From xen-changelog-bounces@lists.xenproject.org Mon Feb 01 15:22:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Feb 2021 15:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.79968.145937 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l6b1i-0006Cs-FI; Mon, 01 Feb 2021 15:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 79968.145937; Mon, 01 Feb 2021 15:22:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l6b1i-0006Ck-CF; Mon, 01 Feb 2021 15:22:06 +0000
Received: by outflank-mailman (input) for mailman id 79968;
 Mon, 01 Feb 2021 15:22:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6b1h-0006Bn-4x
 for xen-changelog@lists.xenproject.org; Mon, 01 Feb 2021 15:22:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6b1h-0004Xl-39
 for xen-changelog@lists.xenproject.org; Mon, 01 Feb 2021 15:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6b1h-0005dd-0v
 for xen-changelog@lists.xenproject.org; Mon, 01 Feb 2021 15:22:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ccQDvyFaa16DgSeWm8K9a7IVLoD7nsNyUemfS5NFs3I=; b=nDrY19SpGztyjHhg1w0m61Hghz
	HBUCUeRp2g0+2I0A6fMqb3/KpsBIcNdm0AZXIb+JUCxIsICisd0Fv6Oh/RupEV+n8U9W/xliisD2d
	kbA9tMGttH7DajLFL0PkA5cen37ESTCwYP/3XlXRsg8BqmfWKC4VzYF6TU6zb5Lg002M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xenpmd.c: use dynamic allocation
Message-Id: <E1l6b1h-0005dd-0v@xenbits.xenproject.org>
Date: Mon, 01 Feb 2021 15:22:05 +0000

commit bbed98e7cedcd5072671c21605330075740382d3
Author:     Manuel Bouyer <bouyer@netbsd.org>
AuthorDate: Sat Jan 30 19:27:10 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Feb 1 15:10:00 2021 +0000

    xenpmd.c: use dynamic allocation
    
    On NetBSD, d_name is larger than 256, so file_name[284] may not be large
    enough (and gcc emits a format-truncation error).
    Use asprintf() instead of snprintf() on a static on-stack buffer.
    
    Signed-off-by: Manuel Bouyer <bouyer@netbsd.org>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    
    Plus
    
    define GNU_SOURCE for asprintf()
    
    Harmless on NetBSD.
    
    Signed-off-by: Manuel Bouyer <bouyer@netbsd.org>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xenpmd/xenpmd.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c
index 12b82cf43e..8e783181e1 100644
--- a/tools/xenpmd/xenpmd.c
+++ b/tools/xenpmd/xenpmd.c
@@ -32,6 +32,7 @@
  * passed to the guest when appropriate battery ports are read/written to.
  */
 
+#define _GNU_SOURCE         /* for asprintf() */
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
@@ -101,7 +102,7 @@ FILE *get_next_battery_file(DIR *battery_dir,
 {
     FILE *file = 0;
     struct dirent *dir_entries;
-    char file_name[284];
+    char *file_name;
     int ret;
     
     do 
@@ -112,16 +113,16 @@ FILE *get_next_battery_file(DIR *battery_dir,
         if ( strlen(dir_entries->d_name) < 4 )
             continue;
         if ( battery_info_type == BIF ) 
-            ret = snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH,
+            ret = asprintf(&file_name, BATTERY_INFO_FILE_PATH,
                      dir_entries->d_name);
         else 
-            ret = snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
+            ret = asprintf(&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");
+	free(file_name);
     } while ( !file );
 
     return file;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Feb 01 15:22:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Feb 2021 15:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.79969.145941 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l6b1s-0006Fm-Gg; Mon, 01 Feb 2021 15:22:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 79969.145941; Mon, 01 Feb 2021 15:22:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l6b1s-0006Fe-Dg; Mon, 01 Feb 2021 15:22:16 +0000
Received: by outflank-mailman (input) for mailman id 79969;
 Mon, 01 Feb 2021 15:22:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6b1r-0006FI-6q
 for xen-changelog@lists.xenproject.org; Mon, 01 Feb 2021 15:22:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6b1r-0004Xo-64
 for xen-changelog@lists.xenproject.org; Mon, 01 Feb 2021 15:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6b1r-0005eP-5F
 for xen-changelog@lists.xenproject.org; Mon, 01 Feb 2021 15:22:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+5jzPDeSrrpaVmpmqbzc+4FFe+qiPcAuS6YMq84dhBY=; b=L/AtLkpArWfhmt3nnvfYj0kebA
	Ieso7jQxRJFwULFRE+t91UwDDD+1Yr0pzqnUgdeLRrM/S3wH0E8CM7rP/ihYFRNWPC+3FoYLp6uo1
	RHhBxVxX90YqtQZuheLwvCsrhYHAcUgNfA7Z8IdLZLLvIKbhZWqzVD6u+wsZ8IwRjGBM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xenpmd.c: Remove hard tab
Message-Id: <E1l6b1r-0005eP-5F@xenbits.xenproject.org>
Date: Mon, 01 Feb 2021 15:22:15 +0000

commit 419cd07895891c6642f29085aee07be72413f08c
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Mon Feb 1 15:18:36 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Feb 1 15:18:36 2021 +0000

    xenpmd.c: Remove hard tab
    
    bbed98e7cedc "xenpmd.c: use dynamic allocation" had a hard tab.
    I thought we had fixed that and I thought I had checked.
    Remove it now.
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xenpmd/xenpmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c
index 8e783181e1..15e6169c44 100644
--- a/tools/xenpmd/xenpmd.c
+++ b/tools/xenpmd/xenpmd.c
@@ -122,7 +122,7 @@ FILE *get_next_battery_file(DIR *battery_dir,
         if (ret < 0)
             continue;
         file = fopen(file_name, "r");
-	free(file_name);
+        free(file_name);
     } while ( !file );
 
     return file;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Feb 01 18:33:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Feb 2021 18:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.80091.146211 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l6e0Y-00031w-Lm; Mon, 01 Feb 2021 18:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 80091.146211; Mon, 01 Feb 2021 18:33:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l6e0Y-00031o-Il; Mon, 01 Feb 2021 18:33:06 +0000
Received: by outflank-mailman (input) for mailman id 80091;
 Mon, 01 Feb 2021 18: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 1l6e0X-00031j-5w
 for xen-changelog@lists.xenproject.org; Mon, 01 Feb 2021 18: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 1l6e0X-0000Fz-3O
 for xen-changelog@lists.xenproject.org; Mon, 01 Feb 2021 18:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6e0X-0000wn-17
 for xen-changelog@lists.xenproject.org; Mon, 01 Feb 2021 18:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BxYnCnXiwVuU9Ib42SRBinmPUr99meVeArocts74U94=; b=kgSt87yBFpR3PMl5aXcX/q6PFK
	7X7b19brDFWov5BN1+o387Fm61zzwSyuvsI2e8pTEqy5uoZxkD0t2+zvj3O+Oyy7G7AqB2t4bK387
	46DhDXJ2+z0kb3S5gqiJKjirqdesDqIWszbKG7CrBumOGEVuVpzEdDhc+9ywJ96lTZ6w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xenstore: fix build on {Net/Free}BSD
Message-Id: <E1l6e0X-0000wn-17@xenbits.xenproject.org>
Date: Mon, 01 Feb 2021 18:33:05 +0000

commit ffbb8aa282de262403275f2395d8540818cf576e
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Feb 1 16:53:17 2021 +0100
Commit:     Wei Liu <wl@xen.org>
CommitDate: Mon Feb 1 18:27:50 2021 +0000

    xenstore: fix build on {Net/Free}BSD
    
    The endian.h header is in sys/ on NetBSD and FreeBSD.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xenstore/include/xenstore_state.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/xenstore/include/xenstore_state.h b/tools/xenstore/include/xenstore_state.h
index d2a9307400..1bd443f61a 100644
--- a/tools/xenstore/include/xenstore_state.h
+++ b/tools/xenstore/include/xenstore_state.h
@@ -21,7 +21,11 @@
 #ifndef XENSTORE_STATE_H
 #define XENSTORE_STATE_H
 
+#if defined(__FreeBSD__) || defined(__NetBSD__)
+#include <sys/endian.h>
+#else
 #include <endian.h>
+#endif
 #include <sys/types.h>
 
 #ifndef htobe32
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 02 10:44:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Feb 2021 10:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.80474.147239 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l6tAE-0006r3-U5; Tue, 02 Feb 2021 10:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 80474.147239; Tue, 02 Feb 2021 10:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l6tAE-0006qv-RA; Tue, 02 Feb 2021 10:44:06 +0000
Received: by outflank-mailman (input) for mailman id 80474;
 Tue, 02 Feb 2021 10:44:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6tAD-0006qp-1K
 for xen-changelog@lists.xenproject.org; Tue, 02 Feb 2021 10:44:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6tAC-00036t-W0
 for xen-changelog@lists.xenproject.org; Tue, 02 Feb 2021 10:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6tAC-0006vL-UI
 for xen-changelog@lists.xenproject.org; Tue, 02 Feb 2021 10:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=E3GPXct1XCwsYCWep8NVxRbcrLhzfkJP5ns/dp5bym8=; b=sk4DuIKtrFVFerGPBgpXqjdEqK
	BLY+bJgZBW30C/HMFJ0rRhuJLU65bCjBkDGnkQVRjs82bCBdDRPB9+8F4Ix4DnrFxfmkUUDmc0jdE
	Pjd572rsHIVs32XyCi6o89FULiwK+v65LB+VWjzG9qVE2v3/CzRYtixn+Tw0wjfBtf7Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xenstore: Fix all builds
Message-Id: <E1l6tAC-0006vL-UI@xenbits.xenproject.org>
Date: Tue, 02 Feb 2021 10:44:04 +0000

commit 3b6c0a9f42525e8e50d5988d8c7fa47e56bc7d1d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 2 11:33:26 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 2 11:33:26 2021 +0100

    xenstore: Fix all builds
    
    This diff is easier viewed through `cat -A`
    
      diff --git a/tools/xenstore/include/xenstore_state.h b/tools/xenstore/include/xenstore_state.h$
      index 1bd443f61a..f7e4da2b2c 100644$
      --- a/tools/xenstore/include/xenstore_state.h$
      +++ b/tools/xenstore/include/xenstore_state.h$
      @@ -21,7 +21,7 @@$
       #ifndef XENSTORE_STATE_H$
       #define XENSTORE_STATE_H$
       $
      -#if defined(__FreeBSD__) ||M-BM- defined(__NetBSD__)$
      +#if defined(__FreeBSD__) || defined(__NetBSD__)$
       #include <sys/endian.h>$
       #else$
       #include <endian.h>$
    
    A non-breaking space isn't a valid C preprocessor token.
    
    Fixes: ffbb8aa282de ("xenstore: fix build on {Net/Free}BSD")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/xenstore/include/xenstore_state.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenstore/include/xenstore_state.h b/tools/xenstore/include/xenstore_state.h
index 1bd443f61a..f7e4da2b2c 100644
--- a/tools/xenstore/include/xenstore_state.h
+++ b/tools/xenstore/include/xenstore_state.h
@@ -21,7 +21,7 @@
 #ifndef XENSTORE_STATE_H
 #define XENSTORE_STATE_H
 
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 #include <sys/endian.h>
 #else
 #include <endian.h>
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 02 10:44:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Feb 2021 10:44:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.80475.147243 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l6tAO-0006s4-Vr; Tue, 02 Feb 2021 10:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 80475.147243; Tue, 02 Feb 2021 10:44:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l6tAO-0006rw-Sj; Tue, 02 Feb 2021 10:44:16 +0000
Received: by outflank-mailman (input) for mailman id 80475;
 Tue, 02 Feb 2021 10:44:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6tAN-0006rn-3a
 for xen-changelog@lists.xenproject.org; Tue, 02 Feb 2021 10:44:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6tAN-00036w-2m
 for xen-changelog@lists.xenproject.org; Tue, 02 Feb 2021 10:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6tAN-0006w2-1y
 for xen-changelog@lists.xenproject.org; Tue, 02 Feb 2021 10:44:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NQQovPpP7Bjj3flK5kRhcZQOHYl+ddo+QB7syDMNtQQ=; b=0aB+txzUnB4ffpmWvL86gWEspH
	QbRqu/4Su5KpooLXW+QL/wr7s6hPr5kIpYVFf1KmwhK9x5FWit5uMLZ85aOUH2Y3nLlcWqzW9K8Ed
	nm1Ech+FGRHW4kJKcMqHOJLB/PX9b5TfMSC/NxYyOjm1h/MU49krSHEbmIA3qSOCMPr0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] memory: fix build with COVERAGE but !HVM
Message-Id: <E1l6tAN-0006w2-1y@xenbits.xenproject.org>
Date: Tue, 02 Feb 2021 10:44:15 +0000

commit 119c98972c4e737508df827bbbc8453cc93292c7
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Feb 2 11:35:42 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 2 11:35:42 2021 +0100

    memory: fix build with COVERAGE but !HVM
    
    Xen is heavily relying on the DCE stage to remove unused code so the
    linker doesn't throw an error because a function is not implemented
    yet we defined a prototype for it.
    
    On some GCC versions (such as 9.4 provided by Debian sid), the compiler
    DCE stage will not manage to figure that out for
    xenmem_add_to_physmap_batch():
    
    ld: ld: prelink.o: in function `xenmem_add_to_physmap_batch':
    /xen/xen/common/memory.c:942: undefined reference to `xenmem_add_to_physmap_one'
    /xen/xen/common/memory.c:942:(.text+0x22145): relocation truncated
    to fit: R_X86_64_PLT32 against undefined symbol `xenmem_add_to_physmap_one'
    prelink-efi.o: in function `xenmem_add_to_physmap_batch':
    /xen/xen/common/memory.c:942: undefined reference to `xenmem_add_to_physmap_one'
    make[2]: *** [Makefile:215: /root/xen/xen/xen.efi] Error 1
    make[2]: *** Waiting for unfinished jobs....
    ld: /xen/xen/.xen-syms.0: hidden symbol `xenmem_add_to_physmap_one' isn't defined
    ld: final link failed: bad value
    
    It is not entirely clear why the compiler DCE is not detecting the
    unused code. However, cloning the check introduced by the commit below
    into xenmem_add_to_physmap_batch() does the trick.
    
    No functional change intended.
    
    Fixes: d4f699a0df6c ("x86/mm: p2m_add_foreign() is HVM-only")
    Reported-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Wei Liu <wl@xen.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/common/memory.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index 01cab7e493..f23b001fd2 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -904,6 +904,17 @@ static int xenmem_add_to_physmap_batch(struct domain *d,
 {
     union add_to_physmap_extra extra = {};
 
+    /*
+     * In some configurations, (!HVM, COVERAGE), the xenmem_add_to_physmap_one()
+     * call doesn't succumb to dead-code-elimination. Duplicate the short-circut
+     * from xatp_permission_check() to try and help the compiler out.
+     */
+    if ( !paging_mode_translate(d) )
+    {
+        ASSERT_UNREACHABLE();
+        return -EACCES;
+    }
+
     if ( unlikely(xatpb->size < extent) )
         return -EILSEQ;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 02 10:44:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Feb 2021 10:44:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.80476.147248 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l6tAZ-0006tV-1P; Tue, 02 Feb 2021 10:44:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 80476.147248; Tue, 02 Feb 2021 10:44:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l6tAY-0006tJ-UK; Tue, 02 Feb 2021 10:44:26 +0000
Received: by outflank-mailman (input) for mailman id 80476;
 Tue, 02 Feb 2021 10:44:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6tAX-0006t3-Ck
 for xen-changelog@lists.xenproject.org; Tue, 02 Feb 2021 10:44:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6tAX-000379-BV
 for xen-changelog@lists.xenproject.org; Tue, 02 Feb 2021 10:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6tAX-0006yO-9k
 for xen-changelog@lists.xenproject.org; Tue, 02 Feb 2021 10:44:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=j39vehztoFt4kDxkE/y5tYcsXIlRzh7HuH2WwafKu9o=; b=0ambYh9aD3AByqckT6pRqQqB2M
	OLgpNiKjhgogBn+57VG4zVC/GbJUxJo0HU1RIpGu8FcHpVfiWTNPUyzdjtIv/CPZUtt2kyHba5POK
	g5g7NBHOje6zHEjs5Sj6Sns7QTY00RP2ZGVdZlhjC23Dtf+EdvuazmyfsUDa/WkiXF0o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xenstore: Fix all builds
Message-Id: <E1l6tAX-0006yO-9k@xenbits.xenproject.org>
Date: Tue, 02 Feb 2021 10:44:25 +0000

commit 42d50392bf49b3d9d2edb6378f903232dc238feb
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 1 23:30:51 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 2 10:34:10 2021 +0000

    xenstore: Fix all builds
    
    This diff is easier viewed through `cat -A`
    
      diff --git a/tools/xenstore/include/xenstore_state.h b/tools/xenstore/include/xenstore_state.h$
      index 1bd443f61a..f7e4da2b2c 100644$
      --- a/tools/xenstore/include/xenstore_state.h$
      +++ b/tools/xenstore/include/xenstore_state.h$
      @@ -21,7 +21,7 @@$
       #ifndef XENSTORE_STATE_H$
       #define XENSTORE_STATE_H$
       $
      -#if defined(__FreeBSD__) ||M-BM- defined(__NetBSD__)$
      +#if defined(__FreeBSD__) || defined(__NetBSD__)$
       #include <sys/endian.h>$
       #else$
       #include <endian.h>$
    
    A non-breaking space isn't a valid C preprocessor token.
    
    Fixes: ffbb8aa282de ("xenstore: fix build on {Net/Free}BSD")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/xenstore/include/xenstore_state.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenstore/include/xenstore_state.h b/tools/xenstore/include/xenstore_state.h
index 1bd443f61a..f7e4da2b2c 100644
--- a/tools/xenstore/include/xenstore_state.h
+++ b/tools/xenstore/include/xenstore_state.h
@@ -21,7 +21,7 @@
 #ifndef XENSTORE_STATE_H
 #define XENSTORE_STATE_H
 
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 #include <sys/endian.h>
 #else
 #include <endian.h>
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 02 10:44:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Feb 2021 10:44:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.80477.147251 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l6tAj-0006uv-2j; Tue, 02 Feb 2021 10:44:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 80477.147251; Tue, 02 Feb 2021 10:44:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l6tAi-0006ul-Vr; Tue, 02 Feb 2021 10:44:36 +0000
Received: by outflank-mailman (input) for mailman id 80477;
 Tue, 02 Feb 2021 10:44:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6tAh-0006uZ-F6
 for xen-changelog@lists.xenproject.org; Tue, 02 Feb 2021 10:44:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6tAh-00037G-EI
 for xen-changelog@lists.xenproject.org; Tue, 02 Feb 2021 10:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6tAh-0006zK-DU
 for xen-changelog@lists.xenproject.org; Tue, 02 Feb 2021 10:44:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RPo8UUE7jHFZRVWMGwuB5BUHi58P8uLWeHU7NFxYMsE=; b=yL/8FhyWGeIcFN7tvgOBtjHnUp
	pLDDDeRD/14dcaB35+g3Hu27V9sEu5ZwGOQn0NxI+QYqXO9bs0pRLHadyGbiI+UXn1Ytudpn6Y3H3
	UW5IkK8OKzdh4srsu6a8pGgENwZLK2uZgrUZtIcMhWS6raw+/1uCgZ+xEUCpa8jebk44=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Merge branch 'staging' of xenbits.xen.org:/home/xen/git/xen into staging
Message-Id: <E1l6tAh-0006zK-DU@xenbits.xenproject.org>
Date: Tue, 02 Feb 2021 10:44:35 +0000

commit 7978d05dbc35373a2e50472f775c9995897fe6c1
Merge: 119c98972c4e737508df827bbbc8453cc93292c7 42d50392bf49b3d9d2edb6378f903232dc238feb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 2 11:36:28 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 2 11:36:28 2021 +0100

    Merge branch 'staging' of xenbits.xen.org:/home/xen/git/xen into staging

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


From xen-changelog-bounces@lists.xenproject.org Tue Feb 02 10:44:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Feb 2021 10:44:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.80478.147255 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l6tAt-0006wE-3w; Tue, 02 Feb 2021 10:44:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 80478.147255; Tue, 02 Feb 2021 10:44:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l6tAt-0006w5-10; Tue, 02 Feb 2021 10:44:47 +0000
Received: by outflank-mailman (input) for mailman id 80478;
 Tue, 02 Feb 2021 10:44:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6tAr-0006vv-Hu
 for xen-changelog@lists.xenproject.org; Tue, 02 Feb 2021 10:44:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6tAr-00037h-HB
 for xen-changelog@lists.xenproject.org; Tue, 02 Feb 2021 10:44:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l6tAr-00070E-GK
 for xen-changelog@lists.xenproject.org; Tue, 02 Feb 2021 10:44:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=X6YQMvBT0esdt8vcdqoR7JWkfLJWJjQNxQFDcoIfVA8=; b=jEJQB+Zj4lWOKMjmdWMYUPRGV7
	A05I8LTIHEzeDOUQUTn5Rcrk0OfV/ouht2r55PKr71zvwdm4joqNHVJ3V2E6FcXPdXhEWXLh6V6jg
	nQEkrhQdoaw4AMHy3CwS/AZgTNOfbu4T1ijWaU4X1y7o/LPLVdvE6hD5ikkne2Leziao=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/build: correctly record dependencies of asm-offsets.s
Message-Id: <E1l6tAr-00070E-GK@xenbits.xenproject.org>
Date: Tue, 02 Feb 2021 10:44:45 +0000

commit 5e7aa904405fa2f268c3af213516bae271de3265
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 2 11:36:50 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 2 11:36:50 2021 +0100

    x86/build: correctly record dependencies of asm-offsets.s
    
    Going through an intermediate *.new file requires telling the compiler
    what the real target is, so that the inclusion of the resulting .*.d
    file will actually be useful.
    
    Fixes: 7d2d7a43d014 ("x86/build: limit rebuilding of asm-offsets.h")
    Reported-by: Julien Grall <julien@xen.org>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 7769bb40d7..3a9b7e7b2e 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -241,7 +241,7 @@ efi/buildid.o efi/relocs-dummy.o: $(BASEDIR)/arch/x86/efi/built_in.o
 efi/buildid.o efi/relocs-dummy.o: ;
 
 asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(BASEDIR)/include/asm-x86/asm-macros.h
-	$(CC) $(filter-out -Wa$(comma)% -flto,$(c_flags)) -S -g0 -o $@.new $<
+	$(CC) $(filter-out -Wa$(comma)% -flto,$(c_flags)) -S -g0 -o $@.new -MQ $@ $<
 	$(call move-if-changed,$@.new,$@)
 
 asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 03 08:11:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Feb 2021 08:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.80843.148144 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7DFf-0007Nu-Cr; Wed, 03 Feb 2021 08:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 80843.148144; Wed, 03 Feb 2021 08:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7DFf-0007Nm-9g; Wed, 03 Feb 2021 08:11:03 +0000
Received: by outflank-mailman (input) for mailman id 80843;
 Wed, 03 Feb 2021 08:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DFe-0007Nh-EB
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DFe-0003Ra-B6
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DFe-00025L-9H
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kjBoCwyW8k4vwrxIAisdlWl1M+Hxlag0ZcRG7FEAw54=; b=Tm6rlvLyYzWleD4dqHj/pRWDBV
	XW3HEyEyBHGVAW0pO21+04YC9qxt8lwPl+5qS+Zz7zV44xpyw0nWto3UjbYarwvMyjr2XoCiM6FBv
	uLq7rGGflj2Qp4nCNXa7py/0eYpJ1ai1SVMLrY0tcAafwrawX+1NPElhVHlSrgJwYyoo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xenpmd.c: use dynamic allocation
Message-Id: <E1l7DFe-00025L-9H@xenbits.xenproject.org>
Date: Wed, 03 Feb 2021 08:11:02 +0000

commit bbed98e7cedcd5072671c21605330075740382d3
Author:     Manuel Bouyer <bouyer@netbsd.org>
AuthorDate: Sat Jan 30 19:27:10 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Feb 1 15:10:00 2021 +0000

    xenpmd.c: use dynamic allocation
    
    On NetBSD, d_name is larger than 256, so file_name[284] may not be large
    enough (and gcc emits a format-truncation error).
    Use asprintf() instead of snprintf() on a static on-stack buffer.
    
    Signed-off-by: Manuel Bouyer <bouyer@netbsd.org>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    
    Plus
    
    define GNU_SOURCE for asprintf()
    
    Harmless on NetBSD.
    
    Signed-off-by: Manuel Bouyer <bouyer@netbsd.org>
    Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xenpmd/xenpmd.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c
index 12b82cf43e..8e783181e1 100644
--- a/tools/xenpmd/xenpmd.c
+++ b/tools/xenpmd/xenpmd.c
@@ -32,6 +32,7 @@
  * passed to the guest when appropriate battery ports are read/written to.
  */
 
+#define _GNU_SOURCE         /* for asprintf() */
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
@@ -101,7 +102,7 @@ FILE *get_next_battery_file(DIR *battery_dir,
 {
     FILE *file = 0;
     struct dirent *dir_entries;
-    char file_name[284];
+    char *file_name;
     int ret;
     
     do 
@@ -112,16 +113,16 @@ FILE *get_next_battery_file(DIR *battery_dir,
         if ( strlen(dir_entries->d_name) < 4 )
             continue;
         if ( battery_info_type == BIF ) 
-            ret = snprintf(file_name, sizeof(file_name), BATTERY_INFO_FILE_PATH,
+            ret = asprintf(&file_name, BATTERY_INFO_FILE_PATH,
                      dir_entries->d_name);
         else 
-            ret = snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
+            ret = asprintf(&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");
+	free(file_name);
     } while ( !file );
 
     return file;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 03 08:11:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Feb 2021 08:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.80844.148149 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7DFp-0007P0-FY; Wed, 03 Feb 2021 08:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 80844.148149; Wed, 03 Feb 2021 08:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7DFp-0007Or-BK; Wed, 03 Feb 2021 08:11:13 +0000
Received: by outflank-mailman (input) for mailman id 80844;
 Wed, 03 Feb 2021 08:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DFo-0007Oj-F4
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DFo-0003Rd-EG
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DFo-00025u-D9
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=s6SPOK4rVRbrxFLr55y8+7U32jAB4XHu6cgweQl/eSk=; b=mjHnoKPZnAyb4/jKWjsjEQxybR
	jZ37STLhCWNmSx5mbG5jfJWeCtvHNvnJe7E3SWOi9S+T2O1rKv7LB/5BB7mhunZ2Azz79TeHN5ueT
	On5vN1p/mU34Udsdnw84Df/qS6brtFjf8pXxBOMTiJkgJWmY4jShTMYNODQ5PsgmIsEI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xenpmd.c: Remove hard tab
Message-Id: <E1l7DFo-00025u-D9@xenbits.xenproject.org>
Date: Wed, 03 Feb 2021 08:11:12 +0000

commit 419cd07895891c6642f29085aee07be72413f08c
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Mon Feb 1 15:18:36 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Feb 1 15:18:36 2021 +0000

    xenpmd.c: Remove hard tab
    
    bbed98e7cedc "xenpmd.c: use dynamic allocation" had a hard tab.
    I thought we had fixed that and I thought I had checked.
    Remove it now.
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xenpmd/xenpmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c
index 8e783181e1..15e6169c44 100644
--- a/tools/xenpmd/xenpmd.c
+++ b/tools/xenpmd/xenpmd.c
@@ -122,7 +122,7 @@ FILE *get_next_battery_file(DIR *battery_dir,
         if (ret < 0)
             continue;
         file = fopen(file_name, "r");
-	free(file_name);
+        free(file_name);
     } while ( !file );
 
     return file;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 03 08:11:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Feb 2021 08:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.80845.148152 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7DFz-0007QG-Fg; Wed, 03 Feb 2021 08:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 80845.148152; Wed, 03 Feb 2021 08:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7DFz-0007Q8-Co; Wed, 03 Feb 2021 08:11:23 +0000
Received: by outflank-mailman (input) for mailman id 80845;
 Wed, 03 Feb 2021 08:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DFy-0007Q0-I8
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DFy-0003Rq-HJ
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DFy-00026T-GO
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xrIMp3XAV2J1cVGNUHvIWMYZbumJCz1a0jjOgCibw/g=; b=ncCz4As9H0ZtVZldCYoSttOggU
	hxudITt0pay9viJAZShWDN2mfZ7APsw4XUiIvXaBNGZ+FWldBLgeBUf85eX9vg8D6WjUw7fj5gFuG
	hgEwPZtkaOwUH7AUuIUzlL3PPbLRXfK+La703RS0FZ4e7gOIgpScRiSzqwkARZwSRhIA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xenstore: fix build on {Net/Free}BSD
Message-Id: <E1l7DFy-00026T-GO@xenbits.xenproject.org>
Date: Wed, 03 Feb 2021 08:11:22 +0000

commit ffbb8aa282de262403275f2395d8540818cf576e
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Feb 1 16:53:17 2021 +0100
Commit:     Wei Liu <wl@xen.org>
CommitDate: Mon Feb 1 18:27:50 2021 +0000

    xenstore: fix build on {Net/Free}BSD
    
    The endian.h header is in sys/ on NetBSD and FreeBSD.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xenstore/include/xenstore_state.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/xenstore/include/xenstore_state.h b/tools/xenstore/include/xenstore_state.h
index d2a9307400..1bd443f61a 100644
--- a/tools/xenstore/include/xenstore_state.h
+++ b/tools/xenstore/include/xenstore_state.h
@@ -21,7 +21,11 @@
 #ifndef XENSTORE_STATE_H
 #define XENSTORE_STATE_H
 
+#if defined(__FreeBSD__) || defined(__NetBSD__)
+#include <sys/endian.h>
+#else
 #include <endian.h>
+#endif
 #include <sys/types.h>
 
 #ifndef htobe32
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 03 08:11:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Feb 2021 08:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.80846.148156 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7DGA-0007RR-Hi; Wed, 03 Feb 2021 08:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 80846.148156; Wed, 03 Feb 2021 08:11:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7DGA-0007RI-EY; Wed, 03 Feb 2021 08:11:34 +0000
Received: by outflank-mailman (input) for mailman id 80846;
 Wed, 03 Feb 2021 08:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DG8-0007R6-LP
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DG8-0003S0-KY
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DG8-00027I-JI
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=w2gKDGRQmoyuu3uFjBkqCExtWqWcH4Ns9sZbKp1av9Y=; b=FLO1yl83ZMSUCZixEmwvCGSGwa
	8GzmENn/ZdZBY7ClbYYrHyxpShoXWw05sA8vAQPm6TA4j8DviUr1IW9ZvGZfOSWxq9V1YoQlPn7AP
	aOhEaPpi0rBNmZhN8vZPrBErPuZ7nrioj1BFE/iJHNDaRD7mq+lXgywE7xEah2Ms7j5s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xenstore: Fix all builds
Message-Id: <E1l7DG8-00027I-JI@xenbits.xenproject.org>
Date: Wed, 03 Feb 2021 08:11:32 +0000

commit 3b6c0a9f42525e8e50d5988d8c7fa47e56bc7d1d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 2 11:33:26 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 2 11:33:26 2021 +0100

    xenstore: Fix all builds
    
    This diff is easier viewed through `cat -A`
    
      diff --git a/tools/xenstore/include/xenstore_state.h b/tools/xenstore/include/xenstore_state.h$
      index 1bd443f61a..f7e4da2b2c 100644$
      --- a/tools/xenstore/include/xenstore_state.h$
      +++ b/tools/xenstore/include/xenstore_state.h$
      @@ -21,7 +21,7 @@$
       #ifndef XENSTORE_STATE_H$
       #define XENSTORE_STATE_H$
       $
      -#if defined(__FreeBSD__) ||M-BM- defined(__NetBSD__)$
      +#if defined(__FreeBSD__) || defined(__NetBSD__)$
       #include <sys/endian.h>$
       #else$
       #include <endian.h>$
    
    A non-breaking space isn't a valid C preprocessor token.
    
    Fixes: ffbb8aa282de ("xenstore: fix build on {Net/Free}BSD")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/xenstore/include/xenstore_state.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenstore/include/xenstore_state.h b/tools/xenstore/include/xenstore_state.h
index 1bd443f61a..f7e4da2b2c 100644
--- a/tools/xenstore/include/xenstore_state.h
+++ b/tools/xenstore/include/xenstore_state.h
@@ -21,7 +21,7 @@
 #ifndef XENSTORE_STATE_H
 #define XENSTORE_STATE_H
 
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 #include <sys/endian.h>
 #else
 #include <endian.h>
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 03 08:11:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Feb 2021 08:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.80847.148160 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7DGK-0007Su-Je; Wed, 03 Feb 2021 08:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 80847.148160; Wed, 03 Feb 2021 08:11:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7DGK-0007Sk-GB; Wed, 03 Feb 2021 08:11:44 +0000
Received: by outflank-mailman (input) for mailman id 80847;
 Wed, 03 Feb 2021 08:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DGI-0007SX-Pp
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DGI-0003S8-Na
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DGI-000284-Mm
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aW5G6wNl/e0B2pu4J1tfY9z50Diealp+TQn4Du/ThZ4=; b=DDci31tGbhjIFmNfh2gFnEGH0+
	U/6g12eio1biXOqDFuguzlxm988yxG6TIW9acoxvTJU0QoPdlEH7e5sBbgyprAOhVKg9TJYqA11ek
	2CXSrbsojqxWieGm/xQO0itJ7scDFyt9IxLKm0S3fSAl62Bwd5vjzkKPW5lEVugLnTsk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] memory: fix build with COVERAGE but !HVM
Message-Id: <E1l7DGI-000284-Mm@xenbits.xenproject.org>
Date: Wed, 03 Feb 2021 08:11:42 +0000

commit 119c98972c4e737508df827bbbc8453cc93292c7
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Feb 2 11:35:42 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 2 11:35:42 2021 +0100

    memory: fix build with COVERAGE but !HVM
    
    Xen is heavily relying on the DCE stage to remove unused code so the
    linker doesn't throw an error because a function is not implemented
    yet we defined a prototype for it.
    
    On some GCC versions (such as 9.4 provided by Debian sid), the compiler
    DCE stage will not manage to figure that out for
    xenmem_add_to_physmap_batch():
    
    ld: ld: prelink.o: in function `xenmem_add_to_physmap_batch':
    /xen/xen/common/memory.c:942: undefined reference to `xenmem_add_to_physmap_one'
    /xen/xen/common/memory.c:942:(.text+0x22145): relocation truncated
    to fit: R_X86_64_PLT32 against undefined symbol `xenmem_add_to_physmap_one'
    prelink-efi.o: in function `xenmem_add_to_physmap_batch':
    /xen/xen/common/memory.c:942: undefined reference to `xenmem_add_to_physmap_one'
    make[2]: *** [Makefile:215: /root/xen/xen/xen.efi] Error 1
    make[2]: *** Waiting for unfinished jobs....
    ld: /xen/xen/.xen-syms.0: hidden symbol `xenmem_add_to_physmap_one' isn't defined
    ld: final link failed: bad value
    
    It is not entirely clear why the compiler DCE is not detecting the
    unused code. However, cloning the check introduced by the commit below
    into xenmem_add_to_physmap_batch() does the trick.
    
    No functional change intended.
    
    Fixes: d4f699a0df6c ("x86/mm: p2m_add_foreign() is HVM-only")
    Reported-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Wei Liu <wl@xen.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/common/memory.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index 01cab7e493..f23b001fd2 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -904,6 +904,17 @@ static int xenmem_add_to_physmap_batch(struct domain *d,
 {
     union add_to_physmap_extra extra = {};
 
+    /*
+     * In some configurations, (!HVM, COVERAGE), the xenmem_add_to_physmap_one()
+     * call doesn't succumb to dead-code-elimination. Duplicate the short-circut
+     * from xatp_permission_check() to try and help the compiler out.
+     */
+    if ( !paging_mode_translate(d) )
+    {
+        ASSERT_UNREACHABLE();
+        return -EACCES;
+    }
+
     if ( unlikely(xatpb->size < extent) )
         return -EILSEQ;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 03 08:11:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Feb 2021 08:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.80848.148164 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7DGU-0007UM-L0; Wed, 03 Feb 2021 08:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 80848.148164; Wed, 03 Feb 2021 08:11:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7DGU-0007UE-Hn; Wed, 03 Feb 2021 08:11:54 +0000
Received: by outflank-mailman (input) for mailman id 80848;
 Wed, 03 Feb 2021 08:11:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DGT-0007U0-0i
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:11:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DGS-0003SJ-VM
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DGS-00028r-Ue
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7I3/t6CaF5IIw2sIzuL/8zVIFzbE+n/4p2IR/zIGsQ8=; b=Hl2LUOnqsJLvt1gBvk9lNdcS6s
	jhojMvLw81sOoQq/mo8OGnTEUXZplqGBZdRVleoVRqQRgn5PX3Kt8/sPwvbBTX9urtis1UWxNdHHM
	ad3lDsWIrgZcsDhHFM7lvxQnOpgr5opR7k6P6p082mg5KtchJyGyintKbxbdZpNJkmDE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xenstore: Fix all builds
Message-Id: <E1l7DGS-00028r-Ue@xenbits.xenproject.org>
Date: Wed, 03 Feb 2021 08:11:52 +0000

commit 42d50392bf49b3d9d2edb6378f903232dc238feb
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 1 23:30:51 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 2 10:34:10 2021 +0000

    xenstore: Fix all builds
    
    This diff is easier viewed through `cat -A`
    
      diff --git a/tools/xenstore/include/xenstore_state.h b/tools/xenstore/include/xenstore_state.h$
      index 1bd443f61a..f7e4da2b2c 100644$
      --- a/tools/xenstore/include/xenstore_state.h$
      +++ b/tools/xenstore/include/xenstore_state.h$
      @@ -21,7 +21,7 @@$
       #ifndef XENSTORE_STATE_H$
       #define XENSTORE_STATE_H$
       $
      -#if defined(__FreeBSD__) ||M-BM- defined(__NetBSD__)$
      +#if defined(__FreeBSD__) || defined(__NetBSD__)$
       #include <sys/endian.h>$
       #else$
       #include <endian.h>$
    
    A non-breaking space isn't a valid C preprocessor token.
    
    Fixes: ffbb8aa282de ("xenstore: fix build on {Net/Free}BSD")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/xenstore/include/xenstore_state.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenstore/include/xenstore_state.h b/tools/xenstore/include/xenstore_state.h
index 1bd443f61a..f7e4da2b2c 100644
--- a/tools/xenstore/include/xenstore_state.h
+++ b/tools/xenstore/include/xenstore_state.h
@@ -21,7 +21,7 @@
 #ifndef XENSTORE_STATE_H
 #define XENSTORE_STATE_H
 
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 #include <sys/endian.h>
 #else
 #include <endian.h>
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 03 08:12:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Feb 2021 08:12:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.80849.148167 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7DGe-0007Vu-MQ; Wed, 03 Feb 2021 08:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 80849.148167; Wed, 03 Feb 2021 08:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7DGe-0007Vm-JQ; Wed, 03 Feb 2021 08:12:04 +0000
Received: by outflank-mailman (input) for mailman id 80849;
 Wed, 03 Feb 2021 08:12:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DGd-0007VN-3a
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:12:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DGd-0003Ss-2j
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:12:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DGd-00029f-1E
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:12:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8bQHFaLX5uaabngkF4fV37T9hQLgOo2NwJLLO5F6NIc=; b=EX2rFcMdDuneHdvmul4TtFQW3o
	N1zSxVlOKBf4yV+lbU8SIorTkExiBxx2Qxv10ez2JAWH0NLOen5LqDynH97b98J1FeQ+IIQBgjh9H
	mX727eIPrp2nhbNaj3rgXWvtPpwwi85T1h/kvh0PbKIFfzXzWFa6i5gfr58W0Uz9qE5Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Merge branch 'staging' of xenbits.xen.org:/home/xen/git/xen into staging
Message-Id: <E1l7DGd-00029f-1E@xenbits.xenproject.org>
Date: Wed, 03 Feb 2021 08:12:03 +0000

commit 7978d05dbc35373a2e50472f775c9995897fe6c1
Merge: 119c98972c4e737508df827bbbc8453cc93292c7 42d50392bf49b3d9d2edb6378f903232dc238feb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 2 11:36:28 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 2 11:36:28 2021 +0100

    Merge branch 'staging' of xenbits.xen.org:/home/xen/git/xen into staging

--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 03 08:12:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Feb 2021 08:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.80850.148172 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7DGo-0007X3-O2; Wed, 03 Feb 2021 08:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 80850.148172; Wed, 03 Feb 2021 08:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7DGo-0007Wv-Kw; Wed, 03 Feb 2021 08:12:14 +0000
Received: by outflank-mailman (input) for mailman id 80850;
 Wed, 03 Feb 2021 08:12:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DGn-0007Wo-7H
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:12:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DGn-0003T0-6V
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7DGn-0002AC-4o
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 08:12:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7ULqEiqSUOEz1YY1Jypirp3OAWwhV9QuFx66pXryfxA=; b=uER1/FCUXvw9iCVDHXLaFvJuUC
	zglcT1zU+pADlYDVmDhPxRLjULcOf9pFbmjSQzdzOu6e3jG9YPT5LgUpyWWPezdav6LffbUUGaX6P
	Rt1k4LsuM9k15kqWDg0Gn3IH+x/JvPqbJwXQPLtxBVvWIj9N2swzhgbcV1M59hMGXQQM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/build: correctly record dependencies of asm-offsets.s
Message-Id: <E1l7DGn-0002AC-4o@xenbits.xenproject.org>
Date: Wed, 03 Feb 2021 08:12:13 +0000

commit 5e7aa904405fa2f268c3af213516bae271de3265
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 2 11:36:50 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 2 11:36:50 2021 +0100

    x86/build: correctly record dependencies of asm-offsets.s
    
    Going through an intermediate *.new file requires telling the compiler
    what the real target is, so that the inclusion of the resulting .*.d
    file will actually be useful.
    
    Fixes: 7d2d7a43d014 ("x86/build: limit rebuilding of asm-offsets.h")
    Reported-by: Julien Grall <julien@xen.org>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 7769bb40d7..3a9b7e7b2e 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -241,7 +241,7 @@ efi/buildid.o efi/relocs-dummy.o: $(BASEDIR)/arch/x86/efi/built_in.o
 efi/buildid.o efi/relocs-dummy.o: ;
 
 asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(BASEDIR)/include/asm-x86/asm-macros.h
-	$(CC) $(filter-out -Wa$(comma)% -flto,$(c_flags)) -S -g0 -o $@.new $<
+	$(CC) $(filter-out -Wa$(comma)% -flto,$(c_flags)) -S -g0 -o $@.new -MQ $@ $<
 	$(call move-if-changed,$@.new,$@)
 
 asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 03 20:11:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Feb 2021 20:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81053.149044 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7OUT-0001JA-Q4; Wed, 03 Feb 2021 20:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81053.149044; Wed, 03 Feb 2021 20:11:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7OUT-0001J2-Mo; Wed, 03 Feb 2021 20:11:05 +0000
Received: by outflank-mailman (input) for mailman id 81053;
 Wed, 03 Feb 2021 20:11:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7OUS-0001Iw-Sa
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 20:11:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7OUS-0007gm-NU
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 20:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7OUS-00043h-KZ
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 20:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=x73Tu+Yh0FuzjTVzEbOogRsTz6tej6TAWuxKdr1AyBU=; b=2UQn0AElKqLz3oShGP+yBclLij
	fbHuOYWljjeytmuDg08QadHRVoFogaX05XHp6pQXt36tLML7tKmuALcyGBeTr5wDTpIgNpYoGqrU6
	BJf8yF/xZI+m7g1IilqrvevxABW6uPWYfCb13RwqColTgF7KdKB9g1DIijhQ/cxDhK2E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libs/foreignmem: Drop useless and/or misleading logging
Message-Id: <E1l7OUS-00043h-KZ@xenbits.xenproject.org>
Date: Wed, 03 Feb 2021 20:11:04 +0000

commit 9351e1468d67ee79fbc6411b087c67ac34813891
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Feb 3 15:41:55 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 3 19:25:15 2021 +0000

    libs/foreignmem: Drop useless and/or misleading logging
    
    These log lines are all in response to single system calls, and do not provide
    any information which the immediate caller can't determine themselves.  It is
    however rude to put junk like this onto stderr, especially as system call
    failures are not even error conditions in certain circumstances.
    
    The FreeBSD logging has stale function names in, and Solaris shouldn't have
    passed code review to start with.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/foreignmemory/freebsd.c | 7 ++-----
 tools/libs/foreignmemory/linux.c   | 6 +-----
 tools/libs/foreignmemory/netbsd.c  | 2 --
 tools/libs/foreignmemory/solaris.c | 2 +-
 4 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/tools/libs/foreignmemory/freebsd.c b/tools/libs/foreignmemory/freebsd.c
index 9a2796f0b7..04bfa806b0 100644
--- a/tools/libs/foreignmemory/freebsd.c
+++ b/tools/libs/foreignmemory/freebsd.c
@@ -65,10 +65,7 @@ void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem,
 
     addr = mmap(addr, num << PAGE_SHIFT, prot, flags | MAP_SHARED, fd, 0);
     if ( addr == MAP_FAILED )
-    {
-        PERROR("xc_map_foreign_bulk: mmap failed");
         return NULL;
-    }
 
     ioctlx.num = num;
     ioctlx.dom = dom;
@@ -80,7 +77,7 @@ void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem,
     if ( rc < 0 )
     {
         int saved_errno = errno;
-        PERROR("xc_map_foreign_bulk: ioctl failed");
+
         (void)munmap(addr, num << PAGE_SHIFT);
         errno = saved_errno;
         return NULL;
@@ -137,7 +134,7 @@ int osdep_xenforeignmemory_map_resource(xenforeignmemory_handle *fmem,
         int saved_errno;
 
         if ( errno != ENOSYS )
-            PERROR("mmap resource ioctl failed");
+            ;
         else
             errno = EOPNOTSUPP;
 
diff --git a/tools/libs/foreignmemory/linux.c b/tools/libs/foreignmemory/linux.c
index d0eead1196..050b9ed3a5 100644
--- a/tools/libs/foreignmemory/linux.c
+++ b/tools/libs/foreignmemory/linux.c
@@ -171,10 +171,7 @@ void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem,
     addr = mmap(addr, num << PAGE_SHIFT, prot, flags | MAP_SHARED,
                 fd, 0);
     if ( addr == MAP_FAILED )
-    {
-        PERROR("mmap failed");
         return NULL;
-    }
 
     ioctlx.num = num;
     ioctlx.dom = dom;
@@ -273,7 +270,6 @@ void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem,
     {
         int saved_errno = errno;
 
-        PERROR("ioctl failed");
         (void)munmap(addr, num << PAGE_SHIFT);
         errno = saved_errno;
         return NULL;
@@ -330,7 +326,7 @@ int osdep_xenforeignmemory_map_resource(
         int saved_errno;
 
         if ( errno != fmem->unimpl_errno && errno != EOPNOTSUPP )
-            PERROR("ioctl failed");
+            ;
         else
             errno = EOPNOTSUPP;
 
diff --git a/tools/libs/foreignmemory/netbsd.c b/tools/libs/foreignmemory/netbsd.c
index 4ae60aafdd..565682e064 100644
--- a/tools/libs/foreignmemory/netbsd.c
+++ b/tools/libs/foreignmemory/netbsd.c
@@ -147,8 +147,6 @@ int osdep_xenforeignmemory_map_resource(
     rc = ioctl(fmem->fd, IOCTL_PRIVCMD_MMAP_RESOURCE, &mr);
     if ( rc )
     {
-        PERROR("ioctl failed");
-
         if ( fres->addr )
         {
             int saved_errno = errno;
diff --git a/tools/libs/foreignmemory/solaris.c b/tools/libs/foreignmemory/solaris.c
index ee8aae4fbd..958fb01f6d 100644
--- a/tools/libs/foreignmemory/solaris.c
+++ b/tools/libs/foreignmemory/solaris.c
@@ -83,7 +83,7 @@ void *osdep_map_foreign_batch(xenforeignmem_handle *fmem, uint32_t dom,
     if ( ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx) < 0 )
     {
         int saved_errno = errno;
-        PERROR("XXXXXXXX");
+
         (void)munmap(addr, num*XC_PAGE_SIZE);
         errno = saved_errno;
         return NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 03 20:11:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Feb 2021 20:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81055.149046 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7OUd-0001KQ-RF; Wed, 03 Feb 2021 20:11:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81055.149046; Wed, 03 Feb 2021 20:11:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7OUd-0001KI-ON; Wed, 03 Feb 2021 20:11:15 +0000
Received: by outflank-mailman (input) for mailman id 81055;
 Wed, 03 Feb 2021 20:11:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7OUc-0001KA-SR
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 20:11:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7OUc-0007gw-Qb
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 20:11:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7OUc-00044J-Pe
 for xen-changelog@lists.xenproject.org; Wed, 03 Feb 2021 20:11:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hMH9AKzLahiDOJC+qMiI6RLLD3r+4rBYSsQDguwMINc=; b=m2cQPfb9fsZ+AmKn7V+z/jLSRG
	KTDgsVwsOVnksxjuIDMasoYoHeeiFIP+cfyhG7WsY59FoZv48VjZK+Sq2MuIHP56/1TL+nyUwl55X
	FsF+k4p8hnJaCs7xLuJfzMWVBPyHuYys82qRqi13QKiXcjhmFbtOvBMSmVsnkhL+ajeY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libs/foreignmem: Fix/simplify errno handling for map_resource
Message-Id: <E1l7OUc-00044J-Pe@xenbits.xenproject.org>
Date: Wed, 03 Feb 2021 20:11:14 +0000

commit d203dbd69f1a02577dd6fe571d72beb980c548a6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Feb 3 15:43:35 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 3 19:25:35 2021 +0000

    libs/foreignmem: Fix/simplify errno handling for map_resource
    
    Simplify the FreeBSD and Linux logic, left in this state by the previous
    change.  No functional change.
    
    Duplicate the FreeBSD logic for NetBSD, to maintain the uniform ABI for
    callers that EOPNOTSUPP covers all Xen/Kernel support.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/foreignmemory/freebsd.c | 4 +---
 tools/libs/foreignmemory/linux.c   | 4 +---
 tools/libs/foreignmemory/netbsd.c  | 3 +++
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/libs/foreignmemory/freebsd.c b/tools/libs/foreignmemory/freebsd.c
index 04bfa806b0..d94ea07862 100644
--- a/tools/libs/foreignmemory/freebsd.c
+++ b/tools/libs/foreignmemory/freebsd.c
@@ -133,9 +133,7 @@ int osdep_xenforeignmemory_map_resource(xenforeignmemory_handle *fmem,
     {
         int saved_errno;
 
-        if ( errno != ENOSYS )
-            ;
-        else
+        if ( errno == ENOSYS )
             errno = EOPNOTSUPP;
 
         if ( fres->addr )
diff --git a/tools/libs/foreignmemory/linux.c b/tools/libs/foreignmemory/linux.c
index 050b9ed3a5..c1f35e2db7 100644
--- a/tools/libs/foreignmemory/linux.c
+++ b/tools/libs/foreignmemory/linux.c
@@ -325,9 +325,7 @@ int osdep_xenforeignmemory_map_resource(
     {
         int saved_errno;
 
-        if ( errno != fmem->unimpl_errno && errno != EOPNOTSUPP )
-            ;
-        else
+        if ( errno == fmem->unimpl_errno )
             errno = EOPNOTSUPP;
 
         if ( fres->addr )
diff --git a/tools/libs/foreignmemory/netbsd.c b/tools/libs/foreignmemory/netbsd.c
index 565682e064..c0b1b8f79d 100644
--- a/tools/libs/foreignmemory/netbsd.c
+++ b/tools/libs/foreignmemory/netbsd.c
@@ -147,6 +147,9 @@ int osdep_xenforeignmemory_map_resource(
     rc = ioctl(fmem->fd, IOCTL_PRIVCMD_MMAP_RESOURCE, &mr);
     if ( rc )
     {
+        if ( errno == ENOSYS )
+            errno = EOPNOTSUPP;
+
         if ( fres->addr )
         {
             int saved_errno = errno;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 04 13:11:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Feb 2021 13:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81295.149991 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7ePZ-0008Af-ME; Thu, 04 Feb 2021 13:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81295.149991; Thu, 04 Feb 2021 13:11:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7ePZ-0008AW-Ii; Thu, 04 Feb 2021 13:11:05 +0000
Received: by outflank-mailman (input) for mailman id 81295;
 Thu, 04 Feb 2021 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 1l7ePZ-0008AR-4y
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 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 1l7ePZ-0003C9-0s
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 13:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7ePY-0003aj-W1
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 13:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qd6mUJwK64okn5yPw/ORRK/zyrz8tYcLjAhDAZS64V4=; b=LoNmVmUEOfBOzFoKOO4F6uq4tp
	0Hrb8phIFTzaMxkxGljKAPC680idGB0BCeBQJgAtiQvzW9ENtROgdUPa2RTkQ3w/gm/JbosbbipS+
	v/LCJkNWObJFKl4mqn4NjGyx2OCBv+llLh340Y4j2QmcSd+PksKH1G9bre07ag9CBEp0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/string: correct memmove()'s forwarding to memcpy()
Message-Id: <E1l7ePY-0003aj-W1@xenbits.xenproject.org>
Date: Thu, 04 Feb 2021 13:11:04 +0000

commit 7b93d92a35dc7c0a6e5f1f79b3c887aa3e66ddc0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 4 13:59:56 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 4 13:59:56 2021 +0100

    x86/string: correct memmove()'s forwarding to memcpy()
    
    With memcpy() expanding to the compiler builtin, we may not hand it
    overlapping source and destination. We strictly mean to forward to our
    own implementation (a few lines up in the same source file).
    
    Fixes: 78825e1c60fa ("x86/string: Clean up x86/string.h")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/string.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/string.c b/xen/arch/x86/string.c
index e2f84638c4..bda24b14ac 100644
--- a/xen/arch/x86/string.c
+++ b/xen/arch/x86/string.c
@@ -43,7 +43,8 @@ void *(memmove)(void *dest, const void *src, size_t n)
         return dest;
 
     if ( dest < src )
-        return memcpy(dest, src, n);
+        /* Depends on Xen's implementation operating forwards. */
+        return (memcpy)(dest, src, n);
 
     asm volatile (
         "   std         ; "
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 04 13:11:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Feb 2021 13:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81296.149995 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7ePj-0008BO-NL; Thu, 04 Feb 2021 13:11:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81296.149995; Thu, 04 Feb 2021 13:11:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7ePj-0008BG-KM; Thu, 04 Feb 2021 13:11:15 +0000
Received: by outflank-mailman (input) for mailman id 81296;
 Thu, 04 Feb 2021 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 1l7ePj-0008BB-73
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 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 1l7ePj-0003Cd-4G
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 13:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7ePj-0003bn-3F
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 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=svviZbDa9jaRO+PDD/UuWGWM5lYDvhfHI+GuVKYceqc=; b=fS+mCw5u8zzNywiQtfdGAnWRtP
	qGs0aENGxjNK3GzDVzro6C1IutXdI3kBO+95yCGTxgsWu3S1QmeVEvpDb+x+YGq5NC9xFKIsLOvoI
	L0YsdZC5eoUb5+VdxkQwj4rcoVfyG8HlFdVr+bfzDT7dj0/IMsx5Ea/Nxm3j5mj/AlU8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] IOREQ: fix waiting for broadcast completion
Message-Id: <E1l7ePj-0003bn-3F@xenbits.xenproject.org>
Date: Thu, 04 Feb 2021 13:11:15 +0000

commit da20c93108226cb2eb2ed1a13225337f2318a642
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 4 14:01:21 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 4 14:01:21 2021 +0100

    IOREQ: fix waiting for broadcast completion
    
    Checking just a single server is not enough - all of them must have
    signaled that they're done processing the request.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 xen/common/ioreq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/common/ioreq.c b/xen/common/ioreq.c
index 90ed2e0302..5b603c0520 100644
--- a/xen/common/ioreq.c
+++ b/xen/common/ioreq.c
@@ -213,9 +213,9 @@ bool vcpu_ioreq_handle_completion(struct vcpu *v)
         return false;
     }
 
-    sv = get_pending_vcpu(v, &s);
-    if ( sv && !wait_for_io(sv, get_ioreq(s, v)) )
-        return false;
+    while ( (sv = get_pending_vcpu(v, &s)) != NULL )
+        if ( !wait_for_io(sv, get_ioreq(s, v)) )
+            return false;
 
     vio->req.state = ioreq_needs_completion(&vio->req) ?
         STATE_IORESP_READY : STATE_IOREQ_NONE;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 04 13:11:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Feb 2021 13:11:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81297.149999 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7ePt-0008D1-P8; Thu, 04 Feb 2021 13:11:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81297.149999; Thu, 04 Feb 2021 13:11:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7ePt-0008Ct-M2; Thu, 04 Feb 2021 13:11:25 +0000
Received: by outflank-mailman (input) for mailman id 81297;
 Thu, 04 Feb 2021 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 1l7ePt-0008Cj-7r
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 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 1l7ePt-0003Cs-7B
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 13:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7ePt-0003cV-6N
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 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=fc6dvqPkOSC4yFPemeSthCzaAsUiRl1ogH+zWDRJt4A=; b=gfeufdanzHz+yK7kos2E4Cabrp
	+eW/zfeEjKFqmTharOMVL0cV+zXm9tUPmw1+yMBcXU15v944V3OiFanw0IiQSqNi1sHLk0SlKJP4y
	LATgg1cziS99rywuuE6iKSOksCEflZvT6n2wWSULmWlkZesN5T4yYZwlRp0Ox4Xs/c8A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/efi: enable MS ABI attribute on clang
Message-Id: <E1l7ePt-0003cV-6N@xenbits.xenproject.org>
Date: Thu, 04 Feb 2021 13:11:25 +0000

commit 92f5ffa58d188c9f9a9f1bcdccb6d6348d9df612
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Feb 4 14:02:32 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 4 14:02:32 2021 +0100

    x86/efi: enable MS ABI attribute on clang
    
    Or else the EFI service calls will use the wrong calling convention.
    
    The __ms_abi__ attribute is available on all supported versions of
    clang. Add a specific Clang check because the GCC version reported by
    Clang is below the required 4.4 to use the __ms_abi__ attribute.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/include/asm-x86/x86_64/efibind.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/asm-x86/x86_64/efibind.h b/xen/include/asm-x86/x86_64/efibind.h
index b013db175d..ddcfae07ec 100644
--- a/xen/include/asm-x86/x86_64/efibind.h
+++ b/xen/include/asm-x86/x86_64/efibind.h
@@ -172,7 +172,7 @@ typedef uint64_t   UINTN;
 #ifndef EFIAPI                  // Forces EFI calling conventions reguardless of compiler options
     #ifdef _MSC_EXTENSIONS
         #define EFIAPI __cdecl  // Force C calling convention for Microsoft C compiler
-    #elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
+    #elif __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
         #define EFIAPI __attribute__((__ms_abi__))  // Force Microsoft ABI
     #else
         #define EFIAPI          // Substitute expresion to force C calling convention
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 04 14:22:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Feb 2021 14:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81327.150108 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7fWI-0007s4-6v; Thu, 04 Feb 2021 14:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81327.150108; Thu, 04 Feb 2021 14:22:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7fWI-0007rw-3q; Thu, 04 Feb 2021 14:22:06 +0000
Received: by outflank-mailman (input) for mailman id 81327;
 Thu, 04 Feb 2021 14: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 1l7fWG-0007rp-Lc
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 14: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 1l7fWG-0004R7-Kn
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 14:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7fWG-00026z-J1
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 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>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Y+2YUYpw5ezH2KlPvJGeU5WynolwVaq7QKtISFJ/zuM=; b=yL4Je9M34sxAAptPjzL4NdAMLT
	zMma/4hn5gemaVPw3xHulcHcZjdcZVc1jJeDtpsUsLtaH6NjQIZT/sn9QehJ5BOzio9bWEytd6xQo
	xXW7Ilj/+dsC1R92UEUSmjNjkLyIwU/Ijq+dUgK0QmFxHHbFfEpA4PRpAnzFJDmtNeg8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/oxenstored: Fix quota calculation for mkdir EEXIST
Message-Id: <E1l7fWG-00026z-J1@xenbits.xenproject.org>
Date: Thu, 04 Feb 2021 14:22:04 +0000

commit c8b96708252a436da44005307f7c195d699bd7c5
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Jan 15 19:11:32 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 4 14:17:44 2021 +0000

    tools/oxenstored: Fix quota calculation for mkdir EEXIST
    
    We increment the domain's quota on mkdir even when the node already exists.
    This results in a quota inconsistency after live update, where reconstructing
    the tree from scratch results in a different quota.
    
    Not a security issue because the domain uses up quota faster, so it will only
    get a Quota error sooner than it should.
    
    Found by the structured fuzzer.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/ocaml/xenstored/store.ml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/ocaml/xenstored/store.ml b/tools/ocaml/xenstored/store.ml
index 1bd0c81f6f..20e67b1427 100644
--- a/tools/ocaml/xenstored/store.ml
+++ b/tools/ocaml/xenstored/store.ml
@@ -419,6 +419,7 @@ let mkdir store perm path =
 	(* It's upt to the mkdir logic to decide what to do with existing path *)
 	if not (existing || (Perms.Connection.is_dom0 perm)) then Quota.check store.quota owner 0;
 	store.root <- path_mkdir store perm path;
+	if not existing then
 	Quota.add_entry store.quota owner
 
 let rm store perm path =
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 04 14:22:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Feb 2021 14:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81328.150111 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7fWS-0007t4-8G; Thu, 04 Feb 2021 14:22:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81328.150111; Thu, 04 Feb 2021 14:22:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7fWS-0007sy-5P; Thu, 04 Feb 2021 14:22:16 +0000
Received: by outflank-mailman (input) for mailman id 81328;
 Thu, 04 Feb 2021 14:22:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7fWQ-0007sp-R5
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 14:22:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7fWQ-0004RD-QE
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 14:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7fWQ-000285-Mv
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 14:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9MqqCcVKOHc3c8PylUO/z2SIpzl2hMPTjGbzV+/1TLM=; b=WKqp5a3YhYqzp5Ovc+k1DVvPMs
	luzuMCO5BUGxjToAh9nMxMLQQzDGTJ1Qqcju18xpvbsn0+8ecYP2G04lSwUHCOHOHA9hDNior0aaF
	4qEnDCfDZJGXmxtRoYtdpu3ObaDNgH14XJom2NGSsxrgdiNaLkTrQ4thSwB2TAlhFrpo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/oxenstored: Reject invalid watch paths early
Message-Id: <E1l7fWQ-000285-Mv@xenbits.xenproject.org>
Date: Thu, 04 Feb 2021 14:22:14 +0000

commit dc8caf214fb882546b0e93317b9828247a7c9da8
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Jan 15 19:28:37 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 4 14:17:44 2021 +0000

    tools/oxenstored: Reject invalid watch paths early
    
    Watches on invalid paths were accepted, but they would never trigger.  The
    client also got no notification that its watch is bad and would never trigger.
    
    Found again by the structured fuzzer, due to an error on live update reload:
    the invalid watch paths would get rejected during live update and the list of
    watches would be different pre/post live update.
    
    The testcase is watch on `//`, which is an invalid path.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/ocaml/xenstored/connection.ml  | 5 ++---
 tools/ocaml/xenstored/connections.ml | 4 +++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/ocaml/xenstored/connection.ml b/tools/ocaml/xenstored/connection.ml
index d09a0fa405..65f99ea6f2 100644
--- a/tools/ocaml/xenstored/connection.ml
+++ b/tools/ocaml/xenstored/connection.ml
@@ -158,18 +158,17 @@ let get_children_watches con path =
 let is_dom0 con =
 	Perms.Connection.is_dom0 (get_perm con)
 
-let add_watch con path token =
+let add_watch con (path, apath) token =
 	if !Quota.activate && !Define.maxwatch > 0 &&
 	   not (is_dom0 con) && con.nb_watches > !Define.maxwatch then
 		raise Quota.Limit_reached;
-	let apath = get_watch_path con path in
 	let l = get_watches con apath in
 	if List.exists (fun w -> w.token = token) l then
 		raise Define.Already_exist;
 	let watch = watch_create ~con ~token ~path in
 	Hashtbl.replace con.watches apath (watch :: l);
 	con.nb_watches <- con.nb_watches + 1;
-	apath, watch
+	watch
 
 let del_watch con path token =
 	let apath = get_watch_path con path in
diff --git a/tools/ocaml/xenstored/connections.ml b/tools/ocaml/xenstored/connections.ml
index 8a66eeec3a..3c7429fe7f 100644
--- a/tools/ocaml/xenstored/connections.ml
+++ b/tools/ocaml/xenstored/connections.ml
@@ -114,8 +114,10 @@ let key_of_path path =
 	"" :: Store.Path.to_string_list path
 
 let add_watch cons con path token =
-	let apath, watch = Connection.add_watch con path token in
+	let apath = Connection.get_watch_path con path in
+	(* fail on invalid paths early by calling key_of_str before adding watch *)
 	let key = key_of_str apath in
+	let watch = Connection.add_watch con (path, apath) token in
 	let watches =
  		if Trie.mem cons.watches key
  		then Trie.find cons.watches key
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 04 14:22:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Feb 2021 14:22:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81329.150116 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7fWc-0007uj-A6; Thu, 04 Feb 2021 14:22:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81329.150116; Thu, 04 Feb 2021 14:22:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7fWc-0007uU-6q; Thu, 04 Feb 2021 14:22:26 +0000
Received: by outflank-mailman (input) for mailman id 81329;
 Thu, 04 Feb 2021 14:22:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7fWa-0007uI-UE
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 14:22:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7fWa-0004Rb-TS
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 14:22:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7fWa-000299-SG
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 14:22:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zBub+ADsOTs2jGypua3ecJCVHiQlBpp6ffmaSn/2/44=; b=CbObM4emKAzPJ8srig+kHmHY44
	Z3vxoP9y0by+0KEyfNCLVWXXZq+JS5urTlWKUsaFy5yoJHjUjBMeqZL0rRgaVHjPf8xdvXC7LSJn+
	mLwBFNsz8foYpdklAhgynipjH7FoDSDN1S1qk4BUpBP6fOzhgqW7f1UpunA+MwXsaYD0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/oxenstored: mkdir conflicts were sometimes missed
Message-Id: <E1l7fWa-000299-SG@xenbits.xenproject.org>
Date: Thu, 04 Feb 2021 14:22:24 +0000

commit 45dee7d92b493bb531e7e77a6f9c0180ab152f87
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Jan 15 19:38:58 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 4 14:17:44 2021 +0000

    tools/oxenstored: mkdir conflicts were sometimes missed
    
    Due to how set_write_lowpath was used here it didn't detect create/delete
    conflicts.  When we create an entry we must mark our parent as modified
    (this is what creating a new node via write does).
    
    Otherwise we can have 2 transactions one creating, and another deleting a node
    both succeeding depending on timing.  Or one transaction reading an entry,
    concluding it doesn't exist, do some other work based on that information and
    successfully commit even if another transaction creates the node via mkdir
    meanwhile.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/ocaml/xenstored/transaction.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/xenstored/transaction.ml b/tools/ocaml/xenstored/transaction.ml
index 25bc8c3b4a..17b1bdf2ea 100644
--- a/tools/ocaml/xenstored/transaction.ml
+++ b/tools/ocaml/xenstored/transaction.ml
@@ -165,7 +165,7 @@ let write t perm path value =
 
 let mkdir ?(with_watch=true) t perm path =
 	Store.mkdir t.store perm path;
-	set_write_lowpath t path;
+	set_write_lowpath t (Store.Path.get_parent path);
 	if with_watch then
 		add_wop t Xenbus.Xb.Op.Mkdir path
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 04 14:44:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Feb 2021 14:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81333.150132 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7fra-0001g0-4p; Thu, 04 Feb 2021 14:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81333.150132; Thu, 04 Feb 2021 14:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7fra-0001fr-1l; Thu, 04 Feb 2021 14:44:06 +0000
Received: by outflank-mailman (input) for mailman id 81333;
 Thu, 04 Feb 2021 14:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7frY-0001fm-QJ
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 14:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7frY-0004nc-MU
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 14:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7frY-0004cM-KF
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 14:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PfOBFVklvO3Nzq8uT9lqvN9TOmHyz9tUA+/LgEvJB4E=; b=XeqxkY7BVUB19KTpxlwVNbhHo0
	glw+kq8UbQbfGdWiS3sX/OKxqB0qlDGKg7cMnpsBzk72Tl+TQb1A5ZTIz1VNJaYtVZUDCaAS5QmHS
	ClW37Y3UabgvSJqxehDAhpCSCcWBin8/Mvqa2UoUlyQVO88eofNORHhzesHbnFW4HpGg=;
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} (again)
Message-Id: <E1l7frY-0004cM-KF@xenbits.xenproject.org>
Date: Thu, 04 Feb 2021 14:44:04 +0000

commit f1f322610718c40680ac09e66f6c82e69c78ba3a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 4 15:39:45 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 4 15:39:45 2021 +0100

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL} (again)
    
    X86_VENDOR_* aren't bit masks in the older trees.
    
    Reported-by: James Dingwall <james@dingwall.me.uk>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/msr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 927ed625df..aefe0cbb4b 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -226,7 +226,8 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
          */
     case MSR_IA32_PERF_STATUS:
     case MSR_IA32_PERF_CTL:
-        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+        if ( cp->x86_vendor != X86_VENDOR_INTEL &&
+             cp->x86_vendor != X86_VENDOR_CENTAUR )
             goto gp_fault;
 
         *val = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Thu Feb 04 14:44:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Feb 2021 14:44:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81334.150136 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7frl-0001gm-6F; Thu, 04 Feb 2021 14:44:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81334.150136; Thu, 04 Feb 2021 14:44:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7frl-0001ge-3J; Thu, 04 Feb 2021 14:44:17 +0000
Received: by outflank-mailman (input) for mailman id 81334;
 Thu, 04 Feb 2021 14:44:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7frj-0001gW-8q
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 14:44:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7frj-0004ni-7a
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 14:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7frj-0004e0-6b
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 14:44:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CS0yy+usRFdGXV11hV3f3shth9lt/hl17CBAxPy6BjY=; b=xlRWIawSTtIhKVhP/+r3GMERqY
	WILQc7T08W5TU/p/sW6LAgEeLWLnU8vQLy4ZT8sRu34+rGCuKELD3QliyMbIgECEJXoxmGX0boDcW
	6pug7oe0nPjD6HTYzLWORM5Sd5vTdlGwU1Hok/1j4qivmlrKD6CBMd9hA1pOyIBgUWPA=;
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} (again)
Message-Id: <E1l7frj-0004e0-6b@xenbits.xenproject.org>
Date: Thu, 04 Feb 2021 14:44:15 +0000

commit f9090d990e201a5ca045976b8ddaab9fa6ee69dd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 4 15:41:12 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 4 15:41:12 2021 +0100

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL} (again)
    
    X86_VENDOR_* aren't bit masks in the older trees.
    
    Reported-by: James Dingwall <james@dingwall.me.uk>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/msr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 99c848ff41..1afb80427c 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -232,7 +232,8 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
          */
     case MSR_IA32_PERF_STATUS:
     case MSR_IA32_PERF_CTL:
-        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+        if ( cp->x86_vendor != X86_VENDOR_INTEL &&
+             cp->x86_vendor != X86_VENDOR_CENTAUR )
             goto gp_fault;
 
         *val = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Thu Feb 04 21:33:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Feb 2021 21:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81440.150564 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7mFP-0005Va-4E; Thu, 04 Feb 2021 21:33:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81440.150564; Thu, 04 Feb 2021 21:33:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7mFP-0005VS-1C; Thu, 04 Feb 2021 21:33:07 +0000
Received: by outflank-mailman (input) for mailman id 81440;
 Thu, 04 Feb 2021 21: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 1l7mFN-0005VN-Lb
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 21: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 1l7mFN-00043z-Eq
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 21:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7mFN-0000o2-BF
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 21:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eoaDVi/zA0ujRnkUX7N5T7lQU3bfw0jNdEv+7ici7hk=; b=wibDF2EuTNx5ERZ+eyCi7Ty2Rk
	UxLUVD0CUVWMKc7tT+KfPyEwGn648DFV8s00ST//+d+cu9kZkFGBxyYde2pkJ2Fgq/t67bZHKxAMX
	j0gMYbNonsViaQZfHac5HYdeiKw2y9dAQ1jGu2yQanM08/0etuWh/i1UkRa2hLtw0m+Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libs/devicemodel: Fix ABI breakage from xendevicemodel_set_irq_level()
Message-Id: <E1l7mFN-0000o2-BF@xenbits.xenproject.org>
Date: Thu, 04 Feb 2021 21:33:05 +0000

commit e8af54084586f4e165eee0b49175a63e3c541c64
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 4 15:50:16 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 4 21:26:41 2021 +0000

    libs/devicemodel: Fix ABI breakage from xendevicemodel_set_irq_level()
    
    It is not permitted to edit the VERS clause for a version in a release of Xen.
    
    Revert xendevicemodel_set_irq_level()'s inclusion in .so.1.2 and bump the the
    library minor version to .so.1.4 instead.
    
    Fixes: 5d752df85f ("xen/dm: Introduce xendevicemodel_set_irq_level DM op")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/devicemodel/Makefile              | 2 +-
 tools/libs/devicemodel/libxendevicemodel.map | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile
index 500de7adc5..3e50ff6d90 100644
--- a/tools/libs/devicemodel/Makefile
+++ b/tools/libs/devicemodel/Makefile
@@ -2,7 +2,7 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
-MINOR    = 3
+MINOR    = 4
 
 SRCS-y                 += core.c
 SRCS-$(CONFIG_Linux)   += common.c
diff --git a/tools/libs/devicemodel/libxendevicemodel.map b/tools/libs/devicemodel/libxendevicemodel.map
index a0c30125de..733549327b 100644
--- a/tools/libs/devicemodel/libxendevicemodel.map
+++ b/tools/libs/devicemodel/libxendevicemodel.map
@@ -32,10 +32,14 @@ VERS_1.2 {
 	global:
 		xendevicemodel_relocate_memory;
 		xendevicemodel_pin_memory_cacheattr;
-		xendevicemodel_set_irq_level;
 } VERS_1.1;
 
 VERS_1.3 {
 	global:
 		xendevicemodel_modified_memory_bulk;
 } VERS_1.2;
+
+VERS_1.4 {
+	global:
+		xendevicemodel_set_irq_level;
+} VERS_1.3;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 04 21:33:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Feb 2021 21:33:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81441.150567 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7mFZ-0005Wc-6w; Thu, 04 Feb 2021 21:33:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81441.150567; Thu, 04 Feb 2021 21:33:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7mFZ-0005WU-40; Thu, 04 Feb 2021 21:33:17 +0000
Received: by outflank-mailman (input) for mailman id 81441;
 Thu, 04 Feb 2021 21: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 1l7mFX-0005WN-J2
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 21: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 1l7mFX-000442-IE
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 21:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7mFX-0000ou-H9
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 21:33:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Kk7e9LIWBZ3lBJaWu7a21aVbjAN6TtiF6jUbJoDPlog=; b=TDNk90pcYi0BcI1ewDjR7rhc5C
	uehcVROAN3VUhRFgi02aACSFbY+V5txYOMLx32RAoyPYd0IOHL+YZQ5b2P7wx8R06bZV8lpuluOHe
	5UkX3yzxF8H8d1sXhOB7PY29VMPVswASTxg93e4OiixCyRjqZ5lHa2VZjVJu+QQAySNA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/hotplug: Add a qemu-ifup script on NetBSD
Message-Id: <E1l7mFX-0000ou-H9@xenbits.xenproject.org>
Date: Thu, 04 Feb 2021 21:33:15 +0000

commit 4cc948020a58588d02413d92976ddd5233dd7cae
Author:     Manuel Bouyer <bouyer@netbsd.org>
AuthorDate: Wed Feb 3 17:54:18 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 4 21:26:41 2021 +0000

    tools/hotplug: Add a qemu-ifup script on NetBSD
    
    On NetBSD, qemu-xen will use a qemu-ifup script to setup the tap interfaces
    (as qemu-xen-traditional used to). Copy the script from qemu-xen-traditional,
    and install it on NetBSD. While there document parameters and environnement
    variables.
    
    Signed-off-by: Manuel Bouyer <bouyer@netbsd.org>
    Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/hotplug/NetBSD/Makefile  | 1 +
 tools/hotplug/NetBSD/qemu-ifup | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/tools/hotplug/NetBSD/Makefile b/tools/hotplug/NetBSD/Makefile
index 114b223207..f909ffa367 100644
--- a/tools/hotplug/NetBSD/Makefile
+++ b/tools/hotplug/NetBSD/Makefile
@@ -7,6 +7,7 @@ XEN_SCRIPTS += locking.sh
 XEN_SCRIPTS += block
 XEN_SCRIPTS += vif-bridge
 XEN_SCRIPTS += vif-ip
+XEN_SCRIPTS += qemu-ifup
 
 XEN_SCRIPT_DATA =
 XEN_RCD_PROG = rc.d/xencommons rc.d/xendomains rc.d/xen-watchdog rc.d/xendriverdomain
diff --git a/tools/hotplug/NetBSD/qemu-ifup b/tools/hotplug/NetBSD/qemu-ifup
new file mode 100644
index 0000000000..4305419f44
--- /dev/null
+++ b/tools/hotplug/NetBSD/qemu-ifup
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+#called by qemu when a HVM domU is started.
+# first parameter is tap interface, second is the bridge name
+# environement variable $XEN_DOMAIN_ID contains the domU's ID,
+# which can be used to retrieve extra parameters from the xenstore.
+
+ifconfig $1 up
+exec /sbin/brconfig $2 add $1
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 04 21:33:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Feb 2021 21:33:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81443.150584 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7mFj-0005ah-H2; Thu, 04 Feb 2021 21:33:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81443.150584; Thu, 04 Feb 2021 21:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7mFj-0005aZ-Dq; Thu, 04 Feb 2021 21:33:27 +0000
Received: by outflank-mailman (input) for mailman id 81443;
 Thu, 04 Feb 2021 21: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 1l7mFh-0005a1-N4
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 21: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 1l7mFh-000463-LW
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 21:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7mFh-0000po-KW
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 21:33:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Z5wPTvx0EOnJYhAUxUD9wJSCE6D86WjDZnnavDNmySw=; b=eFruoIAfF4lP8fCOGUsalZrUEQ
	G5Bf77BRy+EDOQkKcTdkzh5j4Ht/6fVmfGLg8QZxI5Zj0rXSaYau/BlOz7IZmdbWW3isiYLgPm/x8
	8JUj4SNFvAiInwQznbFVlWFXLXp+/FxZZWWJY+DQ6AcITAIqvsh0YN8sWBez1zISSxEY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: close socket connections on error
Message-Id: <E1l7mFh-0000po-KW@xenbits.xenproject.org>
Date: Thu, 04 Feb 2021 21:33:25 +0000

commit cd09c4929e9b70d77747ec187ea94731c8a06ab2
Author:     Manuel Bouyer <bouyer@netbsd.org>
AuthorDate: Wed Feb 3 17:54:19 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 4 21:26:41 2021 +0000

    tools/xenstored: close socket connections on error
    
    On error, don't keep socket connection in ignored state but close them.
    When the remote end of a socket is closed, xenstored will flag it as an
    error and switch the connection to ignored. But on some OSes (e.g.
    NetBSD), poll(2) will return only POLLIN in this case, so sockets in ignored
    state will stay open forever in xenstored (and it will loop with CPU 100%
    busy).
    
    Fixes: d2fa370d3ef9 ("tools/xenstore: Preserve bad client until they are destroyed")
    Signed-off-by: Manuel Bouyer <bouyer@netbsd.org>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xenstore/xenstored_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 1ab6f162cb..0fea598352 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -1440,6 +1440,9 @@ static void ignore_connection(struct connection *conn)
 
 	talloc_free(conn->in);
 	conn->in = NULL;
+	/* if this is a socket connection, drop it now */
+	if (conn->fd >= 0)
+		talloc_free(conn);
 }
 
 static const char *sockmsg_string(enum xsd_sockmsg_type type)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 04 21:33:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Feb 2021 21:33:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81444.150588 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7mFt-0005e7-IY; Thu, 04 Feb 2021 21:33:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81444.150588; Thu, 04 Feb 2021 21:33:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7mFt-0005dz-FS; Thu, 04 Feb 2021 21:33:37 +0000
Received: by outflank-mailman (input) for mailman id 81444;
 Thu, 04 Feb 2021 21: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 1l7mFr-0005da-Pc
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 21: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 1l7mFr-00046A-Op
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 21:33:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7mFr-0000qY-Nd
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 21:33:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6ax40Xm+HpBOJcV4Cu0jLPGxiq3d5sIl/QGL+DjWopM=; b=wXatfdE4LAQgMkkzqskCiA0gpY
	h0SnhJLiCSPL8a7i3bz7a00jGsdJeD6lbCEUhOEiD+CeZ5fvvfS1oPgbqmmxE0n+ozMI2Qygie5gp
	9dfO0aSkjx2ul/+v5PuEcUb0aqMRWD8EEeuurfG1Sh+tHda+NQFbMrWe8/tHcyiE0GtE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs/man: Document qemu-ifup on NetBSD
Message-Id: <E1l7mFr-0000qY-Nd@xenbits.xenproject.org>
Date: Thu, 04 Feb 2021 21:33:35 +0000

commit def12125357ed2efd6d581d9033afcc9d66daa8a
Author:     Manuel Bouyer <bouyer@netbsd.org>
AuthorDate: Wed Feb 3 17:54:20 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 4 21:26:41 2021 +0000

    docs/man: Document qemu-ifup on NetBSD
    
    Document that on NetBSD, the tap interface will be configured by the
    qemu-ifup script.
    
    Signed-off-by: Manuel Bouyer <bouyer@netbsd.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 docs/man/xl-network-configuration.5.pod | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/docs/man/xl-network-configuration.5.pod b/docs/man/xl-network-configuration.5.pod
index af058d4d3c..8e5fd909fa 100644
--- a/docs/man/xl-network-configuration.5.pod
+++ b/docs/man/xl-network-configuration.5.pod
@@ -172,6 +172,9 @@ add it to the relevant bridge). Defaults to
 C<XEN_SCRIPT_DIR/vif-bridge> but can be set to any script. Some example
 scripts are installed in C<XEN_SCRIPT_DIR>.
 
+Note on NetBSD HVM guests will ignore the script option for tap
+(emulated) interfaces and always use
+C<XEN_SCRIPT_DIR/qemu-ifup> to configure the interface in bridged mode.
 
 =head2 ip
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 04 22:11:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Feb 2021 22:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81455.150620 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7mq9-0001dM-Sm; Thu, 04 Feb 2021 22:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81455.150620; Thu, 04 Feb 2021 22:11:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7mq9-0001dE-Pf; Thu, 04 Feb 2021 22:11:05 +0000
Received: by outflank-mailman (input) for mailman id 81455;
 Thu, 04 Feb 2021 22: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 1l7mq9-0001d9-4O
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 22: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 1l7mq9-0004i5-29
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 22:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7mq9-0003zU-0m
 for xen-changelog@lists.xenproject.org; Thu, 04 Feb 2021 22: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=Mie9bHSEbyAEeayr9tHYjut38KITNEq6bQyBz5A5mUY=; b=Qx64bsLAN3PPCPOhvW9BQ8HN5n
	V+L+MvUvpqL4d9p9ef25nOp9DYxqrtYNMQ3EyQPtFZDl5dlfRDFjrlYyKIb0v6IzBJXTAGpoJPPtu
	3CKyFQ6LsjUvSs6gp/BPMHU5q7h83fGGjmBvN6IYN26ELh9uECE3dRAbV99HFwnI+VqA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/tests: Introduce a test for acquire_resource
Message-Id: <E1l7mq9-0003zU-0m@xenbits.xenproject.org>
Date: Thu, 04 Feb 2021 22:11:05 +0000

commit ff522e2e9163b27fe4d80ba55c18408f9b1f1cb7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jul 23 17:26:16 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 4 22:03:33 2021 +0000

    tools/tests: Introduce a test for acquire_resource
    
    For now, simply try to map 40 frames of grant table.  This catches most of the
    basic errors with resource sizes found and fixed through the 4.15 dev window.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/tests/Makefile                 |   1 +
 tools/tests/resource/.gitignore      |   1 +
 tools/tests/resource/Makefile        |  40 ++++++++++
 tools/tests/resource/test-resource.c | 151 +++++++++++++++++++++++++++++++++++
 4 files changed, 193 insertions(+)

diff --git a/tools/tests/Makefile b/tools/tests/Makefile
index fc9b715951..8746aabe6b 100644
--- a/tools/tests/Makefile
+++ b/tools/tests/Makefile
@@ -2,6 +2,7 @@ XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS-y :=
+SUBDIRS-y += resource
 SUBDIRS-$(CONFIG_X86) += cpu-policy
 SUBDIRS-$(CONFIG_X86) += mce-test
 ifneq ($(clang),y)
diff --git a/tools/tests/resource/.gitignore b/tools/tests/resource/.gitignore
new file mode 100644
index 0000000000..4872e97d4b
--- /dev/null
+++ b/tools/tests/resource/.gitignore
@@ -0,0 +1 @@
+test-resource
diff --git a/tools/tests/resource/Makefile b/tools/tests/resource/Makefile
new file mode 100644
index 0000000000..4bef482966
--- /dev/null
+++ b/tools/tests/resource/Makefile
@@ -0,0 +1,40 @@
+XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+TARGET := test-resource
+
+.PHONY: all
+all: $(TARGET)
+
+.PHONY: run
+run: $(TARGET)
+	./$(TARGET)
+
+.PHONY: clean
+clean:
+	$(RM) -f -- *.o $(TARGET) $(DEPS_RM)
+
+.PHONY: distclean
+distclean: clean
+	$(RM) -f -- *~
+
+.PHONY: install
+install: all
+
+.PHONY: uninstall
+uninstall:
+
+CFLAGS += -Werror
+CFLAGS += $(CFLAGS_xeninclude)
+CFLAGS += $(CFLAGS_libxenctrl)
+CFLAGS += $(CFLAGS_libxenforeginmemory)
+CFLAGS += $(APPEND_CFLAGS)
+
+LDFLAGS += $(LDLIBS_libxenctrl)
+LDFLAGS += $(LDLIBS_libxenforeignmemory)
+LDFLAGS += $(APPEND_LDFLAGS)
+
+test-resource: test-resource.o
+	$(CC) -o $@ $< $(LDFLAGS)
+
+-include $(DEPS_INCLUDE)
diff --git a/tools/tests/resource/test-resource.c b/tools/tests/resource/test-resource.c
new file mode 100644
index 0000000000..a409a82f44
--- /dev/null
+++ b/tools/tests/resource/test-resource.c
@@ -0,0 +1,151 @@
+#include <err.h>
+#include <errno.h>
+#include <error.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/mman.h>
+
+#include <xenctrl.h>
+#include <xenforeignmemory.h>
+#include <xen-tools/libs.h>
+
+static unsigned int nr_failures;
+#define fail(fmt, ...)                          \
+({                                              \
+    nr_failures++;                              \
+    (void)printf(fmt, ##__VA_ARGS__);           \
+})
+
+static xc_interface *xch;
+static xenforeignmemory_handle *fh;
+
+static void test_gnttab(uint32_t domid, unsigned int nr_frames)
+{
+    xenforeignmemory_resource_handle *res;
+    void *addr = NULL;
+    size_t size;
+    int rc;
+
+    printf("  Test grant table\n");
+
+    /* Obtain the grant table resource size. */
+    rc = xenforeignmemory_resource_size(
+        fh, domid, XENMEM_resource_grant_table,
+        XENMEM_resource_grant_table_id_shared, &size);
+
+    /*
+     * A failure of this call indicates missing kernel support for size
+     * ioctl(), or missing Xen acquire_resource support.
+     */
+    if ( rc )
+        return fail("    Fail: Get size: %d - %s\n", errno, strerror(errno));
+
+    /*
+     * Getting 32 frames back instead of nr_frames indicates Xen is missing
+     * the bugfix to make size requests actually return real data.
+     */
+    if ( (size >> XC_PAGE_SHIFT) != nr_frames )
+        return fail("    Fail: Get size: expected %u frames, got %zu\n",
+                    nr_frames, size >> XC_PAGE_SHIFT);
+
+    /* Map the entire grant table. */
+    res = xenforeignmemory_map_resource(
+        fh, domid, XENMEM_resource_grant_table,
+        XENMEM_resource_grant_table_id_shared, 0, size >> XC_PAGE_SHIFT,
+        &addr, PROT_READ | PROT_WRITE, 0);
+
+    /*
+     * Failure here with E2BIG indicates Xen is missing the bugfix to map
+     * resources larger than 32 frames.
+     */
+    if ( !res )
+        return fail("    Fail: Map %d - %s\n", errno, strerror(errno));
+
+    rc = xenforeignmemory_unmap_resource(fh, res);
+    if ( rc )
+        return fail("    Fail: Unmap %d - %s\n", errno, strerror(errno));
+}
+
+static void test_domain_configurations(void)
+{
+    static struct test {
+        const char *name;
+        struct xen_domctl_createdomain create;
+    } tests[] = {
+#if defined(__x86_64__) || defined(__i386__)
+        {
+            .name = "x86 PV",
+            .create = {
+                .max_vcpus = 2,
+                .max_grant_frames = 40,
+            },
+        },
+        {
+            .name = "x86 PVH",
+            .create = {
+                .flags = XEN_DOMCTL_CDF_hvm,
+                .max_vcpus = 2,
+                .max_grant_frames = 40,
+                .arch = {
+                    .emulation_flags = XEN_X86_EMU_LAPIC,
+                },
+            },
+        },
+#elif defined(__aarch64__) || defined(__arm__)
+        {
+            .name = "ARM",
+            .create = {
+                .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap,
+                .max_vcpus = 2,
+                .max_grant_frames = 40,
+            },
+        },
+#endif
+    };
+
+    for ( unsigned int i = 0; i < ARRAY_SIZE(tests); ++i )
+    {
+        struct test *t = &tests[i];
+        uint32_t domid = 0;
+        int rc;
+
+        printf("Test %s\n", t->name);
+
+        rc = xc_domain_create(xch, &domid, &t->create);
+        if ( rc )
+        {
+            if ( errno == EINVAL || errno == EOPNOTSUPP )
+                printf("  Skip: %d - %s\n", errno, strerror(errno));
+            else
+                fail("  Domain create failure: %d - %s\n",
+                     errno, strerror(errno));
+            continue;
+        }
+
+        printf("  Created d%u\n", domid);
+
+        test_gnttab(domid, t->create.max_grant_frames);
+
+        rc = xc_domain_destroy(xch, domid);
+        if ( rc )
+            fail("  Failed to destroy domain: %d - %s\n",
+                 errno, strerror(errno));
+    }
+}
+
+int main(int argc, char **argv)
+{
+    printf("XENMEM_acquire_resource tests\n");
+
+    xch = xc_interface_open(NULL, NULL, 0);
+    fh = xenforeignmemory_open(NULL, 0);
+
+    if ( !xch )
+        err(1, "xc_interface_open");
+    if ( !fh )
+        err(1, "xenforeignmemory_open");
+
+    test_domain_configurations();
+
+    return !!nr_failures;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 05 07:55:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Feb 2021 07:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81531.150777 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7vxK-0006zM-CW; Fri, 05 Feb 2021 07:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81531.150777; Fri, 05 Feb 2021 07:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7vxK-0006zE-9h; Fri, 05 Feb 2021 07:55:06 +0000
Received: by outflank-mailman (input) for mailman id 81531;
 Fri, 05 Feb 2021 07:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7vxI-0006z9-NO
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 07:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7vxI-0000aj-KV
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 07:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7vxI-000274-Ho
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 07:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=H8s4mCoZUeLTMSXdUTjhNFadnGBFNhGqlOQj5PMVi+w=; b=NIJdyMbxk52VEnrNCSPRsR0Y5n
	dpFhpTBcCw+G1LcjPIFcEGtCOvaZgqOduRcxlJj4RNjuKBkVqsSQH/O+9gai5QbR04uzmh5immwuR
	1yg2qkSBbXRBuVWe0VBcDPzC3z776XfQGqXvu98VVWvnv/e65B6L0gXGqhhRf9Poagms=;
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} (again, part 2)
Message-Id: <E1l7vxI-000274-Ho@xenbits.xenproject.org>
Date: Fri, 05 Feb 2021 07:55:04 +0000

commit 8d26cdd3b66ab86d560dacd763d76ff3da95723e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 5 08:52:54 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 5 08:52:54 2021 +0100

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL} (again, part 2)
    
    X86_VENDOR_* aren't bit masks in the older trees.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/msr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index aefe0cbb4b..f53a186f6c 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -441,7 +441,8 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
          * a cpufreq controller dom0 which has full access.
          */
     case MSR_IA32_PERF_CTL:
-        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+        if ( cp->x86_vendor != X86_VENDOR_INTEL &&
+             cp->x86_vendor != X86_VENDOR_CENTAUR )
             goto gp_fault;
 
         if ( likely(!is_cpufreq_controller(d)) || wrmsr_safe(msr, val) == 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Fri Feb 05 07:55:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Feb 2021 07:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81532.150781 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7vxU-000705-EN; Fri, 05 Feb 2021 07:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81532.150781; Fri, 05 Feb 2021 07:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7vxU-0006zv-BD; Fri, 05 Feb 2021 07:55:16 +0000
Received: by outflank-mailman (input) for mailman id 81532;
 Fri, 05 Feb 2021 07:55:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7vxT-0006zo-7C
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 07:55:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7vxT-0000aq-5T
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 07:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7vxT-00027y-40
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 07:55:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rjPM7W9JMFTPYKCiLjENYxEUCuFVhQr2UVG7CgwuFRE=; b=TCr+G8XPiVD255JCSblv6h1Grv
	xsQhhJjdnNnFXvxncp2LC4DR+v9Z6Ut/WARb4DFYxlsfQYUUs65GiKmseXTofyOCCUF9ufY+Y+67q
	hcegpBkiISTa3kFK/wVYpedPypmw7YiWwwD2D5des0OVWT0XAOB7ZGhryQi/d88N32Ec=;
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} (again, part 2)
Message-Id: <E1l7vxT-00027y-40@xenbits.xenproject.org>
Date: Fri, 05 Feb 2021 07:55:15 +0000

commit 1c7d984645f9ade9b47e862b5880734ad498fea8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 5 08:54:03 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 5 08:54:03 2021 +0100

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL} (again, part 2)
    
    X86_VENDOR_* aren't bit masks in the older trees.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/msr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 1afb80427c..c028fbdcf4 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -393,7 +393,8 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
          * a cpufreq controller dom0 which has full access.
          */
     case MSR_IA32_PERF_CTL:
-        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+        if ( cp->x86_vendor != X86_VENDOR_INTEL &&
+             cp->x86_vendor != X86_VENDOR_CENTAUR )
             goto gp_fault;
 
         if ( likely(!is_cpufreq_controller(d)) || wrmsr_safe(msr, val) == 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Fri Feb 05 08:44:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Feb 2021 08:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81545.150796 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7wih-0004M2-76; Fri, 05 Feb 2021 08:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81545.150796; Fri, 05 Feb 2021 08:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7wih-0004Lx-4F; Fri, 05 Feb 2021 08:44:03 +0000
Received: by outflank-mailman (input) for mailman id 81545;
 Fri, 05 Feb 2021 08: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 1l7wif-0004L7-U3
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 08:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7wif-0001ub-RH
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 08:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7wif-0005OM-QF
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 08:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QQjjqCWF9Ppob6R8sSO3eLScvHqPHmdpTcHK0Nq+DGY=; b=v66ahRjxzMsnSuPi132CAZdiVA
	ZiJ/Izp1uE3BTkHvQoLMU/Y06IGLQ1TWGIYXD5Gd7zQy2OY4arGt/uC3OVZu8dPw3RCMlsb+YO0na
	bxFj55KtRji0e6ww2R0GKVicef1M8ksFeqLjS8816bk/nX0fBMWF9hOBVRShs3M+OUKk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/foreignmem: Drop useless and/or misleading logging
Message-Id: <E1l7wif-0005OM-QF@xenbits.xenproject.org>
Date: Fri, 05 Feb 2021 08:44:01 +0000

commit 9351e1468d67ee79fbc6411b087c67ac34813891
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Feb 3 15:41:55 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 3 19:25:15 2021 +0000

    libs/foreignmem: Drop useless and/or misleading logging
    
    These log lines are all in response to single system calls, and do not provide
    any information which the immediate caller can't determine themselves.  It is
    however rude to put junk like this onto stderr, especially as system call
    failures are not even error conditions in certain circumstances.
    
    The FreeBSD logging has stale function names in, and Solaris shouldn't have
    passed code review to start with.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/foreignmemory/freebsd.c | 7 ++-----
 tools/libs/foreignmemory/linux.c   | 6 +-----
 tools/libs/foreignmemory/netbsd.c  | 2 --
 tools/libs/foreignmemory/solaris.c | 2 +-
 4 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/tools/libs/foreignmemory/freebsd.c b/tools/libs/foreignmemory/freebsd.c
index 9a2796f0b7..04bfa806b0 100644
--- a/tools/libs/foreignmemory/freebsd.c
+++ b/tools/libs/foreignmemory/freebsd.c
@@ -65,10 +65,7 @@ void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem,
 
     addr = mmap(addr, num << PAGE_SHIFT, prot, flags | MAP_SHARED, fd, 0);
     if ( addr == MAP_FAILED )
-    {
-        PERROR("xc_map_foreign_bulk: mmap failed");
         return NULL;
-    }
 
     ioctlx.num = num;
     ioctlx.dom = dom;
@@ -80,7 +77,7 @@ void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem,
     if ( rc < 0 )
     {
         int saved_errno = errno;
-        PERROR("xc_map_foreign_bulk: ioctl failed");
+
         (void)munmap(addr, num << PAGE_SHIFT);
         errno = saved_errno;
         return NULL;
@@ -137,7 +134,7 @@ int osdep_xenforeignmemory_map_resource(xenforeignmemory_handle *fmem,
         int saved_errno;
 
         if ( errno != ENOSYS )
-            PERROR("mmap resource ioctl failed");
+            ;
         else
             errno = EOPNOTSUPP;
 
diff --git a/tools/libs/foreignmemory/linux.c b/tools/libs/foreignmemory/linux.c
index d0eead1196..050b9ed3a5 100644
--- a/tools/libs/foreignmemory/linux.c
+++ b/tools/libs/foreignmemory/linux.c
@@ -171,10 +171,7 @@ void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem,
     addr = mmap(addr, num << PAGE_SHIFT, prot, flags | MAP_SHARED,
                 fd, 0);
     if ( addr == MAP_FAILED )
-    {
-        PERROR("mmap failed");
         return NULL;
-    }
 
     ioctlx.num = num;
     ioctlx.dom = dom;
@@ -273,7 +270,6 @@ void *osdep_xenforeignmemory_map(xenforeignmemory_handle *fmem,
     {
         int saved_errno = errno;
 
-        PERROR("ioctl failed");
         (void)munmap(addr, num << PAGE_SHIFT);
         errno = saved_errno;
         return NULL;
@@ -330,7 +326,7 @@ int osdep_xenforeignmemory_map_resource(
         int saved_errno;
 
         if ( errno != fmem->unimpl_errno && errno != EOPNOTSUPP )
-            PERROR("ioctl failed");
+            ;
         else
             errno = EOPNOTSUPP;
 
diff --git a/tools/libs/foreignmemory/netbsd.c b/tools/libs/foreignmemory/netbsd.c
index 4ae60aafdd..565682e064 100644
--- a/tools/libs/foreignmemory/netbsd.c
+++ b/tools/libs/foreignmemory/netbsd.c
@@ -147,8 +147,6 @@ int osdep_xenforeignmemory_map_resource(
     rc = ioctl(fmem->fd, IOCTL_PRIVCMD_MMAP_RESOURCE, &mr);
     if ( rc )
     {
-        PERROR("ioctl failed");
-
         if ( fres->addr )
         {
             int saved_errno = errno;
diff --git a/tools/libs/foreignmemory/solaris.c b/tools/libs/foreignmemory/solaris.c
index ee8aae4fbd..958fb01f6d 100644
--- a/tools/libs/foreignmemory/solaris.c
+++ b/tools/libs/foreignmemory/solaris.c
@@ -83,7 +83,7 @@ void *osdep_map_foreign_batch(xenforeignmem_handle *fmem, uint32_t dom,
     if ( ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx) < 0 )
     {
         int saved_errno = errno;
-        PERROR("XXXXXXXX");
+
         (void)munmap(addr, num*XC_PAGE_SIZE);
         errno = saved_errno;
         return NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 05 08:44:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Feb 2021 08:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81548.150816 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7wir-0004QJ-J3; Fri, 05 Feb 2021 08:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81548.150816; Fri, 05 Feb 2021 08:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l7wir-0004QD-G5; Fri, 05 Feb 2021 08:44:13 +0000
Received: by outflank-mailman (input) for mailman id 81548;
 Fri, 05 Feb 2021 08:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7wip-0004Po-WF
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 08:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7wip-0001uk-V2
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 08:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l7wip-0005PJ-TN
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 08:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=C0Qxl9cjOJCN8YAAkXMLgkN7MNeqzUu3nzxqb/59S+g=; b=Hm1OAHzXPMm++XOjEH+a0ujJEn
	5YNFEUODT0jO/9lTNbG9I2UjmpYU/3GNWxvD1xbM6ynVWpcJgCvl6LuqitWQIBGQRBKYvcmERqcVR
	jLpwJmkxd0MSMo5c58du9klwZbw1MjNtBpvNQ4U7X571xq7Q0uVuWzjz8tGhMPHchnl8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/foreignmem: Fix/simplify errno handling for map_resource
Message-Id: <E1l7wip-0005PJ-TN@xenbits.xenproject.org>
Date: Fri, 05 Feb 2021 08:44:11 +0000

commit d203dbd69f1a02577dd6fe571d72beb980c548a6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Feb 3 15:43:35 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 3 19:25:35 2021 +0000

    libs/foreignmem: Fix/simplify errno handling for map_resource
    
    Simplify the FreeBSD and Linux logic, left in this state by the previous
    change.  No functional change.
    
    Duplicate the FreeBSD logic for NetBSD, to maintain the uniform ABI for
    callers that EOPNOTSUPP covers all Xen/Kernel support.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/foreignmemory/freebsd.c | 4 +---
 tools/libs/foreignmemory/linux.c   | 4 +---
 tools/libs/foreignmemory/netbsd.c  | 3 +++
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/libs/foreignmemory/freebsd.c b/tools/libs/foreignmemory/freebsd.c
index 04bfa806b0..d94ea07862 100644
--- a/tools/libs/foreignmemory/freebsd.c
+++ b/tools/libs/foreignmemory/freebsd.c
@@ -133,9 +133,7 @@ int osdep_xenforeignmemory_map_resource(xenforeignmemory_handle *fmem,
     {
         int saved_errno;
 
-        if ( errno != ENOSYS )
-            ;
-        else
+        if ( errno == ENOSYS )
             errno = EOPNOTSUPP;
 
         if ( fres->addr )
diff --git a/tools/libs/foreignmemory/linux.c b/tools/libs/foreignmemory/linux.c
index 050b9ed3a5..c1f35e2db7 100644
--- a/tools/libs/foreignmemory/linux.c
+++ b/tools/libs/foreignmemory/linux.c
@@ -325,9 +325,7 @@ int osdep_xenforeignmemory_map_resource(
     {
         int saved_errno;
 
-        if ( errno != fmem->unimpl_errno && errno != EOPNOTSUPP )
-            ;
-        else
+        if ( errno == fmem->unimpl_errno )
             errno = EOPNOTSUPP;
 
         if ( fres->addr )
diff --git a/tools/libs/foreignmemory/netbsd.c b/tools/libs/foreignmemory/netbsd.c
index 565682e064..c0b1b8f79d 100644
--- a/tools/libs/foreignmemory/netbsd.c
+++ b/tools/libs/foreignmemory/netbsd.c
@@ -147,6 +147,9 @@ int osdep_xenforeignmemory_map_resource(
     rc = ioctl(fmem->fd, IOCTL_PRIVCMD_MMAP_RESOURCE, &mr);
     if ( rc )
     {
+        if ( errno == ENOSYS )
+            errno = EOPNOTSUPP;
+
         if ( fres->addr )
         {
             int saved_errno = errno;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 05 12:55:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Feb 2021 12:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81693.151041 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l80dd-0006m0-PU; Fri, 05 Feb 2021 12:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81693.151041; Fri, 05 Feb 2021 12:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l80dd-0006ls-Mc; Fri, 05 Feb 2021 12:55:05 +0000
Received: by outflank-mailman (input) for mailman id 81693;
 Fri, 05 Feb 2021 12:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l80dc-0006ln-Hn
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 12:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l80dc-00069k-EK
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 12:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l80dc-0007Z2-BM
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 12:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Gadyt5urkc2Tv0EVTyuVgqOlNLpbzWWa0OWPR3jurg0=; b=nt6L3f0HhwNgNzW/+LoFQZ2vEE
	FkaCuH5DrHSNn1m10beQTb4jAMKje9zIEp4/hoTP6N0Y94KOZ1AQZ+yCmMknvXZ2K0HtWpqBqjL5a
	wThIb9Dqy1Lmva/t6+vjhXBZ7VS0abrXWe+3kk0zm4jI9GBzcsQ/F82EL1UdZ0RjjFwk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/tests: fix resource test build on FreeBSD
Message-Id: <E1l80dc-0007Z2-BM@xenbits.xenproject.org>
Date: Fri, 05 Feb 2021 12:55:04 +0000

commit d7acc47c8201611fda98ce5bd465626478ca4759
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Feb 5 13:19:38 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 12:52:19 2021 +0000

    tools/tests: fix resource test build on FreeBSD
    
    error.h is not a standard header, and none of the functions declared
    there are actually used by the code. This fixes the build on FreeBSD
    that doesn't have error.h
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/resource/test-resource.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/tests/resource/test-resource.c b/tools/tests/resource/test-resource.c
index a409a82f44..1caaa60e62 100644
--- a/tools/tests/resource/test-resource.c
+++ b/tools/tests/resource/test-resource.c
@@ -1,6 +1,5 @@
 #include <err.h>
 #include <errno.h>
-#include <error.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/mman.h>
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 05 13:11:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Feb 2021 13:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81712.151070 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l80t8-0000ZK-FY; Fri, 05 Feb 2021 13:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81712.151070; Fri, 05 Feb 2021 13: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 1l80t8-0000ZC-CZ; Fri, 05 Feb 2021 13:11:06 +0000
Received: by outflank-mailman (input) for mailman id 81712;
 Fri, 05 Feb 2021 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 1l80t7-0000Z7-45
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 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 1l80t6-0006TT-Vu
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 13:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l80t6-0000Nx-UD
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 13:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tlo4v3Qkk3nsITwjFpTpLtwbaaY21AY+YXJLDDtQm4Q=; b=tnuwSRbxzim01Ek/QxoBSQa6Q0
	tvr53ff17dEYjF+vflUrFv6Uzp+8ebHese5dolVdi/5XMz6pcgDu7t90A6hqPbGzq5haE/QwDXXi6
	tFNY6XvUArW8QULGDCkBocYlRepoDDvPCcYEjHuY+CMc2uf/iX7uPvj+kVu5aTLsGaRI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/EFI: work around GNU ld 2.36 issue
Message-Id: <E1l80t6-0000Nx-UD@xenbits.xenproject.org>
Date: Fri, 05 Feb 2021 13:11:04 +0000

commit f4318db940c39cc656128fcf72df3e79d2e55bc1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 5 14:09:42 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 5 14:09:42 2021 +0100

    x86/EFI: work around GNU ld 2.36 issue
    
    Our linker capability check fails with the recent binutils release's ld:
    
    .../check.o:(.debug_aranges+0x6): relocation truncated to fit: R_X86_64_32 against `.debug_info'
    .../check.o:(.debug_info+0x6): relocation truncated to fit: R_X86_64_32 against `.debug_abbrev'
    .../check.o:(.debug_info+0xc): relocation truncated to fit: R_X86_64_32 against `.debug_str'+76
    .../check.o:(.debug_info+0x11): relocation truncated to fit: R_X86_64_32 against `.debug_str'+d
    .../check.o:(.debug_info+0x15): relocation truncated to fit: R_X86_64_32 against `.debug_str'+2b
    .../check.o:(.debug_info+0x29): relocation truncated to fit: R_X86_64_32 against `.debug_line'
    .../check.o:(.debug_info+0x30): relocation truncated to fit: R_X86_64_32 against `.debug_str'+19
    .../check.o:(.debug_info+0x37): relocation truncated to fit: R_X86_64_32 against `.debug_str'+71
    .../check.o:(.debug_info+0x3e): relocation truncated to fit: R_X86_64_32 against `.debug_str'
    .../check.o:(.debug_info+0x45): relocation truncated to fit: R_X86_64_32 against `.debug_str'+5e
    .../check.o:(.debug_info+0x4c): additional relocation overflows omitted from the output
    
    Tell the linker to strip debug info as a workaround. Debug info has been
    getting stripped already anyway when linking the actual xen.efi.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 3a9b7e7b2e..dff597f30c 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -123,7 +123,7 @@ ifneq ($(efi-y),)
 # Check if the compiler supports the MS ABI.
 export XEN_BUILD_EFI := $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o efi/check.o 2>/dev/null && echo y)
 # Check if the linker supports PE.
-XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) -mi386pep --subsystem=10 -o efi/check.efi efi/check.o 2>/dev/null && echo y))
+XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) -mi386pep --subsystem=10 -S -o efi/check.efi efi/check.o 2>/dev/null && echo y))
 CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
 endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 05 19:11:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Feb 2021 19:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81895.151446 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l86VW-0007Gh-HW; Fri, 05 Feb 2021 19:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81895.151446; Fri, 05 Feb 2021 19:11:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l86VW-0007GY-EG; Fri, 05 Feb 2021 19:11:06 +0000
Received: by outflank-mailman (input) for mailman id 81895;
 Fri, 05 Feb 2021 19: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 1l86VV-0007GT-GE
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19: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 1l86VV-0004dM-D8
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l86VV-00067E-BB
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19: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=0Dvs/JZOvgKXZLpgT8u1PEaB1JFc40vOrXOYr24z35o=; b=xW9Tv1XTBVMlLr+Wiyrchle8sj
	5Gqo214tcoq5ZlNbDHebJ4vPcRvXmUt7g74sJXErzWQ4bI7X1ybS+F9B7qOtvRZ9rZFSQcQEEJabq
	YaXvKS9ldYEcbkoWTYt+MwQrUvpvAXtng0GdT3uHsEErT+9fsgVP1coPiypLzHcJZmEc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/memory: Fix mapping grant tables with XENMEM_acquire_resource
Message-Id: <E1l86VV-00067E-BB@xenbits.xenproject.org>
Date: Fri, 05 Feb 2021 19:11:05 +0000

commit 34cc2e5f8dba6906da82fe8d76e839f9ab20f153
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jul 27 17:24:11 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:27 2021 +0000

    xen/memory: Fix mapping grant tables with XENMEM_acquire_resource
    
    A guest's default number of grant frames is 64, and XENMEM_acquire_resource
    will reject an attempt to map more than 32 frames.  This limit is caused by
    the size of mfn_list[] on the stack.
    
    Fix mapping of arbitrary size requests by looping over batches of 32 in
    acquire_resource(), and using hypercall continuations when necessary.
    
    To start with, break _acquire_resource() out of acquire_resource() to cope
    with type-specific dispatching, and update the return semantics to indicate
    the number of mfns returned.  Update gnttab_acquire_resource() and x86's
    arch_acquire_resource() to match these new semantics.
    
    Have do_memory_op() pass start_extent into acquire_resource() so it can pick
    up where it left off after a continuation, and loop over batches of 32 until
    all the work is done, or a continuation needs to occur.
    
    compat_memory_op() is a bit more complicated, because it also has to marshal
    frame_list in the XLAT buffer.  Have it account for continuation information
    itself and hide details from the upper layer, so it can marshal the buffer in
    chunks if necessary.
    
    With these fixes in place, it is now possible to map the whole grant table for
    a guest.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/common/compat/memory.c | 114 +++++++++++++++++++++++++++++++++--------
 xen/common/grant_table.c   |   3 ++
 xen/common/memory.c        | 124 +++++++++++++++++++++++++++++++++------------
 3 files changed, 187 insertions(+), 54 deletions(-)

diff --git a/xen/common/compat/memory.c b/xen/common/compat/memory.c
index 834c5e19d1..c43fa97cf1 100644
--- a/xen/common/compat/memory.c
+++ b/xen/common/compat/memory.c
@@ -402,23 +402,10 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat)
         case XENMEM_acquire_resource:
         {
             xen_pfn_t *xen_frame_list = NULL;
-            unsigned int max_nr_frames;
 
             if ( copy_from_guest(&cmp.mar, compat, 1) )
                 return -EFAULT;
 
-            /*
-             * The number of frames handled is currently limited to a
-             * small number by the underlying implementation, so the
-             * scratch space should be sufficient for bouncing the
-             * frame addresses.
-             */
-            max_nr_frames = (COMPAT_ARG_XLAT_SIZE - sizeof(*nat.mar)) /
-                sizeof(*xen_frame_list);
-
-            if ( cmp.mar.nr_frames > max_nr_frames )
-                return -E2BIG;
-
             /* Marshal the frame list in the remainder of the xlat space. */
             if ( !compat_handle_is_null(cmp.mar.frame_list) )
                 xen_frame_list = (xen_pfn_t *)(nat.mar + 1);
@@ -432,6 +419,28 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat)
 
             if ( xen_frame_list && cmp.mar.nr_frames )
             {
+                unsigned int xlat_max_frames =
+                    (COMPAT_ARG_XLAT_SIZE - sizeof(*nat.mar)) /
+                    sizeof(*xen_frame_list);
+
+                if ( start_extent >= cmp.mar.nr_frames )
+                    return -EINVAL;
+
+                /*
+                 * Adjust nat to account for work done on previous
+                 * continuations, leaving cmp pristine.  Hide the continaution
+                 * from the native code to prevent double accounting.
+                 */
+                nat.mar->nr_frames -= start_extent;
+                nat.mar->frame += start_extent;
+                cmd &= MEMOP_CMD_MASK;
+
+                /*
+                 * If there are two many frames to fit within the xlat buffer,
+                 * we'll need to loop to marshal them all.
+                 */
+                nat.mar->nr_frames = min(nat.mar->nr_frames, xlat_max_frames);
+
                 /*
                  * frame_list is an input for translated guests, and an output
                  * for untranslated guests.  Only copy in for translated guests.
@@ -444,14 +453,14 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat)
                                              cmp.mar.nr_frames) ||
                          __copy_from_compat_offset(
                              compat_frame_list, cmp.mar.frame_list,
-                             0, cmp.mar.nr_frames) )
+                             start_extent, nat.mar->nr_frames) )
                         return -EFAULT;
 
                     /*
                      * Iterate backwards over compat_frame_list[] expanding
                      * compat_pfn_t to xen_pfn_t in place.
                      */
-                    for ( int x = cmp.mar.nr_frames - 1; x >= 0; --x )
+                    for ( int x = nat.mar->nr_frames - 1; x >= 0; --x )
                         xen_frame_list[x] = compat_frame_list[x];
                 }
             }
@@ -600,9 +609,11 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat)
         case XENMEM_acquire_resource:
         {
             DEFINE_XEN_GUEST_HANDLE(compat_mem_acquire_resource_t);
+            unsigned int done;
 
             if ( compat_handle_is_null(cmp.mar.frame_list) )
             {
+                ASSERT(split == 0 && rc == 0);
                 if ( __copy_field_to_guest(
                          guest_handle_cast(compat,
                                            compat_mem_acquire_resource_t),
@@ -611,6 +622,21 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat)
                 break;
             }
 
+            if ( split < 0 )
+            {
+                /* Continuation occurred. */
+                ASSERT(rc != XENMEM_acquire_resource);
+                done = cmd >> MEMOP_EXTENT_SHIFT;
+            }
+            else
+            {
+                /* No continuation. */
+                ASSERT(rc == 0);
+                done = nat.mar->nr_frames;
+            }
+
+            ASSERT(done <= nat.mar->nr_frames);
+
             /*
              * frame_list is an input for translated guests, and an output for
              * untranslated guests.  Only copy out for untranslated guests.
@@ -626,21 +652,67 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat)
                  */
                 BUILD_BUG_ON(sizeof(compat_pfn_t) > sizeof(xen_pfn_t));
 
-                for ( i = 0; i < cmp.mar.nr_frames; i++ )
+                rc = 0;
+                for ( i = 0; i < done; i++ )
                 {
                     compat_pfn_t frame = xen_frame_list[i];
 
                     if ( frame != xen_frame_list[i] )
-                        return -ERANGE;
+                    {
+                        rc = -ERANGE;
+                        break;
+                    }
 
                     compat_frame_list[i] = frame;
                 }
 
-                if ( __copy_to_compat_offset(cmp.mar.frame_list, 0,
-                                             compat_frame_list,
-                                             cmp.mar.nr_frames) )
-                    return -EFAULT;
+                if ( !rc && __copy_to_compat_offset(
+                         cmp.mar.frame_list, start_extent,
+                         compat_frame_list, done) )
+                    rc = -EFAULT;
+
+                if ( rc )
+                {
+                    if ( split < 0 )
+                    {
+                        gdprintk(XENLOG_ERR,
+                                 "Cannot cancel continuation: %ld\n", rc);
+                        domain_crash(current->domain);
+                    }
+                    return rc;
+                }
+            }
+
+            start_extent += done;
+
+            /* Completely done. */
+            if ( start_extent == cmp.mar.nr_frames )
+                break;
+
+            /*
+             * Done a "full" batch, but we were limited by space in the xlat
+             * area.  Go around the loop again without necesserily returning
+             * to guest context.
+             */
+            if ( done == nat.mar->nr_frames )
+            {
+                split = 1;
+                break;
             }
+
+            /* Explicit continuation request from a higher level. */
+            if ( done < nat.mar->nr_frames )
+                return hypercall_create_continuation(
+                    __HYPERVISOR_memory_op, "ih",
+                    op | (start_extent << MEMOP_EXTENT_SHIFT), compat);
+
+            /*
+             * Well... Somethings gone wrong with the two levels of chunking.
+             * My condolences to whomever next has to debug this mess.
+             */
+            ASSERT_UNREACHABLE();
+            domain_crash(current->domain);
+            split = 0;
             break;
         }
 
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 280b7969b6..b95403695f 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -4053,6 +4053,9 @@ int gnttab_acquire_resource(
     for ( i = 0; i < nr_frames; ++i )
         mfn_list[i] = virt_to_mfn(vaddrs[frame + i]);
 
+    /* Success.  Passed nr_frames back to the caller. */
+    rc = nr_frames;
+
  out:
     grant_write_unlock(gt);
 
diff --git a/xen/common/memory.c b/xen/common/memory.c
index f23b001fd2..7b012ce291 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -1129,23 +1129,41 @@ static int acquire_ioreq_server(struct domain *d,
         mfn_list[i] = mfn_x(mfn);
     }
 
-    return 0;
+    /* Success.  Passed nr_frames back to the caller. */
+    return nr_frames;
 #else
     return -EOPNOTSUPP;
 #endif
 }
 
+/*
+ * Returns -errno on error, or positive in the range [1, nr_frames] on
+ * success.  Returning less than nr_frames contitutes a request for a
+ * continuation.  Callers can depend on frame + nr_frames not overflowing.
+ */
+static int _acquire_resource(
+    struct domain *d, unsigned int type, unsigned int id, unsigned int frame,
+    unsigned int nr_frames, xen_pfn_t mfn_list[])
+{
+    switch ( type )
+    {
+    case XENMEM_resource_grant_table:
+        return gnttab_acquire_resource(d, id, frame, nr_frames, mfn_list);
+
+    case XENMEM_resource_ioreq_server:
+        return acquire_ioreq_server(d, id, frame, nr_frames, mfn_list);
+
+    default:
+        return -EOPNOTSUPP;
+    }
+}
+
 static int acquire_resource(
-    XEN_GUEST_HANDLE_PARAM(xen_mem_acquire_resource_t) arg)
+    XEN_GUEST_HANDLE_PARAM(xen_mem_acquire_resource_t) arg,
+    unsigned long start_extent)
 {
     struct domain *d, *currd = current->domain;
     xen_mem_acquire_resource_t xmar;
-    /*
-     * The mfn_list and gfn_list (below) arrays are ok on stack for the
-     * moment since they are small, but if they need to grow in future
-     * use-cases then per-CPU arrays or heap allocations may be required.
-     */
-    xen_pfn_t mfn_list[32];
     unsigned int max_frames;
     int rc;
 
@@ -1158,9 +1176,6 @@ static int acquire_resource(
     if ( xmar.pad != 0 )
         return -EINVAL;
 
-    if ( xmar.nr_frames > ARRAY_SIZE(mfn_list) )
-        return -E2BIG;
-
     /*
      * The ABI is rather unfortunate.  nr_frames (and therefore the total size
      * of the resource) is 32bit, while frame (the offset within the resource
@@ -1190,7 +1205,7 @@ static int acquire_resource(
 
     if ( guest_handle_is_null(xmar.frame_list) )
     {
-        if ( xmar.nr_frames )
+        if ( xmar.nr_frames || start_extent )
             goto out;
 
         xmar.nr_frames = max_frames;
@@ -1198,30 +1213,47 @@ static int acquire_resource(
         goto out;
     }
 
-    do {
-        switch ( xmar.type )
-        {
-        case XENMEM_resource_grant_table:
-            rc = gnttab_acquire_resource(d, xmar.id, xmar.frame, xmar.nr_frames,
-                                         mfn_list);
-            break;
+    /*
+     * Limiting nr_frames at (UINT_MAX >> MEMOP_EXTENT_SHIFT) isn't ideal.  If
+     * it ever becomes a practical problem, we can switch to mutating
+     * xmar.{frame,nr_frames,frame_list} in guest memory.
+     */
+    rc = -EINVAL;
+    if ( start_extent >= xmar.nr_frames ||
+         xmar.nr_frames > (UINT_MAX >> MEMOP_EXTENT_SHIFT) )
+        goto out;
 
-        case XENMEM_resource_ioreq_server:
-            rc = acquire_ioreq_server(d, xmar.id, xmar.frame, xmar.nr_frames,
-                                      mfn_list);
-            break;
+    /* Adjust for work done on previous continuations. */
+    xmar.nr_frames -= start_extent;
+    xmar.frame += start_extent;
+    guest_handle_add_offset(xmar.frame_list, start_extent);
 
-        default:
-            rc = -EOPNOTSUPP;
-            break;
-        }
+    do {
+        /*
+         * Arbitrary size.  Not too much stack space, and a reasonable stride
+         * for continuation checks.
+         */
+        xen_pfn_t mfn_list[32];
+        unsigned int todo = MIN(ARRAY_SIZE(mfn_list), xmar.nr_frames), done;
 
-        if ( rc )
+        rc = _acquire_resource(d, xmar.type, xmar.id, xmar.frame,
+                               todo, mfn_list);
+        if ( rc < 0 )
+            goto out;
+
+        done = rc;
+        rc = 0;
+        if ( done == 0 || done > todo )
+        {
+            ASSERT_UNREACHABLE();
+            rc = -EINVAL;
             goto out;
+        }
 
+        /* Adjust guest frame_list appropriately. */
         if ( !paging_mode_translate(currd) )
         {
-            if ( copy_to_guest(xmar.frame_list, mfn_list, xmar.nr_frames) )
+            if ( copy_to_guest(xmar.frame_list, mfn_list, done) )
                 rc = -EFAULT;
         }
         else
@@ -1229,10 +1261,10 @@ static int acquire_resource(
             xen_pfn_t gfn_list[ARRAY_SIZE(mfn_list)];
             unsigned int i;
 
-            if ( copy_from_guest(gfn_list, xmar.frame_list, xmar.nr_frames) )
+            if ( copy_from_guest(gfn_list, xmar.frame_list, done) )
                 rc = -EFAULT;
 
-            for ( i = 0; !rc && i < xmar.nr_frames; i++ )
+            for ( i = 0; !rc && i < done; i++ )
             {
                 rc = set_foreign_p2m_entry(currd, d, gfn_list[i],
                                            _mfn(mfn_list[i]));
@@ -1241,7 +1273,32 @@ static int acquire_resource(
                     rc = -EIO;
             }
         }
-    } while ( 0 );
+
+        if ( rc )
+            goto out;
+
+        xmar.nr_frames -= done;
+        xmar.frame += done;
+        guest_handle_add_offset(xmar.frame_list, done);
+        start_extent += done;
+
+        /*
+         * Explicit continuation request from _acquire_resource(), or we've
+         * still got more work to do.
+         */
+        if ( done < todo ||
+             (xmar.nr_frames && hypercall_preempt_check()) )
+        {
+            rc = hypercall_create_continuation(
+                __HYPERVISOR_memory_op, "lh",
+                XENMEM_acquire_resource | (start_extent << MEMOP_EXTENT_SHIFT),
+                arg);
+            goto out;
+        }
+
+    } while ( xmar.nr_frames );
+
+    rc = 0;
 
  out:
     rcu_unlock_domain(d);
@@ -1708,7 +1765,8 @@ long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
     case XENMEM_acquire_resource:
         rc = acquire_resource(
-            guest_handle_cast(arg, xen_mem_acquire_resource_t));
+            guest_handle_cast(arg, xen_mem_acquire_resource_t),
+            start_extent);
         break;
 
     default:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 05 19:11:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Feb 2021 19:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81896.151449 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l86Vg-0007HY-JH; Fri, 05 Feb 2021 19:11:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81896.151449; Fri, 05 Feb 2021 19: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 1l86Vg-0007HP-Ft; Fri, 05 Feb 2021 19:11:16 +0000
Received: by outflank-mailman (input) for mailman id 81896;
 Fri, 05 Feb 2021 19: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 1l86Vf-0007HG-Ju
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19: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 1l86Vf-0004dZ-Hw
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l86Vf-00068E-Fi
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19: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=MIRpzo3TeqTvo9maqRkxExu6beDDGXxTPre3U1TJXe0=; b=j2O4k/a1a4fvfOsvngy+cKk4aY
	t6DNxI/EPCLyMXRuwIrmA+SFIvN1b+ad7M3UZFb4MAr7Koacr5IZ+duwvwitOWIx2yTwHAT9l3WYQ
	mOhB1wiVVPeHOeEKnEUhjN0NQ2KF1kr2IuHDDqZrLTeL8gYTqW/pj7C/yUVfTlhe0eHs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/domain: Add vmtrace_size domain creation parameter
Message-Id: <E1l86Vf-00068E-Fi@xenbits.xenproject.org>
Date: Fri, 05 Feb 2021 19:11:15 +0000

commit 217dd79ee29286b85074d22cc75ee064206fb2af
Author:     Michał Leszczyński <michal.leszczynski@cert.pl>
AuthorDate: Fri Jul 3 01:16:10 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:27 2021 +0000

    xen/domain: Add vmtrace_size domain creation parameter
    
    To use vmtrace, buffers of a suitable size need allocating, and different
    tasks will want different sizes.
    
    Add a domain creation parameter, and audit it appropriately in the
    {arch_,}sanitise_domain_config() functions.
    
    For now, the x86 specific auditing is tuned to Processor Trace running in
    Single Output mode, which requires a single contiguous range of memory.
    
    The size is given an arbitrary limit of 64M which is expected to be enough for
    anticipated usecases, but not large enough to get into long-running-hypercall
    problems.
    
    Signed-off-by: Michał Leszczyński <michal.leszczynski@cert.pl>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/domain.c       | 23 ++++++++++++++
 xen/common/domain.c         | 77 +++++++++++++++++++++++++++++++++++++++++++++
 xen/include/public/domctl.h |  3 ++
 xen/include/xen/sched.h     |  6 ++++
 4 files changed, 109 insertions(+)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index b9ba04633e..6c7ee25f3b 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -660,6 +660,29 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
         return -EINVAL;
     }
 
+    if ( config->vmtrace_size )
+    {
+        unsigned int size = config->vmtrace_size;
+
+        ASSERT(vmtrace_available); /* Checked by common code. */
+
+        /*
+         * For now, vmtrace is restricted to HVM guests, and using a
+         * power-of-2 buffer between 4k and 64M in size.
+         */
+        if ( !hvm )
+        {
+            dprintk(XENLOG_INFO, "vmtrace not supported for PV\n");
+            return -EINVAL;
+        }
+
+        if ( size < PAGE_SIZE || size > MB(64) || (size & (size - 1)) )
+        {
+            dprintk(XENLOG_INFO, "Unsupported vmtrace size: %#x\n", size);
+            return -EINVAL;
+        }
+    }
+
     return 0;
 }
 
diff --git a/xen/common/domain.c b/xen/common/domain.c
index d1e94d88cf..d85984638a 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -132,6 +132,69 @@ static void vcpu_info_reset(struct vcpu *v)
     v->vcpu_info_mfn = INVALID_MFN;
 }
 
+static void vmtrace_free_buffer(struct vcpu *v)
+{
+    const struct domain *d = v->domain;
+    struct page_info *pg = v->vmtrace.pg;
+    unsigned int i;
+
+    if ( !pg )
+        return;
+
+    v->vmtrace.pg = NULL;
+
+    for ( i = 0; i < (d->vmtrace_size >> PAGE_SHIFT); i++ )
+    {
+        put_page_alloc_ref(&pg[i]);
+        put_page_and_type(&pg[i]);
+    }
+}
+
+static int vmtrace_alloc_buffer(struct vcpu *v)
+{
+    struct domain *d = v->domain;
+    struct page_info *pg;
+    unsigned int i;
+
+    if ( !d->vmtrace_size )
+        return 0;
+
+    pg = alloc_domheap_pages(d, get_order_from_bytes(d->vmtrace_size),
+                             MEMF_no_refcount);
+    if ( !pg )
+        return -ENOMEM;
+
+    for ( i = 0; i < (d->vmtrace_size >> PAGE_SHIFT); i++ )
+        if ( unlikely(!get_page_and_type(&pg[i], d, PGT_writable_page)) )
+            /*
+             * The domain can't possibly know about this page yet, so failure
+             * here is a clear indication of something fishy going on.
+             */
+            goto refcnt_err;
+
+    /*
+     * We must only let vmtrace_free_buffer() take any action in the success
+     * case when we've taken all the refs it intends to drop.
+     */
+    v->vmtrace.pg = pg;
+    return 0;
+
+ refcnt_err:
+    /*
+     * We can theoretically reach this point if someone has taken 2^43 refs on
+     * the frames in the time the above loop takes to execute, or someone has
+     * made a blind decrease reservation hypercall and managed to pick the
+     * right mfn.  Free the memory we safely can, and leak the rest.
+     */
+    while ( i-- )
+    {
+        put_page_alloc_ref(&pg[i]);
+        put_page_and_type(&pg[i]);
+    }
+
+    return -ENODATA;
+}
+
 /*
  * Release resources held by a vcpu.  There may or may not be live references
  * to the vcpu, and it may or may not be fully constructed.
@@ -140,6 +203,8 @@ static void vcpu_info_reset(struct vcpu *v)
  */
 static int vcpu_teardown(struct vcpu *v)
 {
+    vmtrace_free_buffer(v);
+
     return 0;
 }
 
@@ -201,6 +266,9 @@ struct vcpu *vcpu_create(struct domain *d, unsigned int vcpu_id)
     if ( sched_init_vcpu(v) != 0 )
         goto fail_wq;
 
+    if ( vmtrace_alloc_buffer(v) != 0 )
+        goto fail_wq;
+
     if ( arch_vcpu_create(v) != 0 )
         goto fail_sched;
 
@@ -449,6 +517,12 @@ static int sanitise_domain_config(struct xen_domctl_createdomain *config)
         }
     }
 
+    if ( config->vmtrace_size && !vmtrace_available )
+    {
+        dprintk(XENLOG_INFO, "vmtrace requested but not available\n");
+        return -EINVAL;
+    }
+
     return arch_sanitise_domain_config(config);
 }
 
@@ -474,7 +548,10 @@ struct domain *domain_create(domid_t domid,
     ASSERT(is_system_domain(d) ? config == NULL : config != NULL);
 
     if ( config )
+    {
         d->options = config->flags;
+        d->vmtrace_size = config->vmtrace_size;
+    }
 
     /* Sort out our idea of is_control_domain(). */
     d->is_privileged = is_priv;
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 666aeb71bf..88a5b1ef5d 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -95,6 +95,9 @@ struct xen_domctl_createdomain {
     int32_t max_grant_frames;
     int32_t max_maptrack_frames;
 
+    /* Per-vCPU buffer size in bytes.  0 to disable. */
+    uint32_t vmtrace_size;
+
     struct xen_arch_domainconfig arch;
 };
 
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 06dba1a397..bc78a09a53 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -272,6 +272,10 @@ struct vcpu
     /* vPCI per-vCPU area, used to store data for long running operations. */
     struct vpci_vcpu vpci;
 
+    struct {
+        struct page_info *pg; /* One contiguous allocation of d->vmtrace_size */
+    } vmtrace;
+
     struct arch_vcpu arch;
 
 #ifdef CONFIG_IOREQ_SERVER
@@ -547,6 +551,8 @@ struct domain
         unsigned int guest_request_sync          : 1;
     } monitor;
 
+    unsigned int vmtrace_size; /* Buffer size in bytes, or 0 to disable. */
+
 #ifdef CONFIG_ARGO
     /* Argo interdomain communication support */
     struct argo_domain *argo;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 05 19:11:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Feb 2021 19:11:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81897.151454 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l86Vr-0007JH-M0; Fri, 05 Feb 2021 19:11:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81897.151454; Fri, 05 Feb 2021 19: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 1l86Vr-0007J9-Iz; Fri, 05 Feb 2021 19:11:27 +0000
Received: by outflank-mailman (input) for mailman id 81897;
 Fri, 05 Feb 2021 19: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 1l86Vp-0007Iw-Nm
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19: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 1l86Vp-0004do-My
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l86Vp-00069L-L0
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19: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=e6MPBtR+9zGYNzwTzO4fOL0ZKpumEVE3y5pFnplVprs=; b=Yv4sem2w0NZORTKJ1dSUfm472P
	4Rp9erzEG8I34fzSy7gUUiO1sen6YiI3x5wyh+4CPZB0QkKnWvC2tpmpF+mjRmCOndU1dqDDtua/U
	Ndl9UMEPDnbFm3lnXUVpgV1cnZ7uNvuig1gp7pyVxIb85hBl3+xWtJSPG9kff0O8qcDU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/[lib]xl: Add vmtrace_buf_size parameter
Message-Id: <E1l86Vp-00069L-L0@xenbits.xenproject.org>
Date: Fri, 05 Feb 2021 19:11:25 +0000

commit 45ba9a7d7688a6a08200e37a8caa2bc99bb4d267
Author:     Michał Leszczyński <michal.leszczynski@cert.pl>
AuthorDate: Fri Jun 19 00:31:24 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:27 2021 +0000

    tools/[lib]xl: Add vmtrace_buf_size parameter
    
    Allow to specify the size of per-vCPU trace buffer upon
    domain creation. This is zero by default (meaning: not enabled).
    
    Signed-off-by: Michał Leszczyński <michal.leszczynski@cert.pl>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 docs/man/xl.cfg.5.pod.in             | 9 +++++++++
 tools/golang/xenlight/helpers.gen.go | 2 ++
 tools/golang/xenlight/types.gen.go   | 1 +
 tools/include/libxl.h                | 7 +++++++
 tools/libs/light/libxl_create.c      | 1 +
 tools/libs/light/libxl_types.idl     | 4 ++++
 tools/xl/xl_parse.c                  | 4 ++++
 7 files changed, 28 insertions(+)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index 7cdb8595d3..040374dcd6 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -681,6 +681,15 @@ Windows).
 
 If this option is not specified then it will default to B<false>.
 
+=item B<vmtrace_buf_kb=KBYTES>
+
+Specifies the size of vmtrace buffer that would be allocated for each
+vCPU belonging to this domain.  Disabled (i.e.  B<vmtrace_buf_kb=0>) by
+default.
+
+B<NOTE>: Acceptable values are platform specific.  For Intel Processor
+Trace, this value must be a power of 2 between 4k and 16M.
+
 =back
 
 =head2 Devices
diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 63e2876463..4c60d27a9c 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -1114,6 +1114,7 @@ return fmt.Errorf("invalid union key '%v'", x.Type)}
 x.ArchArm.GicVersion = GicVersion(xc.arch_arm.gic_version)
 x.ArchArm.Vuart = VuartType(xc.arch_arm.vuart)
 x.Altp2M = Altp2MMode(xc.altp2m)
+x.VmtraceBufKb = int(xc.vmtrace_buf_kb)
 
  return nil}
 
@@ -1589,6 +1590,7 @@ return fmt.Errorf("invalid union key '%v'", x.Type)}
 xc.arch_arm.gic_version = C.libxl_gic_version(x.ArchArm.GicVersion)
 xc.arch_arm.vuart = C.libxl_vuart_type(x.ArchArm.Vuart)
 xc.altp2m = C.libxl_altp2m_mode(x.Altp2M)
+xc.vmtrace_buf_kb = C.int(x.VmtraceBufKb)
 
  return nil
  }
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index 5851c38057..cb13002fdb 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -514,6 +514,7 @@ GicVersion GicVersion
 Vuart VuartType
 }
 Altp2M Altp2MMode
+VmtraceBufKb int
 }
 
 type domainBuildInfoTypeUnion interface {
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index f48d0c5e8a..a7b673e89d 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -488,6 +488,13 @@
  */
 #define LIBXL_HAVE_PHYSINFO_CAP_VMTRACE 1
 
+/*
+ * LIBXL_HAVE_VMTRACE_BUF_KB indicates that libxl_domain_create_info has a
+ * vmtrace_buf_kb parameter, which allows to enable pre-allocation of
+ * processor tracing buffers of given size.
+ */
+#define LIBXL_HAVE_VMTRACE_BUF_KB 1
+
 /*
  * libxl ABI compatibility
  *
diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index 9848d65f36..46f68da697 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -607,6 +607,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
             .max_evtchn_port = b_info->event_channels,
             .max_grant_frames = b_info->max_grant_frames,
             .max_maptrack_frames = b_info->max_maptrack_frames,
+            .vmtrace_size = ROUNDUP(b_info->vmtrace_buf_kb << 10, XC_PAGE_SHIFT),
         };
 
         if (info->type != LIBXL_DOMAIN_TYPE_PV) {
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index dacb7df6b7..5b85a7419f 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -648,6 +648,10 @@ libxl_domain_build_info = Struct("domain_build_info",[
     # supported by x86 HVM and ARM support is planned.
     ("altp2m", libxl_altp2m_mode),
 
+    # Size of preallocated vmtrace trace buffers (in KBYTES).
+    # Use zero value to disable this feature.
+    ("vmtrace_buf_kb", integer),
+
     ], dir=DIR_IN,
        copy_deprecated_fn="libxl__domain_build_info_copy_deprecated",
 )
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 867e4d068a..1893cfc086 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1863,6 +1863,10 @@ void parse_config_data(const char *config_source,
         }
     }
 
+    if (!xlu_cfg_get_long(config, "vmtrace_buf_kb", &l, 1) && l) {
+        b_info->vmtrace_buf_kb = l;
+    }
+
     if (!xlu_cfg_get_list(config, "ioports", &ioports, &num_ioports, 0)) {
         b_info->num_ioports = num_ioports;
         b_info->ioports = calloc(num_ioports, sizeof(*b_info->ioports));
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 05 19:11:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Feb 2021 19:11:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81899.151458 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l86W1-0007Kd-NR; Fri, 05 Feb 2021 19:11:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81899.151458; Fri, 05 Feb 2021 19:11:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l86W1-0007KV-Kb; Fri, 05 Feb 2021 19:11:37 +0000
Received: by outflank-mailman (input) for mailman id 81899;
 Fri, 05 Feb 2021 19: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 1l86Vz-0007KN-RB
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19: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 1l86Vz-0004eF-QX
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:11:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l86Vz-0006AZ-P9
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19: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=a+9hdsGkkAJJ3GQE6Sci4PclxymDFfhj13XEMEDTIL4=; b=cyEMKlobt89AJFuBGATtI5rHTC
	2LiEL1Xe58lJ/4PPGDxv5+Bs/+qEJXoPUvirY5T1bVK6cukDz5hfhRHfXeQwmIJVBlLkRgK5FON6o
	nLoKYbYghRn/uGKFL8QrkKXyFD7P7JscipRlnjujRGDHGNwkcA7rd7h0ZZ00bPWxIO5c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/memory: Add a vmtrace_buf resource type
Message-Id: <E1l86Vz-0006AZ-P9@xenbits.xenproject.org>
Date: Fri, 05 Feb 2021 19:11:35 +0000

commit b72eab263592a3d76aa826675e5d62606d83cecd
Author:     Michał Leszczyński <michal.leszczynski@cert.pl>
AuthorDate: Mon Jun 29 00:05:51 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:27 2021 +0000

    xen/memory: Add a vmtrace_buf resource type
    
    Allow to map processor trace buffer using acquire_resource().
    
    Signed-off-by: Michał Leszczyński <michal.leszczynski@cert.pl>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/common/memory.c         | 29 +++++++++++++++++++++++++++++
 xen/include/public/memory.h |  1 +
 2 files changed, 30 insertions(+)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index 7b012ce291..76b9f58478 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -1096,6 +1096,9 @@ static unsigned int resource_max_frames(const struct domain *d,
     case XENMEM_resource_ioreq_server:
         return ioreq_server_max_frames(d);
 
+    case XENMEM_resource_vmtrace_buf:
+        return d->vmtrace_size >> PAGE_SHIFT;
+
     default:
         return -EOPNOTSUPP;
     }
@@ -1136,6 +1139,29 @@ static int acquire_ioreq_server(struct domain *d,
 #endif
 }
 
+static int acquire_vmtrace_buf(
+    struct domain *d, unsigned int id, unsigned int frame,
+    unsigned int nr_frames, xen_pfn_t mfn_list[])
+{
+    const struct vcpu *v = domain_vcpu(d, id);
+    unsigned int i;
+    mfn_t mfn;
+
+    if ( !v )
+        return -ENOENT;
+
+    if ( !v->vmtrace.pg ||
+         (frame + nr_frames) > (d->vmtrace_size >> PAGE_SHIFT) )
+        return -EINVAL;
+
+    mfn = page_to_mfn(v->vmtrace.pg);
+
+    for ( i = 0; i < nr_frames; i++ )
+        mfn_list[i] = mfn_x(mfn) + frame + i;
+
+    return nr_frames;
+}
+
 /*
  * Returns -errno on error, or positive in the range [1, nr_frames] on
  * success.  Returning less than nr_frames contitutes a request for a
@@ -1153,6 +1179,9 @@ static int _acquire_resource(
     case XENMEM_resource_ioreq_server:
         return acquire_ioreq_server(d, id, frame, nr_frames, mfn_list);
 
+    case XENMEM_resource_vmtrace_buf:
+        return acquire_vmtrace_buf(d, id, frame, nr_frames, mfn_list);
+
     default:
         return -EOPNOTSUPP;
     }
diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h
index 020c79d757..50e73eef98 100644
--- a/xen/include/public/memory.h
+++ b/xen/include/public/memory.h
@@ -625,6 +625,7 @@ struct xen_mem_acquire_resource {
 
 #define XENMEM_resource_ioreq_server 0
 #define XENMEM_resource_grant_table 1
+#define XENMEM_resource_vmtrace_buf 2
 
     /*
      * IN - a type-specific resource identifier, which must be zero
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 05 19:11:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Feb 2021 19:11:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81900.151463 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l86WB-0007MO-PM; Fri, 05 Feb 2021 19:11:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81900.151463; Fri, 05 Feb 2021 19:11:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l86WB-0007MG-M6; Fri, 05 Feb 2021 19:11:47 +0000
Received: by outflank-mailman (input) for mailman id 81900;
 Fri, 05 Feb 2021 19:11: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 1l86W9-0007M3-W2
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19: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 1l86W9-0004eO-VA
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:11:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l86W9-0006BU-T0
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:11:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ppHbFLT/ggPrw5/vAdv/xsvmOKyd3Om03NIQ58y/7og=; b=q+/1TUmS2t2Z4X9gUetrr3AShT
	wOIoODg2HdWaavqZ/3XidD1nOgv5kcyy4wAW0W9QpumY/g33H3YbzTYqIVKThLRBT5VHh+JS7Hzat
	E+n2AlOIiKeoCPMFTkcSoEZSjO7Xl4FMw9VaXhliW08fVLapWTw67aZ8rWdj+FjpLlmQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vmx: Add Intel Processor Trace support
Message-Id: <E1l86W9-0006BU-T0@xenbits.xenproject.org>
Date: Fri, 05 Feb 2021 19:11:45 +0000

commit 71cb03f03ce309e8cc1dacd18aa383ccea6af231
Author:     Michał Leszczyński <michal.leszczynski@cert.pl>
AuthorDate: Tue Jun 16 15:20:18 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:27 2021 +0000

    x86/vmx: Add Intel Processor Trace support
    
    Add CPUID/MSR enumeration details for Processor Trace.  For now, we will only
    support its use inside VMX operation.  Fill in the vmtrace_available boolean
    to activate the newly introduced common infrastructure for allocating trace
    buffers.
    
    For now, Processor Trace is going to be operated in Single Output mode behind
    the guests back.  Add the MSRs to struct vcpu_msrs, and set up the buffer
    limit in vmx_init_ipt() as it is fixed for the lifetime of the domain.
    
    Context switch the most of the MSRs in and out of vCPU context, but the main
    control register needs to reside in the MSR load/save lists.  Explicitly pull
    the msrs pointer out into a local variable, because the optimiser cannot keep
    it live across the memory clobbers in the MSR accesses.
    
    Signed-off-by: Michał Leszczyński <michal.leszczynski@cert.pl>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/light/libxl_cpuid.c              |  1 +
 tools/misc/xen-cpuid.c                      |  2 +-
 xen/arch/x86/hvm/vmx/vmcs.c                 | 19 +++++++++++++---
 xen/arch/x86/hvm/vmx/vmx.c                  | 34 ++++++++++++++++++++++++++++-
 xen/include/asm-x86/cpufeature.h            |  1 +
 xen/include/asm-x86/hvm/vmx/vmcs.h          |  4 ++++
 xen/include/asm-x86/msr.h                   | 32 +++++++++++++++++++++++++++
 xen/include/public/arch-x86/cpufeatureset.h |  1 +
 8 files changed, 89 insertions(+), 5 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 259612834e..289c59c742 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -188,6 +188,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"avx512-ifma",  0x00000007,  0, CPUID_REG_EBX, 21,  1},
         {"clflushopt",   0x00000007,  0, CPUID_REG_EBX, 23,  1},
         {"clwb",         0x00000007,  0, CPUID_REG_EBX, 24,  1},
+        {"proc-trace",   0x00000007,  0, CPUID_REG_EBX, 25,  1},
         {"avx512pf",     0x00000007,  0, CPUID_REG_EBX, 26,  1},
         {"avx512er",     0x00000007,  0, CPUID_REG_EBX, 27,  1},
         {"avx512cd",     0x00000007,  0, CPUID_REG_EBX, 28,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index c81aa93055..2d04162d8d 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -106,7 +106,7 @@ static const char *const str_7b0[32] =
     [18] = "rdseed",   [19] = "adx",
     [20] = "smap",     [21] = "avx512-ifma",
     [22] = "pcommit",  [23] = "clflushopt",
-    [24] = "clwb",     [25] = "pt",
+    [24] = "clwb",     [25] = "proc-trace",
     [26] = "avx512pf", [27] = "avx512er",
     [28] = "avx512cd", [29] = "sha",
     [30] = "avx512bw", [31] = "avx512vl",
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 164535f8f0..f9f9bc18cd 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -243,7 +243,7 @@ static bool_t cap_check(const char *name, u32 expected, u32 saw)
     return saw != expected;
 }
 
-static int vmx_init_vmcs_config(void)
+static int vmx_init_vmcs_config(bool bsp)
 {
     u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt;
     u32 _vmx_pin_based_exec_control;
@@ -291,6 +291,20 @@ static int vmx_init_vmcs_config(void)
         _vmx_cpu_based_exec_control &=
             ~(CPU_BASED_CR8_LOAD_EXITING | CPU_BASED_CR8_STORE_EXITING);
 
+    rdmsrl(MSR_IA32_VMX_MISC, _vmx_misc_cap);
+
+    /* Check whether IPT is supported in VMX operation. */
+    if ( bsp )
+        vmtrace_available = cpu_has_proc_trace &&
+                            (_vmx_misc_cap & VMX_MISC_PROC_TRACE);
+    else if ( vmtrace_available &&
+              !(_vmx_misc_cap & VMX_MISC_PROC_TRACE) )
+    {
+        printk("VMX: IPT capabilities differ between CPU%u and BSP\n",
+               smp_processor_id());
+        return -EINVAL;
+    }
+
     if ( _vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS )
     {
         min = 0;
@@ -305,7 +319,6 @@ static int vmx_init_vmcs_config(void)
                SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS |
                SECONDARY_EXEC_XSAVES |
                SECONDARY_EXEC_TSC_SCALING);
-        rdmsrl(MSR_IA32_VMX_MISC, _vmx_misc_cap);
         if ( _vmx_misc_cap & VMX_MISC_VMWRITE_ALL )
             opt |= SECONDARY_EXEC_ENABLE_VMCS_SHADOWING;
         if ( opt_vpid_enabled )
@@ -715,7 +728,7 @@ static int _vmx_cpu_up(bool bsp)
         wrmsr(MSR_IA32_FEATURE_CONTROL, eax, 0);
     }
 
-    if ( (rc = vmx_init_vmcs_config()) != 0 )
+    if ( (rc = vmx_init_vmcs_config(bsp)) != 0 )
         return rc;
 
     INIT_LIST_HEAD(&this_cpu(active_vmcs_list));
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 2d4475ee3d..12b961113e 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -428,6 +428,20 @@ static void vmx_domain_relinquish_resources(struct domain *d)
     vmx_free_vlapic_mapping(d);
 }
 
+static void vmx_init_ipt(struct vcpu *v)
+{
+    unsigned int size = v->domain->vmtrace_size;
+
+    if ( !size )
+        return;
+
+    /* Checked by domain creation logic. */
+    ASSERT(v->vmtrace.pg);
+    ASSERT(size >= PAGE_SIZE && (size & (size - 1)) == 0);
+
+    v->arch.msrs->rtit.output_limit = size - 1;
+}
+
 static int vmx_vcpu_initialise(struct vcpu *v)
 {
     int rc;
@@ -470,6 +484,7 @@ static int vmx_vcpu_initialise(struct vcpu *v)
     }
 
     vmx_install_vlapic_mapping(v);
+    vmx_init_ipt(v);
 
     return 0;
 }
@@ -508,22 +523,39 @@ static void vmx_restore_host_msrs(void)
 
 static void vmx_save_guest_msrs(struct vcpu *v)
 {
+    struct vcpu_msrs *msrs = v->arch.msrs;
+
     /*
      * We cannot cache SHADOW_GS_BASE while the VCPU runs, as it can
      * be updated at any time via SWAPGS, which we cannot trap.
      */
     v->arch.hvm.vmx.shadow_gs = read_gs_shadow();
+
+    if ( v->arch.hvm.vmx.ipt_active )
+    {
+        rdmsrl(MSR_RTIT_OUTPUT_MASK, msrs->rtit.output_mask);
+        rdmsrl(MSR_RTIT_STATUS, msrs->rtit.status);
+    }
 }
 
 static void vmx_restore_guest_msrs(struct vcpu *v)
 {
+    const struct vcpu_msrs *msrs = v->arch.msrs;
+
     write_gs_shadow(v->arch.hvm.vmx.shadow_gs);
     wrmsrl(MSR_STAR,           v->arch.hvm.vmx.star);
     wrmsrl(MSR_LSTAR,          v->arch.hvm.vmx.lstar);
     wrmsrl(MSR_SYSCALL_MASK,   v->arch.hvm.vmx.sfmask);
 
     if ( cpu_has_msr_tsc_aux )
-        wrmsr_tsc_aux(v->arch.msrs->tsc_aux);
+        wrmsr_tsc_aux(msrs->tsc_aux);
+
+    if ( v->arch.hvm.vmx.ipt_active )
+    {
+        wrmsrl(MSR_RTIT_OUTPUT_BASE, page_to_maddr(v->vmtrace.pg));
+        wrmsrl(MSR_RTIT_OUTPUT_MASK, msrs->rtit.output_mask);
+        wrmsrl(MSR_RTIT_STATUS, msrs->rtit.status);
+    }
 }
 
 void vmx_update_cpu_exec_control(struct vcpu *v)
diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h
index f62e526a96..33b2257888 100644
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -105,6 +105,7 @@
 #define cpu_has_clwb            boot_cpu_has(X86_FEATURE_CLWB)
 #define cpu_has_avx512er        boot_cpu_has(X86_FEATURE_AVX512ER)
 #define cpu_has_avx512cd        boot_cpu_has(X86_FEATURE_AVX512CD)
+#define cpu_has_proc_trace      boot_cpu_has(X86_FEATURE_PROC_TRACE)
 #define cpu_has_sha             boot_cpu_has(X86_FEATURE_SHA)
 #define cpu_has_avx512bw        boot_cpu_has(X86_FEATURE_AVX512BW)
 #define cpu_has_avx512vl        boot_cpu_has(X86_FEATURE_AVX512VL)
diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/asm-x86/hvm/vmx/vmcs.h
index 906810592f..8073af323b 100644
--- a/xen/include/asm-x86/hvm/vmx/vmcs.h
+++ b/xen/include/asm-x86/hvm/vmx/vmcs.h
@@ -156,6 +156,9 @@ struct vmx_vcpu {
     /* Do we need to tolerate a spurious EPT_MISCONFIG VM exit? */
     bool_t               ept_spurious_misconfig;
 
+    /* Processor Trace configured and enabled for the vcpu. */
+    bool                 ipt_active;
+
     /* Is the guest in real mode? */
     uint8_t              vmx_realmode;
     /* Are we emulating rather than VMENTERing? */
@@ -283,6 +286,7 @@ extern u32 vmx_secondary_exec_control;
 #define VMX_VPID_INVVPID_SINGLE_CONTEXT_RETAINING_GLOBAL 0x80000000000ULL
 extern u64 vmx_ept_vpid_cap;
 
+#define VMX_MISC_PROC_TRACE                     0x00004000
 #define VMX_MISC_CR3_TARGET                     0x01ff0000
 #define VMX_MISC_VMWRITE_ALL                    0x20000000
 
diff --git a/xen/include/asm-x86/msr.h b/xen/include/asm-x86/msr.h
index 16f95e7344..1d3eca9063 100644
--- a/xen/include/asm-x86/msr.h
+++ b/xen/include/asm-x86/msr.h
@@ -306,6 +306,38 @@ struct vcpu_msrs
         };
     } misc_features_enables;
 
+    /*
+     * 0x00000560 ... 57x - MSR_RTIT_*
+     *
+     * "Real Time Instruction Trace", now called Processor Trace.
+     *
+     * These MSRs are not exposed to guests.  They are controlled by Xen
+     * behind the scenes, when vmtrace is enabled for the domain.
+     *
+     * MSR_RTIT_OUTPUT_BASE not stored here.  It is fixed per vcpu, and
+     * derived from v->vmtrace.buf.
+     */
+    struct {
+        /*
+         * Placed in the MSR load/save lists.  Only modified by hypercall in
+         * the common case.
+         */
+        uint64_t ctl;
+
+        /*
+         * Updated by hardware in non-root mode.  Synchronised here on vcpu
+         * context switch.
+         */
+        uint64_t status;
+        union {
+            uint64_t output_mask;
+            struct {
+                uint32_t output_limit;
+                uint32_t output_offset;
+            };
+        };
+    } rtit;
+
     /* 0x00000da0 - MSR_IA32_XSS */
     struct {
         uint64_t raw;
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 6f7efaad6d..a501479820 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -217,6 +217,7 @@ XEN_CPUFEATURE(SMAP,          5*32+20) /*S  Supervisor Mode Access Prevention */
 XEN_CPUFEATURE(AVX512_IFMA,   5*32+21) /*A  AVX-512 Integer Fused Multiply Add */
 XEN_CPUFEATURE(CLFLUSHOPT,    5*32+23) /*A  CLFLUSHOPT instruction */
 XEN_CPUFEATURE(CLWB,          5*32+24) /*A  CLWB instruction */
+XEN_CPUFEATURE(PROC_TRACE,    5*32+25) /*   Processor Trace */
 XEN_CPUFEATURE(AVX512PF,      5*32+26) /*A  AVX-512 Prefetch Instructions */
 XEN_CPUFEATURE(AVX512ER,      5*32+27) /*A  AVX-512 Exponent & Reciprocal Instrs */
 XEN_CPUFEATURE(AVX512CD,      5*32+28) /*A  AVX-512 Conflict Detection Instrs */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 05 19:11:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Feb 2021 19:11:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81901.151466 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l86WL-0007Nc-R5; Fri, 05 Feb 2021 19:11:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81901.151466; Fri, 05 Feb 2021 19:11:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l86WL-0007NU-Ng; Fri, 05 Feb 2021 19:11:57 +0000
Received: by outflank-mailman (input) for mailman id 81901;
 Fri, 05 Feb 2021 19:11: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 1l86WK-0007NI-3H
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:11: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 1l86WK-0004eW-26
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:11:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l86WK-0006CS-1R
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:11:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=E7m+V9o4goMyKSK7j+/XUl9m0ve+W25qLoAqRWyFuQA=; b=P2EPkqjKOeGu7EHzxjcZ28EB44
	RrDXHYXtjutuymhCU4luenvduKcIgei9/1ocJFG/9ahB2lcRCLvzNE6qlCqFsK3G6GCA9neaR52dZ
	J9ErHnZElFvErPWWcMiVUA+20fLSlYsh/wXx/p2pa0NiUCaZqx2Y0eSUsr7gnZp4NZYM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/domctl: Add XEN_DOMCTL_vmtrace_op
Message-Id: <E1l86WK-0006CS-1R@xenbits.xenproject.org>
Date: Fri, 05 Feb 2021 19:11:56 +0000

commit 1cee4bd97c88633c4a39f56f6722be0727c9ea8f
Author:     Michał Leszczyński <michal.leszczynski@cert.pl>
AuthorDate: Sun Jun 28 23:48:09 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:28 2021 +0000

    xen/domctl: Add XEN_DOMCTL_vmtrace_op
    
    Implement an interface to configure and control tracing operations.  Reuse the
    existing SETDEBUGGING flask vector rather than inventing a new one.
    
    Userspace using this interface is going to need platform specific knowledge
    anyway to interpret the contents of the trace buffer.  While some operations
    (e.g. enable/disable) can reasonably be generic, others cannot.  Provide an
    explicitly-platform specific pair of get/set operations to reduce API churn as
    new options get added/enabled.
    
    For the VMX specific Processor Trace implementation, tolerate reading and
    modifying a safe subset of bits in CTL, STATUS and OUTPUT_MASK.  This permits
    userspace to control the content which gets logged, but prevents modification
    of details such as the position/size of the output buffer.
    
    Signed-off-by: Michał Leszczyński <michal.leszczynski@cert.pl>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/domctl.c         |  55 +++++++++++++++++
 xen/arch/x86/hvm/vmx/vmx.c    | 135 ++++++++++++++++++++++++++++++++++++++++++
 xen/include/asm-x86/hvm/hvm.h |  63 ++++++++++++++++++++
 xen/include/public/domctl.h   |  35 +++++++++++
 xen/xsm/flask/hooks.c         |   1 +
 5 files changed, 289 insertions(+)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index b28cfe9817..b464465230 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -155,6 +155,55 @@ void arch_get_domain_info(const struct domain *d,
     info->arch_config.emulation_flags = d->arch.emulation_flags;
 }
 
+static int do_vmtrace_op(struct domain *d, struct xen_domctl_vmtrace_op *op,
+                         XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
+{
+    struct vcpu *v;
+    int rc;
+
+    if ( !d->vmtrace_size || d == current->domain /* No vcpu_pause() */ )
+        return -EINVAL;
+
+    ASSERT(is_hvm_domain(d)); /* Restricted by domain creation logic. */
+
+    v = domain_vcpu(d, op->vcpu);
+    if ( !v )
+        return -ENOENT;
+
+    vcpu_pause(v);
+    switch ( op->cmd )
+    {
+    case XEN_DOMCTL_vmtrace_enable:
+    case XEN_DOMCTL_vmtrace_disable:
+    case XEN_DOMCTL_vmtrace_reset_and_enable:
+        rc = hvm_vmtrace_control(
+            v, op->cmd != XEN_DOMCTL_vmtrace_disable,
+            op->cmd == XEN_DOMCTL_vmtrace_reset_and_enable);
+        break;
+
+    case XEN_DOMCTL_vmtrace_output_position:
+        rc = hvm_vmtrace_output_position(v, &op->value);
+        if ( rc >= 0 )
+            rc = 0;
+        break;
+
+    case XEN_DOMCTL_vmtrace_get_option:
+        rc = hvm_vmtrace_get_option(v, op->key, &op->value);
+        break;
+
+    case XEN_DOMCTL_vmtrace_set_option:
+        rc = hvm_vmtrace_set_option(v, op->key, op->value);
+        break;
+
+    default:
+        rc = -EOPNOTSUPP;
+        break;
+    }
+    vcpu_unpause(v);
+
+    return rc;
+}
+
 #define MAX_IOPORTS 0x10000
 
 long arch_do_domctl(
@@ -1320,6 +1369,12 @@ long arch_do_domctl(
         domain_unpause(d);
         break;
 
+    case XEN_DOMCTL_vmtrace_op:
+        ret = do_vmtrace_op(d, &domctl->u.vmtrace_op, u_domctl);
+        if ( !ret )
+            copyback = true;
+        break;
+
     default:
         ret = iommu_do_domctl(domctl, d, u_domctl);
         break;
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 12b961113e..beb5692b8b 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2261,6 +2261,137 @@ static bool vmx_get_pending_event(struct vcpu *v, struct x86_event *info)
     return true;
 }
 
+/*
+ * We only let vmtrace agents see and modify a subset of bits in MSR_RTIT_CTL.
+ * These all pertain to data-emitted into the trace buffer(s).  Must not
+ * include controls pertaining to the structure/position of the trace
+ * buffer(s).
+ */
+#define RTIT_CTL_MASK                                                   \
+    (RTIT_CTL_TRACE_EN | RTIT_CTL_OS | RTIT_CTL_USR | RTIT_CTL_TSC_EN | \
+     RTIT_CTL_DIS_RETC | RTIT_CTL_BRANCH_EN)
+
+/*
+ * Status bits restricted to the first-gen subset (i.e. no further CPUID
+ * requirements.)
+ */
+#define RTIT_STATUS_MASK                                                \
+    (RTIT_STATUS_FILTER_EN | RTIT_STATUS_CONTEXT_EN | RTIT_STATUS_TRIGGER_EN | \
+     RTIT_STATUS_ERROR | RTIT_STATUS_STOPPED)
+
+static int vmtrace_get_option(struct vcpu *v, uint64_t key, uint64_t *output)
+{
+    const struct vcpu_msrs *msrs = v->arch.msrs;
+
+    switch ( key )
+    {
+    case MSR_RTIT_CTL:
+        *output = msrs->rtit.ctl & RTIT_CTL_MASK;
+        break;
+
+    case MSR_RTIT_STATUS:
+        *output = msrs->rtit.status & RTIT_STATUS_MASK;
+        break;
+
+    default:
+        *output = 0;
+        return -EINVAL;
+    }
+    return 0;
+}
+
+static int vmtrace_set_option(struct vcpu *v, uint64_t key, uint64_t value)
+{
+    struct vcpu_msrs *msrs = v->arch.msrs;
+    bool new_en, old_en = msrs->rtit.ctl & RTIT_CTL_TRACE_EN;
+
+    switch ( key )
+    {
+    case MSR_RTIT_CTL:
+        if ( value & ~RTIT_CTL_MASK )
+            return -EINVAL;
+
+        msrs->rtit.ctl &= ~RTIT_CTL_MASK;
+        msrs->rtit.ctl |= (value & RTIT_CTL_MASK);
+        break;
+
+    case MSR_RTIT_STATUS:
+        if ( value & ~RTIT_STATUS_MASK )
+            return -EINVAL;
+
+        msrs->rtit.status &= ~RTIT_STATUS_MASK;
+        msrs->rtit.status |= (value & RTIT_STATUS_MASK);
+        break;
+
+    default:
+        return -EINVAL;
+    }
+
+    new_en = msrs->rtit.ctl & RTIT_CTL_TRACE_EN;
+
+    /* ctl.trace_en changed => update MSR load/save lists appropriately. */
+    if ( !old_en && new_en )
+    {
+        if ( vmx_add_guest_msr(v, MSR_RTIT_CTL, msrs->rtit.ctl) ||
+             vmx_add_host_load_msr(v, MSR_RTIT_CTL, 0) )
+        {
+            /*
+             * The only failure cases here are failing the
+             * singleton-per-domain memory allocation, or exceeding the space
+             * in the allocation.  We could unwind in principle, but there is
+             * nothing userspace can usefully do to continue using this VM.
+             */
+            domain_crash(v->domain);
+            return -ENXIO;
+        }
+    }
+    else if ( old_en && !new_en )
+    {
+        vmx_del_msr(v, MSR_RTIT_CTL, VMX_MSR_GUEST);
+        vmx_del_msr(v, MSR_RTIT_CTL, VMX_MSR_HOST);
+    }
+
+    return 0;
+}
+
+static int vmtrace_control(struct vcpu *v, bool enable, bool reset)
+{
+    struct vcpu_msrs *msrs = v->arch.msrs;
+    uint64_t new_ctl;
+    int rc;
+
+    /*
+     * Absolutely nothing good will come of Xen's and userspace's idea of
+     * whether ipt is enabled getting out of sync.
+     */
+    if ( v->arch.hvm.vmx.ipt_active == enable )
+        return -EINVAL;
+
+    if ( reset )
+    {
+        msrs->rtit.status = 0;
+        msrs->rtit.output_offset = 0;
+    }
+
+    new_ctl = msrs->rtit.ctl & ~RTIT_CTL_TRACE_EN;
+    if ( enable )
+        new_ctl |= RTIT_CTL_TRACE_EN;
+
+    rc = vmtrace_set_option(v, MSR_RTIT_CTL, new_ctl);
+    if ( rc )
+        return rc;
+
+    v->arch.hvm.vmx.ipt_active = enable;
+
+    return 0;
+}
+
+static int vmtrace_output_position(struct vcpu *v, uint64_t *pos)
+{
+    *pos = v->arch.msrs->rtit.output_offset;
+    return v->arch.hvm.vmx.ipt_active;
+}
+
 static struct hvm_function_table __initdata vmx_function_table = {
     .name                 = "VMX",
     .cpu_up_prepare       = vmx_cpu_up_prepare,
@@ -2316,6 +2447,10 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .altp2m_vcpu_update_vmfunc_ve = vmx_vcpu_update_vmfunc_ve,
     .altp2m_vcpu_emulate_ve = vmx_vcpu_emulate_ve,
     .altp2m_vcpu_emulate_vmfunc = vmx_vcpu_emulate_vmfunc,
+    .vmtrace_control = vmtrace_control,
+    .vmtrace_output_position = vmtrace_output_position,
+    .vmtrace_set_option = vmtrace_set_option,
+    .vmtrace_get_option = vmtrace_get_option,
     .tsc_scaling = {
         .max_ratio = VMX_TSC_MULTIPLIER_MAX,
     },
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index 334bd573b9..960ec03917 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -214,6 +214,12 @@ struct hvm_function_table {
     bool_t (*altp2m_vcpu_emulate_ve)(struct vcpu *v);
     int (*altp2m_vcpu_emulate_vmfunc)(const struct cpu_user_regs *regs);
 
+    /* vmtrace */
+    int (*vmtrace_control)(struct vcpu *v, bool enable, bool reset);
+    int (*vmtrace_output_position)(struct vcpu *v, uint64_t *pos);
+    int (*vmtrace_set_option)(struct vcpu *v, uint64_t key, uint64_t value);
+    int (*vmtrace_get_option)(struct vcpu *v, uint64_t key, uint64_t *value);
+
     /*
      * Parameters and callbacks for hardware-assisted TSC scaling,
      * which are valid only when the hardware feature is available.
@@ -655,6 +661,41 @@ static inline bool altp2m_vcpu_emulate_ve(struct vcpu *v)
     return false;
 }
 
+static inline int hvm_vmtrace_control(struct vcpu *v, bool enable, bool reset)
+{
+    if ( hvm_funcs.vmtrace_control )
+        return hvm_funcs.vmtrace_control(v, enable, reset);
+
+    return -EOPNOTSUPP;
+}
+
+/* Returns -errno, or a boolean of whether tracing is currently active. */
+static inline int hvm_vmtrace_output_position(struct vcpu *v, uint64_t *pos)
+{
+    if ( hvm_funcs.vmtrace_output_position )
+        return hvm_funcs.vmtrace_output_position(v, pos);
+
+    return -EOPNOTSUPP;
+}
+
+static inline int hvm_vmtrace_set_option(
+    struct vcpu *v, uint64_t key, uint64_t value)
+{
+    if ( hvm_funcs.vmtrace_set_option )
+        return hvm_funcs.vmtrace_set_option(v, key, value);
+
+    return -EOPNOTSUPP;
+}
+
+static inline int hvm_vmtrace_get_option(
+    struct vcpu *v, uint64_t key, uint64_t *value)
+{
+    if ( hvm_funcs.vmtrace_get_option )
+        return hvm_funcs.vmtrace_get_option(v, key, value);
+
+    return -EOPNOTSUPP;
+}
+
 /*
  * This must be defined as a macro instead of an inline function,
  * because it uses 'struct vcpu' and 'struct domain' which have
@@ -751,6 +792,28 @@ static inline bool hvm_has_set_descriptor_access_exiting(void)
     return false;
 }
 
+static inline int hvm_vmtrace_control(struct vcpu *v, bool enable, bool reset)
+{
+    return -EOPNOTSUPP;
+}
+
+static inline int hvm_vmtrace_output_position(struct vcpu *v, uint64_t *pos)
+{
+    return -EOPNOTSUPP;
+}
+
+static inline int hvm_vmtrace_set_option(
+    struct vcpu *v, uint64_t key, uint64_t value)
+{
+    return -EOPNOTSUPP;
+}
+
+static inline int hvm_vmtrace_get_option(
+    struct vcpu *v, uint64_t key, uint64_t *value)
+{
+    return -EOPNOTSUPP;
+}
+
 #define is_viridian_domain(d) ((void)(d), false)
 #define is_viridian_vcpu(v) ((void)(v), false)
 #define has_viridian_time_ref_count(d) ((void)(d), false)
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 88a5b1ef5d..4dbf107785 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -1135,6 +1135,39 @@ struct xen_domctl_vuart_op {
                                  */
 };
 
+/* XEN_DOMCTL_vmtrace_op: Perform VM tracing operations. */
+struct xen_domctl_vmtrace_op {
+    uint32_t cmd;           /* IN */
+    uint32_t vcpu;          /* IN */
+    uint64_aligned_t key;   /* IN     - @cmd specific data. */
+    uint64_aligned_t value; /* IN/OUT - @cmd specific data. */
+
+    /*
+     * General enable/disable of tracing.
+     *
+     * XEN_DOMCTL_vmtrace_reset_and_enable is provided as optimisation for
+     * common usecases, which want to reset status and position information
+     * when turning tracing back on.
+     */
+#define XEN_DOMCTL_vmtrace_enable             1
+#define XEN_DOMCTL_vmtrace_disable            2
+#define XEN_DOMCTL_vmtrace_reset_and_enable   3
+
+    /* Obtain the current output position within the buffer.  Fills @value. */
+#define XEN_DOMCTL_vmtrace_output_position    4
+
+    /*
+     * Get/Set platform specific configuration.
+     *
+     * For Intel Processor Trace, @key/@value are interpreted as MSR
+     * reads/writes to MSR_RTIT_*, filtered to a safe subset.
+     */
+#define XEN_DOMCTL_vmtrace_get_option         5
+#define XEN_DOMCTL_vmtrace_set_option         6
+};
+typedef struct xen_domctl_vmtrace_op xen_domctl_vmtrace_op_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domctl_vmtrace_op_t);
+
 struct xen_domctl {
     uint32_t cmd;
 #define XEN_DOMCTL_createdomain                   1
@@ -1219,6 +1252,7 @@ struct xen_domctl {
 #define XEN_DOMCTL_vuart_op                      81
 #define XEN_DOMCTL_get_cpu_policy                82
 #define XEN_DOMCTL_set_cpu_policy                83
+#define XEN_DOMCTL_vmtrace_op                    84
 #define XEN_DOMCTL_gdbsx_guestmemio            1000
 #define XEN_DOMCTL_gdbsx_pausevcpu             1001
 #define XEN_DOMCTL_gdbsx_unpausevcpu           1002
@@ -1279,6 +1313,7 @@ struct xen_domctl {
         struct xen_domctl_monitor_op        monitor_op;
         struct xen_domctl_psr_alloc         psr_alloc;
         struct xen_domctl_vuart_op          vuart_op;
+        struct xen_domctl_vmtrace_op        vmtrace_op;
         uint8_t                             pad[128];
     } u;
 };
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 11784d7425..3b7313b949 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -703,6 +703,7 @@ static int flask_domctl(struct domain *d, int cmd)
         return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__VM_EVENT);
 
     case XEN_DOMCTL_debug_op:
+    case XEN_DOMCTL_vmtrace_op:
     case XEN_DOMCTL_gdbsx_guestmemio:
     case XEN_DOMCTL_gdbsx_pausevcpu:
     case XEN_DOMCTL_gdbsx_unpausevcpu:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 05 19:12:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Feb 2021 19:12:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81902.151470 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l86WV-0007P3-US; Fri, 05 Feb 2021 19:12:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81902.151470; Fri, 05 Feb 2021 19:12: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 1l86WV-0007Ov-RS; Fri, 05 Feb 2021 19:12:07 +0000
Received: by outflank-mailman (input) for mailman id 81902;
 Fri, 05 Feb 2021 19:12: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 1l86WU-0007Oj-6Z
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:12: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 1l86WU-0004er-5T
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:12:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l86WU-0006DP-4S
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:12:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=harFxYL96XUXyov6dFA56FEYHC/nz3eT3qA+2ocwaus=; b=CeNnlVJjmHrnjW064bQwm6SSDQ
	/SkX0KBG3cgpAyS8flVgcOEH0cGS2lrxirhUjxrmxVJB0iqzGP7h14X/tTcKu6t4SYQssR4Ges3mC
	Ijpqv9XGVfhxrNT3Y3TT2Vn/SBeCG8kFppLXSxe9ATm405P2IuxBrqnZutUqYsrordQs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libxc: Add xc_vmtrace_* functions
Message-Id: <E1l86WU-0006DP-4S@xenbits.xenproject.org>
Date: Fri, 05 Feb 2021 19:12:06 +0000

commit 53aaa792fdebcf131983d45ee8e3d09bd0740c71
Author:     Michał Leszczyński <michal.leszczynski@cert.pl>
AuthorDate: Tue Jun 16 15:33:25 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:28 2021 +0000

    tools/libxc: Add xc_vmtrace_* functions
    
    Add functions in libxc that use the new XEN_DOMCTL_vmtrace interface.
    
    Signed-off-by: Michał Leszczyński <michal.leszczynski@cert.pl>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/include/xenctrl.h      |  73 ++++++++++++++++++++++++
 tools/libs/ctrl/Makefile     |   1 +
 tools/libs/ctrl/xc_vmtrace.c | 128 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 202 insertions(+)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 3796425e1e..0efcdae8b4 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1583,6 +1583,79 @@ int xc_tbuf_set_cpu_mask(xc_interface *xch, xc_cpumap_t mask);
 
 int xc_tbuf_set_evt_mask(xc_interface *xch, uint32_t mask);
 
+/**
+ * Enable vmtrace for given vCPU.
+ *
+ * @parm xch a handle to an open hypervisor interface
+ * @parm domid domain identifier
+ * @parm vcpu vcpu identifier
+ * @return 0 on success, -1 on failure
+ */
+int xc_vmtrace_enable(xc_interface *xch, uint32_t domid, uint32_t vcpu);
+
+/**
+ * Enable vmtrace for given vCPU.
+ *
+ * @parm xch a handle to an open hypervisor interface
+ * @parm domid domain identifier
+ * @parm vcpu vcpu identifier
+ * @return 0 on success, -1 on failure
+ */
+int xc_vmtrace_disable(xc_interface *xch, uint32_t domid, uint32_t vcpu);
+
+/**
+ * Enable vmtrace for a given vCPU, along with resetting status/offset
+ * details.
+ *
+ * @parm xch a handle to an open hypervisor interface
+ * @parm domid domain identifier
+ * @parm vcpu vcpu identifier
+ * @return 0 on success, -1 on failure
+ */
+int xc_vmtrace_reset_and_enable(xc_interface *xch, uint32_t domid,
+                                uint32_t vcpu);
+
+/**
+ * Get current output position inside the trace buffer.
+ *
+ * Repeated calls will return different values if tracing is enabled.  It is
+ * platform specific what happens when the buffer fills completely.
+ *
+ * @parm xch a handle to an open hypervisor interface
+ * @parm domid domain identifier
+ * @parm vcpu vcpu identifier
+ * @parm pos current output position in bytes
+ * @return 0 on success, -1 on failure
+ */
+int xc_vmtrace_output_position(xc_interface *xch, uint32_t domid,
+                               uint32_t vcpu, uint64_t *pos);
+
+/**
+ * Get platform specific vmtrace options.
+ *
+ * @parm xch a handle to an open hypervisor interface
+ * @parm domid domain identifier
+ * @parm vcpu vcpu identifier
+ * @parm key platform-specific input
+ * @parm value platform-specific output
+ * @return 0 on success, -1 on failure
+ */
+int xc_vmtrace_get_option(xc_interface *xch, uint32_t domid,
+                          uint32_t vcpu, uint64_t key, uint64_t *value);
+
+/**
+ * Set platform specific vntvmtrace options.
+ *
+ * @parm xch a handle to an open hypervisor interface
+ * @parm domid domain identifier
+ * @parm vcpu vcpu identifier
+ * @parm key platform-specific input
+ * @parm value platform-specific input
+ * @return 0 on success, -1 on failure
+ */
+int xc_vmtrace_set_option(xc_interface *xch, uint32_t domid,
+                          uint32_t vcpu, uint64_t key, uint64_t value);
+
 int xc_domctl(xc_interface *xch, struct xen_domctl *domctl);
 int xc_sysctl(xc_interface *xch, struct xen_sysctl *sysctl);
 
diff --git a/tools/libs/ctrl/Makefile b/tools/libs/ctrl/Makefile
index 6106e36c49..ce9ecae710 100644
--- a/tools/libs/ctrl/Makefile
+++ b/tools/libs/ctrl/Makefile
@@ -22,6 +22,7 @@ SRCS-y       += xc_pm.c
 SRCS-y       += xc_cpu_hotplug.c
 SRCS-y       += xc_resume.c
 SRCS-y       += xc_vm_event.c
+SRCS-y       += xc_vmtrace.c
 SRCS-y       += xc_monitor.c
 SRCS-y       += xc_mem_paging.c
 SRCS-y       += xc_mem_access.c
diff --git a/tools/libs/ctrl/xc_vmtrace.c b/tools/libs/ctrl/xc_vmtrace.c
new file mode 100644
index 0000000000..602502367f
--- /dev/null
+++ b/tools/libs/ctrl/xc_vmtrace.c
@@ -0,0 +1,128 @@
+/******************************************************************************
+ * xc_vmtrace.c
+ *
+ * API for manipulating hardware tracing features
+ *
+ * Copyright (c) 2020, Michal Leszczynski
+ *
+ * Copyright 2020 CERT Polska. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "xc_private.h"
+
+int xc_vmtrace_enable(
+    xc_interface *xch, uint32_t domid, uint32_t vcpu)
+{
+    struct xen_domctl domctl = {
+        .cmd = XEN_DOMCTL_vmtrace_op,
+        .domain = domid,
+        .u.vmtrace_op = {
+            .cmd = XEN_DOMCTL_vmtrace_enable,
+            .vcpu = vcpu,
+        },
+    };
+
+    return do_domctl(xch, &domctl);
+}
+
+int xc_vmtrace_disable(
+    xc_interface *xch, uint32_t domid, uint32_t vcpu)
+{
+    struct xen_domctl domctl = {
+        .cmd = XEN_DOMCTL_vmtrace_op,
+        .domain = domid,
+        .u.vmtrace_op = {
+            .cmd = XEN_DOMCTL_vmtrace_disable,
+            .vcpu = vcpu,
+        },
+    };
+
+    return do_domctl(xch, &domctl);
+}
+
+int xc_vmtrace_reset_and_enable(
+    xc_interface *xch, uint32_t domid, uint32_t vcpu)
+{
+    struct xen_domctl domctl = {
+        .cmd = XEN_DOMCTL_vmtrace_op,
+        .domain = domid,
+        .u.vmtrace_op = {
+            .cmd = XEN_DOMCTL_vmtrace_reset_and_enable,
+            .vcpu = vcpu,
+        },
+    };
+
+    return do_domctl(xch, &domctl);
+}
+
+int xc_vmtrace_output_position(
+    xc_interface *xch, uint32_t domid, uint32_t vcpu, uint64_t *pos)
+{
+    struct xen_domctl domctl = {
+        .cmd = XEN_DOMCTL_vmtrace_op,
+        .domain = domid,
+        .u.vmtrace_op = {
+            .cmd = XEN_DOMCTL_vmtrace_output_position,
+            .vcpu = vcpu,
+        },
+    };
+    int rc = do_domctl(xch, &domctl);
+
+    if ( !rc )
+        *pos = domctl.u.vmtrace_op.value;
+
+    return rc;
+}
+
+int xc_vmtrace_get_option(
+    xc_interface *xch, uint32_t domid, uint32_t vcpu,
+    uint64_t key, uint64_t *value)
+{
+    struct xen_domctl domctl = {
+        .cmd = XEN_DOMCTL_vmtrace_op,
+        .domain = domid,
+        .u.vmtrace_op = {
+            .cmd = XEN_DOMCTL_vmtrace_get_option,
+            .vcpu = vcpu,
+            .key = key,
+        },
+    };
+    int rc = do_domctl(xch, &domctl);
+
+    if ( !rc )
+        *value = domctl.u.vmtrace_op.value;
+
+    return rc;
+}
+
+int xc_vmtrace_set_option(
+    xc_interface *xch, uint32_t domid, uint32_t vcpu,
+    uint64_t key, uint64_t value)
+{
+    struct xen_domctl domctl = {
+        .cmd = XEN_DOMCTL_vmtrace_op,
+        .domain = domid,
+        .u.vmtrace_op = {
+            .cmd = XEN_DOMCTL_vmtrace_set_option,
+            .vcpu = vcpu,
+            .key = key,
+            .value = value,
+        },
+    };
+
+    return do_domctl(xch, &domctl);
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 05 19:12:18 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Feb 2021 19:12:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81903.151473 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l86Wf-0007QI-Vv; Fri, 05 Feb 2021 19:12:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81903.151473; Fri, 05 Feb 2021 19:12: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 1l86Wf-0007QA-T5; Fri, 05 Feb 2021 19:12:17 +0000
Received: by outflank-mailman (input) for mailman id 81903;
 Fri, 05 Feb 2021 19:12: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 1l86We-0007Q1-91
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:12: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 1l86We-0004ez-8J
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:12:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l86We-0006ET-7Z
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:12:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DYJPb8EtlknsewUqGBs689H2UVvk2LOhhOWsIrFtCyA=; b=j/xbcoUsdy0Qfk04SYMZldKOIP
	pXuJsoZaku32JY9MaVBLREsP2NTgvVpVwNZiyC6g6fXHY2kMRfHo+Fs6UZH97z7fL/4m9jJjiPapM
	H9WLJeZwBcOEFgizrEJ4PqJVRCyEFPT25fAaQ7m8SmfN6rsN1oeFXZwgX6+sKDZOnrIs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/misc: Add xen-vmtrace tool
Message-Id: <E1l86We-0006ET-7Z@xenbits.xenproject.org>
Date: Fri, 05 Feb 2021 19:12:16 +0000

commit 88dd8389dd2c9442729e9d96a4febaf38cd822e3
Author:     Michał Leszczyński <michal.leszczynski@cert.pl>
AuthorDate: Tue Jun 16 15:35:07 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:28 2021 +0000

    tools/misc: Add xen-vmtrace tool
    
    Add an demonstration tool that uses xc_vmtrace_* calls in order
    to manage external IPT monitoring for DomU.
    
    Signed-off-by: Michał Leszczyński <michal.leszczynski@cert.pl>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/misc/.gitignore    |   1 +
 tools/misc/Makefile      |   7 ++
 tools/misc/xen-vmtrace.c | 166 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 174 insertions(+)

diff --git a/tools/misc/.gitignore b/tools/misc/.gitignore
index b2c3b21f57..ce6f937d0c 100644
--- a/tools/misc/.gitignore
+++ b/tools/misc/.gitignore
@@ -1,3 +1,4 @@
 xen-access
 xen-memshare
 xen-ucode
+xen-vmtrace
diff --git a/tools/misc/Makefile b/tools/misc/Makefile
index 912c5d4f0e..2b683819d4 100644
--- a/tools/misc/Makefile
+++ b/tools/misc/Makefile
@@ -50,6 +50,10 @@ TARGETS_COPY += xenpvnetboot
 # Everything which needs to be built
 TARGETS_BUILD := $(filter-out $(TARGETS_COPY),$(TARGETS_ALL))
 
+# ... including build-only targets
+TARGETS_BUILD-$(CONFIG_X86)    += xen-vmtrace
+TARGETS_BUILD += $(TARGETS_BUILD-y)
+
 .PHONY: all build
 all build: $(TARGETS_BUILD)
 
@@ -90,6 +94,9 @@ xen-hvmcrash: xen-hvmcrash.o
 xen-memshare: xen-memshare.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
+xen-vmtrace: xen-vmtrace.o
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenforeignmemory) $(APPEND_LDFLAGS)
+
 xenperf: xenperf.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
diff --git a/tools/misc/xen-vmtrace.c b/tools/misc/xen-vmtrace.c
new file mode 100644
index 0000000000..7572e880c5
--- /dev/null
+++ b/tools/misc/xen-vmtrace.c
@@ -0,0 +1,166 @@
+/******************************************************************************
+ * tools/vmtrace.c
+ *
+ * Demonstrative tool for collecting Intel Processor Trace data from Xen.
+ *  Could be used to externally monitor a given vCPU in given DomU.
+ *
+ * Copyright (C) 2020 by CERT Polska - NASK PIB
+ *
+ * Authors: Michał Leszczyński, michal.leszczynski@cert.pl
+ * Date:    June, 2020
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; under version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <err.h>
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+
+#include <xenctrl.h>
+#include <xenforeignmemory.h>
+
+#define MSR_RTIT_CTL                        0x00000570
+#define  RTIT_CTL_OS                        (1 <<  2)
+#define  RTIT_CTL_USR                       (1 <<  3)
+#define  RTIT_CTL_BRANCH_EN                 (1 << 13)
+
+static xc_interface *xch;
+static xenforeignmemory_handle *fh;
+static uint32_t domid, vcpu;
+static size_t size;
+static char *buf;
+
+static sig_atomic_t interrupted;
+static void int_handler(int signum)
+{
+    interrupted = 1;
+}
+
+static int get_more_data(void)
+{
+    static uint64_t last_pos;
+    uint64_t pos;
+
+    if ( xc_vmtrace_output_position(xch, domid, vcpu, &pos) )
+    {
+        perror("xc_vmtrace_output_position()");
+        return -1;
+    }
+
+    if ( pos > last_pos )
+        fwrite(buf + last_pos, pos - last_pos, 1, stdout);
+    else if ( pos < last_pos )
+    {
+        /* buffer wrapped */
+        fwrite(buf + last_pos, size - last_pos, 1, stdout);
+        fwrite(buf, pos, 1, stdout);
+    }
+
+    last_pos = pos;
+    return 0;
+}
+
+int main(int argc, char **argv)
+{
+    int rc, exit = 1;
+    xenforeignmemory_resource_handle *fres = NULL;
+
+    if ( signal(SIGINT, int_handler) == SIG_ERR )
+        err(1, "Failed to register signal handler\n");
+
+    if ( argc != 3 )
+    {
+        fprintf(stderr, "Usage: %s <domid> <vcpu_id>\n", argv[0]);
+        fprintf(stderr, "It's recommended to redirect thisprogram's output to file\n");
+        fprintf(stderr, "or to pipe it's output to xxd or other program.\n");
+        return 1;
+    }
+
+    domid = atoi(argv[1]);
+    vcpu  = atoi(argv[2]);
+
+    xch = xc_interface_open(NULL, NULL, 0);
+    fh = xenforeignmemory_open(NULL, 0);
+
+    if ( !xch )
+        err(1, "xc_interface_open()");
+    if ( !fh )
+        err(1, "xenforeignmemory_open()");
+
+    rc = xenforeignmemory_resource_size(
+        fh, domid, XENMEM_resource_vmtrace_buf, vcpu, &size);
+    if ( rc )
+        err(1, "xenforeignmemory_resource_size()");
+
+    fres = xenforeignmemory_map_resource(
+        fh, domid, XENMEM_resource_vmtrace_buf, vcpu,
+        0, size >> XC_PAGE_SHIFT, (void **)&buf, PROT_READ, 0);
+    if ( !fres )
+        err(1, "xenforeignmemory_map_resource()");
+
+    if ( xc_vmtrace_set_option(
+             xch, domid, vcpu, MSR_RTIT_CTL,
+             RTIT_CTL_BRANCH_EN | RTIT_CTL_USR | RTIT_CTL_OS) )
+    {
+        perror("xc_vmtrace_set_option()");
+        goto out;
+    }
+
+    if ( xc_vmtrace_enable(xch, domid, vcpu) )
+    {
+        perror("xc_vmtrace_enable()");
+        goto out;
+    }
+
+    while ( !interrupted )
+    {
+        xc_dominfo_t dominfo;
+
+        if ( get_more_data() )
+            goto out;
+
+        usleep(1000 * 100);
+
+        if ( xc_domain_getinfo(xch, domid, 1, &dominfo) != 1 ||
+             dominfo.domid != domid || dominfo.shutdown )
+        {
+            if ( get_more_data() )
+                goto out;
+            break;
+        }
+    }
+
+    exit = 0;
+
+ out:
+    if ( xc_vmtrace_disable(xch, domid, vcpu) )
+        perror("xc_vmtrace_disable()");
+
+    if ( fres && xenforeignmemory_unmap_resource(fh, fres) )
+        perror("xenforeignmemory_unmap_resource()");
+
+    return exit;
+}
+
+/*
+ * 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 Feb 05 19:12:28 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Feb 2021 19:12:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81904.151478 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l86Wq-0007Rj-1P; Fri, 05 Feb 2021 19:12:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81904.151478; Fri, 05 Feb 2021 19:12:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l86Wp-0007Rb-Ui; Fri, 05 Feb 2021 19:12:27 +0000
Received: by outflank-mailman (input) for mailman id 81904;
 Fri, 05 Feb 2021 19:12:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l86Wo-0007RO-CG
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:12: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 1l86Wo-0004f8-BW
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:12:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l86Wo-0006FF-Aj
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19: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>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=F/JgnTYax2xy8T1Sxj5AG9ON/52YJZ/7ykO8xUX/hho=; b=5aUIOKn41+CAhezNRNWH5E+T3r
	k+zbRPJT1jrekrqciWkCU7PS8g0MwTsXzwgUyVPkSDIKHoTQr7H14b5FLwz73MjfKnxbWVufP/j0x
	b02ag8/FPAphfAo8AlylIuB7btNKPFHI8FxsG6G64Zu32lfSvQRH9eyvefY8hdu6q/5k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/vmtrace: support for VM forks
Message-Id: <E1l86Wo-0006FF-Aj@xenbits.xenproject.org>
Date: Fri, 05 Feb 2021 19:12:26 +0000

commit 9744611991a042e9aea348c5721b80cc2101c7e5
Author:     Tamas K Lengyel <tamas.lengyel@intel.com>
AuthorDate: Fri Sep 11 20:14:00 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:28 2021 +0000

    xen/vmtrace: support for VM forks
    
    Implement vmtrace_reset_pt function. Properly set IPT
    state for VM forks.
    
    Signed-off-by: Tamas K Lengyel <tamas.lengyel@intel.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/hvm/vmx/vmx.c    | 11 +++++++++++
 xen/arch/x86/mm/mem_sharing.c |  3 +++
 xen/include/asm-x86/hvm/hvm.h |  9 +++++++++
 3 files changed, 23 insertions(+)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index beb5692b8b..faba95d057 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2392,6 +2392,16 @@ static int vmtrace_output_position(struct vcpu *v, uint64_t *pos)
     return v->arch.hvm.vmx.ipt_active;
 }
 
+static int vmtrace_reset(struct vcpu *v)
+{
+    if ( !v->arch.hvm.vmx.ipt_active )
+        return -EINVAL;
+
+    v->arch.msrs->rtit.output_offset = 0;
+    v->arch.msrs->rtit.status = 0;
+    return 0;
+}
+
 static struct hvm_function_table __initdata vmx_function_table = {
     .name                 = "VMX",
     .cpu_up_prepare       = vmx_cpu_up_prepare,
@@ -2451,6 +2461,7 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .vmtrace_output_position = vmtrace_output_position,
     .vmtrace_set_option = vmtrace_set_option,
     .vmtrace_get_option = vmtrace_get_option,
+    .vmtrace_reset = vmtrace_reset,
     .tsc_scaling = {
         .max_ratio = VMX_TSC_MULTIPLIER_MAX,
     },
diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c
index adaeab4612..00ada05c10 100644
--- a/xen/arch/x86/mm/mem_sharing.c
+++ b/xen/arch/x86/mm/mem_sharing.c
@@ -1632,6 +1632,8 @@ static int copy_vcpu_settings(struct domain *cd, const struct domain *d)
             copy_domain_page(new_vcpu_info_mfn, vcpu_info_mfn);
         }
 
+        hvm_vmtrace_reset(cd_vcpu);
+
         /*
          * TODO: to support VMs with PV interfaces copy additional
          * settings here, such as PV timers.
@@ -1782,6 +1784,7 @@ static int fork(struct domain *cd, struct domain *d)
         cd->max_pages = d->max_pages;
         *cd->arch.cpuid = *d->arch.cpuid;
         *cd->arch.msr = *d->arch.msr;
+        cd->vmtrace_size = d->vmtrace_size;
         cd->parent = d;
     }
 
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index 960ec03917..150746de66 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -219,6 +219,7 @@ struct hvm_function_table {
     int (*vmtrace_output_position)(struct vcpu *v, uint64_t *pos);
     int (*vmtrace_set_option)(struct vcpu *v, uint64_t key, uint64_t value);
     int (*vmtrace_get_option)(struct vcpu *v, uint64_t key, uint64_t *value);
+    int (*vmtrace_reset)(struct vcpu *v);
 
     /*
      * Parameters and callbacks for hardware-assisted TSC scaling,
@@ -696,6 +697,14 @@ static inline int hvm_vmtrace_get_option(
     return -EOPNOTSUPP;
 }
 
+static inline int hvm_vmtrace_reset(struct vcpu *v)
+{
+    if ( hvm_funcs.vmtrace_reset )
+        return hvm_funcs.vmtrace_reset(v);
+
+    return -EOPNOTSUPP;
+}
+
 /*
  * This must be defined as a macro instead of an inline function,
  * because it uses 'struct vcpu' and 'struct domain' which have
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 05 19:12:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Feb 2021 19:12:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81906.151494 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l86Wz-0007Ux-Bv; Fri, 05 Feb 2021 19:12:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81906.151494; Fri, 05 Feb 2021 19:12:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l86Wz-0007Up-8W; Fri, 05 Feb 2021 19:12:37 +0000
Received: by outflank-mailman (input) for mailman id 81906;
 Fri, 05 Feb 2021 19:12:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l86Wy-0007UT-G6
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:12:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l86Wy-0004fV-FK
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:12:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l86Wy-0006G1-Dg
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:12:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+ilYkssF+HIoFZYuRr7iUl8zN8YLIZQGdbIf0b07N1c=; b=wMeP5vwNwRgu25WGCCQuYJIv92
	lXH8OJmtTekfguGVh5r6QXXoik+QL8c3CoZtuGve7CCHARvTaY94GRPMjlmJWlERs7HqD44AsJ9Ny
	LulYK26yr+oN7pskUXxobP2v7LCG9fgB8rYwleoLH+KNHeXfEaBmMAku9oIUNJHL+u0U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vm_event: Carry the vmtrace buffer position in vm_event
Message-Id: <E1l86Wy-0006G1-Dg@xenbits.xenproject.org>
Date: Fri, 05 Feb 2021 19:12:36 +0000

commit c5866ab93167a73a8d4d85b844edf4aa364a1aaa
Author:     Tamas K Lengyel <tamas.lengyel@intel.com>
AuthorDate: Mon Jan 18 12:46:37 2021 -0500
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:28 2021 +0000

    x86/vm_event: Carry the vmtrace buffer position in vm_event
    
    Add vmtrace_pos field to x86 regs in vm_event. Initialized to ~0 if
    vmtrace is not in use.
    
    Signed-off-by: Tamas K Lengyel <tamas.lengyel@intel.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/vm_event.c       | 3 +++
 xen/include/public/vm_event.h | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c
index 848d69c1b0..36272e9316 100644
--- a/xen/arch/x86/vm_event.c
+++ b/xen/arch/x86/vm_event.c
@@ -251,6 +251,9 @@ void vm_event_fill_regs(vm_event_request_t *req)
 
     req->data.regs.x86.shadow_gs = ctxt.shadow_gs;
     req->data.regs.x86.dr6 = ctxt.dr6;
+
+    if ( hvm_vmtrace_output_position(curr, &req->data.regs.x86.vmtrace_pos) != 1 )
+        req->data.regs.x86.vmtrace_pos = ~0;
 #endif
 }
 
diff --git a/xen/include/public/vm_event.h b/xen/include/public/vm_event.h
index 141ea024a3..147dc3ea73 100644
--- a/xen/include/public/vm_event.h
+++ b/xen/include/public/vm_event.h
@@ -223,6 +223,13 @@ struct vm_event_regs_x86 {
      */
     uint64_t npt_base;
 
+    /*
+     * Current position in the vmtrace buffer, or ~0 if vmtrace is not active.
+     *
+     * For Intel Processor Trace, it is the upper half of MSR_RTIT_OUTPUT_MASK.
+     */
+    uint64_t vmtrace_pos;
+
     uint32_t cs_base;
     uint32_t ss_base;
     uint32_t ds_base;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 05 19:12:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Feb 2021 19:12:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.81907.151498 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l86X9-0007YD-D1; Fri, 05 Feb 2021 19:12:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 81907.151498; Fri, 05 Feb 2021 19:12:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l86X9-0007Y5-A3; Fri, 05 Feb 2021 19:12:47 +0000
Received: by outflank-mailman (input) for mailman id 81907;
 Fri, 05 Feb 2021 19:12:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l86X8-0007Xu-J3
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:12:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l86X8-0004fc-IK
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:12:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l86X8-0006Gs-HS
 for xen-changelog@lists.xenproject.org; Fri, 05 Feb 2021 19:12:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ef6kAGqybG+PgmD2WhekKMtNRDlpA6XjoXWeW7uCeeg=; b=X+uFAEHhN5yaO63vtnBK+D+jD/
	cIQMW52eLMC4Ds1463dwWGRc99L64DJ1o1YfFv81Sj5hQjpUWRYLl/0UeEjriubyj9UiWDtZRF9OX
	gfjR2Lc2loB9Lwm2ovspiSDa/rtdXiZMvvhVxeTu9TwdjYhNjajzAyOUnbU4dlZVz9sA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vm_event: add response flag to reset vmtrace buffer
Message-Id: <E1l86X8-0006Gs-HS@xenbits.xenproject.org>
Date: Fri, 05 Feb 2021 19:12:46 +0000

commit ca82d3fecc93745ee17850a609ac7772bd7c8bf7
Author:     Tamas K Lengyel <tamas.lengyel@intel.com>
AuthorDate: Sat Jan 30 08:36:37 2021 -0500
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:28 2021 +0000

    x86/vm_event: add response flag to reset vmtrace buffer
    
    Allow resetting the vmtrace buffer in response to a vm_event. This can be used
    to optimize a use-case where detecting a looped vmtrace buffer is important.
    
    Signed-off-by: Tamas K Lengyel <tamas.lengyel@intel.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/vm_event.c        | 7 +++++++
 xen/common/vm_event.c          | 3 +++
 xen/include/asm-arm/vm_event.h | 6 ++++++
 xen/include/asm-x86/vm_event.h | 2 ++
 xen/include/public/vm_event.h  | 4 ++++
 5 files changed, 22 insertions(+)

diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c
index 36272e9316..8f73a73e2e 100644
--- a/xen/arch/x86/vm_event.c
+++ b/xen/arch/x86/vm_event.c
@@ -300,6 +300,13 @@ void vm_event_emulate_check(struct vcpu *v, vm_event_response_t *rsp)
     };
 }
 
+void vm_event_reset_vmtrace(struct vcpu *v)
+{
+#ifdef CONFIG_HVM
+    hvm_vmtrace_reset(v);
+#endif
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c
index 127f2d58f1..44d542f23e 100644
--- a/xen/common/vm_event.c
+++ b/xen/common/vm_event.c
@@ -424,6 +424,9 @@ static int vm_event_resume(struct domain *d, struct vm_event_domain *ved)
             if ( rsp.flags & VM_EVENT_FLAG_GET_NEXT_INTERRUPT )
                 vm_event_monitor_next_interrupt(v);
 
+            if ( rsp.flags & VM_EVENT_FLAG_RESET_VMTRACE )
+                vm_event_reset_vmtrace(v);
+
             if ( rsp.flags & VM_EVENT_FLAG_VCPU_PAUSED )
                 vm_event_vcpu_unpause(v);
         }
diff --git a/xen/include/asm-arm/vm_event.h b/xen/include/asm-arm/vm_event.h
index 14d1d341cc..abe7db1970 100644
--- a/xen/include/asm-arm/vm_event.h
+++ b/xen/include/asm-arm/vm_event.h
@@ -58,4 +58,10 @@ void vm_event_sync_event(struct vcpu *v, bool value)
     /* Not supported on ARM. */
 }
 
+static inline
+void vm_event_reset_vmtrace(struct vcpu *v)
+{
+    /* Not supported on ARM. */
+}
+
 #endif /* __ASM_ARM_VM_EVENT_H__ */
diff --git a/xen/include/asm-x86/vm_event.h b/xen/include/asm-x86/vm_event.h
index 785e741fba..0756124075 100644
--- a/xen/include/asm-x86/vm_event.h
+++ b/xen/include/asm-x86/vm_event.h
@@ -54,4 +54,6 @@ void vm_event_emulate_check(struct vcpu *v, vm_event_response_t *rsp);
 
 void vm_event_sync_event(struct vcpu *v, bool value);
 
+void vm_event_reset_vmtrace(struct vcpu *v);
+
 #endif /* __ASM_X86_VM_EVENT_H__ */
diff --git a/xen/include/public/vm_event.h b/xen/include/public/vm_event.h
index 147dc3ea73..36135ba4f1 100644
--- a/xen/include/public/vm_event.h
+++ b/xen/include/public/vm_event.h
@@ -123,6 +123,10 @@
  * Set if the event comes from a nested VM and thus npt_base is valid.
  */
 #define VM_EVENT_FLAG_NESTED_P2M         (1 << 12)
+/*
+ * Reset the vmtrace buffer (if vmtrace is enabled)
+ */
+#define VM_EVENT_FLAG_RESET_VMTRACE      (1 << 13)
 
 /*
  * Reasons for the vm event request
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Feb 06 11:11:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Feb 2021 11:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82142.151891 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LUV-0000r8-AW; Sat, 06 Feb 2021 11:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82142.151891; Sat, 06 Feb 2021 11:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LUV-0000r1-7W; Sat, 06 Feb 2021 11:11:03 +0000
Received: by outflank-mailman (input) for mailman id 82142;
 Sat, 06 Feb 2021 11:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LUU-0000qw-HG
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LUU-00073f-GV
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LUU-000196-El
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=O5OtVYSPh9r5bIBBwkDZvwP4z9uFGfHhi58QXAq+9Fk=; b=h4YMUV5b1DGp7aQG5AQ52sGrNc
	66zBluv7Pg92zoreWBr8VlwiFZqQmeJNR3NEF0Sp9Trpz0yC9jTh78mSAH77SVoV8Xbh93wJSeKTb
	UhmxJ/Z3ZQyWv3EqZcADtRWvBqwV6ZXZdrXZAAU63IJBSUn/bgPit4+lPxsf+uNqnDhA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/string: correct memmove()'s forwarding to memcpy()
Message-Id: <E1l8LUU-000196-El@xenbits.xenproject.org>
Date: Sat, 06 Feb 2021 11:11:02 +0000

commit 7b93d92a35dc7c0a6e5f1f79b3c887aa3e66ddc0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 4 13:59:56 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 4 13:59:56 2021 +0100

    x86/string: correct memmove()'s forwarding to memcpy()
    
    With memcpy() expanding to the compiler builtin, we may not hand it
    overlapping source and destination. We strictly mean to forward to our
    own implementation (a few lines up in the same source file).
    
    Fixes: 78825e1c60fa ("x86/string: Clean up x86/string.h")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/string.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/string.c b/xen/arch/x86/string.c
index e2f84638c4..bda24b14ac 100644
--- a/xen/arch/x86/string.c
+++ b/xen/arch/x86/string.c
@@ -43,7 +43,8 @@ void *(memmove)(void *dest, const void *src, size_t n)
         return dest;
 
     if ( dest < src )
-        return memcpy(dest, src, n);
+        /* Depends on Xen's implementation operating forwards. */
+        return (memcpy)(dest, src, n);
 
     asm volatile (
         "   std         ; "
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 06 11:11:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Feb 2021 11:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82143.151895 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LUf-0000sa-Ce; Sat, 06 Feb 2021 11:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82143.151895; Sat, 06 Feb 2021 11:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LUf-0000sQ-9G; Sat, 06 Feb 2021 11:11:13 +0000
Received: by outflank-mailman (input) for mailman id 82143;
 Sat, 06 Feb 2021 11:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LUe-0000sG-LI
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11: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 1l8LUe-00073r-KT
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LUe-00019x-Ig
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lE4R1fxK7sDIrvABD8e/U3kEGQ/CerCA5h7S7ZLpVYE=; b=clKcfdYQMvmHjzozRXvi1lQARx
	xhNazSAtRJBAfPpjZv6Tv+NKJjoxAAwiL/B2iGSwdC6fNRySmAA3mWzeuFid2Ly5dtN2c336+Fx+X
	SUFsV3Avpg2qgREYlAwlTv2v1gMdJs6Y5IeoIR5sJvOHSf46/avNiTwAcoO26oRMzE8s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] IOREQ: fix waiting for broadcast completion
Message-Id: <E1l8LUe-00019x-Ig@xenbits.xenproject.org>
Date: Sat, 06 Feb 2021 11:11:12 +0000

commit da20c93108226cb2eb2ed1a13225337f2318a642
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 4 14:01:21 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 4 14:01:21 2021 +0100

    IOREQ: fix waiting for broadcast completion
    
    Checking just a single server is not enough - all of them must have
    signaled that they're done processing the request.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 xen/common/ioreq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/common/ioreq.c b/xen/common/ioreq.c
index 90ed2e0302..5b603c0520 100644
--- a/xen/common/ioreq.c
+++ b/xen/common/ioreq.c
@@ -213,9 +213,9 @@ bool vcpu_ioreq_handle_completion(struct vcpu *v)
         return false;
     }
 
-    sv = get_pending_vcpu(v, &s);
-    if ( sv && !wait_for_io(sv, get_ioreq(s, v)) )
-        return false;
+    while ( (sv = get_pending_vcpu(v, &s)) != NULL )
+        if ( !wait_for_io(sv, get_ioreq(s, v)) )
+            return false;
 
     vio->req.state = ioreq_needs_completion(&vio->req) ?
         STATE_IORESP_READY : STATE_IOREQ_NONE;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 06 11:11:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Feb 2021 11:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82145.151899 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LUp-0000uC-EC; Sat, 06 Feb 2021 11:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82145.151899; Sat, 06 Feb 2021 11:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LUp-0000u3-B2; Sat, 06 Feb 2021 11:11:23 +0000
Received: by outflank-mailman (input) for mailman id 82145;
 Sat, 06 Feb 2021 11:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LUo-0000tx-ON
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LUo-000744-NV
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LUo-0001Ao-Mb
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Q/1Ndky1mZWCHKLCmws6vIbcXZyxtqkgCWWrZjJRCd0=; b=MWeDQdJGf0cyHibvUlzhmAPntu
	l+Nc19Uj8FvwypX1PuxRV0JrYZgW6mMI+e+GHVpM0SdyHjtxaIlRLiyVEouTyPQlre58Fb0Xj4bMG
	APuXcDEDp5M9+UZA1ja5rzBRgf711QWI6802HVswLSzZhsLjgkXqRbfLUQWKFvpY9UMs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/efi: enable MS ABI attribute on clang
Message-Id: <E1l8LUo-0001Ao-Mb@xenbits.xenproject.org>
Date: Sat, 06 Feb 2021 11:11:22 +0000

commit 92f5ffa58d188c9f9a9f1bcdccb6d6348d9df612
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Feb 4 14:02:32 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 4 14:02:32 2021 +0100

    x86/efi: enable MS ABI attribute on clang
    
    Or else the EFI service calls will use the wrong calling convention.
    
    The __ms_abi__ attribute is available on all supported versions of
    clang. Add a specific Clang check because the GCC version reported by
    Clang is below the required 4.4 to use the __ms_abi__ attribute.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/include/asm-x86/x86_64/efibind.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/asm-x86/x86_64/efibind.h b/xen/include/asm-x86/x86_64/efibind.h
index b013db175d..ddcfae07ec 100644
--- a/xen/include/asm-x86/x86_64/efibind.h
+++ b/xen/include/asm-x86/x86_64/efibind.h
@@ -172,7 +172,7 @@ typedef uint64_t   UINTN;
 #ifndef EFIAPI                  // Forces EFI calling conventions reguardless of compiler options
     #ifdef _MSC_EXTENSIONS
         #define EFIAPI __cdecl  // Force C calling convention for Microsoft C compiler
-    #elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
+    #elif __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
         #define EFIAPI __attribute__((__ms_abi__))  // Force Microsoft ABI
     #else
         #define EFIAPI          // Substitute expresion to force C calling convention
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 06 11:11:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Feb 2021 11:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82146.151902 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LV0-0000vf-Fk; Sat, 06 Feb 2021 11:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82146.151902; Sat, 06 Feb 2021 11:11:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LV0-0000vZ-Cq; Sat, 06 Feb 2021 11:11:34 +0000
Received: by outflank-mailman (input) for mailman id 82146;
 Sat, 06 Feb 2021 11:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LUy-0000vL-To
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LUy-00074F-QM
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LUy-0001Bb-PX
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=c/akaxTaSWDJD2l4V5NcaY/3lZNi/Dopjeh3mMFmbvQ=; b=XFrod6ktV/0W82HOdyWGkrpBnX
	Weg2hm2rYHeooAFrg3Fzi+rz5Ld+47Cyg73kvkhGZXT/hjCIDar1G0ybl/bmMDpEWlXKd/nBN1giR
	fSURhCof8nXgZ2uACeyj0BgbR25ZAYIv6WFIMR/i6vexSKZQVQBdf+1Z58f9iZ/818Fg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/oxenstored: Fix quota calculation for mkdir EEXIST
Message-Id: <E1l8LUy-0001Bb-PX@xenbits.xenproject.org>
Date: Sat, 06 Feb 2021 11:11:32 +0000

commit c8b96708252a436da44005307f7c195d699bd7c5
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Jan 15 19:11:32 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 4 14:17:44 2021 +0000

    tools/oxenstored: Fix quota calculation for mkdir EEXIST
    
    We increment the domain's quota on mkdir even when the node already exists.
    This results in a quota inconsistency after live update, where reconstructing
    the tree from scratch results in a different quota.
    
    Not a security issue because the domain uses up quota faster, so it will only
    get a Quota error sooner than it should.
    
    Found by the structured fuzzer.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/ocaml/xenstored/store.ml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/ocaml/xenstored/store.ml b/tools/ocaml/xenstored/store.ml
index 1bd0c81f6f..20e67b1427 100644
--- a/tools/ocaml/xenstored/store.ml
+++ b/tools/ocaml/xenstored/store.ml
@@ -419,6 +419,7 @@ let mkdir store perm path =
 	(* It's upt to the mkdir logic to decide what to do with existing path *)
 	if not (existing || (Perms.Connection.is_dom0 perm)) then Quota.check store.quota owner 0;
 	store.root <- path_mkdir store perm path;
+	if not existing then
 	Quota.add_entry store.quota owner
 
 let rm store perm path =
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 06 11:11:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Feb 2021 11:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82147.151906 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LVA-0000x0-He; Sat, 06 Feb 2021 11:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82147.151906; Sat, 06 Feb 2021 11:11:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LVA-0000ws-EZ; Sat, 06 Feb 2021 11:11:44 +0000
Received: by outflank-mailman (input) for mailman id 82147;
 Sat, 06 Feb 2021 11:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LV8-0000wf-Tq
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LV8-00074Q-T8
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LV8-0001CR-SR
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=O+bPPj/raPNsrlldf6prEchixoAi1ar2c9XJn1IpqF4=; b=BBXQs01zjqwuAw7Hn9FhLcSqAg
	XuN6ssME/c8LXJBxVW2ZEnUEtJd7jR02GBPrrELUxL/XtORTIH/iUOGlsnQEtS5YRy3PQO6SxXZit
	npO+PfiCidD0HZGo9YKDAz0hZynE2fDUIYiMdvSh5Ngsi5YFytZXod46ucglh3R72bWk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/oxenstored: Reject invalid watch paths early
Message-Id: <E1l8LV8-0001CR-SR@xenbits.xenproject.org>
Date: Sat, 06 Feb 2021 11:11:42 +0000

commit dc8caf214fb882546b0e93317b9828247a7c9da8
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Jan 15 19:28:37 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 4 14:17:44 2021 +0000

    tools/oxenstored: Reject invalid watch paths early
    
    Watches on invalid paths were accepted, but they would never trigger.  The
    client also got no notification that its watch is bad and would never trigger.
    
    Found again by the structured fuzzer, due to an error on live update reload:
    the invalid watch paths would get rejected during live update and the list of
    watches would be different pre/post live update.
    
    The testcase is watch on `//`, which is an invalid path.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/ocaml/xenstored/connection.ml  | 5 ++---
 tools/ocaml/xenstored/connections.ml | 4 +++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/ocaml/xenstored/connection.ml b/tools/ocaml/xenstored/connection.ml
index d09a0fa405..65f99ea6f2 100644
--- a/tools/ocaml/xenstored/connection.ml
+++ b/tools/ocaml/xenstored/connection.ml
@@ -158,18 +158,17 @@ let get_children_watches con path =
 let is_dom0 con =
 	Perms.Connection.is_dom0 (get_perm con)
 
-let add_watch con path token =
+let add_watch con (path, apath) token =
 	if !Quota.activate && !Define.maxwatch > 0 &&
 	   not (is_dom0 con) && con.nb_watches > !Define.maxwatch then
 		raise Quota.Limit_reached;
-	let apath = get_watch_path con path in
 	let l = get_watches con apath in
 	if List.exists (fun w -> w.token = token) l then
 		raise Define.Already_exist;
 	let watch = watch_create ~con ~token ~path in
 	Hashtbl.replace con.watches apath (watch :: l);
 	con.nb_watches <- con.nb_watches + 1;
-	apath, watch
+	watch
 
 let del_watch con path token =
 	let apath = get_watch_path con path in
diff --git a/tools/ocaml/xenstored/connections.ml b/tools/ocaml/xenstored/connections.ml
index 8a66eeec3a..3c7429fe7f 100644
--- a/tools/ocaml/xenstored/connections.ml
+++ b/tools/ocaml/xenstored/connections.ml
@@ -114,8 +114,10 @@ let key_of_path path =
 	"" :: Store.Path.to_string_list path
 
 let add_watch cons con path token =
-	let apath, watch = Connection.add_watch con path token in
+	let apath = Connection.get_watch_path con path in
+	(* fail on invalid paths early by calling key_of_str before adding watch *)
 	let key = key_of_str apath in
+	let watch = Connection.add_watch con (path, apath) token in
 	let watches =
  		if Trie.mem cons.watches key
  		then Trie.find cons.watches key
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 06 11:11:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Feb 2021 11:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82148.151911 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LVK-0000yF-JJ; Sat, 06 Feb 2021 11:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82148.151911; Sat, 06 Feb 2021 11:11:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LVK-0000y6-G6; Sat, 06 Feb 2021 11:11:54 +0000
Received: by outflank-mailman (input) for mailman id 82148;
 Sat, 06 Feb 2021 11:11:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LVJ-0000xu-0R
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:11:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LVI-00074y-Vs
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LVI-0001DK-VB
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=c1pbVZfMUG+Nx5h5hF7Bsn99jl6JweSc8wThoA4Hp70=; b=4m6VTLEcV0D0KEWPDGZnyhU6qn
	WUcCniKJg644ttG3e/BdXeft2qEHhGmbUUA2yY+LhhyQIQYflllxrsdjH9oGyc+0U9n8z3G+mgghJ
	ZIaCC+5FvR6WI5izbgscmDoZRGODLjzuFGGCGrD/eBK9HeXU9zCdrjoPuhtPSMjZcK0Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/oxenstored: mkdir conflicts were sometimes missed
Message-Id: <E1l8LVI-0001DK-VB@xenbits.xenproject.org>
Date: Sat, 06 Feb 2021 11:11:52 +0000

commit 45dee7d92b493bb531e7e77a6f9c0180ab152f87
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Jan 15 19:38:58 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 4 14:17:44 2021 +0000

    tools/oxenstored: mkdir conflicts were sometimes missed
    
    Due to how set_write_lowpath was used here it didn't detect create/delete
    conflicts.  When we create an entry we must mark our parent as modified
    (this is what creating a new node via write does).
    
    Otherwise we can have 2 transactions one creating, and another deleting a node
    both succeeding depending on timing.  Or one transaction reading an entry,
    concluding it doesn't exist, do some other work based on that information and
    successfully commit even if another transaction creates the node via mkdir
    meanwhile.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/ocaml/xenstored/transaction.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/xenstored/transaction.ml b/tools/ocaml/xenstored/transaction.ml
index 25bc8c3b4a..17b1bdf2ea 100644
--- a/tools/ocaml/xenstored/transaction.ml
+++ b/tools/ocaml/xenstored/transaction.ml
@@ -165,7 +165,7 @@ let write t perm path value =
 
 let mkdir ?(with_watch=true) t perm path =
 	Store.mkdir t.store perm path;
-	set_write_lowpath t path;
+	set_write_lowpath t (Store.Path.get_parent path);
 	if with_watch then
 		add_wop t Xenbus.Xb.Op.Mkdir path
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 06 11:12:04 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Feb 2021 11:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82151.151915 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LVU-000102-LT; Sat, 06 Feb 2021 11:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82151.151915; Sat, 06 Feb 2021 11:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LVU-0000zs-Hs; Sat, 06 Feb 2021 11:12:04 +0000
Received: by outflank-mailman (input) for mailman id 82151;
 Sat, 06 Feb 2021 11:12:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LVT-0000zk-3D
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:12:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LVT-00075H-2R
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:12:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LVT-0001EK-1j
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:12:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Z2DbqmkZWQFLm2NiTdJxUDnOXV7g3H8PbDc4hEoPO88=; b=AAfHXcmTCFiCnY5pkCZ+PSHjXi
	UZGDUrZeG4sbvl/K8YpRLhGRTxCBxwVBjEbGP/Qt1u0uqshMfO8ylhaPAwlKewJ0n08h2S9CZSfmy
	yNxhY2/GLJJ+jwyutPUHPQ8LcZQ9EuXAyvAldRi+gmPnJTH3ByTsWPxt9UsB4qyEMdxk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/devicemodel: Fix ABI breakage from xendevicemodel_set_irq_level()
Message-Id: <E1l8LVT-0001EK-1j@xenbits.xenproject.org>
Date: Sat, 06 Feb 2021 11:12:03 +0000

commit e8af54084586f4e165eee0b49175a63e3c541c64
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 4 15:50:16 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 4 21:26:41 2021 +0000

    libs/devicemodel: Fix ABI breakage from xendevicemodel_set_irq_level()
    
    It is not permitted to edit the VERS clause for a version in a release of Xen.
    
    Revert xendevicemodel_set_irq_level()'s inclusion in .so.1.2 and bump the the
    library minor version to .so.1.4 instead.
    
    Fixes: 5d752df85f ("xen/dm: Introduce xendevicemodel_set_irq_level DM op")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/devicemodel/Makefile              | 2 +-
 tools/libs/devicemodel/libxendevicemodel.map | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile
index 500de7adc5..3e50ff6d90 100644
--- a/tools/libs/devicemodel/Makefile
+++ b/tools/libs/devicemodel/Makefile
@@ -2,7 +2,7 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
-MINOR    = 3
+MINOR    = 4
 
 SRCS-y                 += core.c
 SRCS-$(CONFIG_Linux)   += common.c
diff --git a/tools/libs/devicemodel/libxendevicemodel.map b/tools/libs/devicemodel/libxendevicemodel.map
index a0c30125de..733549327b 100644
--- a/tools/libs/devicemodel/libxendevicemodel.map
+++ b/tools/libs/devicemodel/libxendevicemodel.map
@@ -32,10 +32,14 @@ VERS_1.2 {
 	global:
 		xendevicemodel_relocate_memory;
 		xendevicemodel_pin_memory_cacheattr;
-		xendevicemodel_set_irq_level;
 } VERS_1.1;
 
 VERS_1.3 {
 	global:
 		xendevicemodel_modified_memory_bulk;
 } VERS_1.2;
+
+VERS_1.4 {
+	global:
+		xendevicemodel_set_irq_level;
+} VERS_1.3;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 06 11:12:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Feb 2021 11:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82152.151918 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LVe-00011M-NN; Sat, 06 Feb 2021 11:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82152.151918; Sat, 06 Feb 2021 11:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LVe-00011E-Ji; Sat, 06 Feb 2021 11:12:14 +0000
Received: by outflank-mailman (input) for mailman id 82152;
 Sat, 06 Feb 2021 11:12:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LVd-000113-6o
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:12:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LVd-00075P-5w
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LVd-0001F9-4f
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:12:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A3mFOVTkol/9aUsd9xklazee6x9Ky/XBx+evbDklgDY=; b=uBk5cm8REQAT11wV/cNr+5qEia
	1X4kwYJLGzPxly0XcE0nyV7kB/7R/q0/STY9NFcHFMxNYtZuEXLzqi4CeirDnHmhnIkCgNy6m9wk+
	nWyNwjenbgw4Fud3QgCdPpfgzCMEfLwat/2OepYVjGs0JcYMfQQpHq8ht/wuge1LMaio=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/hotplug: Add a qemu-ifup script on NetBSD
Message-Id: <E1l8LVd-0001F9-4f@xenbits.xenproject.org>
Date: Sat, 06 Feb 2021 11:12:13 +0000

commit 4cc948020a58588d02413d92976ddd5233dd7cae
Author:     Manuel Bouyer <bouyer@netbsd.org>
AuthorDate: Wed Feb 3 17:54:18 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 4 21:26:41 2021 +0000

    tools/hotplug: Add a qemu-ifup script on NetBSD
    
    On NetBSD, qemu-xen will use a qemu-ifup script to setup the tap interfaces
    (as qemu-xen-traditional used to). Copy the script from qemu-xen-traditional,
    and install it on NetBSD. While there document parameters and environnement
    variables.
    
    Signed-off-by: Manuel Bouyer <bouyer@netbsd.org>
    Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/hotplug/NetBSD/Makefile  | 1 +
 tools/hotplug/NetBSD/qemu-ifup | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/tools/hotplug/NetBSD/Makefile b/tools/hotplug/NetBSD/Makefile
index 114b223207..f909ffa367 100644
--- a/tools/hotplug/NetBSD/Makefile
+++ b/tools/hotplug/NetBSD/Makefile
@@ -7,6 +7,7 @@ XEN_SCRIPTS += locking.sh
 XEN_SCRIPTS += block
 XEN_SCRIPTS += vif-bridge
 XEN_SCRIPTS += vif-ip
+XEN_SCRIPTS += qemu-ifup
 
 XEN_SCRIPT_DATA =
 XEN_RCD_PROG = rc.d/xencommons rc.d/xendomains rc.d/xen-watchdog rc.d/xendriverdomain
diff --git a/tools/hotplug/NetBSD/qemu-ifup b/tools/hotplug/NetBSD/qemu-ifup
new file mode 100644
index 0000000000..4305419f44
--- /dev/null
+++ b/tools/hotplug/NetBSD/qemu-ifup
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+#called by qemu when a HVM domU is started.
+# first parameter is tap interface, second is the bridge name
+# environement variable $XEN_DOMAIN_ID contains the domU's ID,
+# which can be used to retrieve extra parameters from the xenstore.
+
+ifconfig $1 up
+exec /sbin/brconfig $2 add $1
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 06 11:12:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Feb 2021 11:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82153.151923 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LVo-00012n-Qm; Sat, 06 Feb 2021 11:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82153.151923; Sat, 06 Feb 2021 11:12:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LVo-00012f-NA; Sat, 06 Feb 2021 11:12:24 +0000
Received: by outflank-mailman (input) for mailman id 82153;
 Sat, 06 Feb 2021 11:12:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LVn-00012U-A2
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:12:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LVn-00075W-9M
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LVn-0001Fx-86
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:12:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=d+3p3gaSAtTEnmagMqv2ioDwxkq2nJA6yDk0jiFw3Os=; b=XqeO5Gj02Et93i3yJvQd/inT9W
	nnlT3BkiKsl6KQRAWIbwGRmXZCm4GlwTvkzms0W9Qip1UjRV7OM0eTdWdvIAvL/FJBrkr8nBJ14gO
	BVMFstgVlIyfbD1jjitc4m4AWqm9OEcbzQcSAkvJ7tHjoTS7kqgK6Vk3GIDs2hJZjFw0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: close socket connections on error
Message-Id: <E1l8LVn-0001Fx-86@xenbits.xenproject.org>
Date: Sat, 06 Feb 2021 11:12:23 +0000

commit cd09c4929e9b70d77747ec187ea94731c8a06ab2
Author:     Manuel Bouyer <bouyer@netbsd.org>
AuthorDate: Wed Feb 3 17:54:19 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 4 21:26:41 2021 +0000

    tools/xenstored: close socket connections on error
    
    On error, don't keep socket connection in ignored state but close them.
    When the remote end of a socket is closed, xenstored will flag it as an
    error and switch the connection to ignored. But on some OSes (e.g.
    NetBSD), poll(2) will return only POLLIN in this case, so sockets in ignored
    state will stay open forever in xenstored (and it will loop with CPU 100%
    busy).
    
    Fixes: d2fa370d3ef9 ("tools/xenstore: Preserve bad client until they are destroyed")
    Signed-off-by: Manuel Bouyer <bouyer@netbsd.org>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xenstore/xenstored_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 1ab6f162cb..0fea598352 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -1440,6 +1440,9 @@ static void ignore_connection(struct connection *conn)
 
 	talloc_free(conn->in);
 	conn->in = NULL;
+	/* if this is a socket connection, drop it now */
+	if (conn->fd >= 0)
+		talloc_free(conn);
 }
 
 static const char *sockmsg_string(enum xsd_sockmsg_type type)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 06 11:12:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Feb 2021 11:12:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82154.151927 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LVy-000149-Se; Sat, 06 Feb 2021 11:12:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82154.151927; Sat, 06 Feb 2021 11:12:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LVy-000140-Ou; Sat, 06 Feb 2021 11:12:34 +0000
Received: by outflank-mailman (input) for mailman id 82154;
 Sat, 06 Feb 2021 11:12:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LVx-00013q-D4
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:12:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LVx-00075e-CK
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LVx-0001Gl-Bb
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:12:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HaEUzrjxukNF045zJ0uBjC7YhnO7UxOfG+kZyff5HF4=; b=ibEGpcyGEfKJHdEBHNEgiY8byd
	jDKoEijkVy9VfyRnmLNDhDhwlNVTaVRHszdTIRYbz4aw/gixdmYKGZZ75onCbWGtOCR4uhM1AYHjg
	VUv9qBqoGu6+hcjB4mzoLJNKapDkhLRI8rE66ebkwDfOWolp7j0eRpZCwtHzm4amUL40=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/man: Document qemu-ifup on NetBSD
Message-Id: <E1l8LVx-0001Gl-Bb@xenbits.xenproject.org>
Date: Sat, 06 Feb 2021 11:12:33 +0000

commit def12125357ed2efd6d581d9033afcc9d66daa8a
Author:     Manuel Bouyer <bouyer@netbsd.org>
AuthorDate: Wed Feb 3 17:54:20 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 4 21:26:41 2021 +0000

    docs/man: Document qemu-ifup on NetBSD
    
    Document that on NetBSD, the tap interface will be configured by the
    qemu-ifup script.
    
    Signed-off-by: Manuel Bouyer <bouyer@netbsd.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 docs/man/xl-network-configuration.5.pod | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/docs/man/xl-network-configuration.5.pod b/docs/man/xl-network-configuration.5.pod
index af058d4d3c..8e5fd909fa 100644
--- a/docs/man/xl-network-configuration.5.pod
+++ b/docs/man/xl-network-configuration.5.pod
@@ -172,6 +172,9 @@ add it to the relevant bridge). Defaults to
 C<XEN_SCRIPT_DIR/vif-bridge> but can be set to any script. Some example
 scripts are installed in C<XEN_SCRIPT_DIR>.
 
+Note on NetBSD HVM guests will ignore the script option for tap
+(emulated) interfaces and always use
+C<XEN_SCRIPT_DIR/qemu-ifup> to configure the interface in bridged mode.
 
 =head2 ip
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 06 11:12:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Feb 2021 11:12:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82155.151933 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LW8-00015Q-V4; Sat, 06 Feb 2021 11:12:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82155.151933; Sat, 06 Feb 2021 11:12:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l8LW8-00015L-Qh; Sat, 06 Feb 2021 11:12:44 +0000
Received: by outflank-mailman (input) for mailman id 82155;
 Sat, 06 Feb 2021 11:12:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LW7-000159-Gq
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:12:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LW7-00075o-F1
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l8LW7-0001HZ-EO
 for xen-changelog@lists.xenproject.org; Sat, 06 Feb 2021 11:12:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OMTsr0zUciMBm6LVOdfuUm8bUmB+gkkd+JVIzAuU7kw=; b=o/4xQOjpLXcIEYD5TCddTiQ4B+
	veVu2OP5mU9aJ/mMub/fy6h40gD+J9aAV6fMeBZlgVMGa2KKvdGZwF7dWG5dOMlQgwPpSkTnEODpq
	5W4N7E26mLkqW3re+It2CwGGcugeuozgabPfjUK0qPFqJfGcqDZlA2IBl6NtDJmaQAx0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/tests: Introduce a test for acquire_resource
Message-Id: <E1l8LW7-0001HZ-EO@xenbits.xenproject.org>
Date: Sat, 06 Feb 2021 11:12:43 +0000

commit ff522e2e9163b27fe4d80ba55c18408f9b1f1cb7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jul 23 17:26:16 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 4 22:03:33 2021 +0000

    tools/tests: Introduce a test for acquire_resource
    
    For now, simply try to map 40 frames of grant table.  This catches most of the
    basic errors with resource sizes found and fixed through the 4.15 dev window.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/tests/Makefile                 |   1 +
 tools/tests/resource/.gitignore      |   1 +
 tools/tests/resource/Makefile        |  40 ++++++++++
 tools/tests/resource/test-resource.c | 151 +++++++++++++++++++++++++++++++++++
 4 files changed, 193 insertions(+)

diff --git a/tools/tests/Makefile b/tools/tests/Makefile
index fc9b715951..8746aabe6b 100644
--- a/tools/tests/Makefile
+++ b/tools/tests/Makefile
@@ -2,6 +2,7 @@ XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS-y :=
+SUBDIRS-y += resource
 SUBDIRS-$(CONFIG_X86) += cpu-policy
 SUBDIRS-$(CONFIG_X86) += mce-test
 ifneq ($(clang),y)
diff --git a/tools/tests/resource/.gitignore b/tools/tests/resource/.gitignore
new file mode 100644
index 0000000000..4872e97d4b
--- /dev/null
+++ b/tools/tests/resource/.gitignore
@@ -0,0 +1 @@
+test-resource
diff --git a/tools/tests/resource/Makefile b/tools/tests/resource/Makefile
new file mode 100644
index 0000000000..4bef482966
--- /dev/null
+++ b/tools/tests/resource/Makefile
@@ -0,0 +1,40 @@
+XEN_ROOT = $(CURDIR)/../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+TARGET := test-resource
+
+.PHONY: all
+all: $(TARGET)
+
+.PHONY: run
+run: $(TARGET)
+	./$(TARGET)
+
+.PHONY: clean
+clean:
+	$(RM) -f -- *.o $(TARGET) $(DEPS_RM)
+
+.PHONY: distclean
+distclean: clean
+	$(RM) -f -- *~
+
+.PHONY: install
+install: all
+
+.PHONY: uninstall
+uninstall:
+
+CFLAGS += -Werror
+CFLAGS += $(CFLAGS_xeninclude)
+CFLAGS += $(CFLAGS_libxenctrl)
+CFLAGS += $(CFLAGS_libxenforeginmemory)
+CFLAGS += $(APPEND_CFLAGS)
+
+LDFLAGS += $(LDLIBS_libxenctrl)
+LDFLAGS += $(LDLIBS_libxenforeignmemory)
+LDFLAGS += $(APPEND_LDFLAGS)
+
+test-resource: test-resource.o
+	$(CC) -o $@ $< $(LDFLAGS)
+
+-include $(DEPS_INCLUDE)
diff --git a/tools/tests/resource/test-resource.c b/tools/tests/resource/test-resource.c
new file mode 100644
index 0000000000..a409a82f44
--- /dev/null
+++ b/tools/tests/resource/test-resource.c
@@ -0,0 +1,151 @@
+#include <err.h>
+#include <errno.h>
+#include <error.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/mman.h>
+
+#include <xenctrl.h>
+#include <xenforeignmemory.h>
+#include <xen-tools/libs.h>
+
+static unsigned int nr_failures;
+#define fail(fmt, ...)                          \
+({                                              \
+    nr_failures++;                              \
+    (void)printf(fmt, ##__VA_ARGS__);           \
+})
+
+static xc_interface *xch;
+static xenforeignmemory_handle *fh;
+
+static void test_gnttab(uint32_t domid, unsigned int nr_frames)
+{
+    xenforeignmemory_resource_handle *res;
+    void *addr = NULL;
+    size_t size;
+    int rc;
+
+    printf("  Test grant table\n");
+
+    /* Obtain the grant table resource size. */
+    rc = xenforeignmemory_resource_size(
+        fh, domid, XENMEM_resource_grant_table,
+        XENMEM_resource_grant_table_id_shared, &size);
+
+    /*
+     * A failure of this call indicates missing kernel support for size
+     * ioctl(), or missing Xen acquire_resource support.
+     */
+    if ( rc )
+        return fail("    Fail: Get size: %d - %s\n", errno, strerror(errno));
+
+    /*
+     * Getting 32 frames back instead of nr_frames indicates Xen is missing
+     * the bugfix to make size requests actually return real data.
+     */
+    if ( (size >> XC_PAGE_SHIFT) != nr_frames )
+        return fail("    Fail: Get size: expected %u frames, got %zu\n",
+                    nr_frames, size >> XC_PAGE_SHIFT);
+
+    /* Map the entire grant table. */
+    res = xenforeignmemory_map_resource(
+        fh, domid, XENMEM_resource_grant_table,
+        XENMEM_resource_grant_table_id_shared, 0, size >> XC_PAGE_SHIFT,
+        &addr, PROT_READ | PROT_WRITE, 0);
+
+    /*
+     * Failure here with E2BIG indicates Xen is missing the bugfix to map
+     * resources larger than 32 frames.
+     */
+    if ( !res )
+        return fail("    Fail: Map %d - %s\n", errno, strerror(errno));
+
+    rc = xenforeignmemory_unmap_resource(fh, res);
+    if ( rc )
+        return fail("    Fail: Unmap %d - %s\n", errno, strerror(errno));
+}
+
+static void test_domain_configurations(void)
+{
+    static struct test {
+        const char *name;
+        struct xen_domctl_createdomain create;
+    } tests[] = {
+#if defined(__x86_64__) || defined(__i386__)
+        {
+            .name = "x86 PV",
+            .create = {
+                .max_vcpus = 2,
+                .max_grant_frames = 40,
+            },
+        },
+        {
+            .name = "x86 PVH",
+            .create = {
+                .flags = XEN_DOMCTL_CDF_hvm,
+                .max_vcpus = 2,
+                .max_grant_frames = 40,
+                .arch = {
+                    .emulation_flags = XEN_X86_EMU_LAPIC,
+                },
+            },
+        },
+#elif defined(__aarch64__) || defined(__arm__)
+        {
+            .name = "ARM",
+            .create = {
+                .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap,
+                .max_vcpus = 2,
+                .max_grant_frames = 40,
+            },
+        },
+#endif
+    };
+
+    for ( unsigned int i = 0; i < ARRAY_SIZE(tests); ++i )
+    {
+        struct test *t = &tests[i];
+        uint32_t domid = 0;
+        int rc;
+
+        printf("Test %s\n", t->name);
+
+        rc = xc_domain_create(xch, &domid, &t->create);
+        if ( rc )
+        {
+            if ( errno == EINVAL || errno == EOPNOTSUPP )
+                printf("  Skip: %d - %s\n", errno, strerror(errno));
+            else
+                fail("  Domain create failure: %d - %s\n",
+                     errno, strerror(errno));
+            continue;
+        }
+
+        printf("  Created d%u\n", domid);
+
+        test_gnttab(domid, t->create.max_grant_frames);
+
+        rc = xc_domain_destroy(xch, domid);
+        if ( rc )
+            fail("  Failed to destroy domain: %d - %s\n",
+                 errno, strerror(errno));
+    }
+}
+
+int main(int argc, char **argv)
+{
+    printf("XENMEM_acquire_resource tests\n");
+
+    xch = xc_interface_open(NULL, NULL, 0);
+    fh = xenforeignmemory_open(NULL, 0);
+
+    if ( !xch )
+        err(1, "xc_interface_open");
+    if ( !fh )
+        err(1, "xenforeignmemory_open");
+
+    test_domain_configurations();
+
+    return !!nr_failures;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Feb 08 12:33:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Feb 2021 12:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82837.153180 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l95j1-0005qM-2A; Mon, 08 Feb 2021 12:33:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82837.153180; Mon, 08 Feb 2021 12:33:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l95j0-0005qE-Vb; Mon, 08 Feb 2021 12:33:06 +0000
Received: by outflank-mailman (input) for mailman id 82837;
 Mon, 08 Feb 2021 12:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l95iz-0005q6-He
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 12:33:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l95iz-0003Uv-Fu
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 12:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l95iz-00051T-ES
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 12:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tARa5+sK3RRE9bd4f1IPqh/qzCyyeNgJYPj3hCUZ5Pg=; b=Kn2AL9eIBOtnL0Pi0tKWCkRFL7
	+2HR4A7xcAuv+07IyKhN/OSs+/599uFZU9v0bATHp2Yh1TrHXuMbuKtLj4hl+S89B7fGdHVQ+4uau
	FxCTC0TtWXh893mldmQlNYSghz0d28T8h5SEawiHCW3//j/NC5xPj7M6VPrytQcqLUwU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libxl: pass libxl__domain_build_state to libxl__arch_domain_create
Message-Id: <E1l95iz-00051T-ES@xenbits.xenproject.org>
Date: Mon, 08 Feb 2021 12:33:05 +0000

commit 804fe751375b1f40eb3142121bf2b70fa2a83972
Author:     Igor Druzhinin <igor.druzhinin@citrix.com>
AuthorDate: Wed Feb 3 20:07:03 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 8 12:26:44 2021 +0000

    tools/libxl: pass libxl__domain_build_state to libxl__arch_domain_create
    
    No functional change.
    
    Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/light/libxl_arch.h | 6 ++++--
 tools/libs/light/libxl_arm.c  | 4 +++-
 tools/libs/light/libxl_dom.c  | 2 +-
 tools/libs/light/libxl_x86.c  | 6 ++++--
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/tools/libs/light/libxl_arch.h b/tools/libs/light/libxl_arch.h
index 6a91775b9e..c305d704b1 100644
--- a/tools/libs/light/libxl_arch.h
+++ b/tools/libs/light/libxl_arch.h
@@ -30,8 +30,10 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
 
 /* arch specific internal domain creation function */
 _hidden
-int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
-               uint32_t domid);
+int libxl__arch_domain_create(libxl__gc *gc,
+                              libxl_domain_config *d_config,
+                              libxl__domain_build_state *state,
+                              uint32_t domid);
 
 /* setup arch specific hardware description, i.e. DTB on ARM */
 _hidden
diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index 66e8a065fe..8c4eda3caf 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -126,7 +126,9 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
     return 0;
 }
 
-int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
+int libxl__arch_domain_create(libxl__gc *gc,
+                              libxl_domain_config *d_config,
+                              ibxl__domain_build_state *state,
                               uint32_t domid)
 {
     return 0;
diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c
index 19168572fd..842a51c86c 100644
--- a/tools/libs/light/libxl_dom.c
+++ b/tools/libs/light/libxl_dom.c
@@ -378,7 +378,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
     state->store_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->store_domid);
     state->console_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->console_domid);
 
-    rc = libxl__arch_domain_create(gc, d_config, domid);
+    rc = libxl__arch_domain_create(gc, d_config, state, domid);
 
     /* Construct a CPUID policy, but only for brand new domains.  Domains
      * being migrated-in/restored have CPUID handled during the
diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c
index 91a9fc72ed..91169d1045 100644
--- a/tools/libs/light/libxl_x86.c
+++ b/tools/libs/light/libxl_x86.c
@@ -453,8 +453,10 @@ static int hvm_set_conf_params(libxl__gc *gc, uint32_t domid,
     return ret;
 }
 
-int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
-        uint32_t domid)
+int libxl__arch_domain_create(libxl__gc *gc,
+                              libxl_domain_config *d_config,
+                              libxl__domain_build_state *state,
+                              uint32_t domid)
 {
     const libxl_domain_build_info *info = &d_config->b_info;
     int ret = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Feb 08 12:33:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Feb 2021 12:33:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82838.153184 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l95jB-0005ss-3b; Mon, 08 Feb 2021 12:33:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82838.153184; Mon, 08 Feb 2021 12:33:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l95jB-0005sk-0m; Mon, 08 Feb 2021 12:33:17 +0000
Received: by outflank-mailman (input) for mailman id 82838;
 Mon, 08 Feb 2021 12:33:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l95j9-0005sa-Ku
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 12:33:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l95j9-0003V7-Jg
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 12:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l95j9-00052t-I1
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 12:33:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KpYdlVWVigaueQLUZeEdSdEeYItm4+W700iwNRBoeQw=; b=WOkX5WqEJ7oKYOthAW+RcKEILB
	7IzE0cvfe7zk1WZgZ10P4gZoZprGw1udfKMaG4P5QHnxo6ffdX8pWK8q3GVbLqzXThGuHc4K+AanJ
	wHMFdMvzk58cKYLNXRHDacFajxGBwX2HcE8k89KOwhdPcHHpCIM6Bs6PpNCegURJAXiI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libxl: only set viridian flags on new domains
Message-Id: <E1l95j9-00052t-I1@xenbits.xenproject.org>
Date: Mon, 08 Feb 2021 12:33:15 +0000

commit 25ee478662d378ec2b24f517fb6d8d4829b885ff
Author:     Igor Druzhinin <igor.druzhinin@citrix.com>
AuthorDate: Wed Feb 3 20:07:04 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 8 12:26:44 2021 +0000

    tools/libxl: only set viridian flags on new domains
    
    Domains migrating or restoring should have viridian HVM param key in
    the migration stream already and setting that twice results in Xen
    returing -EEXIST on the second attempt later (during migration stream parsing)
    in case the values don't match. That causes migration/restore operation
    to fail at destination side.
    
    That issue is now resurfaced by the latest commits (983524671 and 7e5cffcd1e)
    extending default viridian feature set making the values from the previous
    migration streams and those set at domain construction different.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/light/libxl_x86.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c
index 91169d1045..58187ed760 100644
--- a/tools/libs/light/libxl_x86.c
+++ b/tools/libs/light/libxl_x86.c
@@ -468,7 +468,10 @@ int libxl__arch_domain_create(libxl__gc *gc,
         (ret = hvm_set_conf_params(gc, domid, info)) != 0)
         goto out;
 
-    if (info->type == LIBXL_DOMAIN_TYPE_HVM &&
+    /* Viridian flags are already a part of the migration stream so set
+     * them here only for brand new domains. */
+    if (!state->restore &&
+        info->type == LIBXL_DOMAIN_TYPE_HVM &&
         (ret = hvm_set_viridian_features(gc, domid, info)) != 0)
         goto out;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Feb 08 14:44:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Feb 2021 14:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82901.153324 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l97lm-00026g-VR; Mon, 08 Feb 2021 14:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82901.153324; Mon, 08 Feb 2021 14:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l97lm-00026Y-S7; Mon, 08 Feb 2021 14:44:06 +0000
Received: by outflank-mailman (input) for mailman id 82901;
 Mon, 08 Feb 2021 14:44:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l97ll-00026T-BO
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 14:44:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l97ll-0005hX-6y
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 14:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l97ll-0007pj-44
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 14:44:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+RK+gKZu1+rmuqCj9H0uhBZxU1D8KKBk7m+9Hx9zlOo=; b=ji1+FPPT6tjk5oZIAwt5DCk98D
	hf8wEPcWWt1kM9yI/Et2lRWIrPjUuGQ2kcbsJ7cbjsISjmAQ+CceAJKpJXR+IbrahvYY0isPqGxsy
	PjMU3UVuM/hW0U4V3cYqrLrsgou7hPzDqo0RjOvLoJuFH+bbWJyj3kIFVfSgA0f4myxw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libxl: Fix ARM build
Message-Id: <E1l97ll-0007pj-44@xenbits.xenproject.org>
Date: Mon, 08 Feb 2021 14:44:05 +0000

commit c973c38c2722b44396e94b64655a909330c631e7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 8 14:36:32 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 8 14:36:32 2021 +0000

    tools/libxl: Fix ARM build
    
    Fixes: 804fe751375 ("tools/libxl: pass libxl__domain_build_state to libxl__arch_domain_create")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/light/libxl_arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index 8c4eda3caf..5e2a209a8b 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -128,7 +128,7 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
 
 int libxl__arch_domain_create(libxl__gc *gc,
                               libxl_domain_config *d_config,
-                              ibxl__domain_build_state *state,
+                              libxl__domain_build_state *state,
                               uint32_t domid)
 {
     return 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Feb 08 16:33:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Feb 2021 16:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82964.153522 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l99TG-0005lE-Ml; Mon, 08 Feb 2021 16:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82964.153522; Mon, 08 Feb 2021 16:33:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l99TG-0005l6-K1; Mon, 08 Feb 2021 16:33:06 +0000
Received: by outflank-mailman (input) for mailman id 82964;
 Mon, 08 Feb 2021 16:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l99TF-0005l1-L0
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 16:33:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l99TF-000866-HS
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 16:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l99TF-0000Jj-Gm
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 16:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CaA9AhAqPVvM8qoTkrZM1xR3g8PDZn6tJVRRfC9PaEA=; b=1iNAEI+12ySwwaNATbw8Q6p8VO
	RminRoc+uHd6WHnTCsWly9neRKw0g46rF4Sg2RVn92MZoTyl2El9ZvG7ZdW8J+TyYZdPWTDABy2kL
	+Nel64FZQxyCe+BdSpf7LiHBHemNWZqROkeyOO0GIyVmWMLKwxq7xgDhM80ow6lKW0A0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: remove stale create example from xl.1
Message-Id: <E1l99TF-0000Jj-Gm@xenbits.xenproject.org>
Date: Mon, 08 Feb 2021 16:33:05 +0000

commit 8563c9e3a7bdf8c928a8e675e6b2c9c9254bd440
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Mon Jan 11 18:41:48 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Feb 8 15:43:31 2021 +0000

    docs: remove stale create example from xl.1
    
    Maybe xm create had a feature to create a domU based on a configuration
    file. xl create requires the '-f' option to refer to a file.
    There is no code to look into XEN_CONFIG_DIR, so remove the example.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 docs/man/xl.1.pod.in | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index f4779d8fd6..0354d3beba 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -171,13 +171,6 @@ B<EXAMPLES>
 
 =over 4
 
-=item I<with config file>
-
-  xl create DebianLenny
-
-This creates a domain with the file /etc/xen/DebianLenny, and returns as
-soon as it is run.
-
 =item I<with extra parameters>
 
   xl create hvm.cfg 'cpus="0-3"; pci=["01:05.1","01:05.2"]'
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Feb 08 16:33:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Feb 2021 16:33:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82965.153527 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l99TQ-0005m3-Ob; Mon, 08 Feb 2021 16:33:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82965.153527; Mon, 08 Feb 2021 16:33:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l99TQ-0005lv-Le; Mon, 08 Feb 2021 16:33:16 +0000
Received: by outflank-mailman (input) for mailman id 82965;
 Mon, 08 Feb 2021 16:33:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l99TP-0005lq-Np
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 16:33:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l99TP-00086J-LN
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 16:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l99TP-0000KW-Je
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 16:33:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=y9/3Jotl5Qb2qR74XwjeQWFHrkb/yVAUfYTbhFjLx98=; b=tQfJwtOGuDY32zz6T26gPAQJmX
	t6OGOQVGvpIfQ7GAXdTq9FFZfL3yJbU76IQJ4HCiKFzfLwAB16Jc/yEBI9CDyDlPi/nf9tx2dzQJG
	2bV5VQKc1ZW0mInyB1m1akhmB1ZAUxmM4rJ+K/s0nDSJtrxVQ/BweaO9w6vaFNiWR5L8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: substitute XEN_CONFIG_DIR in xl.conf.5
Message-Id: <E1l99TP-0000KW-Je@xenbits.xenproject.org>
Date: Mon, 08 Feb 2021 16:33:15 +0000

commit 52280d9492ee486be735859ef496220534c71905
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Mon Jan 11 18:41:49 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Feb 8 15:45:28 2021 +0000

    docs: substitute XEN_CONFIG_DIR in xl.conf.5
    
    xl(1) opens xl.conf in XEN_CONFIG_DIR.
    Substitute this variable also in the man page.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 docs/man/xl.1.pod.in   | 2 +-
 docs/man/xl.conf.5.pod | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index 0354d3beba..e206039d99 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -50,7 +50,7 @@ setup the bridge.
 
 If you specify the amount of memory dom0 has, passing B<dom0_mem> to
 Xen, it is highly recommended to disable B<autoballoon>. Edit
-B</etc/xen/xl.conf> and set it to 0.
+B<@XEN_CONFIG_DIR@/xl.conf> and set it to 0.
 
 =item run xl as B<root>
 
diff --git a/docs/man/xl.conf.5.pod b/docs/man/xl.conf.5.pod
index 41ee428744..dfea9d64ba 100644
--- a/docs/man/xl.conf.5.pod
+++ b/docs/man/xl.conf.5.pod
@@ -1,6 +1,6 @@
 =head1 NAME
 
-/etc/xen/xl.conf - XL Global/Host Configuration 
+@XEN_CONFIG_DIR@/xl.conf - XL Global/Host Configuration
 
 =head1 DESCRIPTION
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Feb 08 16:33:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Feb 2021 16:33:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82966.153532 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l99Ta-0005nA-Qf; Mon, 08 Feb 2021 16:33:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82966.153532; Mon, 08 Feb 2021 16:33:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l99Ta-0005n2-NB; Mon, 08 Feb 2021 16:33:26 +0000
Received: by outflank-mailman (input) for mailman id 82966;
 Mon, 08 Feb 2021 16:33:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l99TZ-0005mv-PF
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 16:33:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l99TZ-00086T-OU
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 16:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l99TZ-0000L6-NY
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 16:33:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6gyRxgpNtj93ynTc+zn4YsPUxJ7AWYll636o0tFU0m8=; b=R/vUvBI/3h0cto3I81ARAzskiA
	WLDNySC63YGW+D/5X4X/Iltle07KRcGyNZ96z/AFfKgPGXVyrXjzECTr1sMiMavgdkd+O3AkQraFo
	Un5ndoPijoufdxaPuU1AJOqwOhMPHUGHdCG1Pcn0QsZLsC0XjPtScaZVHBUFjKQ029Z4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Update .gitignore for some docs files
Message-Id: <E1l99TZ-0000L6-NY@xenbits.xenproject.org>
Date: Mon, 08 Feb 2021 16:33:25 +0000

commit 12e459742544fa0ef3260ec1cda7ea6fe2cd53bd
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Mon Feb 8 16:07:32 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Feb 8 16:08:10 2021 +0000

    Update .gitignore for some docs files
    
    [ split out of a larger commit -iwj ]
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 .gitignore | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.gitignore b/.gitignore
index 9e0488e0cd..1c2fa1530b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,7 +48,10 @@ dist/*
 docs/tmp.*
 docs/html/
 docs/man/xl.cfg.5.pod
+docs/man/xl-disk-configuration.5.pod
+docs/man/xl-network-configuration.5.pod
 docs/man/xl.1.pod
+docs/man/xl.conf.5.pod
 docs/man1/
 docs/man5/
 docs/man7/
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Feb 08 16:33:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Feb 2021 16:33:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82967.153535 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l99Tk-0005oK-SB; Mon, 08 Feb 2021 16:33:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82967.153535; Mon, 08 Feb 2021 16:33:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l99Tk-0005oD-Ox; Mon, 08 Feb 2021 16:33:36 +0000
Received: by outflank-mailman (input) for mailman id 82967;
 Mon, 08 Feb 2021 16: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 1l99Tj-0005o4-V3
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 16: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 1l99Tj-00086d-TF
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 16:33:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l99Tj-0000Lo-Qm
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 16:33:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7P5X0MzHf8dsfjKcTGYhNQhceOM2GadD+yYwFOmhzMA=; b=1xPb+6jfTLQMK9udY2QQm7Tfu2
	E9BSxsz7DQR5jesi20/yczotEAJSeHcPuxdckEqki/GYrosQ5qz1of2BhUDN8y6vGDuuMV/yIIztF
	R8IXxoIqOHsFdixnkCTQkDSK3rVQpfuB//giRH59H0lNrVdKFU5HQSjVhBq8T/3JDEQQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Use XEN_SCRIPT_DIR to refer to /etc/xen/scripts
Message-Id: <E1l99Tj-0000Lo-Qm@xenbits.xenproject.org>
Date: Mon, 08 Feb 2021 16:33:35 +0000

commit 53c8785b63a777902563394a93428030cbecf943
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Mon Jan 11 18:41:51 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Feb 8 16:22:00 2021 +0000

    Use XEN_SCRIPT_DIR to refer to /etc/xen/scripts
    
    Replace all hardcoded paths to use XEN_SCRIPT_DIR to expand the actual
    location.
    
    [ .gitignore change split out -iwj ]
    [ dropped erroneous hunk for docs/misc/block-scripts.txt iwj ]
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 docs/configure.ac                          |   3 +
 docs/man/xl-disk-configuration.5.pod       | 529 -----------------------------
 docs/man/xl-disk-configuration.5.pod.in    | 529 +++++++++++++++++++++++++++++
 docs/man/xl-network-configuration.5.pod    | 260 --------------
 docs/man/xl-network-configuration.5.pod.in | 260 ++++++++++++++
 docs/man/xl.1.pod.in                       |   2 +-
 docs/man/xl.conf.5.pod                     | 229 -------------
 docs/man/xl.conf.5.pod.in                  | 229 +++++++++++++
 tools/xl/xl_cmdtable.c                     |   2 +-
 9 files changed, 1023 insertions(+), 1020 deletions(-)

diff --git a/docs/configure.ac b/docs/configure.ac
index cb5a6eaa4c..c2e5edd3b3 100644
--- a/docs/configure.ac
+++ b/docs/configure.ac
@@ -9,6 +9,9 @@ AC_CONFIG_FILES([
 ../config/Docs.mk
 man/xl.cfg.5.pod
 man/xl.1.pod
+man/xl-disk-configuration.5.pod
+man/xl-network-configuration.5.pod
+man/xl.conf.5.pod
 ])
 AC_CONFIG_AUX_DIR([../])
 
diff --git a/docs/man/xl-disk-configuration.5.pod b/docs/man/xl-disk-configuration.5.pod
deleted file mode 100644
index 46feedb95e..0000000000
--- a/docs/man/xl-disk-configuration.5.pod
+++ /dev/null
@@ -1,529 +0,0 @@
-=head1 NAME
-
-xl-disk-configuration - XL Disk Configuration Syntax
-
-=head1 SYNTAX
-
-This document specifies the xl config file format disk configuration
-option.  It has the following form:
-
-   disk = [ 'DISKSPEC', 'DISKSPEC', ... ]
-
-where each C<DISKSPEC> is in this form:
-
-   [<key>=<value>|<flag>,]*,
-     [<target>, [<format>, [<vdev>, [<access>]]]],
-     [<key>=<value>|<flag>,]*
-     [target=<target>]
-
-For example, these strings are equivalent:
-
-    /dev/vg/guest-volume,,hda
-    /dev/vg/guest-volume,raw,hda,rw
-    format=raw, vdev=hda, access=rw, target=/dev/vg/guest-volume
-    raw:/dev/vg/guest-volume,hda,w  (deprecated, see below)
-
-As are these:
-
-    /root/image.iso,,hdc,cdrom
-    /root/image.iso,,hdc,,cdrom
-    /root/image.iso,raw,hdc,devtype=cdrom
-    format=raw, vdev=hdc, access=ro, devtype=cdrom, target=/root/image.iso
-    raw:/root/image.iso,hdc:cdrom,ro   (deprecated, see below)
-
-These might be specified in the domain config file like this:
-
-    disk = [ '/dev/vg/guest-volume,,hda', '/root/image.iso,,hdc,cdrom' ]
-
-
-More formally, the string is a series of comma-separated keyword/value
-pairs, flags and positional parameters.  Parameters which are not bare
-keywords and which do not contain "=" symbols are assigned to the
-so-far-unspecified positional parameters, in the order below.  The
-positional parameters may also be specified explicitly by name.
-
-Each parameter may be specified at most once, either as a positional
-parameter or a named parameter.  Default values apply if the parameter
-is not specified, or if it is specified with an empty value (whether
-positionally or explicitly).
-
-Whitespace may appear before each parameter and will be ignored.
-
-=head1 Positional Parameters
-
-=over 4
-
-=item B<target>
-
-=over 4
-
-=item Description
-
-Block device or image file path.  When this is used as a path, F</dev>
-will be prepended if the path doesn't start with a '/'.
-
-=item Supported values
-
-N/A
-
-=item Deprecated values
-
-N/A
-
-=item Default value
-
-None.  While a path is provided in most cases there is an exception:
-for a cdrom device, lack of this attribute would imply an empty cdrom
-drive.
-
-=item Special syntax
-
-When this parameter is specified by name, ie with the C<target=>
-syntax in the configuration file, it consumes the whole rest of the
-C<DISKSPEC> including trailing whitespaces.  Therefore in that case
-it must come last.  This is permissible even if an empty value for
-the target was already specified as a positional parameter.  This
-is the only way to specify a target string containing metacharacters
-such as commas and (in some cases) colons, which would otherwise be
-misinterpreted.
-
-Future parameter and flag names will start with an ascii letter and
-contain only ascii alphanumerics, hyphens and underscores, and will
-not be legal as vdevs.  Targets which might match that syntax
-should not be specified as positional parameters.
-
-=back
-
-=item B<format>
-
-=over 4
-
-=item Description
-
-Specifies the format of image file.
-
-=item Supported values
-
-raw, qcow, qcow2, vhd, qed
-
-=item Deprecated values
-
-None
-
-=item Default value
-
-raw
-
-=back
-
-=item B<vdev>
-
-=over 4
-
-=item Description
-
-Virtual device as seen by the guest (also referred to as guest drive
-designation in some specifications).  See L<xen-vbd-interface(7)>.
-
-=item Supported values
-
-hd[x], xvd[x], sd[x] etc.  Please refer to the above specification for
-further details.
-
-=item Deprecated values
-
-None
-
-=item Default Value
-
-None, this parameter is mandatory.
-
-=back
-
-=item B<access>
-
-=over 4
-
-=item Description
-
-Specified access control information.  Whether or not the block device is
-provided to the guest in read-only or read-write mode depends on this
-attribute.
-
-=item Supported values
-
-C<ro>, C<r>   (specifies read-only)
-
-C<rw>, C<w>   (specifies read/write)
-
-=item Deprecated values
-
-None
-
-=item Default value
-
-C<rw> unless devtype=cdrom, in which case C<r>
-
-=back
-
-=back
-
-=head1 Other Parameters And Flags
-
-=over 4
-
-=item B<devtype>=I<DEVTYPE>
-
-=over 4
-
-=item Description
-
-Qualifies virtual device type.
-
-=item Supported values
-
-cdrom
-
-=item Deprecated values
-
-None
-
-=item Mandatory
-
-No
-
-=back
-
-=item B<cdrom>
-
-Convenience alias for "devtype=cdrom".
-
-
-=item B<backend>=I<DOMAIN-NAME>
-
-=over 4
-
-=item Description
-
-Designates a backend domain for the device
-
-=item Supported values
-
-Valid domain names
-
-=item Mandatory
-
-No
-
-=back
-
-Specifies the backend domain which this device should attach to. This
-defaults to domain 0. Specifying another domain requires setting up a
-driver domain which is outside the scope of this document.
-
-
-=item B<backendtype>=I<TYPE>
-
-=over 4
-
-=item Description
-
-Specifies the backend implementation to use
-
-=item Supported values
-
-phy, qdisk
-
-=item Mandatory
-
-No
-
-=item Default value
-
-Automatically determine which backend to use.
-
-=back
-
-This does not affect the guest's view of the device.  It controls
-which software implementation of the Xen backend driver is used.
-
-Not all backend drivers support all combinations of other options.
-For example, "phy" does not support formats other than "raw".
-Normally this option should not be specified, in which case libxl will
-automatically determine the most suitable backend.
-
-
-=item B<script>=I<SCRIPT>
-
-Specifies that B<target> is not a normal host path, but rather
-information to be interpreted by the executable program I<SCRIPT>,
-(looked for in F</etc/xen/scripts>, if it doesn't contain a slash).
-
-These scripts are normally called "block-I<SCRIPT>".
-
-
-=item B<direct-io-safe>
-
-=over 4
-
-=item Description
-
-Disables non-O_DIRECT workaround
-
-=item Supported values
-
-absent, present
-
-=item Mandatory
-
-No
-
-=item Default value
-
-absent (workaround may be enabled)
-
-=back
-
-There is a memory lifetime bug in some driver domain (dom0) kernels
-which can cause crashes when using O_DIRECT.  The bug occurs due to a
-mismatch between the backend-visible lifetime of pages used for the
-Xen PV network protocol and that expected by the backend kernel's
-networking subsystem.  This can cause crashes when using certain
-backends with certain underlying storage.
-
-See:
- L<https://lists.xenproject.org/archives/html/xen-devel/2012-12/msg01154.html>
-
-For this reason, (this version of) the Xen libxl toolstack disables
-O_DIRECT when using the qemu-based Xen PV backend (C<qdisk>).
-
-However, this workaround has performance and scaling implications, and
-it is only necessary if the underlying device is a network filesystem.
-If the underlying device is not, then it is good to disable it; that
-is what this option is for.
-
-This option simply requests that the workaround be disabled.  (However,
-not all backends versions which use the workaround understand this
-option, so this is on a best effort basis.)
-
-It's important to note that if you are storing the VM disk on a
-network filesystem or a network block device (NFS or ISCSI) it might
-not be safe to use this option.  Otherwise specifying it is safe and
-can give better performances.
-
-If in the future the bug is fixed properly this option will then be
-silently ignored.
-
-
-=item B<discard> / B<no-discard>
-
-=over 4
-
-=item Description
-
-Request that backend advertise discard support to frontend
-
-=item Supported values
-
-discard, no-discard
-
-=item Mandatory
-
-No
-
-=item Default value
-
-discard
-
-=back
-
-An advisory setting for the backend driver, specifying whether to
-advertise discard support (TRIM, UNMAP) to the frontend.  The real
-benefit of this option is to be able to force it off rather than on.  It
-can be used to disable "hole punching" for file based backends which
-were intentionally created non-sparse to avoid fragmentation of the
-file.
-
-=back
-
-
-=head1 COLO Parameters
-
-=over 4
-
-=item B<colo>
-
-Enable COLO HA for disk. For better understanding block replication on
-QEMU, please refer to: L<https://wiki.qemu.org/Features/BlockReplication>
-Note that the COLO configuration settings should be considered unstable.
-They may change incompatibly in future versions of Xen.
-
-
-=item B<colo-host>
-
-=over 4
-
-=item Description
-
-Secondary host's address
-
-=item Mandatory
-
-Yes when COLO enabled
-
-=back
-
-=item B<colo-port>
-
-=over 4
-
-=item Description
-
-Secondary port.  We will run a nbd server on secondary host,
-and the nbd server will listen this port.
-
-=item Mandatory
-
-Yes when COLO enabled
-
-=back
-
-=item B<colo-export>
-
-=over 4
-
-=item Description
-
-We will run a nbd server on secondary host, exportname is
-the nbd server's disk export name.
-
-=item Mandatory
-
-Yes when COLO enabled
-
-=back
-
-=item B<active-disk>
-
-=over 4
-
-=item Description
-
-This is used by secondary. Secondary guest's write will be buffered in this
-disk.
-
-=item Mandatory
-
-Yes when COLO enabled
-
-=back
-
-=item B<hidden-disk>
-
-=over 4
-
-=item Description
-
-This is used by secondary. It buffers the original content that is modified
-by the primary VM.
-
-=item Mandatory
-
-Yes when COLO enabled
-
-=back
-
-=back
-
-
-=head1 Deprecated Parameters, Prefixes And Syntaxes
-
-Deprecated forms are acceptable and are intended work compatibly with
-xend and xl from xen 4.1.  In future they may print a warning.
-Support for deprecated parameters and syntaxes are likely to be
-dropped in future versions of xl.
-
-There is support for a deprecated old syntax for C<DISKSPEC>:
-
-  [<format>:][<target>],<vdev>[:<devtype>],<access>   (deprecated)
-
-This syntax also supports deprecated prefixes, described below.  These
-are found prepended to the format parameter - eg C<tap:aio:qcow:>.
-
-=over 4
-
-=item B<format>
-
-=over 4
-
-=item Description
-
-Specifies the format (deprecated)
-
-=item Supported values
-
-raw:  qcow2:  vhd:
-
-=back
-
-In xend and old versions of libxl it was necessary to specify the
-format with a prefix.  For compatibility, these three prefixes are
-recognised as specifying the corresponding format.  They are
-equivalent to C<format=FORMAT> or the specification of B<format>
-(without a colon) as a positional parameter.
-
-
-=item B<script>
-
-=over 4
-
-=item Description
-
-Specifies the script (deprecated)
-
-=item Supported values
-
-iscsi:  nbd:  enbd:  drbd:
-
-=back
-
-In xend and old versions of libxl it was necessary to specify the
-"script" (see above) with a prefix.  For compatibility, these four
-prefixes are recognised as specifying the corresponding script.  They
-are equivalent to C<script=block-SCRIPT>.
-
-
-=item B<deprecated-prefix>
-
-=over 4
-
-=item Description
-
-Deprecated prefix, ignored
-
-=item Supported values
-
-tapdisk:  tap2:  aio:  ioemu:  file:  phy:
-
-=back
-
-Various prefixes were required by xend and older versions of libxl to
-make the block devices work.  In some cases these options would
-override the backend type, but in other cases they would be ignored in
-favour of "making it work"; in yet other cases it would be necessary
-to specify several of these, for example:
-
-  tap:aio:/some/path...
-
-All of these prefixes are now stripped and ignored.
-
-=back
-
-=head2 Missing format and empty target
-
-The following syntax is also supported:
-
-  ,<vdev>:<devtype>,<access>   (deprecated)
-
-This is solely for compatibility with xend's syntax for empty cdroms,
-which is (for example) C<,hdc:cdrom,r>.
diff --git a/docs/man/xl-disk-configuration.5.pod.in b/docs/man/xl-disk-configuration.5.pod.in
new file mode 100644
index 0000000000..71d0e86e3d
--- /dev/null
+++ b/docs/man/xl-disk-configuration.5.pod.in
@@ -0,0 +1,529 @@
+=head1 NAME
+
+xl-disk-configuration - XL Disk Configuration Syntax
+
+=head1 SYNTAX
+
+This document specifies the xl config file format disk configuration
+option.  It has the following form:
+
+   disk = [ 'DISKSPEC', 'DISKSPEC', ... ]
+
+where each C<DISKSPEC> is in this form:
+
+   [<key>=<value>|<flag>,]*,
+     [<target>, [<format>, [<vdev>, [<access>]]]],
+     [<key>=<value>|<flag>,]*
+     [target=<target>]
+
+For example, these strings are equivalent:
+
+    /dev/vg/guest-volume,,hda
+    /dev/vg/guest-volume,raw,hda,rw
+    format=raw, vdev=hda, access=rw, target=/dev/vg/guest-volume
+    raw:/dev/vg/guest-volume,hda,w  (deprecated, see below)
+
+As are these:
+
+    /root/image.iso,,hdc,cdrom
+    /root/image.iso,,hdc,,cdrom
+    /root/image.iso,raw,hdc,devtype=cdrom
+    format=raw, vdev=hdc, access=ro, devtype=cdrom, target=/root/image.iso
+    raw:/root/image.iso,hdc:cdrom,ro   (deprecated, see below)
+
+These might be specified in the domain config file like this:
+
+    disk = [ '/dev/vg/guest-volume,,hda', '/root/image.iso,,hdc,cdrom' ]
+
+
+More formally, the string is a series of comma-separated keyword/value
+pairs, flags and positional parameters.  Parameters which are not bare
+keywords and which do not contain "=" symbols are assigned to the
+so-far-unspecified positional parameters, in the order below.  The
+positional parameters may also be specified explicitly by name.
+
+Each parameter may be specified at most once, either as a positional
+parameter or a named parameter.  Default values apply if the parameter
+is not specified, or if it is specified with an empty value (whether
+positionally or explicitly).
+
+Whitespace may appear before each parameter and will be ignored.
+
+=head1 Positional Parameters
+
+=over 4
+
+=item B<target>
+
+=over 4
+
+=item Description
+
+Block device or image file path.  When this is used as a path, F</dev>
+will be prepended if the path doesn't start with a '/'.
+
+=item Supported values
+
+N/A
+
+=item Deprecated values
+
+N/A
+
+=item Default value
+
+None.  While a path is provided in most cases there is an exception:
+for a cdrom device, lack of this attribute would imply an empty cdrom
+drive.
+
+=item Special syntax
+
+When this parameter is specified by name, ie with the C<target=>
+syntax in the configuration file, it consumes the whole rest of the
+C<DISKSPEC> including trailing whitespaces.  Therefore in that case
+it must come last.  This is permissible even if an empty value for
+the target was already specified as a positional parameter.  This
+is the only way to specify a target string containing metacharacters
+such as commas and (in some cases) colons, which would otherwise be
+misinterpreted.
+
+Future parameter and flag names will start with an ascii letter and
+contain only ascii alphanumerics, hyphens and underscores, and will
+not be legal as vdevs.  Targets which might match that syntax
+should not be specified as positional parameters.
+
+=back
+
+=item B<format>
+
+=over 4
+
+=item Description
+
+Specifies the format of image file.
+
+=item Supported values
+
+raw, qcow, qcow2, vhd, qed
+
+=item Deprecated values
+
+None
+
+=item Default value
+
+raw
+
+=back
+
+=item B<vdev>
+
+=over 4
+
+=item Description
+
+Virtual device as seen by the guest (also referred to as guest drive
+designation in some specifications).  See L<xen-vbd-interface(7)>.
+
+=item Supported values
+
+hd[x], xvd[x], sd[x] etc.  Please refer to the above specification for
+further details.
+
+=item Deprecated values
+
+None
+
+=item Default Value
+
+None, this parameter is mandatory.
+
+=back
+
+=item B<access>
+
+=over 4
+
+=item Description
+
+Specified access control information.  Whether or not the block device is
+provided to the guest in read-only or read-write mode depends on this
+attribute.
+
+=item Supported values
+
+C<ro>, C<r>   (specifies read-only)
+
+C<rw>, C<w>   (specifies read/write)
+
+=item Deprecated values
+
+None
+
+=item Default value
+
+C<rw> unless devtype=cdrom, in which case C<r>
+
+=back
+
+=back
+
+=head1 Other Parameters And Flags
+
+=over 4
+
+=item B<devtype>=I<DEVTYPE>
+
+=over 4
+
+=item Description
+
+Qualifies virtual device type.
+
+=item Supported values
+
+cdrom
+
+=item Deprecated values
+
+None
+
+=item Mandatory
+
+No
+
+=back
+
+=item B<cdrom>
+
+Convenience alias for "devtype=cdrom".
+
+
+=item B<backend>=I<DOMAIN-NAME>
+
+=over 4
+
+=item Description
+
+Designates a backend domain for the device
+
+=item Supported values
+
+Valid domain names
+
+=item Mandatory
+
+No
+
+=back
+
+Specifies the backend domain which this device should attach to. This
+defaults to domain 0. Specifying another domain requires setting up a
+driver domain which is outside the scope of this document.
+
+
+=item B<backendtype>=I<TYPE>
+
+=over 4
+
+=item Description
+
+Specifies the backend implementation to use
+
+=item Supported values
+
+phy, qdisk
+
+=item Mandatory
+
+No
+
+=item Default value
+
+Automatically determine which backend to use.
+
+=back
+
+This does not affect the guest's view of the device.  It controls
+which software implementation of the Xen backend driver is used.
+
+Not all backend drivers support all combinations of other options.
+For example, "phy" does not support formats other than "raw".
+Normally this option should not be specified, in which case libxl will
+automatically determine the most suitable backend.
+
+
+=item B<script>=I<SCRIPT>
+
+Specifies that B<target> is not a normal host path, but rather
+information to be interpreted by the executable program I<SCRIPT>,
+(looked for in F<@XEN_SCRIPT_DIR@>, if it doesn't contain a slash).
+
+These scripts are normally called "block-I<SCRIPT>".
+
+
+=item B<direct-io-safe>
+
+=over 4
+
+=item Description
+
+Disables non-O_DIRECT workaround
+
+=item Supported values
+
+absent, present
+
+=item Mandatory
+
+No
+
+=item Default value
+
+absent (workaround may be enabled)
+
+=back
+
+There is a memory lifetime bug in some driver domain (dom0) kernels
+which can cause crashes when using O_DIRECT.  The bug occurs due to a
+mismatch between the backend-visible lifetime of pages used for the
+Xen PV network protocol and that expected by the backend kernel's
+networking subsystem.  This can cause crashes when using certain
+backends with certain underlying storage.
+
+See:
+ L<https://lists.xenproject.org/archives/html/xen-devel/2012-12/msg01154.html>
+
+For this reason, (this version of) the Xen libxl toolstack disables
+O_DIRECT when using the qemu-based Xen PV backend (C<qdisk>).
+
+However, this workaround has performance and scaling implications, and
+it is only necessary if the underlying device is a network filesystem.
+If the underlying device is not, then it is good to disable it; that
+is what this option is for.
+
+This option simply requests that the workaround be disabled.  (However,
+not all backends versions which use the workaround understand this
+option, so this is on a best effort basis.)
+
+It's important to note that if you are storing the VM disk on a
+network filesystem or a network block device (NFS or ISCSI) it might
+not be safe to use this option.  Otherwise specifying it is safe and
+can give better performances.
+
+If in the future the bug is fixed properly this option will then be
+silently ignored.
+
+
+=item B<discard> / B<no-discard>
+
+=over 4
+
+=item Description
+
+Request that backend advertise discard support to frontend
+
+=item Supported values
+
+discard, no-discard
+
+=item Mandatory
+
+No
+
+=item Default value
+
+discard
+
+=back
+
+An advisory setting for the backend driver, specifying whether to
+advertise discard support (TRIM, UNMAP) to the frontend.  The real
+benefit of this option is to be able to force it off rather than on.  It
+can be used to disable "hole punching" for file based backends which
+were intentionally created non-sparse to avoid fragmentation of the
+file.
+
+=back
+
+
+=head1 COLO Parameters
+
+=over 4
+
+=item B<colo>
+
+Enable COLO HA for disk. For better understanding block replication on
+QEMU, please refer to: L<https://wiki.qemu.org/Features/BlockReplication>
+Note that the COLO configuration settings should be considered unstable.
+They may change incompatibly in future versions of Xen.
+
+
+=item B<colo-host>
+
+=over 4
+
+=item Description
+
+Secondary host's address
+
+=item Mandatory
+
+Yes when COLO enabled
+
+=back
+
+=item B<colo-port>
+
+=over 4
+
+=item Description
+
+Secondary port.  We will run a nbd server on secondary host,
+and the nbd server will listen this port.
+
+=item Mandatory
+
+Yes when COLO enabled
+
+=back
+
+=item B<colo-export>
+
+=over 4
+
+=item Description
+
+We will run a nbd server on secondary host, exportname is
+the nbd server's disk export name.
+
+=item Mandatory
+
+Yes when COLO enabled
+
+=back
+
+=item B<active-disk>
+
+=over 4
+
+=item Description
+
+This is used by secondary. Secondary guest's write will be buffered in this
+disk.
+
+=item Mandatory
+
+Yes when COLO enabled
+
+=back
+
+=item B<hidden-disk>
+
+=over 4
+
+=item Description
+
+This is used by secondary. It buffers the original content that is modified
+by the primary VM.
+
+=item Mandatory
+
+Yes when COLO enabled
+
+=back
+
+=back
+
+
+=head1 Deprecated Parameters, Prefixes And Syntaxes
+
+Deprecated forms are acceptable and are intended work compatibly with
+xend and xl from xen 4.1.  In future they may print a warning.
+Support for deprecated parameters and syntaxes are likely to be
+dropped in future versions of xl.
+
+There is support for a deprecated old syntax for C<DISKSPEC>:
+
+  [<format>:][<target>],<vdev>[:<devtype>],<access>   (deprecated)
+
+This syntax also supports deprecated prefixes, described below.  These
+are found prepended to the format parameter - eg C<tap:aio:qcow:>.
+
+=over 4
+
+=item B<format>
+
+=over 4
+
+=item Description
+
+Specifies the format (deprecated)
+
+=item Supported values
+
+raw:  qcow2:  vhd:
+
+=back
+
+In xend and old versions of libxl it was necessary to specify the
+format with a prefix.  For compatibility, these three prefixes are
+recognised as specifying the corresponding format.  They are
+equivalent to C<format=FORMAT> or the specification of B<format>
+(without a colon) as a positional parameter.
+
+
+=item B<script>
+
+=over 4
+
+=item Description
+
+Specifies the script (deprecated)
+
+=item Supported values
+
+iscsi:  nbd:  enbd:  drbd:
+
+=back
+
+In xend and old versions of libxl it was necessary to specify the
+"script" (see above) with a prefix.  For compatibility, these four
+prefixes are recognised as specifying the corresponding script.  They
+are equivalent to C<script=block-SCRIPT>.
+
+
+=item B<deprecated-prefix>
+
+=over 4
+
+=item Description
+
+Deprecated prefix, ignored
+
+=item Supported values
+
+tapdisk:  tap2:  aio:  ioemu:  file:  phy:
+
+=back
+
+Various prefixes were required by xend and older versions of libxl to
+make the block devices work.  In some cases these options would
+override the backend type, but in other cases they would be ignored in
+favour of "making it work"; in yet other cases it would be necessary
+to specify several of these, for example:
+
+  tap:aio:/some/path...
+
+All of these prefixes are now stripped and ignored.
+
+=back
+
+=head2 Missing format and empty target
+
+The following syntax is also supported:
+
+  ,<vdev>:<devtype>,<access>   (deprecated)
+
+This is solely for compatibility with xend's syntax for empty cdroms,
+which is (for example) C<,hdc:cdrom,r>.
diff --git a/docs/man/xl-network-configuration.5.pod b/docs/man/xl-network-configuration.5.pod
deleted file mode 100644
index 8e5fd909fa..0000000000
--- a/docs/man/xl-network-configuration.5.pod
+++ /dev/null
@@ -1,260 +0,0 @@
-=encoding utf8
-
-=head1 NAME
-
-xl-network-configuration - XL Network Configuration Syntax
-
-
-=head1 SYNTAX
-
-This document specifies the xl config file format vif configuration
-option.  It has the following form:
-
-        vif = [ '<vifspec>', '<vifspec>', ... ]
-
-where each vifspec is in this form:
-
-        [<key>=<value>|<flag>,]
-
-For example:
-
-        'mac=00:16:3E:74:3d:76,model=rtl8139,bridge=xenbr0'
-        'mac=00:16:3E:74:34:32'
-        '' # The empty string
-
-These might be specified in the domain config file like this:
-
-        vif = [ 'mac=00:16:3E:74:34:32', 'mac=00:16:3e:5f:48:e4,bridge=xenbr1' ]
-
-More formally, the string is a series of comma-separated keyword/value
-pairs. All keywords are optional.
-
-Each device has a C<DEVID> which is its index within the vif list, starting from 0.
-
-
-=head1 Keywords
-
-
-=head2 mac
-
-If specified then this option specifies the MAC address inside the
-guest of this VIF device. The value is a 48-bit number represented as
-six groups of two hexadecimal digits, separated by colons (:).
-
-The default if this keyword is not specified is to be automatically
-generate a MAC address inside the space assigned to Xen's
-L<Organizationally Unique Identifier|https://en.wikipedia.org/wiki/Organizationally_Unique_Identifier> (00:16:3e).
-
-If you are choosing a MAC address then it is strongly recommend to
-follow one of the following strategies:
-
-=over
-
-=item *
-
-Generate a random sequence of 6 byte, set the locally administered
-bit (bit 2 of the first byte) and clear the multicast bit (bit 1
-of the first byte). In other words the first byte should have the
-bit pattern xxxxxx10 (where x is a randomly generated bit) and the
-remaining 5 bytes are randomly generated See
-[https://en.wikipedia.org/wiki/MAC_address] for more details the
-structure of a MAC address.
-
-
-=item *
-
-Allocate an address from within the space defined by your
-organization's OUI (if you have one) following your organization's
-procedures for doing so.
-
-
-=item *
-
-Allocate an address from within the space defined by Xen's OUI
-(00:16:3e). Taking care not to clash with other users of the
-physical network segment where this VIF will reside.
-
-
-=back
-
-If you have an OUI for your own use then that is the preferred
-strategy. Otherwise in general you should prefer to generate a random
-MAC and set the locally administered bit since this allows for more
-bits of randomness than using the Xen OUI.
-
-
-=head2 bridge
-
-Specifies the name of the network bridge which this VIF should be
-added to. The default is C<xenbr0>. The bridge must be configured using
-your distribution's network configuration tools. See the L<wiki|https://wiki.xenproject.org/wiki/Network_Configuration_Examples_(Xen_4.1%2B)>
-for guidance and examples.
-
-
-=head2 gatewaydev
-
-Specifies the name of the network interface which has an IP and which
-is in the network the VIF should communicate with. This is used in the host
-by the vif-route hotplug script. See L<wiki|https://wiki.xenproject.org/wiki/Vif-route> for guidance and
-examples.
-
-NOTE: netdev is a deprecated alias of this option.
-
-
-=head2 type
-
-This keyword is valid for HVM guests only.
-
-Specifies the type of device to valid values are:
-
-=over
-
-=item *
-
-C<ioemu> (default) -- this device will be provided as an emulate
-device to the guest and also as a paravirtualised device which the
-guest may choose to use instead if it has suitable drivers
-available.
-
-
-=item *
-
-C<vif> -- this device will be provided as a paravirtualised device
-only.
-
-
-=back
-
-
-=head2 model
-
-This keyword is valid for HVM guest devices with C<type=ioemu> only.
-
-Specifies the type device to emulated for this guest. Valid values
-are:
-
-=over
-
-=item *
-
-C<rtl8139> (default) -- Realtek RTL8139
-
-
-=item *
-
-C<e1000> -- Intel E1000
-
-
-=item *
-
-in principle any device supported by your device model
-
-
-=back
-
-
-=head2 vifname
-
-Specifies the backend device name for the virtual device.
-
-If the domain is an HVM domain then the associated emulated (tap)
-device will have a "-emu" suffice added.
-
-The default name for the virtual device is C<vifDOMID.DEVID> where
-C<DOMID> is the guest domain ID and C<DEVID> is the device
-number. Likewise the default tap name is C<vifDOMID.DEVID-emu>.
-
-
-=head2 script
-
-Specifies the hotplug script to run to configure this device (e.g. to
-add it to the relevant bridge). Defaults to
-C<XEN_SCRIPT_DIR/vif-bridge> but can be set to any script. Some example
-scripts are installed in C<XEN_SCRIPT_DIR>.
-
-Note on NetBSD HVM guests will ignore the script option for tap
-(emulated) interfaces and always use
-C<XEN_SCRIPT_DIR/qemu-ifup> to configure the interface in bridged mode.
-
-=head2 ip
-
-Specifies the IP address for the device, the default is not to
-specify an IP address.
-
-What, if any, effect this has depends on the hotplug script which is
-configured. A typically behaviour (exhibited by the example hotplug
-scripts) if set might be to configure firewall rules to allow only the
-specified IP address to be used by the guest (blocking all others).
-
-
-=head2 backend
-
-Specifies the backend domain which this device should attach to. This
-defaults to domain 0.  Specifying another domain requires setting up a
-driver domain which is outside the scope of this document.
-
-
-=head2 rate
-
-Specifies the rate at which the outgoing traffic will be limited to.
-The default if this keyword is not specified is unlimited.
-
-The rate may be specified as "/s" or optionally "/s@".
-
-=over
-
-=item *
-
-C<RATE> is in bytes and can accept suffixes:
-
-=over
-
-=item *
-
-GB, MB, KB, B for bytes.
-
-
-=item *
-
-Gb, Mb, Kb, b for bits.
-
-
-=back
-
-
-
-=item *
-
-C<INTERVAL> is in microseconds and can accept suffixes: ms, us, s.
-It determines the frequency at which the vif transmission credit
-is replenished. The default is 50ms.
-
-
-=back
-
-Vif rate limiting is credit-based. It means that for "1MB/s@20ms", the
-available credit will be equivalent of the traffic you would have done
-at "1MB/s" during 20ms. This will results in a credit of 20,000 bytes
-replenished every 20,000 us.
-
-For example:
-
-        'rate=10Mb/s' -- meaning up to 10 megabits every second
-        'rate=250KB/s' -- meaning up to 250 kilobytes every second
-        'rate=1MB/s@20ms' -- meaning 20,000 bytes in every 20 millisecond period
-
-NOTE: The actual underlying limits of rate limiting are dependent
-on the underlying netback implementation.
-
-
-=head2 devid
-
-Specifies the devid manually instead of letting xl choose the lowest index available.
-
-NOTE: This should not be set unless you have a reason to.
-
-=head2 mtu
-
-Specifies the MTU (i.e. the maximum size of an IP payload, exclusing headers). The
-default value is 1500 but, if the VIF is attached to a bridge, it will be set to match
-unless overridden by this parameter.
diff --git a/docs/man/xl-network-configuration.5.pod.in b/docs/man/xl-network-configuration.5.pod.in
new file mode 100644
index 0000000000..cf92d7960c
--- /dev/null
+++ b/docs/man/xl-network-configuration.5.pod.in
@@ -0,0 +1,260 @@
+=encoding utf8
+
+=head1 NAME
+
+xl-network-configuration - XL Network Configuration Syntax
+
+
+=head1 SYNTAX
+
+This document specifies the xl config file format vif configuration
+option.  It has the following form:
+
+        vif = [ '<vifspec>', '<vifspec>', ... ]
+
+where each vifspec is in this form:
+
+        [<key>=<value>|<flag>,]
+
+For example:
+
+        'mac=00:16:3E:74:3d:76,model=rtl8139,bridge=xenbr0'
+        'mac=00:16:3E:74:34:32'
+        '' # The empty string
+
+These might be specified in the domain config file like this:
+
+        vif = [ 'mac=00:16:3E:74:34:32', 'mac=00:16:3e:5f:48:e4,bridge=xenbr1' ]
+
+More formally, the string is a series of comma-separated keyword/value
+pairs. All keywords are optional.
+
+Each device has a C<DEVID> which is its index within the vif list, starting from 0.
+
+
+=head1 Keywords
+
+
+=head2 mac
+
+If specified then this option specifies the MAC address inside the
+guest of this VIF device. The value is a 48-bit number represented as
+six groups of two hexadecimal digits, separated by colons (:).
+
+The default if this keyword is not specified is to be automatically
+generate a MAC address inside the space assigned to Xen's
+L<Organizationally Unique Identifier|https://en.wikipedia.org/wiki/Organizationally_Unique_Identifier> (00:16:3e).
+
+If you are choosing a MAC address then it is strongly recommend to
+follow one of the following strategies:
+
+=over
+
+=item *
+
+Generate a random sequence of 6 byte, set the locally administered
+bit (bit 2 of the first byte) and clear the multicast bit (bit 1
+of the first byte). In other words the first byte should have the
+bit pattern xxxxxx10 (where x is a randomly generated bit) and the
+remaining 5 bytes are randomly generated See
+[https://en.wikipedia.org/wiki/MAC_address] for more details the
+structure of a MAC address.
+
+
+=item *
+
+Allocate an address from within the space defined by your
+organization's OUI (if you have one) following your organization's
+procedures for doing so.
+
+
+=item *
+
+Allocate an address from within the space defined by Xen's OUI
+(00:16:3e). Taking care not to clash with other users of the
+physical network segment where this VIF will reside.
+
+
+=back
+
+If you have an OUI for your own use then that is the preferred
+strategy. Otherwise in general you should prefer to generate a random
+MAC and set the locally administered bit since this allows for more
+bits of randomness than using the Xen OUI.
+
+
+=head2 bridge
+
+Specifies the name of the network bridge which this VIF should be
+added to. The default is C<xenbr0>. The bridge must be configured using
+your distribution's network configuration tools. See the L<wiki|https://wiki.xenproject.org/wiki/Network_Configuration_Examples_(Xen_4.1%2B)>
+for guidance and examples.
+
+
+=head2 gatewaydev
+
+Specifies the name of the network interface which has an IP and which
+is in the network the VIF should communicate with. This is used in the host
+by the vif-route hotplug script. See L<wiki|https://wiki.xenproject.org/wiki/Vif-route> for guidance and
+examples.
+
+NOTE: netdev is a deprecated alias of this option.
+
+
+=head2 type
+
+This keyword is valid for HVM guests only.
+
+Specifies the type of device to valid values are:
+
+=over
+
+=item *
+
+C<ioemu> (default) -- this device will be provided as an emulate
+device to the guest and also as a paravirtualised device which the
+guest may choose to use instead if it has suitable drivers
+available.
+
+
+=item *
+
+C<vif> -- this device will be provided as a paravirtualised device
+only.
+
+
+=back
+
+
+=head2 model
+
+This keyword is valid for HVM guest devices with C<type=ioemu> only.
+
+Specifies the type device to emulated for this guest. Valid values
+are:
+
+=over
+
+=item *
+
+C<rtl8139> (default) -- Realtek RTL8139
+
+
+=item *
+
+C<e1000> -- Intel E1000
+
+
+=item *
+
+in principle any device supported by your device model
+
+
+=back
+
+
+=head2 vifname
+
+Specifies the backend device name for the virtual device.
+
+If the domain is an HVM domain then the associated emulated (tap)
+device will have a "-emu" suffice added.
+
+The default name for the virtual device is C<vifDOMID.DEVID> where
+C<DOMID> is the guest domain ID and C<DEVID> is the device
+number. Likewise the default tap name is C<vifDOMID.DEVID-emu>.
+
+
+=head2 script
+
+Specifies the hotplug script to run to configure this device (e.g. to
+add it to the relevant bridge). Defaults to
+C<@XEN_SCRIPT_DIR@/vif-bridge> but can be set to any script. Some example
+scripts are installed in C<@XEN_SCRIPT_DIR@>.
+
+Note on NetBSD HVM guests will ignore the script option for tap
+(emulated) interfaces and always use
+C<XEN_SCRIPT_DIR/qemu-ifup> to configure the interface in bridged mode.
+
+=head2 ip
+
+Specifies the IP address for the device, the default is not to
+specify an IP address.
+
+What, if any, effect this has depends on the hotplug script which is
+configured. A typically behaviour (exhibited by the example hotplug
+scripts) if set might be to configure firewall rules to allow only the
+specified IP address to be used by the guest (blocking all others).
+
+
+=head2 backend
+
+Specifies the backend domain which this device should attach to. This
+defaults to domain 0.  Specifying another domain requires setting up a
+driver domain which is outside the scope of this document.
+
+
+=head2 rate
+
+Specifies the rate at which the outgoing traffic will be limited to.
+The default if this keyword is not specified is unlimited.
+
+The rate may be specified as "/s" or optionally "/s@".
+
+=over
+
+=item *
+
+C<RATE> is in bytes and can accept suffixes:
+
+=over
+
+=item *
+
+GB, MB, KB, B for bytes.
+
+
+=item *
+
+Gb, Mb, Kb, b for bits.
+
+
+=back
+
+
+
+=item *
+
+C<INTERVAL> is in microseconds and can accept suffixes: ms, us, s.
+It determines the frequency at which the vif transmission credit
+is replenished. The default is 50ms.
+
+
+=back
+
+Vif rate limiting is credit-based. It means that for "1MB/s@20ms", the
+available credit will be equivalent of the traffic you would have done
+at "1MB/s" during 20ms. This will results in a credit of 20,000 bytes
+replenished every 20,000 us.
+
+For example:
+
+        'rate=10Mb/s' -- meaning up to 10 megabits every second
+        'rate=250KB/s' -- meaning up to 250 kilobytes every second
+        'rate=1MB/s@20ms' -- meaning 20,000 bytes in every 20 millisecond period
+
+NOTE: The actual underlying limits of rate limiting are dependent
+on the underlying netback implementation.
+
+
+=head2 devid
+
+Specifies the devid manually instead of letting xl choose the lowest index available.
+
+NOTE: This should not be set unless you have a reason to.
+
+=head2 mtu
+
+Specifies the MTU (i.e. the maximum size of an IP payload, exclusing headers). The
+default value is 1500 but, if the VIF is attached to a bridge, it will be set to match
+unless overridden by this parameter.
diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index e206039d99..618c195148 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -571,7 +571,7 @@ See the corresponding option of the I<create> subcommand.
 =item B<-N> I<netbufscript>
 
 Use <netbufscript> to setup network buffering instead of the
-default script (/etc/xen/scripts/remus-netbuf-setup).
+default script (@XEN_SCRIPT_DIR@/remus-netbuf-setup).
 
 =item B<-F>
 
diff --git a/docs/man/xl.conf.5.pod b/docs/man/xl.conf.5.pod
deleted file mode 100644
index dfea9d64ba..0000000000
--- a/docs/man/xl.conf.5.pod
+++ /dev/null
@@ -1,229 +0,0 @@
-=head1 NAME
-
-@XEN_CONFIG_DIR@/xl.conf - XL Global/Host Configuration
-
-=head1 DESCRIPTION
-
-The F<xl.conf> file allows configuration of hostwide C<xl> toolstack
-options.
-
-For details of per-domain configuration options please see
-L<xl.cfg(5)>.
-
-=head1 SYNTAX
-
-The config file consists of a series of C<KEY=VALUE> pairs.
-
-A value C<VALUE> is one of:
-
-=over 4
-
-=item B<"STRING">
-
-A string, surrounded by either single or double quotes.
-
-=item B<NUMBER>
-
-A number, in either decimal, octal (using a C<0> prefix) or
-hexadecimal (using an C<0x> prefix).
-
-=item B<BOOLEAN>
-
-A C<NUMBER> interpreted as C<False> (C<0>) or C<True> (any other
-value).
-
-=item B<[ VALUE, VALUE, ... ]>
-
-A list of C<VALUES> of the above types. Lists are homogeneous and are
-not nested.
-
-=back
-
-The semantics of each C<KEY> defines which form of C<VALUE> is required.
-
-=head1 OPTIONS
-
-=over 4
-
-=item B<domid_policy="xen"|"random">
-
-Determines how domain-id is set when creating a new domain.
-
-If set to "xen" then the hypervisor will allocate new domain-id values on a sequential basis.
-
-If set to "random" then a random domain-id value will be chosen.
-
-Default: "xen"
-
-=item B<autoballoon="off"|"on"|"auto">
-
-If set to "on" then C<xl> will automatically reduce the amount of
-memory assigned to domain 0 in order to free memory for new domains.
-
-If set to "off" then C<xl> will not automatically reduce the amount of
-domain 0 memory.
-
-If set to "auto" then auto-ballooning will be disabled if the
-C<dom0_mem> option was provided on the Xen command line.
-
-You are strongly recommended to set this to C<"off"> (or C<"auto">) if
-you use the C<dom0_mem> hypervisor command line to reduce the amount
-of memory given to domain 0 by default.
-
-Default: C<"auto">
-
-=item B<run_hotplug_scripts=BOOLEAN>
-
-If disabled hotplug scripts will be called from udev, as it used to
-be in the previous releases. With the default option, hotplug scripts
-will be launched by xl directly.
-
-Default: C<1>
-
-=item B<lockfile="PATH">
-
-Sets the path to the lock file used by xl to serialise certain
-operations (primarily domain creation).
-
-Default: C</var/lock/xl>
-
-=item B<max_grant_frames=NUMBER>
-
-Sets the default value for the C<max_grant_frames> domain config value.
-
-Default: value of Xen command line B<gnttab_max_frames> parameter (or its
-default value if unspecified).
-
-=item B<max_maptrack_frames=NUMBER>
-
-Sets the default value for the C<max_maptrack_frames> domain config value.
-
-Default: value of Xen command line B<gnttab_max_maptrack_frames>
-parameter (or its default value if unspecified).
-
-=item B<vif.default.script="PATH">
-
-Configures the default hotplug script used by virtual network devices.
-
-The old B<vifscript> option is deprecated and should not be used.
-
-Default: C</etc/xen/scripts/vif-bridge>
-
-=item B<vif.default.bridge="NAME">
-
-Configures the default bridge to set for virtual network devices.
-
-The old B<defaultbridge> option is deprecated and should not be used.
-
-Default: C<xenbr0>
-
-=item B<vif.default.backend="NAME">
-
-Configures the default backend to set for virtual network devices.
-
-Default: C<0>
-
-=item B<vif.default.gatewaydev="NAME">
-
-Configures the default gateway device to set for virtual network devices.
-
-Default: C<None>
-
-=item B<remus.default.netbufscript="PATH">
-
-Configures the default script used by Remus to setup network buffering.
-
-Default: C</etc/xen/scripts/remus-netbuf-setup>
-
-=item B<colo.default.proxyscript="PATH">
-
-Configures the default script used by COLO to setup colo-proxy.
-
-Default: C</etc/xen/scripts/colo-proxy-setup>
-
-=item B<output_format="json|sxp">
-
-Configures the default output format used by xl when printing "machine
-readable" information. The default is to use the C<JSON>
-L<https://www.json.org/> syntax. However for compatibility with the
-previous C<xm> toolstack this can be configured to use the old C<SXP>
-(S-Expression-like) syntax instead.
-
-Default: C<json>
-
-=item B<blkdev_start="NAME">
-
-Configures the name of the first block device to be used for temporary
-block device allocations by the toolstack.
-The default choice is "xvda".
-
-=item B<claim_mode=BOOLEAN>
-
-If this option is enabled then when a guest is created there will be an
-guarantee that there is memory available for the guest.
-The self-balloon mechanism can deflate/inflate the balloon
-quickly and the amount of free memory (which C<xl info> can show) is
-stale the moment it is printed. When claim is enabled a reservation for
-the amount of memory (see 'memory' in xl.conf(5)) is set, which is then
-reduced as the domain's memory is populated and eventually reaches zero.
-The free memory in C<xl info> is the combination of the hypervisor's
-free heap memory minus the outstanding claims value.
-
-If the reservation cannot be meet the guest creation fails immediately
-instead of taking seconds/minutes (depending on the size of the guest)
-while the guest is populated.
-
-Default: C<1>
-
-=over 4
-
-=item C<0>
-
-No claim is made. Memory population during guest creation will be
-attempted as normal and may fail due to memory exhaustion.
-
-=item C<1>
-
-Free memory as reported by the hypervisor is used for
-calculating whether there is enough memory free to launch a guest.
-This guarantees immediate feedback whether the guest can be launched due
-to memory exhaustion (which can take a long time to find out if launching
-massively huge guests).
-
-=back
-
-=item B<vm.cpumask>="CPULIST"
-
-=item B<vm.hvm.cpumask>="CPULIST"
-
-=item B<vm.pv.cpumask>="CPULIST"
-
-Global masks that are applied when creating guests and pinning vcpus
-to indicate which cpus they are allowed to run on.  Specifically,
-C<vm.cpumask> applies to all guest types, C<vm.hvm.cpumask> applies to
-both HVM and PVH guests and C<vm.pv.cpumask> applies to PV guests.
-
-The hard affinity of guest's vcpus are logical-AND'ed with respective
-masks. If the resulting affinity mask is empty, operation will fail.
-
-Use --ignore-global-affinity-masks to skip applying global masks.
-
-The default value for these masks are all 1's, i.e. all cpus are allowed.
-
-Due to bug(s), these options may not interact well with other options
-concerning CPU affinity. One example is CPU pools. Users should always double
-check that the required affinity has taken effect.
-
-=back
-
-=head1 SEE ALSO
-
-=over 4
-
-=item L<xl(1)>
-
-=item L<xl.cfg(5)>
-
-=item https://www.json.org/
-
-=back
diff --git a/docs/man/xl.conf.5.pod.in b/docs/man/xl.conf.5.pod.in
new file mode 100644
index 0000000000..b48e99131a
--- /dev/null
+++ b/docs/man/xl.conf.5.pod.in
@@ -0,0 +1,229 @@
+=head1 NAME
+
+@XEN_CONFIG_DIR@/xl.conf - XL Global/Host Configuration
+
+=head1 DESCRIPTION
+
+The F<xl.conf> file allows configuration of hostwide C<xl> toolstack
+options.
+
+For details of per-domain configuration options please see
+L<xl.cfg(5)>.
+
+=head1 SYNTAX
+
+The config file consists of a series of C<KEY=VALUE> pairs.
+
+A value C<VALUE> is one of:
+
+=over 4
+
+=item B<"STRING">
+
+A string, surrounded by either single or double quotes.
+
+=item B<NUMBER>
+
+A number, in either decimal, octal (using a C<0> prefix) or
+hexadecimal (using an C<0x> prefix).
+
+=item B<BOOLEAN>
+
+A C<NUMBER> interpreted as C<False> (C<0>) or C<True> (any other
+value).
+
+=item B<[ VALUE, VALUE, ... ]>
+
+A list of C<VALUES> of the above types. Lists are homogeneous and are
+not nested.
+
+=back
+
+The semantics of each C<KEY> defines which form of C<VALUE> is required.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<domid_policy="xen"|"random">
+
+Determines how domain-id is set when creating a new domain.
+
+If set to "xen" then the hypervisor will allocate new domain-id values on a sequential basis.
+
+If set to "random" then a random domain-id value will be chosen.
+
+Default: "xen"
+
+=item B<autoballoon="off"|"on"|"auto">
+
+If set to "on" then C<xl> will automatically reduce the amount of
+memory assigned to domain 0 in order to free memory for new domains.
+
+If set to "off" then C<xl> will not automatically reduce the amount of
+domain 0 memory.
+
+If set to "auto" then auto-ballooning will be disabled if the
+C<dom0_mem> option was provided on the Xen command line.
+
+You are strongly recommended to set this to C<"off"> (or C<"auto">) if
+you use the C<dom0_mem> hypervisor command line to reduce the amount
+of memory given to domain 0 by default.
+
+Default: C<"auto">
+
+=item B<run_hotplug_scripts=BOOLEAN>
+
+If disabled hotplug scripts will be called from udev, as it used to
+be in the previous releases. With the default option, hotplug scripts
+will be launched by xl directly.
+
+Default: C<1>
+
+=item B<lockfile="PATH">
+
+Sets the path to the lock file used by xl to serialise certain
+operations (primarily domain creation).
+
+Default: C</var/lock/xl>
+
+=item B<max_grant_frames=NUMBER>
+
+Sets the default value for the C<max_grant_frames> domain config value.
+
+Default: value of Xen command line B<gnttab_max_frames> parameter (or its
+default value if unspecified).
+
+=item B<max_maptrack_frames=NUMBER>
+
+Sets the default value for the C<max_maptrack_frames> domain config value.
+
+Default: value of Xen command line B<gnttab_max_maptrack_frames>
+parameter (or its default value if unspecified).
+
+=item B<vif.default.script="PATH">
+
+Configures the default hotplug script used by virtual network devices.
+
+The old B<vifscript> option is deprecated and should not be used.
+
+Default: C<@XEN_SCRIPT_DIR@/vif-bridge>
+
+=item B<vif.default.bridge="NAME">
+
+Configures the default bridge to set for virtual network devices.
+
+The old B<defaultbridge> option is deprecated and should not be used.
+
+Default: C<xenbr0>
+
+=item B<vif.default.backend="NAME">
+
+Configures the default backend to set for virtual network devices.
+
+Default: C<0>
+
+=item B<vif.default.gatewaydev="NAME">
+
+Configures the default gateway device to set for virtual network devices.
+
+Default: C<None>
+
+=item B<remus.default.netbufscript="PATH">
+
+Configures the default script used by Remus to setup network buffering.
+
+Default: C<@XEN_SCRIPT_DIR@/remus-netbuf-setup>
+
+=item B<colo.default.proxyscript="PATH">
+
+Configures the default script used by COLO to setup colo-proxy.
+
+Default: C<@XEN_SCRIPT_DIR@/colo-proxy-setup>
+
+=item B<output_format="json|sxp">
+
+Configures the default output format used by xl when printing "machine
+readable" information. The default is to use the C<JSON>
+L<https://www.json.org/> syntax. However for compatibility with the
+previous C<xm> toolstack this can be configured to use the old C<SXP>
+(S-Expression-like) syntax instead.
+
+Default: C<json>
+
+=item B<blkdev_start="NAME">
+
+Configures the name of the first block device to be used for temporary
+block device allocations by the toolstack.
+The default choice is "xvda".
+
+=item B<claim_mode=BOOLEAN>
+
+If this option is enabled then when a guest is created there will be an
+guarantee that there is memory available for the guest.
+The self-balloon mechanism can deflate/inflate the balloon
+quickly and the amount of free memory (which C<xl info> can show) is
+stale the moment it is printed. When claim is enabled a reservation for
+the amount of memory (see 'memory' in xl.conf(5)) is set, which is then
+reduced as the domain's memory is populated and eventually reaches zero.
+The free memory in C<xl info> is the combination of the hypervisor's
+free heap memory minus the outstanding claims value.
+
+If the reservation cannot be meet the guest creation fails immediately
+instead of taking seconds/minutes (depending on the size of the guest)
+while the guest is populated.
+
+Default: C<1>
+
+=over 4
+
+=item C<0>
+
+No claim is made. Memory population during guest creation will be
+attempted as normal and may fail due to memory exhaustion.
+
+=item C<1>
+
+Free memory as reported by the hypervisor is used for
+calculating whether there is enough memory free to launch a guest.
+This guarantees immediate feedback whether the guest can be launched due
+to memory exhaustion (which can take a long time to find out if launching
+massively huge guests).
+
+=back
+
+=item B<vm.cpumask>="CPULIST"
+
+=item B<vm.hvm.cpumask>="CPULIST"
+
+=item B<vm.pv.cpumask>="CPULIST"
+
+Global masks that are applied when creating guests and pinning vcpus
+to indicate which cpus they are allowed to run on.  Specifically,
+C<vm.cpumask> applies to all guest types, C<vm.hvm.cpumask> applies to
+both HVM and PVH guests and C<vm.pv.cpumask> applies to PV guests.
+
+The hard affinity of guest's vcpus are logical-AND'ed with respective
+masks. If the resulting affinity mask is empty, operation will fail.
+
+Use --ignore-global-affinity-masks to skip applying global masks.
+
+The default value for these masks are all 1's, i.e. all cpus are allowed.
+
+Due to bug(s), these options may not interact well with other options
+concerning CPU affinity. One example is CPU pools. Users should always double
+check that the required affinity has taken effect.
+
+=back
+
+=head1 SEE ALSO
+
+=over 4
+
+=item L<xl(1)>
+
+=item L<xl.cfg(5)>
+
+=item https://www.json.org/
+
+=back
diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index bd8af12ff3..07f54daabe 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -525,7 +525,7 @@ struct cmd_spec cmd_table[] = {
       "-e                      Do not wait in the background (on <host>) for the death\n"
       "                        of the domain.\n"
       "-N <netbufscript>       Use netbufscript to setup network buffering instead of the\n"
-      "                        default script (/etc/xen/scripts/remus-netbuf-setup).\n"
+      "                        default script (" XEN_SCRIPT_DIR "/remus-netbuf-setup).\n"
       "-F                      Enable unsafe configurations [-b|-n|-d flags]. Use this option\n"
       "                        with caution as failover may not work as intended.\n"
       "-b                      Replicate memory checkpoints to /dev/null (blackhole).\n"
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Feb 08 16:33:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Feb 2021 16:33:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.82968.153539 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l99Tu-0005pa-VT; Mon, 08 Feb 2021 16:33:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 82968.153539; Mon, 08 Feb 2021 16:33:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l99Tu-0005pS-Sd; Mon, 08 Feb 2021 16:33:46 +0000
Received: by outflank-mailman (input) for mailman id 82968;
 Mon, 08 Feb 2021 16: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 1l99Tu-0005pK-0W
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 16: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 1l99Tt-00086g-Vv
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 16:33:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l99Tt-0000MX-VH
 for xen-changelog@lists.xenproject.org; Mon, 08 Feb 2021 16:33:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LzvbXPwSEqO1QQEWQNqHS7guizd6YzdaQp9YQB2nM8I=; b=zFhN57MKrb+53bDR6EqEZUK1v1
	XHm/j3K6y3kT2hpY/tPAq+G9O60LFPngGzCg/Msdvl5ojN5sxx8Ju9Iwjhq5les0O+/DONn5SO6Oo
	aYyJbsGdRZaMHhidNJzMskciUmPEHbkdO9NgYdAMFJtVnbin3zf5A4nTV9X4Izw2SOZU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: remove tabs from code produced by libxl_save_msgs_gen.pl
Message-Id: <E1l99Tt-0000MX-VH@xenbits.xenproject.org>
Date: Mon, 08 Feb 2021 16:33:45 +0000

commit f18309eb06efd1db5a2ab9903a1c246b6299951a
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Mon Jan 11 18:42:17 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Feb 8 16:28:34 2021 +0000

    tools: remove tabs from code produced by libxl_save_msgs_gen.pl
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/light/libxl_save_msgs_gen.pl | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/libs/light/libxl_save_msgs_gen.pl b/tools/libs/light/libxl_save_msgs_gen.pl
index 5bfbd4fd10..9d425b1dee 100755
--- a/tools/libs/light/libxl_save_msgs_gen.pl
+++ b/tools/libs/light/libxl_save_msgs_gen.pl
@@ -120,8 +120,8 @@ sub typeid ($) { my ($t) = @_; $t =~ s/\W/_/; return $t; };
 
 $out_body{'callout'} .= <<END;
 static int bytes_get(const unsigned char **msg,
-		     const unsigned char *const endmsg,
-		     void *result, int rlen)
+                     const unsigned char *const endmsg,
+                     void *result, int rlen)
 {
     if (endmsg - *msg < rlen) return 0;
     memcpy(result, *msg, rlen);
@@ -132,11 +132,11 @@ static int bytes_get(const unsigned char **msg,
 END
 $out_body{'helper'} .= <<END;
 static void bytes_put(unsigned char *const buf, int *len,
-		      const void *value, int vlen)
+                      const void *value, int vlen)
 {
     assert(vlen < INT_MAX/2 - *len);
     if (buf)
-	memcpy(buf + *len, value, vlen);
+        memcpy(buf + *len, value, vlen);
     *len += vlen;
 }
 
@@ -155,7 +155,7 @@ static int ${typeid}_get(const unsigned char **msg,
 END
     $out_body{'helper'} .= <<END;
 static void ${typeid}_put(unsigned char *const buf, int *len,
-			 const $simpletype value)
+                          const $simpletype value)
 {
     bytes_put(buf, len, &value, sizeof(value));
 }
@@ -192,15 +192,15 @@ END
 $out_body{'helper'} .= <<END;
 static void BLOCK_put(unsigned char *const buf,
                       int *len,
-		      const uint8_t *bytes, uint32_t size)
+                      const uint8_t *bytes, uint32_t size)
 {
     uint32_t_put(buf, len, size);
     bytes_put(buf, len, bytes, size);
 }
 
 static void STRING_put(unsigned char *const buf,
-		       int *len,
-		       const char *string)
+                       int *len,
+                       const char *string)
 {
     size_t slen = strlen(string);
     assert(slen < INT_MAX / 4);
@@ -216,7 +216,7 @@ foreach my $sr (qw(save restore)) {
            "(void *data)");
 
     f_decl("${receiveds}_${sr}", 'callout', 'int',
-	   "(const unsigned char *msg, uint32_t len, void *user)");
+           "(const unsigned char *msg, uint32_t len, void *user)");
 
     f_decl("${enumcallbacks}_${sr}", 'callout', 'unsigned',
            "(const ".cbtype($sr)." *cbs)");
@@ -301,7 +301,7 @@ END_ALWAYS
 	$c_callback_args .= "$c_args, ";
 	$c_recv.=
             "        if (!${typeid}_get(&msg, endmsg, $c_get_args)) return 0;\n";
-        f_more("${encode}_$name", "	${typeid}_put(buf, &len, $c_args);\n");
+        f_more("${encode}_$name", "        ${typeid}_put(buf, &len, $c_args);\n");
     }
     $f_more_sr->($c_recv);
     $c_decl .= "void *user)";
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 09 17:11:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Feb 2021 17:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.83347.154866 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l9WXa-0002v3-FW; Tue, 09 Feb 2021 17:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 83347.154866; Tue, 09 Feb 2021 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 1l9WXa-0002uv-CZ; Tue, 09 Feb 2021 17:11:06 +0000
Received: by outflank-mailman (input) for mailman id 83347;
 Tue, 09 Feb 2021 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 1l9WXZ-0002uq-2j
 for xen-changelog@lists.xenproject.org; Tue, 09 Feb 2021 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 1l9WXY-0003Aj-U9
 for xen-changelog@lists.xenproject.org; Tue, 09 Feb 2021 17:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l9WXY-0001Jq-SB
 for xen-changelog@lists.xenproject.org; Tue, 09 Feb 2021 17:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=m0PbWSz7jzbSHe2Qs0LhQfta/Si43FQkGrUvB6+FlHw=; b=akSevaMLwAtkVn1QNbIUd8Yogt
	XgrzR02d3OFQrMjqGsl6/eKI4kPprZUUsrLYkTjVi9N0RQrhmxeU/a27jBGrYgd1yIYU+LZiKrCxl
	KgpujV1OyNJeNFUIluR5Oun5jQvDjye0gUmdCJZaC5tVRI0lmhPMF/5fPK/xS/N1k1PE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: Regenerate autoconf
Message-Id: <E1l9WXY-0001Jq-SB@xenbits.xenproject.org>
Date: Tue, 09 Feb 2021 17:11:04 +0000

commit 548ba7c85c6d80a671c2abb8681c29bc85c616f3
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Feb 9 17:05:54 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Feb 9 17:09:34 2021 +0000

    tools: Regenerate autoconf
    
    This seems to have been omitted in many recent commits.  The earliest
    of which are, according to git-bisect:
      154137dfdba3  stubdom/configure      stubdom: add xenstore pvh stubdom
      cc83ee4c6c37  all configure scripts  NetBSD: Fix lock directory path
    but it seems that this is true of several later commits too.
    
    Release status: I consider this discrepancy a release critical bug.
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
    Release-acked-by: Ian Jackson <iwj@xenproject.org>
---
 configure         | 2 +-
 docs/configure    | 7 +++++--
 stubdom/configure | 6 +++---
 tools/configure   | 2 +-
 4 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index 741e54bf2a..e174dbd238 100755
--- a/configure
+++ b/configure
@@ -2056,7 +2056,7 @@ XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
 
 case "$host_os" in
 *freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
-*netbsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
+*netbsd*) XEN_LOCK_DIR=$rundir_path ;;
 *) XEN_LOCK_DIR=$localstatedir/lock ;;
 esac
 
diff --git a/docs/configure b/docs/configure
index f55268564e..1582d477e3 100755
--- a/docs/configure
+++ b/docs/configure
@@ -1749,7 +1749,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-ac_config_files="$ac_config_files ../config/Docs.mk man/xl.cfg.5.pod man/xl.1.pod"
+ac_config_files="$ac_config_files ../config/Docs.mk man/xl.cfg.5.pod man/xl.1.pod man/xl-disk-configuration.5.pod man/xl-network-configuration.5.pod man/xl.conf.5.pod"
 
 ac_aux_dir=
 for ac_dir in ../ "$srcdir"/../; do
@@ -1959,7 +1959,7 @@ XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
 
 case "$host_os" in
 *freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
-*netbsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
+*netbsd*) XEN_LOCK_DIR=$rundir_path ;;
 *) XEN_LOCK_DIR=$localstatedir/lock ;;
 esac
 
@@ -2976,6 +2976,9 @@ do
     "../config/Docs.mk") CONFIG_FILES="$CONFIG_FILES ../config/Docs.mk" ;;
     "man/xl.cfg.5.pod") CONFIG_FILES="$CONFIG_FILES man/xl.cfg.5.pod" ;;
     "man/xl.1.pod") CONFIG_FILES="$CONFIG_FILES man/xl.1.pod" ;;
+    "man/xl-disk-configuration.5.pod") CONFIG_FILES="$CONFIG_FILES man/xl-disk-configuration.5.pod" ;;
+    "man/xl-network-configuration.5.pod") CONFIG_FILES="$CONFIG_FILES man/xl-network-configuration.5.pod" ;;
+    "man/xl.conf.5.pod") CONFIG_FILES="$CONFIG_FILES man/xl.conf.5.pod" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
diff --git a/stubdom/configure b/stubdom/configure
index 903414589b..6068f58d12 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -690,7 +690,7 @@ enable_c_stubdom
 enable_caml_stubdom
 enable_pv_grub
 enable_xenstore_stubdom
-enable_xenstore_pvh_stubdom
+enable_xenstorepvh_stubdom
 enable_vtpm_stubdom
 enable_vtpmmgr_stubdom
 enable_qemu_traditional
@@ -2184,8 +2184,8 @@ fi
 
 
 # Check whether --enable-xenstorepvh-stubdom was given.
-if test "${enable_xenstore_pvh_stubdom+set}" = set; then :
-  enableval=$enable_xenstore_pvh_stubdom;
+if test "${enable_xenstorepvh_stubdom+set}" = set; then :
+  enableval=$enable_xenstorepvh_stubdom;
 
 if test "x$enableval" = "xyes"; then :
 
diff --git a/tools/configure b/tools/configure
index 42c0d05bc1..519efb71ee 100755
--- a/tools/configure
+++ b/tools/configure
@@ -4038,7 +4038,7 @@ XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
 
 case "$host_os" in
 *freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
-*netbsd*) XEN_LOCK_DIR=$localstatedir/run ;;
+*netbsd*) XEN_LOCK_DIR=$rundir_path ;;
 *) XEN_LOCK_DIR=$localstatedir/lock ;;
 esac
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 09 17:11:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Feb 2021 17:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.83348.154870 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l9WXk-0002xe-Hc; Tue, 09 Feb 2021 17:11:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 83348.154870; Tue, 09 Feb 2021 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 1l9WXk-0002xW-EI; Tue, 09 Feb 2021 17:11:16 +0000
Received: by outflank-mailman (input) for mailman id 83348;
 Tue, 09 Feb 2021 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 1l9WXj-0002xR-3U
 for xen-changelog@lists.xenproject.org; Tue, 09 Feb 2021 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 1l9WXj-0003B2-2k
 for xen-changelog@lists.xenproject.org; Tue, 09 Feb 2021 17:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l9WXj-0001Ke-0m
 for xen-changelog@lists.xenproject.org; Tue, 09 Feb 2021 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=/3TgMJdiGlXO6cvevK3s6p9ZE0KFwOuOoL+f5/WLlZw=; b=UccdRxL4PHDFckPcrFYp+x3T3o
	oe8OmVR9ZmYlJG8mj/OpVez7GFLEuxyaIpqIpjLiYU7hrzK5DBqYd81xk7fS9O3VgpIeQltBVEmUQ
	1/ryHqekw8jFfK+3ZUcKH5arwSzkG2k9a4gyCGf58bPz/uL7OKVm4yuGMjIVwgHsgykw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: move CONFIG_DIR and XEN_CONFIG_DIR in paths.m4
Message-Id: <E1l9WXj-0001Ke-0m@xenbits.xenproject.org>
Date: Tue, 09 Feb 2021 17:11:15 +0000

commit fe9ba142c03a2046def52cfd5864f5a89172bf5c
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Tue Feb 9 16:45:33 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Feb 9 17:09:34 2021 +0000

    tools: move CONFIG_DIR and XEN_CONFIG_DIR in paths.m4
    
    Upcoming changes need to reuse XEN_CONFIG_DIR.
    
    In its current location the assignment happens too late. Move it up
    in the file, along with CONFIG_DIR. Their only dependency is
    sysconfdir, which may also be adjusted in this file.
    
    No functional change intended.
    
    [autoconf rerun -iwj]
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 configure       | 16 ++++++++--------
 docs/configure  | 16 ++++++++--------
 m4/paths.m4     | 12 ++++++------
 tools/configure | 16 ++++++++--------
 4 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/configure b/configure
index e174dbd238..2fe26c1bf7 100755
--- a/configure
+++ b/configure
@@ -600,9 +600,7 @@ XEN_DUMP_DIR
 XEN_PAGING_DIR
 XEN_LOCK_DIR
 XEN_SCRIPT_DIR
-XEN_CONFIG_DIR
 INITD_DIR
-CONFIG_DIR
 SHAREDIR
 XEN_LIB_DIR
 XEN_RUN_STORED
@@ -615,6 +613,8 @@ LIBEXEC_LIB
 LIBEXEC_BIN
 LIBEXEC
 CONFIG_LEAF_DIR
+XEN_CONFIG_DIR
+CONFIG_DIR
 XENSTORED_PORT
 XENSTORED_KVA
 host_os
@@ -1936,6 +1936,12 @@ if test "x$sysconfdir" = 'x${prefix}/etc' ; then
     esac
 fi
 
+CONFIG_DIR=$sysconfdir
+
+
+XEN_CONFIG_DIR=$CONFIG_DIR/xen
+
+
 
 # Check whether --with-initddir was given.
 if test "${with_initddir+set}" = set; then :
@@ -2042,15 +2048,9 @@ XEN_LIB_DIR=$localstatedir/lib/xen
 SHAREDIR=$prefix/share
 
 
-CONFIG_DIR=$sysconfdir
-
-
 INITD_DIR=$initddir_path
 
 
-XEN_CONFIG_DIR=$CONFIG_DIR/xen
-
-
 XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
 
 
diff --git a/docs/configure b/docs/configure
index 1582d477e3..18075e4e00 100755
--- a/docs/configure
+++ b/docs/configure
@@ -598,9 +598,7 @@ XEN_DUMP_DIR
 XEN_PAGING_DIR
 XEN_LOCK_DIR
 XEN_SCRIPT_DIR
-XEN_CONFIG_DIR
 INITD_DIR
-CONFIG_DIR
 SHAREDIR
 XEN_LIB_DIR
 XEN_RUN_STORED
@@ -613,6 +611,8 @@ LIBEXEC_LIB
 LIBEXEC_BIN
 LIBEXEC
 CONFIG_LEAF_DIR
+XEN_CONFIG_DIR
+CONFIG_DIR
 XENSTORED_PORT
 XENSTORED_KVA
 target_alias
@@ -1839,6 +1839,12 @@ if test "x$sysconfdir" = 'x${prefix}/etc' ; then
     esac
 fi
 
+CONFIG_DIR=$sysconfdir
+
+
+XEN_CONFIG_DIR=$CONFIG_DIR/xen
+
+
 
 # Check whether --with-initddir was given.
 if test "${with_initddir+set}" = set; then :
@@ -1945,15 +1951,9 @@ XEN_LIB_DIR=$localstatedir/lib/xen
 SHAREDIR=$prefix/share
 
 
-CONFIG_DIR=$sysconfdir
-
-
 INITD_DIR=$initddir_path
 
 
-XEN_CONFIG_DIR=$CONFIG_DIR/xen
-
-
 XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
 
 
diff --git a/m4/paths.m4 b/m4/paths.m4
index 1c107b1a61..a736f57d8d 100644
--- a/m4/paths.m4
+++ b/m4/paths.m4
@@ -34,6 +34,12 @@ if test "x$sysconfdir" = 'x${prefix}/etc' ; then
     esac
 fi
 
+CONFIG_DIR=$sysconfdir
+AC_SUBST(CONFIG_DIR)
+
+XEN_CONFIG_DIR=$CONFIG_DIR/xen
+AC_SUBST(XEN_CONFIG_DIR)
+
 AC_ARG_WITH([initddir],
     AS_HELP_STRING([--with-initddir=DIR],
     [Path to directory with sysv runlevel scripts. [SYSCONFDIR/init.d]]),
@@ -128,15 +134,9 @@ AC_SUBST(XEN_LIB_DIR)
 SHAREDIR=$prefix/share
 AC_SUBST(SHAREDIR)
 
-CONFIG_DIR=$sysconfdir
-AC_SUBST(CONFIG_DIR)
-
 INITD_DIR=$initddir_path
 AC_SUBST(INITD_DIR)
 
-XEN_CONFIG_DIR=$CONFIG_DIR/xen
-AC_SUBST(XEN_CONFIG_DIR)
-
 XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
 AC_SUBST(XEN_SCRIPT_DIR)
 
diff --git a/tools/configure b/tools/configure
index 519efb71ee..86de2e2736 100755
--- a/tools/configure
+++ b/tools/configure
@@ -721,9 +721,7 @@ XEN_DUMP_DIR
 XEN_PAGING_DIR
 XEN_LOCK_DIR
 XEN_SCRIPT_DIR
-XEN_CONFIG_DIR
 INITD_DIR
-CONFIG_DIR
 SHAREDIR
 XEN_LIB_DIR
 XEN_RUN_STORED
@@ -736,6 +734,8 @@ LIBEXEC_LIB
 LIBEXEC_BIN
 LIBEXEC
 CONFIG_LEAF_DIR
+XEN_CONFIG_DIR
+CONFIG_DIR
 XENSTORED_PORT
 XENSTORED_KVA
 FILE_OFFSET_BITS
@@ -3918,6 +3918,12 @@ if test "x$sysconfdir" = 'x${prefix}/etc' ; then
     esac
 fi
 
+CONFIG_DIR=$sysconfdir
+
+
+XEN_CONFIG_DIR=$CONFIG_DIR/xen
+
+
 
 # Check whether --with-initddir was given.
 if test "${with_initddir+set}" = set; then :
@@ -4024,15 +4030,9 @@ XEN_LIB_DIR=$localstatedir/lib/xen
 SHAREDIR=$prefix/share
 
 
-CONFIG_DIR=$sysconfdir
-
-
 INITD_DIR=$initddir_path
 
 
-XEN_CONFIG_DIR=$CONFIG_DIR/xen
-
-
 XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 09 17:11:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Feb 2021 17:11:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.83349.154874 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l9WXu-0002yp-Iu; Tue, 09 Feb 2021 17:11:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 83349.154874; Tue, 09 Feb 2021 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 1l9WXu-0002yh-Fr; Tue, 09 Feb 2021 17:11:26 +0000
Received: by outflank-mailman (input) for mailman id 83349;
 Tue, 09 Feb 2021 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 1l9WXt-0002yX-7M
 for xen-changelog@lists.xenproject.org; Tue, 09 Feb 2021 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 1l9WXt-0003B8-6i
 for xen-changelog@lists.xenproject.org; Tue, 09 Feb 2021 17:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l9WXt-0001LU-5d
 for xen-changelog@lists.xenproject.org; Tue, 09 Feb 2021 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=VJwM0C3jT3lORTo5xWWBbMJcO4PZhzl7fVrgm71jjAc=; b=G/R1gjGkEP7E2Ac6XtlB/KvA7j
	u1EF2WiGYMjtvh/O4ZVLtEYYNEA6IIKpnoPGFDXX+JixlbVFffqY6OyWIYZS1LVkobFZWapXfpwJf
	SuaSkkPAootIM6vr1cd5qX0gGzmNRwXdwLin2LfUYNX6tTOozqv5Sv8iimNZU3u93Ctc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: add with-xen-scriptdir configure option
Message-Id: <E1l9WXt-0001LU-5d@xenbits.xenproject.org>
Date: Tue, 09 Feb 2021 17:11:25 +0000

commit 7a321c3676250aac5bacb1ae8d7dd22bfe8b1448
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Tue Feb 9 16:45:34 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Feb 9 17:10:03 2021 +0000

    tools: add with-xen-scriptdir configure option
    
    Some distros plan for fresh installations will have an empty /etc,
    whose content will not be controlled by the package manager anymore.
    
    To make this possible, add a knob to configure to allow storing the
    hotplug scripts to libexec instead of /etc/xen/scripts.
    
    The current default remains unchanged, which is /etc/xen/scripts.
    
    [autoconf rerun -iwj]
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
---
 configure       | 20 ++++++++++++++++----
 docs/configure  | 20 ++++++++++++++++----
 m4/paths.m4     | 11 ++++++++---
 tools/configure | 20 ++++++++++++++++----
 4 files changed, 56 insertions(+), 15 deletions(-)

diff --git a/configure b/configure
index 2fe26c1bf7..a2789ae480 100755
--- a/configure
+++ b/configure
@@ -599,7 +599,6 @@ DEBUG_DIR
 XEN_DUMP_DIR
 XEN_PAGING_DIR
 XEN_LOCK_DIR
-XEN_SCRIPT_DIR
 INITD_DIR
 SHAREDIR
 XEN_LIB_DIR
@@ -612,6 +611,7 @@ LIBEXEC_INC
 LIBEXEC_LIB
 LIBEXEC_BIN
 LIBEXEC
+XEN_SCRIPT_DIR
 CONFIG_LEAF_DIR
 XEN_CONFIG_DIR
 CONFIG_DIR
@@ -670,6 +670,7 @@ enable_option_checking
 with_initddir
 with_sysconfig_leaf_dir
 with_libexec_leaf_dir
+with_xen_scriptdir
 with_xen_dumpdir
 with_rundir
 with_debugdir
@@ -1328,6 +1329,9 @@ Optional Packages:
                           "default". [sysconfig]
   --with-libexec-leaf-dir=SUBDIR
                           Name of subdirectory in libexecdir to use.
+  --with-xen-scriptdir=DIR
+                          Path to directory for dom0 hotplug scripts.
+                          [SYSCONFDIR/xen/scripts]
   --with-xen-dumpdir=DIR  Path to directory for domU crash dumps.
                           [LOCALSTATEDIR/lib/xen/dump]
   --with-rundir=DIR       Path to directory for runtime data.
@@ -1984,6 +1988,17 @@ fi
 
 
 
+# Check whether --with-xen-scriptdir was given.
+if test "${with_xen_scriptdir+set}" = set; then :
+  withval=$with_xen_scriptdir; xen_scriptdir_path=$withval
+else
+  xen_scriptdir_path=$XEN_CONFIG_DIR/scripts
+fi
+
+XEN_SCRIPT_DIR=$xen_scriptdir_path
+
+
+
 # Check whether --with-xen-dumpdir was given.
 if test "${with_xen_dumpdir+set}" = set; then :
   withval=$with_xen_dumpdir; xen_dumpdir_path=$withval
@@ -2051,9 +2066,6 @@ SHAREDIR=$prefix/share
 INITD_DIR=$initddir_path
 
 
-XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
-
-
 case "$host_os" in
 *freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
 *netbsd*) XEN_LOCK_DIR=$rundir_path ;;
diff --git a/docs/configure b/docs/configure
index 18075e4e00..e9c040cb84 100755
--- a/docs/configure
+++ b/docs/configure
@@ -597,7 +597,6 @@ DEBUG_DIR
 XEN_DUMP_DIR
 XEN_PAGING_DIR
 XEN_LOCK_DIR
-XEN_SCRIPT_DIR
 INITD_DIR
 SHAREDIR
 XEN_LIB_DIR
@@ -610,6 +609,7 @@ LIBEXEC_INC
 LIBEXEC_LIB
 LIBEXEC_BIN
 LIBEXEC
+XEN_SCRIPT_DIR
 CONFIG_LEAF_DIR
 XEN_CONFIG_DIR
 CONFIG_DIR
@@ -660,6 +660,7 @@ enable_option_checking
 with_initddir
 with_sysconfig_leaf_dir
 with_libexec_leaf_dir
+with_xen_scriptdir
 with_xen_dumpdir
 with_rundir
 with_debugdir
@@ -1301,6 +1302,9 @@ Optional Packages:
                           "default". [sysconfig]
   --with-libexec-leaf-dir=SUBDIR
                           Name of subdirectory in libexecdir to use.
+  --with-xen-scriptdir=DIR
+                          Path to directory for dom0 hotplug scripts.
+                          [SYSCONFDIR/xen/scripts]
   --with-xen-dumpdir=DIR  Path to directory for domU crash dumps.
                           [LOCALSTATEDIR/lib/xen/dump]
   --with-rundir=DIR       Path to directory for runtime data.
@@ -1887,6 +1891,17 @@ fi
 
 
 
+# Check whether --with-xen-scriptdir was given.
+if test "${with_xen_scriptdir+set}" = set; then :
+  withval=$with_xen_scriptdir; xen_scriptdir_path=$withval
+else
+  xen_scriptdir_path=$XEN_CONFIG_DIR/scripts
+fi
+
+XEN_SCRIPT_DIR=$xen_scriptdir_path
+
+
+
 # Check whether --with-xen-dumpdir was given.
 if test "${with_xen_dumpdir+set}" = set; then :
   withval=$with_xen_dumpdir; xen_dumpdir_path=$withval
@@ -1954,9 +1969,6 @@ SHAREDIR=$prefix/share
 INITD_DIR=$initddir_path
 
 
-XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
-
-
 case "$host_os" in
 *freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
 *netbsd*) XEN_LOCK_DIR=$rundir_path ;;
diff --git a/m4/paths.m4 b/m4/paths.m4
index a736f57d8d..7be314a3e2 100644
--- a/m4/paths.m4
+++ b/m4/paths.m4
@@ -76,6 +76,14 @@ AC_ARG_WITH([libexec-leaf-dir],
     [libexec_subdir=$withval],
     [libexec_subdir=$PACKAGE_TARNAME])
 
+AC_ARG_WITH([xen-scriptdir],
+    AS_HELP_STRING([--with-xen-scriptdir=DIR],
+    [Path to directory for dom0 hotplug scripts. [SYSCONFDIR/xen/scripts]]),
+    [xen_scriptdir_path=$withval],
+    [xen_scriptdir_path=$XEN_CONFIG_DIR/scripts])
+XEN_SCRIPT_DIR=$xen_scriptdir_path
+AC_SUBST(XEN_SCRIPT_DIR)
+
 AC_ARG_WITH([xen-dumpdir],
     AS_HELP_STRING([--with-xen-dumpdir=DIR],
     [Path to directory for domU crash dumps. [LOCALSTATEDIR/lib/xen/dump]]),
@@ -137,9 +145,6 @@ AC_SUBST(SHAREDIR)
 INITD_DIR=$initddir_path
 AC_SUBST(INITD_DIR)
 
-XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
-AC_SUBST(XEN_SCRIPT_DIR)
-
 case "$host_os" in
 *freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
 *netbsd*) XEN_LOCK_DIR=$rundir_path ;;
diff --git a/tools/configure b/tools/configure
index 86de2e2736..419d7b189a 100755
--- a/tools/configure
+++ b/tools/configure
@@ -720,7 +720,6 @@ DEBUG_DIR
 XEN_DUMP_DIR
 XEN_PAGING_DIR
 XEN_LOCK_DIR
-XEN_SCRIPT_DIR
 INITD_DIR
 SHAREDIR
 XEN_LIB_DIR
@@ -733,6 +732,7 @@ LIBEXEC_INC
 LIBEXEC_LIB
 LIBEXEC_BIN
 LIBEXEC
+XEN_SCRIPT_DIR
 CONFIG_LEAF_DIR
 XEN_CONFIG_DIR
 CONFIG_DIR
@@ -801,6 +801,7 @@ enable_largefile
 with_initddir
 with_sysconfig_leaf_dir
 with_libexec_leaf_dir
+with_xen_scriptdir
 with_xen_dumpdir
 with_rundir
 with_debugdir
@@ -1526,6 +1527,9 @@ Optional Packages:
                           "default". [sysconfig]
   --with-libexec-leaf-dir=SUBDIR
                           Name of subdirectory in libexecdir to use.
+  --with-xen-scriptdir=DIR
+                          Path to directory for dom0 hotplug scripts.
+                          [SYSCONFDIR/xen/scripts]
   --with-xen-dumpdir=DIR  Path to directory for domU crash dumps.
                           [LOCALSTATEDIR/lib/xen/dump]
   --with-rundir=DIR       Path to directory for runtime data.
@@ -3966,6 +3970,17 @@ fi
 
 
 
+# Check whether --with-xen-scriptdir was given.
+if test "${with_xen_scriptdir+set}" = set; then :
+  withval=$with_xen_scriptdir; xen_scriptdir_path=$withval
+else
+  xen_scriptdir_path=$XEN_CONFIG_DIR/scripts
+fi
+
+XEN_SCRIPT_DIR=$xen_scriptdir_path
+
+
+
 # Check whether --with-xen-dumpdir was given.
 if test "${with_xen_dumpdir+set}" = set; then :
   withval=$with_xen_dumpdir; xen_dumpdir_path=$withval
@@ -4033,9 +4048,6 @@ SHAREDIR=$prefix/share
 INITD_DIR=$initddir_path
 
 
-XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
-
-
 case "$host_os" in
 *freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
 *netbsd*) XEN_LOCK_DIR=$rundir_path ;;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 09 17:11:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Feb 2021 17:11:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.83350.154878 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l9WY4-00030L-KO; Tue, 09 Feb 2021 17:11:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 83350.154878; Tue, 09 Feb 2021 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 1l9WY4-00030D-HM; Tue, 09 Feb 2021 17:11:36 +0000
Received: by outflank-mailman (input) for mailman id 83350;
 Tue, 09 Feb 2021 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 1l9WY3-000302-AS
 for xen-changelog@lists.xenproject.org; Tue, 09 Feb 2021 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 1l9WY3-0003BK-9o
 for xen-changelog@lists.xenproject.org; Tue, 09 Feb 2021 17:11:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l9WY3-0001Nv-8w
 for xen-changelog@lists.xenproject.org; Tue, 09 Feb 2021 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=McFjGGC4mqSpNcFoVys+/+ZR9Zx8FU180xVywqwDgi0=; b=u7sVVuzlEDhabMlNDbQVKGsLuL
	GpE2pB6qRH3ib6bh1r13FHnhZOVBcCXX8gIVkfx6HBS7ngDdIVSO61MwK9paD5Cki1mO0dfW744rS
	JFwRScMVNOskaxggLxXeAH1wrHd7ynii17GwPUmKeT5EVfzVt52r77od3UTw6p0tDLtw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xl: optionally print timestamps when running xl commands
Message-Id: <E1l9WY3-0001Nv-8w@xenbits.xenproject.org>
Date: Tue, 09 Feb 2021 17:11:35 +0000

commit 687121f8a0e7c1ea1c4fa3d056637e5819342f14
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Tue Feb 9 16:45:35 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Feb 9 17:10:23 2021 +0000

    xl: optionally print timestamps when running xl commands
    
    Add a global option "-T" to xl to enable timestamps in the output from
    libxl and libxc. This is most useful with long running commands such
    as "migrate".
    
    During 'xl -v.. migrate domU host' a large amount of debug is generated.
    It is difficult to map each line to the sending and receiving side.
    Also the time spent for migration is not reported.
    
    With 'xl -T migrate domU host' both sides will print timestamps and
    also the pid of the invoked xl process to make it more obvious which
    side produced a given log line.
    
    Note: depending on the command, xl itself also produces other output
    which does not go through libxentoollog. As a result such output will
    not have timestamps prepended.
    
    This change adds also the missing "-t" flag to "xl help" output.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
---
 docs/man/xl.1.pod.in  |  4 ++++
 tools/xl/xl.c         | 18 +++++++++++++-----
 tools/xl/xl.h         |  1 +
 tools/xl/xl_migrate.c |  3 ++-
 4 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index 618c195148..e2176bd696 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -86,6 +86,10 @@ Always use carriage-return-based overwriting for displaying progress
 messages without scrolling the screen.  Without -t, this is done only
 if stderr is a tty.
 
+=item B<-T>
+
+Include timestamps and pid of the xl process in output.
+
 =back
 
 =head1 DOMAIN SUBCOMMANDS
diff --git a/tools/xl/xl.c b/tools/xl/xl.c
index 2a5ddd4390..3a89295802 100644
--- a/tools/xl/xl.c
+++ b/tools/xl/xl.c
@@ -52,6 +52,7 @@ libxl_bitmap global_pv_affinity_mask;
 enum output_format default_output_format = OUTPUT_FORMAT_JSON;
 int claim_mode = 1;
 bool progress_use_cr = 0;
+bool timestamps = 0;
 int max_grant_frames = -1;
 int max_maptrack_frames = -1;
 libxl_domid domid_policy = INVALID_DOMID;
@@ -365,8 +366,9 @@ int main(int argc, char **argv)
     int ret;
     void *config_data = 0;
     int config_len = 0;
+    unsigned int xtl_flags = 0;
 
-    while ((opt = getopt(argc, argv, "+vftN")) >= 0) {
+    while ((opt = getopt(argc, argv, "+vftTN")) >= 0) {
         switch (opt) {
         case 'v':
             if (minmsglevel > 0) minmsglevel--;
@@ -380,6 +382,9 @@ int main(int argc, char **argv)
         case 't':
             progress_use_cr = 1;
             break;
+        case 'T':
+            timestamps = 1;
+            break;
         default:
             fprintf(stderr, "unknown global option\n");
             exit(EXIT_FAILURE);
@@ -394,8 +399,11 @@ int main(int argc, char **argv)
     }
     opterr = 0;
 
-    logger = xtl_createlogger_stdiostream(stderr, minmsglevel,
-        (progress_use_cr ? XTL_STDIOSTREAM_PROGRESS_USE_CR : 0));
+    if (progress_use_cr)
+        xtl_flags |= XTL_STDIOSTREAM_PROGRESS_USE_CR;
+    if (timestamps)
+        xtl_flags |= XTL_STDIOSTREAM_SHOW_DATE | XTL_STDIOSTREAM_SHOW_PID;
+    logger = xtl_createlogger_stdiostream(stderr, minmsglevel, xtl_flags);
     if (!logger) exit(EXIT_FAILURE);
 
     xl_ctx_alloc();
@@ -457,7 +465,7 @@ void help(const char *command)
     struct cmd_spec *cmd;
 
     if (!command || !strcmp(command, "help")) {
-        printf("Usage xl [-vfN] <subcommand> [args]\n\n");
+        printf("Usage xl [-vfNtT] <subcommand> [args]\n\n");
         printf("xl full list of subcommands:\n\n");
         for (i = 0; i < cmdtable_len; i++) {
             printf(" %-19s ", cmd_table[i].cmd_name);
@@ -468,7 +476,7 @@ void help(const char *command)
     } else {
         cmd = cmdtable_lookup(command);
         if (cmd) {
-            printf("Usage: xl [-v%s%s] %s %s\n\n%s.\n\n",
+            printf("Usage: xl [-vtT%s%s] %s %s\n\n%s.\n\n",
                    cmd->modifies ? "f" : "",
                    cmd->can_dryrun ? "N" : "",
                    cmd->cmd_name,
diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index 06569c6c4a..137a29077c 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -269,6 +269,7 @@ extern int run_hotplug_scripts;
 extern int dryrun_only;
 extern int claim_mode;
 extern bool progress_use_cr;
+extern bool timestamps;
 extern xentoollog_level minmsglevel;
 #define minmsglevel_default XTL_PROGRESS
 extern char *lockfile;
diff --git a/tools/xl/xl_migrate.c b/tools/xl/xl_migrate.c
index 0813beb801..b8594f44a5 100644
--- a/tools/xl/xl_migrate.c
+++ b/tools/xl/xl_migrate.c
@@ -592,9 +592,10 @@ int main_migrate(int argc, char **argv)
         } else {
             verbose_len = (minmsglevel_default - minmsglevel) + 2;
         }
-        xasprintf(&rune, "exec %s %s xl%s%.*s migrate-receive%s%s%s",
+        xasprintf(&rune, "exec %s %s xl%s%s%.*s migrate-receive%s%s%s",
                   ssh_command, host,
                   pass_tty_arg ? " -t" : "",
+                  timestamps ? " -T" : "",
                   verbose_len, verbose_buf,
                   daemonize ? "" : " -e",
                   debug ? " -d" : "",
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 10 11:22:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Feb 2021 11:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.83551.155746 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l9nZO-0000tF-MI; Wed, 10 Feb 2021 11:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 83551.155746; Wed, 10 Feb 2021 11:22:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l9nZO-0000t7-IR; Wed, 10 Feb 2021 11:22:06 +0000
Received: by outflank-mailman (input) for mailman id 83551;
 Wed, 10 Feb 2021 11: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 1l9nZN-0000sz-4z
 for xen-changelog@lists.xenproject.org; Wed, 10 Feb 2021 11: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 1l9nZN-0007vt-49
 for xen-changelog@lists.xenproject.org; Wed, 10 Feb 2021 11:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l9nZN-0008Fr-2E
 for xen-changelog@lists.xenproject.org; Wed, 10 Feb 2021 11:22:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nXZC7IEJEFnNKZd5d2HRaV8GUwLl75OKfBWQexslxFA=; b=d5Ylj0r0bz7ZlXWfkWDnaqaMT5
	9ItSDYgIjLx2tkbrGw+qiu7U6+UMUwIz+WCpgcn2KKMWzT7FJQ9Z9VCHxQDrv/Oq5ZC8fW9vmbb9K
	S3w/4Bj9fWP90+z4LxGvRC7LxHHMupuxUOXGexQEqBCiSSe5bzRAoW/R6s4YDklyCVSU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] autoconf: check endian.h include path
Message-Id: <E1l9nZN-0008Fr-2E@xenbits.xenproject.org>
Date: Wed, 10 Feb 2021 11:22:05 +0000

commit c9b0242ad44a739e0f4c72b67fd4bcf4b042f800
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Feb 4 10:38:33 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Wed Feb 10 11:10:55 2021 +0000

    autoconf: check endian.h include path
    
    Introduce an autoconf macro to check for the include path of certain
    headers that can be different between OSes.
    
    Use such macro to find the correct path for the endian.h header, and
    modify the users of endian.h to use the output of such check.
    
    Suggested-by: Ian Jackson <iwj@xenproject.org>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 m4/header.m4                                      | 13 +++++++++++++
 tools/configure.ac                                |  3 +++
 tools/libs/guest/xg_dom_decompress_unsafe_lzo1x.c |  2 +-
 tools/libs/guest/xg_dom_decompress_unsafe_xz.c    |  2 +-
 tools/libs/guest/xg_dom_decompress_unsafe_zstd.c  |  2 +-
 tools/xenstore/include/xenstore_state.h           |  6 +-----
 6 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/m4/header.m4 b/m4/header.m4
new file mode 100644
index 0000000000..81d1d65194
--- /dev/null
+++ b/m4/header.m4
@@ -0,0 +1,13 @@
+AC_DEFUN([AX_FIND_HEADER], [
+ax_found=0
+m4_foreach_w([header], $2, [
+    AS_IF([test "$ax_found" = "0"], [
+        AC_CHECK_HEADER(header, [
+            AC_DEFINE($1, [<header>], [Header path for $1])
+            ax_found=1])
+    ])
+])
+AS_IF([test "$ax_found" = "0"], [
+    AC_MSG_ERROR([No header found from list $2])
+])
+])
diff --git a/tools/configure.ac b/tools/configure.ac
index 5b328700e0..3a3e7b4b2b 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -74,6 +74,7 @@ m4_include([../m4/ax_compare_version.m4])
 m4_include([../m4/paths.m4])
 m4_include([../m4/systemd.m4])
 m4_include([../m4/golang.m4])
+m4_include([../m4/header.m4])
 
 AX_XEN_EXPAND_CONFIG()
 
@@ -517,4 +518,6 @@ AC_ARG_ENABLE([pvshim],
 ])
 AC_SUBST(pvshim)
 
+AX_FIND_HEADER([INCLUDE_ENDIAN_H], [endian.h sys/endian.h])
+
 AC_OUTPUT()
diff --git a/tools/libs/guest/xg_dom_decompress_unsafe_lzo1x.c b/tools/libs/guest/xg_dom_decompress_unsafe_lzo1x.c
index a4f8ebd42d..e58c1b95ed 100644
--- a/tools/libs/guest/xg_dom_decompress_unsafe_lzo1x.c
+++ b/tools/libs/guest/xg_dom_decompress_unsafe_lzo1x.c
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <inttypes.h>
-#include <endian.h>
+#include INCLUDE_ENDIAN_H
 #include <stdint.h>
 
 #include "xg_private.h"
diff --git a/tools/libs/guest/xg_dom_decompress_unsafe_xz.c b/tools/libs/guest/xg_dom_decompress_unsafe_xz.c
index ff6824b38d..fc48198741 100644
--- a/tools/libs/guest/xg_dom_decompress_unsafe_xz.c
+++ b/tools/libs/guest/xg_dom_decompress_unsafe_xz.c
@@ -1,5 +1,5 @@
 #include <stdio.h>
-#include <endian.h>
+#include INCLUDE_ENDIAN_H
 #include <stdlib.h>
 #include <stddef.h>
 #include <stdint.h>
diff --git a/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c b/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c
index 52558d2ffc..01eafaaaa6 100644
--- a/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c
+++ b/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c
@@ -1,5 +1,5 @@
 #include <stdio.h>
-#include <endian.h>
+#include INCLUDE_ENDIAN_H
 #include <stdlib.h>
 #include <stddef.h>
 #include <stdint.h>
diff --git a/tools/xenstore/include/xenstore_state.h b/tools/xenstore/include/xenstore_state.h
index f7e4da2b2c..ae0d053c8f 100644
--- a/tools/xenstore/include/xenstore_state.h
+++ b/tools/xenstore/include/xenstore_state.h
@@ -21,11 +21,7 @@
 #ifndef XENSTORE_STATE_H
 #define XENSTORE_STATE_H
 
-#if defined(__FreeBSD__) || defined(__NetBSD__)
-#include <sys/endian.h>
-#else
-#include <endian.h>
-#endif
+#include INCLUDE_ENDIAN_H
 #include <sys/types.h>
 
 #ifndef htobe32
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 10 11:22:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Feb 2021 11:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.83552.155750 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l9nZX-0000uY-PB; Wed, 10 Feb 2021 11:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 83552.155750; Wed, 10 Feb 2021 11:22:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l9nZX-0000uQ-MM; Wed, 10 Feb 2021 11:22:15 +0000
Received: by outflank-mailman (input) for mailman id 83552;
 Wed, 10 Feb 2021 11: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 1l9nZX-0000uL-8f
 for xen-changelog@lists.xenproject.org; Wed, 10 Feb 2021 11:22:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l9nZX-0007w0-7b
 for xen-changelog@lists.xenproject.org; Wed, 10 Feb 2021 11:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l9nZX-0008Gs-69
 for xen-changelog@lists.xenproject.org; Wed, 10 Feb 2021 11:22:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AP2oqIQnFt7RYtNhaubodOQqV1OAg4YMaHqcw+Puwaw=; b=REHkmrITeBRCHrrcV8p+1KRvJa
	2L+54/Ky2oenIez70Rbf0CSC0Zr1z1zYuTcxacg3K8anc4z0qN+bWvt6KzEzpGFVqExHxee8OBkjJ
	M/zaMRNYGUxi7DnfN0XQXCVeKXyvEawdn3CB49Gu/JA57X0NT5MuhHA6rGwnCa4Pgveg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/configure: add bison as mandatory
Message-Id: <E1l9nZX-0008Gs-69@xenbits.xenproject.org>
Date: Wed, 10 Feb 2021 11:22:15 +0000

commit 20077d035224c6f3b3eef8b111b8b842635f2c40
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Feb 5 12:53:27 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Wed Feb 10 11:11:55 2021 +0000

    tools/configure: add bison as mandatory
    
    Bison is now mandatory when the pvshim build is enabled in order to
    generate the Kconfig.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
---
 tools/configure.ac | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/configure.ac b/tools/configure.ac
index 3a3e7b4b2b..6b611deb13 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -309,7 +309,6 @@ AC_ARG_VAR([AWK], [Path to awk tool])
 AC_PROG_CC
 AC_PROG_MAKE_SET
 AC_PROG_INSTALL
-AC_PATH_PROG([BISON], [bison])
 AC_PATH_PROG([FLEX], [flex])
 AX_PATH_PROG_OR_FAIL([PERL], [perl])
 AX_PATH_PROG_OR_FAIL([AWK], [awk])
@@ -517,6 +516,11 @@ AC_ARG_ENABLE([pvshim],
     esac
 ])
 AC_SUBST(pvshim)
+AS_IF([test "x$pvshim" = "xy"], [
+    AX_PATH_PROG_OR_FAIL([BISON], [bison])
+], [
+    AC_PATH_PROG([BISON], [bison])
+])
 
 AX_FIND_HEADER([INCLUDE_ENDIAN_H], [endian.h sys/endian.h])
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 10 13:55:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Feb 2021 13:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.83609.156006 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l9pxS-0008BL-2M; Wed, 10 Feb 2021 13:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 83609.156006; Wed, 10 Feb 2021 13:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l9pxR-0008BC-Vd; Wed, 10 Feb 2021 13:55:05 +0000
Received: by outflank-mailman (input) for mailman id 83609;
 Wed, 10 Feb 2021 13:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l9pxQ-0008B7-Vo
 for xen-changelog@lists.xenproject.org; Wed, 10 Feb 2021 13:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l9pxQ-00023w-Sf
 for xen-changelog@lists.xenproject.org; Wed, 10 Feb 2021 13:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l9pxQ-0003ce-Rp
 for xen-changelog@lists.xenproject.org; Wed, 10 Feb 2021 13:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YLaqo2loZHYoBuQcorEjDBKX4dvT0gTfESNg85MrEUM=; b=PGuOD4vASzM6ZrN/1OBVb9LsEE
	BVuIwS2jWuzFDM0ewa2VfW5ECwTnek06h0cUwSX2ryMj6kDs+qbgCdYpMSWE0ZwwtoWNFfE0gYs9O
	JczP2qyqI2TSREfnihJNTwSSQpqVPsXxUd5As349EBQ43zfoG5H0PZM1ZCBGBlBujjkc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/ucode/amd: Fix OoB read in cpu_request_microcode()
Message-Id: <E1l9pxQ-0003ce-Rp@xenbits.xenproject.org>
Date: Wed, 10 Feb 2021 13:55:04 +0000

commit 1cbc4d89c45cba3929f1c0cb4bca0b000c4f174b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 9 22:10:54 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 10 13:23:51 2021 +0000

    x86/ucode/amd: Fix OoB read in cpu_request_microcode()
    
    verify_patch_size() is a maximum size check, and doesn't have a minimum bound.
    
    If the microcode container encodes a blob with a length less than 64 bytes,
    the subsequent calls to microcode_fits()/compare_header() may read off the end
    of the buffer.
    
    Fixes: 4de936a38a ("x86/ucode/amd: Rework parsing logic in cpu_request_microcode()")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/amd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 5255028af7..3e51e53c1f 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -349,6 +349,7 @@ static struct microcode_patch *cpu_request_microcode(const void *buf, size_t siz
             if ( size < sizeof(*mc) ||
                  (mc = buf)->type != UCODE_UCODE_TYPE ||
                  size - sizeof(*mc) < mc->len ||
+                 mc->len < sizeof(struct microcode_patch) ||
                  (!skip_ucode && !verify_patch_size(mc->len)) )
             {
                 printk(XENLOG_ERR "microcode: Bad microcode data\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 10 13:55:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Feb 2021 13:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.83610.156009 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l9pxc-0008Ch-42; Wed, 10 Feb 2021 13:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 83610.156009; Wed, 10 Feb 2021 13:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l9pxc-0008CZ-0u; Wed, 10 Feb 2021 13:55:16 +0000
Received: by outflank-mailman (input) for mailman id 83610;
 Wed, 10 Feb 2021 13:55:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l9pxb-0008CQ-0U
 for xen-changelog@lists.xenproject.org; Wed, 10 Feb 2021 13:55:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l9pxa-000242-Vl
 for xen-changelog@lists.xenproject.org; Wed, 10 Feb 2021 13:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l9pxa-0003dX-Uz
 for xen-changelog@lists.xenproject.org; Wed, 10 Feb 2021 13:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BY2hVUTdnPBNRJlPzgI5pG5kDBhxe3nSxFtyShfnkHo=; b=E1BQ4UW4dEGfI58V50jt1f0Y94
	6B269yN6E1i1tbJBXDA5YLBDb4O6Hpjmt4iG/X7n4QtIcPmUbO0YmqiMP4bqHAk9Qq2T3jEwgjRn5
	ga58Yu7xIxQ1VmWh37v3zAKwQXq9Lu/g+8N6sFr8QG5Shx2m/iNz+tVS0O6m3LPnNDsE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/ucode/amd: Handle length sanity check failures more gracefully
Message-Id: <E1l9pxa-0003dX-Uz@xenbits.xenproject.org>
Date: Wed, 10 Feb 2021 13:55:14 +0000

commit 0e898ad8bc86d76485ce7a6a29ff2d3fa34d070d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 9 20:49:07 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 10 13:23:51 2021 +0000

    x86/ucode/amd: Handle length sanity check failures more gracefully
    
    Currently, a failure of verify_patch_size() causes an early abort of the
    microcode blob loop, which in turn causes a second go around the main
    container loop, ultimately failing the UCODE_MAGIC check.
    
    First, check for errors after the blob loop.  An error here is unrecoverable,
    so avoid going around the container loop again and printing an
    unhelpful-at-best error concerning bad UCODE_MAGIC.
    
    Second, split the verify_patch_size() check out of the microcode blob header
    check.  In the case that the sanity check fails, we can still use the
    known-to-be-plausible header length to continue walking the container to
    potentially find other applicable microcode blobs.
    
    Before:
      (XEN) microcode: Bad microcode data
      (XEN) microcode: Wrong microcode patch file magic
      (XEN) Parsing microcode blob error -22
    
    After:
      (XEN) microcode: Bad microcode length 0x000015c0 for cpu 0xa000
      (XEN) microcode: Bad microcode length 0x000015c0 for cpu 0xa010
      (XEN) microcode: Bad microcode length 0x000015c0 for cpu 0xa011
      (XEN) microcode: Bad microcode length 0x000015c0 for cpu 0xa200
      (XEN) microcode: Bad microcode length 0x000015c0 for cpu 0xa210
      (XEN) microcode: Bad microcode length 0x000015c0 for cpu 0xa500
      (XEN) microcode: couldn't find any matching ucode in the provided blob!
    
    Fixes: 4de936a38a ("x86/ucode/amd: Rework parsing logic in cpu_request_microcode()")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/amd.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 3e51e53c1f..500b2ce941 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -349,8 +349,7 @@ static struct microcode_patch *cpu_request_microcode(const void *buf, size_t siz
             if ( size < sizeof(*mc) ||
                  (mc = buf)->type != UCODE_UCODE_TYPE ||
                  size - sizeof(*mc) < mc->len ||
-                 mc->len < sizeof(struct microcode_patch) ||
-                 (!skip_ucode && !verify_patch_size(mc->len)) )
+                 mc->len < sizeof(struct microcode_patch) )
             {
                 printk(XENLOG_ERR "microcode: Bad microcode data\n");
                 error = -EINVAL;
@@ -360,6 +359,19 @@ static struct microcode_patch *cpu_request_microcode(const void *buf, size_t siz
             if ( skip_ucode )
                 goto skip;
 
+            if ( !verify_patch_size(mc->len) )
+            {
+                printk(XENLOG_WARNING
+                       "microcode: Bad microcode length 0x%08x for cpu 0x%04x\n",
+                       mc->len, mc->patch->processor_rev_id);
+                /*
+                 * If the blob size sanity check fails, trust the container
+                 * length which has already been checked to be at least
+                 * plausible at this point.
+                 */
+                goto skip;
+            }
+
             /*
              * If the new ucode covers current CPU, compare ucodes and store the
              * one with higher revision.
@@ -383,6 +395,14 @@ static struct microcode_patch *cpu_request_microcode(const void *buf, size_t siz
             if ( size >= 4 && *(const uint32_t *)buf == UCODE_MAGIC )
                 break;
         }
+
+        /*
+         * Any error means we didn't get cleanly to the end of the microcode
+         * container.  There isn't an overall length field, so we've got no
+         * way of skipping to the next container in the stream.
+         */
+        if ( error )
+            break;
     }
 
     if ( saved )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 10 13:55:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Feb 2021 13:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.83611.156014 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l9pxm-0008EG-5d; Wed, 10 Feb 2021 13:55:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 83611.156014; Wed, 10 Feb 2021 13:55:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l9pxm-0008E8-2a; Wed, 10 Feb 2021 13:55:26 +0000
Received: by outflank-mailman (input) for mailman id 83611;
 Wed, 10 Feb 2021 13:55:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l9pxl-0008Dw-3x
 for xen-changelog@lists.xenproject.org; Wed, 10 Feb 2021 13:55:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l9pxl-00024P-2x
 for xen-changelog@lists.xenproject.org; Wed, 10 Feb 2021 13:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l9pxl-0003eG-1l
 for xen-changelog@lists.xenproject.org; Wed, 10 Feb 2021 13:55:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uOUhzVpRJqwi6WymvFmzcxHgg67QqlBdzsa4GdGYd2M=; b=SAGXiPTQ0tCE8JnTu3JH5IfFcO
	bzTRn5fQtUfleAFbc50NGuW4pzYmt0qrKBEnEVIwwUykzuk+49bG1uPfRZOAw7sWw75vXEm8BtOzx
	dVlruwxFWpYYgevAxPzaXkDWXeD3KrcJvCr1Gja3NFg5jx8dh10PfrrNLFsnX1/PYYNo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/ucode/amd: Fix microcode payload size for Fam19 processors
Message-Id: <E1l9pxl-0003eG-1l@xenbits.xenproject.org>
Date: Wed, 10 Feb 2021 13:55:25 +0000

commit 90b014a6e6ecad036ec5846426afd19b305dedff
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 9 15:28:57 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 10 13:23:51 2021 +0000

    x86/ucode/amd: Fix microcode payload size for Fam19 processors
    
    The original limit provided wasn't accurate.  Blobs are in fact rather larger.
    
    Fixes: fe36a173d1 ("x86/amd: Initial support for Fam19h processors")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/cpu/microcode/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 500b2ce941..809ba4967c 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -111,7 +111,7 @@ static bool verify_patch_size(uint32_t patch_size)
 #define F15H_MPB_MAX_SIZE 4096
 #define F16H_MPB_MAX_SIZE 3458
 #define F17H_MPB_MAX_SIZE 3200
-#define F19H_MPB_MAX_SIZE 4800
+#define F19H_MPB_MAX_SIZE 5568
 
     switch ( boot_cpu_data.x86 )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 10 15:33:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Feb 2021 15:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.83650.156210 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l9rUJ-0001xH-Cv; Wed, 10 Feb 2021 15:33:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 83650.156210; Wed, 10 Feb 2021 15:33:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1l9rUJ-0001x9-9x; Wed, 10 Feb 2021 15:33:07 +0000
Received: by outflank-mailman (input) for mailman id 83650;
 Wed, 10 Feb 2021 15:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l9rUH-0001x4-NJ
 for xen-changelog@lists.xenproject.org; Wed, 10 Feb 2021 15: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 1l9rUH-0003qo-Jo
 for xen-changelog@lists.xenproject.org; Wed, 10 Feb 2021 15:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1l9rUH-0002iN-HM
 for xen-changelog@lists.xenproject.org; Wed, 10 Feb 2021 15:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OIqGk6Gatwlh9+BKQOldqfd0Tv5ZIsjeiAlLp7QjUZw=; b=zypCOSE3C9/0j3mw82v0TWBejy
	j/TQtmKw7M+j9qpwU7JLuK8LEREJPDswiDwweLKRVujDvCiqtE12XUpgB2RBBRh5+a3LDNZP0kxhG
	56oe8T2hqp9mINYzRBnu0DbeN6YZpnJHTSWtp/Kr1GlrrxLJ7vtEor2bKopoY1p0RanI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: rerun autoconf again
Message-Id: <E1l9rUH-0002iN-HM@xenbits.xenproject.org>
Date: Wed, 10 Feb 2021 15:33:05 +0000

commit 01456785ce093d95c6a8515e6b8feeb39e1820b8
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Wed Feb 10 15:30:59 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Wed Feb 10 15:30:59 2021 +0000

    tools: rerun autoconf again
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 tools/config.h.in |   3 +
 tools/configure   | 174 +++++++++++++++++++++++++++++++++++++++++-------------
 2 files changed, 137 insertions(+), 40 deletions(-)

diff --git a/tools/config.h.in b/tools/config.h.in
index 5abf6092de..52e01b2c84 100644
--- a/tools/config.h.in
+++ b/tools/config.h.in
@@ -84,6 +84,9 @@
 /* Define curses header to use */
 #undef INCLUDE_CURSES_H
 
+/* Header path for INCLUDE_ENDIAN_H */
+#undef INCLUDE_ENDIAN_H
+
 /* Define extfs header to use */
 #undef INCLUDE_EXTFS_H
 
diff --git a/tools/configure b/tools/configure
index 419d7b189a..e63ca3797d 100755
--- a/tools/configure
+++ b/tools/configure
@@ -3890,6 +3890,8 @@ esac
 
 
 
+
+
 
 
 
@@ -5400,46 +5402,6 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
-# Extract the first word of "bison", so it can be a program name with args.
-set dummy bison; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_BISON+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $BISON in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_BISON="$BISON" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_BISON="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-BISON=$ac_cv_path_BISON
-if test -n "$BISON"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5
-$as_echo "$BISON" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
 # Extract the first word of "flex", so it can be a program name with args.
 set dummy flex; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -10110,6 +10072,138 @@ else
 fi
 
 
+if test "x$pvshim" = "xy"; then :
+
+    # Extract the first word of "bison", so it can be a program name with args.
+set dummy bison; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BISON+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BISON in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BISON="$BISON" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BISON="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_BISON" && ac_cv_path_BISON="no"
+  ;;
+esac
+fi
+BISON=$ac_cv_path_BISON
+if test -n "$BISON"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5
+$as_echo "$BISON" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${BISON}" = x"no"
+then
+    as_fn_error $? "Unable to find bison, please install bison" "$LINENO" 5
+fi
+
+else
+
+    # Extract the first word of "bison", so it can be a program name with args.
+set dummy bison; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BISON+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BISON in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BISON="$BISON" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BISON="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+BISON=$ac_cv_path_BISON
+if test -n "$BISON"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5
+$as_echo "$BISON" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+fi
+
+
+ax_found=0
+
+    if test "$ax_found" = "0"; then :
+
+        ac_fn_c_check_header_mongrel "$LINENO" "endian.h" "ac_cv_header_endian_h" "$ac_includes_default"
+if test "x$ac_cv_header_endian_h" = xyes; then :
+
+
+$as_echo "#define INCLUDE_ENDIAN_H <endian.h>" >>confdefs.h
+
+            ax_found=1
+fi
+
+
+
+fi
+
+    if test "$ax_found" = "0"; then :
+
+        ac_fn_c_check_header_mongrel "$LINENO" "sys/endian.h" "ac_cv_header_sys_endian_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_endian_h" = xyes; then :
+
+
+$as_echo "#define INCLUDE_ENDIAN_H <sys/endian.h>" >>confdefs.h
+
+            ax_found=1
+fi
+
+
+
+fi
+
+if test "$ax_found" = "0"; then :
+
+    as_fn_error $? "No header found from list endian.h sys/endian.h" "$LINENO" 5
+
+fi
+
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 11 16:55:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Feb 2021 16:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84013.157384 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lAFFC-0001ld-KD; Thu, 11 Feb 2021 16:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84013.157384; Thu, 11 Feb 2021 16:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lAFFC-0001lV-HH; Thu, 11 Feb 2021 16:55:06 +0000
Received: by outflank-mailman (input) for mailman id 84013;
 Thu, 11 Feb 2021 16:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lAFFA-0001lQ-Ro
 for xen-changelog@lists.xenproject.org; Thu, 11 Feb 2021 16:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lAFFA-0008WN-PQ
 for xen-changelog@lists.xenproject.org; Thu, 11 Feb 2021 16:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lAFFA-0004EC-Nx
 for xen-changelog@lists.xenproject.org; Thu, 11 Feb 2021 16:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fULd5VenQKOR2eEBTQyh03Q1BZDK32I/NQ+8adGUxKg=; b=YUloAgOw2RQT5SP9CF71LwuAcg
	GUKGYMWP6YnjSSNdYqp0dk4C557Pn75JdSWwPnruwGdxEQZ1sHF016GFJfIpG0KrUKQ2O143mSoRc
	jOkua0BSb+TqOxpNjCnNuVpLe4G9tUVboweHFytaPKcGxW8c3x3oey8BKEkL3nlkgsbc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: fix SYSENTER/SYSCALL switching into 64-bit mode
Message-Id: <E1lAFFA-0004EC-Nx@xenbits.xenproject.org>
Date: Thu, 11 Feb 2021 16:55:04 +0000

commit f3e1eb2f0234c955243a915d69ebd84f26eec130
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 11 17:53:10 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 11 17:53:10 2021 +0100

    x86emul: fix SYSENTER/SYSCALL switching into 64-bit mode
    
    When invoked by compat mode, mode_64bit() will be false at the start of
    emulation. The logic after complete_insn, however, needs to consider the
    mode switched into, in particular to avoid truncating RIP.
    
    Inspired by / paralleling and extending Linux commit 943dea8af21b ("KVM:
    x86: Update emulator context mode if SYSENTER xfers to 64-bit mode").
    
    While there, tighten a related assertion in x86_emulate_wrapper() - we
    want to be sure to not switch into an impossible mode when the code gets
    built for 32-bit only (as is possible for the test harness).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citirix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 6ac0787745..4a33fe9613 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6127,6 +6127,10 @@ x86_emulate(
              (rc = ops->write_segment(x86_seg_ss, &sreg, ctxt)) )
             goto done;
 
+        if ( ctxt->lma )
+            /* In particular mode_64bit() needs to return true from here on. */
+            ctxt->addr_size = ctxt->sp_size = 64;
+
         /*
          * SYSCALL (unlike most instructions) evaluates its singlestep action
          * based on the resulting EFLAGS.TF, not the starting EFLAGS.TF.
@@ -6927,6 +6931,10 @@ x86_emulate(
                                       ctxt)) != X86EMUL_OKAY )
             goto done;
 
+        if ( ctxt->lma )
+            /* In particular mode_64bit() needs to return true from here on. */
+            ctxt->addr_size = ctxt->sp_size = 64;
+
         singlestep = _regs.eflags & X86_EFLAGS_TF;
         break;
 
@@ -12113,8 +12121,12 @@ int x86_emulate_wrapper(
     unsigned long orig_ip = ctxt->regs->r(ip);
     int rc;
 
+#ifdef __x86_64__
     if ( mode_64bit() )
         ASSERT(ctxt->lma);
+#else
+    ASSERT(!ctxt->lma && !mode_64bit());
+#endif
 
     rc = x86_emulate(ctxt, ops);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 11 17:33:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Feb 2021 17:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84047.157517 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lAFpx-0006UK-VI; Thu, 11 Feb 2021 17:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84047.157517; Thu, 11 Feb 2021 17:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lAFpx-0006UC-S2; Thu, 11 Feb 2021 17:33:05 +0000
Received: by outflank-mailman (input) for mailman id 84047;
 Thu, 11 Feb 2021 17: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 1lAFpw-0006U7-TQ
 for xen-changelog@lists.xenproject.org; Thu, 11 Feb 2021 17:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lAFpw-0000lv-Pu
 for xen-changelog@lists.xenproject.org; Thu, 11 Feb 2021 17:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lAFpw-0001sX-Jk
 for xen-changelog@lists.xenproject.org; Thu, 11 Feb 2021 17:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=trCOCFPEXV0XzOCUkYzdRkNgqyOnT54XAYMY6Kq4VZo=; b=RsJ8VcAzfjsfGaeraGn0tp4dyw
	MHhjtKuslibKALriO0bZYaJ9grqAMomMC8Q6VbdqZH8q+Su9j1Vcvqplm/MKj1bJ0ZVHSpR/lUaZu
	yjptATAp1Poug6kC4KaVMzSbHpRAjO1QhLGArz0VrxdZL/kihxzOoVHzkif8l/j+X+Mc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libxl: Document where the magic MAC numbers come from
Message-Id: <E1lAFpw-0001sX-Jk@xenbits.xenproject.org>
Date: Thu, 11 Feb 2021 17:33:04 +0000

commit 9ca7632bc45cf045fa78a9d7e1275af55240b243
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Feb 10 13:51:21 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 11 17:26:13 2021 +0000

    tools/libxl: Document where the magic MAC numbers come from
    
    Matches the comment in the xl-network-configuration manpage.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/light/libxl_nic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libs/light/libxl_nic.c b/tools/libs/light/libxl_nic.c
index 144e9e23e1..0b45469dca 100644
--- a/tools/libs/light/libxl_nic.c
+++ b/tools/libs/light/libxl_nic.c
@@ -73,6 +73,7 @@ static int libxl__device_nic_setdefault(libxl__gc *gc, uint32_t domid,
         libxl_uuid_generate(&uuid);
         r = libxl_uuid_bytearray(&uuid);
 
+        /* Generate a random MAC address, with Xen's OUI (00:16:3e) */
         nic->mac[0] = 0x00;
         nic->mac[1] = 0x16;
         nic->mac[2] = 0x3e;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 11 17:33:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Feb 2021 17:33:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84048.157521 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lAFq8-0006V9-0G; Thu, 11 Feb 2021 17:33:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84048.157521; Thu, 11 Feb 2021 17:33:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lAFq7-0006V1-Tc; Thu, 11 Feb 2021 17:33:15 +0000
Received: by outflank-mailman (input) for mailman id 84048;
 Thu, 11 Feb 2021 17: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 1lAFq6-0006Ut-Ug
 for xen-changelog@lists.xenproject.org; Thu, 11 Feb 2021 17:33:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lAFq6-0000m6-Ts
 for xen-changelog@lists.xenproject.org; Thu, 11 Feb 2021 17:33:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lAFq6-0001tT-S3
 for xen-changelog@lists.xenproject.org; Thu, 11 Feb 2021 17:33:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WpqBFdw8yRxJMkNWLCFsKhB4HpS9IfxensobhldRjtg=; b=5RyVrS45FOr72Mt6+BAXBTWgOQ
	yfWQ0/Y00KatuDwuXeRf8ktlH8XKJ82H8TFdlYmyZIG5Zyn++/H6q9gayr2M/0xlf6JTyMUcrs0dr
	tvA78E1cHQjLA9vFQXfmgUmLw9On0Q30oYqOokfz4HmMGmKGaqyTiP386x76jgtHAvrM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: Add Ubuntu Focal builds
Message-Id: <E1lAFq6-0001tT-S3@xenbits.xenproject.org>
Date: Thu, 11 Feb 2021 17:33:14 +0000

commit d66cf56fa26a052bce2f8c746dc0dbac9061b593
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 13:25:58 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 11 17:26:13 2021 +0000

    automation: Add Ubuntu Focal builds
    
    Logical continuation of c/s eb52442d7f "automation: Add Ubuntu:focal
    container".
    
    No further changes required.  Everything builds fine.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 automation/gitlab-ci/build.yaml | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index db68dd0b69..d00b8a5123 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -390,6 +390,26 @@ ubuntu-bionic-gcc-debug:
   variables:
     CONTAINER: ubuntu:bionic
 
+ubuntu-focal-gcc:
+  extends: .gcc-x86-64-build
+  variables:
+    CONTAINER: ubuntu:focal
+
+ubuntu-focal-gcc-debug:
+  extends: .gcc-x86-64-build-debug
+  variables:
+    CONTAINER: ubuntu:focal
+
+ubuntu-focal-clang:
+  extends: .gcc-x86-64-build
+  variables:
+    CONTAINER: ubuntu:focal
+
+ubuntu-focal-clang-debug:
+  extends: .gcc-x86-64-build-debug
+  variables:
+    CONTAINER: ubuntu:focal
+
 opensuse-leap-clang:
   extends: .clang-x86-64-build
   variables:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 12 01:55:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Feb 2021 01:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84109.157705 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lANfm-0005HK-Bo; Fri, 12 Feb 2021 01:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84109.157705; Fri, 12 Feb 2021 01:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lANfm-0005HB-8X; Fri, 12 Feb 2021 01:55:06 +0000
Received: by outflank-mailman (input) for mailman id 84109;
 Fri, 12 Feb 2021 01:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lANfk-0005H6-Nd
 for xen-changelog@lists.xenproject.org; Fri, 12 Feb 2021 01:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lANfk-0002gz-K3
 for xen-changelog@lists.xenproject.org; Fri, 12 Feb 2021 01:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lANfk-0007UN-HU
 for xen-changelog@lists.xenproject.org; Fri, 12 Feb 2021 01:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0QZCgszdw8rDXjH6H1XjnBkEJqeXhzRpSwQn68YSPxM=; b=DCBcZoBMEI8hen/wvkkdEwsuQj
	mtgLAUKLrmMRczVOXi1TZtRd3sA0uNb70tmELfKec9GO7aTJQrhurHaULMiaGA5D5Clr216ngvDIz
	SAdK7sPMim7xy8uSjT1Ev3Sg3iqCkp+iUd8is2Iz8m8JP/dJKeoKodBdxUiPO/AkDL9k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: workaround missing device_type property in pci/pcie nodes
Message-Id: <E1lANfk-0007UN-HU@xenbits.xenproject.org>
Date: Fri, 12 Feb 2021 01:55:04 +0000

commit 5a4087004d1adbbb223925f3306db0e5824a2bdc
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Tue Feb 9 11:53:34 2021 -0800
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Feb 11 17:52:36 2021 -0800

    xen: workaround missing device_type property in pci/pcie nodes
    
    PCI buses differ from default buses in a few important ways, so it is
    important to detect them properly. Normally, PCI buses are expected to
    have the following property:
    
        device_type = "pci"
    
    In reality, it is not always the case. To handle PCI bus nodes that
    don't have the device_type property, also consider the node name: if the
    node name is "pcie" or "pci" then consider the bus as a PCI bus.
    
    This commit is based on the Linux kernel commit
    d1ac0002dd29 "of: address: Work around missing device_type property in
    pcie nodes".
    
    This fixes Xen boot on RPi4. Some RPi4 kernels have the following node
    on their device trees:
    
    &pcie0 {
            pci@1,0 {
                    #address-cells = <3>;
                    #size-cells = <2>;
                    ranges;
    
                    reg = <0 0 0 0 0>;
    
                    usb@1,0 {
                            reg = <0x10000 0 0 0 0>;
                            resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>;
                    };
            };
    };
    
    The pci@1,0 node is a PCI bus. If we parse the node and its children as
    a default bus, the reg property under usb@1,0 would have to be
    interpreted as an address range mappable by the CPU, which is not the
    case and would break.
    
    Link: https://lore.kernel.org/xen-devel/YBmQQ3Tzu++AadKx@mattapan.m5p.com/
    [fix style on commit]
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Tested-by: Elliott Mitchell <ehem+xen@m5p.com>
    Tested-by: Jukka Kaartinen <jukka.kaartinen@unikie.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/device_tree.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
index 18825e333e..03d25a81ce 100644
--- a/xen/common/device_tree.c
+++ b/xen/common/device_tree.c
@@ -563,14 +563,28 @@ static unsigned int dt_bus_default_get_flags(const __be32 *addr)
  * PCI bus specific translator
  */
 
+static bool dt_node_is_pci(const struct dt_device_node *np)
+{
+    bool is_pci = !strcmp(np->name, "pcie") || !strcmp(np->name, "pci");
+
+    if ( is_pci )
+        printk(XENLOG_WARNING "%s: Missing device_type\n", np->full_name);
+
+    return is_pci;
+}
+
 static bool_t dt_bus_pci_match(const struct dt_device_node *np)
 {
     /*
      * "pciex" is PCI Express "vci" is for the /chaos bridge on 1st-gen PCI
      * powermacs "ht" is hypertransport
+     *
+     * If none of the device_type match, and that the node name is
+     * "pcie" or "pci", accept the device as PCI (with a warning).
      */
     return !strcmp(np->type, "pci") || !strcmp(np->type, "pciex") ||
-        !strcmp(np->type, "vci") || !strcmp(np->type, "ht");
+        !strcmp(np->type, "vci") || !strcmp(np->type, "ht") ||
+        dt_node_is_pci(np);
 }
 
 static void dt_bus_pci_count_cells(const struct dt_device_node *np,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 12 13:55:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Feb 2021 13:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84284.157997 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lAYuV-0007VQ-Dm; Fri, 12 Feb 2021 13:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84284.157997; Fri, 12 Feb 2021 13:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lAYuV-0007VI-Aq; Fri, 12 Feb 2021 13:55:03 +0000
Received: by outflank-mailman (input) for mailman id 84284;
 Fri, 12 Feb 2021 13:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lAYuU-0007VD-R4
 for xen-changelog@lists.xenproject.org; Fri, 12 Feb 2021 13:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lAYuU-0007OR-PZ
 for xen-changelog@lists.xenproject.org; Fri, 12 Feb 2021 13:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lAYuU-00038b-Nd
 for xen-changelog@lists.xenproject.org; Fri, 12 Feb 2021 13:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qybejTLzQLiUVuW7VS1633Qd2qgex8JmWzsmfN0xegU=; b=nebO2xk4o5a5Mr6j3ikKWVMEq3
	8dAozXhiaccC/R7cg5wxT3NorOs1qW6uXFZQxaEvjrI7XR9SMcB0GvSTiw4mtpWBfwHFpWFLPVy+9
	3vYd0p+IfxUQ3Qsk7Gpwv1aINpE97pF6DFG/FJ73OabKkkA7IScia04/dDOBRujlFyUA=;
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} (again)
Message-Id: <E1lAYuU-00038b-Nd@xenbits.xenproject.org>
Date: Fri, 12 Feb 2021 13:55:02 +0000

commit f1f322610718c40680ac09e66f6c82e69c78ba3a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 4 15:39:45 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 4 15:39:45 2021 +0100

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL} (again)
    
    X86_VENDOR_* aren't bit masks in the older trees.
    
    Reported-by: James Dingwall <james@dingwall.me.uk>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/msr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 927ed625df..aefe0cbb4b 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -226,7 +226,8 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
          */
     case MSR_IA32_PERF_STATUS:
     case MSR_IA32_PERF_CTL:
-        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+        if ( cp->x86_vendor != X86_VENDOR_INTEL &&
+             cp->x86_vendor != X86_VENDOR_CENTAUR )
             goto gp_fault;
 
         *val = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Fri Feb 12 13:55:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Feb 2021 13:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84285.158001 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lAYuf-0007WH-FJ; Fri, 12 Feb 2021 13:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84285.158001; Fri, 12 Feb 2021 13:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lAYuf-0007W9-CM; Fri, 12 Feb 2021 13:55:13 +0000
Received: by outflank-mailman (input) for mailman id 84285;
 Fri, 12 Feb 2021 13:55:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lAYue-0007W3-Uu
 for xen-changelog@lists.xenproject.org; Fri, 12 Feb 2021 13:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lAYue-0007OX-TL
 for xen-changelog@lists.xenproject.org; Fri, 12 Feb 2021 13:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lAYue-00039N-Rb
 for xen-changelog@lists.xenproject.org; Fri, 12 Feb 2021 13:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PvHdrsUhacWAboJ/d+QjbVAZZDYqIaf2sU6DYzSoa4Y=; b=l0LBaFZyiZZkWKgheHs/KZI6dp
	n6PO3JlZeDLQoehK7Hm5Nb9eMEmbiMF5igQfXXvZTMfJo9s6Mbiz61+YzT+68Ir1vCho+8JVfLkoI
	uP5ox5BAuyOS6mSO375xL6RDmPrlZqlb+tWaJmJG6XBawsML0f62APs1z8qicWfDuW18=;
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} (again, part 2)
Message-Id: <E1lAYue-00039N-Rb@xenbits.xenproject.org>
Date: Fri, 12 Feb 2021 13:55:12 +0000

commit 8d26cdd3b66ab86d560dacd763d76ff3da95723e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 5 08:52:54 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 5 08:52:54 2021 +0100

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL} (again, part 2)
    
    X86_VENDOR_* aren't bit masks in the older trees.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/msr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index aefe0cbb4b..f53a186f6c 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -441,7 +441,8 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
          * a cpufreq controller dom0 which has full access.
          */
     case MSR_IA32_PERF_CTL:
-        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+        if ( cp->x86_vendor != X86_VENDOR_INTEL &&
+             cp->x86_vendor != X86_VENDOR_CENTAUR )
             goto gp_fault;
 
         if ( likely(!is_cpufreq_controller(d)) || wrmsr_safe(msr, val) == 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Fri Feb 12 19:11:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Feb 2021 19:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84428.158343 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lAdqM-0006NJ-Dh; Fri, 12 Feb 2021 19:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84428.158343; Fri, 12 Feb 2021 19:11:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lAdqM-0006NB-Aq; Fri, 12 Feb 2021 19:11:06 +0000
Received: by outflank-mailman (input) for mailman id 84428;
 Fri, 12 Feb 2021 19:11:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lAdqK-0006N6-Rq
 for xen-changelog@lists.xenproject.org; Fri, 12 Feb 2021 19:11:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lAdqK-0004mz-OS
 for xen-changelog@lists.xenproject.org; Fri, 12 Feb 2021 19:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lAdqK-00083I-NO
 for xen-changelog@lists.xenproject.org; Fri, 12 Feb 2021 19:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XksWCRURSJQdcJqqrkChGNprLzyCIJWmLGlNQlsTsME=; b=mvxYu96uFmr0Q3lr88BFUANPZv
	nG0ncXzJROs6n6a8lWsRkh2mpBmxy4HWVQwVd8AwWpT48onJt9arEm/XUzxi2LawLDJ4/SF3UBYeZ
	ztmAu8i88GZpaEQDhaJeYEPdmlewwNosKV4g0GjyyA4rdqrT0vzuuI8lvVILf6TdGHbE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: fix gnttab_need_iommu_mapping
Message-Id: <E1lAdqK-00083I-NO@xenbits.xenproject.org>
Date: Fri, 12 Feb 2021 19:11:04 +0000

commit 04085ec1ac05a362812e9b0c6b5a8713d7dc88ad
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Mon Feb 8 10:49:32 2021 -0800
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Fri Feb 12 11:01:41 2021 -0800

    xen/arm: fix gnttab_need_iommu_mapping
    
    Commit 91d4eca7add broke gnttab_need_iommu_mapping on ARM.
    The offending chunk is:
    
     #define gnttab_need_iommu_mapping(d)                    \
    -    (is_domain_direct_mapped(d) && need_iommu(d))
    +    (is_domain_direct_mapped(d) && need_iommu_pt_sync(d))
    
    On ARM we need gnttab_need_iommu_mapping to be true for dom0 when it is
    directly mapped and IOMMU is enabled for the domain, like the old check
    did, but the new check is always false.
    
    In fact, need_iommu_pt_sync is defined as dom_iommu(d)->need_sync and
    need_sync is set as:
    
        if ( !is_hardware_domain(d) || iommu_hwdom_strict )
            hd->need_sync = !iommu_use_hap_pt(d);
    
    iommu_use_hap_pt(d) means that the page-table used by the IOMMU is the
    P2M. It is true on ARM. need_sync means that you have a separate IOMMU
    page-table and it needs to be updated for every change. need_sync is set
    to false on ARM. Hence, gnttab_need_iommu_mapping(d) is false too,
    which is wrong.
    
    As a consequence, when using PV network from a domU on a system where
    IOMMU is on from Dom0, I get:
    
    (XEN) smmu: /smmu@fd800000: Unhandled context fault: fsr=0x402, iova=0x8424cb148, fsynr=0xb0001, cb=0
    [   68.290307] macb ff0e0000.ethernet eth0: DMA bus error: HRESP not OK
    
    The fix is to go back to something along the lines of the old
    implementation of gnttab_need_iommu_mapping.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Fixes: 91d4eca7add ("mm / iommu: split need_iommu() into has_iommu_pt() and need_iommu_pt_sync()")
    Backport: 4.13+
---
 xen/include/asm-arm/grant_table.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/asm-arm/grant_table.h b/xen/include/asm-arm/grant_table.h
index 6f585b1538..0ce77f9a1c 100644
--- a/xen/include/asm-arm/grant_table.h
+++ b/xen/include/asm-arm/grant_table.h
@@ -89,7 +89,7 @@ int replace_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
     (((i) >= nr_status_frames(t)) ? INVALID_GFN : (t)->arch.status_gfn[i])
 
 #define gnttab_need_iommu_mapping(d)                    \
-    (is_domain_direct_mapped(d) && need_iommu_pt_sync(d))
+    (is_domain_direct_mapped(d) && is_iommu_enabled(d))
 
 #endif /* __ASM_GRANT_TABLE_H__ */
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Feb 13 08:55:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Feb 2021 08:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84542.158587 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lAqhj-0002AG-DD; Sat, 13 Feb 2021 08:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84542.158587; Sat, 13 Feb 2021 08:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lAqhj-0002A8-9v; Sat, 13 Feb 2021 08:55:03 +0000
Received: by outflank-mailman (input) for mailman id 84542;
 Sat, 13 Feb 2021 08: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 1lAqhi-0002A2-Lv
 for xen-changelog@lists.xenproject.org; Sat, 13 Feb 2021 08: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 1lAqhi-0004qQ-L2
 for xen-changelog@lists.xenproject.org; Sat, 13 Feb 2021 08:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lAqhi-0007rz-JZ
 for xen-changelog@lists.xenproject.org; Sat, 13 Feb 2021 08:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/LrY68pWC5ZgOYhse0qdOOpvT1jI/BNgSouxfHraXtE=; b=hD6PWKX0UO6ept+LKurYlen3k5
	XJdAh5cqP8cjQau6MZwd8Z0wDd2nTsI31JSsiUt1dlSgPPtyvCv5Wn0VEASEsjeHb89w2fH5oQF6i
	u17AH/CyyBh1lMrD3jP7r4hLALzdbXwXFGdNjP3qaTiXF6XGbJISRGDcK238ZF1mLZm4=;
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} (again)
Message-Id: <E1lAqhi-0007rz-JZ@xenbits.xenproject.org>
Date: Sat, 13 Feb 2021 08:55:02 +0000

commit f9090d990e201a5ca045976b8ddaab9fa6ee69dd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 4 15:41:12 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 4 15:41:12 2021 +0100

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL} (again)
    
    X86_VENDOR_* aren't bit masks in the older trees.
    
    Reported-by: James Dingwall <james@dingwall.me.uk>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/msr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 99c848ff41..1afb80427c 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -232,7 +232,8 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
          */
     case MSR_IA32_PERF_STATUS:
     case MSR_IA32_PERF_CTL:
-        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+        if ( cp->x86_vendor != X86_VENDOR_INTEL &&
+             cp->x86_vendor != X86_VENDOR_CENTAUR )
             goto gp_fault;
 
         *val = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Sat Feb 13 08:55:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Feb 2021 08:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84543.158592 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lAqht-0002BV-EF; Sat, 13 Feb 2021 08:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84543.158592; Sat, 13 Feb 2021 08:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lAqht-0002BN-BN; Sat, 13 Feb 2021 08:55:13 +0000
Received: by outflank-mailman (input) for mailman id 84543;
 Sat, 13 Feb 2021 08: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 1lAqhs-0002B0-Pk
 for xen-changelog@lists.xenproject.org; Sat, 13 Feb 2021 08: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 1lAqhs-0004qp-Ov
 for xen-changelog@lists.xenproject.org; Sat, 13 Feb 2021 08:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lAqhs-0007t1-N8
 for xen-changelog@lists.xenproject.org; Sat, 13 Feb 2021 08:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LHtXp/3393G6tzHKdgn8MgKJLSED4Lp0OINEOPeGa5o=; b=Zel4JBL56Fy+EmWq5r434E3KUA
	Q0/pBSzk+XrBL7OO2l9Y79ILkjUIHXl0jg/xjtPo6k9OxITWwRy10Hc45U7rsncu2jeLhViOceN3I
	2CDfXZKx14UWKq6rhAVPnRw0kbaB4pboge/kbiL+teoChww9EJv13POseVsEe/20/nPA=;
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} (again, part 2)
Message-Id: <E1lAqhs-0007t1-N8@xenbits.xenproject.org>
Date: Sat, 13 Feb 2021 08:55:12 +0000

commit 1c7d984645f9ade9b47e862b5880734ad498fea8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 5 08:54:03 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 5 08:54:03 2021 +0100

    x86/msr: fix handling of MSR_IA32_PERF_{STATUS/CTL} (again, part 2)
    
    X86_VENDOR_* aren't bit masks in the older trees.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/msr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 1afb80427c..c028fbdcf4 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -393,7 +393,8 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
          * a cpufreq controller dom0 which has full access.
          */
     case MSR_IA32_PERF_CTL:
-        if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+        if ( cp->x86_vendor != X86_VENDOR_INTEL &&
+             cp->x86_vendor != X86_VENDOR_CENTAUR )
             goto gp_fault;
 
         if ( likely(!is_cpufreq_controller(d)) || wrmsr_safe(msr, val) == 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:33:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84739.158845 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6HY-0002vp-IZ; Sun, 14 Feb 2021 01:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84739.158845; Sun, 14 Feb 2021 01:33:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6HY-0002vg-EZ; Sun, 14 Feb 2021 01:33:04 +0000
Received: by outflank-mailman (input) for mailman id 84739;
 Sun, 14 Feb 2021 01: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 1lB6HW-0002vb-Tp
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01: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 1lB6HW-0006sQ-Sk
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6HW-0005dH-RM
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dGz9PM9LaPboyqf4iKZhZfBfiT2NUTmaNXKni5V2BYY=; b=aCUDhptt0HP4G3GLhq+n78ap1q
	NjHktaL8xzZpA/e3N2/AeKyZVwDfJMhgSJYJTbe2zbHSMbN4vLhK0JlUnTKcIufXgiUd7IFBFz2ad
	NyT7/snhVZHos0A333P1hPfvlmKGfjfNPsaMqrlgw069J5DcLu/Wb6lU6YwRES6PJhh0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/tests: fix resource test build on FreeBSD
Message-Id: <E1lB6HW-0005dH-RM@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:33:02 +0000

commit d7acc47c8201611fda98ce5bd465626478ca4759
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Feb 5 13:19:38 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 12:52:19 2021 +0000

    tools/tests: fix resource test build on FreeBSD
    
    error.h is not a standard header, and none of the functions declared
    there are actually used by the code. This fixes the build on FreeBSD
    that doesn't have error.h
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/resource/test-resource.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/tests/resource/test-resource.c b/tools/tests/resource/test-resource.c
index a409a82f44..1caaa60e62 100644
--- a/tools/tests/resource/test-resource.c
+++ b/tools/tests/resource/test-resource.c
@@ -1,6 +1,5 @@
 #include <err.h>
 #include <errno.h>
-#include <error.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/mman.h>
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:33:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84740.158850 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Hi-0002wU-K6; Sun, 14 Feb 2021 01:33:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84740.158850; Sun, 14 Feb 2021 01:33:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Hi-0002wN-GA; Sun, 14 Feb 2021 01:33:14 +0000
Received: by outflank-mailman (input) for mailman id 84740;
 Sun, 14 Feb 2021 01: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 1lB6Hh-0002wH-0p
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01: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 1lB6Hh-0006sY-0A
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:33:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Hg-0005dz-VU
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xWm7EpYPeSEZjzxVYon/wtn1UI8AdFjiT65DUIf+gB0=; b=y6cwwGUS7G5qN50QWh0xnY0hef
	kb6QR57EbIft3NLEsFyklOuKqnu3ue/EdjVRppiT6Ty1TQVKUdNC9F71Civg2aAYbQLp6q7UQ0OHM
	S6Dtdjf57s+kz4mCtBfLOzRMiQNKBPC1uQ9SIXcerDQYhT0LmJvTExsVOC3BU+4WaPMw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/EFI: work around GNU ld 2.36 issue
Message-Id: <E1lB6Hg-0005dz-VU@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:33:12 +0000

commit f4318db940c39cc656128fcf72df3e79d2e55bc1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 5 14:09:42 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 5 14:09:42 2021 +0100

    x86/EFI: work around GNU ld 2.36 issue
    
    Our linker capability check fails with the recent binutils release's ld:
    
    .../check.o:(.debug_aranges+0x6): relocation truncated to fit: R_X86_64_32 against `.debug_info'
    .../check.o:(.debug_info+0x6): relocation truncated to fit: R_X86_64_32 against `.debug_abbrev'
    .../check.o:(.debug_info+0xc): relocation truncated to fit: R_X86_64_32 against `.debug_str'+76
    .../check.o:(.debug_info+0x11): relocation truncated to fit: R_X86_64_32 against `.debug_str'+d
    .../check.o:(.debug_info+0x15): relocation truncated to fit: R_X86_64_32 against `.debug_str'+2b
    .../check.o:(.debug_info+0x29): relocation truncated to fit: R_X86_64_32 against `.debug_line'
    .../check.o:(.debug_info+0x30): relocation truncated to fit: R_X86_64_32 against `.debug_str'+19
    .../check.o:(.debug_info+0x37): relocation truncated to fit: R_X86_64_32 against `.debug_str'+71
    .../check.o:(.debug_info+0x3e): relocation truncated to fit: R_X86_64_32 against `.debug_str'
    .../check.o:(.debug_info+0x45): relocation truncated to fit: R_X86_64_32 against `.debug_str'+5e
    .../check.o:(.debug_info+0x4c): additional relocation overflows omitted from the output
    
    Tell the linker to strip debug info as a workaround. Debug info has been
    getting stripped already anyway when linking the actual xen.efi.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 3a9b7e7b2e..dff597f30c 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -123,7 +123,7 @@ ifneq ($(efi-y),)
 # Check if the compiler supports the MS ABI.
 export XEN_BUILD_EFI := $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o efi/check.o 2>/dev/null && echo y)
 # Check if the linker supports PE.
-XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) -mi386pep --subsystem=10 -o efi/check.efi efi/check.o 2>/dev/null && echo y))
+XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) -mi386pep --subsystem=10 -S -o efi/check.efi efi/check.o 2>/dev/null && echo y))
 CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
 endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:33:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84741.158853 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Hr-0002xg-L4; Sun, 14 Feb 2021 01:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84741.158853; Sun, 14 Feb 2021 01:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Hr-0002xW-Hf; Sun, 14 Feb 2021 01:33:23 +0000
Received: by outflank-mailman (input) for mailman id 84741;
 Sun, 14 Feb 2021 01: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 1lB6Hr-0002xP-4T
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01: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 1lB6Hr-0006t0-3e
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:33:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Hr-0005fI-2d
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:33:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9piuKXinufATlWFFkdPlgbnYcG4UegoXt1O8P2rlz+g=; b=Hzk9nDGj1xqlsJh7WlEN8/LbYu
	JwQIbsMmdashsV2EM+jzkvj0GM97niX0k7nVIeIibhk+hT0svWikmBUetxBCznNYvR36bF12FCjX3
	culJB4neJU2/wM6/or146L51cFfKZw0Xrcknm3XrExBOxxXJ717XeUdaS5o8k7kS2ezg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/memory: Fix mapping grant tables with XENMEM_acquire_resource
Message-Id: <E1lB6Hr-0005fI-2d@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:33:23 +0000

commit 34cc2e5f8dba6906da82fe8d76e839f9ab20f153
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jul 27 17:24:11 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:27 2021 +0000

    xen/memory: Fix mapping grant tables with XENMEM_acquire_resource
    
    A guest's default number of grant frames is 64, and XENMEM_acquire_resource
    will reject an attempt to map more than 32 frames.  This limit is caused by
    the size of mfn_list[] on the stack.
    
    Fix mapping of arbitrary size requests by looping over batches of 32 in
    acquire_resource(), and using hypercall continuations when necessary.
    
    To start with, break _acquire_resource() out of acquire_resource() to cope
    with type-specific dispatching, and update the return semantics to indicate
    the number of mfns returned.  Update gnttab_acquire_resource() and x86's
    arch_acquire_resource() to match these new semantics.
    
    Have do_memory_op() pass start_extent into acquire_resource() so it can pick
    up where it left off after a continuation, and loop over batches of 32 until
    all the work is done, or a continuation needs to occur.
    
    compat_memory_op() is a bit more complicated, because it also has to marshal
    frame_list in the XLAT buffer.  Have it account for continuation information
    itself and hide details from the upper layer, so it can marshal the buffer in
    chunks if necessary.
    
    With these fixes in place, it is now possible to map the whole grant table for
    a guest.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/common/compat/memory.c | 114 +++++++++++++++++++++++++++++++++--------
 xen/common/grant_table.c   |   3 ++
 xen/common/memory.c        | 124 +++++++++++++++++++++++++++++++++------------
 3 files changed, 187 insertions(+), 54 deletions(-)

diff --git a/xen/common/compat/memory.c b/xen/common/compat/memory.c
index 834c5e19d1..c43fa97cf1 100644
--- a/xen/common/compat/memory.c
+++ b/xen/common/compat/memory.c
@@ -402,23 +402,10 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat)
         case XENMEM_acquire_resource:
         {
             xen_pfn_t *xen_frame_list = NULL;
-            unsigned int max_nr_frames;
 
             if ( copy_from_guest(&cmp.mar, compat, 1) )
                 return -EFAULT;
 
-            /*
-             * The number of frames handled is currently limited to a
-             * small number by the underlying implementation, so the
-             * scratch space should be sufficient for bouncing the
-             * frame addresses.
-             */
-            max_nr_frames = (COMPAT_ARG_XLAT_SIZE - sizeof(*nat.mar)) /
-                sizeof(*xen_frame_list);
-
-            if ( cmp.mar.nr_frames > max_nr_frames )
-                return -E2BIG;
-
             /* Marshal the frame list in the remainder of the xlat space. */
             if ( !compat_handle_is_null(cmp.mar.frame_list) )
                 xen_frame_list = (xen_pfn_t *)(nat.mar + 1);
@@ -432,6 +419,28 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat)
 
             if ( xen_frame_list && cmp.mar.nr_frames )
             {
+                unsigned int xlat_max_frames =
+                    (COMPAT_ARG_XLAT_SIZE - sizeof(*nat.mar)) /
+                    sizeof(*xen_frame_list);
+
+                if ( start_extent >= cmp.mar.nr_frames )
+                    return -EINVAL;
+
+                /*
+                 * Adjust nat to account for work done on previous
+                 * continuations, leaving cmp pristine.  Hide the continaution
+                 * from the native code to prevent double accounting.
+                 */
+                nat.mar->nr_frames -= start_extent;
+                nat.mar->frame += start_extent;
+                cmd &= MEMOP_CMD_MASK;
+
+                /*
+                 * If there are two many frames to fit within the xlat buffer,
+                 * we'll need to loop to marshal them all.
+                 */
+                nat.mar->nr_frames = min(nat.mar->nr_frames, xlat_max_frames);
+
                 /*
                  * frame_list is an input for translated guests, and an output
                  * for untranslated guests.  Only copy in for translated guests.
@@ -444,14 +453,14 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat)
                                              cmp.mar.nr_frames) ||
                          __copy_from_compat_offset(
                              compat_frame_list, cmp.mar.frame_list,
-                             0, cmp.mar.nr_frames) )
+                             start_extent, nat.mar->nr_frames) )
                         return -EFAULT;
 
                     /*
                      * Iterate backwards over compat_frame_list[] expanding
                      * compat_pfn_t to xen_pfn_t in place.
                      */
-                    for ( int x = cmp.mar.nr_frames - 1; x >= 0; --x )
+                    for ( int x = nat.mar->nr_frames - 1; x >= 0; --x )
                         xen_frame_list[x] = compat_frame_list[x];
                 }
             }
@@ -600,9 +609,11 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat)
         case XENMEM_acquire_resource:
         {
             DEFINE_XEN_GUEST_HANDLE(compat_mem_acquire_resource_t);
+            unsigned int done;
 
             if ( compat_handle_is_null(cmp.mar.frame_list) )
             {
+                ASSERT(split == 0 && rc == 0);
                 if ( __copy_field_to_guest(
                          guest_handle_cast(compat,
                                            compat_mem_acquire_resource_t),
@@ -611,6 +622,21 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat)
                 break;
             }
 
+            if ( split < 0 )
+            {
+                /* Continuation occurred. */
+                ASSERT(rc != XENMEM_acquire_resource);
+                done = cmd >> MEMOP_EXTENT_SHIFT;
+            }
+            else
+            {
+                /* No continuation. */
+                ASSERT(rc == 0);
+                done = nat.mar->nr_frames;
+            }
+
+            ASSERT(done <= nat.mar->nr_frames);
+
             /*
              * frame_list is an input for translated guests, and an output for
              * untranslated guests.  Only copy out for untranslated guests.
@@ -626,21 +652,67 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat)
                  */
                 BUILD_BUG_ON(sizeof(compat_pfn_t) > sizeof(xen_pfn_t));
 
-                for ( i = 0; i < cmp.mar.nr_frames; i++ )
+                rc = 0;
+                for ( i = 0; i < done; i++ )
                 {
                     compat_pfn_t frame = xen_frame_list[i];
 
                     if ( frame != xen_frame_list[i] )
-                        return -ERANGE;
+                    {
+                        rc = -ERANGE;
+                        break;
+                    }
 
                     compat_frame_list[i] = frame;
                 }
 
-                if ( __copy_to_compat_offset(cmp.mar.frame_list, 0,
-                                             compat_frame_list,
-                                             cmp.mar.nr_frames) )
-                    return -EFAULT;
+                if ( !rc && __copy_to_compat_offset(
+                         cmp.mar.frame_list, start_extent,
+                         compat_frame_list, done) )
+                    rc = -EFAULT;
+
+                if ( rc )
+                {
+                    if ( split < 0 )
+                    {
+                        gdprintk(XENLOG_ERR,
+                                 "Cannot cancel continuation: %ld\n", rc);
+                        domain_crash(current->domain);
+                    }
+                    return rc;
+                }
+            }
+
+            start_extent += done;
+
+            /* Completely done. */
+            if ( start_extent == cmp.mar.nr_frames )
+                break;
+
+            /*
+             * Done a "full" batch, but we were limited by space in the xlat
+             * area.  Go around the loop again without necesserily returning
+             * to guest context.
+             */
+            if ( done == nat.mar->nr_frames )
+            {
+                split = 1;
+                break;
             }
+
+            /* Explicit continuation request from a higher level. */
+            if ( done < nat.mar->nr_frames )
+                return hypercall_create_continuation(
+                    __HYPERVISOR_memory_op, "ih",
+                    op | (start_extent << MEMOP_EXTENT_SHIFT), compat);
+
+            /*
+             * Well... Somethings gone wrong with the two levels of chunking.
+             * My condolences to whomever next has to debug this mess.
+             */
+            ASSERT_UNREACHABLE();
+            domain_crash(current->domain);
+            split = 0;
             break;
         }
 
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 280b7969b6..b95403695f 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -4053,6 +4053,9 @@ int gnttab_acquire_resource(
     for ( i = 0; i < nr_frames; ++i )
         mfn_list[i] = virt_to_mfn(vaddrs[frame + i]);
 
+    /* Success.  Passed nr_frames back to the caller. */
+    rc = nr_frames;
+
  out:
     grant_write_unlock(gt);
 
diff --git a/xen/common/memory.c b/xen/common/memory.c
index f23b001fd2..7b012ce291 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -1129,23 +1129,41 @@ static int acquire_ioreq_server(struct domain *d,
         mfn_list[i] = mfn_x(mfn);
     }
 
-    return 0;
+    /* Success.  Passed nr_frames back to the caller. */
+    return nr_frames;
 #else
     return -EOPNOTSUPP;
 #endif
 }
 
+/*
+ * Returns -errno on error, or positive in the range [1, nr_frames] on
+ * success.  Returning less than nr_frames contitutes a request for a
+ * continuation.  Callers can depend on frame + nr_frames not overflowing.
+ */
+static int _acquire_resource(
+    struct domain *d, unsigned int type, unsigned int id, unsigned int frame,
+    unsigned int nr_frames, xen_pfn_t mfn_list[])
+{
+    switch ( type )
+    {
+    case XENMEM_resource_grant_table:
+        return gnttab_acquire_resource(d, id, frame, nr_frames, mfn_list);
+
+    case XENMEM_resource_ioreq_server:
+        return acquire_ioreq_server(d, id, frame, nr_frames, mfn_list);
+
+    default:
+        return -EOPNOTSUPP;
+    }
+}
+
 static int acquire_resource(
-    XEN_GUEST_HANDLE_PARAM(xen_mem_acquire_resource_t) arg)
+    XEN_GUEST_HANDLE_PARAM(xen_mem_acquire_resource_t) arg,
+    unsigned long start_extent)
 {
     struct domain *d, *currd = current->domain;
     xen_mem_acquire_resource_t xmar;
-    /*
-     * The mfn_list and gfn_list (below) arrays are ok on stack for the
-     * moment since they are small, but if they need to grow in future
-     * use-cases then per-CPU arrays or heap allocations may be required.
-     */
-    xen_pfn_t mfn_list[32];
     unsigned int max_frames;
     int rc;
 
@@ -1158,9 +1176,6 @@ static int acquire_resource(
     if ( xmar.pad != 0 )
         return -EINVAL;
 
-    if ( xmar.nr_frames > ARRAY_SIZE(mfn_list) )
-        return -E2BIG;
-
     /*
      * The ABI is rather unfortunate.  nr_frames (and therefore the total size
      * of the resource) is 32bit, while frame (the offset within the resource
@@ -1190,7 +1205,7 @@ static int acquire_resource(
 
     if ( guest_handle_is_null(xmar.frame_list) )
     {
-        if ( xmar.nr_frames )
+        if ( xmar.nr_frames || start_extent )
             goto out;
 
         xmar.nr_frames = max_frames;
@@ -1198,30 +1213,47 @@ static int acquire_resource(
         goto out;
     }
 
-    do {
-        switch ( xmar.type )
-        {
-        case XENMEM_resource_grant_table:
-            rc = gnttab_acquire_resource(d, xmar.id, xmar.frame, xmar.nr_frames,
-                                         mfn_list);
-            break;
+    /*
+     * Limiting nr_frames at (UINT_MAX >> MEMOP_EXTENT_SHIFT) isn't ideal.  If
+     * it ever becomes a practical problem, we can switch to mutating
+     * xmar.{frame,nr_frames,frame_list} in guest memory.
+     */
+    rc = -EINVAL;
+    if ( start_extent >= xmar.nr_frames ||
+         xmar.nr_frames > (UINT_MAX >> MEMOP_EXTENT_SHIFT) )
+        goto out;
 
-        case XENMEM_resource_ioreq_server:
-            rc = acquire_ioreq_server(d, xmar.id, xmar.frame, xmar.nr_frames,
-                                      mfn_list);
-            break;
+    /* Adjust for work done on previous continuations. */
+    xmar.nr_frames -= start_extent;
+    xmar.frame += start_extent;
+    guest_handle_add_offset(xmar.frame_list, start_extent);
 
-        default:
-            rc = -EOPNOTSUPP;
-            break;
-        }
+    do {
+        /*
+         * Arbitrary size.  Not too much stack space, and a reasonable stride
+         * for continuation checks.
+         */
+        xen_pfn_t mfn_list[32];
+        unsigned int todo = MIN(ARRAY_SIZE(mfn_list), xmar.nr_frames), done;
 
-        if ( rc )
+        rc = _acquire_resource(d, xmar.type, xmar.id, xmar.frame,
+                               todo, mfn_list);
+        if ( rc < 0 )
+            goto out;
+
+        done = rc;
+        rc = 0;
+        if ( done == 0 || done > todo )
+        {
+            ASSERT_UNREACHABLE();
+            rc = -EINVAL;
             goto out;
+        }
 
+        /* Adjust guest frame_list appropriately. */
         if ( !paging_mode_translate(currd) )
         {
-            if ( copy_to_guest(xmar.frame_list, mfn_list, xmar.nr_frames) )
+            if ( copy_to_guest(xmar.frame_list, mfn_list, done) )
                 rc = -EFAULT;
         }
         else
@@ -1229,10 +1261,10 @@ static int acquire_resource(
             xen_pfn_t gfn_list[ARRAY_SIZE(mfn_list)];
             unsigned int i;
 
-            if ( copy_from_guest(gfn_list, xmar.frame_list, xmar.nr_frames) )
+            if ( copy_from_guest(gfn_list, xmar.frame_list, done) )
                 rc = -EFAULT;
 
-            for ( i = 0; !rc && i < xmar.nr_frames; i++ )
+            for ( i = 0; !rc && i < done; i++ )
             {
                 rc = set_foreign_p2m_entry(currd, d, gfn_list[i],
                                            _mfn(mfn_list[i]));
@@ -1241,7 +1273,32 @@ static int acquire_resource(
                     rc = -EIO;
             }
         }
-    } while ( 0 );
+
+        if ( rc )
+            goto out;
+
+        xmar.nr_frames -= done;
+        xmar.frame += done;
+        guest_handle_add_offset(xmar.frame_list, done);
+        start_extent += done;
+
+        /*
+         * Explicit continuation request from _acquire_resource(), or we've
+         * still got more work to do.
+         */
+        if ( done < todo ||
+             (xmar.nr_frames && hypercall_preempt_check()) )
+        {
+            rc = hypercall_create_continuation(
+                __HYPERVISOR_memory_op, "lh",
+                XENMEM_acquire_resource | (start_extent << MEMOP_EXTENT_SHIFT),
+                arg);
+            goto out;
+        }
+
+    } while ( xmar.nr_frames );
+
+    rc = 0;
 
  out:
     rcu_unlock_domain(d);
@@ -1708,7 +1765,8 @@ long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
     case XENMEM_acquire_resource:
         rc = acquire_resource(
-            guest_handle_cast(arg, xen_mem_acquire_resource_t));
+            guest_handle_cast(arg, xen_mem_acquire_resource_t),
+            start_extent);
         break;
 
     default:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:33:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84742.158857 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6I1-0002zH-N4; Sun, 14 Feb 2021 01:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84742.158857; Sun, 14 Feb 2021 01:33:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6I1-0002z9-JN; Sun, 14 Feb 2021 01:33:33 +0000
Received: by outflank-mailman (input) for mailman id 84742;
 Sun, 14 Feb 2021 01: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 1lB6I1-0002z2-83
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01: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 1lB6I1-0006tA-7F
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:33:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6I1-0005fx-6A
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:33:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=y898aNivWlaeLd32LVcmhM+z14L/Zc2NXrQ4YRK64DA=; b=EOaX+OooXQokvaraWk20tBUnkg
	C2r2KP10dB2nudwbNdT59vur8+QMF1QdBqMq9u/J3JI4yKSwYxQLK8UYYnjJDNdmdd6O9Rqy1lnJk
	bPWXpGijEKNQf4gviUFDmfdRl9BotWwARtI7F4wCWARtNnszE4ewfC8SnWevhChI6Xdg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/domain: Add vmtrace_size domain creation parameter
Message-Id: <E1lB6I1-0005fx-6A@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:33:33 +0000

commit 217dd79ee29286b85074d22cc75ee064206fb2af
Author:     Michał Leszczyński <michal.leszczynski@cert.pl>
AuthorDate: Fri Jul 3 01:16:10 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:27 2021 +0000

    xen/domain: Add vmtrace_size domain creation parameter
    
    To use vmtrace, buffers of a suitable size need allocating, and different
    tasks will want different sizes.
    
    Add a domain creation parameter, and audit it appropriately in the
    {arch_,}sanitise_domain_config() functions.
    
    For now, the x86 specific auditing is tuned to Processor Trace running in
    Single Output mode, which requires a single contiguous range of memory.
    
    The size is given an arbitrary limit of 64M which is expected to be enough for
    anticipated usecases, but not large enough to get into long-running-hypercall
    problems.
    
    Signed-off-by: Michał Leszczyński <michal.leszczynski@cert.pl>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/domain.c       | 23 ++++++++++++++
 xen/common/domain.c         | 77 +++++++++++++++++++++++++++++++++++++++++++++
 xen/include/public/domctl.h |  3 ++
 xen/include/xen/sched.h     |  6 ++++
 4 files changed, 109 insertions(+)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index b9ba04633e..6c7ee25f3b 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -660,6 +660,29 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
         return -EINVAL;
     }
 
+    if ( config->vmtrace_size )
+    {
+        unsigned int size = config->vmtrace_size;
+
+        ASSERT(vmtrace_available); /* Checked by common code. */
+
+        /*
+         * For now, vmtrace is restricted to HVM guests, and using a
+         * power-of-2 buffer between 4k and 64M in size.
+         */
+        if ( !hvm )
+        {
+            dprintk(XENLOG_INFO, "vmtrace not supported for PV\n");
+            return -EINVAL;
+        }
+
+        if ( size < PAGE_SIZE || size > MB(64) || (size & (size - 1)) )
+        {
+            dprintk(XENLOG_INFO, "Unsupported vmtrace size: %#x\n", size);
+            return -EINVAL;
+        }
+    }
+
     return 0;
 }
 
diff --git a/xen/common/domain.c b/xen/common/domain.c
index d1e94d88cf..d85984638a 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -132,6 +132,69 @@ static void vcpu_info_reset(struct vcpu *v)
     v->vcpu_info_mfn = INVALID_MFN;
 }
 
+static void vmtrace_free_buffer(struct vcpu *v)
+{
+    const struct domain *d = v->domain;
+    struct page_info *pg = v->vmtrace.pg;
+    unsigned int i;
+
+    if ( !pg )
+        return;
+
+    v->vmtrace.pg = NULL;
+
+    for ( i = 0; i < (d->vmtrace_size >> PAGE_SHIFT); i++ )
+    {
+        put_page_alloc_ref(&pg[i]);
+        put_page_and_type(&pg[i]);
+    }
+}
+
+static int vmtrace_alloc_buffer(struct vcpu *v)
+{
+    struct domain *d = v->domain;
+    struct page_info *pg;
+    unsigned int i;
+
+    if ( !d->vmtrace_size )
+        return 0;
+
+    pg = alloc_domheap_pages(d, get_order_from_bytes(d->vmtrace_size),
+                             MEMF_no_refcount);
+    if ( !pg )
+        return -ENOMEM;
+
+    for ( i = 0; i < (d->vmtrace_size >> PAGE_SHIFT); i++ )
+        if ( unlikely(!get_page_and_type(&pg[i], d, PGT_writable_page)) )
+            /*
+             * The domain can't possibly know about this page yet, so failure
+             * here is a clear indication of something fishy going on.
+             */
+            goto refcnt_err;
+
+    /*
+     * We must only let vmtrace_free_buffer() take any action in the success
+     * case when we've taken all the refs it intends to drop.
+     */
+    v->vmtrace.pg = pg;
+    return 0;
+
+ refcnt_err:
+    /*
+     * We can theoretically reach this point if someone has taken 2^43 refs on
+     * the frames in the time the above loop takes to execute, or someone has
+     * made a blind decrease reservation hypercall and managed to pick the
+     * right mfn.  Free the memory we safely can, and leak the rest.
+     */
+    while ( i-- )
+    {
+        put_page_alloc_ref(&pg[i]);
+        put_page_and_type(&pg[i]);
+    }
+
+    return -ENODATA;
+}
+
 /*
  * Release resources held by a vcpu.  There may or may not be live references
  * to the vcpu, and it may or may not be fully constructed.
@@ -140,6 +203,8 @@ static void vcpu_info_reset(struct vcpu *v)
  */
 static int vcpu_teardown(struct vcpu *v)
 {
+    vmtrace_free_buffer(v);
+
     return 0;
 }
 
@@ -201,6 +266,9 @@ struct vcpu *vcpu_create(struct domain *d, unsigned int vcpu_id)
     if ( sched_init_vcpu(v) != 0 )
         goto fail_wq;
 
+    if ( vmtrace_alloc_buffer(v) != 0 )
+        goto fail_wq;
+
     if ( arch_vcpu_create(v) != 0 )
         goto fail_sched;
 
@@ -449,6 +517,12 @@ static int sanitise_domain_config(struct xen_domctl_createdomain *config)
         }
     }
 
+    if ( config->vmtrace_size && !vmtrace_available )
+    {
+        dprintk(XENLOG_INFO, "vmtrace requested but not available\n");
+        return -EINVAL;
+    }
+
     return arch_sanitise_domain_config(config);
 }
 
@@ -474,7 +548,10 @@ struct domain *domain_create(domid_t domid,
     ASSERT(is_system_domain(d) ? config == NULL : config != NULL);
 
     if ( config )
+    {
         d->options = config->flags;
+        d->vmtrace_size = config->vmtrace_size;
+    }
 
     /* Sort out our idea of is_control_domain(). */
     d->is_privileged = is_priv;
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 666aeb71bf..88a5b1ef5d 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -95,6 +95,9 @@ struct xen_domctl_createdomain {
     int32_t max_grant_frames;
     int32_t max_maptrack_frames;
 
+    /* Per-vCPU buffer size in bytes.  0 to disable. */
+    uint32_t vmtrace_size;
+
     struct xen_arch_domainconfig arch;
 };
 
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 06dba1a397..bc78a09a53 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -272,6 +272,10 @@ struct vcpu
     /* vPCI per-vCPU area, used to store data for long running operations. */
     struct vpci_vcpu vpci;
 
+    struct {
+        struct page_info *pg; /* One contiguous allocation of d->vmtrace_size */
+    } vmtrace;
+
     struct arch_vcpu arch;
 
 #ifdef CONFIG_IOREQ_SERVER
@@ -547,6 +551,8 @@ struct domain
         unsigned int guest_request_sync          : 1;
     } monitor;
 
+    unsigned int vmtrace_size; /* Buffer size in bytes, or 0 to disable. */
+
 #ifdef CONFIG_ARGO
     /* Argo interdomain communication support */
     struct argo_domain *argo;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:33:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84743.158860 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6IB-00030i-Q8; Sun, 14 Feb 2021 01:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84743.158860; Sun, 14 Feb 2021 01:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6IB-00030a-Ml; Sun, 14 Feb 2021 01:33:43 +0000
Received: by outflank-mailman (input) for mailman id 84743;
 Sun, 14 Feb 2021 01: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 1lB6IB-00030V-Bi
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01: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 1lB6IB-0006tH-Ay
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:33:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6IB-0005h9-A7
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:33:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A6i2uYdjKDf3DjljNvfx1m0Gyi81Yeb9qzNatkVftHY=; b=E6FUsShjh0cezYMyliSda0S0SD
	2ecHgFvs9yCrw0b8JxxjiNlvQe7+Pw5f36i1Qv1Yn3mwwb3KpeSSP6KGZ8tgVIF5PRuDazIAWjV7T
	5h7LF9TCosggMSGXv7dc1QBu3tlYFLuNFzaMKW4E0gmCEUQ0ggyfs6KPbueVyXe3pL3s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/[lib]xl: Add vmtrace_buf_size parameter
Message-Id: <E1lB6IB-0005h9-A7@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:33:43 +0000

commit 45ba9a7d7688a6a08200e37a8caa2bc99bb4d267
Author:     Michał Leszczyński <michal.leszczynski@cert.pl>
AuthorDate: Fri Jun 19 00:31:24 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:27 2021 +0000

    tools/[lib]xl: Add vmtrace_buf_size parameter
    
    Allow to specify the size of per-vCPU trace buffer upon
    domain creation. This is zero by default (meaning: not enabled).
    
    Signed-off-by: Michał Leszczyński <michal.leszczynski@cert.pl>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 docs/man/xl.cfg.5.pod.in             | 9 +++++++++
 tools/golang/xenlight/helpers.gen.go | 2 ++
 tools/golang/xenlight/types.gen.go   | 1 +
 tools/include/libxl.h                | 7 +++++++
 tools/libs/light/libxl_create.c      | 1 +
 tools/libs/light/libxl_types.idl     | 4 ++++
 tools/xl/xl_parse.c                  | 4 ++++
 7 files changed, 28 insertions(+)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index 7cdb8595d3..040374dcd6 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -681,6 +681,15 @@ Windows).
 
 If this option is not specified then it will default to B<false>.
 
+=item B<vmtrace_buf_kb=KBYTES>
+
+Specifies the size of vmtrace buffer that would be allocated for each
+vCPU belonging to this domain.  Disabled (i.e.  B<vmtrace_buf_kb=0>) by
+default.
+
+B<NOTE>: Acceptable values are platform specific.  For Intel Processor
+Trace, this value must be a power of 2 between 4k and 16M.
+
 =back
 
 =head2 Devices
diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 63e2876463..4c60d27a9c 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -1114,6 +1114,7 @@ return fmt.Errorf("invalid union key '%v'", x.Type)}
 x.ArchArm.GicVersion = GicVersion(xc.arch_arm.gic_version)
 x.ArchArm.Vuart = VuartType(xc.arch_arm.vuart)
 x.Altp2M = Altp2MMode(xc.altp2m)
+x.VmtraceBufKb = int(xc.vmtrace_buf_kb)
 
  return nil}
 
@@ -1589,6 +1590,7 @@ return fmt.Errorf("invalid union key '%v'", x.Type)}
 xc.arch_arm.gic_version = C.libxl_gic_version(x.ArchArm.GicVersion)
 xc.arch_arm.vuart = C.libxl_vuart_type(x.ArchArm.Vuart)
 xc.altp2m = C.libxl_altp2m_mode(x.Altp2M)
+xc.vmtrace_buf_kb = C.int(x.VmtraceBufKb)
 
  return nil
  }
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index 5851c38057..cb13002fdb 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -514,6 +514,7 @@ GicVersion GicVersion
 Vuart VuartType
 }
 Altp2M Altp2MMode
+VmtraceBufKb int
 }
 
 type domainBuildInfoTypeUnion interface {
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index f48d0c5e8a..a7b673e89d 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -488,6 +488,13 @@
  */
 #define LIBXL_HAVE_PHYSINFO_CAP_VMTRACE 1
 
+/*
+ * LIBXL_HAVE_VMTRACE_BUF_KB indicates that libxl_domain_create_info has a
+ * vmtrace_buf_kb parameter, which allows to enable pre-allocation of
+ * processor tracing buffers of given size.
+ */
+#define LIBXL_HAVE_VMTRACE_BUF_KB 1
+
 /*
  * libxl ABI compatibility
  *
diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index 9848d65f36..46f68da697 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -607,6 +607,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
             .max_evtchn_port = b_info->event_channels,
             .max_grant_frames = b_info->max_grant_frames,
             .max_maptrack_frames = b_info->max_maptrack_frames,
+            .vmtrace_size = ROUNDUP(b_info->vmtrace_buf_kb << 10, XC_PAGE_SHIFT),
         };
 
         if (info->type != LIBXL_DOMAIN_TYPE_PV) {
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index dacb7df6b7..5b85a7419f 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -648,6 +648,10 @@ libxl_domain_build_info = Struct("domain_build_info",[
     # supported by x86 HVM and ARM support is planned.
     ("altp2m", libxl_altp2m_mode),
 
+    # Size of preallocated vmtrace trace buffers (in KBYTES).
+    # Use zero value to disable this feature.
+    ("vmtrace_buf_kb", integer),
+
     ], dir=DIR_IN,
        copy_deprecated_fn="libxl__domain_build_info_copy_deprecated",
 )
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 867e4d068a..1893cfc086 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1863,6 +1863,10 @@ void parse_config_data(const char *config_source,
         }
     }
 
+    if (!xlu_cfg_get_long(config, "vmtrace_buf_kb", &l, 1) && l) {
+        b_info->vmtrace_buf_kb = l;
+    }
+
     if (!xlu_cfg_get_list(config, "ioports", &ioports, &num_ioports, 0)) {
         b_info->num_ioports = num_ioports;
         b_info->ioports = calloc(num_ioports, sizeof(*b_info->ioports));
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:33:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84744.158865 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6IM-000325-SR; Sun, 14 Feb 2021 01:33:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84744.158865; Sun, 14 Feb 2021 01:33:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6IM-00031w-OL; Sun, 14 Feb 2021 01:33:54 +0000
Received: by outflank-mailman (input) for mailman id 84744;
 Sun, 14 Feb 2021 01: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 1lB6IL-00031m-En
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01: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 1lB6IL-0006tP-E7
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:33:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6IL-0005i0-D9
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:33:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fZDnRdqHzPyzphhA7mxFOI8IkUpar6qGHhiW7vimyY4=; b=bqbD8yie5iRJ/+S8a6mUZ3wjlT
	7SQL+1D5qH64DAQs2WMqkWY1hYTRL6Wqjf2KV8Js/rl14WHJas7U4c3hlxKC/k2gMyoHF3Zl5V/vx
	/SN1tXLageRF94lU/4AK/bo0bYg+/y1rlLMEO+uJL28yrhuMZUdtRXj6FbrW6YwGHGOE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/memory: Add a vmtrace_buf resource type
Message-Id: <E1lB6IL-0005i0-D9@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:33:53 +0000

commit b72eab263592a3d76aa826675e5d62606d83cecd
Author:     Michał Leszczyński <michal.leszczynski@cert.pl>
AuthorDate: Mon Jun 29 00:05:51 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:27 2021 +0000

    xen/memory: Add a vmtrace_buf resource type
    
    Allow to map processor trace buffer using acquire_resource().
    
    Signed-off-by: Michał Leszczyński <michal.leszczynski@cert.pl>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/common/memory.c         | 29 +++++++++++++++++++++++++++++
 xen/include/public/memory.h |  1 +
 2 files changed, 30 insertions(+)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index 7b012ce291..76b9f58478 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -1096,6 +1096,9 @@ static unsigned int resource_max_frames(const struct domain *d,
     case XENMEM_resource_ioreq_server:
         return ioreq_server_max_frames(d);
 
+    case XENMEM_resource_vmtrace_buf:
+        return d->vmtrace_size >> PAGE_SHIFT;
+
     default:
         return -EOPNOTSUPP;
     }
@@ -1136,6 +1139,29 @@ static int acquire_ioreq_server(struct domain *d,
 #endif
 }
 
+static int acquire_vmtrace_buf(
+    struct domain *d, unsigned int id, unsigned int frame,
+    unsigned int nr_frames, xen_pfn_t mfn_list[])
+{
+    const struct vcpu *v = domain_vcpu(d, id);
+    unsigned int i;
+    mfn_t mfn;
+
+    if ( !v )
+        return -ENOENT;
+
+    if ( !v->vmtrace.pg ||
+         (frame + nr_frames) > (d->vmtrace_size >> PAGE_SHIFT) )
+        return -EINVAL;
+
+    mfn = page_to_mfn(v->vmtrace.pg);
+
+    for ( i = 0; i < nr_frames; i++ )
+        mfn_list[i] = mfn_x(mfn) + frame + i;
+
+    return nr_frames;
+}
+
 /*
  * Returns -errno on error, or positive in the range [1, nr_frames] on
  * success.  Returning less than nr_frames contitutes a request for a
@@ -1153,6 +1179,9 @@ static int _acquire_resource(
     case XENMEM_resource_ioreq_server:
         return acquire_ioreq_server(d, id, frame, nr_frames, mfn_list);
 
+    case XENMEM_resource_vmtrace_buf:
+        return acquire_vmtrace_buf(d, id, frame, nr_frames, mfn_list);
+
     default:
         return -EOPNOTSUPP;
     }
diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h
index 020c79d757..50e73eef98 100644
--- a/xen/include/public/memory.h
+++ b/xen/include/public/memory.h
@@ -625,6 +625,7 @@ struct xen_mem_acquire_resource {
 
 #define XENMEM_resource_ioreq_server 0
 #define XENMEM_resource_grant_table 1
+#define XENMEM_resource_vmtrace_buf 2
 
     /*
      * IN - a type-specific resource identifier, which must be zero
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:34:04 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:34:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84745.158869 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6IW-00033Q-Ti; Sun, 14 Feb 2021 01:34:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84745.158869; Sun, 14 Feb 2021 01:34:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6IW-00033D-Pz; Sun, 14 Feb 2021 01:34:04 +0000
Received: by outflank-mailman (input) for mailman id 84745;
 Sun, 14 Feb 2021 01: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 1lB6IV-000334-JE
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01: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 1lB6IV-0006tk-IN
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:34:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6IV-0005j0-Gn
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:34:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6n2MNw/Fdy7uBg3b9jKmq6JKes2FfDpMail06xjIHzw=; b=LGWb+rS6mm/dHcLm4ke65XJyFc
	9EfiRdOl6zuK5BNJ1/fuppurG4igb6kwL0p3ybo6/n2vN0ArmD45hxZWsWXj1cuZy/fN9Vbr0b0Zj
	9TPEPtaw8efbzWcMmaOHFMpsC1m0KgOqrl+PD/IfsoGog9pUcjnH2aL7CGuw1MHXo5zw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vmx: Add Intel Processor Trace support
Message-Id: <E1lB6IV-0005j0-Gn@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:34:03 +0000

commit 71cb03f03ce309e8cc1dacd18aa383ccea6af231
Author:     Michał Leszczyński <michal.leszczynski@cert.pl>
AuthorDate: Tue Jun 16 15:20:18 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:27 2021 +0000

    x86/vmx: Add Intel Processor Trace support
    
    Add CPUID/MSR enumeration details for Processor Trace.  For now, we will only
    support its use inside VMX operation.  Fill in the vmtrace_available boolean
    to activate the newly introduced common infrastructure for allocating trace
    buffers.
    
    For now, Processor Trace is going to be operated in Single Output mode behind
    the guests back.  Add the MSRs to struct vcpu_msrs, and set up the buffer
    limit in vmx_init_ipt() as it is fixed for the lifetime of the domain.
    
    Context switch the most of the MSRs in and out of vCPU context, but the main
    control register needs to reside in the MSR load/save lists.  Explicitly pull
    the msrs pointer out into a local variable, because the optimiser cannot keep
    it live across the memory clobbers in the MSR accesses.
    
    Signed-off-by: Michał Leszczyński <michal.leszczynski@cert.pl>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/light/libxl_cpuid.c              |  1 +
 tools/misc/xen-cpuid.c                      |  2 +-
 xen/arch/x86/hvm/vmx/vmcs.c                 | 19 +++++++++++++---
 xen/arch/x86/hvm/vmx/vmx.c                  | 34 ++++++++++++++++++++++++++++-
 xen/include/asm-x86/cpufeature.h            |  1 +
 xen/include/asm-x86/hvm/vmx/vmcs.h          |  4 ++++
 xen/include/asm-x86/msr.h                   | 32 +++++++++++++++++++++++++++
 xen/include/public/arch-x86/cpufeatureset.h |  1 +
 8 files changed, 89 insertions(+), 5 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 259612834e..289c59c742 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -188,6 +188,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"avx512-ifma",  0x00000007,  0, CPUID_REG_EBX, 21,  1},
         {"clflushopt",   0x00000007,  0, CPUID_REG_EBX, 23,  1},
         {"clwb",         0x00000007,  0, CPUID_REG_EBX, 24,  1},
+        {"proc-trace",   0x00000007,  0, CPUID_REG_EBX, 25,  1},
         {"avx512pf",     0x00000007,  0, CPUID_REG_EBX, 26,  1},
         {"avx512er",     0x00000007,  0, CPUID_REG_EBX, 27,  1},
         {"avx512cd",     0x00000007,  0, CPUID_REG_EBX, 28,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index c81aa93055..2d04162d8d 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -106,7 +106,7 @@ static const char *const str_7b0[32] =
     [18] = "rdseed",   [19] = "adx",
     [20] = "smap",     [21] = "avx512-ifma",
     [22] = "pcommit",  [23] = "clflushopt",
-    [24] = "clwb",     [25] = "pt",
+    [24] = "clwb",     [25] = "proc-trace",
     [26] = "avx512pf", [27] = "avx512er",
     [28] = "avx512cd", [29] = "sha",
     [30] = "avx512bw", [31] = "avx512vl",
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 164535f8f0..f9f9bc18cd 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -243,7 +243,7 @@ static bool_t cap_check(const char *name, u32 expected, u32 saw)
     return saw != expected;
 }
 
-static int vmx_init_vmcs_config(void)
+static int vmx_init_vmcs_config(bool bsp)
 {
     u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt;
     u32 _vmx_pin_based_exec_control;
@@ -291,6 +291,20 @@ static int vmx_init_vmcs_config(void)
         _vmx_cpu_based_exec_control &=
             ~(CPU_BASED_CR8_LOAD_EXITING | CPU_BASED_CR8_STORE_EXITING);
 
+    rdmsrl(MSR_IA32_VMX_MISC, _vmx_misc_cap);
+
+    /* Check whether IPT is supported in VMX operation. */
+    if ( bsp )
+        vmtrace_available = cpu_has_proc_trace &&
+                            (_vmx_misc_cap & VMX_MISC_PROC_TRACE);
+    else if ( vmtrace_available &&
+              !(_vmx_misc_cap & VMX_MISC_PROC_TRACE) )
+    {
+        printk("VMX: IPT capabilities differ between CPU%u and BSP\n",
+               smp_processor_id());
+        return -EINVAL;
+    }
+
     if ( _vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS )
     {
         min = 0;
@@ -305,7 +319,6 @@ static int vmx_init_vmcs_config(void)
                SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS |
                SECONDARY_EXEC_XSAVES |
                SECONDARY_EXEC_TSC_SCALING);
-        rdmsrl(MSR_IA32_VMX_MISC, _vmx_misc_cap);
         if ( _vmx_misc_cap & VMX_MISC_VMWRITE_ALL )
             opt |= SECONDARY_EXEC_ENABLE_VMCS_SHADOWING;
         if ( opt_vpid_enabled )
@@ -715,7 +728,7 @@ static int _vmx_cpu_up(bool bsp)
         wrmsr(MSR_IA32_FEATURE_CONTROL, eax, 0);
     }
 
-    if ( (rc = vmx_init_vmcs_config()) != 0 )
+    if ( (rc = vmx_init_vmcs_config(bsp)) != 0 )
         return rc;
 
     INIT_LIST_HEAD(&this_cpu(active_vmcs_list));
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 2d4475ee3d..12b961113e 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -428,6 +428,20 @@ static void vmx_domain_relinquish_resources(struct domain *d)
     vmx_free_vlapic_mapping(d);
 }
 
+static void vmx_init_ipt(struct vcpu *v)
+{
+    unsigned int size = v->domain->vmtrace_size;
+
+    if ( !size )
+        return;
+
+    /* Checked by domain creation logic. */
+    ASSERT(v->vmtrace.pg);
+    ASSERT(size >= PAGE_SIZE && (size & (size - 1)) == 0);
+
+    v->arch.msrs->rtit.output_limit = size - 1;
+}
+
 static int vmx_vcpu_initialise(struct vcpu *v)
 {
     int rc;
@@ -470,6 +484,7 @@ static int vmx_vcpu_initialise(struct vcpu *v)
     }
 
     vmx_install_vlapic_mapping(v);
+    vmx_init_ipt(v);
 
     return 0;
 }
@@ -508,22 +523,39 @@ static void vmx_restore_host_msrs(void)
 
 static void vmx_save_guest_msrs(struct vcpu *v)
 {
+    struct vcpu_msrs *msrs = v->arch.msrs;
+
     /*
      * We cannot cache SHADOW_GS_BASE while the VCPU runs, as it can
      * be updated at any time via SWAPGS, which we cannot trap.
      */
     v->arch.hvm.vmx.shadow_gs = read_gs_shadow();
+
+    if ( v->arch.hvm.vmx.ipt_active )
+    {
+        rdmsrl(MSR_RTIT_OUTPUT_MASK, msrs->rtit.output_mask);
+        rdmsrl(MSR_RTIT_STATUS, msrs->rtit.status);
+    }
 }
 
 static void vmx_restore_guest_msrs(struct vcpu *v)
 {
+    const struct vcpu_msrs *msrs = v->arch.msrs;
+
     write_gs_shadow(v->arch.hvm.vmx.shadow_gs);
     wrmsrl(MSR_STAR,           v->arch.hvm.vmx.star);
     wrmsrl(MSR_LSTAR,          v->arch.hvm.vmx.lstar);
     wrmsrl(MSR_SYSCALL_MASK,   v->arch.hvm.vmx.sfmask);
 
     if ( cpu_has_msr_tsc_aux )
-        wrmsr_tsc_aux(v->arch.msrs->tsc_aux);
+        wrmsr_tsc_aux(msrs->tsc_aux);
+
+    if ( v->arch.hvm.vmx.ipt_active )
+    {
+        wrmsrl(MSR_RTIT_OUTPUT_BASE, page_to_maddr(v->vmtrace.pg));
+        wrmsrl(MSR_RTIT_OUTPUT_MASK, msrs->rtit.output_mask);
+        wrmsrl(MSR_RTIT_STATUS, msrs->rtit.status);
+    }
 }
 
 void vmx_update_cpu_exec_control(struct vcpu *v)
diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h
index f62e526a96..33b2257888 100644
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -105,6 +105,7 @@
 #define cpu_has_clwb            boot_cpu_has(X86_FEATURE_CLWB)
 #define cpu_has_avx512er        boot_cpu_has(X86_FEATURE_AVX512ER)
 #define cpu_has_avx512cd        boot_cpu_has(X86_FEATURE_AVX512CD)
+#define cpu_has_proc_trace      boot_cpu_has(X86_FEATURE_PROC_TRACE)
 #define cpu_has_sha             boot_cpu_has(X86_FEATURE_SHA)
 #define cpu_has_avx512bw        boot_cpu_has(X86_FEATURE_AVX512BW)
 #define cpu_has_avx512vl        boot_cpu_has(X86_FEATURE_AVX512VL)
diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/asm-x86/hvm/vmx/vmcs.h
index 906810592f..8073af323b 100644
--- a/xen/include/asm-x86/hvm/vmx/vmcs.h
+++ b/xen/include/asm-x86/hvm/vmx/vmcs.h
@@ -156,6 +156,9 @@ struct vmx_vcpu {
     /* Do we need to tolerate a spurious EPT_MISCONFIG VM exit? */
     bool_t               ept_spurious_misconfig;
 
+    /* Processor Trace configured and enabled for the vcpu. */
+    bool                 ipt_active;
+
     /* Is the guest in real mode? */
     uint8_t              vmx_realmode;
     /* Are we emulating rather than VMENTERing? */
@@ -283,6 +286,7 @@ extern u32 vmx_secondary_exec_control;
 #define VMX_VPID_INVVPID_SINGLE_CONTEXT_RETAINING_GLOBAL 0x80000000000ULL
 extern u64 vmx_ept_vpid_cap;
 
+#define VMX_MISC_PROC_TRACE                     0x00004000
 #define VMX_MISC_CR3_TARGET                     0x01ff0000
 #define VMX_MISC_VMWRITE_ALL                    0x20000000
 
diff --git a/xen/include/asm-x86/msr.h b/xen/include/asm-x86/msr.h
index 16f95e7344..1d3eca9063 100644
--- a/xen/include/asm-x86/msr.h
+++ b/xen/include/asm-x86/msr.h
@@ -306,6 +306,38 @@ struct vcpu_msrs
         };
     } misc_features_enables;
 
+    /*
+     * 0x00000560 ... 57x - MSR_RTIT_*
+     *
+     * "Real Time Instruction Trace", now called Processor Trace.
+     *
+     * These MSRs are not exposed to guests.  They are controlled by Xen
+     * behind the scenes, when vmtrace is enabled for the domain.
+     *
+     * MSR_RTIT_OUTPUT_BASE not stored here.  It is fixed per vcpu, and
+     * derived from v->vmtrace.buf.
+     */
+    struct {
+        /*
+         * Placed in the MSR load/save lists.  Only modified by hypercall in
+         * the common case.
+         */
+        uint64_t ctl;
+
+        /*
+         * Updated by hardware in non-root mode.  Synchronised here on vcpu
+         * context switch.
+         */
+        uint64_t status;
+        union {
+            uint64_t output_mask;
+            struct {
+                uint32_t output_limit;
+                uint32_t output_offset;
+            };
+        };
+    } rtit;
+
     /* 0x00000da0 - MSR_IA32_XSS */
     struct {
         uint64_t raw;
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 6f7efaad6d..a501479820 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -217,6 +217,7 @@ XEN_CPUFEATURE(SMAP,          5*32+20) /*S  Supervisor Mode Access Prevention */
 XEN_CPUFEATURE(AVX512_IFMA,   5*32+21) /*A  AVX-512 Integer Fused Multiply Add */
 XEN_CPUFEATURE(CLFLUSHOPT,    5*32+23) /*A  CLFLUSHOPT instruction */
 XEN_CPUFEATURE(CLWB,          5*32+24) /*A  CLWB instruction */
+XEN_CPUFEATURE(PROC_TRACE,    5*32+25) /*   Processor Trace */
 XEN_CPUFEATURE(AVX512PF,      5*32+26) /*A  AVX-512 Prefetch Instructions */
 XEN_CPUFEATURE(AVX512ER,      5*32+27) /*A  AVX-512 Exponent & Reciprocal Instrs */
 XEN_CPUFEATURE(AVX512CD,      5*32+28) /*A  AVX-512 Conflict Detection Instrs */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:34:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:34:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84746.158873 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Ig-00034Q-W8; Sun, 14 Feb 2021 01:34:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84746.158873; Sun, 14 Feb 2021 01:34:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Ig-00034I-S7; Sun, 14 Feb 2021 01:34:14 +0000
Received: by outflank-mailman (input) for mailman id 84746;
 Sun, 14 Feb 2021 01:34:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6If-00034B-Mo
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:34:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6If-0006tu-M6
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:34:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6If-0005k2-L9
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:34:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JMdYYqR8AojaQ4fc7IM601AjsLOYuDXqNi9bpgBmDjs=; b=yRYOhHgputAWdV+lipElFcPi/9
	52qyPchGOIQRwqsufqRgUz3RqA0B3wiKLF9ITfhZY1Tis21MzWaqm6/MBB2c6Y8ZASWH50fg218G4
	DJ8vPCQBebTveTYKBdOI/AvAdzg3R5AFkh4Zm/BB3y+eGRR3/8Ut18s0/jm4KKEA6rB0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/domctl: Add XEN_DOMCTL_vmtrace_op
Message-Id: <E1lB6If-0005k2-L9@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:34:13 +0000

commit 1cee4bd97c88633c4a39f56f6722be0727c9ea8f
Author:     Michał Leszczyński <michal.leszczynski@cert.pl>
AuthorDate: Sun Jun 28 23:48:09 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:28 2021 +0000

    xen/domctl: Add XEN_DOMCTL_vmtrace_op
    
    Implement an interface to configure and control tracing operations.  Reuse the
    existing SETDEBUGGING flask vector rather than inventing a new one.
    
    Userspace using this interface is going to need platform specific knowledge
    anyway to interpret the contents of the trace buffer.  While some operations
    (e.g. enable/disable) can reasonably be generic, others cannot.  Provide an
    explicitly-platform specific pair of get/set operations to reduce API churn as
    new options get added/enabled.
    
    For the VMX specific Processor Trace implementation, tolerate reading and
    modifying a safe subset of bits in CTL, STATUS and OUTPUT_MASK.  This permits
    userspace to control the content which gets logged, but prevents modification
    of details such as the position/size of the output buffer.
    
    Signed-off-by: Michał Leszczyński <michal.leszczynski@cert.pl>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/domctl.c         |  55 +++++++++++++++++
 xen/arch/x86/hvm/vmx/vmx.c    | 135 ++++++++++++++++++++++++++++++++++++++++++
 xen/include/asm-x86/hvm/hvm.h |  63 ++++++++++++++++++++
 xen/include/public/domctl.h   |  35 +++++++++++
 xen/xsm/flask/hooks.c         |   1 +
 5 files changed, 289 insertions(+)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index b28cfe9817..b464465230 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -155,6 +155,55 @@ void arch_get_domain_info(const struct domain *d,
     info->arch_config.emulation_flags = d->arch.emulation_flags;
 }
 
+static int do_vmtrace_op(struct domain *d, struct xen_domctl_vmtrace_op *op,
+                         XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
+{
+    struct vcpu *v;
+    int rc;
+
+    if ( !d->vmtrace_size || d == current->domain /* No vcpu_pause() */ )
+        return -EINVAL;
+
+    ASSERT(is_hvm_domain(d)); /* Restricted by domain creation logic. */
+
+    v = domain_vcpu(d, op->vcpu);
+    if ( !v )
+        return -ENOENT;
+
+    vcpu_pause(v);
+    switch ( op->cmd )
+    {
+    case XEN_DOMCTL_vmtrace_enable:
+    case XEN_DOMCTL_vmtrace_disable:
+    case XEN_DOMCTL_vmtrace_reset_and_enable:
+        rc = hvm_vmtrace_control(
+            v, op->cmd != XEN_DOMCTL_vmtrace_disable,
+            op->cmd == XEN_DOMCTL_vmtrace_reset_and_enable);
+        break;
+
+    case XEN_DOMCTL_vmtrace_output_position:
+        rc = hvm_vmtrace_output_position(v, &op->value);
+        if ( rc >= 0 )
+            rc = 0;
+        break;
+
+    case XEN_DOMCTL_vmtrace_get_option:
+        rc = hvm_vmtrace_get_option(v, op->key, &op->value);
+        break;
+
+    case XEN_DOMCTL_vmtrace_set_option:
+        rc = hvm_vmtrace_set_option(v, op->key, op->value);
+        break;
+
+    default:
+        rc = -EOPNOTSUPP;
+        break;
+    }
+    vcpu_unpause(v);
+
+    return rc;
+}
+
 #define MAX_IOPORTS 0x10000
 
 long arch_do_domctl(
@@ -1320,6 +1369,12 @@ long arch_do_domctl(
         domain_unpause(d);
         break;
 
+    case XEN_DOMCTL_vmtrace_op:
+        ret = do_vmtrace_op(d, &domctl->u.vmtrace_op, u_domctl);
+        if ( !ret )
+            copyback = true;
+        break;
+
     default:
         ret = iommu_do_domctl(domctl, d, u_domctl);
         break;
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 12b961113e..beb5692b8b 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2261,6 +2261,137 @@ static bool vmx_get_pending_event(struct vcpu *v, struct x86_event *info)
     return true;
 }
 
+/*
+ * We only let vmtrace agents see and modify a subset of bits in MSR_RTIT_CTL.
+ * These all pertain to data-emitted into the trace buffer(s).  Must not
+ * include controls pertaining to the structure/position of the trace
+ * buffer(s).
+ */
+#define RTIT_CTL_MASK                                                   \
+    (RTIT_CTL_TRACE_EN | RTIT_CTL_OS | RTIT_CTL_USR | RTIT_CTL_TSC_EN | \
+     RTIT_CTL_DIS_RETC | RTIT_CTL_BRANCH_EN)
+
+/*
+ * Status bits restricted to the first-gen subset (i.e. no further CPUID
+ * requirements.)
+ */
+#define RTIT_STATUS_MASK                                                \
+    (RTIT_STATUS_FILTER_EN | RTIT_STATUS_CONTEXT_EN | RTIT_STATUS_TRIGGER_EN | \
+     RTIT_STATUS_ERROR | RTIT_STATUS_STOPPED)
+
+static int vmtrace_get_option(struct vcpu *v, uint64_t key, uint64_t *output)
+{
+    const struct vcpu_msrs *msrs = v->arch.msrs;
+
+    switch ( key )
+    {
+    case MSR_RTIT_CTL:
+        *output = msrs->rtit.ctl & RTIT_CTL_MASK;
+        break;
+
+    case MSR_RTIT_STATUS:
+        *output = msrs->rtit.status & RTIT_STATUS_MASK;
+        break;
+
+    default:
+        *output = 0;
+        return -EINVAL;
+    }
+    return 0;
+}
+
+static int vmtrace_set_option(struct vcpu *v, uint64_t key, uint64_t value)
+{
+    struct vcpu_msrs *msrs = v->arch.msrs;
+    bool new_en, old_en = msrs->rtit.ctl & RTIT_CTL_TRACE_EN;
+
+    switch ( key )
+    {
+    case MSR_RTIT_CTL:
+        if ( value & ~RTIT_CTL_MASK )
+            return -EINVAL;
+
+        msrs->rtit.ctl &= ~RTIT_CTL_MASK;
+        msrs->rtit.ctl |= (value & RTIT_CTL_MASK);
+        break;
+
+    case MSR_RTIT_STATUS:
+        if ( value & ~RTIT_STATUS_MASK )
+            return -EINVAL;
+
+        msrs->rtit.status &= ~RTIT_STATUS_MASK;
+        msrs->rtit.status |= (value & RTIT_STATUS_MASK);
+        break;
+
+    default:
+        return -EINVAL;
+    }
+
+    new_en = msrs->rtit.ctl & RTIT_CTL_TRACE_EN;
+
+    /* ctl.trace_en changed => update MSR load/save lists appropriately. */
+    if ( !old_en && new_en )
+    {
+        if ( vmx_add_guest_msr(v, MSR_RTIT_CTL, msrs->rtit.ctl) ||
+             vmx_add_host_load_msr(v, MSR_RTIT_CTL, 0) )
+        {
+            /*
+             * The only failure cases here are failing the
+             * singleton-per-domain memory allocation, or exceeding the space
+             * in the allocation.  We could unwind in principle, but there is
+             * nothing userspace can usefully do to continue using this VM.
+             */
+            domain_crash(v->domain);
+            return -ENXIO;
+        }
+    }
+    else if ( old_en && !new_en )
+    {
+        vmx_del_msr(v, MSR_RTIT_CTL, VMX_MSR_GUEST);
+        vmx_del_msr(v, MSR_RTIT_CTL, VMX_MSR_HOST);
+    }
+
+    return 0;
+}
+
+static int vmtrace_control(struct vcpu *v, bool enable, bool reset)
+{
+    struct vcpu_msrs *msrs = v->arch.msrs;
+    uint64_t new_ctl;
+    int rc;
+
+    /*
+     * Absolutely nothing good will come of Xen's and userspace's idea of
+     * whether ipt is enabled getting out of sync.
+     */
+    if ( v->arch.hvm.vmx.ipt_active == enable )
+        return -EINVAL;
+
+    if ( reset )
+    {
+        msrs->rtit.status = 0;
+        msrs->rtit.output_offset = 0;
+    }
+
+    new_ctl = msrs->rtit.ctl & ~RTIT_CTL_TRACE_EN;
+    if ( enable )
+        new_ctl |= RTIT_CTL_TRACE_EN;
+
+    rc = vmtrace_set_option(v, MSR_RTIT_CTL, new_ctl);
+    if ( rc )
+        return rc;
+
+    v->arch.hvm.vmx.ipt_active = enable;
+
+    return 0;
+}
+
+static int vmtrace_output_position(struct vcpu *v, uint64_t *pos)
+{
+    *pos = v->arch.msrs->rtit.output_offset;
+    return v->arch.hvm.vmx.ipt_active;
+}
+
 static struct hvm_function_table __initdata vmx_function_table = {
     .name                 = "VMX",
     .cpu_up_prepare       = vmx_cpu_up_prepare,
@@ -2316,6 +2447,10 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .altp2m_vcpu_update_vmfunc_ve = vmx_vcpu_update_vmfunc_ve,
     .altp2m_vcpu_emulate_ve = vmx_vcpu_emulate_ve,
     .altp2m_vcpu_emulate_vmfunc = vmx_vcpu_emulate_vmfunc,
+    .vmtrace_control = vmtrace_control,
+    .vmtrace_output_position = vmtrace_output_position,
+    .vmtrace_set_option = vmtrace_set_option,
+    .vmtrace_get_option = vmtrace_get_option,
     .tsc_scaling = {
         .max_ratio = VMX_TSC_MULTIPLIER_MAX,
     },
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index 334bd573b9..960ec03917 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -214,6 +214,12 @@ struct hvm_function_table {
     bool_t (*altp2m_vcpu_emulate_ve)(struct vcpu *v);
     int (*altp2m_vcpu_emulate_vmfunc)(const struct cpu_user_regs *regs);
 
+    /* vmtrace */
+    int (*vmtrace_control)(struct vcpu *v, bool enable, bool reset);
+    int (*vmtrace_output_position)(struct vcpu *v, uint64_t *pos);
+    int (*vmtrace_set_option)(struct vcpu *v, uint64_t key, uint64_t value);
+    int (*vmtrace_get_option)(struct vcpu *v, uint64_t key, uint64_t *value);
+
     /*
      * Parameters and callbacks for hardware-assisted TSC scaling,
      * which are valid only when the hardware feature is available.
@@ -655,6 +661,41 @@ static inline bool altp2m_vcpu_emulate_ve(struct vcpu *v)
     return false;
 }
 
+static inline int hvm_vmtrace_control(struct vcpu *v, bool enable, bool reset)
+{
+    if ( hvm_funcs.vmtrace_control )
+        return hvm_funcs.vmtrace_control(v, enable, reset);
+
+    return -EOPNOTSUPP;
+}
+
+/* Returns -errno, or a boolean of whether tracing is currently active. */
+static inline int hvm_vmtrace_output_position(struct vcpu *v, uint64_t *pos)
+{
+    if ( hvm_funcs.vmtrace_output_position )
+        return hvm_funcs.vmtrace_output_position(v, pos);
+
+    return -EOPNOTSUPP;
+}
+
+static inline int hvm_vmtrace_set_option(
+    struct vcpu *v, uint64_t key, uint64_t value)
+{
+    if ( hvm_funcs.vmtrace_set_option )
+        return hvm_funcs.vmtrace_set_option(v, key, value);
+
+    return -EOPNOTSUPP;
+}
+
+static inline int hvm_vmtrace_get_option(
+    struct vcpu *v, uint64_t key, uint64_t *value)
+{
+    if ( hvm_funcs.vmtrace_get_option )
+        return hvm_funcs.vmtrace_get_option(v, key, value);
+
+    return -EOPNOTSUPP;
+}
+
 /*
  * This must be defined as a macro instead of an inline function,
  * because it uses 'struct vcpu' and 'struct domain' which have
@@ -751,6 +792,28 @@ static inline bool hvm_has_set_descriptor_access_exiting(void)
     return false;
 }
 
+static inline int hvm_vmtrace_control(struct vcpu *v, bool enable, bool reset)
+{
+    return -EOPNOTSUPP;
+}
+
+static inline int hvm_vmtrace_output_position(struct vcpu *v, uint64_t *pos)
+{
+    return -EOPNOTSUPP;
+}
+
+static inline int hvm_vmtrace_set_option(
+    struct vcpu *v, uint64_t key, uint64_t value)
+{
+    return -EOPNOTSUPP;
+}
+
+static inline int hvm_vmtrace_get_option(
+    struct vcpu *v, uint64_t key, uint64_t *value)
+{
+    return -EOPNOTSUPP;
+}
+
 #define is_viridian_domain(d) ((void)(d), false)
 #define is_viridian_vcpu(v) ((void)(v), false)
 #define has_viridian_time_ref_count(d) ((void)(d), false)
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 88a5b1ef5d..4dbf107785 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -1135,6 +1135,39 @@ struct xen_domctl_vuart_op {
                                  */
 };
 
+/* XEN_DOMCTL_vmtrace_op: Perform VM tracing operations. */
+struct xen_domctl_vmtrace_op {
+    uint32_t cmd;           /* IN */
+    uint32_t vcpu;          /* IN */
+    uint64_aligned_t key;   /* IN     - @cmd specific data. */
+    uint64_aligned_t value; /* IN/OUT - @cmd specific data. */
+
+    /*
+     * General enable/disable of tracing.
+     *
+     * XEN_DOMCTL_vmtrace_reset_and_enable is provided as optimisation for
+     * common usecases, which want to reset status and position information
+     * when turning tracing back on.
+     */
+#define XEN_DOMCTL_vmtrace_enable             1
+#define XEN_DOMCTL_vmtrace_disable            2
+#define XEN_DOMCTL_vmtrace_reset_and_enable   3
+
+    /* Obtain the current output position within the buffer.  Fills @value. */
+#define XEN_DOMCTL_vmtrace_output_position    4
+
+    /*
+     * Get/Set platform specific configuration.
+     *
+     * For Intel Processor Trace, @key/@value are interpreted as MSR
+     * reads/writes to MSR_RTIT_*, filtered to a safe subset.
+     */
+#define XEN_DOMCTL_vmtrace_get_option         5
+#define XEN_DOMCTL_vmtrace_set_option         6
+};
+typedef struct xen_domctl_vmtrace_op xen_domctl_vmtrace_op_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domctl_vmtrace_op_t);
+
 struct xen_domctl {
     uint32_t cmd;
 #define XEN_DOMCTL_createdomain                   1
@@ -1219,6 +1252,7 @@ struct xen_domctl {
 #define XEN_DOMCTL_vuart_op                      81
 #define XEN_DOMCTL_get_cpu_policy                82
 #define XEN_DOMCTL_set_cpu_policy                83
+#define XEN_DOMCTL_vmtrace_op                    84
 #define XEN_DOMCTL_gdbsx_guestmemio            1000
 #define XEN_DOMCTL_gdbsx_pausevcpu             1001
 #define XEN_DOMCTL_gdbsx_unpausevcpu           1002
@@ -1279,6 +1313,7 @@ struct xen_domctl {
         struct xen_domctl_monitor_op        monitor_op;
         struct xen_domctl_psr_alloc         psr_alloc;
         struct xen_domctl_vuart_op          vuart_op;
+        struct xen_domctl_vmtrace_op        vmtrace_op;
         uint8_t                             pad[128];
     } u;
 };
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 11784d7425..3b7313b949 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -703,6 +703,7 @@ static int flask_domctl(struct domain *d, int cmd)
         return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__VM_EVENT);
 
     case XEN_DOMCTL_debug_op:
+    case XEN_DOMCTL_vmtrace_op:
     case XEN_DOMCTL_gdbsx_guestmemio:
     case XEN_DOMCTL_gdbsx_pausevcpu:
     case XEN_DOMCTL_gdbsx_unpausevcpu:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:34:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:34:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84747.158877 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Ir-00036J-39; Sun, 14 Feb 2021 01:34:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84747.158877; Sun, 14 Feb 2021 01:34:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Iq-00036A-VN; Sun, 14 Feb 2021 01:34:24 +0000
Received: by outflank-mailman (input) for mailman id 84747;
 Sun, 14 Feb 2021 01:34:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Ip-00035f-Px
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:34:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Ip-0006uK-PI
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:34:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Ip-0005lI-OO
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:34:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mv5m6ep7WrM4SjsV3nB3C0Iif5lgx+YrR0EElFSxdgw=; b=uv+DB+6MfCjUj7LmSV9aMCD7TQ
	jPzNlGcfbEiZMXy9nKkC45K7qEy+ChDQXU5C616cUU/XSzTKvEsAFK4/2Tr+e3dMFV+DO+f2QMvv+
	05E4T2S4i/n4E+TQgqDX9qxoBdnT101FseDHvpOGjSpAcd54ESHmMhbjw8MKEvwyVvEc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxc: Add xc_vmtrace_* functions
Message-Id: <E1lB6Ip-0005lI-OO@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:34:23 +0000

commit 53aaa792fdebcf131983d45ee8e3d09bd0740c71
Author:     Michał Leszczyński <michal.leszczynski@cert.pl>
AuthorDate: Tue Jun 16 15:33:25 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:28 2021 +0000

    tools/libxc: Add xc_vmtrace_* functions
    
    Add functions in libxc that use the new XEN_DOMCTL_vmtrace interface.
    
    Signed-off-by: Michał Leszczyński <michal.leszczynski@cert.pl>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/include/xenctrl.h      |  73 ++++++++++++++++++++++++
 tools/libs/ctrl/Makefile     |   1 +
 tools/libs/ctrl/xc_vmtrace.c | 128 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 202 insertions(+)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 3796425e1e..0efcdae8b4 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1583,6 +1583,79 @@ int xc_tbuf_set_cpu_mask(xc_interface *xch, xc_cpumap_t mask);
 
 int xc_tbuf_set_evt_mask(xc_interface *xch, uint32_t mask);
 
+/**
+ * Enable vmtrace for given vCPU.
+ *
+ * @parm xch a handle to an open hypervisor interface
+ * @parm domid domain identifier
+ * @parm vcpu vcpu identifier
+ * @return 0 on success, -1 on failure
+ */
+int xc_vmtrace_enable(xc_interface *xch, uint32_t domid, uint32_t vcpu);
+
+/**
+ * Enable vmtrace for given vCPU.
+ *
+ * @parm xch a handle to an open hypervisor interface
+ * @parm domid domain identifier
+ * @parm vcpu vcpu identifier
+ * @return 0 on success, -1 on failure
+ */
+int xc_vmtrace_disable(xc_interface *xch, uint32_t domid, uint32_t vcpu);
+
+/**
+ * Enable vmtrace for a given vCPU, along with resetting status/offset
+ * details.
+ *
+ * @parm xch a handle to an open hypervisor interface
+ * @parm domid domain identifier
+ * @parm vcpu vcpu identifier
+ * @return 0 on success, -1 on failure
+ */
+int xc_vmtrace_reset_and_enable(xc_interface *xch, uint32_t domid,
+                                uint32_t vcpu);
+
+/**
+ * Get current output position inside the trace buffer.
+ *
+ * Repeated calls will return different values if tracing is enabled.  It is
+ * platform specific what happens when the buffer fills completely.
+ *
+ * @parm xch a handle to an open hypervisor interface
+ * @parm domid domain identifier
+ * @parm vcpu vcpu identifier
+ * @parm pos current output position in bytes
+ * @return 0 on success, -1 on failure
+ */
+int xc_vmtrace_output_position(xc_interface *xch, uint32_t domid,
+                               uint32_t vcpu, uint64_t *pos);
+
+/**
+ * Get platform specific vmtrace options.
+ *
+ * @parm xch a handle to an open hypervisor interface
+ * @parm domid domain identifier
+ * @parm vcpu vcpu identifier
+ * @parm key platform-specific input
+ * @parm value platform-specific output
+ * @return 0 on success, -1 on failure
+ */
+int xc_vmtrace_get_option(xc_interface *xch, uint32_t domid,
+                          uint32_t vcpu, uint64_t key, uint64_t *value);
+
+/**
+ * Set platform specific vntvmtrace options.
+ *
+ * @parm xch a handle to an open hypervisor interface
+ * @parm domid domain identifier
+ * @parm vcpu vcpu identifier
+ * @parm key platform-specific input
+ * @parm value platform-specific input
+ * @return 0 on success, -1 on failure
+ */
+int xc_vmtrace_set_option(xc_interface *xch, uint32_t domid,
+                          uint32_t vcpu, uint64_t key, uint64_t value);
+
 int xc_domctl(xc_interface *xch, struct xen_domctl *domctl);
 int xc_sysctl(xc_interface *xch, struct xen_sysctl *sysctl);
 
diff --git a/tools/libs/ctrl/Makefile b/tools/libs/ctrl/Makefile
index 6106e36c49..ce9ecae710 100644
--- a/tools/libs/ctrl/Makefile
+++ b/tools/libs/ctrl/Makefile
@@ -22,6 +22,7 @@ SRCS-y       += xc_pm.c
 SRCS-y       += xc_cpu_hotplug.c
 SRCS-y       += xc_resume.c
 SRCS-y       += xc_vm_event.c
+SRCS-y       += xc_vmtrace.c
 SRCS-y       += xc_monitor.c
 SRCS-y       += xc_mem_paging.c
 SRCS-y       += xc_mem_access.c
diff --git a/tools/libs/ctrl/xc_vmtrace.c b/tools/libs/ctrl/xc_vmtrace.c
new file mode 100644
index 0000000000..602502367f
--- /dev/null
+++ b/tools/libs/ctrl/xc_vmtrace.c
@@ -0,0 +1,128 @@
+/******************************************************************************
+ * xc_vmtrace.c
+ *
+ * API for manipulating hardware tracing features
+ *
+ * Copyright (c) 2020, Michal Leszczynski
+ *
+ * Copyright 2020 CERT Polska. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "xc_private.h"
+
+int xc_vmtrace_enable(
+    xc_interface *xch, uint32_t domid, uint32_t vcpu)
+{
+    struct xen_domctl domctl = {
+        .cmd = XEN_DOMCTL_vmtrace_op,
+        .domain = domid,
+        .u.vmtrace_op = {
+            .cmd = XEN_DOMCTL_vmtrace_enable,
+            .vcpu = vcpu,
+        },
+    };
+
+    return do_domctl(xch, &domctl);
+}
+
+int xc_vmtrace_disable(
+    xc_interface *xch, uint32_t domid, uint32_t vcpu)
+{
+    struct xen_domctl domctl = {
+        .cmd = XEN_DOMCTL_vmtrace_op,
+        .domain = domid,
+        .u.vmtrace_op = {
+            .cmd = XEN_DOMCTL_vmtrace_disable,
+            .vcpu = vcpu,
+        },
+    };
+
+    return do_domctl(xch, &domctl);
+}
+
+int xc_vmtrace_reset_and_enable(
+    xc_interface *xch, uint32_t domid, uint32_t vcpu)
+{
+    struct xen_domctl domctl = {
+        .cmd = XEN_DOMCTL_vmtrace_op,
+        .domain = domid,
+        .u.vmtrace_op = {
+            .cmd = XEN_DOMCTL_vmtrace_reset_and_enable,
+            .vcpu = vcpu,
+        },
+    };
+
+    return do_domctl(xch, &domctl);
+}
+
+int xc_vmtrace_output_position(
+    xc_interface *xch, uint32_t domid, uint32_t vcpu, uint64_t *pos)
+{
+    struct xen_domctl domctl = {
+        .cmd = XEN_DOMCTL_vmtrace_op,
+        .domain = domid,
+        .u.vmtrace_op = {
+            .cmd = XEN_DOMCTL_vmtrace_output_position,
+            .vcpu = vcpu,
+        },
+    };
+    int rc = do_domctl(xch, &domctl);
+
+    if ( !rc )
+        *pos = domctl.u.vmtrace_op.value;
+
+    return rc;
+}
+
+int xc_vmtrace_get_option(
+    xc_interface *xch, uint32_t domid, uint32_t vcpu,
+    uint64_t key, uint64_t *value)
+{
+    struct xen_domctl domctl = {
+        .cmd = XEN_DOMCTL_vmtrace_op,
+        .domain = domid,
+        .u.vmtrace_op = {
+            .cmd = XEN_DOMCTL_vmtrace_get_option,
+            .vcpu = vcpu,
+            .key = key,
+        },
+    };
+    int rc = do_domctl(xch, &domctl);
+
+    if ( !rc )
+        *value = domctl.u.vmtrace_op.value;
+
+    return rc;
+}
+
+int xc_vmtrace_set_option(
+    xc_interface *xch, uint32_t domid, uint32_t vcpu,
+    uint64_t key, uint64_t value)
+{
+    struct xen_domctl domctl = {
+        .cmd = XEN_DOMCTL_vmtrace_op,
+        .domain = domid,
+        .u.vmtrace_op = {
+            .cmd = XEN_DOMCTL_vmtrace_set_option,
+            .vcpu = vcpu,
+            .key = key,
+            .value = value,
+        },
+    };
+
+    return do_domctl(xch, &domctl);
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:34:35 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:34:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84748.158881 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6J1-00037j-4R; Sun, 14 Feb 2021 01:34:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84748.158881; Sun, 14 Feb 2021 01:34:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6J1-00037b-0w; Sun, 14 Feb 2021 01:34:35 +0000
Received: by outflank-mailman (input) for mailman id 84748;
 Sun, 14 Feb 2021 01:34:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Iz-00037R-Sl
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:34:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Iz-0006uS-S8
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Iz-0005mY-RN
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:34:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ljn9bbCt08+1HZgvhhBf9F1KsOVKlz2gn5/M8dvI9XE=; b=cu/tLdvbe7tEzmFIvZ1WEPJ47g
	vMxHqAHIlZqjuLuF1/eU2bWapXbz/T1cenlpyF3bGnZXflQHCtI5ZJ6XG4NhHmNL4nxyM/AlIOAZv
	4tbhM8/apMpfjQkM2NB0i1Q3czf0W7DFhe3Pl4Kbx//Ts9HIHmNumwz/JOQwBCzwF2Z4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/misc: Add xen-vmtrace tool
Message-Id: <E1lB6Iz-0005mY-RN@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:34:33 +0000

commit 88dd8389dd2c9442729e9d96a4febaf38cd822e3
Author:     Michał Leszczyński <michal.leszczynski@cert.pl>
AuthorDate: Tue Jun 16 15:35:07 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:28 2021 +0000

    tools/misc: Add xen-vmtrace tool
    
    Add an demonstration tool that uses xc_vmtrace_* calls in order
    to manage external IPT monitoring for DomU.
    
    Signed-off-by: Michał Leszczyński <michal.leszczynski@cert.pl>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/misc/.gitignore    |   1 +
 tools/misc/Makefile      |   7 ++
 tools/misc/xen-vmtrace.c | 166 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 174 insertions(+)

diff --git a/tools/misc/.gitignore b/tools/misc/.gitignore
index b2c3b21f57..ce6f937d0c 100644
--- a/tools/misc/.gitignore
+++ b/tools/misc/.gitignore
@@ -1,3 +1,4 @@
 xen-access
 xen-memshare
 xen-ucode
+xen-vmtrace
diff --git a/tools/misc/Makefile b/tools/misc/Makefile
index 912c5d4f0e..2b683819d4 100644
--- a/tools/misc/Makefile
+++ b/tools/misc/Makefile
@@ -50,6 +50,10 @@ TARGETS_COPY += xenpvnetboot
 # Everything which needs to be built
 TARGETS_BUILD := $(filter-out $(TARGETS_COPY),$(TARGETS_ALL))
 
+# ... including build-only targets
+TARGETS_BUILD-$(CONFIG_X86)    += xen-vmtrace
+TARGETS_BUILD += $(TARGETS_BUILD-y)
+
 .PHONY: all build
 all build: $(TARGETS_BUILD)
 
@@ -90,6 +94,9 @@ xen-hvmcrash: xen-hvmcrash.o
 xen-memshare: xen-memshare.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
+xen-vmtrace: xen-vmtrace.o
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenforeignmemory) $(APPEND_LDFLAGS)
+
 xenperf: xenperf.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
diff --git a/tools/misc/xen-vmtrace.c b/tools/misc/xen-vmtrace.c
new file mode 100644
index 0000000000..7572e880c5
--- /dev/null
+++ b/tools/misc/xen-vmtrace.c
@@ -0,0 +1,166 @@
+/******************************************************************************
+ * tools/vmtrace.c
+ *
+ * Demonstrative tool for collecting Intel Processor Trace data from Xen.
+ *  Could be used to externally monitor a given vCPU in given DomU.
+ *
+ * Copyright (C) 2020 by CERT Polska - NASK PIB
+ *
+ * Authors: Michał Leszczyński, michal.leszczynski@cert.pl
+ * Date:    June, 2020
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; under version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <err.h>
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+
+#include <xenctrl.h>
+#include <xenforeignmemory.h>
+
+#define MSR_RTIT_CTL                        0x00000570
+#define  RTIT_CTL_OS                        (1 <<  2)
+#define  RTIT_CTL_USR                       (1 <<  3)
+#define  RTIT_CTL_BRANCH_EN                 (1 << 13)
+
+static xc_interface *xch;
+static xenforeignmemory_handle *fh;
+static uint32_t domid, vcpu;
+static size_t size;
+static char *buf;
+
+static sig_atomic_t interrupted;
+static void int_handler(int signum)
+{
+    interrupted = 1;
+}
+
+static int get_more_data(void)
+{
+    static uint64_t last_pos;
+    uint64_t pos;
+
+    if ( xc_vmtrace_output_position(xch, domid, vcpu, &pos) )
+    {
+        perror("xc_vmtrace_output_position()");
+        return -1;
+    }
+
+    if ( pos > last_pos )
+        fwrite(buf + last_pos, pos - last_pos, 1, stdout);
+    else if ( pos < last_pos )
+    {
+        /* buffer wrapped */
+        fwrite(buf + last_pos, size - last_pos, 1, stdout);
+        fwrite(buf, pos, 1, stdout);
+    }
+
+    last_pos = pos;
+    return 0;
+}
+
+int main(int argc, char **argv)
+{
+    int rc, exit = 1;
+    xenforeignmemory_resource_handle *fres = NULL;
+
+    if ( signal(SIGINT, int_handler) == SIG_ERR )
+        err(1, "Failed to register signal handler\n");
+
+    if ( argc != 3 )
+    {
+        fprintf(stderr, "Usage: %s <domid> <vcpu_id>\n", argv[0]);
+        fprintf(stderr, "It's recommended to redirect thisprogram's output to file\n");
+        fprintf(stderr, "or to pipe it's output to xxd or other program.\n");
+        return 1;
+    }
+
+    domid = atoi(argv[1]);
+    vcpu  = atoi(argv[2]);
+
+    xch = xc_interface_open(NULL, NULL, 0);
+    fh = xenforeignmemory_open(NULL, 0);
+
+    if ( !xch )
+        err(1, "xc_interface_open()");
+    if ( !fh )
+        err(1, "xenforeignmemory_open()");
+
+    rc = xenforeignmemory_resource_size(
+        fh, domid, XENMEM_resource_vmtrace_buf, vcpu, &size);
+    if ( rc )
+        err(1, "xenforeignmemory_resource_size()");
+
+    fres = xenforeignmemory_map_resource(
+        fh, domid, XENMEM_resource_vmtrace_buf, vcpu,
+        0, size >> XC_PAGE_SHIFT, (void **)&buf, PROT_READ, 0);
+    if ( !fres )
+        err(1, "xenforeignmemory_map_resource()");
+
+    if ( xc_vmtrace_set_option(
+             xch, domid, vcpu, MSR_RTIT_CTL,
+             RTIT_CTL_BRANCH_EN | RTIT_CTL_USR | RTIT_CTL_OS) )
+    {
+        perror("xc_vmtrace_set_option()");
+        goto out;
+    }
+
+    if ( xc_vmtrace_enable(xch, domid, vcpu) )
+    {
+        perror("xc_vmtrace_enable()");
+        goto out;
+    }
+
+    while ( !interrupted )
+    {
+        xc_dominfo_t dominfo;
+
+        if ( get_more_data() )
+            goto out;
+
+        usleep(1000 * 100);
+
+        if ( xc_domain_getinfo(xch, domid, 1, &dominfo) != 1 ||
+             dominfo.domid != domid || dominfo.shutdown )
+        {
+            if ( get_more_data() )
+                goto out;
+            break;
+        }
+    }
+
+    exit = 0;
+
+ out:
+    if ( xc_vmtrace_disable(xch, domid, vcpu) )
+        perror("xc_vmtrace_disable()");
+
+    if ( fres && xenforeignmemory_unmap_resource(fh, fres) )
+        perror("xenforeignmemory_unmap_resource()");
+
+    return exit;
+}
+
+/*
+ * 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 Sun Feb 14 01:34:45 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:34:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84749.158884 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6JB-000398-6M; Sun, 14 Feb 2021 01:34:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84749.158884; Sun, 14 Feb 2021 01:34:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6JB-00038z-2m; Sun, 14 Feb 2021 01:34:45 +0000
Received: by outflank-mailman (input) for mailman id 84749;
 Sun, 14 Feb 2021 01:34:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6J9-00038p-W4
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:34:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6J9-0006uh-VS
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6J9-0005nj-Ue
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:34:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/mzQitpYc1ZsEp9nzcUQlU8rnTIMNbCQO9omXD+GnGU=; b=gYVYx/fxfP5maNR8NSdIfMMbJA
	ZN2V8CgSMAjUZcTj0WgWQRJIKjVhk2E/MMBAykEXvABNo+SJEA5jE0fZTowCDxH3Hxi83dXyUHdEQ
	xNMagWT8zZMpddOfPhvAD4Kk+4fw9lOGm/c3vG7xP/Ep3pFz+dqgN8Z6K/rzJDt/Tz84=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/vmtrace: support for VM forks
Message-Id: <E1lB6J9-0005nj-Ue@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:34:43 +0000

commit 9744611991a042e9aea348c5721b80cc2101c7e5
Author:     Tamas K Lengyel <tamas.lengyel@intel.com>
AuthorDate: Fri Sep 11 20:14:00 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:28 2021 +0000

    xen/vmtrace: support for VM forks
    
    Implement vmtrace_reset_pt function. Properly set IPT
    state for VM forks.
    
    Signed-off-by: Tamas K Lengyel <tamas.lengyel@intel.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/hvm/vmx/vmx.c    | 11 +++++++++++
 xen/arch/x86/mm/mem_sharing.c |  3 +++
 xen/include/asm-x86/hvm/hvm.h |  9 +++++++++
 3 files changed, 23 insertions(+)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index beb5692b8b..faba95d057 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2392,6 +2392,16 @@ static int vmtrace_output_position(struct vcpu *v, uint64_t *pos)
     return v->arch.hvm.vmx.ipt_active;
 }
 
+static int vmtrace_reset(struct vcpu *v)
+{
+    if ( !v->arch.hvm.vmx.ipt_active )
+        return -EINVAL;
+
+    v->arch.msrs->rtit.output_offset = 0;
+    v->arch.msrs->rtit.status = 0;
+    return 0;
+}
+
 static struct hvm_function_table __initdata vmx_function_table = {
     .name                 = "VMX",
     .cpu_up_prepare       = vmx_cpu_up_prepare,
@@ -2451,6 +2461,7 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .vmtrace_output_position = vmtrace_output_position,
     .vmtrace_set_option = vmtrace_set_option,
     .vmtrace_get_option = vmtrace_get_option,
+    .vmtrace_reset = vmtrace_reset,
     .tsc_scaling = {
         .max_ratio = VMX_TSC_MULTIPLIER_MAX,
     },
diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c
index adaeab4612..00ada05c10 100644
--- a/xen/arch/x86/mm/mem_sharing.c
+++ b/xen/arch/x86/mm/mem_sharing.c
@@ -1632,6 +1632,8 @@ static int copy_vcpu_settings(struct domain *cd, const struct domain *d)
             copy_domain_page(new_vcpu_info_mfn, vcpu_info_mfn);
         }
 
+        hvm_vmtrace_reset(cd_vcpu);
+
         /*
          * TODO: to support VMs with PV interfaces copy additional
          * settings here, such as PV timers.
@@ -1782,6 +1784,7 @@ static int fork(struct domain *cd, struct domain *d)
         cd->max_pages = d->max_pages;
         *cd->arch.cpuid = *d->arch.cpuid;
         *cd->arch.msr = *d->arch.msr;
+        cd->vmtrace_size = d->vmtrace_size;
         cd->parent = d;
     }
 
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index 960ec03917..150746de66 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -219,6 +219,7 @@ struct hvm_function_table {
     int (*vmtrace_output_position)(struct vcpu *v, uint64_t *pos);
     int (*vmtrace_set_option)(struct vcpu *v, uint64_t key, uint64_t value);
     int (*vmtrace_get_option)(struct vcpu *v, uint64_t key, uint64_t *value);
+    int (*vmtrace_reset)(struct vcpu *v);
 
     /*
      * Parameters and callbacks for hardware-assisted TSC scaling,
@@ -696,6 +697,14 @@ static inline int hvm_vmtrace_get_option(
     return -EOPNOTSUPP;
 }
 
+static inline int hvm_vmtrace_reset(struct vcpu *v)
+{
+    if ( hvm_funcs.vmtrace_reset )
+        return hvm_funcs.vmtrace_reset(v);
+
+    return -EOPNOTSUPP;
+}
+
 /*
  * This must be defined as a macro instead of an inline function,
  * because it uses 'struct vcpu' and 'struct domain' which have
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:34:55 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:34:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84750.158890 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6JL-0003AQ-8V; Sun, 14 Feb 2021 01:34:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84750.158890; Sun, 14 Feb 2021 01:34:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6JL-0003AJ-4N; Sun, 14 Feb 2021 01:34:55 +0000
Received: by outflank-mailman (input) for mailman id 84750;
 Sun, 14 Feb 2021 01:34:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6JK-0003A8-34
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:34:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6JK-0006uq-2Q
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:34:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6JK-0005p3-1X
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:34:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PGRRY29luWnPNWMETjjfGWn5mu5Ln28x80sBeyaaa5U=; b=1AGxfpzhDFycXZyiIqcEuVPnp4
	MiqwwpJyo0FGivrUM8lg71gZPqUSsPbW8/sw6YmNUn12sMQ942wFuVUTwTkdDolxCqByrpvyKbceR
	dYdVfHHb+GN413jM9vKx5K03yOd55J40LCPhSnNf7dcOckO9mZaXZZ53mfZtt2kMjTVE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vm_event: Carry the vmtrace buffer position in vm_event
Message-Id: <E1lB6JK-0005p3-1X@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:34:54 +0000

commit c5866ab93167a73a8d4d85b844edf4aa364a1aaa
Author:     Tamas K Lengyel <tamas.lengyel@intel.com>
AuthorDate: Mon Jan 18 12:46:37 2021 -0500
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:28 2021 +0000

    x86/vm_event: Carry the vmtrace buffer position in vm_event
    
    Add vmtrace_pos field to x86 regs in vm_event. Initialized to ~0 if
    vmtrace is not in use.
    
    Signed-off-by: Tamas K Lengyel <tamas.lengyel@intel.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/vm_event.c       | 3 +++
 xen/include/public/vm_event.h | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c
index 848d69c1b0..36272e9316 100644
--- a/xen/arch/x86/vm_event.c
+++ b/xen/arch/x86/vm_event.c
@@ -251,6 +251,9 @@ void vm_event_fill_regs(vm_event_request_t *req)
 
     req->data.regs.x86.shadow_gs = ctxt.shadow_gs;
     req->data.regs.x86.dr6 = ctxt.dr6;
+
+    if ( hvm_vmtrace_output_position(curr, &req->data.regs.x86.vmtrace_pos) != 1 )
+        req->data.regs.x86.vmtrace_pos = ~0;
 #endif
 }
 
diff --git a/xen/include/public/vm_event.h b/xen/include/public/vm_event.h
index 141ea024a3..147dc3ea73 100644
--- a/xen/include/public/vm_event.h
+++ b/xen/include/public/vm_event.h
@@ -223,6 +223,13 @@ struct vm_event_regs_x86 {
      */
     uint64_t npt_base;
 
+    /*
+     * Current position in the vmtrace buffer, or ~0 if vmtrace is not active.
+     *
+     * For Intel Processor Trace, it is the upper half of MSR_RTIT_OUTPUT_MASK.
+     */
+    uint64_t vmtrace_pos;
+
     uint32_t cs_base;
     uint32_t ss_base;
     uint32_t ds_base;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:35:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:35:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84751.158893 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6JV-0003Bq-AX; Sun, 14 Feb 2021 01:35:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84751.158893; Sun, 14 Feb 2021 01:35:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6JV-0003Bi-6O; Sun, 14 Feb 2021 01:35:05 +0000
Received: by outflank-mailman (input) for mailman id 84751;
 Sun, 14 Feb 2021 01:35:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6JU-0003Ba-7E
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:35:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6JU-0006vD-6V
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:35:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6JU-0005qW-4x
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:35:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sNogtggYoa6j701/ai4AUxC+0v8IGTPpZrUyYkjV6xY=; b=xFhyHpkiSsj39BZCC/N1gZX5b+
	ZnIgy/AcEZCzueOz5urBoIYbVONf+uHJtn4aZzuMRb109bmexN1uw1f0g+UObFV/YHdyV733FQy6I
	O2/I1YDSnqLEJLxiuC3H9byDRoiKkN5chGH0VO53yvzVYE7kmZQCci6fSGZj9ldUxDp8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vm_event: add response flag to reset vmtrace buffer
Message-Id: <E1lB6JU-0005qW-4x@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:35:04 +0000

commit ca82d3fecc93745ee17850a609ac7772bd7c8bf7
Author:     Tamas K Lengyel <tamas.lengyel@intel.com>
AuthorDate: Sat Jan 30 08:36:37 2021 -0500
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 5 17:37:28 2021 +0000

    x86/vm_event: add response flag to reset vmtrace buffer
    
    Allow resetting the vmtrace buffer in response to a vm_event. This can be used
    to optimize a use-case where detecting a looped vmtrace buffer is important.
    
    Signed-off-by: Tamas K Lengyel <tamas.lengyel@intel.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/vm_event.c        | 7 +++++++
 xen/common/vm_event.c          | 3 +++
 xen/include/asm-arm/vm_event.h | 6 ++++++
 xen/include/asm-x86/vm_event.h | 2 ++
 xen/include/public/vm_event.h  | 4 ++++
 5 files changed, 22 insertions(+)

diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c
index 36272e9316..8f73a73e2e 100644
--- a/xen/arch/x86/vm_event.c
+++ b/xen/arch/x86/vm_event.c
@@ -300,6 +300,13 @@ void vm_event_emulate_check(struct vcpu *v, vm_event_response_t *rsp)
     };
 }
 
+void vm_event_reset_vmtrace(struct vcpu *v)
+{
+#ifdef CONFIG_HVM
+    hvm_vmtrace_reset(v);
+#endif
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c
index 127f2d58f1..44d542f23e 100644
--- a/xen/common/vm_event.c
+++ b/xen/common/vm_event.c
@@ -424,6 +424,9 @@ static int vm_event_resume(struct domain *d, struct vm_event_domain *ved)
             if ( rsp.flags & VM_EVENT_FLAG_GET_NEXT_INTERRUPT )
                 vm_event_monitor_next_interrupt(v);
 
+            if ( rsp.flags & VM_EVENT_FLAG_RESET_VMTRACE )
+                vm_event_reset_vmtrace(v);
+
             if ( rsp.flags & VM_EVENT_FLAG_VCPU_PAUSED )
                 vm_event_vcpu_unpause(v);
         }
diff --git a/xen/include/asm-arm/vm_event.h b/xen/include/asm-arm/vm_event.h
index 14d1d341cc..abe7db1970 100644
--- a/xen/include/asm-arm/vm_event.h
+++ b/xen/include/asm-arm/vm_event.h
@@ -58,4 +58,10 @@ void vm_event_sync_event(struct vcpu *v, bool value)
     /* Not supported on ARM. */
 }
 
+static inline
+void vm_event_reset_vmtrace(struct vcpu *v)
+{
+    /* Not supported on ARM. */
+}
+
 #endif /* __ASM_ARM_VM_EVENT_H__ */
diff --git a/xen/include/asm-x86/vm_event.h b/xen/include/asm-x86/vm_event.h
index 785e741fba..0756124075 100644
--- a/xen/include/asm-x86/vm_event.h
+++ b/xen/include/asm-x86/vm_event.h
@@ -54,4 +54,6 @@ void vm_event_emulate_check(struct vcpu *v, vm_event_response_t *rsp);
 
 void vm_event_sync_event(struct vcpu *v, bool value);
 
+void vm_event_reset_vmtrace(struct vcpu *v);
+
 #endif /* __ASM_X86_VM_EVENT_H__ */
diff --git a/xen/include/public/vm_event.h b/xen/include/public/vm_event.h
index 147dc3ea73..36135ba4f1 100644
--- a/xen/include/public/vm_event.h
+++ b/xen/include/public/vm_event.h
@@ -123,6 +123,10 @@
  * Set if the event comes from a nested VM and thus npt_base is valid.
  */
 #define VM_EVENT_FLAG_NESTED_P2M         (1 << 12)
+/*
+ * Reset the vmtrace buffer (if vmtrace is enabled)
+ */
+#define VM_EVENT_FLAG_RESET_VMTRACE      (1 << 13)
 
 /*
  * Reasons for the vm event request
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:35:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:35:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84752.158897 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Jf-0003DQ-Dp; Sun, 14 Feb 2021 01:35:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84752.158897; Sun, 14 Feb 2021 01:35:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Jf-0003DD-AE; Sun, 14 Feb 2021 01:35:15 +0000
Received: by outflank-mailman (input) for mailman id 84752;
 Sun, 14 Feb 2021 01:35:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Je-0003D3-Bl
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:35:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Je-0006vL-Aj
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:35:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Je-0005rg-93
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:35:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uyzaJEU2Eyeo2bao0MmcRG7Os7YKhbzCH3SSl2QIYmw=; b=EB7MtJiDwur6J6pdkPCPnjGPLO
	tqs/lyLjjD9sjnmqap3XABrBqyPyNGPPDPe7AxpJCnrkSABX4GwJLMz0jbqF0RsACEvA9eO6FZyK2
	GuGqeuniYtkmXRk1qhy3vbc13bYFycBzUbuT0CbakvLo7p/Y6A7Jdb62LdhAJVBhCGz8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxl: pass libxl__domain_build_state to libxl__arch_domain_create
Message-Id: <E1lB6Je-0005rg-93@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:35:14 +0000

commit 804fe751375b1f40eb3142121bf2b70fa2a83972
Author:     Igor Druzhinin <igor.druzhinin@citrix.com>
AuthorDate: Wed Feb 3 20:07:03 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 8 12:26:44 2021 +0000

    tools/libxl: pass libxl__domain_build_state to libxl__arch_domain_create
    
    No functional change.
    
    Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/light/libxl_arch.h | 6 ++++--
 tools/libs/light/libxl_arm.c  | 4 +++-
 tools/libs/light/libxl_dom.c  | 2 +-
 tools/libs/light/libxl_x86.c  | 6 ++++--
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/tools/libs/light/libxl_arch.h b/tools/libs/light/libxl_arch.h
index 6a91775b9e..c305d704b1 100644
--- a/tools/libs/light/libxl_arch.h
+++ b/tools/libs/light/libxl_arch.h
@@ -30,8 +30,10 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
 
 /* arch specific internal domain creation function */
 _hidden
-int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
-               uint32_t domid);
+int libxl__arch_domain_create(libxl__gc *gc,
+                              libxl_domain_config *d_config,
+                              libxl__domain_build_state *state,
+                              uint32_t domid);
 
 /* setup arch specific hardware description, i.e. DTB on ARM */
 _hidden
diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index 66e8a065fe..8c4eda3caf 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -126,7 +126,9 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
     return 0;
 }
 
-int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
+int libxl__arch_domain_create(libxl__gc *gc,
+                              libxl_domain_config *d_config,
+                              ibxl__domain_build_state *state,
                               uint32_t domid)
 {
     return 0;
diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c
index 19168572fd..842a51c86c 100644
--- a/tools/libs/light/libxl_dom.c
+++ b/tools/libs/light/libxl_dom.c
@@ -378,7 +378,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
     state->store_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->store_domid);
     state->console_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->console_domid);
 
-    rc = libxl__arch_domain_create(gc, d_config, domid);
+    rc = libxl__arch_domain_create(gc, d_config, state, domid);
 
     /* Construct a CPUID policy, but only for brand new domains.  Domains
      * being migrated-in/restored have CPUID handled during the
diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c
index 91a9fc72ed..91169d1045 100644
--- a/tools/libs/light/libxl_x86.c
+++ b/tools/libs/light/libxl_x86.c
@@ -453,8 +453,10 @@ static int hvm_set_conf_params(libxl__gc *gc, uint32_t domid,
     return ret;
 }
 
-int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
-        uint32_t domid)
+int libxl__arch_domain_create(libxl__gc *gc,
+                              libxl_domain_config *d_config,
+                              libxl__domain_build_state *state,
+                              uint32_t domid)
 {
     const libxl_domain_build_info *info = &d_config->b_info;
     int ret = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:35:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:35:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84753.158902 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Jp-0003Ek-Fu; Sun, 14 Feb 2021 01:35:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84753.158902; Sun, 14 Feb 2021 01:35:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Jp-0003Ee-Bf; Sun, 14 Feb 2021 01:35:25 +0000
Received: by outflank-mailman (input) for mailman id 84753;
 Sun, 14 Feb 2021 01:35:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Jo-0003EX-EZ
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:35:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Jo-0006vm-Dt
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:35:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Jo-0005sm-D1
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:35:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mU3SZguwhvPhYUJ+e/WgG9si0k8IJuPoih+RjBXyuY0=; b=5XTMIB69dlyt5arJwYf4zSeZlp
	jZzTqBX8NrkCqvGlwBtnbn0CJu5nFFznckJwU8nMNPprfyOHyeTS5YV6fqRXrgX3ck53qZUE+lL+N
	VoP9bXW8sOw59r7RmS1PKwpewWiGZJTAf5Udpc0cX73eQCNHfLjN8SMYHUiBGHWt21Lg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxl: only set viridian flags on new domains
Message-Id: <E1lB6Jo-0005sm-D1@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:35:24 +0000

commit 25ee478662d378ec2b24f517fb6d8d4829b885ff
Author:     Igor Druzhinin <igor.druzhinin@citrix.com>
AuthorDate: Wed Feb 3 20:07:04 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 8 12:26:44 2021 +0000

    tools/libxl: only set viridian flags on new domains
    
    Domains migrating or restoring should have viridian HVM param key in
    the migration stream already and setting that twice results in Xen
    returing -EEXIST on the second attempt later (during migration stream parsing)
    in case the values don't match. That causes migration/restore operation
    to fail at destination side.
    
    That issue is now resurfaced by the latest commits (983524671 and 7e5cffcd1e)
    extending default viridian feature set making the values from the previous
    migration streams and those set at domain construction different.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/light/libxl_x86.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c
index 91169d1045..58187ed760 100644
--- a/tools/libs/light/libxl_x86.c
+++ b/tools/libs/light/libxl_x86.c
@@ -468,7 +468,10 @@ int libxl__arch_domain_create(libxl__gc *gc,
         (ret = hvm_set_conf_params(gc, domid, info)) != 0)
         goto out;
 
-    if (info->type == LIBXL_DOMAIN_TYPE_HVM &&
+    /* Viridian flags are already a part of the migration stream so set
+     * them here only for brand new domains. */
+    if (!state->restore &&
+        info->type == LIBXL_DOMAIN_TYPE_HVM &&
         (ret = hvm_set_viridian_features(gc, domid, info)) != 0)
         goto out;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:35:35 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:35:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84754.158906 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Jz-0003GA-GY; Sun, 14 Feb 2021 01:35:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84754.158906; Sun, 14 Feb 2021 01:35:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Jz-0003Fy-DA; Sun, 14 Feb 2021 01:35:35 +0000
Received: by outflank-mailman (input) for mailman id 84754;
 Sun, 14 Feb 2021 01:35:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Jy-0003Fo-IH
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:35:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Jy-0006vu-Gm
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:35:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Jy-0005tz-GB
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:35:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NTJr/BMPs9pw8zdrl4mafM0wYBPiG86xXS0fiD0ev1Y=; b=fIZI4hM3Xrp1xSfC0cTfLJJjqj
	7V/3OCCw5GffbwVwqOYg+LQPPyq8jCp0+1B/hpsmbWNpiT5TdQymMzffpNjgIuicgwTxRwxCZSP4W
	skKZqgc27Qbp7ZanR4ceQD2yqPntZL7d0Q/v29xvtq76vbWP2psSqiSwwNwUIdvb8I14=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxl: Fix ARM build
Message-Id: <E1lB6Jy-0005tz-GB@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:35:34 +0000

commit c973c38c2722b44396e94b64655a909330c631e7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 8 14:36:32 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 8 14:36:32 2021 +0000

    tools/libxl: Fix ARM build
    
    Fixes: 804fe751375 ("tools/libxl: pass libxl__domain_build_state to libxl__arch_domain_create")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/light/libxl_arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index 8c4eda3caf..5e2a209a8b 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -128,7 +128,7 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
 
 int libxl__arch_domain_create(libxl__gc *gc,
                               libxl_domain_config *d_config,
-                              ibxl__domain_build_state *state,
+                              libxl__domain_build_state *state,
                               uint32_t domid)
 {
     return 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:35:45 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:35:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84755.158909 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6K9-0003HK-HY; Sun, 14 Feb 2021 01:35:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84755.158909; Sun, 14 Feb 2021 01:35:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6K9-0003HC-Eh; Sun, 14 Feb 2021 01:35:45 +0000
Received: by outflank-mailman (input) for mailman id 84755;
 Sun, 14 Feb 2021 01:35:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6K8-0003H4-KN
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:35:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6K8-0006w2-Jd
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:35:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6K8-0005v5-Iw
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:35:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aFbtsGtrWMrHdu3exmroJw0TRAdAfN8oq4tfHx33klM=; b=LyikH1Peyd+RTsW2sVxOJ+FRm7
	gDTNSsNdduw7we2qfeBVFb/sWg9SpLZ8Y+kPBVBlPLhBTbMYZuBsJOG7YXXxZCmKZZhbdg6695al4
	kRF1aiM2Qog6rYGgewFTV2szxFG7WHo6pztUGlu/qBO9+uT/Y+yl2m1/HkbUUl+LPN8I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: remove stale create example from xl.1
Message-Id: <E1lB6K8-0005v5-Iw@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:35:44 +0000

commit 8563c9e3a7bdf8c928a8e675e6b2c9c9254bd440
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Mon Jan 11 18:41:48 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Feb 8 15:43:31 2021 +0000

    docs: remove stale create example from xl.1
    
    Maybe xm create had a feature to create a domU based on a configuration
    file. xl create requires the '-f' option to refer to a file.
    There is no code to look into XEN_CONFIG_DIR, so remove the example.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 docs/man/xl.1.pod.in | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index f4779d8fd6..0354d3beba 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -171,13 +171,6 @@ B<EXAMPLES>
 
 =over 4
 
-=item I<with config file>
-
-  xl create DebianLenny
-
-This creates a domain with the file /etc/xen/DebianLenny, and returns as
-soon as it is run.
-
 =item I<with extra parameters>
 
   xl create hvm.cfg 'cpus="0-3"; pci=["01:05.1","01:05.2"]'
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:35:56 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:35:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84756.158913 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6KK-0003Ij-JB; Sun, 14 Feb 2021 01:35:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84756.158913; Sun, 14 Feb 2021 01:35:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6KK-0003Ib-GC; Sun, 14 Feb 2021 01:35:56 +0000
Received: by outflank-mailman (input) for mailman id 84756;
 Sun, 14 Feb 2021 01:35:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6KI-0003IO-Nc
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:35:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6KI-0006wC-Mw
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:35:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6KI-0005wB-Ln
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:35:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Yb4qbje454Jz3UK5Mj/JvBQENGDstVoBnTajvpRjIsU=; b=I/MEej+md0aaMEgUsoKz+TaiqC
	bG7GxaDeqjYporxErJNeEfKDmxtNdCQl6uTH+IrqH7WzCq6Br46Et56ROUN/hryU3FXtnE0EdPpTc
	3VtgFmFMejz5XAuqjiaUH5O6u+yggm2qGzEBJ+XlRgWIilrqN67wqhQtrQbtwTvXJKw0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: substitute XEN_CONFIG_DIR in xl.conf.5
Message-Id: <E1lB6KI-0005wB-Ln@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:35:54 +0000

commit 52280d9492ee486be735859ef496220534c71905
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Mon Jan 11 18:41:49 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Feb 8 15:45:28 2021 +0000

    docs: substitute XEN_CONFIG_DIR in xl.conf.5
    
    xl(1) opens xl.conf in XEN_CONFIG_DIR.
    Substitute this variable also in the man page.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 docs/man/xl.1.pod.in   | 2 +-
 docs/man/xl.conf.5.pod | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index 0354d3beba..e206039d99 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -50,7 +50,7 @@ setup the bridge.
 
 If you specify the amount of memory dom0 has, passing B<dom0_mem> to
 Xen, it is highly recommended to disable B<autoballoon>. Edit
-B</etc/xen/xl.conf> and set it to 0.
+B<@XEN_CONFIG_DIR@/xl.conf> and set it to 0.
 
 =item run xl as B<root>
 
diff --git a/docs/man/xl.conf.5.pod b/docs/man/xl.conf.5.pod
index 41ee428744..dfea9d64ba 100644
--- a/docs/man/xl.conf.5.pod
+++ b/docs/man/xl.conf.5.pod
@@ -1,6 +1,6 @@
 =head1 NAME
 
-/etc/xen/xl.conf - XL Global/Host Configuration 
+@XEN_CONFIG_DIR@/xl.conf - XL Global/Host Configuration
 
 =head1 DESCRIPTION
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:36:06 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:36:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84757.158916 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6KU-0003Jp-KW; Sun, 14 Feb 2021 01:36:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84757.158916; Sun, 14 Feb 2021 01:36:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6KU-0003Jh-Hc; Sun, 14 Feb 2021 01:36:06 +0000
Received: by outflank-mailman (input) for mailman id 84757;
 Sun, 14 Feb 2021 01:36: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 1lB6KS-0003JS-QJ
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:36:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6KS-0006wd-Pg
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:36:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6KS-0005xU-P2
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:36:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=w3MbBY2crk6AekF/f9wLCCbCvGnkshF7ARvYvjFEdMY=; b=wNngo3dQw9AKRTYODsG1IZqOdd
	KiEbU6DqgScb86a8yjStvLsmQS9e9h+f/vlR1/OW1zw7tneBM37BIZtHncigGrUjzDXrzdtAa3TJ6
	cElwxv8fBI44DKQKAaeKG+OX2RAqLftImU4C+kBf3AnSz4WuYrO9Xr4I5Zu6aKB6eQy8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Update .gitignore for some docs files
Message-Id: <E1lB6KS-0005xU-P2@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:36:04 +0000

commit 12e459742544fa0ef3260ec1cda7ea6fe2cd53bd
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Mon Feb 8 16:07:32 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Feb 8 16:08:10 2021 +0000

    Update .gitignore for some docs files
    
    [ split out of a larger commit -iwj ]
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 .gitignore | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.gitignore b/.gitignore
index 9e0488e0cd..1c2fa1530b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,7 +48,10 @@ dist/*
 docs/tmp.*
 docs/html/
 docs/man/xl.cfg.5.pod
+docs/man/xl-disk-configuration.5.pod
+docs/man/xl-network-configuration.5.pod
 docs/man/xl.1.pod
+docs/man/xl.conf.5.pod
 docs/man1/
 docs/man5/
 docs/man7/
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:36:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:36:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84758.158921 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Ke-0003Mj-MR; Sun, 14 Feb 2021 01:36:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84758.158921; Sun, 14 Feb 2021 01:36:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Ke-0003Mc-JB; Sun, 14 Feb 2021 01:36:16 +0000
Received: by outflank-mailman (input) for mailman id 84758;
 Sun, 14 Feb 2021 01:36:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Kc-0003MP-U3
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:36:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Kc-0006wl-TG
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:36:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Kc-0005yc-S9
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:36:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ILcpGxl3y7mI7ut8PPrqnjQrZd96JNkku6LYn1kl40s=; b=b2QN48w6NpFAsNlpEUI+aq1+4A
	TA8D7/hhKBSpnfq/mEng5YGIjaAvJwz3PmW/uPaiqeic22vjaWdSVv4XnyfbFqox3g2iflxHCun5Q
	BiJBcS119D48FgZe5Grh8yfyR0MOIgz0uWqlWNPnwYlSbE7RRYIoJFz4AyyUAE/JV0oU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Use XEN_SCRIPT_DIR to refer to /etc/xen/scripts
Message-Id: <E1lB6Kc-0005yc-S9@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:36:14 +0000

commit 53c8785b63a777902563394a93428030cbecf943
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Mon Jan 11 18:41:51 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Feb 8 16:22:00 2021 +0000

    Use XEN_SCRIPT_DIR to refer to /etc/xen/scripts
    
    Replace all hardcoded paths to use XEN_SCRIPT_DIR to expand the actual
    location.
    
    [ .gitignore change split out -iwj ]
    [ dropped erroneous hunk for docs/misc/block-scripts.txt iwj ]
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 docs/configure.ac                          |   3 +
 docs/man/xl-disk-configuration.5.pod       | 529 -----------------------------
 docs/man/xl-disk-configuration.5.pod.in    | 529 +++++++++++++++++++++++++++++
 docs/man/xl-network-configuration.5.pod    | 260 --------------
 docs/man/xl-network-configuration.5.pod.in | 260 ++++++++++++++
 docs/man/xl.1.pod.in                       |   2 +-
 docs/man/xl.conf.5.pod                     | 229 -------------
 docs/man/xl.conf.5.pod.in                  | 229 +++++++++++++
 tools/xl/xl_cmdtable.c                     |   2 +-
 9 files changed, 1023 insertions(+), 1020 deletions(-)

diff --git a/docs/configure.ac b/docs/configure.ac
index cb5a6eaa4c..c2e5edd3b3 100644
--- a/docs/configure.ac
+++ b/docs/configure.ac
@@ -9,6 +9,9 @@ AC_CONFIG_FILES([
 ../config/Docs.mk
 man/xl.cfg.5.pod
 man/xl.1.pod
+man/xl-disk-configuration.5.pod
+man/xl-network-configuration.5.pod
+man/xl.conf.5.pod
 ])
 AC_CONFIG_AUX_DIR([../])
 
diff --git a/docs/man/xl-disk-configuration.5.pod b/docs/man/xl-disk-configuration.5.pod
deleted file mode 100644
index 46feedb95e..0000000000
--- a/docs/man/xl-disk-configuration.5.pod
+++ /dev/null
@@ -1,529 +0,0 @@
-=head1 NAME
-
-xl-disk-configuration - XL Disk Configuration Syntax
-
-=head1 SYNTAX
-
-This document specifies the xl config file format disk configuration
-option.  It has the following form:
-
-   disk = [ 'DISKSPEC', 'DISKSPEC', ... ]
-
-where each C<DISKSPEC> is in this form:
-
-   [<key>=<value>|<flag>,]*,
-     [<target>, [<format>, [<vdev>, [<access>]]]],
-     [<key>=<value>|<flag>,]*
-     [target=<target>]
-
-For example, these strings are equivalent:
-
-    /dev/vg/guest-volume,,hda
-    /dev/vg/guest-volume,raw,hda,rw
-    format=raw, vdev=hda, access=rw, target=/dev/vg/guest-volume
-    raw:/dev/vg/guest-volume,hda,w  (deprecated, see below)
-
-As are these:
-
-    /root/image.iso,,hdc,cdrom
-    /root/image.iso,,hdc,,cdrom
-    /root/image.iso,raw,hdc,devtype=cdrom
-    format=raw, vdev=hdc, access=ro, devtype=cdrom, target=/root/image.iso
-    raw:/root/image.iso,hdc:cdrom,ro   (deprecated, see below)
-
-These might be specified in the domain config file like this:
-
-    disk = [ '/dev/vg/guest-volume,,hda', '/root/image.iso,,hdc,cdrom' ]
-
-
-More formally, the string is a series of comma-separated keyword/value
-pairs, flags and positional parameters.  Parameters which are not bare
-keywords and which do not contain "=" symbols are assigned to the
-so-far-unspecified positional parameters, in the order below.  The
-positional parameters may also be specified explicitly by name.
-
-Each parameter may be specified at most once, either as a positional
-parameter or a named parameter.  Default values apply if the parameter
-is not specified, or if it is specified with an empty value (whether
-positionally or explicitly).
-
-Whitespace may appear before each parameter and will be ignored.
-
-=head1 Positional Parameters
-
-=over 4
-
-=item B<target>
-
-=over 4
-
-=item Description
-
-Block device or image file path.  When this is used as a path, F</dev>
-will be prepended if the path doesn't start with a '/'.
-
-=item Supported values
-
-N/A
-
-=item Deprecated values
-
-N/A
-
-=item Default value
-
-None.  While a path is provided in most cases there is an exception:
-for a cdrom device, lack of this attribute would imply an empty cdrom
-drive.
-
-=item Special syntax
-
-When this parameter is specified by name, ie with the C<target=>
-syntax in the configuration file, it consumes the whole rest of the
-C<DISKSPEC> including trailing whitespaces.  Therefore in that case
-it must come last.  This is permissible even if an empty value for
-the target was already specified as a positional parameter.  This
-is the only way to specify a target string containing metacharacters
-such as commas and (in some cases) colons, which would otherwise be
-misinterpreted.
-
-Future parameter and flag names will start with an ascii letter and
-contain only ascii alphanumerics, hyphens and underscores, and will
-not be legal as vdevs.  Targets which might match that syntax
-should not be specified as positional parameters.
-
-=back
-
-=item B<format>
-
-=over 4
-
-=item Description
-
-Specifies the format of image file.
-
-=item Supported values
-
-raw, qcow, qcow2, vhd, qed
-
-=item Deprecated values
-
-None
-
-=item Default value
-
-raw
-
-=back
-
-=item B<vdev>
-
-=over 4
-
-=item Description
-
-Virtual device as seen by the guest (also referred to as guest drive
-designation in some specifications).  See L<xen-vbd-interface(7)>.
-
-=item Supported values
-
-hd[x], xvd[x], sd[x] etc.  Please refer to the above specification for
-further details.
-
-=item Deprecated values
-
-None
-
-=item Default Value
-
-None, this parameter is mandatory.
-
-=back
-
-=item B<access>
-
-=over 4
-
-=item Description
-
-Specified access control information.  Whether or not the block device is
-provided to the guest in read-only or read-write mode depends on this
-attribute.
-
-=item Supported values
-
-C<ro>, C<r>   (specifies read-only)
-
-C<rw>, C<w>   (specifies read/write)
-
-=item Deprecated values
-
-None
-
-=item Default value
-
-C<rw> unless devtype=cdrom, in which case C<r>
-
-=back
-
-=back
-
-=head1 Other Parameters And Flags
-
-=over 4
-
-=item B<devtype>=I<DEVTYPE>
-
-=over 4
-
-=item Description
-
-Qualifies virtual device type.
-
-=item Supported values
-
-cdrom
-
-=item Deprecated values
-
-None
-
-=item Mandatory
-
-No
-
-=back
-
-=item B<cdrom>
-
-Convenience alias for "devtype=cdrom".
-
-
-=item B<backend>=I<DOMAIN-NAME>
-
-=over 4
-
-=item Description
-
-Designates a backend domain for the device
-
-=item Supported values
-
-Valid domain names
-
-=item Mandatory
-
-No
-
-=back
-
-Specifies the backend domain which this device should attach to. This
-defaults to domain 0. Specifying another domain requires setting up a
-driver domain which is outside the scope of this document.
-
-
-=item B<backendtype>=I<TYPE>
-
-=over 4
-
-=item Description
-
-Specifies the backend implementation to use
-
-=item Supported values
-
-phy, qdisk
-
-=item Mandatory
-
-No
-
-=item Default value
-
-Automatically determine which backend to use.
-
-=back
-
-This does not affect the guest's view of the device.  It controls
-which software implementation of the Xen backend driver is used.
-
-Not all backend drivers support all combinations of other options.
-For example, "phy" does not support formats other than "raw".
-Normally this option should not be specified, in which case libxl will
-automatically determine the most suitable backend.
-
-
-=item B<script>=I<SCRIPT>
-
-Specifies that B<target> is not a normal host path, but rather
-information to be interpreted by the executable program I<SCRIPT>,
-(looked for in F</etc/xen/scripts>, if it doesn't contain a slash).
-
-These scripts are normally called "block-I<SCRIPT>".
-
-
-=item B<direct-io-safe>
-
-=over 4
-
-=item Description
-
-Disables non-O_DIRECT workaround
-
-=item Supported values
-
-absent, present
-
-=item Mandatory
-
-No
-
-=item Default value
-
-absent (workaround may be enabled)
-
-=back
-
-There is a memory lifetime bug in some driver domain (dom0) kernels
-which can cause crashes when using O_DIRECT.  The bug occurs due to a
-mismatch between the backend-visible lifetime of pages used for the
-Xen PV network protocol and that expected by the backend kernel's
-networking subsystem.  This can cause crashes when using certain
-backends with certain underlying storage.
-
-See:
- L<https://lists.xenproject.org/archives/html/xen-devel/2012-12/msg01154.html>
-
-For this reason, (this version of) the Xen libxl toolstack disables
-O_DIRECT when using the qemu-based Xen PV backend (C<qdisk>).
-
-However, this workaround has performance and scaling implications, and
-it is only necessary if the underlying device is a network filesystem.
-If the underlying device is not, then it is good to disable it; that
-is what this option is for.
-
-This option simply requests that the workaround be disabled.  (However,
-not all backends versions which use the workaround understand this
-option, so this is on a best effort basis.)
-
-It's important to note that if you are storing the VM disk on a
-network filesystem or a network block device (NFS or ISCSI) it might
-not be safe to use this option.  Otherwise specifying it is safe and
-can give better performances.
-
-If in the future the bug is fixed properly this option will then be
-silently ignored.
-
-
-=item B<discard> / B<no-discard>
-
-=over 4
-
-=item Description
-
-Request that backend advertise discard support to frontend
-
-=item Supported values
-
-discard, no-discard
-
-=item Mandatory
-
-No
-
-=item Default value
-
-discard
-
-=back
-
-An advisory setting for the backend driver, specifying whether to
-advertise discard support (TRIM, UNMAP) to the frontend.  The real
-benefit of this option is to be able to force it off rather than on.  It
-can be used to disable "hole punching" for file based backends which
-were intentionally created non-sparse to avoid fragmentation of the
-file.
-
-=back
-
-
-=head1 COLO Parameters
-
-=over 4
-
-=item B<colo>
-
-Enable COLO HA for disk. For better understanding block replication on
-QEMU, please refer to: L<https://wiki.qemu.org/Features/BlockReplication>
-Note that the COLO configuration settings should be considered unstable.
-They may change incompatibly in future versions of Xen.
-
-
-=item B<colo-host>
-
-=over 4
-
-=item Description
-
-Secondary host's address
-
-=item Mandatory
-
-Yes when COLO enabled
-
-=back
-
-=item B<colo-port>
-
-=over 4
-
-=item Description
-
-Secondary port.  We will run a nbd server on secondary host,
-and the nbd server will listen this port.
-
-=item Mandatory
-
-Yes when COLO enabled
-
-=back
-
-=item B<colo-export>
-
-=over 4
-
-=item Description
-
-We will run a nbd server on secondary host, exportname is
-the nbd server's disk export name.
-
-=item Mandatory
-
-Yes when COLO enabled
-
-=back
-
-=item B<active-disk>
-
-=over 4
-
-=item Description
-
-This is used by secondary. Secondary guest's write will be buffered in this
-disk.
-
-=item Mandatory
-
-Yes when COLO enabled
-
-=back
-
-=item B<hidden-disk>
-
-=over 4
-
-=item Description
-
-This is used by secondary. It buffers the original content that is modified
-by the primary VM.
-
-=item Mandatory
-
-Yes when COLO enabled
-
-=back
-
-=back
-
-
-=head1 Deprecated Parameters, Prefixes And Syntaxes
-
-Deprecated forms are acceptable and are intended work compatibly with
-xend and xl from xen 4.1.  In future they may print a warning.
-Support for deprecated parameters and syntaxes are likely to be
-dropped in future versions of xl.
-
-There is support for a deprecated old syntax for C<DISKSPEC>:
-
-  [<format>:][<target>],<vdev>[:<devtype>],<access>   (deprecated)
-
-This syntax also supports deprecated prefixes, described below.  These
-are found prepended to the format parameter - eg C<tap:aio:qcow:>.
-
-=over 4
-
-=item B<format>
-
-=over 4
-
-=item Description
-
-Specifies the format (deprecated)
-
-=item Supported values
-
-raw:  qcow2:  vhd:
-
-=back
-
-In xend and old versions of libxl it was necessary to specify the
-format with a prefix.  For compatibility, these three prefixes are
-recognised as specifying the corresponding format.  They are
-equivalent to C<format=FORMAT> or the specification of B<format>
-(without a colon) as a positional parameter.
-
-
-=item B<script>
-
-=over 4
-
-=item Description
-
-Specifies the script (deprecated)
-
-=item Supported values
-
-iscsi:  nbd:  enbd:  drbd:
-
-=back
-
-In xend and old versions of libxl it was necessary to specify the
-"script" (see above) with a prefix.  For compatibility, these four
-prefixes are recognised as specifying the corresponding script.  They
-are equivalent to C<script=block-SCRIPT>.
-
-
-=item B<deprecated-prefix>
-
-=over 4
-
-=item Description
-
-Deprecated prefix, ignored
-
-=item Supported values
-
-tapdisk:  tap2:  aio:  ioemu:  file:  phy:
-
-=back
-
-Various prefixes were required by xend and older versions of libxl to
-make the block devices work.  In some cases these options would
-override the backend type, but in other cases they would be ignored in
-favour of "making it work"; in yet other cases it would be necessary
-to specify several of these, for example:
-
-  tap:aio:/some/path...
-
-All of these prefixes are now stripped and ignored.
-
-=back
-
-=head2 Missing format and empty target
-
-The following syntax is also supported:
-
-  ,<vdev>:<devtype>,<access>   (deprecated)
-
-This is solely for compatibility with xend's syntax for empty cdroms,
-which is (for example) C<,hdc:cdrom,r>.
diff --git a/docs/man/xl-disk-configuration.5.pod.in b/docs/man/xl-disk-configuration.5.pod.in
new file mode 100644
index 0000000000..71d0e86e3d
--- /dev/null
+++ b/docs/man/xl-disk-configuration.5.pod.in
@@ -0,0 +1,529 @@
+=head1 NAME
+
+xl-disk-configuration - XL Disk Configuration Syntax
+
+=head1 SYNTAX
+
+This document specifies the xl config file format disk configuration
+option.  It has the following form:
+
+   disk = [ 'DISKSPEC', 'DISKSPEC', ... ]
+
+where each C<DISKSPEC> is in this form:
+
+   [<key>=<value>|<flag>,]*,
+     [<target>, [<format>, [<vdev>, [<access>]]]],
+     [<key>=<value>|<flag>,]*
+     [target=<target>]
+
+For example, these strings are equivalent:
+
+    /dev/vg/guest-volume,,hda
+    /dev/vg/guest-volume,raw,hda,rw
+    format=raw, vdev=hda, access=rw, target=/dev/vg/guest-volume
+    raw:/dev/vg/guest-volume,hda,w  (deprecated, see below)
+
+As are these:
+
+    /root/image.iso,,hdc,cdrom
+    /root/image.iso,,hdc,,cdrom
+    /root/image.iso,raw,hdc,devtype=cdrom
+    format=raw, vdev=hdc, access=ro, devtype=cdrom, target=/root/image.iso
+    raw:/root/image.iso,hdc:cdrom,ro   (deprecated, see below)
+
+These might be specified in the domain config file like this:
+
+    disk = [ '/dev/vg/guest-volume,,hda', '/root/image.iso,,hdc,cdrom' ]
+
+
+More formally, the string is a series of comma-separated keyword/value
+pairs, flags and positional parameters.  Parameters which are not bare
+keywords and which do not contain "=" symbols are assigned to the
+so-far-unspecified positional parameters, in the order below.  The
+positional parameters may also be specified explicitly by name.
+
+Each parameter may be specified at most once, either as a positional
+parameter or a named parameter.  Default values apply if the parameter
+is not specified, or if it is specified with an empty value (whether
+positionally or explicitly).
+
+Whitespace may appear before each parameter and will be ignored.
+
+=head1 Positional Parameters
+
+=over 4
+
+=item B<target>
+
+=over 4
+
+=item Description
+
+Block device or image file path.  When this is used as a path, F</dev>
+will be prepended if the path doesn't start with a '/'.
+
+=item Supported values
+
+N/A
+
+=item Deprecated values
+
+N/A
+
+=item Default value
+
+None.  While a path is provided in most cases there is an exception:
+for a cdrom device, lack of this attribute would imply an empty cdrom
+drive.
+
+=item Special syntax
+
+When this parameter is specified by name, ie with the C<target=>
+syntax in the configuration file, it consumes the whole rest of the
+C<DISKSPEC> including trailing whitespaces.  Therefore in that case
+it must come last.  This is permissible even if an empty value for
+the target was already specified as a positional parameter.  This
+is the only way to specify a target string containing metacharacters
+such as commas and (in some cases) colons, which would otherwise be
+misinterpreted.
+
+Future parameter and flag names will start with an ascii letter and
+contain only ascii alphanumerics, hyphens and underscores, and will
+not be legal as vdevs.  Targets which might match that syntax
+should not be specified as positional parameters.
+
+=back
+
+=item B<format>
+
+=over 4
+
+=item Description
+
+Specifies the format of image file.
+
+=item Supported values
+
+raw, qcow, qcow2, vhd, qed
+
+=item Deprecated values
+
+None
+
+=item Default value
+
+raw
+
+=back
+
+=item B<vdev>
+
+=over 4
+
+=item Description
+
+Virtual device as seen by the guest (also referred to as guest drive
+designation in some specifications).  See L<xen-vbd-interface(7)>.
+
+=item Supported values
+
+hd[x], xvd[x], sd[x] etc.  Please refer to the above specification for
+further details.
+
+=item Deprecated values
+
+None
+
+=item Default Value
+
+None, this parameter is mandatory.
+
+=back
+
+=item B<access>
+
+=over 4
+
+=item Description
+
+Specified access control information.  Whether or not the block device is
+provided to the guest in read-only or read-write mode depends on this
+attribute.
+
+=item Supported values
+
+C<ro>, C<r>   (specifies read-only)
+
+C<rw>, C<w>   (specifies read/write)
+
+=item Deprecated values
+
+None
+
+=item Default value
+
+C<rw> unless devtype=cdrom, in which case C<r>
+
+=back
+
+=back
+
+=head1 Other Parameters And Flags
+
+=over 4
+
+=item B<devtype>=I<DEVTYPE>
+
+=over 4
+
+=item Description
+
+Qualifies virtual device type.
+
+=item Supported values
+
+cdrom
+
+=item Deprecated values
+
+None
+
+=item Mandatory
+
+No
+
+=back
+
+=item B<cdrom>
+
+Convenience alias for "devtype=cdrom".
+
+
+=item B<backend>=I<DOMAIN-NAME>
+
+=over 4
+
+=item Description
+
+Designates a backend domain for the device
+
+=item Supported values
+
+Valid domain names
+
+=item Mandatory
+
+No
+
+=back
+
+Specifies the backend domain which this device should attach to. This
+defaults to domain 0. Specifying another domain requires setting up a
+driver domain which is outside the scope of this document.
+
+
+=item B<backendtype>=I<TYPE>
+
+=over 4
+
+=item Description
+
+Specifies the backend implementation to use
+
+=item Supported values
+
+phy, qdisk
+
+=item Mandatory
+
+No
+
+=item Default value
+
+Automatically determine which backend to use.
+
+=back
+
+This does not affect the guest's view of the device.  It controls
+which software implementation of the Xen backend driver is used.
+
+Not all backend drivers support all combinations of other options.
+For example, "phy" does not support formats other than "raw".
+Normally this option should not be specified, in which case libxl will
+automatically determine the most suitable backend.
+
+
+=item B<script>=I<SCRIPT>
+
+Specifies that B<target> is not a normal host path, but rather
+information to be interpreted by the executable program I<SCRIPT>,
+(looked for in F<@XEN_SCRIPT_DIR@>, if it doesn't contain a slash).
+
+These scripts are normally called "block-I<SCRIPT>".
+
+
+=item B<direct-io-safe>
+
+=over 4
+
+=item Description
+
+Disables non-O_DIRECT workaround
+
+=item Supported values
+
+absent, present
+
+=item Mandatory
+
+No
+
+=item Default value
+
+absent (workaround may be enabled)
+
+=back
+
+There is a memory lifetime bug in some driver domain (dom0) kernels
+which can cause crashes when using O_DIRECT.  The bug occurs due to a
+mismatch between the backend-visible lifetime of pages used for the
+Xen PV network protocol and that expected by the backend kernel's
+networking subsystem.  This can cause crashes when using certain
+backends with certain underlying storage.
+
+See:
+ L<https://lists.xenproject.org/archives/html/xen-devel/2012-12/msg01154.html>
+
+For this reason, (this version of) the Xen libxl toolstack disables
+O_DIRECT when using the qemu-based Xen PV backend (C<qdisk>).
+
+However, this workaround has performance and scaling implications, and
+it is only necessary if the underlying device is a network filesystem.
+If the underlying device is not, then it is good to disable it; that
+is what this option is for.
+
+This option simply requests that the workaround be disabled.  (However,
+not all backends versions which use the workaround understand this
+option, so this is on a best effort basis.)
+
+It's important to note that if you are storing the VM disk on a
+network filesystem or a network block device (NFS or ISCSI) it might
+not be safe to use this option.  Otherwise specifying it is safe and
+can give better performances.
+
+If in the future the bug is fixed properly this option will then be
+silently ignored.
+
+
+=item B<discard> / B<no-discard>
+
+=over 4
+
+=item Description
+
+Request that backend advertise discard support to frontend
+
+=item Supported values
+
+discard, no-discard
+
+=item Mandatory
+
+No
+
+=item Default value
+
+discard
+
+=back
+
+An advisory setting for the backend driver, specifying whether to
+advertise discard support (TRIM, UNMAP) to the frontend.  The real
+benefit of this option is to be able to force it off rather than on.  It
+can be used to disable "hole punching" for file based backends which
+were intentionally created non-sparse to avoid fragmentation of the
+file.
+
+=back
+
+
+=head1 COLO Parameters
+
+=over 4
+
+=item B<colo>
+
+Enable COLO HA for disk. For better understanding block replication on
+QEMU, please refer to: L<https://wiki.qemu.org/Features/BlockReplication>
+Note that the COLO configuration settings should be considered unstable.
+They may change incompatibly in future versions of Xen.
+
+
+=item B<colo-host>
+
+=over 4
+
+=item Description
+
+Secondary host's address
+
+=item Mandatory
+
+Yes when COLO enabled
+
+=back
+
+=item B<colo-port>
+
+=over 4
+
+=item Description
+
+Secondary port.  We will run a nbd server on secondary host,
+and the nbd server will listen this port.
+
+=item Mandatory
+
+Yes when COLO enabled
+
+=back
+
+=item B<colo-export>
+
+=over 4
+
+=item Description
+
+We will run a nbd server on secondary host, exportname is
+the nbd server's disk export name.
+
+=item Mandatory
+
+Yes when COLO enabled
+
+=back
+
+=item B<active-disk>
+
+=over 4
+
+=item Description
+
+This is used by secondary. Secondary guest's write will be buffered in this
+disk.
+
+=item Mandatory
+
+Yes when COLO enabled
+
+=back
+
+=item B<hidden-disk>
+
+=over 4
+
+=item Description
+
+This is used by secondary. It buffers the original content that is modified
+by the primary VM.
+
+=item Mandatory
+
+Yes when COLO enabled
+
+=back
+
+=back
+
+
+=head1 Deprecated Parameters, Prefixes And Syntaxes
+
+Deprecated forms are acceptable and are intended work compatibly with
+xend and xl from xen 4.1.  In future they may print a warning.
+Support for deprecated parameters and syntaxes are likely to be
+dropped in future versions of xl.
+
+There is support for a deprecated old syntax for C<DISKSPEC>:
+
+  [<format>:][<target>],<vdev>[:<devtype>],<access>   (deprecated)
+
+This syntax also supports deprecated prefixes, described below.  These
+are found prepended to the format parameter - eg C<tap:aio:qcow:>.
+
+=over 4
+
+=item B<format>
+
+=over 4
+
+=item Description
+
+Specifies the format (deprecated)
+
+=item Supported values
+
+raw:  qcow2:  vhd:
+
+=back
+
+In xend and old versions of libxl it was necessary to specify the
+format with a prefix.  For compatibility, these three prefixes are
+recognised as specifying the corresponding format.  They are
+equivalent to C<format=FORMAT> or the specification of B<format>
+(without a colon) as a positional parameter.
+
+
+=item B<script>
+
+=over 4
+
+=item Description
+
+Specifies the script (deprecated)
+
+=item Supported values
+
+iscsi:  nbd:  enbd:  drbd:
+
+=back
+
+In xend and old versions of libxl it was necessary to specify the
+"script" (see above) with a prefix.  For compatibility, these four
+prefixes are recognised as specifying the corresponding script.  They
+are equivalent to C<script=block-SCRIPT>.
+
+
+=item B<deprecated-prefix>
+
+=over 4
+
+=item Description
+
+Deprecated prefix, ignored
+
+=item Supported values
+
+tapdisk:  tap2:  aio:  ioemu:  file:  phy:
+
+=back
+
+Various prefixes were required by xend and older versions of libxl to
+make the block devices work.  In some cases these options would
+override the backend type, but in other cases they would be ignored in
+favour of "making it work"; in yet other cases it would be necessary
+to specify several of these, for example:
+
+  tap:aio:/some/path...
+
+All of these prefixes are now stripped and ignored.
+
+=back
+
+=head2 Missing format and empty target
+
+The following syntax is also supported:
+
+  ,<vdev>:<devtype>,<access>   (deprecated)
+
+This is solely for compatibility with xend's syntax for empty cdroms,
+which is (for example) C<,hdc:cdrom,r>.
diff --git a/docs/man/xl-network-configuration.5.pod b/docs/man/xl-network-configuration.5.pod
deleted file mode 100644
index 8e5fd909fa..0000000000
--- a/docs/man/xl-network-configuration.5.pod
+++ /dev/null
@@ -1,260 +0,0 @@
-=encoding utf8
-
-=head1 NAME
-
-xl-network-configuration - XL Network Configuration Syntax
-
-
-=head1 SYNTAX
-
-This document specifies the xl config file format vif configuration
-option.  It has the following form:
-
-        vif = [ '<vifspec>', '<vifspec>', ... ]
-
-where each vifspec is in this form:
-
-        [<key>=<value>|<flag>,]
-
-For example:
-
-        'mac=00:16:3E:74:3d:76,model=rtl8139,bridge=xenbr0'
-        'mac=00:16:3E:74:34:32'
-        '' # The empty string
-
-These might be specified in the domain config file like this:
-
-        vif = [ 'mac=00:16:3E:74:34:32', 'mac=00:16:3e:5f:48:e4,bridge=xenbr1' ]
-
-More formally, the string is a series of comma-separated keyword/value
-pairs. All keywords are optional.
-
-Each device has a C<DEVID> which is its index within the vif list, starting from 0.
-
-
-=head1 Keywords
-
-
-=head2 mac
-
-If specified then this option specifies the MAC address inside the
-guest of this VIF device. The value is a 48-bit number represented as
-six groups of two hexadecimal digits, separated by colons (:).
-
-The default if this keyword is not specified is to be automatically
-generate a MAC address inside the space assigned to Xen's
-L<Organizationally Unique Identifier|https://en.wikipedia.org/wiki/Organizationally_Unique_Identifier> (00:16:3e).
-
-If you are choosing a MAC address then it is strongly recommend to
-follow one of the following strategies:
-
-=over
-
-=item *
-
-Generate a random sequence of 6 byte, set the locally administered
-bit (bit 2 of the first byte) and clear the multicast bit (bit 1
-of the first byte). In other words the first byte should have the
-bit pattern xxxxxx10 (where x is a randomly generated bit) and the
-remaining 5 bytes are randomly generated See
-[https://en.wikipedia.org/wiki/MAC_address] for more details the
-structure of a MAC address.
-
-
-=item *
-
-Allocate an address from within the space defined by your
-organization's OUI (if you have one) following your organization's
-procedures for doing so.
-
-
-=item *
-
-Allocate an address from within the space defined by Xen's OUI
-(00:16:3e). Taking care not to clash with other users of the
-physical network segment where this VIF will reside.
-
-
-=back
-
-If you have an OUI for your own use then that is the preferred
-strategy. Otherwise in general you should prefer to generate a random
-MAC and set the locally administered bit since this allows for more
-bits of randomness than using the Xen OUI.
-
-
-=head2 bridge
-
-Specifies the name of the network bridge which this VIF should be
-added to. The default is C<xenbr0>. The bridge must be configured using
-your distribution's network configuration tools. See the L<wiki|https://wiki.xenproject.org/wiki/Network_Configuration_Examples_(Xen_4.1%2B)>
-for guidance and examples.
-
-
-=head2 gatewaydev
-
-Specifies the name of the network interface which has an IP and which
-is in the network the VIF should communicate with. This is used in the host
-by the vif-route hotplug script. See L<wiki|https://wiki.xenproject.org/wiki/Vif-route> for guidance and
-examples.
-
-NOTE: netdev is a deprecated alias of this option.
-
-
-=head2 type
-
-This keyword is valid for HVM guests only.
-
-Specifies the type of device to valid values are:
-
-=over
-
-=item *
-
-C<ioemu> (default) -- this device will be provided as an emulate
-device to the guest and also as a paravirtualised device which the
-guest may choose to use instead if it has suitable drivers
-available.
-
-
-=item *
-
-C<vif> -- this device will be provided as a paravirtualised device
-only.
-
-
-=back
-
-
-=head2 model
-
-This keyword is valid for HVM guest devices with C<type=ioemu> only.
-
-Specifies the type device to emulated for this guest. Valid values
-are:
-
-=over
-
-=item *
-
-C<rtl8139> (default) -- Realtek RTL8139
-
-
-=item *
-
-C<e1000> -- Intel E1000
-
-
-=item *
-
-in principle any device supported by your device model
-
-
-=back
-
-
-=head2 vifname
-
-Specifies the backend device name for the virtual device.
-
-If the domain is an HVM domain then the associated emulated (tap)
-device will have a "-emu" suffice added.
-
-The default name for the virtual device is C<vifDOMID.DEVID> where
-C<DOMID> is the guest domain ID and C<DEVID> is the device
-number. Likewise the default tap name is C<vifDOMID.DEVID-emu>.
-
-
-=head2 script
-
-Specifies the hotplug script to run to configure this device (e.g. to
-add it to the relevant bridge). Defaults to
-C<XEN_SCRIPT_DIR/vif-bridge> but can be set to any script. Some example
-scripts are installed in C<XEN_SCRIPT_DIR>.
-
-Note on NetBSD HVM guests will ignore the script option for tap
-(emulated) interfaces and always use
-C<XEN_SCRIPT_DIR/qemu-ifup> to configure the interface in bridged mode.
-
-=head2 ip
-
-Specifies the IP address for the device, the default is not to
-specify an IP address.
-
-What, if any, effect this has depends on the hotplug script which is
-configured. A typically behaviour (exhibited by the example hotplug
-scripts) if set might be to configure firewall rules to allow only the
-specified IP address to be used by the guest (blocking all others).
-
-
-=head2 backend
-
-Specifies the backend domain which this device should attach to. This
-defaults to domain 0.  Specifying another domain requires setting up a
-driver domain which is outside the scope of this document.
-
-
-=head2 rate
-
-Specifies the rate at which the outgoing traffic will be limited to.
-The default if this keyword is not specified is unlimited.
-
-The rate may be specified as "/s" or optionally "/s@".
-
-=over
-
-=item *
-
-C<RATE> is in bytes and can accept suffixes:
-
-=over
-
-=item *
-
-GB, MB, KB, B for bytes.
-
-
-=item *
-
-Gb, Mb, Kb, b for bits.
-
-
-=back
-
-
-
-=item *
-
-C<INTERVAL> is in microseconds and can accept suffixes: ms, us, s.
-It determines the frequency at which the vif transmission credit
-is replenished. The default is 50ms.
-
-
-=back
-
-Vif rate limiting is credit-based. It means that for "1MB/s@20ms", the
-available credit will be equivalent of the traffic you would have done
-at "1MB/s" during 20ms. This will results in a credit of 20,000 bytes
-replenished every 20,000 us.
-
-For example:
-
-        'rate=10Mb/s' -- meaning up to 10 megabits every second
-        'rate=250KB/s' -- meaning up to 250 kilobytes every second
-        'rate=1MB/s@20ms' -- meaning 20,000 bytes in every 20 millisecond period
-
-NOTE: The actual underlying limits of rate limiting are dependent
-on the underlying netback implementation.
-
-
-=head2 devid
-
-Specifies the devid manually instead of letting xl choose the lowest index available.
-
-NOTE: This should not be set unless you have a reason to.
-
-=head2 mtu
-
-Specifies the MTU (i.e. the maximum size of an IP payload, exclusing headers). The
-default value is 1500 but, if the VIF is attached to a bridge, it will be set to match
-unless overridden by this parameter.
diff --git a/docs/man/xl-network-configuration.5.pod.in b/docs/man/xl-network-configuration.5.pod.in
new file mode 100644
index 0000000000..cf92d7960c
--- /dev/null
+++ b/docs/man/xl-network-configuration.5.pod.in
@@ -0,0 +1,260 @@
+=encoding utf8
+
+=head1 NAME
+
+xl-network-configuration - XL Network Configuration Syntax
+
+
+=head1 SYNTAX
+
+This document specifies the xl config file format vif configuration
+option.  It has the following form:
+
+        vif = [ '<vifspec>', '<vifspec>', ... ]
+
+where each vifspec is in this form:
+
+        [<key>=<value>|<flag>,]
+
+For example:
+
+        'mac=00:16:3E:74:3d:76,model=rtl8139,bridge=xenbr0'
+        'mac=00:16:3E:74:34:32'
+        '' # The empty string
+
+These might be specified in the domain config file like this:
+
+        vif = [ 'mac=00:16:3E:74:34:32', 'mac=00:16:3e:5f:48:e4,bridge=xenbr1' ]
+
+More formally, the string is a series of comma-separated keyword/value
+pairs. All keywords are optional.
+
+Each device has a C<DEVID> which is its index within the vif list, starting from 0.
+
+
+=head1 Keywords
+
+
+=head2 mac
+
+If specified then this option specifies the MAC address inside the
+guest of this VIF device. The value is a 48-bit number represented as
+six groups of two hexadecimal digits, separated by colons (:).
+
+The default if this keyword is not specified is to be automatically
+generate a MAC address inside the space assigned to Xen's
+L<Organizationally Unique Identifier|https://en.wikipedia.org/wiki/Organizationally_Unique_Identifier> (00:16:3e).
+
+If you are choosing a MAC address then it is strongly recommend to
+follow one of the following strategies:
+
+=over
+
+=item *
+
+Generate a random sequence of 6 byte, set the locally administered
+bit (bit 2 of the first byte) and clear the multicast bit (bit 1
+of the first byte). In other words the first byte should have the
+bit pattern xxxxxx10 (where x is a randomly generated bit) and the
+remaining 5 bytes are randomly generated See
+[https://en.wikipedia.org/wiki/MAC_address] for more details the
+structure of a MAC address.
+
+
+=item *
+
+Allocate an address from within the space defined by your
+organization's OUI (if you have one) following your organization's
+procedures for doing so.
+
+
+=item *
+
+Allocate an address from within the space defined by Xen's OUI
+(00:16:3e). Taking care not to clash with other users of the
+physical network segment where this VIF will reside.
+
+
+=back
+
+If you have an OUI for your own use then that is the preferred
+strategy. Otherwise in general you should prefer to generate a random
+MAC and set the locally administered bit since this allows for more
+bits of randomness than using the Xen OUI.
+
+
+=head2 bridge
+
+Specifies the name of the network bridge which this VIF should be
+added to. The default is C<xenbr0>. The bridge must be configured using
+your distribution's network configuration tools. See the L<wiki|https://wiki.xenproject.org/wiki/Network_Configuration_Examples_(Xen_4.1%2B)>
+for guidance and examples.
+
+
+=head2 gatewaydev
+
+Specifies the name of the network interface which has an IP and which
+is in the network the VIF should communicate with. This is used in the host
+by the vif-route hotplug script. See L<wiki|https://wiki.xenproject.org/wiki/Vif-route> for guidance and
+examples.
+
+NOTE: netdev is a deprecated alias of this option.
+
+
+=head2 type
+
+This keyword is valid for HVM guests only.
+
+Specifies the type of device to valid values are:
+
+=over
+
+=item *
+
+C<ioemu> (default) -- this device will be provided as an emulate
+device to the guest and also as a paravirtualised device which the
+guest may choose to use instead if it has suitable drivers
+available.
+
+
+=item *
+
+C<vif> -- this device will be provided as a paravirtualised device
+only.
+
+
+=back
+
+
+=head2 model
+
+This keyword is valid for HVM guest devices with C<type=ioemu> only.
+
+Specifies the type device to emulated for this guest. Valid values
+are:
+
+=over
+
+=item *
+
+C<rtl8139> (default) -- Realtek RTL8139
+
+
+=item *
+
+C<e1000> -- Intel E1000
+
+
+=item *
+
+in principle any device supported by your device model
+
+
+=back
+
+
+=head2 vifname
+
+Specifies the backend device name for the virtual device.
+
+If the domain is an HVM domain then the associated emulated (tap)
+device will have a "-emu" suffice added.
+
+The default name for the virtual device is C<vifDOMID.DEVID> where
+C<DOMID> is the guest domain ID and C<DEVID> is the device
+number. Likewise the default tap name is C<vifDOMID.DEVID-emu>.
+
+
+=head2 script
+
+Specifies the hotplug script to run to configure this device (e.g. to
+add it to the relevant bridge). Defaults to
+C<@XEN_SCRIPT_DIR@/vif-bridge> but can be set to any script. Some example
+scripts are installed in C<@XEN_SCRIPT_DIR@>.
+
+Note on NetBSD HVM guests will ignore the script option for tap
+(emulated) interfaces and always use
+C<XEN_SCRIPT_DIR/qemu-ifup> to configure the interface in bridged mode.
+
+=head2 ip
+
+Specifies the IP address for the device, the default is not to
+specify an IP address.
+
+What, if any, effect this has depends on the hotplug script which is
+configured. A typically behaviour (exhibited by the example hotplug
+scripts) if set might be to configure firewall rules to allow only the
+specified IP address to be used by the guest (blocking all others).
+
+
+=head2 backend
+
+Specifies the backend domain which this device should attach to. This
+defaults to domain 0.  Specifying another domain requires setting up a
+driver domain which is outside the scope of this document.
+
+
+=head2 rate
+
+Specifies the rate at which the outgoing traffic will be limited to.
+The default if this keyword is not specified is unlimited.
+
+The rate may be specified as "/s" or optionally "/s@".
+
+=over
+
+=item *
+
+C<RATE> is in bytes and can accept suffixes:
+
+=over
+
+=item *
+
+GB, MB, KB, B for bytes.
+
+
+=item *
+
+Gb, Mb, Kb, b for bits.
+
+
+=back
+
+
+
+=item *
+
+C<INTERVAL> is in microseconds and can accept suffixes: ms, us, s.
+It determines the frequency at which the vif transmission credit
+is replenished. The default is 50ms.
+
+
+=back
+
+Vif rate limiting is credit-based. It means that for "1MB/s@20ms", the
+available credit will be equivalent of the traffic you would have done
+at "1MB/s" during 20ms. This will results in a credit of 20,000 bytes
+replenished every 20,000 us.
+
+For example:
+
+        'rate=10Mb/s' -- meaning up to 10 megabits every second
+        'rate=250KB/s' -- meaning up to 250 kilobytes every second
+        'rate=1MB/s@20ms' -- meaning 20,000 bytes in every 20 millisecond period
+
+NOTE: The actual underlying limits of rate limiting are dependent
+on the underlying netback implementation.
+
+
+=head2 devid
+
+Specifies the devid manually instead of letting xl choose the lowest index available.
+
+NOTE: This should not be set unless you have a reason to.
+
+=head2 mtu
+
+Specifies the MTU (i.e. the maximum size of an IP payload, exclusing headers). The
+default value is 1500 but, if the VIF is attached to a bridge, it will be set to match
+unless overridden by this parameter.
diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index e206039d99..618c195148 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -571,7 +571,7 @@ See the corresponding option of the I<create> subcommand.
 =item B<-N> I<netbufscript>
 
 Use <netbufscript> to setup network buffering instead of the
-default script (/etc/xen/scripts/remus-netbuf-setup).
+default script (@XEN_SCRIPT_DIR@/remus-netbuf-setup).
 
 =item B<-F>
 
diff --git a/docs/man/xl.conf.5.pod b/docs/man/xl.conf.5.pod
deleted file mode 100644
index dfea9d64ba..0000000000
--- a/docs/man/xl.conf.5.pod
+++ /dev/null
@@ -1,229 +0,0 @@
-=head1 NAME
-
-@XEN_CONFIG_DIR@/xl.conf - XL Global/Host Configuration
-
-=head1 DESCRIPTION
-
-The F<xl.conf> file allows configuration of hostwide C<xl> toolstack
-options.
-
-For details of per-domain configuration options please see
-L<xl.cfg(5)>.
-
-=head1 SYNTAX
-
-The config file consists of a series of C<KEY=VALUE> pairs.
-
-A value C<VALUE> is one of:
-
-=over 4
-
-=item B<"STRING">
-
-A string, surrounded by either single or double quotes.
-
-=item B<NUMBER>
-
-A number, in either decimal, octal (using a C<0> prefix) or
-hexadecimal (using an C<0x> prefix).
-
-=item B<BOOLEAN>
-
-A C<NUMBER> interpreted as C<False> (C<0>) or C<True> (any other
-value).
-
-=item B<[ VALUE, VALUE, ... ]>
-
-A list of C<VALUES> of the above types. Lists are homogeneous and are
-not nested.
-
-=back
-
-The semantics of each C<KEY> defines which form of C<VALUE> is required.
-
-=head1 OPTIONS
-
-=over 4
-
-=item B<domid_policy="xen"|"random">
-
-Determines how domain-id is set when creating a new domain.
-
-If set to "xen" then the hypervisor will allocate new domain-id values on a sequential basis.
-
-If set to "random" then a random domain-id value will be chosen.
-
-Default: "xen"
-
-=item B<autoballoon="off"|"on"|"auto">
-
-If set to "on" then C<xl> will automatically reduce the amount of
-memory assigned to domain 0 in order to free memory for new domains.
-
-If set to "off" then C<xl> will not automatically reduce the amount of
-domain 0 memory.
-
-If set to "auto" then auto-ballooning will be disabled if the
-C<dom0_mem> option was provided on the Xen command line.
-
-You are strongly recommended to set this to C<"off"> (or C<"auto">) if
-you use the C<dom0_mem> hypervisor command line to reduce the amount
-of memory given to domain 0 by default.
-
-Default: C<"auto">
-
-=item B<run_hotplug_scripts=BOOLEAN>
-
-If disabled hotplug scripts will be called from udev, as it used to
-be in the previous releases. With the default option, hotplug scripts
-will be launched by xl directly.
-
-Default: C<1>
-
-=item B<lockfile="PATH">
-
-Sets the path to the lock file used by xl to serialise certain
-operations (primarily domain creation).
-
-Default: C</var/lock/xl>
-
-=item B<max_grant_frames=NUMBER>
-
-Sets the default value for the C<max_grant_frames> domain config value.
-
-Default: value of Xen command line B<gnttab_max_frames> parameter (or its
-default value if unspecified).
-
-=item B<max_maptrack_frames=NUMBER>
-
-Sets the default value for the C<max_maptrack_frames> domain config value.
-
-Default: value of Xen command line B<gnttab_max_maptrack_frames>
-parameter (or its default value if unspecified).
-
-=item B<vif.default.script="PATH">
-
-Configures the default hotplug script used by virtual network devices.
-
-The old B<vifscript> option is deprecated and should not be used.
-
-Default: C</etc/xen/scripts/vif-bridge>
-
-=item B<vif.default.bridge="NAME">
-
-Configures the default bridge to set for virtual network devices.
-
-The old B<defaultbridge> option is deprecated and should not be used.
-
-Default: C<xenbr0>
-
-=item B<vif.default.backend="NAME">
-
-Configures the default backend to set for virtual network devices.
-
-Default: C<0>
-
-=item B<vif.default.gatewaydev="NAME">
-
-Configures the default gateway device to set for virtual network devices.
-
-Default: C<None>
-
-=item B<remus.default.netbufscript="PATH">
-
-Configures the default script used by Remus to setup network buffering.
-
-Default: C</etc/xen/scripts/remus-netbuf-setup>
-
-=item B<colo.default.proxyscript="PATH">
-
-Configures the default script used by COLO to setup colo-proxy.
-
-Default: C</etc/xen/scripts/colo-proxy-setup>
-
-=item B<output_format="json|sxp">
-
-Configures the default output format used by xl when printing "machine
-readable" information. The default is to use the C<JSON>
-L<https://www.json.org/> syntax. However for compatibility with the
-previous C<xm> toolstack this can be configured to use the old C<SXP>
-(S-Expression-like) syntax instead.
-
-Default: C<json>
-
-=item B<blkdev_start="NAME">
-
-Configures the name of the first block device to be used for temporary
-block device allocations by the toolstack.
-The default choice is "xvda".
-
-=item B<claim_mode=BOOLEAN>
-
-If this option is enabled then when a guest is created there will be an
-guarantee that there is memory available for the guest.
-The self-balloon mechanism can deflate/inflate the balloon
-quickly and the amount of free memory (which C<xl info> can show) is
-stale the moment it is printed. When claim is enabled a reservation for
-the amount of memory (see 'memory' in xl.conf(5)) is set, which is then
-reduced as the domain's memory is populated and eventually reaches zero.
-The free memory in C<xl info> is the combination of the hypervisor's
-free heap memory minus the outstanding claims value.
-
-If the reservation cannot be meet the guest creation fails immediately
-instead of taking seconds/minutes (depending on the size of the guest)
-while the guest is populated.
-
-Default: C<1>
-
-=over 4
-
-=item C<0>
-
-No claim is made. Memory population during guest creation will be
-attempted as normal and may fail due to memory exhaustion.
-
-=item C<1>
-
-Free memory as reported by the hypervisor is used for
-calculating whether there is enough memory free to launch a guest.
-This guarantees immediate feedback whether the guest can be launched due
-to memory exhaustion (which can take a long time to find out if launching
-massively huge guests).
-
-=back
-
-=item B<vm.cpumask>="CPULIST"
-
-=item B<vm.hvm.cpumask>="CPULIST"
-
-=item B<vm.pv.cpumask>="CPULIST"
-
-Global masks that are applied when creating guests and pinning vcpus
-to indicate which cpus they are allowed to run on.  Specifically,
-C<vm.cpumask> applies to all guest types, C<vm.hvm.cpumask> applies to
-both HVM and PVH guests and C<vm.pv.cpumask> applies to PV guests.
-
-The hard affinity of guest's vcpus are logical-AND'ed with respective
-masks. If the resulting affinity mask is empty, operation will fail.
-
-Use --ignore-global-affinity-masks to skip applying global masks.
-
-The default value for these masks are all 1's, i.e. all cpus are allowed.
-
-Due to bug(s), these options may not interact well with other options
-concerning CPU affinity. One example is CPU pools. Users should always double
-check that the required affinity has taken effect.
-
-=back
-
-=head1 SEE ALSO
-
-=over 4
-
-=item L<xl(1)>
-
-=item L<xl.cfg(5)>
-
-=item https://www.json.org/
-
-=back
diff --git a/docs/man/xl.conf.5.pod.in b/docs/man/xl.conf.5.pod.in
new file mode 100644
index 0000000000..b48e99131a
--- /dev/null
+++ b/docs/man/xl.conf.5.pod.in
@@ -0,0 +1,229 @@
+=head1 NAME
+
+@XEN_CONFIG_DIR@/xl.conf - XL Global/Host Configuration
+
+=head1 DESCRIPTION
+
+The F<xl.conf> file allows configuration of hostwide C<xl> toolstack
+options.
+
+For details of per-domain configuration options please see
+L<xl.cfg(5)>.
+
+=head1 SYNTAX
+
+The config file consists of a series of C<KEY=VALUE> pairs.
+
+A value C<VALUE> is one of:
+
+=over 4
+
+=item B<"STRING">
+
+A string, surrounded by either single or double quotes.
+
+=item B<NUMBER>
+
+A number, in either decimal, octal (using a C<0> prefix) or
+hexadecimal (using an C<0x> prefix).
+
+=item B<BOOLEAN>
+
+A C<NUMBER> interpreted as C<False> (C<0>) or C<True> (any other
+value).
+
+=item B<[ VALUE, VALUE, ... ]>
+
+A list of C<VALUES> of the above types. Lists are homogeneous and are
+not nested.
+
+=back
+
+The semantics of each C<KEY> defines which form of C<VALUE> is required.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<domid_policy="xen"|"random">
+
+Determines how domain-id is set when creating a new domain.
+
+If set to "xen" then the hypervisor will allocate new domain-id values on a sequential basis.
+
+If set to "random" then a random domain-id value will be chosen.
+
+Default: "xen"
+
+=item B<autoballoon="off"|"on"|"auto">
+
+If set to "on" then C<xl> will automatically reduce the amount of
+memory assigned to domain 0 in order to free memory for new domains.
+
+If set to "off" then C<xl> will not automatically reduce the amount of
+domain 0 memory.
+
+If set to "auto" then auto-ballooning will be disabled if the
+C<dom0_mem> option was provided on the Xen command line.
+
+You are strongly recommended to set this to C<"off"> (or C<"auto">) if
+you use the C<dom0_mem> hypervisor command line to reduce the amount
+of memory given to domain 0 by default.
+
+Default: C<"auto">
+
+=item B<run_hotplug_scripts=BOOLEAN>
+
+If disabled hotplug scripts will be called from udev, as it used to
+be in the previous releases. With the default option, hotplug scripts
+will be launched by xl directly.
+
+Default: C<1>
+
+=item B<lockfile="PATH">
+
+Sets the path to the lock file used by xl to serialise certain
+operations (primarily domain creation).
+
+Default: C</var/lock/xl>
+
+=item B<max_grant_frames=NUMBER>
+
+Sets the default value for the C<max_grant_frames> domain config value.
+
+Default: value of Xen command line B<gnttab_max_frames> parameter (or its
+default value if unspecified).
+
+=item B<max_maptrack_frames=NUMBER>
+
+Sets the default value for the C<max_maptrack_frames> domain config value.
+
+Default: value of Xen command line B<gnttab_max_maptrack_frames>
+parameter (or its default value if unspecified).
+
+=item B<vif.default.script="PATH">
+
+Configures the default hotplug script used by virtual network devices.
+
+The old B<vifscript> option is deprecated and should not be used.
+
+Default: C<@XEN_SCRIPT_DIR@/vif-bridge>
+
+=item B<vif.default.bridge="NAME">
+
+Configures the default bridge to set for virtual network devices.
+
+The old B<defaultbridge> option is deprecated and should not be used.
+
+Default: C<xenbr0>
+
+=item B<vif.default.backend="NAME">
+
+Configures the default backend to set for virtual network devices.
+
+Default: C<0>
+
+=item B<vif.default.gatewaydev="NAME">
+
+Configures the default gateway device to set for virtual network devices.
+
+Default: C<None>
+
+=item B<remus.default.netbufscript="PATH">
+
+Configures the default script used by Remus to setup network buffering.
+
+Default: C<@XEN_SCRIPT_DIR@/remus-netbuf-setup>
+
+=item B<colo.default.proxyscript="PATH">
+
+Configures the default script used by COLO to setup colo-proxy.
+
+Default: C<@XEN_SCRIPT_DIR@/colo-proxy-setup>
+
+=item B<output_format="json|sxp">
+
+Configures the default output format used by xl when printing "machine
+readable" information. The default is to use the C<JSON>
+L<https://www.json.org/> syntax. However for compatibility with the
+previous C<xm> toolstack this can be configured to use the old C<SXP>
+(S-Expression-like) syntax instead.
+
+Default: C<json>
+
+=item B<blkdev_start="NAME">
+
+Configures the name of the first block device to be used for temporary
+block device allocations by the toolstack.
+The default choice is "xvda".
+
+=item B<claim_mode=BOOLEAN>
+
+If this option is enabled then when a guest is created there will be an
+guarantee that there is memory available for the guest.
+The self-balloon mechanism can deflate/inflate the balloon
+quickly and the amount of free memory (which C<xl info> can show) is
+stale the moment it is printed. When claim is enabled a reservation for
+the amount of memory (see 'memory' in xl.conf(5)) is set, which is then
+reduced as the domain's memory is populated and eventually reaches zero.
+The free memory in C<xl info> is the combination of the hypervisor's
+free heap memory minus the outstanding claims value.
+
+If the reservation cannot be meet the guest creation fails immediately
+instead of taking seconds/minutes (depending on the size of the guest)
+while the guest is populated.
+
+Default: C<1>
+
+=over 4
+
+=item C<0>
+
+No claim is made. Memory population during guest creation will be
+attempted as normal and may fail due to memory exhaustion.
+
+=item C<1>
+
+Free memory as reported by the hypervisor is used for
+calculating whether there is enough memory free to launch a guest.
+This guarantees immediate feedback whether the guest can be launched due
+to memory exhaustion (which can take a long time to find out if launching
+massively huge guests).
+
+=back
+
+=item B<vm.cpumask>="CPULIST"
+
+=item B<vm.hvm.cpumask>="CPULIST"
+
+=item B<vm.pv.cpumask>="CPULIST"
+
+Global masks that are applied when creating guests and pinning vcpus
+to indicate which cpus they are allowed to run on.  Specifically,
+C<vm.cpumask> applies to all guest types, C<vm.hvm.cpumask> applies to
+both HVM and PVH guests and C<vm.pv.cpumask> applies to PV guests.
+
+The hard affinity of guest's vcpus are logical-AND'ed with respective
+masks. If the resulting affinity mask is empty, operation will fail.
+
+Use --ignore-global-affinity-masks to skip applying global masks.
+
+The default value for these masks are all 1's, i.e. all cpus are allowed.
+
+Due to bug(s), these options may not interact well with other options
+concerning CPU affinity. One example is CPU pools. Users should always double
+check that the required affinity has taken effect.
+
+=back
+
+=head1 SEE ALSO
+
+=over 4
+
+=item L<xl(1)>
+
+=item L<xl.cfg(5)>
+
+=item https://www.json.org/
+
+=back
diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index bd8af12ff3..07f54daabe 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -525,7 +525,7 @@ struct cmd_spec cmd_table[] = {
       "-e                      Do not wait in the background (on <host>) for the death\n"
       "                        of the domain.\n"
       "-N <netbufscript>       Use netbufscript to setup network buffering instead of the\n"
-      "                        default script (/etc/xen/scripts/remus-netbuf-setup).\n"
+      "                        default script (" XEN_SCRIPT_DIR "/remus-netbuf-setup).\n"
       "-F                      Enable unsafe configurations [-b|-n|-d flags]. Use this option\n"
       "                        with caution as failover may not work as intended.\n"
       "-b                      Replicate memory checkpoints to /dev/null (blackhole).\n"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:36:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:36:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84759.158925 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Ko-0003OI-Py; Sun, 14 Feb 2021 01:36:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84759.158925; Sun, 14 Feb 2021 01:36:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Ko-0003OA-Mt; Sun, 14 Feb 2021 01:36:26 +0000
Received: by outflank-mailman (input) for mailman id 84759;
 Sun, 14 Feb 2021 01:36:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Kn-0003O2-0Q
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:36:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Km-0006x4-W5
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:36:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Km-0005zx-VQ
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:36:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7TBzSX1e89PldIJQG1NSMK5Ax6Cp99IDlsONSVahbiE=; b=YYHrMibNRjnH5MqLOhg/IoHnD1
	tB/qjcc7RMbupBue9KtbtxTE7wjtcu83AucaSWo7r5EZQQZLSiGw1+EhUw9yJArUF9/RqsGjw7aXX
	xdZFlst1e3TWgvCdyF1OfFZcrBWenk1xWjd5Bq0xT4iS9lt6EFO/9OEC/oVMQ9CIxNu8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: remove tabs from code produced by libxl_save_msgs_gen.pl
Message-Id: <E1lB6Km-0005zx-VQ@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:36:24 +0000

commit f18309eb06efd1db5a2ab9903a1c246b6299951a
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Mon Jan 11 18:42:17 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Feb 8 16:28:34 2021 +0000

    tools: remove tabs from code produced by libxl_save_msgs_gen.pl
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/light/libxl_save_msgs_gen.pl | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/libs/light/libxl_save_msgs_gen.pl b/tools/libs/light/libxl_save_msgs_gen.pl
index 5bfbd4fd10..9d425b1dee 100755
--- a/tools/libs/light/libxl_save_msgs_gen.pl
+++ b/tools/libs/light/libxl_save_msgs_gen.pl
@@ -120,8 +120,8 @@ sub typeid ($) { my ($t) = @_; $t =~ s/\W/_/; return $t; };
 
 $out_body{'callout'} .= <<END;
 static int bytes_get(const unsigned char **msg,
-		     const unsigned char *const endmsg,
-		     void *result, int rlen)
+                     const unsigned char *const endmsg,
+                     void *result, int rlen)
 {
     if (endmsg - *msg < rlen) return 0;
     memcpy(result, *msg, rlen);
@@ -132,11 +132,11 @@ static int bytes_get(const unsigned char **msg,
 END
 $out_body{'helper'} .= <<END;
 static void bytes_put(unsigned char *const buf, int *len,
-		      const void *value, int vlen)
+                      const void *value, int vlen)
 {
     assert(vlen < INT_MAX/2 - *len);
     if (buf)
-	memcpy(buf + *len, value, vlen);
+        memcpy(buf + *len, value, vlen);
     *len += vlen;
 }
 
@@ -155,7 +155,7 @@ static int ${typeid}_get(const unsigned char **msg,
 END
     $out_body{'helper'} .= <<END;
 static void ${typeid}_put(unsigned char *const buf, int *len,
-			 const $simpletype value)
+                          const $simpletype value)
 {
     bytes_put(buf, len, &value, sizeof(value));
 }
@@ -192,15 +192,15 @@ END
 $out_body{'helper'} .= <<END;
 static void BLOCK_put(unsigned char *const buf,
                       int *len,
-		      const uint8_t *bytes, uint32_t size)
+                      const uint8_t *bytes, uint32_t size)
 {
     uint32_t_put(buf, len, size);
     bytes_put(buf, len, bytes, size);
 }
 
 static void STRING_put(unsigned char *const buf,
-		       int *len,
-		       const char *string)
+                       int *len,
+                       const char *string)
 {
     size_t slen = strlen(string);
     assert(slen < INT_MAX / 4);
@@ -216,7 +216,7 @@ foreach my $sr (qw(save restore)) {
            "(void *data)");
 
     f_decl("${receiveds}_${sr}", 'callout', 'int',
-	   "(const unsigned char *msg, uint32_t len, void *user)");
+           "(const unsigned char *msg, uint32_t len, void *user)");
 
     f_decl("${enumcallbacks}_${sr}", 'callout', 'unsigned',
            "(const ".cbtype($sr)." *cbs)");
@@ -301,7 +301,7 @@ END_ALWAYS
 	$c_callback_args .= "$c_args, ";
 	$c_recv.=
             "        if (!${typeid}_get(&msg, endmsg, $c_get_args)) return 0;\n";
-        f_more("${encode}_$name", "	${typeid}_put(buf, &len, $c_args);\n");
+        f_more("${encode}_$name", "        ${typeid}_put(buf, &len, $c_args);\n");
     }
     $f_more_sr->($c_recv);
     $c_decl .= "void *user)";
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:36:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:36:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84760.158929 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Ky-0003Po-RK; Sun, 14 Feb 2021 01:36:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84760.158929; Sun, 14 Feb 2021 01:36:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Ky-0003Pg-OM; Sun, 14 Feb 2021 01:36:36 +0000
Received: by outflank-mailman (input) for mailman id 84760;
 Sun, 14 Feb 2021 01:36:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Kx-0003PK-4d
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:36:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Kx-0006xH-3g
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:36:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Kx-00062X-31
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:36:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hBD9jfFFkEXhgfuHXA5QHCPjf537m9/WZ91X2uIS3Mc=; b=wUJWiDvBu3y15MTkr4S8y8bkO2
	EePgwblKzhCVHd5v5sb6AzVcUTBPxEcWMI8umixPwdGpvsn1iqvR2UMgzGO8hFFEFrCVTreC9/qZS
	387xh5fdvWNhXkgurkXZOKdeGgt5aZf+0YTjs72pupBG7kTs2vJjI76BRNXybG7M9ZNQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Regenerate autoconf
Message-Id: <E1lB6Kx-00062X-31@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:36:35 +0000

commit 548ba7c85c6d80a671c2abb8681c29bc85c616f3
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Feb 9 17:05:54 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Feb 9 17:09:34 2021 +0000

    tools: Regenerate autoconf
    
    This seems to have been omitted in many recent commits.  The earliest
    of which are, according to git-bisect:
      154137dfdba3  stubdom/configure      stubdom: add xenstore pvh stubdom
      cc83ee4c6c37  all configure scripts  NetBSD: Fix lock directory path
    but it seems that this is true of several later commits too.
    
    Release status: I consider this discrepancy a release critical bug.
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
    Release-acked-by: Ian Jackson <iwj@xenproject.org>
---
 configure         | 2 +-
 docs/configure    | 7 +++++--
 stubdom/configure | 6 +++---
 tools/configure   | 2 +-
 4 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index 741e54bf2a..e174dbd238 100755
--- a/configure
+++ b/configure
@@ -2056,7 +2056,7 @@ XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
 
 case "$host_os" in
 *freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
-*netbsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
+*netbsd*) XEN_LOCK_DIR=$rundir_path ;;
 *) XEN_LOCK_DIR=$localstatedir/lock ;;
 esac
 
diff --git a/docs/configure b/docs/configure
index f55268564e..1582d477e3 100755
--- a/docs/configure
+++ b/docs/configure
@@ -1749,7 +1749,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-ac_config_files="$ac_config_files ../config/Docs.mk man/xl.cfg.5.pod man/xl.1.pod"
+ac_config_files="$ac_config_files ../config/Docs.mk man/xl.cfg.5.pod man/xl.1.pod man/xl-disk-configuration.5.pod man/xl-network-configuration.5.pod man/xl.conf.5.pod"
 
 ac_aux_dir=
 for ac_dir in ../ "$srcdir"/../; do
@@ -1959,7 +1959,7 @@ XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
 
 case "$host_os" in
 *freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
-*netbsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
+*netbsd*) XEN_LOCK_DIR=$rundir_path ;;
 *) XEN_LOCK_DIR=$localstatedir/lock ;;
 esac
 
@@ -2976,6 +2976,9 @@ do
     "../config/Docs.mk") CONFIG_FILES="$CONFIG_FILES ../config/Docs.mk" ;;
     "man/xl.cfg.5.pod") CONFIG_FILES="$CONFIG_FILES man/xl.cfg.5.pod" ;;
     "man/xl.1.pod") CONFIG_FILES="$CONFIG_FILES man/xl.1.pod" ;;
+    "man/xl-disk-configuration.5.pod") CONFIG_FILES="$CONFIG_FILES man/xl-disk-configuration.5.pod" ;;
+    "man/xl-network-configuration.5.pod") CONFIG_FILES="$CONFIG_FILES man/xl-network-configuration.5.pod" ;;
+    "man/xl.conf.5.pod") CONFIG_FILES="$CONFIG_FILES man/xl.conf.5.pod" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
diff --git a/stubdom/configure b/stubdom/configure
index 903414589b..6068f58d12 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -690,7 +690,7 @@ enable_c_stubdom
 enable_caml_stubdom
 enable_pv_grub
 enable_xenstore_stubdom
-enable_xenstore_pvh_stubdom
+enable_xenstorepvh_stubdom
 enable_vtpm_stubdom
 enable_vtpmmgr_stubdom
 enable_qemu_traditional
@@ -2184,8 +2184,8 @@ fi
 
 
 # Check whether --enable-xenstorepvh-stubdom was given.
-if test "${enable_xenstore_pvh_stubdom+set}" = set; then :
-  enableval=$enable_xenstore_pvh_stubdom;
+if test "${enable_xenstorepvh_stubdom+set}" = set; then :
+  enableval=$enable_xenstorepvh_stubdom;
 
 if test "x$enableval" = "xyes"; then :
 
diff --git a/tools/configure b/tools/configure
index 42c0d05bc1..519efb71ee 100755
--- a/tools/configure
+++ b/tools/configure
@@ -4038,7 +4038,7 @@ XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
 
 case "$host_os" in
 *freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
-*netbsd*) XEN_LOCK_DIR=$localstatedir/run ;;
+*netbsd*) XEN_LOCK_DIR=$rundir_path ;;
 *) XEN_LOCK_DIR=$localstatedir/lock ;;
 esac
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:36:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:36:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84763.158947 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6L8-0003Tc-Co; Sun, 14 Feb 2021 01:36:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84763.158947; Sun, 14 Feb 2021 01:36:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6L8-0003TU-9v; Sun, 14 Feb 2021 01:36:46 +0000
Received: by outflank-mailman (input) for mailman id 84763;
 Sun, 14 Feb 2021 01:36:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6L7-0003TE-84
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:36:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6L7-0006xY-7M
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:36:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6L7-00063f-6Y
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:36:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YZkOKD6Soxz/MhS0cu4Jsh04ufhIaKlnMyAgtDotH8k=; b=uAesj4L1vhSRaP++/HiVr2Jc1D
	qvfsiVvt0M2XO4m4JlAYoKv6NYpv5qF5xNMI2UxTYrh/8PrVEB8m2qRe6HTiCzb+QoXUn5seSUf3J
	yQObe1eyv4gLEbcE6cCrU0qenEDCwVOWlKeDdxNunB8YhTKkb4TvHmKPGBFxBv/5x9Yc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: move CONFIG_DIR and XEN_CONFIG_DIR in paths.m4
Message-Id: <E1lB6L7-00063f-6Y@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:36:45 +0000

commit fe9ba142c03a2046def52cfd5864f5a89172bf5c
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Tue Feb 9 16:45:33 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Feb 9 17:09:34 2021 +0000

    tools: move CONFIG_DIR and XEN_CONFIG_DIR in paths.m4
    
    Upcoming changes need to reuse XEN_CONFIG_DIR.
    
    In its current location the assignment happens too late. Move it up
    in the file, along with CONFIG_DIR. Their only dependency is
    sysconfdir, which may also be adjusted in this file.
    
    No functional change intended.
    
    [autoconf rerun -iwj]
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 configure       | 16 ++++++++--------
 docs/configure  | 16 ++++++++--------
 m4/paths.m4     | 12 ++++++------
 tools/configure | 16 ++++++++--------
 4 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/configure b/configure
index e174dbd238..2fe26c1bf7 100755
--- a/configure
+++ b/configure
@@ -600,9 +600,7 @@ XEN_DUMP_DIR
 XEN_PAGING_DIR
 XEN_LOCK_DIR
 XEN_SCRIPT_DIR
-XEN_CONFIG_DIR
 INITD_DIR
-CONFIG_DIR
 SHAREDIR
 XEN_LIB_DIR
 XEN_RUN_STORED
@@ -615,6 +613,8 @@ LIBEXEC_LIB
 LIBEXEC_BIN
 LIBEXEC
 CONFIG_LEAF_DIR
+XEN_CONFIG_DIR
+CONFIG_DIR
 XENSTORED_PORT
 XENSTORED_KVA
 host_os
@@ -1936,6 +1936,12 @@ if test "x$sysconfdir" = 'x${prefix}/etc' ; then
     esac
 fi
 
+CONFIG_DIR=$sysconfdir
+
+
+XEN_CONFIG_DIR=$CONFIG_DIR/xen
+
+
 
 # Check whether --with-initddir was given.
 if test "${with_initddir+set}" = set; then :
@@ -2042,15 +2048,9 @@ XEN_LIB_DIR=$localstatedir/lib/xen
 SHAREDIR=$prefix/share
 
 
-CONFIG_DIR=$sysconfdir
-
-
 INITD_DIR=$initddir_path
 
 
-XEN_CONFIG_DIR=$CONFIG_DIR/xen
-
-
 XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
 
 
diff --git a/docs/configure b/docs/configure
index 1582d477e3..18075e4e00 100755
--- a/docs/configure
+++ b/docs/configure
@@ -598,9 +598,7 @@ XEN_DUMP_DIR
 XEN_PAGING_DIR
 XEN_LOCK_DIR
 XEN_SCRIPT_DIR
-XEN_CONFIG_DIR
 INITD_DIR
-CONFIG_DIR
 SHAREDIR
 XEN_LIB_DIR
 XEN_RUN_STORED
@@ -613,6 +611,8 @@ LIBEXEC_LIB
 LIBEXEC_BIN
 LIBEXEC
 CONFIG_LEAF_DIR
+XEN_CONFIG_DIR
+CONFIG_DIR
 XENSTORED_PORT
 XENSTORED_KVA
 target_alias
@@ -1839,6 +1839,12 @@ if test "x$sysconfdir" = 'x${prefix}/etc' ; then
     esac
 fi
 
+CONFIG_DIR=$sysconfdir
+
+
+XEN_CONFIG_DIR=$CONFIG_DIR/xen
+
+
 
 # Check whether --with-initddir was given.
 if test "${with_initddir+set}" = set; then :
@@ -1945,15 +1951,9 @@ XEN_LIB_DIR=$localstatedir/lib/xen
 SHAREDIR=$prefix/share
 
 
-CONFIG_DIR=$sysconfdir
-
-
 INITD_DIR=$initddir_path
 
 
-XEN_CONFIG_DIR=$CONFIG_DIR/xen
-
-
 XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
 
 
diff --git a/m4/paths.m4 b/m4/paths.m4
index 1c107b1a61..a736f57d8d 100644
--- a/m4/paths.m4
+++ b/m4/paths.m4
@@ -34,6 +34,12 @@ if test "x$sysconfdir" = 'x${prefix}/etc' ; then
     esac
 fi
 
+CONFIG_DIR=$sysconfdir
+AC_SUBST(CONFIG_DIR)
+
+XEN_CONFIG_DIR=$CONFIG_DIR/xen
+AC_SUBST(XEN_CONFIG_DIR)
+
 AC_ARG_WITH([initddir],
     AS_HELP_STRING([--with-initddir=DIR],
     [Path to directory with sysv runlevel scripts. [SYSCONFDIR/init.d]]),
@@ -128,15 +134,9 @@ AC_SUBST(XEN_LIB_DIR)
 SHAREDIR=$prefix/share
 AC_SUBST(SHAREDIR)
 
-CONFIG_DIR=$sysconfdir
-AC_SUBST(CONFIG_DIR)
-
 INITD_DIR=$initddir_path
 AC_SUBST(INITD_DIR)
 
-XEN_CONFIG_DIR=$CONFIG_DIR/xen
-AC_SUBST(XEN_CONFIG_DIR)
-
 XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
 AC_SUBST(XEN_SCRIPT_DIR)
 
diff --git a/tools/configure b/tools/configure
index 519efb71ee..86de2e2736 100755
--- a/tools/configure
+++ b/tools/configure
@@ -721,9 +721,7 @@ XEN_DUMP_DIR
 XEN_PAGING_DIR
 XEN_LOCK_DIR
 XEN_SCRIPT_DIR
-XEN_CONFIG_DIR
 INITD_DIR
-CONFIG_DIR
 SHAREDIR
 XEN_LIB_DIR
 XEN_RUN_STORED
@@ -736,6 +734,8 @@ LIBEXEC_LIB
 LIBEXEC_BIN
 LIBEXEC
 CONFIG_LEAF_DIR
+XEN_CONFIG_DIR
+CONFIG_DIR
 XENSTORED_PORT
 XENSTORED_KVA
 FILE_OFFSET_BITS
@@ -3918,6 +3918,12 @@ if test "x$sysconfdir" = 'x${prefix}/etc' ; then
     esac
 fi
 
+CONFIG_DIR=$sysconfdir
+
+
+XEN_CONFIG_DIR=$CONFIG_DIR/xen
+
+
 
 # Check whether --with-initddir was given.
 if test "${with_initddir+set}" = set; then :
@@ -4024,15 +4030,9 @@ XEN_LIB_DIR=$localstatedir/lib/xen
 SHAREDIR=$prefix/share
 
 
-CONFIG_DIR=$sysconfdir
-
-
 INITD_DIR=$initddir_path
 
 
-XEN_CONFIG_DIR=$CONFIG_DIR/xen
-
-
 XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:36:56 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:36:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84764.158952 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6LI-0003Wp-El; Sun, 14 Feb 2021 01:36:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84764.158952; Sun, 14 Feb 2021 01:36:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6LI-0003We-BZ; Sun, 14 Feb 2021 01:36:56 +0000
Received: by outflank-mailman (input) for mailman id 84764;
 Sun, 14 Feb 2021 01:36:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6LH-0003WO-BP
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:36:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6LH-0006zG-Ao
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:36:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6LH-00064i-A7
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:36:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ghTY+eJBZylSzfeb1goWqi8sp2GOvFxTmz1RHXTlHGE=; b=aEK3TYddGM+VhqBhHXRBWLzP/v
	dKDlF3KCFUfD/+c3q8J3VSJfh4CoJg3B0eWdc1LDrHkrhmGjCemcwRBu4XYxq6DsWhIrYCELtnzzQ
	rHkoY7twLdBwtXMh225uBqLk2x/PsuJQCJAXd4o+2Q4kkh019ZRwa88d6y0cqsv5X1dE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: add with-xen-scriptdir configure option
Message-Id: <E1lB6LH-00064i-A7@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:36:55 +0000

commit 7a321c3676250aac5bacb1ae8d7dd22bfe8b1448
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Tue Feb 9 16:45:34 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Feb 9 17:10:03 2021 +0000

    tools: add with-xen-scriptdir configure option
    
    Some distros plan for fresh installations will have an empty /etc,
    whose content will not be controlled by the package manager anymore.
    
    To make this possible, add a knob to configure to allow storing the
    hotplug scripts to libexec instead of /etc/xen/scripts.
    
    The current default remains unchanged, which is /etc/xen/scripts.
    
    [autoconf rerun -iwj]
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
---
 configure       | 20 ++++++++++++++++----
 docs/configure  | 20 ++++++++++++++++----
 m4/paths.m4     | 11 ++++++++---
 tools/configure | 20 ++++++++++++++++----
 4 files changed, 56 insertions(+), 15 deletions(-)

diff --git a/configure b/configure
index 2fe26c1bf7..a2789ae480 100755
--- a/configure
+++ b/configure
@@ -599,7 +599,6 @@ DEBUG_DIR
 XEN_DUMP_DIR
 XEN_PAGING_DIR
 XEN_LOCK_DIR
-XEN_SCRIPT_DIR
 INITD_DIR
 SHAREDIR
 XEN_LIB_DIR
@@ -612,6 +611,7 @@ LIBEXEC_INC
 LIBEXEC_LIB
 LIBEXEC_BIN
 LIBEXEC
+XEN_SCRIPT_DIR
 CONFIG_LEAF_DIR
 XEN_CONFIG_DIR
 CONFIG_DIR
@@ -670,6 +670,7 @@ enable_option_checking
 with_initddir
 with_sysconfig_leaf_dir
 with_libexec_leaf_dir
+with_xen_scriptdir
 with_xen_dumpdir
 with_rundir
 with_debugdir
@@ -1328,6 +1329,9 @@ Optional Packages:
                           "default". [sysconfig]
   --with-libexec-leaf-dir=SUBDIR
                           Name of subdirectory in libexecdir to use.
+  --with-xen-scriptdir=DIR
+                          Path to directory for dom0 hotplug scripts.
+                          [SYSCONFDIR/xen/scripts]
   --with-xen-dumpdir=DIR  Path to directory for domU crash dumps.
                           [LOCALSTATEDIR/lib/xen/dump]
   --with-rundir=DIR       Path to directory for runtime data.
@@ -1984,6 +1988,17 @@ fi
 
 
 
+# Check whether --with-xen-scriptdir was given.
+if test "${with_xen_scriptdir+set}" = set; then :
+  withval=$with_xen_scriptdir; xen_scriptdir_path=$withval
+else
+  xen_scriptdir_path=$XEN_CONFIG_DIR/scripts
+fi
+
+XEN_SCRIPT_DIR=$xen_scriptdir_path
+
+
+
 # Check whether --with-xen-dumpdir was given.
 if test "${with_xen_dumpdir+set}" = set; then :
   withval=$with_xen_dumpdir; xen_dumpdir_path=$withval
@@ -2051,9 +2066,6 @@ SHAREDIR=$prefix/share
 INITD_DIR=$initddir_path
 
 
-XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
-
-
 case "$host_os" in
 *freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
 *netbsd*) XEN_LOCK_DIR=$rundir_path ;;
diff --git a/docs/configure b/docs/configure
index 18075e4e00..e9c040cb84 100755
--- a/docs/configure
+++ b/docs/configure
@@ -597,7 +597,6 @@ DEBUG_DIR
 XEN_DUMP_DIR
 XEN_PAGING_DIR
 XEN_LOCK_DIR
-XEN_SCRIPT_DIR
 INITD_DIR
 SHAREDIR
 XEN_LIB_DIR
@@ -610,6 +609,7 @@ LIBEXEC_INC
 LIBEXEC_LIB
 LIBEXEC_BIN
 LIBEXEC
+XEN_SCRIPT_DIR
 CONFIG_LEAF_DIR
 XEN_CONFIG_DIR
 CONFIG_DIR
@@ -660,6 +660,7 @@ enable_option_checking
 with_initddir
 with_sysconfig_leaf_dir
 with_libexec_leaf_dir
+with_xen_scriptdir
 with_xen_dumpdir
 with_rundir
 with_debugdir
@@ -1301,6 +1302,9 @@ Optional Packages:
                           "default". [sysconfig]
   --with-libexec-leaf-dir=SUBDIR
                           Name of subdirectory in libexecdir to use.
+  --with-xen-scriptdir=DIR
+                          Path to directory for dom0 hotplug scripts.
+                          [SYSCONFDIR/xen/scripts]
   --with-xen-dumpdir=DIR  Path to directory for domU crash dumps.
                           [LOCALSTATEDIR/lib/xen/dump]
   --with-rundir=DIR       Path to directory for runtime data.
@@ -1887,6 +1891,17 @@ fi
 
 
 
+# Check whether --with-xen-scriptdir was given.
+if test "${with_xen_scriptdir+set}" = set; then :
+  withval=$with_xen_scriptdir; xen_scriptdir_path=$withval
+else
+  xen_scriptdir_path=$XEN_CONFIG_DIR/scripts
+fi
+
+XEN_SCRIPT_DIR=$xen_scriptdir_path
+
+
+
 # Check whether --with-xen-dumpdir was given.
 if test "${with_xen_dumpdir+set}" = set; then :
   withval=$with_xen_dumpdir; xen_dumpdir_path=$withval
@@ -1954,9 +1969,6 @@ SHAREDIR=$prefix/share
 INITD_DIR=$initddir_path
 
 
-XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
-
-
 case "$host_os" in
 *freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
 *netbsd*) XEN_LOCK_DIR=$rundir_path ;;
diff --git a/m4/paths.m4 b/m4/paths.m4
index a736f57d8d..7be314a3e2 100644
--- a/m4/paths.m4
+++ b/m4/paths.m4
@@ -76,6 +76,14 @@ AC_ARG_WITH([libexec-leaf-dir],
     [libexec_subdir=$withval],
     [libexec_subdir=$PACKAGE_TARNAME])
 
+AC_ARG_WITH([xen-scriptdir],
+    AS_HELP_STRING([--with-xen-scriptdir=DIR],
+    [Path to directory for dom0 hotplug scripts. [SYSCONFDIR/xen/scripts]]),
+    [xen_scriptdir_path=$withval],
+    [xen_scriptdir_path=$XEN_CONFIG_DIR/scripts])
+XEN_SCRIPT_DIR=$xen_scriptdir_path
+AC_SUBST(XEN_SCRIPT_DIR)
+
 AC_ARG_WITH([xen-dumpdir],
     AS_HELP_STRING([--with-xen-dumpdir=DIR],
     [Path to directory for domU crash dumps. [LOCALSTATEDIR/lib/xen/dump]]),
@@ -137,9 +145,6 @@ AC_SUBST(SHAREDIR)
 INITD_DIR=$initddir_path
 AC_SUBST(INITD_DIR)
 
-XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
-AC_SUBST(XEN_SCRIPT_DIR)
-
 case "$host_os" in
 *freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
 *netbsd*) XEN_LOCK_DIR=$rundir_path ;;
diff --git a/tools/configure b/tools/configure
index 86de2e2736..419d7b189a 100755
--- a/tools/configure
+++ b/tools/configure
@@ -720,7 +720,6 @@ DEBUG_DIR
 XEN_DUMP_DIR
 XEN_PAGING_DIR
 XEN_LOCK_DIR
-XEN_SCRIPT_DIR
 INITD_DIR
 SHAREDIR
 XEN_LIB_DIR
@@ -733,6 +732,7 @@ LIBEXEC_INC
 LIBEXEC_LIB
 LIBEXEC_BIN
 LIBEXEC
+XEN_SCRIPT_DIR
 CONFIG_LEAF_DIR
 XEN_CONFIG_DIR
 CONFIG_DIR
@@ -801,6 +801,7 @@ enable_largefile
 with_initddir
 with_sysconfig_leaf_dir
 with_libexec_leaf_dir
+with_xen_scriptdir
 with_xen_dumpdir
 with_rundir
 with_debugdir
@@ -1526,6 +1527,9 @@ Optional Packages:
                           "default". [sysconfig]
   --with-libexec-leaf-dir=SUBDIR
                           Name of subdirectory in libexecdir to use.
+  --with-xen-scriptdir=DIR
+                          Path to directory for dom0 hotplug scripts.
+                          [SYSCONFDIR/xen/scripts]
   --with-xen-dumpdir=DIR  Path to directory for domU crash dumps.
                           [LOCALSTATEDIR/lib/xen/dump]
   --with-rundir=DIR       Path to directory for runtime data.
@@ -3966,6 +3970,17 @@ fi
 
 
 
+# Check whether --with-xen-scriptdir was given.
+if test "${with_xen_scriptdir+set}" = set; then :
+  withval=$with_xen_scriptdir; xen_scriptdir_path=$withval
+else
+  xen_scriptdir_path=$XEN_CONFIG_DIR/scripts
+fi
+
+XEN_SCRIPT_DIR=$xen_scriptdir_path
+
+
+
 # Check whether --with-xen-dumpdir was given.
 if test "${with_xen_dumpdir+set}" = set; then :
   withval=$with_xen_dumpdir; xen_dumpdir_path=$withval
@@ -4033,9 +4048,6 @@ SHAREDIR=$prefix/share
 INITD_DIR=$initddir_path
 
 
-XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
-
-
 case "$host_os" in
 *freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
 *netbsd*) XEN_LOCK_DIR=$rundir_path ;;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:37:06 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:37:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84766.158956 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6LS-0003Yv-G7; Sun, 14 Feb 2021 01:37:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84766.158956; Sun, 14 Feb 2021 01:37:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6LS-0003Yn-D8; Sun, 14 Feb 2021 01:37:06 +0000
Received: by outflank-mailman (input) for mailman id 84766;
 Sun, 14 Feb 2021 01:37:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6LR-0003Yc-Ea
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:37:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6LR-0006zb-Dv
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:37:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6LR-00065w-D8
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:37:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=chtiOtHaiyUfIXef3Si+80jhYoO5+VPfdE7diqwaq+w=; b=wlj12CAeNAZN1SL+FhCWP1FsLi
	ya/zsYcWPQk4VLK4OWcsmmjpm7HNIyAhaMWNsgke+CDCOjLcUqf+1gwO7uALU35xzpTkOsflxRNOa
	OIJyl/YVbMTnMq62AKoR/qRQ5Tsr52eWp3+ufx5eFHQy1XUpa2mHK2V9IyFPr0NXAupk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xl: optionally print timestamps when running xl commands
Message-Id: <E1lB6LR-00065w-D8@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:37:05 +0000

commit 687121f8a0e7c1ea1c4fa3d056637e5819342f14
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Tue Feb 9 16:45:35 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Feb 9 17:10:23 2021 +0000

    xl: optionally print timestamps when running xl commands
    
    Add a global option "-T" to xl to enable timestamps in the output from
    libxl and libxc. This is most useful with long running commands such
    as "migrate".
    
    During 'xl -v.. migrate domU host' a large amount of debug is generated.
    It is difficult to map each line to the sending and receiving side.
    Also the time spent for migration is not reported.
    
    With 'xl -T migrate domU host' both sides will print timestamps and
    also the pid of the invoked xl process to make it more obvious which
    side produced a given log line.
    
    Note: depending on the command, xl itself also produces other output
    which does not go through libxentoollog. As a result such output will
    not have timestamps prepended.
    
    This change adds also the missing "-t" flag to "xl help" output.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
---
 docs/man/xl.1.pod.in  |  4 ++++
 tools/xl/xl.c         | 18 +++++++++++++-----
 tools/xl/xl.h         |  1 +
 tools/xl/xl_migrate.c |  3 ++-
 4 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index 618c195148..e2176bd696 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -86,6 +86,10 @@ Always use carriage-return-based overwriting for displaying progress
 messages without scrolling the screen.  Without -t, this is done only
 if stderr is a tty.
 
+=item B<-T>
+
+Include timestamps and pid of the xl process in output.
+
 =back
 
 =head1 DOMAIN SUBCOMMANDS
diff --git a/tools/xl/xl.c b/tools/xl/xl.c
index 2a5ddd4390..3a89295802 100644
--- a/tools/xl/xl.c
+++ b/tools/xl/xl.c
@@ -52,6 +52,7 @@ libxl_bitmap global_pv_affinity_mask;
 enum output_format default_output_format = OUTPUT_FORMAT_JSON;
 int claim_mode = 1;
 bool progress_use_cr = 0;
+bool timestamps = 0;
 int max_grant_frames = -1;
 int max_maptrack_frames = -1;
 libxl_domid domid_policy = INVALID_DOMID;
@@ -365,8 +366,9 @@ int main(int argc, char **argv)
     int ret;
     void *config_data = 0;
     int config_len = 0;
+    unsigned int xtl_flags = 0;
 
-    while ((opt = getopt(argc, argv, "+vftN")) >= 0) {
+    while ((opt = getopt(argc, argv, "+vftTN")) >= 0) {
         switch (opt) {
         case 'v':
             if (minmsglevel > 0) minmsglevel--;
@@ -380,6 +382,9 @@ int main(int argc, char **argv)
         case 't':
             progress_use_cr = 1;
             break;
+        case 'T':
+            timestamps = 1;
+            break;
         default:
             fprintf(stderr, "unknown global option\n");
             exit(EXIT_FAILURE);
@@ -394,8 +399,11 @@ int main(int argc, char **argv)
     }
     opterr = 0;
 
-    logger = xtl_createlogger_stdiostream(stderr, minmsglevel,
-        (progress_use_cr ? XTL_STDIOSTREAM_PROGRESS_USE_CR : 0));
+    if (progress_use_cr)
+        xtl_flags |= XTL_STDIOSTREAM_PROGRESS_USE_CR;
+    if (timestamps)
+        xtl_flags |= XTL_STDIOSTREAM_SHOW_DATE | XTL_STDIOSTREAM_SHOW_PID;
+    logger = xtl_createlogger_stdiostream(stderr, minmsglevel, xtl_flags);
     if (!logger) exit(EXIT_FAILURE);
 
     xl_ctx_alloc();
@@ -457,7 +465,7 @@ void help(const char *command)
     struct cmd_spec *cmd;
 
     if (!command || !strcmp(command, "help")) {
-        printf("Usage xl [-vfN] <subcommand> [args]\n\n");
+        printf("Usage xl [-vfNtT] <subcommand> [args]\n\n");
         printf("xl full list of subcommands:\n\n");
         for (i = 0; i < cmdtable_len; i++) {
             printf(" %-19s ", cmd_table[i].cmd_name);
@@ -468,7 +476,7 @@ void help(const char *command)
     } else {
         cmd = cmdtable_lookup(command);
         if (cmd) {
-            printf("Usage: xl [-v%s%s] %s %s\n\n%s.\n\n",
+            printf("Usage: xl [-vtT%s%s] %s %s\n\n%s.\n\n",
                    cmd->modifies ? "f" : "",
                    cmd->can_dryrun ? "N" : "",
                    cmd->cmd_name,
diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index 06569c6c4a..137a29077c 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -269,6 +269,7 @@ extern int run_hotplug_scripts;
 extern int dryrun_only;
 extern int claim_mode;
 extern bool progress_use_cr;
+extern bool timestamps;
 extern xentoollog_level minmsglevel;
 #define minmsglevel_default XTL_PROGRESS
 extern char *lockfile;
diff --git a/tools/xl/xl_migrate.c b/tools/xl/xl_migrate.c
index 0813beb801..b8594f44a5 100644
--- a/tools/xl/xl_migrate.c
+++ b/tools/xl/xl_migrate.c
@@ -592,9 +592,10 @@ int main_migrate(int argc, char **argv)
         } else {
             verbose_len = (minmsglevel_default - minmsglevel) + 2;
         }
-        xasprintf(&rune, "exec %s %s xl%s%.*s migrate-receive%s%s%s",
+        xasprintf(&rune, "exec %s %s xl%s%s%.*s migrate-receive%s%s%s",
                   ssh_command, host,
                   pass_tty_arg ? " -t" : "",
+                  timestamps ? " -T" : "",
                   verbose_len, verbose_buf,
                   daemonize ? "" : " -e",
                   debug ? " -d" : "",
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:37:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:37:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84768.158960 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Lc-0003as-Ix; Sun, 14 Feb 2021 01:37:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84768.158960; Sun, 14 Feb 2021 01:37:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Lc-0003aj-Fq; Sun, 14 Feb 2021 01:37:16 +0000
Received: by outflank-mailman (input) for mailman id 84768;
 Sun, 14 Feb 2021 01:37:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Lb-0003aY-Hh
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:37:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Lb-0006zn-Ge
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:37:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Lb-000673-G2
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:37:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=y4dVm0K4uPeb6lxq25mpzXgc6+8vwzmuuk/Uj1v0duM=; b=lCDcyzJs2ZGaqySW6gS2bCk1lS
	wh7PvxWeSWSKzX6/dcW+foQp3fnDK4990h4XaGYE8glTv4035v2pUblezZHACEEn3OPKvyfCMn9Z6
	AMR3VbpMcjFss7qpbeBq/GdgpOHgddYIr1038NiM040PeLXeg7AKf0QObsj5QYnMDZ6I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] autoconf: check endian.h include path
Message-Id: <E1lB6Lb-000673-G2@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:37:15 +0000

commit c9b0242ad44a739e0f4c72b67fd4bcf4b042f800
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Feb 4 10:38:33 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Wed Feb 10 11:10:55 2021 +0000

    autoconf: check endian.h include path
    
    Introduce an autoconf macro to check for the include path of certain
    headers that can be different between OSes.
    
    Use such macro to find the correct path for the endian.h header, and
    modify the users of endian.h to use the output of such check.
    
    Suggested-by: Ian Jackson <iwj@xenproject.org>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 m4/header.m4                                      | 13 +++++++++++++
 tools/configure.ac                                |  3 +++
 tools/libs/guest/xg_dom_decompress_unsafe_lzo1x.c |  2 +-
 tools/libs/guest/xg_dom_decompress_unsafe_xz.c    |  2 +-
 tools/libs/guest/xg_dom_decompress_unsafe_zstd.c  |  2 +-
 tools/xenstore/include/xenstore_state.h           |  6 +-----
 6 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/m4/header.m4 b/m4/header.m4
new file mode 100644
index 0000000000..81d1d65194
--- /dev/null
+++ b/m4/header.m4
@@ -0,0 +1,13 @@
+AC_DEFUN([AX_FIND_HEADER], [
+ax_found=0
+m4_foreach_w([header], $2, [
+    AS_IF([test "$ax_found" = "0"], [
+        AC_CHECK_HEADER(header, [
+            AC_DEFINE($1, [<header>], [Header path for $1])
+            ax_found=1])
+    ])
+])
+AS_IF([test "$ax_found" = "0"], [
+    AC_MSG_ERROR([No header found from list $2])
+])
+])
diff --git a/tools/configure.ac b/tools/configure.ac
index 5b328700e0..3a3e7b4b2b 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -74,6 +74,7 @@ m4_include([../m4/ax_compare_version.m4])
 m4_include([../m4/paths.m4])
 m4_include([../m4/systemd.m4])
 m4_include([../m4/golang.m4])
+m4_include([../m4/header.m4])
 
 AX_XEN_EXPAND_CONFIG()
 
@@ -517,4 +518,6 @@ AC_ARG_ENABLE([pvshim],
 ])
 AC_SUBST(pvshim)
 
+AX_FIND_HEADER([INCLUDE_ENDIAN_H], [endian.h sys/endian.h])
+
 AC_OUTPUT()
diff --git a/tools/libs/guest/xg_dom_decompress_unsafe_lzo1x.c b/tools/libs/guest/xg_dom_decompress_unsafe_lzo1x.c
index a4f8ebd42d..e58c1b95ed 100644
--- a/tools/libs/guest/xg_dom_decompress_unsafe_lzo1x.c
+++ b/tools/libs/guest/xg_dom_decompress_unsafe_lzo1x.c
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <inttypes.h>
-#include <endian.h>
+#include INCLUDE_ENDIAN_H
 #include <stdint.h>
 
 #include "xg_private.h"
diff --git a/tools/libs/guest/xg_dom_decompress_unsafe_xz.c b/tools/libs/guest/xg_dom_decompress_unsafe_xz.c
index ff6824b38d..fc48198741 100644
--- a/tools/libs/guest/xg_dom_decompress_unsafe_xz.c
+++ b/tools/libs/guest/xg_dom_decompress_unsafe_xz.c
@@ -1,5 +1,5 @@
 #include <stdio.h>
-#include <endian.h>
+#include INCLUDE_ENDIAN_H
 #include <stdlib.h>
 #include <stddef.h>
 #include <stdint.h>
diff --git a/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c b/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c
index 52558d2ffc..01eafaaaa6 100644
--- a/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c
+++ b/tools/libs/guest/xg_dom_decompress_unsafe_zstd.c
@@ -1,5 +1,5 @@
 #include <stdio.h>
-#include <endian.h>
+#include INCLUDE_ENDIAN_H
 #include <stdlib.h>
 #include <stddef.h>
 #include <stdint.h>
diff --git a/tools/xenstore/include/xenstore_state.h b/tools/xenstore/include/xenstore_state.h
index f7e4da2b2c..ae0d053c8f 100644
--- a/tools/xenstore/include/xenstore_state.h
+++ b/tools/xenstore/include/xenstore_state.h
@@ -21,11 +21,7 @@
 #ifndef XENSTORE_STATE_H
 #define XENSTORE_STATE_H
 
-#if defined(__FreeBSD__) || defined(__NetBSD__)
-#include <sys/endian.h>
-#else
-#include <endian.h>
-#endif
+#include INCLUDE_ENDIAN_H
 #include <sys/types.h>
 
 #ifndef htobe32
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:37:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:37:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84769.158964 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Lm-0003cg-KV; Sun, 14 Feb 2021 01:37:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84769.158964; Sun, 14 Feb 2021 01:37:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Lm-0003cY-HN; Sun, 14 Feb 2021 01:37:26 +0000
Received: by outflank-mailman (input) for mailman id 84769;
 Sun, 14 Feb 2021 01:37:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Ll-0003cR-KZ
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:37:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Ll-00070E-JT
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:37:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Ll-00068F-Io
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:37:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RG5xRn49LfdqVjX7Fq9b9oXY2ajwvruW1SMx+JtfVgI=; b=cV0kGF5vyXl4e6tZ4NYl5m7ImO
	wKhe+sRRFRKotMr2uBeyhd8DttGGNY3XcAkez2jTOweDyPwo7eysCzrEdeS3T8f4PqwFnk9FDAAa1
	kTs+r8oSsOn163R07pmKZAe8f6ILDIgtSTHMDZ/+wlLVUZbiWDV6N1rYCLJshwLOgRtc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/configure: add bison as mandatory
Message-Id: <E1lB6Ll-00068F-Io@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:37:25 +0000

commit 20077d035224c6f3b3eef8b111b8b842635f2c40
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Fri Feb 5 12:53:27 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Wed Feb 10 11:11:55 2021 +0000

    tools/configure: add bison as mandatory
    
    Bison is now mandatory when the pvshim build is enabled in order to
    generate the Kconfig.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
---
 tools/configure.ac | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/configure.ac b/tools/configure.ac
index 3a3e7b4b2b..6b611deb13 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -309,7 +309,6 @@ AC_ARG_VAR([AWK], [Path to awk tool])
 AC_PROG_CC
 AC_PROG_MAKE_SET
 AC_PROG_INSTALL
-AC_PATH_PROG([BISON], [bison])
 AC_PATH_PROG([FLEX], [flex])
 AX_PATH_PROG_OR_FAIL([PERL], [perl])
 AX_PATH_PROG_OR_FAIL([AWK], [awk])
@@ -517,6 +516,11 @@ AC_ARG_ENABLE([pvshim],
     esac
 ])
 AC_SUBST(pvshim)
+AS_IF([test "x$pvshim" = "xy"], [
+    AX_PATH_PROG_OR_FAIL([BISON], [bison])
+], [
+    AC_PATH_PROG([BISON], [bison])
+])
 
 AX_FIND_HEADER([INCLUDE_ENDIAN_H], [endian.h sys/endian.h])
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:37:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:37:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84770.158967 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Lw-0003eH-Lx; Sun, 14 Feb 2021 01:37:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84770.158967; Sun, 14 Feb 2021 01:37: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 1lB6Lw-0003e9-Iw; Sun, 14 Feb 2021 01:37:36 +0000
Received: by outflank-mailman (input) for mailman id 84770;
 Sun, 14 Feb 2021 01:37: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 1lB6Lv-0003du-N1
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:37:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Lv-00070Q-MM
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:37:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Lv-00069F-Lg
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:37:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bqXxCWR10+44e4fMUBynthuBjnb2FEUP7xrcjoljBIo=; b=Fa6Gd3IszhRH4CBwsrs3ZRybWK
	TwCcDHOCPLMtlY0XRf3Mt0mMb0ovX0B7UNZlxqchWisUqrTzuNGokUJzCW5qxKtewD3dkuR/E4Lm8
	5+cTV+R2jGBhL7E7iLb3Fsm7x0LkiyVVE2fvaajXETRwp3vuFc05kmTOxRtcG93WPCs8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ucode/amd: Fix OoB read in cpu_request_microcode()
Message-Id: <E1lB6Lv-00069F-Lg@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:37:35 +0000

commit 1cbc4d89c45cba3929f1c0cb4bca0b000c4f174b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 9 22:10:54 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 10 13:23:51 2021 +0000

    x86/ucode/amd: Fix OoB read in cpu_request_microcode()
    
    verify_patch_size() is a maximum size check, and doesn't have a minimum bound.
    
    If the microcode container encodes a blob with a length less than 64 bytes,
    the subsequent calls to microcode_fits()/compare_header() may read off the end
    of the buffer.
    
    Fixes: 4de936a38a ("x86/ucode/amd: Rework parsing logic in cpu_request_microcode()")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/amd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 5255028af7..3e51e53c1f 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -349,6 +349,7 @@ static struct microcode_patch *cpu_request_microcode(const void *buf, size_t siz
             if ( size < sizeof(*mc) ||
                  (mc = buf)->type != UCODE_UCODE_TYPE ||
                  size - sizeof(*mc) < mc->len ||
+                 mc->len < sizeof(struct microcode_patch) ||
                  (!skip_ucode && !verify_patch_size(mc->len)) )
             {
                 printk(XENLOG_ERR "microcode: Bad microcode data\n");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:37:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:37:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84771.158972 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6M6-0003fb-NZ; Sun, 14 Feb 2021 01:37:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84771.158972; Sun, 14 Feb 2021 01:37:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6M6-0003fR-KT; Sun, 14 Feb 2021 01:37:46 +0000
Received: by outflank-mailman (input) for mailman id 84771;
 Sun, 14 Feb 2021 01:37: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 1lB6M5-0003fJ-Qw
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:37: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 1lB6M5-00070Y-PF
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:37:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6M5-0006AL-Od
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:37:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A94rOSb2y3lw+74kfU6S8rdrwA45Suasap0oO6O+tU8=; b=2ypO36wuSAOTKfZT9eAnpRmPku
	sNCartz9NJfAifY0eFA47df2YuPxiOF5bNwVoh7+i3QqpweN7Ao2jgQCGGS56gUPohlFt5BTvv/AG
	fuD2pcjyfQKnRP70oNmZNtr17B0gKsevOIfiXT2GtEBEaxjUZY8GUdNnOVsapjyQ2zjg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ucode/amd: Handle length sanity check failures more gracefully
Message-Id: <E1lB6M5-0006AL-Od@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:37:45 +0000

commit 0e898ad8bc86d76485ce7a6a29ff2d3fa34d070d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 9 20:49:07 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 10 13:23:51 2021 +0000

    x86/ucode/amd: Handle length sanity check failures more gracefully
    
    Currently, a failure of verify_patch_size() causes an early abort of the
    microcode blob loop, which in turn causes a second go around the main
    container loop, ultimately failing the UCODE_MAGIC check.
    
    First, check for errors after the blob loop.  An error here is unrecoverable,
    so avoid going around the container loop again and printing an
    unhelpful-at-best error concerning bad UCODE_MAGIC.
    
    Second, split the verify_patch_size() check out of the microcode blob header
    check.  In the case that the sanity check fails, we can still use the
    known-to-be-plausible header length to continue walking the container to
    potentially find other applicable microcode blobs.
    
    Before:
      (XEN) microcode: Bad microcode data
      (XEN) microcode: Wrong microcode patch file magic
      (XEN) Parsing microcode blob error -22
    
    After:
      (XEN) microcode: Bad microcode length 0x000015c0 for cpu 0xa000
      (XEN) microcode: Bad microcode length 0x000015c0 for cpu 0xa010
      (XEN) microcode: Bad microcode length 0x000015c0 for cpu 0xa011
      (XEN) microcode: Bad microcode length 0x000015c0 for cpu 0xa200
      (XEN) microcode: Bad microcode length 0x000015c0 for cpu 0xa210
      (XEN) microcode: Bad microcode length 0x000015c0 for cpu 0xa500
      (XEN) microcode: couldn't find any matching ucode in the provided blob!
    
    Fixes: 4de936a38a ("x86/ucode/amd: Rework parsing logic in cpu_request_microcode()")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/amd.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 3e51e53c1f..500b2ce941 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -349,8 +349,7 @@ static struct microcode_patch *cpu_request_microcode(const void *buf, size_t siz
             if ( size < sizeof(*mc) ||
                  (mc = buf)->type != UCODE_UCODE_TYPE ||
                  size - sizeof(*mc) < mc->len ||
-                 mc->len < sizeof(struct microcode_patch) ||
-                 (!skip_ucode && !verify_patch_size(mc->len)) )
+                 mc->len < sizeof(struct microcode_patch) )
             {
                 printk(XENLOG_ERR "microcode: Bad microcode data\n");
                 error = -EINVAL;
@@ -360,6 +359,19 @@ static struct microcode_patch *cpu_request_microcode(const void *buf, size_t siz
             if ( skip_ucode )
                 goto skip;
 
+            if ( !verify_patch_size(mc->len) )
+            {
+                printk(XENLOG_WARNING
+                       "microcode: Bad microcode length 0x%08x for cpu 0x%04x\n",
+                       mc->len, mc->patch->processor_rev_id);
+                /*
+                 * If the blob size sanity check fails, trust the container
+                 * length which has already been checked to be at least
+                 * plausible at this point.
+                 */
+                goto skip;
+            }
+
             /*
              * If the new ucode covers current CPU, compare ucodes and store the
              * one with higher revision.
@@ -383,6 +395,14 @@ static struct microcode_patch *cpu_request_microcode(const void *buf, size_t siz
             if ( size >= 4 && *(const uint32_t *)buf == UCODE_MAGIC )
                 break;
         }
+
+        /*
+         * Any error means we didn't get cleanly to the end of the microcode
+         * container.  There isn't an overall length field, so we've got no
+         * way of skipping to the next container in the stream.
+         */
+        if ( error )
+            break;
     }
 
     if ( saved )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:37:56 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:37:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84772.158976 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6MG-0003gx-P6; Sun, 14 Feb 2021 01:37:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84772.158976; Sun, 14 Feb 2021 01:37:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6MG-0003gp-MA; Sun, 14 Feb 2021 01:37:56 +0000
Received: by outflank-mailman (input) for mailman id 84772;
 Sun, 14 Feb 2021 01:37:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6MF-0003gh-St
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:37:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6MF-00070g-S6
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:37:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6MF-0006BN-RO
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:37:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NRTK4KnCsKN7bZt75YEoY34Y4ywBlUWkej8jPNjtVmo=; b=L5epmi31/rMLgnGExCeUU1HcJN
	43GrGq4TXyewc1uhug1o1kE5DmXdPurXcT4xabMWci09cr0gu/0cdJ36ojqniVyd/io9K2I9fyz6U
	XI84h7ofeTYJzQ6VatBLxkl2L/PMs00WN91Z7ALA6/KGhg6d22mY4olA42Phl/Z+9NoU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ucode/amd: Fix microcode payload size for Fam19 processors
Message-Id: <E1lB6MF-0006BN-RO@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:37:55 +0000

commit 90b014a6e6ecad036ec5846426afd19b305dedff
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 9 15:28:57 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 10 13:23:51 2021 +0000

    x86/ucode/amd: Fix microcode payload size for Fam19 processors
    
    The original limit provided wasn't accurate.  Blobs are in fact rather larger.
    
    Fixes: fe36a173d1 ("x86/amd: Initial support for Fam19h processors")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/cpu/microcode/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 500b2ce941..809ba4967c 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -111,7 +111,7 @@ static bool verify_patch_size(uint32_t patch_size)
 #define F15H_MPB_MAX_SIZE 4096
 #define F16H_MPB_MAX_SIZE 3458
 #define F17H_MPB_MAX_SIZE 3200
-#define F19H_MPB_MAX_SIZE 4800
+#define F19H_MPB_MAX_SIZE 5568
 
     switch ( boot_cpu_data.x86 )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:38:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:38:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84773.158980 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6MR-0003iT-Qk; Sun, 14 Feb 2021 01:38:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84773.158980; Sun, 14 Feb 2021 01:38:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6MR-0003iL-Nh; Sun, 14 Feb 2021 01:38:07 +0000
Received: by outflank-mailman (input) for mailman id 84773;
 Sun, 14 Feb 2021 01:38:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6MQ-0003i7-2C
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:38:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6MP-000713-Vw
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:38:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6MP-0006CM-Uj
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:38: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=oJ/yJ70DSwCFygLzFxe+4nyIwehpbONev721+k/5CXQ=; b=5vHkkpvNFdMOUMA2nfgzNsPa4S
	KL9yyvm/hKxMRWllE+EwtGjVRHFtzJjzBzvcx44kv9WIOn+cZLKx1Rbcv7nz3g3Bhfbq9BZjblHgF
	QJe7atTOWvtsPTudf2yiyPyPQmhJOwsi9AmmrlClSNGjyxfznmO+3M7OIXZKCVM47058=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: rerun autoconf again
Message-Id: <E1lB6MP-0006CM-Uj@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:38:05 +0000

commit 01456785ce093d95c6a8515e6b8feeb39e1820b8
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Wed Feb 10 15:30:59 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Wed Feb 10 15:30:59 2021 +0000

    tools: rerun autoconf again
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 tools/config.h.in |   3 +
 tools/configure   | 174 +++++++++++++++++++++++++++++++++++++++++-------------
 2 files changed, 137 insertions(+), 40 deletions(-)

diff --git a/tools/config.h.in b/tools/config.h.in
index 5abf6092de..52e01b2c84 100644
--- a/tools/config.h.in
+++ b/tools/config.h.in
@@ -84,6 +84,9 @@
 /* Define curses header to use */
 #undef INCLUDE_CURSES_H
 
+/* Header path for INCLUDE_ENDIAN_H */
+#undef INCLUDE_ENDIAN_H
+
 /* Define extfs header to use */
 #undef INCLUDE_EXTFS_H
 
diff --git a/tools/configure b/tools/configure
index 419d7b189a..e63ca3797d 100755
--- a/tools/configure
+++ b/tools/configure
@@ -3890,6 +3890,8 @@ esac
 
 
 
+
+
 
 
 
@@ -5400,46 +5402,6 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
-# Extract the first word of "bison", so it can be a program name with args.
-set dummy bison; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_BISON+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $BISON in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_BISON="$BISON" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_BISON="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-BISON=$ac_cv_path_BISON
-if test -n "$BISON"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5
-$as_echo "$BISON" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
 # Extract the first word of "flex", so it can be a program name with args.
 set dummy flex; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -10110,6 +10072,138 @@ else
 fi
 
 
+if test "x$pvshim" = "xy"; then :
+
+    # Extract the first word of "bison", so it can be a program name with args.
+set dummy bison; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BISON+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BISON in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BISON="$BISON" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BISON="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_BISON" && ac_cv_path_BISON="no"
+  ;;
+esac
+fi
+BISON=$ac_cv_path_BISON
+if test -n "$BISON"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5
+$as_echo "$BISON" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"${BISON}" = x"no"
+then
+    as_fn_error $? "Unable to find bison, please install bison" "$LINENO" 5
+fi
+
+else
+
+    # Extract the first word of "bison", so it can be a program name with args.
+set dummy bison; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BISON+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $BISON in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_BISON="$BISON" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_BISON="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+BISON=$ac_cv_path_BISON
+if test -n "$BISON"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5
+$as_echo "$BISON" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+fi
+
+
+ax_found=0
+
+    if test "$ax_found" = "0"; then :
+
+        ac_fn_c_check_header_mongrel "$LINENO" "endian.h" "ac_cv_header_endian_h" "$ac_includes_default"
+if test "x$ac_cv_header_endian_h" = xyes; then :
+
+
+$as_echo "#define INCLUDE_ENDIAN_H <endian.h>" >>confdefs.h
+
+            ax_found=1
+fi
+
+
+
+fi
+
+    if test "$ax_found" = "0"; then :
+
+        ac_fn_c_check_header_mongrel "$LINENO" "sys/endian.h" "ac_cv_header_sys_endian_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_endian_h" = xyes; then :
+
+
+$as_echo "#define INCLUDE_ENDIAN_H <sys/endian.h>" >>confdefs.h
+
+            ax_found=1
+fi
+
+
+
+fi
+
+if test "$ax_found" = "0"; then :
+
+    as_fn_error $? "No header found from list endian.h sys/endian.h" "$LINENO" 5
+
+fi
+
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:38:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:38:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84774.158984 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Mb-0003jy-Tc; Sun, 14 Feb 2021 01:38:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84774.158984; Sun, 14 Feb 2021 01:38:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Mb-0003jr-Qg; Sun, 14 Feb 2021 01:38:17 +0000
Received: by outflank-mailman (input) for mailman id 84774;
 Sun, 14 Feb 2021 01:38:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Ma-0003je-3q
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:38:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Ma-00071G-39
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:38:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Ma-0006DF-2O
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:38:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4SPw2qUMy3SipwGF1AErdkompnSBTqotDXg13qLrICo=; b=qVixp9wZ/dX4Rqry7MdW2MYqt+
	yMwB3Lb7U4mOlnue/8n8gMy5lu2589EH37D+ZOrgFNsXbPkVqK6DX8Hz/nHCixyta2A3KeS4oj8Iz
	ZTlVaRzs8QYuOhLgkzb7w5Pe77uEeSKq3PoQMG4Q8a7veobFNFdUEBTpLnSrf4IAt+9E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: fix SYSENTER/SYSCALL switching into 64-bit mode
Message-Id: <E1lB6Ma-0006DF-2O@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:38:16 +0000

commit f3e1eb2f0234c955243a915d69ebd84f26eec130
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 11 17:53:10 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 11 17:53:10 2021 +0100

    x86emul: fix SYSENTER/SYSCALL switching into 64-bit mode
    
    When invoked by compat mode, mode_64bit() will be false at the start of
    emulation. The logic after complete_insn, however, needs to consider the
    mode switched into, in particular to avoid truncating RIP.
    
    Inspired by / paralleling and extending Linux commit 943dea8af21b ("KVM:
    x86: Update emulator context mode if SYSENTER xfers to 64-bit mode").
    
    While there, tighten a related assertion in x86_emulate_wrapper() - we
    want to be sure to not switch into an impossible mode when the code gets
    built for 32-bit only (as is possible for the test harness).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citirix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 6ac0787745..4a33fe9613 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6127,6 +6127,10 @@ x86_emulate(
              (rc = ops->write_segment(x86_seg_ss, &sreg, ctxt)) )
             goto done;
 
+        if ( ctxt->lma )
+            /* In particular mode_64bit() needs to return true from here on. */
+            ctxt->addr_size = ctxt->sp_size = 64;
+
         /*
          * SYSCALL (unlike most instructions) evaluates its singlestep action
          * based on the resulting EFLAGS.TF, not the starting EFLAGS.TF.
@@ -6927,6 +6931,10 @@ x86_emulate(
                                       ctxt)) != X86EMUL_OKAY )
             goto done;
 
+        if ( ctxt->lma )
+            /* In particular mode_64bit() needs to return true from here on. */
+            ctxt->addr_size = ctxt->sp_size = 64;
+
         singlestep = _regs.eflags & X86_EFLAGS_TF;
         break;
 
@@ -12113,8 +12121,12 @@ int x86_emulate_wrapper(
     unsigned long orig_ip = ctxt->regs->r(ip);
     int rc;
 
+#ifdef __x86_64__
     if ( mode_64bit() )
         ASSERT(ctxt->lma);
+#else
+    ASSERT(!ctxt->lma && !mode_64bit());
+#endif
 
     rc = x86_emulate(ctxt, ops);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:38:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:38:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84775.158988 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Ml-0003ld-VC; Sun, 14 Feb 2021 01:38:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84775.158988; Sun, 14 Feb 2021 01:38:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Ml-0003lV-SL; Sun, 14 Feb 2021 01:38:27 +0000
Received: by outflank-mailman (input) for mailman id 84775;
 Sun, 14 Feb 2021 01:38:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Mk-0003lN-7H
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:38:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Mk-00071e-6Z
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:38:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Mk-0006E7-5F
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:38:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SRHgH3aAJKAoqXYfsfxR5q7etaRFedIR/b9kZ7Fwo3c=; b=bStw3G7Z4ZBg9u6a80uSydIFvi
	9xJqPGBZN1NtxDup78RfLDo9Xft+xZ/yZ28dBNzsRZaNE2tLGSBeeqfE2tY2c2u04v1CXAYa10SAk
	ZEQHqcGDrLA8Zq/jmvX9jNptcEK1kt/449cEmvOrBCfeqo7ainAa56gnv6RBOiCf01Ok=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxl: Document where the magic MAC numbers come from
Message-Id: <E1lB6Mk-0006E7-5F@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:38:26 +0000

commit 9ca7632bc45cf045fa78a9d7e1275af55240b243
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Feb 10 13:51:21 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 11 17:26:13 2021 +0000

    tools/libxl: Document where the magic MAC numbers come from
    
    Matches the comment in the xl-network-configuration manpage.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/light/libxl_nic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libs/light/libxl_nic.c b/tools/libs/light/libxl_nic.c
index 144e9e23e1..0b45469dca 100644
--- a/tools/libs/light/libxl_nic.c
+++ b/tools/libs/light/libxl_nic.c
@@ -73,6 +73,7 @@ static int libxl__device_nic_setdefault(libxl__gc *gc, uint32_t domid,
         libxl_uuid_generate(&uuid);
         r = libxl_uuid_bytearray(&uuid);
 
+        /* Generate a random MAC address, with Xen's OUI (00:16:3e) */
         nic->mac[0] = 0x00;
         nic->mac[1] = 0x16;
         nic->mac[2] = 0x3e;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:38:38 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:38:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84777.158993 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Mw-0003nF-14; Sun, 14 Feb 2021 01:38:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84777.158993; Sun, 14 Feb 2021 01:38:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6Mv-0003n6-Tp; Sun, 14 Feb 2021 01:38:37 +0000
Received: by outflank-mailman (input) for mailman id 84777;
 Sun, 14 Feb 2021 01:38:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Mu-0003mr-A1
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:38:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Mu-00071r-9L
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:38:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6Mu-0006F3-8f
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:38:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rmSZDRQzSEI8KBKhR8JVad46JlVy/wXrkemqW2YdnRU=; b=KWPk8Cc7+Kup8+qFCeC4o7lboN
	uXQToHnJgcglBrWIaJolaJ2579qzDtdxsG45L8TdWQZinNNn0woJyr6RXa969Y2bHcU1dOOtrJKq0
	T4nK5ANvtwIhmBTeiUsGyHDTK3QEy0ZCju4dBStkFb1+2BLWHheelAIUrYSkmNJNu01A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Add Ubuntu Focal builds
Message-Id: <E1lB6Mu-0006F3-8f@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:38:36 +0000

commit d66cf56fa26a052bce2f8c746dc0dbac9061b593
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 13:25:58 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 11 17:26:13 2021 +0000

    automation: Add Ubuntu Focal builds
    
    Logical continuation of c/s eb52442d7f "automation: Add Ubuntu:focal
    container".
    
    No further changes required.  Everything builds fine.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 automation/gitlab-ci/build.yaml | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index db68dd0b69..d00b8a5123 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -390,6 +390,26 @@ ubuntu-bionic-gcc-debug:
   variables:
     CONTAINER: ubuntu:bionic
 
+ubuntu-focal-gcc:
+  extends: .gcc-x86-64-build
+  variables:
+    CONTAINER: ubuntu:focal
+
+ubuntu-focal-gcc-debug:
+  extends: .gcc-x86-64-build-debug
+  variables:
+    CONTAINER: ubuntu:focal
+
+ubuntu-focal-clang:
+  extends: .gcc-x86-64-build
+  variables:
+    CONTAINER: ubuntu:focal
+
+ubuntu-focal-clang-debug:
+  extends: .gcc-x86-64-build-debug
+  variables:
+    CONTAINER: ubuntu:focal
+
 opensuse-leap-clang:
   extends: .clang-x86-64-build
   variables:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:38:48 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:38:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84778.158996 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6N6-0003oe-2B; Sun, 14 Feb 2021 01:38:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84778.158996; Sun, 14 Feb 2021 01:38:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6N5-0003oW-VO; Sun, 14 Feb 2021 01:38:47 +0000
Received: by outflank-mailman (input) for mailman id 84778;
 Sun, 14 Feb 2021 01:38:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6N4-0003oK-D1
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:38:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6N4-000722-CG
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:38:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6N4-0006Fl-BV
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:38:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UtOHw1g27sJjvz9wj03Skqf5fMb2M2iVYsx76x86jFU=; b=Ka0gBu1Oti9nAonEalNer4O7oB
	0xmet7qyh6+6GbGHErQEDzzLatXnE7i6sC2SRNY94g183T32hNajI9huVu89s0h3CgbcjmRb6KV38
	B+4qRVp/BikQEfnPYWEuhknHVqzzXJEvbfObJ8pZ8+hMFKivefCZK/qPWWwDCiFNZfi4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: workaround missing device_type property in pci/pcie nodes
Message-Id: <E1lB6N4-0006Fl-BV@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:38:46 +0000

commit 5a4087004d1adbbb223925f3306db0e5824a2bdc
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Tue Feb 9 11:53:34 2021 -0800
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Thu Feb 11 17:52:36 2021 -0800

    xen: workaround missing device_type property in pci/pcie nodes
    
    PCI buses differ from default buses in a few important ways, so it is
    important to detect them properly. Normally, PCI buses are expected to
    have the following property:
    
        device_type = "pci"
    
    In reality, it is not always the case. To handle PCI bus nodes that
    don't have the device_type property, also consider the node name: if the
    node name is "pcie" or "pci" then consider the bus as a PCI bus.
    
    This commit is based on the Linux kernel commit
    d1ac0002dd29 "of: address: Work around missing device_type property in
    pcie nodes".
    
    This fixes Xen boot on RPi4. Some RPi4 kernels have the following node
    on their device trees:
    
    &pcie0 {
            pci@1,0 {
                    #address-cells = <3>;
                    #size-cells = <2>;
                    ranges;
    
                    reg = <0 0 0 0 0>;
    
                    usb@1,0 {
                            reg = <0x10000 0 0 0 0>;
                            resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>;
                    };
            };
    };
    
    The pci@1,0 node is a PCI bus. If we parse the node and its children as
    a default bus, the reg property under usb@1,0 would have to be
    interpreted as an address range mappable by the CPU, which is not the
    case and would break.
    
    Link: https://lore.kernel.org/xen-devel/YBmQQ3Tzu++AadKx@mattapan.m5p.com/
    [fix style on commit]
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Tested-by: Elliott Mitchell <ehem+xen@m5p.com>
    Tested-by: Jukka Kaartinen <jukka.kaartinen@unikie.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/device_tree.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
index 18825e333e..03d25a81ce 100644
--- a/xen/common/device_tree.c
+++ b/xen/common/device_tree.c
@@ -563,14 +563,28 @@ static unsigned int dt_bus_default_get_flags(const __be32 *addr)
  * PCI bus specific translator
  */
 
+static bool dt_node_is_pci(const struct dt_device_node *np)
+{
+    bool is_pci = !strcmp(np->name, "pcie") || !strcmp(np->name, "pci");
+
+    if ( is_pci )
+        printk(XENLOG_WARNING "%s: Missing device_type\n", np->full_name);
+
+    return is_pci;
+}
+
 static bool_t dt_bus_pci_match(const struct dt_device_node *np)
 {
     /*
      * "pciex" is PCI Express "vci" is for the /chaos bridge on 1st-gen PCI
      * powermacs "ht" is hypertransport
+     *
+     * If none of the device_type match, and that the node name is
+     * "pcie" or "pci", accept the device as PCI (with a warning).
      */
     return !strcmp(np->type, "pci") || !strcmp(np->type, "pciex") ||
-        !strcmp(np->type, "vci") || !strcmp(np->type, "ht");
+        !strcmp(np->type, "vci") || !strcmp(np->type, "ht") ||
+        dt_node_is_pci(np);
 }
 
 static void dt_bus_pci_count_cells(const struct dt_device_node *np,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 14 01:38:58 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 14 Feb 2021 01:38:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.84779.159000 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6NG-0003qY-44; Sun, 14 Feb 2021 01:38:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 84779.159000; Sun, 14 Feb 2021 01:38:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lB6NG-0003qP-0o; Sun, 14 Feb 2021 01:38:58 +0000
Received: by outflank-mailman (input) for mailman id 84779;
 Sun, 14 Feb 2021 01:38:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6NE-0003pm-Ik
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:38:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6NE-00072E-I2
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:38:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lB6NE-0006Gc-EI
 for xen-changelog@lists.xenproject.org; Sun, 14 Feb 2021 01:38:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sv4svp6BC3hogXekcIa2X9OmlYVLbfdJnGHlDOjKOXY=; b=0ZIA+7BXUhvLsi2WKsxALxgT/E
	M7xuCNRCloiUgfyhLmGUSy833UEvWAvroYrJbu12p0/0h3CJcBJAZYX3tVpfuL2LMtqjW3NbVFkcu
	IXBaO58dVpHkbU6/RPZGgXUcdOxYJN2S9rO8r0GHnleVG/Ak+IrwLwrcD5OCXyXRsG5s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: fix gnttab_need_iommu_mapping
Message-Id: <E1lB6NE-0006Gc-EI@xenbits.xenproject.org>
Date: Sun, 14 Feb 2021 01:38:56 +0000

commit 04085ec1ac05a362812e9b0c6b5a8713d7dc88ad
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Mon Feb 8 10:49:32 2021 -0800
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Fri Feb 12 11:01:41 2021 -0800

    xen/arm: fix gnttab_need_iommu_mapping
    
    Commit 91d4eca7add broke gnttab_need_iommu_mapping on ARM.
    The offending chunk is:
    
     #define gnttab_need_iommu_mapping(d)                    \
    -    (is_domain_direct_mapped(d) && need_iommu(d))
    +    (is_domain_direct_mapped(d) && need_iommu_pt_sync(d))
    
    On ARM we need gnttab_need_iommu_mapping to be true for dom0 when it is
    directly mapped and IOMMU is enabled for the domain, like the old check
    did, but the new check is always false.
    
    In fact, need_iommu_pt_sync is defined as dom_iommu(d)->need_sync and
    need_sync is set as:
    
        if ( !is_hardware_domain(d) || iommu_hwdom_strict )
            hd->need_sync = !iommu_use_hap_pt(d);
    
    iommu_use_hap_pt(d) means that the page-table used by the IOMMU is the
    P2M. It is true on ARM. need_sync means that you have a separate IOMMU
    page-table and it needs to be updated for every change. need_sync is set
    to false on ARM. Hence, gnttab_need_iommu_mapping(d) is false too,
    which is wrong.
    
    As a consequence, when using PV network from a domU on a system where
    IOMMU is on from Dom0, I get:
    
    (XEN) smmu: /smmu@fd800000: Unhandled context fault: fsr=0x402, iova=0x8424cb148, fsynr=0xb0001, cb=0
    [   68.290307] macb ff0e0000.ethernet eth0: DMA bus error: HRESP not OK
    
    The fix is to go back to something along the lines of the old
    implementation of gnttab_need_iommu_mapping.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Fixes: 91d4eca7add ("mm / iommu: split need_iommu() into has_iommu_pt() and need_iommu_pt_sync()")
    Backport: 4.13+
---
 xen/include/asm-arm/grant_table.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/asm-arm/grant_table.h b/xen/include/asm-arm/grant_table.h
index 6f585b1538..0ce77f9a1c 100644
--- a/xen/include/asm-arm/grant_table.h
+++ b/xen/include/asm-arm/grant_table.h
@@ -89,7 +89,7 @@ int replace_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
     (((i) >= nr_status_frames(t)) ? INVALID_GFN : (t)->arch.status_gfn[i])
 
 #define gnttab_need_iommu_mapping(d)                    \
-    (is_domain_direct_mapped(d) && need_iommu_pt_sync(d))
+    (is_domain_direct_mapped(d) && is_iommu_enabled(d))
 
 #endif /* __ASM_GRANT_TABLE_H__ */
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 16 14:44:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Feb 2021 14:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.85864.160673 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lC1aB-0000XZ-4u; Tue, 16 Feb 2021 14:44:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 85864.160673; Tue, 16 Feb 2021 14:44:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lC1aB-0000XR-1w; Tue, 16 Feb 2021 14:44:07 +0000
Received: by outflank-mailman (input) for mailman id 85864;
 Tue, 16 Feb 2021 14:44:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lC1a9-0000XM-IO
 for xen-changelog@lists.xenproject.org; Tue, 16 Feb 2021 14:44:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lC1a9-0002Bo-FB
 for xen-changelog@lists.xenproject.org; Tue, 16 Feb 2021 14:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lC1a9-0004yT-DB
 for xen-changelog@lists.xenproject.org; Tue, 16 Feb 2021 14:44:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SBGzg82hXN1a+1OZTRRGeyIIhDh2yNgdgNt6hmW4h5o=; b=A9znzmSDpMod6x77CNqpiN5mzk
	AL0aLzCtzRA6l5XHZLHcllndxG4/8eibg620ZKh5M01GWEIDmPLnNfH/FpY2wyGvzlyhG+wekm1pF
	CRr/crLkJvatHjb6V/C7vhxPOvVOllOOgTN8/+MA3zM2tejOQc/DCgUCCOiH6VgWBO44=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] SUPPORT.md: PV display frontend is unsupported in "backend allocation" mode
Message-Id: <E1lC1a9-0004yT-DB@xenbits.xenproject.org>
Date: Tue, 16 Feb 2021 14:44:05 +0000

commit 2dd2cd0f16aae2cad2227f9aae9469fd6cdd8cd3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 16 15:31:59 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 16 15:31:59 2021 +0100

    SUPPORT.md: PV display frontend is unsupported in "backend allocation" mode
    
    This wasn't meant to be supported, but wasn't stated this way.
    
    This is XSA-363.
    
    Reported-by: Jan Belich <jbeulich@suse.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index f69edc7ba4..4cb5ec9802 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -415,7 +415,8 @@ Guest-side driver capable of speaking the Xen PV Framebuffer protocol
 
 Guest-side driver capable of speaking the Xen PV display protocol
 
-    Status, Linux: Supported
+    Status, Linux: Supported (outside of "backend allocation" mode)
+    Status, Linux: Experimental (in "backend allocation" mode)
 
 ### PV Console (frontend)
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 16 14:44:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Feb 2021 14:44:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.85865.160677 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lC1aL-0000YF-6O; Tue, 16 Feb 2021 14:44:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 85865.160677; Tue, 16 Feb 2021 14:44:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lC1aL-0000Y7-3P; Tue, 16 Feb 2021 14:44:17 +0000
Received: by outflank-mailman (input) for mailman id 85865;
 Tue, 16 Feb 2021 14:44:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lC1aJ-0000Y2-KV
 for xen-changelog@lists.xenproject.org; Tue, 16 Feb 2021 14:44:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lC1aJ-0002Br-JN
 for xen-changelog@lists.xenproject.org; Tue, 16 Feb 2021 14:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lC1aJ-0004zU-HU
 for xen-changelog@lists.xenproject.org; Tue, 16 Feb 2021 14:44:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=B+eM+J8uCqcmEwHqKIOuRFZnAWuM0vfxP0yh38A/Kbw=; b=U6mm6HIsrhKBlhRZPL36kPTLTm
	9MOugJqH0Eia+5QcSx/w91+k717TZmBVs+tfYsV+2r333V6yQaHWU+Hr071YdKto6OzFT4usjgBzR
	mHbJwZtnJASGL4MsE+YhrChJ8RlJMYGCeihAH33uPtxi7XHN68O7kaPGN3N3efi8jgjQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
Message-Id: <E1lC1aJ-0004zU-HU@xenbits.xenproject.org>
Date: Tue, 16 Feb 2021 14:44:15 +0000

commit 3b1cc15f1931ba56d0ee256fe9bfe65509733b27
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Jan 21 10:16:08 2021 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 16 15:32:08 2021 +0100

    xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
    
    At the moment, each page are flushed to RAM just after the allocator
    found some free pages. However, this is happening before check if the
    page was scrubbed.
    
    As a consequence, on Arm, a guest may be able to access the old content
    of the scrubbed pages if it has cache disabled (default at boot) and
    the content didn't reach the Point of Coherency.
    
    The flush is now moved after we know the content of the page will not
    change. This also has the benefit to reduce the amount of work happening
    with the heap_lock held.
    
    This is XSA-364.
    
    Fixes: 307c3be3ccb2 ("mm: Don't scrub pages while holding heap lock in alloc_heap_pages()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/page_alloc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 02ac1fa613..1744e6faa5 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -924,6 +924,7 @@ static struct page_info *alloc_heap_pages(
     bool need_tlbflush = false;
     uint32_t tlbflush_timestamp = 0;
     unsigned int dirty_cnt = 0;
+    mfn_t mfn;
 
     /* Make sure there are enough bits in memflags for nodeID. */
     BUILD_BUG_ON((_MEMF_bits - _MEMF_node) < (8 * sizeof(nodeid_t)));
@@ -1022,11 +1023,6 @@ static struct page_info *alloc_heap_pages(
         pg[i].u.inuse.type_info = 0;
         page_set_owner(&pg[i], NULL);
 
-        /* Ensure cache and RAM are consistent for platforms where the
-         * guest can control its own visibility of/through the cache.
-         */
-        flush_page_to_ram(mfn_x(page_to_mfn(&pg[i])),
-                          !(memflags & MEMF_no_icache_flush));
     }
 
     spin_unlock(&heap_lock);
@@ -1062,6 +1058,14 @@ static struct page_info *alloc_heap_pages(
     if ( need_tlbflush )
         filtered_flush_tlb_mask(tlbflush_timestamp);
 
+    /*
+     * Ensure cache and RAM are consistent for platforms where the guest
+     * can control its own visibility of/through the cache.
+     */
+    mfn = page_to_mfn(pg);
+    for ( i = 0; i < (1U << order); i++ )
+        flush_page_to_ram(mfn_x(mfn) + i, !(memflags & MEMF_no_icache_flush));
+
     return pg;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 16 14:44:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Feb 2021 14:44:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.85866.160681 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lC1aV-0000Za-7o; Tue, 16 Feb 2021 14:44:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 85866.160681; Tue, 16 Feb 2021 14:44:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lC1aV-0000ZS-4z; Tue, 16 Feb 2021 14:44:27 +0000
Received: by outflank-mailman (input) for mailman id 85866;
 Tue, 16 Feb 2021 14:44: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 1lC1aU-0000ZH-8k
 for xen-changelog@lists.xenproject.org; Tue, 16 Feb 2021 14:44: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 1lC1aU-0002C3-7z
 for xen-changelog@lists.xenproject.org; Tue, 16 Feb 2021 14:44:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lC1aU-00050s-49
 for xen-changelog@lists.xenproject.org; Tue, 16 Feb 2021 14: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>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TJQmxQAEWjhmOqTrAUzCB+umN4rbrjiM+LI0PMAJ9UU=; b=hguNvX8Z9sNbGTd02KNlnH/H8M
	Qm179FHHgynlGZm/jL4PLug25h57UEyjCMyiKYCjF1GK7MA9Yn5nmEYLIYp7jJKEIRGQYS9xrvZMh
	ox9OcT1c3qJvZn61d20R1jWvVWO1PJt1RhgTS9OsMYl2vTNrvek3C5uMO/NIQcYXHX1Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
Message-Id: <E1lC1aU-00050s-49@xenbits.xenproject.org>
Date: Tue, 16 Feb 2021 14:44:26 +0000

commit 9f357fe3e4593fc1109962b76d4db73d589ebef5
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Feb 16 15:36:16 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 16 15:36:16 2021 +0100

    xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
    
    At the moment, each page are flushed to RAM just after the allocator
    found some free pages. However, this is happening before check if the
    page was scrubbed.
    
    As a consequence, on Arm, a guest may be able to access the old content
    of the scrubbed pages if it has cache disabled (default at boot) and
    the content didn't reach the Point of Coherency.
    
    The flush is now moved after we know the content of the page will not
    change. This also has the benefit to reduce the amount of work happening
    with the heap_lock held.
    
    This is XSA-364.
    
    Fixes: 307c3be3ccb2 ("mm: Don't scrub pages while holding heap lock in alloc_heap_pages()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3b1cc15f1931ba56d0ee256fe9bfe65509733b27
    master date: 2021-02-16 15:32:08 +0100
---
 xen/common/page_alloc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 10b7aeca48..d9578abb7c 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -924,6 +924,7 @@ static struct page_info *alloc_heap_pages(
     bool need_tlbflush = false;
     uint32_t tlbflush_timestamp = 0;
     unsigned int dirty_cnt = 0;
+    mfn_t mfn;
 
     /* Make sure there are enough bits in memflags for nodeID. */
     BUILD_BUG_ON((_MEMF_bits - _MEMF_node) < (8 * sizeof(nodeid_t)));
@@ -1022,11 +1023,6 @@ static struct page_info *alloc_heap_pages(
         pg[i].u.inuse.type_info = 0;
         page_set_owner(&pg[i], NULL);
 
-        /* Ensure cache and RAM are consistent for platforms where the
-         * guest can control its own visibility of/through the cache.
-         */
-        flush_page_to_ram(mfn_x(page_to_mfn(&pg[i])),
-                          !(memflags & MEMF_no_icache_flush));
     }
 
     spin_unlock(&heap_lock);
@@ -1062,6 +1058,14 @@ static struct page_info *alloc_heap_pages(
     if ( need_tlbflush )
         filtered_flush_tlb_mask(tlbflush_timestamp);
 
+    /*
+     * Ensure cache and RAM are consistent for platforms where the guest
+     * can control its own visibility of/through the cache.
+     */
+    mfn = page_to_mfn(pg);
+    for ( i = 0; i < (1U << order); i++ )
+        flush_page_to_ram(mfn_x(mfn) + i, !(memflags & MEMF_no_icache_flush));
+
     return pg;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Feb 16 14:44:38 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Feb 2021 14:44:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.85867.160685 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lC1ag-0000bI-9P; Tue, 16 Feb 2021 14:44:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 85867.160685; Tue, 16 Feb 2021 14:44:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lC1ag-0000b9-6W; Tue, 16 Feb 2021 14:44:38 +0000
Received: by outflank-mailman (input) for mailman id 85867;
 Tue, 16 Feb 2021 14:44: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 1lC1ae-0000b1-Q3
 for xen-changelog@lists.xenproject.org; Tue, 16 Feb 2021 14:44: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 1lC1ae-0002CK-PI
 for xen-changelog@lists.xenproject.org; Tue, 16 Feb 2021 14:44:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lC1ae-00051w-OT
 for xen-changelog@lists.xenproject.org; Tue, 16 Feb 2021 14: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>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6rDTb3tTdWV3sNr1jKr+9y296tVp7AKwBY6axk2I7x4=; b=zsjZ3gzAW518ylq7PJLWjU4bwR
	4WFZkt9HRaUGqjN5DYxnHyhNbpqM5nJHtHGk3pyox+VuRkOuB+st2JfXPnzm3zW0tklDhbb1XDfSL
	WjzMYI+YBBbkmFpAft6i0xF2puu64eUdHpMCn+OW+fyfZWvRe5hg59mfdweP+AoBQIlg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
Message-Id: <E1lC1ae-00051w-OT@xenbits.xenproject.org>
Date: Tue, 16 Feb 2021 14:44:36 +0000

commit ab995b6af9ab723b0b52e5ea0e342b612f1a7b89
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Feb 16 15:38:11 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 16 15:38:11 2021 +0100

    xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
    
    At the moment, each page are flushed to RAM just after the allocator
    found some free pages. However, this is happening before check if the
    page was scrubbed.
    
    As a consequence, on Arm, a guest may be able to access the old content
    of the scrubbed pages if it has cache disabled (default at boot) and
    the content didn't reach the Point of Coherency.
    
    The flush is now moved after we know the content of the page will not
    change. This also has the benefit to reduce the amount of work happening
    with the heap_lock held.
    
    This is XSA-364.
    
    Fixes: 307c3be3ccb2 ("mm: Don't scrub pages while holding heap lock in alloc_heap_pages()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3b1cc15f1931ba56d0ee256fe9bfe65509733b27
    master date: 2021-02-16 15:32:08 +0100
---
 xen/common/page_alloc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 7cb1bd368b..ebc7f45c0f 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -923,6 +923,7 @@ static struct page_info *alloc_heap_pages(
     bool need_tlbflush = false;
     uint32_t tlbflush_timestamp = 0;
     unsigned int dirty_cnt = 0;
+    mfn_t mfn;
 
     /* Make sure there are enough bits in memflags for nodeID. */
     BUILD_BUG_ON((_MEMF_bits - _MEMF_node) < (8 * sizeof(nodeid_t)));
@@ -1021,11 +1022,6 @@ static struct page_info *alloc_heap_pages(
         pg[i].u.inuse.type_info = 0;
         page_set_owner(&pg[i], NULL);
 
-        /* Ensure cache and RAM are consistent for platforms where the
-         * guest can control its own visibility of/through the cache.
-         */
-        flush_page_to_ram(mfn_x(page_to_mfn(&pg[i])),
-                          !(memflags & MEMF_no_icache_flush));
     }
 
     spin_unlock(&heap_lock);
@@ -1061,6 +1057,14 @@ static struct page_info *alloc_heap_pages(
     if ( need_tlbflush )
         filtered_flush_tlb_mask(tlbflush_timestamp);
 
+    /*
+     * Ensure cache and RAM are consistent for platforms where the guest
+     * can control its own visibility of/through the cache.
+     */
+    mfn = page_to_mfn(pg);
+    for ( i = 0; i < (1U << order); i++ )
+        flush_page_to_ram(mfn_x(mfn) + i, !(memflags & MEMF_no_icache_flush));
+
     return pg;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Feb 16 14:44:48 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Feb 2021 14:44:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.85868.160689 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lC1aq-0000cW-Ar; Tue, 16 Feb 2021 14:44:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 85868.160689; Tue, 16 Feb 2021 14:44:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lC1aq-0000cO-84; Tue, 16 Feb 2021 14:44:48 +0000
Received: by outflank-mailman (input) for mailman id 85868;
 Tue, 16 Feb 2021 14:44: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 1lC1ap-0000cG-Cz
 for xen-changelog@lists.xenproject.org; Tue, 16 Feb 2021 14:44: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 1lC1ap-0002CS-Bu
 for xen-changelog@lists.xenproject.org; Tue, 16 Feb 2021 14:44:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lC1ap-000539-9h
 for xen-changelog@lists.xenproject.org; Tue, 16 Feb 2021 14:44:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/xrepcmdJDn/OVXwY9trDia1uBhsM2O/lpV2Vwtunso=; b=zwf1h4DIaTynxKX9NFdIlDEWuz
	oumHsnKi8PcoO5UvElS5/HJgR0otjHjtHXiylUi15QMEvuHcJQWNIqmEiFFZgMUjH0Xhs5+sP5kYz
	HCIbqmvQZZe9wlQXmCvkJWsgy0BnixnCPayU0BWIdzQyT2DigD5P/4Mf6M2CJlHAwYms=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
Message-Id: <E1lC1ap-000539-9h@xenbits.xenproject.org>
Date: Tue, 16 Feb 2021 14:44:47 +0000

commit 4cf5929606adc2fb1ab4e2921c14ba4b8046ecd1
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Feb 16 15:39:05 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 16 15:39:05 2021 +0100

    xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
    
    At the moment, each page are flushed to RAM just after the allocator
    found some free pages. However, this is happening before check if the
    page was scrubbed.
    
    As a consequence, on Arm, a guest may be able to access the old content
    of the scrubbed pages if it has cache disabled (default at boot) and
    the content didn't reach the Point of Coherency.
    
    The flush is now moved after we know the content of the page will not
    change. This also has the benefit to reduce the amount of work happening
    with the heap_lock held.
    
    This is XSA-364.
    
    Fixes: 307c3be3ccb2 ("mm: Don't scrub pages while holding heap lock in alloc_heap_pages()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3b1cc15f1931ba56d0ee256fe9bfe65509733b27
    master date: 2021-02-16 15:32:08 +0100
---
 xen/common/page_alloc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 38a0459403..1dee9a05d4 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -923,6 +923,7 @@ static struct page_info *alloc_heap_pages(
     bool need_tlbflush = false;
     uint32_t tlbflush_timestamp = 0;
     unsigned int dirty_cnt = 0;
+    mfn_t mfn;
 
     /* Make sure there are enough bits in memflags for nodeID. */
     BUILD_BUG_ON((_MEMF_bits - _MEMF_node) < (8 * sizeof(nodeid_t)));
@@ -1030,11 +1031,6 @@ static struct page_info *alloc_heap_pages(
         pg[i].u.inuse.type_info = 0;
         page_set_owner(&pg[i], NULL);
 
-        /* Ensure cache and RAM are consistent for platforms where the
-         * guest can control its own visibility of/through the cache.
-         */
-        flush_page_to_ram(mfn_x(page_to_mfn(&pg[i])),
-                          !(memflags & MEMF_no_icache_flush));
     }
 
     spin_unlock(&heap_lock);
@@ -1070,6 +1066,14 @@ static struct page_info *alloc_heap_pages(
     if ( need_tlbflush )
         filtered_flush_tlb_mask(tlbflush_timestamp);
 
+    /*
+     * Ensure cache and RAM are consistent for platforms where the guest
+     * can control its own visibility of/through the cache.
+     */
+    mfn = page_to_mfn(pg);
+    for ( i = 0; i < (1U << order); i++ )
+        flush_page_to_ram(mfn_x(mfn) + i, !(memflags & MEMF_no_icache_flush));
+
     return pg;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Feb 16 14:44:59 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Feb 2021 14:44:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.85869.160693 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lC1b1-0000du-CH; Tue, 16 Feb 2021 14:44:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 85869.160693; Tue, 16 Feb 2021 14:44:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lC1b1-0000dm-9N; Tue, 16 Feb 2021 14:44:59 +0000
Received: by outflank-mailman (input) for mailman id 85869;
 Tue, 16 Feb 2021 14:44:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lC1az-0000dd-US
 for xen-changelog@lists.xenproject.org; Tue, 16 Feb 2021 14:44:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lC1az-0002Cr-TP
 for xen-changelog@lists.xenproject.org; Tue, 16 Feb 2021 14:44:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lC1az-00054G-Rv
 for xen-changelog@lists.xenproject.org; Tue, 16 Feb 2021 14:44:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ghQDQiqHN1lNQuW882dDtPOZYpQUWUQkI4hXDCr5piQ=; b=h8jDRCGQkh9zo55Flo253unIHS
	Z6gfR8I3lYy9n99zh+PDJpd93+vAsVscL4ghOgpznTIQ54tXVxpSdDItC1PbxNz3HO6ulxSiI4eF/
	YRiccQLK4RExQoff0N1c5EnxOcdGAt/oSMT0EWw2F4ua2sgq23tloi+7M3xyQqtowFuo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.11] xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
Message-Id: <E1lC1az-00054G-Rv@xenbits.xenproject.org>
Date: Tue, 16 Feb 2021 14:44:57 +0000

commit 80cad584fb4c2599ae174226e2c913bb23df3bfa
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Feb 16 15:39:56 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 16 15:39:56 2021 +0100

    xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
    
    At the moment, each page are flushed to RAM just after the allocator
    found some free pages. However, this is happening before check if the
    page was scrubbed.
    
    As a consequence, on Arm, a guest may be able to access the old content
    of the scrubbed pages if it has cache disabled (default at boot) and
    the content didn't reach the Point of Coherency.
    
    The flush is now moved after we know the content of the page will not
    change. This also has the benefit to reduce the amount of work happening
    with the heap_lock held.
    
    This is XSA-364.
    
    Fixes: 307c3be3ccb2 ("mm: Don't scrub pages while holding heap lock in alloc_heap_pages()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3b1cc15f1931ba56d0ee256fe9bfe65509733b27
    master date: 2021-02-16 15:32:08 +0100
---
 xen/common/page_alloc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 57f65460e3..6c3d59c6d8 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -882,6 +882,7 @@ static struct page_info *alloc_heap_pages(
     bool need_tlbflush = false;
     uint32_t tlbflush_timestamp = 0;
     unsigned int dirty_cnt = 0;
+    mfn_t mfn;
 
     /* Make sure there are enough bits in memflags for nodeID. */
     BUILD_BUG_ON((_MEMF_bits - _MEMF_node) < (8 * sizeof(nodeid_t)));
@@ -989,11 +990,6 @@ static struct page_info *alloc_heap_pages(
         pg[i].u.inuse.type_info = 0;
         page_set_owner(&pg[i], NULL);
 
-        /* Ensure cache and RAM are consistent for platforms where the
-         * guest can control its own visibility of/through the cache.
-         */
-        flush_page_to_ram(mfn_x(page_to_mfn(&pg[i])),
-                          !(memflags & MEMF_no_icache_flush));
     }
 
     spin_unlock(&heap_lock);
@@ -1029,6 +1025,14 @@ static struct page_info *alloc_heap_pages(
     if ( need_tlbflush )
         filtered_flush_tlb_mask(tlbflush_timestamp);
 
+    /*
+     * Ensure cache and RAM are consistent for platforms where the guest
+     * can control its own visibility of/through the cache.
+     */
+    mfn = page_to_mfn(pg);
+    for ( i = 0; i < (1U << order); i++ )
+        flush_page_to_ram(mfn_x(mfn) + i, !(memflags & MEMF_no_icache_flush));
+
     return pg;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Feb 17 00:22:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Feb 2021 00:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86075.161174 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCAbW-00066i-Sm; Wed, 17 Feb 2021 00:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86075.161174; Wed, 17 Feb 2021 00:22:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCAbW-00066a-P1; Wed, 17 Feb 2021 00:22:06 +0000
Received: by outflank-mailman (input) for mailman id 86075;
 Wed, 17 Feb 2021 00: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 1lCAbV-00066V-DR
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 00: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 1lCAbV-0004XQ-9V
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 00:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCAbV-000138-6h
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 00:22:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=V4RVBDVckUnBwFaWxGjzh3ncqJylhI0ZP9W8EWwq0w4=; b=AZ1sqkViFxMw5hMCtPE5f41ZmV
	Q9SJBC1lyz8bqycZGt7hvEX9FQaDOElA+Bd3AenkRS5GYMBgNVKGmga2rAK8FY8fWq3mLqcwyrbFz
	71XGHcB+z60PWIUsIlmLne0TWd1XMoLxCRVpFwezNhMEOkLvX9m+ImD/stnP19hYtFmc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] xen/arm: fix gnttab_need_iommu_mapping
Message-Id: <E1lCAbV-000138-6h@xenbits.xenproject.org>
Date: Wed, 17 Feb 2021 00:22:05 +0000

commit b0b734a8b3e516ff1040884b755a8d47afed31ea
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Mon Feb 8 10:49:32 2021 -0800
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Tue Feb 16 16:13:16 2021 -0800

    xen/arm: fix gnttab_need_iommu_mapping
    
    Commit 91d4eca7add broke gnttab_need_iommu_mapping on ARM.
    The offending chunk is:
    
     #define gnttab_need_iommu_mapping(d)                    \
    -    (is_domain_direct_mapped(d) && need_iommu(d))
    +    (is_domain_direct_mapped(d) && need_iommu_pt_sync(d))
    
    On ARM we need gnttab_need_iommu_mapping to be true for dom0 when it is
    directly mapped and IOMMU is enabled for the domain, like the old check
    did, but the new check is always false.
    
    In fact, need_iommu_pt_sync is defined as dom_iommu(d)->need_sync and
    need_sync is set as:
    
        if ( !is_hardware_domain(d) || iommu_hwdom_strict )
            hd->need_sync = !iommu_use_hap_pt(d);
    
    iommu_use_hap_pt(d) means that the page-table used by the IOMMU is the
    P2M. It is true on ARM. need_sync means that you have a separate IOMMU
    page-table and it needs to be updated for every change. need_sync is set
    to false on ARM. Hence, gnttab_need_iommu_mapping(d) is false too,
    which is wrong.
    
    As a consequence, when using PV network from a domU on a system where
    IOMMU is on from Dom0, I get:
    
    (XEN) smmu: /smmu@fd800000: Unhandled context fault: fsr=0x402, iova=0x8424cb148, fsynr=0xb0001, cb=0
    [   68.290307] macb ff0e0000.ethernet eth0: DMA bus error: HRESP not OK
    
    The fix is to go back to something along the lines of the old
    implementation of gnttab_need_iommu_mapping.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Fixes: 91d4eca7add ("mm / iommu: split need_iommu() into has_iommu_pt() and need_iommu_pt_sync()")
    Backport: 4.13+
    (cherry picked from commit 04085ec1ac05a362812e9b0c6b5a8713d7dc88ad)
---
 xen/include/asm-arm/grant_table.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/asm-arm/grant_table.h b/xen/include/asm-arm/grant_table.h
index 6f585b1538..0ce77f9a1c 100644
--- a/xen/include/asm-arm/grant_table.h
+++ b/xen/include/asm-arm/grant_table.h
@@ -89,7 +89,7 @@ int replace_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
     (((i) >= nr_status_frames(t)) ? INVALID_GFN : (t)->arch.status_gfn[i])
 
 #define gnttab_need_iommu_mapping(d)                    \
-    (is_domain_direct_mapped(d) && need_iommu_pt_sync(d))
+    (is_domain_direct_mapped(d) && is_iommu_enabled(d))
 
 #endif /* __ASM_GRANT_TABLE_H__ */
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Feb 17 00:22:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Feb 2021 00:22:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86076.161178 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCAbg-00067p-Vi; Wed, 17 Feb 2021 00:22:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86076.161178; Wed, 17 Feb 2021 00:22:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCAbg-00067h-SH; Wed, 17 Feb 2021 00:22:16 +0000
Received: by outflank-mailman (input) for mailman id 86076;
 Wed, 17 Feb 2021 00: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 1lCAbf-00067b-TA
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 00:22:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCAbf-0004XZ-Rz
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 00:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCAbf-000142-Q1
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 00:22:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Mo1fjVTuFpAAR3Zgqe2nv6vz4TxHb2cJSxm93aYNdsw=; b=SkQlmaDPClogfq/dujuNg67uMb
	zrwqieicLfHlLK2d/aFSs9QPftcbFq1Ivp11D6jt4eOllNaCrBC2ZsTX57kKDKRKGOLxb0UZlAyxA
	o1W8QoO7SyQJ8XZ0oZ2GpDT6I6STmlETz7gcvYI6o1uCVEpm24Qs2EPhO+oGYwfnwoLQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] xen/arm: fix gnttab_need_iommu_mapping
Message-Id: <E1lCAbf-000142-Q1@xenbits.xenproject.org>
Date: Wed, 17 Feb 2021 00:22:15 +0000

commit d7a1e06efd3ae2b16d5bb335932376b7d7eaf633
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Mon Feb 8 10:49:32 2021 -0800
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Tue Feb 16 16:16:09 2021 -0800

    xen/arm: fix gnttab_need_iommu_mapping
    
    Commit 91d4eca7add broke gnttab_need_iommu_mapping on ARM.
    The offending chunk is:
    
     #define gnttab_need_iommu_mapping(d)                    \
    -    (is_domain_direct_mapped(d) && need_iommu(d))
    +    (is_domain_direct_mapped(d) && need_iommu_pt_sync(d))
    
    On ARM we need gnttab_need_iommu_mapping to be true for dom0 when it is
    directly mapped and IOMMU is enabled for the domain, like the old check
    did, but the new check is always false.
    
    In fact, need_iommu_pt_sync is defined as dom_iommu(d)->need_sync and
    need_sync is set as:
    
        if ( !is_hardware_domain(d) || iommu_hwdom_strict )
            hd->need_sync = !iommu_use_hap_pt(d);
    
    iommu_use_hap_pt(d) means that the page-table used by the IOMMU is the
    P2M. It is true on ARM. need_sync means that you have a separate IOMMU
    page-table and it needs to be updated for every change. need_sync is set
    to false on ARM. Hence, gnttab_need_iommu_mapping(d) is false too,
    which is wrong.
    
    As a consequence, when using PV network from a domU on a system where
    IOMMU is on from Dom0, I get:
    
    (XEN) smmu: /smmu@fd800000: Unhandled context fault: fsr=0x402, iova=0x8424cb148, fsynr=0xb0001, cb=0
    [   68.290307] macb ff0e0000.ethernet eth0: DMA bus error: HRESP not OK
    
    The fix is to go back to something along the lines of the old
    implementation of gnttab_need_iommu_mapping.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Fixes: 91d4eca7add ("mm / iommu: split need_iommu() into has_iommu_pt() and need_iommu_pt_sync()")
    Backport: 4.13+
    (cherry picked from commit 04085ec1ac05a362812e9b0c6b5a8713d7dc88ad)
---
 xen/include/asm-arm/grant_table.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/asm-arm/grant_table.h b/xen/include/asm-arm/grant_table.h
index 6f585b1538..0ce77f9a1c 100644
--- a/xen/include/asm-arm/grant_table.h
+++ b/xen/include/asm-arm/grant_table.h
@@ -89,7 +89,7 @@ int replace_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
     (((i) >= nr_status_frames(t)) ? INVALID_GFN : (t)->arch.status_gfn[i])
 
 #define gnttab_need_iommu_mapping(d)                    \
-    (is_domain_direct_mapped(d) && need_iommu_pt_sync(d))
+    (is_domain_direct_mapped(d) && is_iommu_enabled(d))
 
 #endif /* __ASM_GRANT_TABLE_H__ */
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Feb 17 07:55:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Feb 2021 07:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86131.161341 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCHfs-0007PE-2z; Wed, 17 Feb 2021 07:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86131.161341; Wed, 17 Feb 2021 07:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCHfs-0007P7-08; Wed, 17 Feb 2021 07:55:04 +0000
Received: by outflank-mailman (input) for mailman id 86131;
 Wed, 17 Feb 2021 07:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCHfp-0007P2-Tv
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 07:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCHfp-0005wc-T4
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 07:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCHfp-0000ns-Rb
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 07:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OXaNALv9d226wC434/o5Hph8f+5fUfCY3OVxKxKHJGM=; b=lC3ILURk/PHcuYM2YDQz9xH2U6
	PtUQrKGNjbYFG52SpKapZLrF7NEjappKFZOPRwsRJV36zu+1gCQAw+WX6OIyU5DK+rtio/0G+uzq9
	x7kbGGCsbnWAcVILgUHVzqwcRLQvADXv8KgKlEYGF3fINGoLT61S972grWXgUANKjGAc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.11] xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
Message-Id: <E1lCHfp-0000ns-Rb@xenbits.xenproject.org>
Date: Wed, 17 Feb 2021 07:55:01 +0000

commit 80cad584fb4c2599ae174226e2c913bb23df3bfa
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Feb 16 15:39:56 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 16 15:39:56 2021 +0100

    xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
    
    At the moment, each page are flushed to RAM just after the allocator
    found some free pages. However, this is happening before check if the
    page was scrubbed.
    
    As a consequence, on Arm, a guest may be able to access the old content
    of the scrubbed pages if it has cache disabled (default at boot) and
    the content didn't reach the Point of Coherency.
    
    The flush is now moved after we know the content of the page will not
    change. This also has the benefit to reduce the amount of work happening
    with the heap_lock held.
    
    This is XSA-364.
    
    Fixes: 307c3be3ccb2 ("mm: Don't scrub pages while holding heap lock in alloc_heap_pages()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3b1cc15f1931ba56d0ee256fe9bfe65509733b27
    master date: 2021-02-16 15:32:08 +0100
---
 xen/common/page_alloc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 57f65460e3..6c3d59c6d8 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -882,6 +882,7 @@ static struct page_info *alloc_heap_pages(
     bool need_tlbflush = false;
     uint32_t tlbflush_timestamp = 0;
     unsigned int dirty_cnt = 0;
+    mfn_t mfn;
 
     /* Make sure there are enough bits in memflags for nodeID. */
     BUILD_BUG_ON((_MEMF_bits - _MEMF_node) < (8 * sizeof(nodeid_t)));
@@ -989,11 +990,6 @@ static struct page_info *alloc_heap_pages(
         pg[i].u.inuse.type_info = 0;
         page_set_owner(&pg[i], NULL);
 
-        /* Ensure cache and RAM are consistent for platforms where the
-         * guest can control its own visibility of/through the cache.
-         */
-        flush_page_to_ram(mfn_x(page_to_mfn(&pg[i])),
-                          !(memflags & MEMF_no_icache_flush));
     }
 
     spin_unlock(&heap_lock);
@@ -1029,6 +1025,14 @@ static struct page_info *alloc_heap_pages(
     if ( need_tlbflush )
         filtered_flush_tlb_mask(tlbflush_timestamp);
 
+    /*
+     * Ensure cache and RAM are consistent for platforms where the guest
+     * can control its own visibility of/through the cache.
+     */
+    mfn = page_to_mfn(pg);
+    for ( i = 0; i < (1U << order); i++ )
+        flush_page_to_ram(mfn_x(mfn) + i, !(memflags & MEMF_no_icache_flush));
+
     return pg;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Feb 17 11:33:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Feb 2021 11:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86220.161689 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCL4r-0005PK-CR; Wed, 17 Feb 2021 11:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86220.161689; Wed, 17 Feb 2021 11:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCL4r-0005PC-9d; Wed, 17 Feb 2021 11:33:05 +0000
Received: by outflank-mailman (input) for mailman id 86220;
 Wed, 17 Feb 2021 11:33:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCL4q-0005P7-Ly
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 11:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCL4q-0001lv-Ie
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 11:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCL4q-0000HP-FT
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 11:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cavKb89QVvG4EipAhhrHT5Co2AHpFz2YjYLD+1AAhvE=; b=DfORC8To5CA/Yj/LlDFr3GM89g
	qDWJF9k8iwwESr0uT5RQKSlcGL5kXrQbfbg58FiOdvzQf5IdA7Pxsq9msXSBkTEc6/RV9a3PU3yED
	fHumHyTOjPsGT3Oi1gU3biMRgf3mdQH6rBAHTj7Hoazeq/MUTUpTg1urkvAY7XZICFVE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/iommu: Check if the IOMMU was initialized before tearing down
Message-Id: <E1lCL4q-0000HP-FT@xenbits.xenproject.org>
Date: Wed, 17 Feb 2021 11:33:04 +0000

commit d670ef3401b91d04c58d72cd8ce5579b4fa900d8
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Dec 17 12:27:21 2020 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Feb 17 11:30:05 2021 +0000

    xen/iommu: Check if the IOMMU was initialized before tearing down
    
    is_iommu_enabled() will return true even if the IOMMU has not been
    initialized (e.g. the ops are not set).
    
    In the case of an early failure in arch_domain_init(), the function
    iommu_destroy_domain() will be called even if the IOMMU is not
    initialized.
    
    This will result to dereference the ops which will be NULL and an host
    crash.
    
    Fix the issue by checking that ops has been set before accessing it.
    
    Fixes: 71e617a6b8f6 ("use is_iommu_enabled() where appropriate...")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 xen/drivers/passthrough/iommu.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 2358b6eb09..879d238bcd 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -221,6 +221,13 @@ static void iommu_teardown(struct domain *d)
 {
     struct domain_iommu *hd = dom_iommu(d);
 
+    /*
+     * During early domain creation failure, we may reach here with the
+     * ops not yet initialized.
+     */
+    if ( !hd->platform_ops )
+        return;
+
     iommu_vcall(hd->platform_ops, teardown, d);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 17 12:33:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Feb 2021 12:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86253.161770 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCM0t-00039f-Rf; Wed, 17 Feb 2021 12:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86253.161770; Wed, 17 Feb 2021 12:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCM0t-00039W-OU; Wed, 17 Feb 2021 12:33:03 +0000
Received: by outflank-mailman (input) for mailman id 86253;
 Wed, 17 Feb 2021 12:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCM0s-00039R-K4
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 12:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCM0s-0002lv-If
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 12:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCM0s-0004nd-Gr
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 12:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xqCUDE3cfXSBGXtylaP8lsWcGDEB2EdUVhLd8w2pJXI=; b=ryy8CIFru7G8wUSJJDb8G5NGHL
	irCXBr+v+E8DpeYSAhfMJG8MeKx+qE5JHq6yTxqZ7nz9oZEywF6WRbEFlN9kvEh0DKP8TA70SWZKs
	p5kZ9nPokU2a68UxL+TgkdTDnSJngaWZrK8OGPgJNo+Cy0EQdYWWaIXZ+Ljm/uTRbuIU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
Message-Id: <E1lCM0s-0004nd-Gr@xenbits.xenproject.org>
Date: Wed, 17 Feb 2021 12:33:02 +0000

commit 4cf5929606adc2fb1ab4e2921c14ba4b8046ecd1
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Feb 16 15:39:05 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 16 15:39:05 2021 +0100

    xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
    
    At the moment, each page are flushed to RAM just after the allocator
    found some free pages. However, this is happening before check if the
    page was scrubbed.
    
    As a consequence, on Arm, a guest may be able to access the old content
    of the scrubbed pages if it has cache disabled (default at boot) and
    the content didn't reach the Point of Coherency.
    
    The flush is now moved after we know the content of the page will not
    change. This also has the benefit to reduce the amount of work happening
    with the heap_lock held.
    
    This is XSA-364.
    
    Fixes: 307c3be3ccb2 ("mm: Don't scrub pages while holding heap lock in alloc_heap_pages()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3b1cc15f1931ba56d0ee256fe9bfe65509733b27
    master date: 2021-02-16 15:32:08 +0100
---
 xen/common/page_alloc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 38a0459403..1dee9a05d4 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -923,6 +923,7 @@ static struct page_info *alloc_heap_pages(
     bool need_tlbflush = false;
     uint32_t tlbflush_timestamp = 0;
     unsigned int dirty_cnt = 0;
+    mfn_t mfn;
 
     /* Make sure there are enough bits in memflags for nodeID. */
     BUILD_BUG_ON((_MEMF_bits - _MEMF_node) < (8 * sizeof(nodeid_t)));
@@ -1030,11 +1031,6 @@ static struct page_info *alloc_heap_pages(
         pg[i].u.inuse.type_info = 0;
         page_set_owner(&pg[i], NULL);
 
-        /* Ensure cache and RAM are consistent for platforms where the
-         * guest can control its own visibility of/through the cache.
-         */
-        flush_page_to_ram(mfn_x(page_to_mfn(&pg[i])),
-                          !(memflags & MEMF_no_icache_flush));
     }
 
     spin_unlock(&heap_lock);
@@ -1070,6 +1066,14 @@ static struct page_info *alloc_heap_pages(
     if ( need_tlbflush )
         filtered_flush_tlb_mask(tlbflush_timestamp);
 
+    /*
+     * Ensure cache and RAM are consistent for platforms where the guest
+     * can control its own visibility of/through the cache.
+     */
+    mfn = page_to_mfn(pg);
+    for ( i = 0; i < (1U << order); i++ )
+        flush_page_to_ram(mfn_x(mfn) + i, !(memflags & MEMF_no_icache_flush));
+
     return pg;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Feb 17 12:44:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Feb 2021 12:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86255.161773 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCMBa-00045R-Lh; Wed, 17 Feb 2021 12:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86255.161773; Wed, 17 Feb 2021 12:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCMBa-00045I-It; Wed, 17 Feb 2021 12:44:06 +0000
Received: by outflank-mailman (input) for mailman id 86255;
 Wed, 17 Feb 2021 12:44:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCMBZ-00045D-EJ
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 12:44:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCMBZ-0002vv-1b
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 12:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCMBZ-0005o3-08
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 12:44:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7oRd619yDNDjfk+SRo3/FXUbzaL+tAx7DyVza+crlbQ=; b=hMddM8i9xYDrKAP2b2IE+9V1Gy
	ZeQWAnAScu+Dg2QmuZDkC3mUTi8+d3B14xy5ldyOMiR0Vs3do0c/kX7ppnj2NmoAocTxtvjAWiZXn
	K1SX26A0ZB+0L++Md+gjlpLo4SGuE7IaQfC1WHOPH2+dxB04FHjM7wV81YHcEI6Yz0/E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xl: Fix exit code for `xl vkbattach`
Message-Id: <E1lCMBZ-0005o3-08@xenbits.xenproject.org>
Date: Wed, 17 Feb 2021 12:44:05 +0000

commit 8e5b2029feee1961d6753127bf249c7a8c8f89a5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 18:49:23 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 17 12:37:08 2021 +0000

    tools/xl: Fix exit code for `xl vkbattach`
    
    Various version of gcc, when compiling with -Og, complain:
    
      xl_vkb.c: In function 'main_vkbattach':
      xl_vkb.c:79:12: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized]
         79 |     return rc;
            |            ^~
    
    The dryrun_only path really does leave rc uninitalised.  Introduce a done
    label for success paths to use.
    
    Fixes: a15166af7c3 ("xl: add vkb config parser and CLI")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xl/xl_vkb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/xl/xl_vkb.c b/tools/xl/xl_vkb.c
index f6ed9e05ee..728ac9470b 100644
--- a/tools/xl/xl_vkb.c
+++ b/tools/xl/xl_vkb.c
@@ -64,7 +64,7 @@ int main_vkbattach(int argc, char **argv)
         char *json = libxl_device_vkb_to_json(ctx, &vkb);
         printf("vkb: %s\n", json);
         free(json);
-        goto out;
+        goto done;
     }
 
     if (libxl_device_vkb_add(ctx, domid, &vkb, 0)) {
@@ -72,6 +72,7 @@ int main_vkbattach(int argc, char **argv)
         rc = ERROR_FAIL; goto out;
     }
 
+done:
     rc = 0;
 
 out:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 17 12:44:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Feb 2021 12:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86256.161777 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCMBk-000467-NB; Wed, 17 Feb 2021 12:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86256.161777; Wed, 17 Feb 2021 12:44:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCMBk-00045z-KJ; Wed, 17 Feb 2021 12:44:16 +0000
Received: by outflank-mailman (input) for mailman id 86256;
 Wed, 17 Feb 2021 12:44:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCMBj-00045i-6u
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 12:44:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCMBj-0002wH-5g
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 12:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCMBj-0005pD-3t
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 12:44:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cn5hNAN+D7QPwSgq2UGtde+01uze4q8dXacCTVd20mg=; b=sAC1ue38Vmsj8qM5DoJQrPd4Ea
	uqOFWV9DMKSN9tBjQ162pd+8CtZIGqtI4JIfotB+p2A2wIQMwG+cCSTJqZF2+GTm+tH8tM9e98xoy
	CBC4R0baimypE4RUHyuwHCbfTmaWNC9diwUnVEOmMGQb35FDkfcX5OdoYOte5KV1ICCE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libxg: Fix uninitialised variable in write_x86_cpu_policy_records()
Message-Id: <E1lCMBj-0005pD-3t@xenbits.xenproject.org>
Date: Wed, 17 Feb 2021 12:44:15 +0000

commit 60773532231d3b6ecdc98913832ca78c3d9a4371
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 14:25:57 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 17 12:37:08 2021 +0000

    tools/libxg: Fix uninitialised variable in write_x86_cpu_policy_records()
    
    Various version of gcc, when compiling with -Og, complain:
    
      xg_sr_common_x86.c: In function 'write_x86_cpu_policy_records':
      xg_sr_common_x86.c:92:12: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized]
         92 |     return rc;
            |            ^~
    
    The complaint is legitimate, and can occur with unexpected behaviour of two
    related hypercalls in combination with a libc which permits zero-length
    malloc()s.
    
    Have an explicit rc = 0 on the success path, and make the MSRs record error
    handling consistent with the CPUID record before it.
    
    Fixes: f6b2b8ec53d ("libxc/save: Write X86_{CPUID,MSR}_DATA records")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/guest/xg_sr_common_x86.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/libs/guest/xg_sr_common_x86.c b/tools/libs/guest/xg_sr_common_x86.c
index 6f12483907..3168c5485f 100644
--- a/tools/libs/guest/xg_sr_common_x86.c
+++ b/tools/libs/guest/xg_sr_common_x86.c
@@ -83,7 +83,13 @@ int write_x86_cpu_policy_records(struct xc_sr_context *ctx)
 
     msrs.length = nr_msrs * sizeof(xen_msr_entry_t);
     if ( msrs.length )
+    {
         rc = write_record(ctx, &msrs);
+        if ( rc )
+            goto out;
+    }
+
+    rc = 0;
 
  out:
     free(cpuid.data);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 17 12:44:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Feb 2021 12:44:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86257.161781 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCMBu-00047r-Of; Wed, 17 Feb 2021 12:44:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86257.161781; Wed, 17 Feb 2021 12:44:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCMBu-00047j-Lm; Wed, 17 Feb 2021 12:44:26 +0000
Received: by outflank-mailman (input) for mailman id 86257;
 Wed, 17 Feb 2021 12:44:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCMBt-00047U-BT
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 12:44:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCMBt-0002wT-Ac
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 12:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCMBt-0005pr-80
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 12:44:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sr7TCqetmN3dmGCXzqyO1yxy6Kq8KI59N09+rJfu/OU=; b=iascLJVLKFekQYQcGulNVnzoYf
	Z18iNmZsR3yiCSn2bj68QoaKWfJzjGnSGtXi9IRw4K58iOXQQtlMFrP4IWWYlTfEmNGANIXkqAlWm
	t4IvSjpTlvhMrip7Y2JVQQPDJAnEFrCmHmaw5wmIH7xsUgbL9Y4DsoJgMYcrbxkOhPHU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libxg: Drop stale p2m logic from ARM's meminit()
Message-Id: <E1lCMBt-0005pr-80@xenbits.xenproject.org>
Date: Wed, 17 Feb 2021 12:44:25 +0000

commit 928bffb6dd3f1b8a2355418f4c763a6fff714aa7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 17:45:21 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 17 12:37:08 2021 +0000

    tools/libxg: Drop stale p2m logic from ARM's meminit()
    
    Various version of gcc, when compiling with -Og, complain:
    
      xg_dom_arm.c: In function 'meminit':
      xg_dom_arm.c:420:19: error: 'p2m_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]
        420 |     dom->p2m_size = p2m_size;
            |     ~~~~~~~~~~~~~~^~~~~~~~~~
    
    This is actually entirely stale code since ee21f10d70^..97e34ad22d which
    removed the 1:1 identity p2m for translated domains.
    
    Drop the write of d->p2m_size, and the p2m_size local variable.  Reposition
    the p2m_size field in struct xc_dom_image and correct some stale
    documentation.
    
    This change really ought to have been part of the original cleanup series.
    
    No actual change to how ARM domains are constructed.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/include/xenguest.h      | 5 ++---
 tools/libs/guest/xg_dom_arm.c | 5 -----
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/tools/include/xenguest.h b/tools/include/xenguest.h
index 775cf34c04..217022b6e7 100644
--- a/tools/include/xenguest.h
+++ b/tools/include/xenguest.h
@@ -145,6 +145,7 @@ struct xc_dom_image {
      * eventually copied into guest context.
      */
     xen_pfn_t *pv_p2m;
+    xen_pfn_t p2m_size;         /* number of pfns covered by pv_p2m */
 
     /* physical memory
      *
@@ -154,12 +155,10 @@ struct xc_dom_image {
      *
      * An ARM guest has GUEST_RAM_BANKS regions of RAM, with
      * rambank_size[i] pages in each. The lowest RAM address
-     * (corresponding to the base of the p2m arrays above) is stored
-     * in rambase_pfn.
+     * is stored in rambase_pfn.
      */
     xen_pfn_t rambase_pfn;
     xen_pfn_t total_pages;
-    xen_pfn_t p2m_size;         /* number of pfns covered by p2m */
     struct xc_dom_phys *phys_pages;
 #if defined (__arm__) || defined(__aarch64__)
     xen_pfn_t rambank_size[GUEST_RAM_BANKS];
diff --git a/tools/libs/guest/xg_dom_arm.c b/tools/libs/guest/xg_dom_arm.c
index 94948d2b20..b4c24f15fb 100644
--- a/tools/libs/guest/xg_dom_arm.c
+++ b/tools/libs/guest/xg_dom_arm.c
@@ -373,7 +373,6 @@ static int meminit(struct xc_dom_image *dom)
     const uint64_t modsize = dtb_size + ramdisk_size;
     const uint64_t ram128mb = bankbase[0] + (128<<20);
 
-    xen_pfn_t p2m_size;
     uint64_t bank0end;
 
     assert(dom->rambase_pfn << XC_PAGE_SHIFT == bankbase[0]);
@@ -409,16 +408,12 @@ static int meminit(struct xc_dom_image *dom)
 
         ramsize -= banksize;
 
-        p2m_size = ( bankbase[i] + banksize - bankbase[0] ) >> XC_PAGE_SHIFT;
-
         dom->rambank_size[i] = banksize >> XC_PAGE_SHIFT;
     }
 
     assert(dom->rambank_size[0] != 0);
     assert(ramsize == 0); /* Too much RAM is rejected above */
 
-    dom->p2m_size = p2m_size;
-
     /* setup initial p2m and allocate guest memory */
     for ( i = 0; i < GUEST_RAM_BANKS && dom->rambank_size[i]; i++ )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 17 12:44:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Feb 2021 12:44:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86258.161786 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCMC4-00049R-Rl; Wed, 17 Feb 2021 12:44:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86258.161786; Wed, 17 Feb 2021 12:44:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCMC4-00049J-NG; Wed, 17 Feb 2021 12:44:36 +0000
Received: by outflank-mailman (input) for mailman id 86258;
 Wed, 17 Feb 2021 12:44:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCMC3-000494-FX
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 12:44:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCMC3-0002wf-Dv
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 12:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCMC3-0005qz-Cu
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 12:44:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dZOsJBRqqR5fXAOpXpQLJZcha1uJBbSVQpyMSgREPyw=; b=r5Vr7nzoMib6lJFPOF9mHOf+xt
	Q0zF2ncTmAn0VUCgryoFmIxNh//yVVRrOFy88i0G0rOxHP52Nb0fmq9vX9Z7rrVZ7esh2cleqIkvV
	9BxkEHIyeOafp7UnDfJKtGmA+9egTswK2bM5Mht+MTTutGJ16Vdo6LLVB4EdVIumL/AY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libxl: Fix uninitialised variable in libxl__write_stub_dmargs()
Message-Id: <E1lCMC3-0005qz-Cu@xenbits.xenproject.org>
Date: Wed, 17 Feb 2021 12:44:35 +0000

commit b4159d2de0153eb8ce6aced1978e1917c07cf39d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 17:44:36 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 17 12:37:08 2021 +0000

    tools/libxl: Fix uninitialised variable in libxl__write_stub_dmargs()
    
    Various version of gcc, when compiling with -Og, complain:
    
      libxl_dm.c: In function ‘libxl__write_stub_dmargs’:
      libxl_dm.c:2166:16: error: ‘dmargs’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
                   rc = libxl__xs_write_checked(gc, t, path, dmargs);
                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    It isn't actually used while uninitialised, but only because of how the
    is_linux_stubdom checks line up.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/light/libxl_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 291dee9b3f..db4cec6a76 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -2101,7 +2101,7 @@ static int libxl__write_stub_dmargs(libxl__gc *gc,
 {
     struct xs_permissions roperm[2];
     xs_transaction_t t = XBT_NULL;
-    char *dmargs;
+    char *dmargs = NULL;
     int rc;
 
     roperm[0].id = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 17 12:44:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Feb 2021 12:44:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86259.161789 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCMCE-0004Al-Rq; Wed, 17 Feb 2021 12:44:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86259.161789; Wed, 17 Feb 2021 12:44:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCMCE-0004Ac-Ol; Wed, 17 Feb 2021 12:44:46 +0000
Received: by outflank-mailman (input) for mailman id 86259;
 Wed, 17 Feb 2021 12:44:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCMCD-0004AS-Hs
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 12:44:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCMCD-0002wr-H3
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 12:44:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCMCD-0005rg-G8
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 12:44:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1hXE7nynV0pm7WFSZz3nxTkqySU6GY3CxsEKEvaiyt4=; b=vwv+7s+vBh6QLSEPC5F/5+dBpG
	JUvC5SoVhAwbpwtBL9YN66TCGXK1NqK+zqTVLhf8PDU5PnitvNViOv9jdzggsK6YdPuawyh9hKUVk
	3NJheHjr7roP49ByGQONrUQNVrLu9+o4u4Mus7UO8ecG6zbVktMGKqG8ONI5Smmut8FA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] stubdom/xenstored: Fix uninitialised variables in lu_read_state()
Message-Id: <E1lCMCD-0005rg-G8@xenbits.xenproject.org>
Date: Wed, 17 Feb 2021 12:44:45 +0000

commit 7a4133feaf42000923eb9d84badb6b171625f137
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 21:10:51 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 17 12:37:08 2021 +0000

    stubdom/xenstored: Fix uninitialised variables in lu_read_state()
    
    Various version of gcc, when compiling with -Og, complain:
    
      xenstored_control.c: In function ‘lu_read_state’:
      xenstored_control.c:540:11: error: ‘state.size’ is used uninitialized in this
      function [-Werror=uninitialized]
        if (state.size == 0)
            ~~~~~^~~~~
      xenstored_control.c:543:6: error: ‘state.buf’ may be used uninitialized in
      this function [-Werror=maybe-uninitialized]
        pre = state.buf;
        ~~~~^~~~~~~~~~~
      xenstored_control.c:550:23: error: ‘state.buf’ may be used uninitialized in
      this function [-Werror=maybe-uninitialized]
         (void *)head - state.buf < state.size;
                        ~~~~~^~~~
      xenstored_control.c:550:35: error: ‘state.size’ may be used uninitialized in
      this function [-Werror=maybe-uninitialized]
         (void *)head - state.buf < state.size;
                                    ~~~~~^~~~~
    
    for the stubdom build.  This is because lu_get_dump_state() is a no-op stub in
    MiniOS, and state really is operated on uninitialised.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xenstore/xenstored_control.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index 1f733e0a04..f10beaf85e 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -530,7 +530,7 @@ static const char *lu_dump_state(const void *ctx, struct connection *conn)
 
 void lu_read_state(void)
 {
-	struct lu_dump_state state;
+	struct lu_dump_state state = {};
 	struct xs_state_record_header *head;
 	void *ctx = talloc_new(NULL); /* Work context for subfunctions. */
 	struct xs_state_preamble *pre;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 17 18:00:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Feb 2021 18:00:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86393.162196 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCR7L-00036q-S4; Wed, 17 Feb 2021 18:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86393.162196; Wed, 17 Feb 2021 18:00:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCR7L-00036U-Ox; Wed, 17 Feb 2021 18:00:03 +0000
Received: by outflank-mailman (input) for mailman id 86393;
 Wed, 17 Feb 2021 18: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 1lCR7K-00030r-Pm
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 18: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 1lCR7K-0000Nl-LF
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 18:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCR7K-0001Qk-JW
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 18:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4L0Jgig5rXsAGAnpVsKmtHm4/GHnkLDMTq4+7TEMK/c=; b=3KrWYqlDq20MCdTkpEBXJ+UjhT
	B2KL4vz29sPdtXP+f48KLinOYmZ6THJYv608fbWVttahI3rfv/adBFqCgZTsdOh52qwwlH4Uiz0sU
	pM0aIAttuT40sPU3O2rQGIOvlA7ZwbzaXMAMC47B3q7dG9y4N456t+eHdoErUuWu9FVI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
Message-Id: <E1lCR7K-0001Qk-JW@xenbits.xenproject.org>
Date: Wed, 17 Feb 2021 18:00:02 +0000

commit ab995b6af9ab723b0b52e5ea0e342b612f1a7b89
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Feb 16 15:38:11 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 16 15:38:11 2021 +0100

    xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
    
    At the moment, each page are flushed to RAM just after the allocator
    found some free pages. However, this is happening before check if the
    page was scrubbed.
    
    As a consequence, on Arm, a guest may be able to access the old content
    of the scrubbed pages if it has cache disabled (default at boot) and
    the content didn't reach the Point of Coherency.
    
    The flush is now moved after we know the content of the page will not
    change. This also has the benefit to reduce the amount of work happening
    with the heap_lock held.
    
    This is XSA-364.
    
    Fixes: 307c3be3ccb2 ("mm: Don't scrub pages while holding heap lock in alloc_heap_pages()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3b1cc15f1931ba56d0ee256fe9bfe65509733b27
    master date: 2021-02-16 15:32:08 +0100
---
 xen/common/page_alloc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 7cb1bd368b..ebc7f45c0f 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -923,6 +923,7 @@ static struct page_info *alloc_heap_pages(
     bool need_tlbflush = false;
     uint32_t tlbflush_timestamp = 0;
     unsigned int dirty_cnt = 0;
+    mfn_t mfn;
 
     /* Make sure there are enough bits in memflags for nodeID. */
     BUILD_BUG_ON((_MEMF_bits - _MEMF_node) < (8 * sizeof(nodeid_t)));
@@ -1021,11 +1022,6 @@ static struct page_info *alloc_heap_pages(
         pg[i].u.inuse.type_info = 0;
         page_set_owner(&pg[i], NULL);
 
-        /* Ensure cache and RAM are consistent for platforms where the
-         * guest can control its own visibility of/through the cache.
-         */
-        flush_page_to_ram(mfn_x(page_to_mfn(&pg[i])),
-                          !(memflags & MEMF_no_icache_flush));
     }
 
     spin_unlock(&heap_lock);
@@ -1061,6 +1057,14 @@ static struct page_info *alloc_heap_pages(
     if ( need_tlbflush )
         filtered_flush_tlb_mask(tlbflush_timestamp);
 
+    /*
+     * Ensure cache and RAM are consistent for platforms where the guest
+     * can control its own visibility of/through the cache.
+     */
+    mfn = page_to_mfn(pg);
+    for ( i = 0; i < (1U << order); i++ )
+        flush_page_to_ram(mfn_x(mfn) + i, !(memflags & MEMF_no_icache_flush));
+
     return pg;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Feb 17 21:33:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Feb 2021 21:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86439.162283 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCURT-0006g6-R7; Wed, 17 Feb 2021 21:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86439.162283; Wed, 17 Feb 2021 21:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCURT-0006fy-OD; Wed, 17 Feb 2021 21:33:03 +0000
Received: by outflank-mailman (input) for mailman id 86439;
 Wed, 17 Feb 2021 21: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 1lCURS-0006ft-D6
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 21: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 1lCURS-0003sl-CD
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 21:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCURS-0000AE-AT
 for xen-changelog@lists.xenproject.org; Wed, 17 Feb 2021 21:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HZ0t8uCgp1X2X/fsfy6Rwf7CNBUqPGnVT4Nb+tAcXo8=; b=JNwIJkYymbnSLiH2pZg+dSaGo0
	cUU//mLGXQkVfdR8MjH5w5RwbYjod19xyrL9hrKK4uR21u0HbIg4ejQe0PiGAq5kjttIPDWCZLY7I
	zTtJZTxA/elNJWnNpG1f47l/QU+HbXxY3EDqo6Ui91r/sabwabhYvJafpvMUhZDfIpUI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
Message-Id: <E1lCURS-0000AE-AT@xenbits.xenproject.org>
Date: Wed, 17 Feb 2021 21:33:02 +0000

commit 9f357fe3e4593fc1109962b76d4db73d589ebef5
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Feb 16 15:36:16 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 16 15:36:16 2021 +0100

    xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
    
    At the moment, each page are flushed to RAM just after the allocator
    found some free pages. However, this is happening before check if the
    page was scrubbed.
    
    As a consequence, on Arm, a guest may be able to access the old content
    of the scrubbed pages if it has cache disabled (default at boot) and
    the content didn't reach the Point of Coherency.
    
    The flush is now moved after we know the content of the page will not
    change. This also has the benefit to reduce the amount of work happening
    with the heap_lock held.
    
    This is XSA-364.
    
    Fixes: 307c3be3ccb2 ("mm: Don't scrub pages while holding heap lock in alloc_heap_pages()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 3b1cc15f1931ba56d0ee256fe9bfe65509733b27
    master date: 2021-02-16 15:32:08 +0100
---
 xen/common/page_alloc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 10b7aeca48..d9578abb7c 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -924,6 +924,7 @@ static struct page_info *alloc_heap_pages(
     bool need_tlbflush = false;
     uint32_t tlbflush_timestamp = 0;
     unsigned int dirty_cnt = 0;
+    mfn_t mfn;
 
     /* Make sure there are enough bits in memflags for nodeID. */
     BUILD_BUG_ON((_MEMF_bits - _MEMF_node) < (8 * sizeof(nodeid_t)));
@@ -1022,11 +1023,6 @@ static struct page_info *alloc_heap_pages(
         pg[i].u.inuse.type_info = 0;
         page_set_owner(&pg[i], NULL);
 
-        /* Ensure cache and RAM are consistent for platforms where the
-         * guest can control its own visibility of/through the cache.
-         */
-        flush_page_to_ram(mfn_x(page_to_mfn(&pg[i])),
-                          !(memflags & MEMF_no_icache_flush));
     }
 
     spin_unlock(&heap_lock);
@@ -1062,6 +1058,14 @@ static struct page_info *alloc_heap_pages(
     if ( need_tlbflush )
         filtered_flush_tlb_mask(tlbflush_timestamp);
 
+    /*
+     * Ensure cache and RAM are consistent for platforms where the guest
+     * can control its own visibility of/through the cache.
+     */
+    mfn = page_to_mfn(pg);
+    for ( i = 0; i < (1U << order); i++ )
+        flush_page_to_ram(mfn_x(mfn) + i, !(memflags & MEMF_no_icache_flush));
+
     return pg;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Feb 18 03:33:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Feb 2021 03:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86467.162371 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCa3r-0001St-G8; Thu, 18 Feb 2021 03:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86467.162371; Thu, 18 Feb 2021 03:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCa3r-0001Sk-CP; Thu, 18 Feb 2021 03:33:03 +0000
Received: by outflank-mailman (input) for mailman id 86467;
 Thu, 18 Feb 2021 03: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 1lCa3q-0001Sf-Og
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 03: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 1lCa3q-0003op-L1
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 03:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCa3q-0003Ak-Ij
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 03:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Klf2WABMkoCvOZ4hH6vrK8umgabx2O3lopP7DAa/ZzM=; b=HQIf4tFichqrqc6AyvnMox/hYR
	eBGwITjZp+Bw4um4rnAd/eyjGLytiRyPAoWxuQDF+lth4TelbHxFo+8XKXxjCcl3U+3FmYZB+jBOF
	LRXJ45+eO5uFrUiF1R0iQod3HP5pfEtkFWz1zEmbFhYpZI1114bpOp4Zc3/AqPfzx3hc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] SUPPORT.md: PV display frontend is unsupported in "backend allocation" mode
Message-Id: <E1lCa3q-0003Ak-Ij@xenbits.xenproject.org>
Date: Thu, 18 Feb 2021 03:33:02 +0000

commit 2dd2cd0f16aae2cad2227f9aae9469fd6cdd8cd3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 16 15:31:59 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 16 15:31:59 2021 +0100

    SUPPORT.md: PV display frontend is unsupported in "backend allocation" mode
    
    This wasn't meant to be supported, but wasn't stated this way.
    
    This is XSA-363.
    
    Reported-by: Jan Belich <jbeulich@suse.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index f69edc7ba4..4cb5ec9802 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -415,7 +415,8 @@ Guest-side driver capable of speaking the Xen PV Framebuffer protocol
 
 Guest-side driver capable of speaking the Xen PV display protocol
 
-    Status, Linux: Supported
+    Status, Linux: Supported (outside of "backend allocation" mode)
+    Status, Linux: Experimental (in "backend allocation" mode)
 
 ### PV Console (frontend)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 18 03:33:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Feb 2021 03:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86468.162375 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCa41-0001Tb-Hh; Thu, 18 Feb 2021 03:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86468.162375; Thu, 18 Feb 2021 03:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCa41-0001TU-Ee; Thu, 18 Feb 2021 03:33:13 +0000
Received: by outflank-mailman (input) for mailman id 86468;
 Thu, 18 Feb 2021 03:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCa40-0001TN-RO
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 03:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCa40-0003ox-PM
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 03:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCa40-0003BW-NX
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 03:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2ZY70MFnnDRllUSbB41hiiEDw2UlcOUTN94i3mqVEdg=; b=UZEuXb5/liEt/Fn8RKaoHuLhjT
	3joM62W2KPWVy1hx+TDa7ON67xTTbvklvMRlUwBr0nqIkWVHvT+/XES6rDF5x7uPfEYr989blp5jo
	apdAA50gEclgFBl2wvt4UpMRy+479XWOkXoEgsCIpXwRIvs7IMtnOLZaHW51Io84h8bQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
Message-Id: <E1lCa40-0003BW-NX@xenbits.xenproject.org>
Date: Thu, 18 Feb 2021 03:33:12 +0000

commit 3b1cc15f1931ba56d0ee256fe9bfe65509733b27
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Jan 21 10:16:08 2021 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 16 15:32:08 2021 +0100

    xen/page_alloc: Only flush the page to RAM once we know they are scrubbed
    
    At the moment, each page are flushed to RAM just after the allocator
    found some free pages. However, this is happening before check if the
    page was scrubbed.
    
    As a consequence, on Arm, a guest may be able to access the old content
    of the scrubbed pages if it has cache disabled (default at boot) and
    the content didn't reach the Point of Coherency.
    
    The flush is now moved after we know the content of the page will not
    change. This also has the benefit to reduce the amount of work happening
    with the heap_lock held.
    
    This is XSA-364.
    
    Fixes: 307c3be3ccb2 ("mm: Don't scrub pages while holding heap lock in alloc_heap_pages()")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/page_alloc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 02ac1fa613..1744e6faa5 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -924,6 +924,7 @@ static struct page_info *alloc_heap_pages(
     bool need_tlbflush = false;
     uint32_t tlbflush_timestamp = 0;
     unsigned int dirty_cnt = 0;
+    mfn_t mfn;
 
     /* Make sure there are enough bits in memflags for nodeID. */
     BUILD_BUG_ON((_MEMF_bits - _MEMF_node) < (8 * sizeof(nodeid_t)));
@@ -1022,11 +1023,6 @@ static struct page_info *alloc_heap_pages(
         pg[i].u.inuse.type_info = 0;
         page_set_owner(&pg[i], NULL);
 
-        /* Ensure cache and RAM are consistent for platforms where the
-         * guest can control its own visibility of/through the cache.
-         */
-        flush_page_to_ram(mfn_x(page_to_mfn(&pg[i])),
-                          !(memflags & MEMF_no_icache_flush));
     }
 
     spin_unlock(&heap_lock);
@@ -1062,6 +1058,14 @@ static struct page_info *alloc_heap_pages(
     if ( need_tlbflush )
         filtered_flush_tlb_mask(tlbflush_timestamp);
 
+    /*
+     * Ensure cache and RAM are consistent for platforms where the guest
+     * can control its own visibility of/through the cache.
+     */
+    mfn = page_to_mfn(pg);
+    for ( i = 0; i < (1U << order); i++ )
+        flush_page_to_ram(mfn_x(mfn) + i, !(memflags & MEMF_no_icache_flush));
+
     return pg;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 18 12:11:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Feb 2021 12:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86632.162743 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCi9B-0004Cs-RA; Thu, 18 Feb 2021 12:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86632.162743; Thu, 18 Feb 2021 12:11:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCi9B-0004Ci-Ne; Thu, 18 Feb 2021 12:11:05 +0000
Received: by outflank-mailman (input) for mailman id 86632;
 Thu, 18 Feb 2021 12: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 1lCi9A-0004Cd-Uq
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 12: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 1lCi9A-0005EJ-RS
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 12:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCi9A-0003Tv-P9
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 12:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kp+nkwDSh7hofh9cqoKMMEgfeGkH+72pbfezkoa0iLI=; b=mGAQScee+E0N+7W77FQxqSh9ZI
	HmKE8wuAb10Taqq8WkTgFHcIEntQFJZSf41oUvg2OEOkDRUcNxGxwn1JX7pk15WCqez8Q7VDyrur8
	6kqxmAulsrc/uQWuhkFJrWvSXul6mlsRJzBpRMO2sKf27Ck5hfrPVptAieaGTXLeAzDY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.11] x86/ept: fix missing IOMMU flush in atomic_write_ept_entry
Message-Id: <E1lCi9A-0003Tv-P9@xenbits.xenproject.org>
Date: Thu, 18 Feb 2021 12:11:04 +0000

commit 76d369d33179a5f8e5f6607f3917db9ab8c22968
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Feb 18 13:02:04 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 18 13:02:04 2021 +0100

    x86/ept: fix missing IOMMU flush in atomic_write_ept_entry
    
    Backport of XSA-321 missed a flush in atomic_write_ept_entry when
    level was different than 0. Such omission will undermine the fix for
    XSA-321, because page table entries cached in the IOMMU can get out
    of sync and contain stale entries.
    
    Fix this by slightly re-arranging the code to prevent the early return
    when level is different that 0. Note that the early return is just an
    optimization because foreign entries cannot have level > 0.
    
    This is XSA-366.
    
    Reported-by: M. Vefa Bicakci <m.v.b@runbox.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/p2m-ept.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 02071752e8..e0fec73e3f 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -53,12 +53,7 @@ static int atomic_write_ept_entry(ept_entry_t *entryptr, ept_entry_t new,
     bool_t check_foreign = (new.mfn != entryptr->mfn ||
                             new.sa_p2mt != entryptr->sa_p2mt);
 
-    if ( level )
-    {
-        ASSERT(!is_epte_superpage(&new) || !p2m_is_foreign(new.sa_p2mt));
-        write_atomic(&entryptr->epte, new.epte);
-        return 0;
-    }
+    ASSERT(!level || !is_epte_superpage(&new) || !p2m_is_foreign(new.sa_p2mt));
 
     if ( unlikely(p2m_is_foreign(new.sa_p2mt)) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Thu Feb 18 12:22:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Feb 2021 12:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86633.162746 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCiJq-0005Bx-Lp; Thu, 18 Feb 2021 12:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86633.162746; Thu, 18 Feb 2021 12:22:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCiJq-0005Bp-Ic; Thu, 18 Feb 2021 12:22:06 +0000
Received: by outflank-mailman (input) for mailman id 86633;
 Thu, 18 Feb 2021 12: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 1lCiJp-0005Bk-4z
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 12: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 1lCiJp-0005Pu-1V
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 12:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCiJp-0004Ga-0F
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 12:22:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ge9Rg6rxx0sStCineTQay0uRGh4o5E/BLsxiiku7VZo=; b=1fMKJyoR9tXrjqNfU1rzbxvNsb
	sWPa7Zd0eMQ993nJWYeQ1g1qXXsTcVs4rozicYSQSfOVDBXYi2fMPVnaZ35juhNvn/Wy2gcIgsnhd
	vDoCkZjHQJhf20+mbXbTreH7GXfnGqj7it9FxqZZQiLioxGSsHWVlhMuOGG1uBhNJduM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] IOREQ: refine when to send mapcache invalidation request
Message-Id: <E1lCiJp-0004Ga-0F@xenbits.xenproject.org>
Date: Thu, 18 Feb 2021 12:22:05 +0000

commit 588d961d15d1af5b51d7c33b5278ac7269a961ef
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 18 13:11:19 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 18 13:11:19 2021 +0100

    IOREQ: refine when to send mapcache invalidation request
    
    XENMEM_decrease_reservation isn't the only means by which pages can get
    removed from a guest, yet all removals ought to be signaled to qemu. Put
    setting of the flag into the central p2m_remove_page() underlying all
    respective hypercalls as well as a few similar places, mainly in PoD
    code.
    
    Additionally there's no point sending the request for the local domain
    when the domain acted upon is a different one. The latter domain's ioreq
    server mapcaches need invalidating. We assume that domain to be paused
    at the point the operation takes place, so sending the request in this
    case happens from the hvm_do_resume() path, which as one of its first
    steps calls handle_hvm_io_completion().
    
    Even without the remote operation aspect a single domain-wide flag
    doesn't do: Guests may e.g. decrease-reservation on multiple vCPU-s in
    parallel. Each of them needs to issue an invalidation request in due
    course, in particular because exiting to guest context should not happen
    before the request was actually seen by (all) the emulator(s).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/p2m.c           |  7 +++----
 xen/arch/arm/traps.c         |  4 ++--
 xen/arch/x86/hvm/hypercall.c | 12 +++++-------
 xen/arch/x86/mm/p2m-pod.c    |  9 +++++++++
 xen/arch/x86/mm/p2m.c        |  5 +++++
 xen/common/ioreq.c           | 32 +++++++++++++++++++++++++++-----
 xen/include/xen/ioreq.h      |  1 +
 xen/include/xen/sched.h      | 13 ++++++++-----
 8 files changed, 60 insertions(+), 23 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 6895804379..ac50312620 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -759,10 +759,9 @@ static void p2m_free_entry(struct p2m_domain *p2m,
          * has failed (error case).
          * So, at worst, the spurious mapcache invalidation might be sent.
          */
-        if ( (p2m->domain == current->domain) &&
-              domain_has_ioreq_server(p2m->domain) &&
-              p2m_is_ram(entry.p2m.type) )
-            p2m->domain->mapcache_invalidate = true;
+        if ( p2m_is_ram(entry.p2m.type) &&
+             domain_has_ioreq_server(p2m->domain) )
+            ioreq_request_mapcache_invalidate(p2m->domain);
 #endif
 
         p2m->stats.mappings[level]--;
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 6fa135050b..ccc0827107 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1509,8 +1509,8 @@ static void do_trap_hypercall(struct cpu_user_regs *regs, register_t *nr,
      * Note that sending the invalidation request causes the vCPU to block
      * until all the IOREQ servers have acknowledged the invalidation.
      */
-    if ( unlikely(curr->domain->mapcache_invalidate) &&
-         test_and_clear_bool(curr->domain->mapcache_invalidate) )
+    if ( unlikely(curr->mapcache_invalidate) &&
+         test_and_clear_bool(curr->mapcache_invalidate) )
         ioreq_signal_mapcache_invalidate();
 #endif
 }
diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index 6d41c563e1..b084afcbce 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -32,7 +32,6 @@
 
 static long hvm_memory_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
-    const struct vcpu *curr = current;
     long rc;
 
     switch ( cmd & MEMOP_CMD_MASK )
@@ -42,14 +41,11 @@ static long hvm_memory_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         return -ENOSYS;
     }
 
-    if ( !curr->hcall_compat )
+    if ( !current->hcall_compat )
         rc = do_memory_op(cmd, arg);
     else
         rc = compat_memory_op(cmd, arg);
 
-    if ( (cmd & MEMOP_CMD_MASK) == XENMEM_decrease_reservation )
-        curr->domain->mapcache_invalidate = true;
-
     return rc;
 }
 
@@ -327,9 +323,11 @@ int hvm_hypercall(struct cpu_user_regs *regs)
 
     HVM_DBG_LOG(DBG_LEVEL_HCALL, "hcall%lu -> %lx", eax, regs->rax);
 
-    if ( unlikely(currd->mapcache_invalidate) &&
-         test_and_clear_bool(currd->mapcache_invalidate) )
+    if ( unlikely(curr->mapcache_invalidate) )
+    {
+        curr->mapcache_invalidate = false;
         ioreq_signal_mapcache_invalidate();
+    }
 
     return curr->hcall_preempted ? HVM_HCALL_preempted : HVM_HCALL_completed;
 }
diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index 48e609d1ed..ae153fa6e6 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -20,6 +20,7 @@
  */
 
 #include <xen/event.h>
+#include <xen/ioreq.h>
 #include <xen/mm.h>
 #include <xen/sched.h>
 #include <xen/trace.h>
@@ -647,6 +648,8 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
                 set_gpfn_from_mfn(mfn_x(mfn), INVALID_M2P_ENTRY);
             p2m_pod_cache_add(p2m, page, cur_order);
 
+            ioreq_request_mapcache_invalidate(d);
+
             steal_for_cache =  ( p2m->pod.entry_count > p2m->pod.count );
 
             ram -= n;
@@ -835,6 +838,8 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn)
     p2m_pod_cache_add(p2m, mfn_to_page(mfn0), PAGE_ORDER_2M);
     p2m->pod.entry_count += SUPERPAGE_PAGES;
 
+    ioreq_request_mapcache_invalidate(d);
+
     ret = SUPERPAGE_PAGES;
 
 out_reset:
@@ -997,6 +1002,8 @@ p2m_pod_zero_check(struct p2m_domain *p2m, const gfn_t *gfns, unsigned int count
             /* Add to cache, and account for the new p2m PoD entry */
             p2m_pod_cache_add(p2m, mfn_to_page(mfns[i]), PAGE_ORDER_4K);
             p2m->pod.entry_count++;
+
+            ioreq_request_mapcache_invalidate(d);
         }
     }
 
@@ -1315,6 +1322,8 @@ guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
         p2m->pod.entry_count -= pod_count;
         BUG_ON(p2m->pod.entry_count < 0);
         pod_unlock(p2m);
+
+        ioreq_request_mapcache_invalidate(d);
     }
 
 out:
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 2091aed4a6..3840f167b0 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -28,6 +28,7 @@
 #include <xen/vm_event.h>
 #include <xen/event.h>
 #include <xen/grant_table.h>
+#include <xen/ioreq.h>
 #include <xen/param.h>
 #include <public/vm_event.h>
 #include <asm/domain.h>
@@ -815,6 +816,8 @@ p2m_remove_page(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
         }
     }
 
+    ioreq_request_mapcache_invalidate(p2m->domain);
+
     return p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
                          p2m->default_access);
 }
@@ -1301,6 +1304,8 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
             ASSERT(mfn_valid(mfn_add(omfn, i)));
             set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
         }
+
+        ioreq_request_mapcache_invalidate(d);
     }
 
     P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
diff --git a/xen/common/ioreq.c b/xen/common/ioreq.c
index 5b603c0520..d732dc045d 100644
--- a/xen/common/ioreq.c
+++ b/xen/common/ioreq.c
@@ -35,6 +35,17 @@
 #include <public/hvm/ioreq.h>
 #include <public/hvm/params.h>
 
+void ioreq_request_mapcache_invalidate(const struct domain *d)
+{
+    struct vcpu *v = current;
+
+    if ( d == v->domain )
+        v->mapcache_invalidate = true;
+    else if ( d->creation_finished )
+        for_each_vcpu ( d, v )
+            v->mapcache_invalidate = true;
+}
+
 /* Ask ioemu mapcache to invalidate mappings. */
 void ioreq_signal_mapcache_invalidate(void)
 {
@@ -206,6 +217,7 @@ bool vcpu_ioreq_handle_completion(struct vcpu *v)
     struct ioreq_server *s;
     struct ioreq_vcpu *sv;
     enum vio_completion completion;
+    bool res = true;
 
     if ( has_vpci(d) && vpci_process_pending(v) )
     {
@@ -232,17 +244,27 @@ bool vcpu_ioreq_handle_completion(struct vcpu *v)
         break;
 
     case VIO_mmio_completion:
-        return arch_ioreq_complete_mmio();
+        res = arch_ioreq_complete_mmio();
+        break;
 
     case VIO_pio_completion:
-        return handle_pio(vio->req.addr, vio->req.size,
-                          vio->req.dir);
+        res = handle_pio(vio->req.addr, vio->req.size,
+                         vio->req.dir);
+        break;
 
     default:
-        return arch_vcpu_ioreq_completion(completion);
+        res = arch_vcpu_ioreq_completion(completion);
+        break;
     }
 
-    return true;
+    if ( res && unlikely(v->mapcache_invalidate) )
+    {
+        v->mapcache_invalidate = false;
+        ioreq_signal_mapcache_invalidate();
+        res = false;
+    }
+
+    return res;
 }
 
 static int ioreq_server_alloc_mfn(struct ioreq_server *s, bool buf)
diff --git a/xen/include/xen/ioreq.h b/xen/include/xen/ioreq.h
index a54a637bef..a26614d331 100644
--- a/xen/include/xen/ioreq.h
+++ b/xen/include/xen/ioreq.h
@@ -103,6 +103,7 @@ struct ioreq_server *ioreq_server_select(struct domain *d,
 int ioreq_send(struct ioreq_server *s, ioreq_t *proto_p,
                bool buffered);
 unsigned int ioreq_broadcast(ioreq_t *p, bool buffered);
+void ioreq_request_mapcache_invalidate(const struct domain *d);
 void ioreq_signal_mapcache_invalidate(void);
 
 void ioreq_domain_init(struct domain *d);
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index bc78a09a53..5485d08afb 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -225,6 +225,14 @@ struct vcpu
     bool             hcall_compat;
 #endif
 
+#ifdef CONFIG_IOREQ_SERVER
+    /*
+     * Indicates that mapcache invalidation request should be sent to
+     * the device emulator.
+     */
+    bool             mapcache_invalidate;
+#endif
+
     /* The CPU, if any, which is holding onto this VCPU's state. */
 #define VCPU_CPU_CLEAN (~0u)
     unsigned int     dirty_cpu;
@@ -448,11 +456,6 @@ struct domain
      * unpaused for the first time by the systemcontroller.
      */
     bool             creation_finished;
-    /*
-     * Indicates that mapcache invalidation request should be sent to
-     * the device emulator.
-     */
-    bool             mapcache_invalidate;
 
     /* Which guest this guest has privileges on */
     struct domain   *target;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 18 12:22:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Feb 2021 12:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86634.162750 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCiK0-0005Cp-Nj; Thu, 18 Feb 2021 12:22:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86634.162750; Thu, 18 Feb 2021 12:22:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCiK0-0005Cg-KQ; Thu, 18 Feb 2021 12:22:16 +0000
Received: by outflank-mailman (input) for mailman id 86634;
 Thu, 18 Feb 2021 12: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 1lCiJz-0005CY-9D
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 12:22:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCiJz-0005Q1-6o
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 12:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCiJz-0004HI-3x
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 12:22:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8WxPYvD5bvleySNIN5x51B/bBi5D6bIk8L8uRsLrYYU=; b=C97dsWt7kLIoyXGL0JQmaomQ3/
	66tQj66sK8sSdZ07Nb5wMbedO1NcH1LhNkua6RkH43/hSLuKVgiP+hFhgRztT/TzBUrwOGvjty9E2
	6n2JoHR2H4ddSjQjJdlzSXfZrY7Yo0hElb1Il8xJV7d03huwsRC5xPq1sLe6ciWRNmik=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] gnttab: never permit mapping transitive grants
Message-Id: <E1lCiJz-0004HI-3x@xenbits.xenproject.org>
Date: Thu, 18 Feb 2021 12:22:15 +0000

commit b339e3a976b1680f57051adabcb98281198f7eac
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 18 13:16:12 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 18 13:16:12 2021 +0100

    gnttab: never permit mapping transitive grants
    
    Transitive grants allow an intermediate domain I to grant a target
    domain T access to a page which origin domain O did grant I access to.
    As an implementation restriction, T is not allowed to map such a grant.
    This restriction is currently tried to be enforced by marking active
    entries resulting from transitive grants as is-sub-page; sub-page grants
    for obvious reasons don't allow mapping. However, marking (and checking)
    only active entries is insufficient, as a map attempt may also occur on
    a grant not otherwise in use. When not presently in use (pin count zero)
    the grant type itself needs checking. Otherwise T may be able to map an
    unrelated page owned by I. This is because the "transitive" sub-
    structure of the v2 union would end up being interpreted as "full_page"
    sub-structure instead. The low 32 bits of the GFN used would match the
    grant reference specified in I's transitive grant entry, while the upper
    32 bits could be random (depending on how exactly I sets up its grant
    table entries).
    
    Note that if one mapping already exists and the granting domain _then_
    changes the grant to GTF_transitive (which the domain is not supposed to
    do), the changed type will only be honored after the pin count has gone
    back to zero. This is no different from e.g. GTF_readonly or
    GTF_sub_page becoming set when a grant is already in use.
    
    While adjusting the implementation, also adjust commentary in the public
    header to better reflect reality.
    
    Fixes: 3672ce675c93 ("Transitive grant support")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/grant_table.c         | 9 +++++----
 xen/include/public/grant_table.h | 6 ++++--
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index b95403695f..4902598c8f 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -851,9 +851,10 @@ static int _set_status_v2(const grant_entry_header_t *shah,
         mask |= GTF_sub_page;
 
     /* If not already pinned, check the grant domid and type. */
-    if ( !act->pin && ((((scombo.flags & mask) != GTF_permit_access) &&
-                        ((scombo.flags & mask) != GTF_transitive)) ||
-                       (scombo.domid != ldomid)) )
+    if ( !act->pin &&
+         ((((scombo.flags & mask) != GTF_permit_access) &&
+           (mapflag || ((scombo.flags & mask) != GTF_transitive))) ||
+          (scombo.domid != ldomid)) )
         PIN_FAIL(done, GNTST_general_error,
                  "Bad flags (%x) or dom (%d); expected d%d, flags %x\n",
                  scombo.flags, scombo.domid, ldomid, mask);
@@ -879,7 +880,7 @@ static int _set_status_v2(const grant_entry_header_t *shah,
     if ( !act->pin )
     {
         if ( (((scombo.flags & mask) != GTF_permit_access) &&
-              ((scombo.flags & mask) != GTF_transitive)) ||
+              (mapflag || ((scombo.flags & mask) != GTF_transitive))) ||
              (scombo.domid != ldomid) ||
              (!readonly && (scombo.flags & GTF_readonly)) )
         {
diff --git a/xen/include/public/grant_table.h b/xen/include/public/grant_table.h
index 3b7bf93d74..84b1d26b36 100644
--- a/xen/include/public/grant_table.h
+++ b/xen/include/public/grant_table.h
@@ -166,11 +166,13 @@ typedef struct grant_entry_v1 grant_entry_v1_t;
 #define GTF_type_mask       (3U<<0)
 
 /*
- * Subflags for GTF_permit_access.
+ * Subflags for GTF_permit_access and GTF_transitive.
  *  GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST]
  *  GTF_reading: Grant entry is currently mapped for reading by @domid. [XEN]
  *  GTF_writing: Grant entry is currently mapped for writing by @domid. [XEN]
- *  GTF_PAT, GTF_PWT, GTF_PCD: (x86) cache attribute flags for the grant [GST]
+ * Further subflags for GTF_permit_access only.
+ *  GTF_PAT, GTF_PWT, GTF_PCD: (x86) cache attribute flags to be used for
+ *                             mappings of the grant [GST]
  *  GTF_sub_page: Grant access to only a subrange of the page.  @domid
  *                will only be allowed to copy from the grant, and not
  *                map it. [GST]
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 18 12:22:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Feb 2021 12:22:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86635.162754 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCiKA-0005EB-P9; Thu, 18 Feb 2021 12:22:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86635.162754; Thu, 18 Feb 2021 12:22:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCiKA-0005E3-Lw; Thu, 18 Feb 2021 12:22:26 +0000
Received: by outflank-mailman (input) for mailman id 86635;
 Thu, 18 Feb 2021 12:22:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCiK9-0005Dt-Ae
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 12:22:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCiK9-0005Q9-9s
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 12:22:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCiK9-0004I1-8u
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 12:22:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7HOP281bw7jTbVXasZcCgbJc+md45EneocWZMKmbI6I=; b=WCQcFLc+RYoMwSU9KEF/RHINC+
	SsOw0J7PW+DM+guEuUQ05Q9EE+tl+o81xfryIC13DiCyE98FmpD24oM8mEx9JTOEN1hIeG1MPxGkn
	sYuuad4No4oh3BURbzOMH1mYeT75x4zLx12HuMBIG5ccn5BqrcV5bNwWF8RtePwFSguw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] gnttab: bypass IOMMU (un)mapping when a domain is (un)mapping its own grant
Message-Id: <E1lCiK9-0004I1-8u@xenbits.xenproject.org>
Date: Thu, 18 Feb 2021 12:22:25 +0000

commit e8185c5f01c68f7d29d23a4a91bc1be1ff2cc1ca
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 18 13:16:59 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 18 13:16:59 2021 +0100

    gnttab: bypass IOMMU (un)mapping when a domain is (un)mapping its own grant
    
    Mappings for a domain's own pages should already be present in the
    IOMMU. While installing the same mapping again is merely redundant (and
    inefficient), removing the mapping when the grant mapping gets removed
    is outright wrong in this case: The mapping was there before the map, so
    should remain in place after unmapping.
    
    This affects
    - Arm Dom0 in the direct mapped case,
    - x86 PV Dom0 in the "iommu=dom0-strict" / "dom0-iommu=strict" case,
    - all x86 PV DomU-s, including driver domains.
    
    See the code comment for why it's the original domain and not the page
    owner that gets compared against.
    
    Reported-by: Rahul Singh <Rahul.Singh@arm.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/grant_table.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 4902598c8f..f937c1d350 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1243,7 +1243,14 @@ map_grant_ref(
         goto undo_out;
     }
 
-    need_iommu = gnttab_need_iommu_mapping(ld);
+    /*
+     * This is deliberately not checking the page's owner: get_paged_frame()
+     * explicitly rejects foreign pages, and all success paths above yield
+     * either owner == rd or owner == dom_io (the dom_cow case is irrelevant
+     * as mem-sharing and IOMMU use are incompatible). The dom_io case would
+     * need checking separately if we compared against owner here.
+     */
+    need_iommu = ld != rd && gnttab_need_iommu_mapping(ld);
     if ( need_iommu )
     {
         unsigned int kind;
@@ -1493,7 +1500,8 @@ unmap_common(
     if ( put_handle )
         put_maptrack_handle(lgt, op->handle);
 
-    if ( rc == GNTST_okay && gnttab_need_iommu_mapping(ld) )
+    /* See the respective comment in map_grant_ref(). */
+    if ( rc == GNTST_okay && ld != rd && gnttab_need_iommu_mapping(ld) )
     {
         unsigned int kind;
         int err = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 18 20:33:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Feb 2021 20:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86730.163034 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCpyx-0003Fv-Fm; Thu, 18 Feb 2021 20:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86730.163034; Thu, 18 Feb 2021 20:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCpyx-0003Fn-Cj; Thu, 18 Feb 2021 20:33:03 +0000
Received: by outflank-mailman (input) for mailman id 86730;
 Thu, 18 Feb 2021 20: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 1lCpyv-0003Fi-S0
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 20:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCpyv-0005hN-R6
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 20:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCpyv-0005oq-P8
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 20:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tPdNlBCfNyHYsNCPKXZV9evm+ol2LSirJ+UVWNyxoHI=; b=t6BiBPyWIsLhB6Wp7d1lfkpe/f
	j9+uN547crD1zWWHjkf+ALziR8NRTPsmT7rm/4DRyZDpAtR5pBcd8tnxh6Wndwp+rCOvrYDC0eOGP
	VKBlslCDUf/YaTw1l06nadwIHubBRFhJH6q9y3jPv5cu6Y2ToCdRfwR8U8PtNpqJ7Mqk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] xen/arm: fix gnttab_need_iommu_mapping
Message-Id: <E1lCpyv-0005oq-P8@xenbits.xenproject.org>
Date: Thu, 18 Feb 2021 20:33:01 +0000

commit d7a1e06efd3ae2b16d5bb335932376b7d7eaf633
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Mon Feb 8 10:49:32 2021 -0800
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Tue Feb 16 16:16:09 2021 -0800

    xen/arm: fix gnttab_need_iommu_mapping
    
    Commit 91d4eca7add broke gnttab_need_iommu_mapping on ARM.
    The offending chunk is:
    
     #define gnttab_need_iommu_mapping(d)                    \
    -    (is_domain_direct_mapped(d) && need_iommu(d))
    +    (is_domain_direct_mapped(d) && need_iommu_pt_sync(d))
    
    On ARM we need gnttab_need_iommu_mapping to be true for dom0 when it is
    directly mapped and IOMMU is enabled for the domain, like the old check
    did, but the new check is always false.
    
    In fact, need_iommu_pt_sync is defined as dom_iommu(d)->need_sync and
    need_sync is set as:
    
        if ( !is_hardware_domain(d) || iommu_hwdom_strict )
            hd->need_sync = !iommu_use_hap_pt(d);
    
    iommu_use_hap_pt(d) means that the page-table used by the IOMMU is the
    P2M. It is true on ARM. need_sync means that you have a separate IOMMU
    page-table and it needs to be updated for every change. need_sync is set
    to false on ARM. Hence, gnttab_need_iommu_mapping(d) is false too,
    which is wrong.
    
    As a consequence, when using PV network from a domU on a system where
    IOMMU is on from Dom0, I get:
    
    (XEN) smmu: /smmu@fd800000: Unhandled context fault: fsr=0x402, iova=0x8424cb148, fsynr=0xb0001, cb=0
    [   68.290307] macb ff0e0000.ethernet eth0: DMA bus error: HRESP not OK
    
    The fix is to go back to something along the lines of the old
    implementation of gnttab_need_iommu_mapping.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Fixes: 91d4eca7add ("mm / iommu: split need_iommu() into has_iommu_pt() and need_iommu_pt_sync()")
    Backport: 4.13+
    (cherry picked from commit 04085ec1ac05a362812e9b0c6b5a8713d7dc88ad)
---
 xen/include/asm-arm/grant_table.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/asm-arm/grant_table.h b/xen/include/asm-arm/grant_table.h
index 6f585b1538..0ce77f9a1c 100644
--- a/xen/include/asm-arm/grant_table.h
+++ b/xen/include/asm-arm/grant_table.h
@@ -89,7 +89,7 @@ int replace_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
     (((i) >= nr_status_frames(t)) ? INVALID_GFN : (t)->arch.status_gfn[i])
 
 #define gnttab_need_iommu_mapping(d)                    \
-    (is_domain_direct_mapped(d) && need_iommu_pt_sync(d))
+    (is_domain_direct_mapped(d) && is_iommu_enabled(d))
 
 #endif /* __ASM_GRANT_TABLE_H__ */
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Feb 18 23:33:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Feb 2021 23:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86742.163059 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCsn9-0003HS-2f; Thu, 18 Feb 2021 23:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86742.163059; Thu, 18 Feb 2021 23:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCsn8-0003HK-Vm; Thu, 18 Feb 2021 23:33:02 +0000
Received: by outflank-mailman (input) for mailman id 86742;
 Thu, 18 Feb 2021 23: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 1lCsn7-0003HF-O0
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 23: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 1lCsn7-00008c-M7
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 23:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCsn7-00036D-Ki
 for xen-changelog@lists.xenproject.org; Thu, 18 Feb 2021 23:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gI5c5Z/DFvlq0pWmN7KZhDSk0TonXZeGaAEQ2ie/Fr0=; b=aRXlh2B2Y1XXz1TMnduVPpIS2u
	sSx5SKpHEj1Lk1b23nStDKo9hql+GkMCAC5QzpI7VnC7B4Ff6Icop7Qac499AfBymSH63Za3lDXlK
	Ww+EX7T/8PoAlT9I/Ts1f8Dl6SDE3kip/yr8eccUZRS45A67EWZudo+nYNuzjDbRn0vU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] xen/arm: fix gnttab_need_iommu_mapping
Message-Id: <E1lCsn7-00036D-Ki@xenbits.xenproject.org>
Date: Thu, 18 Feb 2021 23:33:01 +0000

commit b0b734a8b3e516ff1040884b755a8d47afed31ea
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Mon Feb 8 10:49:32 2021 -0800
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Tue Feb 16 16:13:16 2021 -0800

    xen/arm: fix gnttab_need_iommu_mapping
    
    Commit 91d4eca7add broke gnttab_need_iommu_mapping on ARM.
    The offending chunk is:
    
     #define gnttab_need_iommu_mapping(d)                    \
    -    (is_domain_direct_mapped(d) && need_iommu(d))
    +    (is_domain_direct_mapped(d) && need_iommu_pt_sync(d))
    
    On ARM we need gnttab_need_iommu_mapping to be true for dom0 when it is
    directly mapped and IOMMU is enabled for the domain, like the old check
    did, but the new check is always false.
    
    In fact, need_iommu_pt_sync is defined as dom_iommu(d)->need_sync and
    need_sync is set as:
    
        if ( !is_hardware_domain(d) || iommu_hwdom_strict )
            hd->need_sync = !iommu_use_hap_pt(d);
    
    iommu_use_hap_pt(d) means that the page-table used by the IOMMU is the
    P2M. It is true on ARM. need_sync means that you have a separate IOMMU
    page-table and it needs to be updated for every change. need_sync is set
    to false on ARM. Hence, gnttab_need_iommu_mapping(d) is false too,
    which is wrong.
    
    As a consequence, when using PV network from a domU on a system where
    IOMMU is on from Dom0, I get:
    
    (XEN) smmu: /smmu@fd800000: Unhandled context fault: fsr=0x402, iova=0x8424cb148, fsynr=0xb0001, cb=0
    [   68.290307] macb ff0e0000.ethernet eth0: DMA bus error: HRESP not OK
    
    The fix is to go back to something along the lines of the old
    implementation of gnttab_need_iommu_mapping.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Fixes: 91d4eca7add ("mm / iommu: split need_iommu() into has_iommu_pt() and need_iommu_pt_sync()")
    Backport: 4.13+
    (cherry picked from commit 04085ec1ac05a362812e9b0c6b5a8713d7dc88ad)
---
 xen/include/asm-arm/grant_table.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/asm-arm/grant_table.h b/xen/include/asm-arm/grant_table.h
index 6f585b1538..0ce77f9a1c 100644
--- a/xen/include/asm-arm/grant_table.h
+++ b/xen/include/asm-arm/grant_table.h
@@ -89,7 +89,7 @@ int replace_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
     (((i) >= nr_status_frames(t)) ? INVALID_GFN : (t)->arch.status_gfn[i])
 
 #define gnttab_need_iommu_mapping(d)                    \
-    (is_domain_direct_mapped(d) && need_iommu_pt_sync(d))
+    (is_domain_direct_mapped(d) && is_iommu_enabled(d))
 
 #endif /* __ASM_GRANT_TABLE_H__ */
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 06:22:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 06:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86772.163138 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCzAx-0003cn-6u; Fri, 19 Feb 2021 06:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86772.163138; Fri, 19 Feb 2021 06:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCzAx-0003ce-3g; Fri, 19 Feb 2021 06:22:03 +0000
Received: by outflank-mailman (input) for mailman id 86772;
 Fri, 19 Feb 2021 06:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCzAw-0003cZ-8w
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 06:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCzAw-0001n7-6O
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 06:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCzAw-0008Ai-4A
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 06:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3UDJtp/zMFuhVJEMwq4hYVEoUgmn+8F2ZeSGApXQpbQ=; b=MQPYU5Fu1B+zlRqvoCtNyWRtx+
	fdJlcYydTP1TLyLeIAU5u/URuLjU1B5NukCECdwgSySXsLAfYaGjjNR7XwLbSqo/Go2mBNjZbdP18
	Ri7DTirExk0zuEoEbOPuXP1kQTsdoCWlgxXIb5QMVhylStjtUTIpqQVvYpQ/oyB0aEu0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/iommu: Check if the IOMMU was initialized before tearing down
Message-Id: <E1lCzAw-0008Ai-4A@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 06:22:02 +0000

commit d670ef3401b91d04c58d72cd8ce5579b4fa900d8
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Dec 17 12:27:21 2020 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Feb 17 11:30:05 2021 +0000

    xen/iommu: Check if the IOMMU was initialized before tearing down
    
    is_iommu_enabled() will return true even if the IOMMU has not been
    initialized (e.g. the ops are not set).
    
    In the case of an early failure in arch_domain_init(), the function
    iommu_destroy_domain() will be called even if the IOMMU is not
    initialized.
    
    This will result to dereference the ops which will be NULL and an host
    crash.
    
    Fix the issue by checking that ops has been set before accessing it.
    
    Fixes: 71e617a6b8f6 ("use is_iommu_enabled() where appropriate...")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 xen/drivers/passthrough/iommu.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 2358b6eb09..879d238bcd 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -221,6 +221,13 @@ static void iommu_teardown(struct domain *d)
 {
     struct domain_iommu *hd = dom_iommu(d);
 
+    /*
+     * During early domain creation failure, we may reach here with the
+     * ops not yet initialized.
+     */
+    if ( !hd->platform_ops )
+        return;
+
     iommu_vcall(hd->platform_ops, teardown, d);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 06:22:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 06:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86773.163142 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCzB7-0003dV-86; Fri, 19 Feb 2021 06:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86773.163142; Fri, 19 Feb 2021 06:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCzB7-0003dN-5C; Fri, 19 Feb 2021 06:22:13 +0000
Received: by outflank-mailman (input) for mailman id 86773;
 Fri, 19 Feb 2021 06:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCzB6-0003dH-BJ
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 06:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCzB6-0001nE-A9
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 06:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCzB6-0008Bc-8X
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 06:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xRWw7rYDtvBKk81syuzNUPXTYYmgf+RH8iEWaTv9k3Y=; b=Z2I9/zsWlo90Z6pftpmdfg7wFI
	Hcg6s1wgHl73Z6/ypsVoCJboadxs/Y0otrAdeeyMTBX3EhXOqGqn6wjPmDaJscGAZ0m0IAvcPmeSU
	djjELfCcr+BUQQ8YmFg3hPjVqVEnsjgl1lqhpvZMbJLRF/7q84DiqlIqNHHKi+ViIw7A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xl: Fix exit code for `xl vkbattach`
Message-Id: <E1lCzB6-0008Bc-8X@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 06:22:12 +0000

commit 8e5b2029feee1961d6753127bf249c7a8c8f89a5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 18:49:23 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 17 12:37:08 2021 +0000

    tools/xl: Fix exit code for `xl vkbattach`
    
    Various version of gcc, when compiling with -Og, complain:
    
      xl_vkb.c: In function 'main_vkbattach':
      xl_vkb.c:79:12: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized]
         79 |     return rc;
            |            ^~
    
    The dryrun_only path really does leave rc uninitalised.  Introduce a done
    label for success paths to use.
    
    Fixes: a15166af7c3 ("xl: add vkb config parser and CLI")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xl/xl_vkb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/xl/xl_vkb.c b/tools/xl/xl_vkb.c
index f6ed9e05ee..728ac9470b 100644
--- a/tools/xl/xl_vkb.c
+++ b/tools/xl/xl_vkb.c
@@ -64,7 +64,7 @@ int main_vkbattach(int argc, char **argv)
         char *json = libxl_device_vkb_to_json(ctx, &vkb);
         printf("vkb: %s\n", json);
         free(json);
-        goto out;
+        goto done;
     }
 
     if (libxl_device_vkb_add(ctx, domid, &vkb, 0)) {
@@ -72,6 +72,7 @@ int main_vkbattach(int argc, char **argv)
         rc = ERROR_FAIL; goto out;
     }
 
+done:
     rc = 0;
 
 out:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 06:22:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 06:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86774.163147 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCzBH-0003eu-9r; Fri, 19 Feb 2021 06:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86774.163147; Fri, 19 Feb 2021 06:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCzBH-0003el-6g; Fri, 19 Feb 2021 06:22:23 +0000
Received: by outflank-mailman (input) for mailman id 86774;
 Fri, 19 Feb 2021 06:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCzBG-0003ea-Er
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 06:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCzBG-0001nK-DH
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 06:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCzBG-0008CI-CJ
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 06:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GmZ62+MZHwnfw8TgODHEBq9n43kEMPxJW7tBqcUq38Q=; b=kJbKIPdyGZxaKXODCKMEi+Ox31
	wrbFhjKhPf5hOZAMIihrEwASJ/g0XOm8fA2+1hcgiDCuMzZnB/E0aMURituC6P/NFgyCjLOngs60h
	ugS3caGAnX1nvYc0DNNgNlFDgJN65MF1GSsWi1zBohzs95ea3hBm08L+/tisjPXriqEw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxg: Fix uninitialised variable in write_x86_cpu_policy_records()
Message-Id: <E1lCzBG-0008CI-CJ@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 06:22:22 +0000

commit 60773532231d3b6ecdc98913832ca78c3d9a4371
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 14:25:57 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 17 12:37:08 2021 +0000

    tools/libxg: Fix uninitialised variable in write_x86_cpu_policy_records()
    
    Various version of gcc, when compiling with -Og, complain:
    
      xg_sr_common_x86.c: In function 'write_x86_cpu_policy_records':
      xg_sr_common_x86.c:92:12: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized]
         92 |     return rc;
            |            ^~
    
    The complaint is legitimate, and can occur with unexpected behaviour of two
    related hypercalls in combination with a libc which permits zero-length
    malloc()s.
    
    Have an explicit rc = 0 on the success path, and make the MSRs record error
    handling consistent with the CPUID record before it.
    
    Fixes: f6b2b8ec53d ("libxc/save: Write X86_{CPUID,MSR}_DATA records")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/guest/xg_sr_common_x86.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/libs/guest/xg_sr_common_x86.c b/tools/libs/guest/xg_sr_common_x86.c
index 6f12483907..3168c5485f 100644
--- a/tools/libs/guest/xg_sr_common_x86.c
+++ b/tools/libs/guest/xg_sr_common_x86.c
@@ -83,7 +83,13 @@ int write_x86_cpu_policy_records(struct xc_sr_context *ctx)
 
     msrs.length = nr_msrs * sizeof(xen_msr_entry_t);
     if ( msrs.length )
+    {
         rc = write_record(ctx, &msrs);
+        if ( rc )
+            goto out;
+    }
+
+    rc = 0;
 
  out:
     free(cpuid.data);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 06:22:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 06:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86775.163150 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCzBR-0003gJ-Ay; Fri, 19 Feb 2021 06:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86775.163150; Fri, 19 Feb 2021 06:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCzBR-0003gC-88; Fri, 19 Feb 2021 06:22:33 +0000
Received: by outflank-mailman (input) for mailman id 86775;
 Fri, 19 Feb 2021 06:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCzBQ-0003g5-I0
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 06:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCzBQ-0001na-H6
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 06:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCzBQ-0008DD-FQ
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 06:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UVSvCyib3QAS8PjVt81gYgptuDKlRkxWK8eFWsynvP0=; b=yT+j28NtQ1idSNa05ehpeQJuDU
	Cx2hbH7efEaCUqoXzVQO3OvEkfOPsratrinLFtdfjBBP9Qgzvz42/Rwq8nL0Jc2doFKUS7HFfyxOf
	R+fw58lQzGOy4POPW5kYejcXKr2T7MKg8QhIvyaaCCFnVxH18mJM5pwhyDD6tAL7/+As=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxg: Drop stale p2m logic from ARM's meminit()
Message-Id: <E1lCzBQ-0008DD-FQ@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 06:22:32 +0000

commit 928bffb6dd3f1b8a2355418f4c763a6fff714aa7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 17:45:21 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 17 12:37:08 2021 +0000

    tools/libxg: Drop stale p2m logic from ARM's meminit()
    
    Various version of gcc, when compiling with -Og, complain:
    
      xg_dom_arm.c: In function 'meminit':
      xg_dom_arm.c:420:19: error: 'p2m_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]
        420 |     dom->p2m_size = p2m_size;
            |     ~~~~~~~~~~~~~~^~~~~~~~~~
    
    This is actually entirely stale code since ee21f10d70^..97e34ad22d which
    removed the 1:1 identity p2m for translated domains.
    
    Drop the write of d->p2m_size, and the p2m_size local variable.  Reposition
    the p2m_size field in struct xc_dom_image and correct some stale
    documentation.
    
    This change really ought to have been part of the original cleanup series.
    
    No actual change to how ARM domains are constructed.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/include/xenguest.h      | 5 ++---
 tools/libs/guest/xg_dom_arm.c | 5 -----
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/tools/include/xenguest.h b/tools/include/xenguest.h
index 775cf34c04..217022b6e7 100644
--- a/tools/include/xenguest.h
+++ b/tools/include/xenguest.h
@@ -145,6 +145,7 @@ struct xc_dom_image {
      * eventually copied into guest context.
      */
     xen_pfn_t *pv_p2m;
+    xen_pfn_t p2m_size;         /* number of pfns covered by pv_p2m */
 
     /* physical memory
      *
@@ -154,12 +155,10 @@ struct xc_dom_image {
      *
      * An ARM guest has GUEST_RAM_BANKS regions of RAM, with
      * rambank_size[i] pages in each. The lowest RAM address
-     * (corresponding to the base of the p2m arrays above) is stored
-     * in rambase_pfn.
+     * is stored in rambase_pfn.
      */
     xen_pfn_t rambase_pfn;
     xen_pfn_t total_pages;
-    xen_pfn_t p2m_size;         /* number of pfns covered by p2m */
     struct xc_dom_phys *phys_pages;
 #if defined (__arm__) || defined(__aarch64__)
     xen_pfn_t rambank_size[GUEST_RAM_BANKS];
diff --git a/tools/libs/guest/xg_dom_arm.c b/tools/libs/guest/xg_dom_arm.c
index 94948d2b20..b4c24f15fb 100644
--- a/tools/libs/guest/xg_dom_arm.c
+++ b/tools/libs/guest/xg_dom_arm.c
@@ -373,7 +373,6 @@ static int meminit(struct xc_dom_image *dom)
     const uint64_t modsize = dtb_size + ramdisk_size;
     const uint64_t ram128mb = bankbase[0] + (128<<20);
 
-    xen_pfn_t p2m_size;
     uint64_t bank0end;
 
     assert(dom->rambase_pfn << XC_PAGE_SHIFT == bankbase[0]);
@@ -409,16 +408,12 @@ static int meminit(struct xc_dom_image *dom)
 
         ramsize -= banksize;
 
-        p2m_size = ( bankbase[i] + banksize - bankbase[0] ) >> XC_PAGE_SHIFT;
-
         dom->rambank_size[i] = banksize >> XC_PAGE_SHIFT;
     }
 
     assert(dom->rambank_size[0] != 0);
     assert(ramsize == 0); /* Too much RAM is rejected above */
 
-    dom->p2m_size = p2m_size;
-
     /* setup initial p2m and allocate guest memory */
     for ( i = 0; i < GUEST_RAM_BANKS && dom->rambank_size[i]; i++ )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 06:22:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 06:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86776.163154 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCzBb-0003he-D7; Fri, 19 Feb 2021 06:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86776.163154; Fri, 19 Feb 2021 06:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCzBb-0003hW-9y; Fri, 19 Feb 2021 06:22:43 +0000
Received: by outflank-mailman (input) for mailman id 86776;
 Fri, 19 Feb 2021 06:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCzBa-0003hN-MO
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 06:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCzBa-0001o0-Lh
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 06:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCzBa-0008Ds-JI
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 06:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sLJoYcIePlHscFeE5YNMUd8PKdzmse08C7sbu8B/yTw=; b=feaqqX9Cq468UZ2nvGTMW3zfhe
	2PdtKHMbFph3tkX39xts+aHmu66gfpOFZJ1tkmlMB3M2Ob5GTUWAiB5Qa4qsb68YsY71obGH6U1NV
	fMBGzqgrupCqDXbrKq2HVZeqsoN3bkNK78Au+7vCgbZDFLGstoTyb0ZdWa7gx7THMH6k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxl: Fix uninitialised variable in libxl__write_stub_dmargs()
Message-Id: <E1lCzBa-0008Ds-JI@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 06:22:42 +0000

commit b4159d2de0153eb8ce6aced1978e1917c07cf39d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 17:44:36 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 17 12:37:08 2021 +0000

    tools/libxl: Fix uninitialised variable in libxl__write_stub_dmargs()
    
    Various version of gcc, when compiling with -Og, complain:
    
      libxl_dm.c: In function ‘libxl__write_stub_dmargs’:
      libxl_dm.c:2166:16: error: ‘dmargs’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
                   rc = libxl__xs_write_checked(gc, t, path, dmargs);
                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    It isn't actually used while uninitialised, but only because of how the
    is_linux_stubdom checks line up.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/light/libxl_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 291dee9b3f..db4cec6a76 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -2101,7 +2101,7 @@ static int libxl__write_stub_dmargs(libxl__gc *gc,
 {
     struct xs_permissions roperm[2];
     xs_transaction_t t = XBT_NULL;
-    char *dmargs;
+    char *dmargs = NULL;
     int rc;
 
     roperm[0].id = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 06:22:53 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 06:22:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86777.163158 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCzBl-0003jG-EU; Fri, 19 Feb 2021 06:22:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86777.163158; Fri, 19 Feb 2021 06:22:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lCzBl-0003j8-BU; Fri, 19 Feb 2021 06:22:53 +0000
Received: by outflank-mailman (input) for mailman id 86777;
 Fri, 19 Feb 2021 06:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCzBk-0003j1-PZ
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 06:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCzBk-0001oA-Oo
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 06:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lCzBk-0008El-Ns
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 06:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rtOYqbm2LZ3tI54KPE5Ryuhe2LhxeW9k0rkgxXmCD14=; b=rNxVX3MC6TH97xqS1oKVmnYonf
	FFFnhcYWrfnYDJf0K+NRZdPobRksbp7yt5y3iqgf3wMhJU+Fdn0H35iROdmE8PgouYiIVQ+0iAhsi
	7YoEs57JTqHYiznpPwOe5j2lDGtLpjrCWQg+rgqcJxD5EzyPuRoSXI7PK3KaGQ8zaQ5w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] stubdom/xenstored: Fix uninitialised variables in lu_read_state()
Message-Id: <E1lCzBk-0008El-Ns@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 06:22:52 +0000

commit 7a4133feaf42000923eb9d84badb6b171625f137
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 21:10:51 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 17 12:37:08 2021 +0000

    stubdom/xenstored: Fix uninitialised variables in lu_read_state()
    
    Various version of gcc, when compiling with -Og, complain:
    
      xenstored_control.c: In function ‘lu_read_state’:
      xenstored_control.c:540:11: error: ‘state.size’ is used uninitialized in this
      function [-Werror=uninitialized]
        if (state.size == 0)
            ~~~~~^~~~~
      xenstored_control.c:543:6: error: ‘state.buf’ may be used uninitialized in
      this function [-Werror=maybe-uninitialized]
        pre = state.buf;
        ~~~~^~~~~~~~~~~
      xenstored_control.c:550:23: error: ‘state.buf’ may be used uninitialized in
      this function [-Werror=maybe-uninitialized]
         (void *)head - state.buf < state.size;
                        ~~~~~^~~~
      xenstored_control.c:550:35: error: ‘state.size’ may be used uninitialized in
      this function [-Werror=maybe-uninitialized]
         (void *)head - state.buf < state.size;
                                    ~~~~~^~~~~
    
    for the stubdom build.  This is because lu_get_dump_state() is a no-op stub in
    MiniOS, and state really is operated on uninitialised.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xenstore/xenstored_control.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index 1f733e0a04..f10beaf85e 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -530,7 +530,7 @@ static const char *lu_dump_state(const void *ctx, struct connection *conn)
 
 void lu_read_state(void)
 {
-	struct lu_dump_state state;
+	struct lu_dump_state state = {};
 	struct xs_state_record_header *head;
 	void *ctx = talloc_new(NULL); /* Work context for subfunctions. */
 	struct xs_state_preamble *pre;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 15:00:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 15:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86914.163494 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD7GI-0006R2-Ut; Fri, 19 Feb 2021 15:00:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86914.163494; Fri, 19 Feb 2021 15:00:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD7GI-0006Qu-Qi; Fri, 19 Feb 2021 15:00:06 +0000
Received: by outflank-mailman (input) for mailman id 86914;
 Fri, 19 Feb 2021 15: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 1lD7GH-0006Ge-MO
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 15: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 1lD7GH-0002Vu-K3
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 15:00:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD7GH-0001xM-IP
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 15: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>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HQatg20/ghlE8fFDujG3Kr+IzBPV0PO7fenLyRItvG8=; b=Bw1CfHCkeDGK9165YPXVtJLFg/
	qmzbeSd5/pHlnGuDFgQsiEhU9HAjICWBHhCE/0E0f590nBlg07egO4TYEYNDEk7B5k+0anbC1L3gO
	Mcw/SvB0N6huVnZst5+lLhA1cx6btcnjX27CeBVpubpTISwS8qG/ZgNh1Blzwm8ZNr+4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm : smmuv3: Fix to handle multiple StreamIds per device.
Message-Id: <E1lD7GH-0001xM-IP@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 15:00:05 +0000

commit 6794cdd08ea8b3512c53b8f162cb3f88fef54d0d
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Wed Feb 17 10:05:14 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Feb 19 14:55:54 2021 +0000

    xen/arm : smmuv3: Fix to handle multiple StreamIds per device.
    
    SMMUv3 driver does not handle multiple StreamId if the master device
    supports more than one StreamID.
    
    This bug was introduced when the driver was ported from Linux to XEN.
    dt_device_set_protected(..) should be called from add_device(..) not
    from the dt_xlate(..).
    
    Move dt_device_set_protected(..) from dt_xlate(..) to add_device().
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/drivers/passthrough/arm/smmu-v3.c | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c
index 914cdc1cf4..53d150cdb6 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.c
+++ b/xen/drivers/passthrough/arm/smmu-v3.c
@@ -2207,24 +2207,6 @@ static int arm_smmu_add_device(u8 devfn, struct device *dev)
 	 */
 	arm_smmu_enable_pasid(master);
 
-	return 0;
-
-err_free_master:
-	xfree(master);
-	dev_iommu_priv_set(dev, NULL);
-	return ret;
-}
-
-static int arm_smmu_dt_xlate(struct device *dev,
-				const struct dt_phandle_args *args)
-{
-	int ret;
-	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
-
-	ret = iommu_fwspec_add_ids(dev, args->args, 1);
-	if (ret)
-		return ret;
-
 	if (dt_device_is_protected(dev_to_dt(dev))) {
 		dev_err(dev, "Already added to SMMUv3\n");
 		return -EEXIST;
@@ -2237,6 +2219,17 @@ static int arm_smmu_dt_xlate(struct device *dev,
 			dev_name(fwspec->iommu_dev), fwspec->num_ids);
 
 	return 0;
+
+err_free_master:
+	xfree(master);
+	dev_iommu_priv_set(dev, NULL);
+	return ret;
+}
+
+static int arm_smmu_dt_xlate(struct device *dev,
+				const struct dt_phandle_args *args)
+{
+	return iommu_fwspec_add_ids(dev, args->args, 1);
 }
 
 /* Probing and initialisation functions */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 15:22:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 15:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86922.163521 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD7bX-0000EO-VK; Fri, 19 Feb 2021 15:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86922.163521; Fri, 19 Feb 2021 15:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD7bX-0000EG-SF; Fri, 19 Feb 2021 15:22:03 +0000
Received: by outflank-mailman (input) for mailman id 86922;
 Fri, 19 Feb 2021 15:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD7bW-0000EB-In
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 15:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD7bW-0002ry-G8
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 15:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD7bW-0003lm-De
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 15: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=gobntIv+fV8JWhIjFia9mdJYfgfolCRv1z6oHLA0/Yg=; b=Tf4anW7F1fGCnZHWikYb7sauS8
	RzNyBJH4nSHX0DH7Bkxv1NniFQV5uM8ztKbWayPRRuhssiYEJ4129k7qHTN8MY4+Ld/OqHLVZKwNT
	SgrWcoT0GmBAohhz3BCnnx9TQODj6DMlgvGjpOIxrG88f6plUWUkp3NdlOtb6x6d/ByI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.11] x86/ept: fix missing IOMMU flush in atomic_write_ept_entry
Message-Id: <E1lD7bW-0003lm-De@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 15:22:02 +0000

commit 76d369d33179a5f8e5f6607f3917db9ab8c22968
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Feb 18 13:02:04 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 18 13:02:04 2021 +0100

    x86/ept: fix missing IOMMU flush in atomic_write_ept_entry
    
    Backport of XSA-321 missed a flush in atomic_write_ept_entry when
    level was different than 0. Such omission will undermine the fix for
    XSA-321, because page table entries cached in the IOMMU can get out
    of sync and contain stale entries.
    
    Fix this by slightly re-arranging the code to prevent the early return
    when level is different that 0. Note that the early return is just an
    optimization because foreign entries cannot have level > 0.
    
    This is XSA-366.
    
    Reported-by: M. Vefa Bicakci <m.v.b@runbox.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/p2m-ept.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 02071752e8..e0fec73e3f 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -53,12 +53,7 @@ static int atomic_write_ept_entry(ept_entry_t *entryptr, ept_entry_t new,
     bool_t check_foreign = (new.mfn != entryptr->mfn ||
                             new.sa_p2mt != entryptr->sa_p2mt);
 
-    if ( level )
-    {
-        ASSERT(!is_epte_superpage(&new) || !p2m_is_foreign(new.sa_p2mt));
-        write_atomic(&entryptr->epte, new.epte);
-        return 0;
-    }
+    ASSERT(!level || !is_epte_superpage(&new) || !p2m_is_foreign(new.sa_p2mt));
 
     if ( unlikely(p2m_is_foreign(new.sa_p2mt)) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 16:33:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 16:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86974.163744 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD8iI-0000y9-FG; Fri, 19 Feb 2021 16:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86974.163744; Fri, 19 Feb 2021 16:33:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD8iI-0000y1-CI; Fri, 19 Feb 2021 16:33:06 +0000
Received: by outflank-mailman (input) for mailman id 86974;
 Fri, 19 Feb 2021 16:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD8iH-0000xw-Io
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16:33:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD8iH-0004c6-Hy
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD8iH-0001em-Gy
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hhDom+I4lnDp7YXMDrA7EFKZ7uZSDAJcRDTNZBaPwrM=; b=e+gLqJZsgtrJqFfx4+fDFoejbc
	RGnF6SCb0xF1BR3uL4yLVcdwz3VMeiVWuAo8X++OUQHjfLq4bUqFN1HFCptQqA2HD4MDmhSg9X/9E
	yug0FzeP9pF2NjxzRlGYzfe7M896BgiYhwoc1AGV7bOG/47kAmidIj2tL23MfhZmv4Fo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: split __{get,put}_user() into "guest" and "unsafe" variants
Message-Id: <E1lD8iH-0001em-Gy@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 16:33:05 +0000

commit 6a1d72d3739e330caf728ea07d656d7bf568824b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 19 17:18:27 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 19 17:18:27 2021 +0100

    x86: split __{get,put}_user() into "guest" and "unsafe" variants
    
    The "guest" variants are intended to work with (potentially) fully guest
    controlled addresses, while the "unsafe" variants are intended to be
    used in order to access addresses not (directly) under guest control,
    within Xen's part of virtual address space. (For linear page table and
    descriptor table accesses the low bits of the addresses may still be
    guest controlled, but this still won't allow speculation to "escape"
    into unwanted areas.) Subsequently we will want them to have distinct
    behavior, so as first step identify which one is which. For now, both
    groups of constructs alias one another.
    
    Double underscore prefixes are retained only on __{get,put}_guest(), to
    allow still distinguishing them from their "checking" counterparts once
    they also get renamed (to {get,put}_guest()).
    
    Since for them it's almost a full re-write, move what becomes
    {get,put}_unsafe_size() into the "common" uaccess.h (x86_64/*.h should
    disappear at some point anyway).
    
    In __copy_to_user() one of the two casts in each put_guest_size()
    invocation gets dropped. They're not needed and did break symmetry with
    __copy_from_user().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org> [shadow]
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/mm/shadow/multi.c            |  4 +-
 xen/arch/x86/pv/emul-gate-op.c            |  8 +--
 xen/arch/x86/pv/emulate.c                 |  4 +-
 xen/arch/x86/pv/iret.c                    | 22 ++++----
 xen/arch/x86/traps.c                      |  4 +-
 xen/include/asm-x86/uaccess.h             | 87 ++++++++++++++++++++-----------
 xen/include/asm-x86/x86_64/uaccess.h      | 24 ---------
 xen/test/livepatch/xen_hello_world_func.c |  2 +-
 8 files changed, 78 insertions(+), 77 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index da46eae835..36f548b554 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -776,9 +776,9 @@ shadow_write_entries(void *d, void *s, int entries, mfn_t mfn)
     /* Because we mirror access rights at all levels in the shadow, an
      * l2 (or higher) entry with the RW bit cleared will leave us with
      * no write access through the linear map.
-     * We detect that by writing to the shadow with __put_user() and
+     * We detect that by writing to the shadow with put_unsafe() and
      * using map_domain_page() to get a writeable mapping if we need to. */
-    if ( __put_user(*dst, dst) )
+    if ( put_unsafe(*dst, dst) )
     {
         perfc_incr(shadow_linear_map_failed);
         map = map_domain_page(mfn);
diff --git a/xen/arch/x86/pv/emul-gate-op.c b/xen/arch/x86/pv/emul-gate-op.c
index 61e65ce521..90a0a47aef 100644
--- a/xen/arch/x86/pv/emul-gate-op.c
+++ b/xen/arch/x86/pv/emul-gate-op.c
@@ -40,7 +40,7 @@ static int read_gate_descriptor(unsigned int gate_sel,
          ((gate_sel >> 3) + !is_pv_32bit_vcpu(v) >=
           (gate_sel & 4 ? v->arch.pv.ldt_ents
                         : v->arch.pv.gdt_ents)) ||
-         __get_user(desc, pdesc) )
+         get_unsafe(desc, pdesc) )
         return 0;
 
     *sel = (desc.a >> 16) & 0x0000fffc;
@@ -59,7 +59,7 @@ static int read_gate_descriptor(unsigned int gate_sel,
     {
         if ( (*ar & 0x1f00) != 0x0c00 ||
              /* Limit check done above already. */
-             __get_user(desc, pdesc + 1) ||
+             get_unsafe(desc, pdesc + 1) ||
              (desc.b & 0x1f00) )
             return 0;
 
@@ -294,7 +294,7 @@ void pv_emulate_gate_op(struct cpu_user_regs *regs)
         { \
             --stkp; \
             esp -= 4; \
-            rc = __put_user(item, stkp); \
+            rc = __put_guest(item, stkp); \
             if ( rc ) \
             { \
                 pv_inject_page_fault(PFEC_write_access, \
@@ -362,7 +362,7 @@ void pv_emulate_gate_op(struct cpu_user_regs *regs)
                     unsigned int parm;
 
                     --ustkp;
-                    rc = __get_user(parm, ustkp);
+                    rc = __get_guest(parm, ustkp);
                     if ( rc )
                     {
                         pv_inject_page_fault(0, (unsigned long)(ustkp + 1) - rc);
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index c0b153e2c5..e8bb326efd 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -34,13 +34,13 @@ int pv_emul_read_descriptor(unsigned int sel, const struct vcpu *v,
     if ( sel < 4 ||
          /*
           * Don't apply the GDT limit here, as the selector may be a Xen
-          * provided one. __get_user() will fail (without taking further
+          * provided one. get_unsafe() will fail (without taking further
           * action) for ones falling in the gap between guest populated
           * and Xen ones.
           */
          ((sel & 4) && (sel >> 3) >= v->arch.pv.ldt_ents) )
         desc.b = desc.a = 0;
-    else if ( __get_user(desc, gdt_ldt_desc_ptr(sel)) )
+    else if ( get_unsafe(desc, gdt_ldt_desc_ptr(sel)) )
         return 0;
     if ( !insn_fetch )
         desc.b &= ~_SEGMENT_L;
diff --git a/xen/arch/x86/pv/iret.c b/xen/arch/x86/pv/iret.c
index 9e34b616f9..39b18b04f3 100644
--- a/xen/arch/x86/pv/iret.c
+++ b/xen/arch/x86/pv/iret.c
@@ -114,15 +114,15 @@ unsigned int compat_iret(void)
     regs->rsp = (u32)regs->rsp;
 
     /* Restore EAX (clobbered by hypercall). */
-    if ( unlikely(__get_user(regs->eax, (u32 *)regs->rsp)) )
+    if ( unlikely(__get_guest(regs->eax, (u32 *)regs->rsp)) )
     {
         domain_crash(v->domain);
         return 0;
     }
 
     /* Restore CS and EIP. */
-    if ( unlikely(__get_user(regs->eip, (u32 *)regs->rsp + 1)) ||
-        unlikely(__get_user(regs->cs, (u32 *)regs->rsp + 2)) )
+    if ( unlikely(__get_guest(regs->eip, (u32 *)regs->rsp + 1)) ||
+        unlikely(__get_guest(regs->cs, (u32 *)regs->rsp + 2)) )
     {
         domain_crash(v->domain);
         return 0;
@@ -132,7 +132,7 @@ unsigned int compat_iret(void)
      * Fix up and restore EFLAGS. We fix up in a local staging area
      * to avoid firing the BUG_ON(IOPL) check in arch_get_info_guest.
      */
-    if ( unlikely(__get_user(eflags, (u32 *)regs->rsp + 3)) )
+    if ( unlikely(__get_guest(eflags, (u32 *)regs->rsp + 3)) )
     {
         domain_crash(v->domain);
         return 0;
@@ -164,16 +164,16 @@ unsigned int compat_iret(void)
         {
             for (i = 1; i < 10; ++i)
             {
-                rc |= __get_user(x, (u32 *)regs->rsp + i);
-                rc |= __put_user(x, (u32 *)(unsigned long)ksp + i);
+                rc |= __get_guest(x, (u32 *)regs->rsp + i);
+                rc |= __put_guest(x, (u32 *)(unsigned long)ksp + i);
             }
         }
         else if ( ksp > regs->esp )
         {
             for ( i = 9; i > 0; --i )
             {
-                rc |= __get_user(x, (u32 *)regs->rsp + i);
-                rc |= __put_user(x, (u32 *)(unsigned long)ksp + i);
+                rc |= __get_guest(x, (u32 *)regs->rsp + i);
+                rc |= __put_guest(x, (u32 *)(unsigned long)ksp + i);
             }
         }
         if ( rc )
@@ -189,7 +189,7 @@ unsigned int compat_iret(void)
             eflags &= ~X86_EFLAGS_IF;
         regs->eflags &= ~(X86_EFLAGS_VM|X86_EFLAGS_RF|
                           X86_EFLAGS_NT|X86_EFLAGS_TF);
-        if ( unlikely(__put_user(0, (u32 *)regs->rsp)) )
+        if ( unlikely(__put_guest(0, (u32 *)regs->rsp)) )
         {
             domain_crash(v->domain);
             return 0;
@@ -205,8 +205,8 @@ unsigned int compat_iret(void)
     else if ( ring_1(regs) )
         regs->esp += 16;
     /* Return to ring 2/3: restore ESP and SS. */
-    else if ( __get_user(regs->ss, (u32 *)regs->rsp + 5) ||
-              __get_user(regs->esp, (u32 *)regs->rsp + 4) )
+    else if ( __get_guest(regs->ss, (u32 *)regs->rsp + 5) ||
+              __get_guest(regs->esp, (u32 *)regs->rsp + 4) )
     {
         domain_crash(v->domain);
         return 0;
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index a6f1d45e77..c65835844d 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -274,7 +274,7 @@ static void compat_show_guest_stack(struct vcpu *v,
     {
         if ( (((long)stack - 1) ^ ((long)(stack + 1) - 1)) & mask )
             break;
-        if ( __get_user(addr, stack) )
+        if ( __get_guest(addr, stack) )
         {
             if ( i != 0 )
                 printk("\n    ");
@@ -343,7 +343,7 @@ static void show_guest_stack(struct vcpu *v, const struct cpu_user_regs *regs)
     {
         if ( (((long)stack - 1) ^ ((long)(stack + 1) - 1)) & mask )
             break;
-        if ( __get_user(addr, stack) )
+        if ( __get_guest(addr, stack) )
         {
             if ( i != 0 )
                 printk("\n    ");
diff --git a/xen/include/asm-x86/uaccess.h b/xen/include/asm-x86/uaccess.h
index 8411fb9586..570b6b8080 100644
--- a/xen/include/asm-x86/uaccess.h
+++ b/xen/include/asm-x86/uaccess.h
@@ -59,13 +59,11 @@ extern void __put_user_bad(void);
   __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
 
 /**
- * __get_user: - Get a simple variable from user space, with less checking.
+ * __get_guest: - Get a simple variable from guest space, with less checking.
  * @x:   Variable to store result.
- * @ptr: Source address, in user space.
- *
- * Context: User context only.  This function may sleep.
+ * @ptr: Source address, in guest space.
  *
- * This macro copies a single simple variable from user space to kernel
+ * This macro copies a single simple variable from guest space to hypervisor
  * space.  It supports simple types like char and int, but not larger
  * data types like structures or arrays.
  *
@@ -78,17 +76,15 @@ extern void __put_user_bad(void);
  * Returns zero on success, or -EFAULT on error.
  * On error, the variable @x is set to zero.
  */
-#define __get_user(x,ptr) \
-  __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
+#define __get_guest(x, ptr) get_guest_nocheck(x, ptr, sizeof(*(ptr)))
+#define get_unsafe __get_guest
 
 /**
- * __put_user: - Write a simple value into user space, with less checking.
- * @x:   Value to copy to user space.
- * @ptr: Destination address, in user space.
+ * __put_guest: - Write a simple value into guest space, with less checking.
+ * @x:   Value to store in guest space.
+ * @ptr: Destination address, in guest space.
  *
- * Context: User context only.  This function may sleep.
- *
- * This macro copies a single simple value from kernel space to user
+ * This macro copies a single simple value from hypervisor space to guest
  * space.  It supports simple types like char and int, but not larger
  * data types like structures or arrays.
  *
@@ -100,13 +96,14 @@ extern void __put_user_bad(void);
  *
  * Returns zero on success, or -EFAULT on error.
  */
-#define __put_user(x,ptr) \
-  __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
+#define __put_guest(x, ptr) \
+    put_guest_nocheck((__typeof__(*(ptr)))(x), ptr, sizeof(*(ptr)))
+#define put_unsafe __put_guest
 
-#define __put_user_nocheck(x, ptr, size)				\
+#define put_guest_nocheck(x, ptr, size)					\
 ({									\
 	int err_; 							\
-	__put_user_size(x, ptr, size, err_, -EFAULT);			\
+	put_guest_size(x, ptr, size, err_, -EFAULT);			\
 	err_;								\
 })
 
@@ -114,14 +111,14 @@ extern void __put_user_bad(void);
 ({									\
 	__typeof__(*(ptr)) __user *ptr_ = (ptr);			\
 	__typeof__(size) size_ = (size);				\
-	access_ok(ptr_, size_) ? __put_user_nocheck(x, ptr_, size_)	\
+	access_ok(ptr_, size_) ? put_guest_nocheck(x, ptr_, size_)	\
 			       : -EFAULT;				\
 })
 
-#define __get_user_nocheck(x, ptr, size)				\
+#define get_guest_nocheck(x, ptr, size)					\
 ({									\
 	int err_; 							\
-	__get_user_size(x, ptr, size, err_, -EFAULT);			\
+	get_guest_size(x, ptr, size, err_, -EFAULT);			\
 	err_;								\
 })
 
@@ -129,7 +126,7 @@ extern void __put_user_bad(void);
 ({									\
 	__typeof__(*(ptr)) __user *ptr_ = (ptr);			\
 	__typeof__(size) size_ = (size);				\
-	access_ok(ptr_, size_) ? __get_user_nocheck(x, ptr_, size_)	\
+	access_ok(ptr_, size_) ? get_guest_nocheck(x, ptr_, size_)	\
 			       : -EFAULT;				\
 })
 
@@ -141,7 +138,7 @@ struct __large_struct { unsigned long buf[100]; };
  * we do not write to any memory gcc knows about, so there are no
  * aliasing issues.
  */
-#define __put_user_asm(x, addr, err, itype, rtype, ltype, errret)	\
+#define put_unsafe_asm(x, addr, err, itype, rtype, ltype, errret)	\
 	stac();								\
 	__asm__ __volatile__(						\
 		"1:	mov"itype" %"rtype"1,%2\n"			\
@@ -155,7 +152,7 @@ struct __large_struct { unsigned long buf[100]; };
 		: ltype (x), "m"(__m(addr)), "i"(errret), "0"(err));	\
 	clac()
 
-#define __get_user_asm(x, addr, err, itype, rtype, ltype, errret)	\
+#define get_unsafe_asm(x, addr, err, itype, rtype, ltype, errret)	\
 	stac();								\
 	__asm__ __volatile__(						\
 		"1:	mov"itype" %2,%"rtype"1\n"			\
@@ -170,6 +167,34 @@ struct __large_struct { unsigned long buf[100]; };
 		: "m"(__m(addr)), "i"(errret), "0"(err));		\
 	clac()
 
+#define put_unsafe_size(x, ptr, size, retval, errret)                      \
+do {                                                                       \
+    retval = 0;                                                            \
+    switch ( size )                                                        \
+    {                                                                      \
+    case 1: put_unsafe_asm(x, ptr, retval, "b", "b", "iq", errret); break; \
+    case 2: put_unsafe_asm(x, ptr, retval, "w", "w", "ir", errret); break; \
+    case 4: put_unsafe_asm(x, ptr, retval, "l", "k", "ir", errret); break; \
+    case 8: put_unsafe_asm(x, ptr, retval, "q",  "", "ir", errret); break; \
+    default: __put_user_bad();                                             \
+    }                                                                      \
+} while ( false )
+#define put_guest_size put_unsafe_size
+
+#define get_unsafe_size(x, ptr, size, retval, errret)                      \
+do {                                                                       \
+    retval = 0;                                                            \
+    switch ( size )                                                        \
+    {                                                                      \
+    case 1: get_unsafe_asm(x, ptr, retval, "b", "b", "=q", errret); break; \
+    case 2: get_unsafe_asm(x, ptr, retval, "w", "w", "=r", errret); break; \
+    case 4: get_unsafe_asm(x, ptr, retval, "l", "k", "=r", errret); break; \
+    case 8: get_unsafe_asm(x, ptr, retval, "q",  "", "=r", errret); break; \
+    default: __get_user_bad();                                             \
+    }                                                                      \
+} while ( false )
+#define get_guest_size get_unsafe_size
+
 /**
  * __copy_to_user: - Copy a block of data into user space, with less checking
  * @to:   Destination address, in user space.
@@ -192,16 +217,16 @@ __copy_to_user(void __user *to, const void *from, unsigned long n)
 
         switch (n) {
         case 1:
-            __put_user_size(*(const u8 *)from, (u8 __user *)to, 1, ret, 1);
+            put_guest_size(*(const uint8_t *)from, to, 1, ret, 1);
             return ret;
         case 2:
-            __put_user_size(*(const u16 *)from, (u16 __user *)to, 2, ret, 2);
+            put_guest_size(*(const uint16_t *)from, to, 2, ret, 2);
             return ret;
         case 4:
-            __put_user_size(*(const u32 *)from, (u32 __user *)to, 4, ret, 4);
+            put_guest_size(*(const uint32_t *)from, to, 4, ret, 4);
             return ret;
         case 8:
-            __put_user_size(*(const u64 *)from, (u64 __user *)to, 8, ret, 8);
+            put_guest_size(*(const uint64_t *)from, to, 8, ret, 8);
             return ret;
         }
     }
@@ -233,16 +258,16 @@ __copy_from_user(void *to, const void __user *from, unsigned long n)
 
         switch (n) {
         case 1:
-            __get_user_size(*(u8 *)to, from, 1, ret, 1);
+            get_guest_size(*(uint8_t *)to, from, 1, ret, 1);
             return ret;
         case 2:
-            __get_user_size(*(u16 *)to, from, 2, ret, 2);
+            get_guest_size(*(uint16_t *)to, from, 2, ret, 2);
             return ret;
         case 4:
-            __get_user_size(*(u32 *)to, from, 4, ret, 4);
+            get_guest_size(*(uint32_t *)to, from, 4, ret, 4);
             return ret;
         case 8:
-            __get_user_size(*(u64*)to, from, 8, ret, 8);
+            get_guest_size(*(uint64_t *)to, from, 8, ret, 8);
             return ret;
         }
     }
diff --git a/xen/include/asm-x86/x86_64/uaccess.h b/xen/include/asm-x86/x86_64/uaccess.h
index d7dad4f8bc..c48e57bf09 100644
--- a/xen/include/asm-x86/x86_64/uaccess.h
+++ b/xen/include/asm-x86/x86_64/uaccess.h
@@ -57,28 +57,4 @@ extern void *xlat_malloc(unsigned long *xlat_page_current, size_t size);
     (likely((count) < (~0U / (size))) && \
      compat_access_ok(addr, 0 + (count) * (size)))
 
-#define __put_user_size(x,ptr,size,retval,errret)			\
-do {									\
-	retval = 0;							\
-	switch (size) {							\
-	case 1: __put_user_asm(x,ptr,retval,"b","b","iq",errret);break;	\
-	case 2: __put_user_asm(x,ptr,retval,"w","w","ir",errret);break; \
-	case 4: __put_user_asm(x,ptr,retval,"l","k","ir",errret);break;	\
-	case 8: __put_user_asm(x,ptr,retval,"q","","ir",errret);break;	\
-	default: __put_user_bad();					\
-	}								\
-} while (0)
-
-#define __get_user_size(x,ptr,size,retval,errret)			\
-do {									\
-	retval = 0;							\
-	switch (size) {							\
-	case 1: __get_user_asm(x,ptr,retval,"b","b","=q",errret);break;	\
-	case 2: __get_user_asm(x,ptr,retval,"w","w","=r",errret);break;	\
-	case 4: __get_user_asm(x,ptr,retval,"l","k","=r",errret);break;	\
-	case 8: __get_user_asm(x,ptr,retval,"q","","=r",errret); break;	\
-	default: __get_user_bad();					\
-	}								\
-} while (0)
-
 #endif /* __X86_64_UACCESS_H */
diff --git a/xen/test/livepatch/xen_hello_world_func.c b/xen/test/livepatch/xen_hello_world_func.c
index b358224e3e..161066d8c1 100644
--- a/xen/test/livepatch/xen_hello_world_func.c
+++ b/xen/test/livepatch/xen_hello_world_func.c
@@ -26,7 +26,7 @@ const char *xen_hello_world(void)
      * Any BUG, or WARN_ON will contain symbol and payload name. Furthermore
      * exceptions will be caught and processed properly.
      */
-    rc = __get_user(tmp, non_canonical_addr);
+    rc = get_unsafe(tmp, non_canonical_addr);
     BUG_ON(rc != -EFAULT);
 #endif
 #if defined(CONFIG_ARM)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 16:33:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 16:33:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86976.163748 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD8iS-0000z5-Gr; Fri, 19 Feb 2021 16:33:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86976.163748; Fri, 19 Feb 2021 16:33:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD8iS-0000yx-Ds; Fri, 19 Feb 2021 16:33:16 +0000
Received: by outflank-mailman (input) for mailman id 86976;
 Fri, 19 Feb 2021 16:33:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD8iR-0000yq-MP
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16:33:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD8iR-0004cE-Lc
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD8iR-0001fh-Kg
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16:33:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0AQbOV6vxTKUPsTKdH6WJ0FAVguC30WCIgGpjLCMKfM=; b=f1kcL2KvdThxdR3GJyNpE+TjxM
	S6nzn4gKfq1KKKtnqv5gBMWiqaM8QzR9EtIF8xnLBdTzHj5cWYKdM0oIhvUYYHcgj4xjwm+6WufzI
	bm627KIwgINpWLWMaaKeiGsxR32ypfloOKuUmRz58Z4OCmQpedoi4xN8y7V/RWxqokM8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: split __copy_{from,to}_user() into "guest" and "unsafe" variants
Message-Id: <E1lD8iR-0001fh-Kg@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 16:33:15 +0000

commit 2d824791504f4119f04f95bafffec2e37d319c25
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 19 17:19:19 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 19 17:19:19 2021 +0100

    x86: split __copy_{from,to}_user() into "guest" and "unsafe" variants
    
    The "guest" variants are intended to work with (potentially) fully guest
    controlled addresses, while the "unsafe" variants are intended to be
    used in order to access addresses not (directly) under guest control,
    within Xen's part of virtual address space. Subsequently we will want
    them to have distinct behavior, so as first step identify which one is
    which. For now, both groups of constructs alias one another.
    
    Double underscore prefixes are retained only on
    __copy_{from,to}_guest_pv(), to allow still distinguishing them from
    their "checking" counterparts once they also get renamed (to
    copy_{from,to}_guest_pv()).
    
    Add previously missing __user at some call sites.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org> [shadow]
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/gdbstub.c             |  4 ++--
 xen/arch/x86/mm/shadow/multi.c     | 16 ++++++++--------
 xen/arch/x86/pv/emul-gate-op.c     |  4 ++--
 xen/arch/x86/pv/emul-priv-op.c     | 10 ++++++----
 xen/arch/x86/pv/mm.c               |  2 +-
 xen/arch/x86/pv/mm.h               |  2 +-
 xen/arch/x86/pv/ro-page-fault.c    |  2 +-
 xen/arch/x86/traps.c               |  2 +-
 xen/arch/x86/usercopy.c            |  4 ++--
 xen/include/asm-x86/guest_access.h |  4 ++--
 xen/include/asm-x86/uaccess.h      | 28 ++++++++++++++--------------
 11 files changed, 40 insertions(+), 38 deletions(-)

diff --git a/xen/arch/x86/gdbstub.c b/xen/arch/x86/gdbstub.c
index ff9f7f9a69..8f4f49fd3b 100644
--- a/xen/arch/x86/gdbstub.c
+++ b/xen/arch/x86/gdbstub.c
@@ -33,13 +33,13 @@ gdb_arch_signal_num(struct cpu_user_regs *regs, unsigned long cookie)
 unsigned int
 gdb_arch_copy_from_user(void *dest, const void *src, unsigned len)
 {
-    return __copy_from_user(dest, src, len);
+    return copy_from_unsafe(dest, src, len);
 }
 
 unsigned int 
 gdb_arch_copy_to_user(void *dest, const void *src, unsigned len)
 {
-    return __copy_to_user(dest, src, len);
+    return copy_to_unsafe(dest, src, len);
 }
 
 void
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 36f548b554..797ebde586 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -2614,7 +2614,7 @@ static int sh_page_fault(struct vcpu *v,
         {
             shadow_l2e_t sl2e;
             mfn_t gl1mfn;
-            if ( (__copy_from_user(&sl2e,
+            if ( (copy_from_unsafe(&sl2e,
                                    (sh_linear_l2_table(v)
                                     + shadow_l2_linear_offset(va)),
                                    sizeof(sl2e)) != 0)
@@ -2633,7 +2633,7 @@ static int sh_page_fault(struct vcpu *v,
 #endif /* SHOPT_OUT_OF_SYNC */
         /* The only reasons for reserved bits to be set in shadow entries
          * are the two "magic" shadow_l1e entries. */
-        if ( likely((__copy_from_user(&sl1e,
+        if ( likely((copy_from_unsafe(&sl1e,
                                       (sh_linear_l1_table(v)
                                        + shadow_l1_linear_offset(va)),
                                       sizeof(sl1e)) == 0)
@@ -3308,10 +3308,10 @@ static bool sh_invlpg(struct vcpu *v, unsigned long linear)
                    sh_linear_l4_table(v)[shadow_l4_linear_offset(linear)])
                & _PAGE_PRESENT) )
             return false;
-        /* This must still be a copy-from-user because we don't have the
+        /* This must still be a copy-from-unsafe because we don't have the
          * paging lock, and the higher-level shadows might disappear
          * under our feet. */
-        if ( __copy_from_user(&sl3e, (sh_linear_l3_table(v)
+        if ( copy_from_unsafe(&sl3e, (sh_linear_l3_table(v)
                                       + shadow_l3_linear_offset(linear)),
                               sizeof (sl3e)) != 0 )
         {
@@ -3330,9 +3330,9 @@ static bool sh_invlpg(struct vcpu *v, unsigned long linear)
         return false;
 #endif
 
-    /* This must still be a copy-from-user because we don't have the shadow
+    /* This must still be a copy-from-unsafe because we don't have the shadow
      * lock, and the higher-level shadows might disappear under our feet. */
-    if ( __copy_from_user(&sl2e,
+    if ( copy_from_unsafe(&sl2e,
                           sh_linear_l2_table(v) + shadow_l2_linear_offset(linear),
                           sizeof (sl2e)) != 0 )
     {
@@ -3371,11 +3371,11 @@ static bool sh_invlpg(struct vcpu *v, unsigned long linear)
              * hold the paging lock yet.  Check again with the lock held. */
             paging_lock(d);
 
-            /* This must still be a copy-from-user because we didn't
+            /* This must still be a copy-from-unsafe because we didn't
              * have the paging lock last time we checked, and the
              * higher-level shadows might have disappeared under our
              * feet. */
-            if ( __copy_from_user(&sl2e,
+            if ( copy_from_unsafe(&sl2e,
                                   sh_linear_l2_table(v)
                                   + shadow_l2_linear_offset(linear),
                                   sizeof (sl2e)) != 0 )
diff --git a/xen/arch/x86/pv/emul-gate-op.c b/xen/arch/x86/pv/emul-gate-op.c
index 90a0a47aef..43d847abd0 100644
--- a/xen/arch/x86/pv/emul-gate-op.c
+++ b/xen/arch/x86/pv/emul-gate-op.c
@@ -149,12 +149,12 @@ static int read_mem(enum x86_segment seg, unsigned long offset, void *p_data,
 
     addr = (uint32_t)addr;
 
-    if ( (rc = __copy_from_user(p_data, (void *)addr, bytes)) )
+    if ( (rc = __copy_from_guest_pv(p_data, (void __user *)addr, bytes)) )
     {
         /*
          * TODO: This should report PFEC_insn_fetch when goc->insn_fetch &&
          * cpu_has_nx, but we'd then need a "fetch" variant of
-         * __copy_from_user() respecting NX, SMEP, and protection keys.
+         * __copy_from_guest_pv() respecting NX, SMEP, and protection keys.
          */
         x86_emul_pagefault(0, addr + bytes - rc, ctxt);
         return X86EMUL_EXCEPTION;
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index dbceed8a05..e5a22b9347 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -649,7 +649,8 @@ static int rep_ins(uint16_t port,
         if ( rc != X86EMUL_OKAY )
             return rc;
 
-        if ( (rc = __copy_to_user((void *)addr, &data, bytes_per_rep)) != 0 )
+        if ( (rc = __copy_to_guest_pv((void __user *)addr, &data,
+                                      bytes_per_rep)) != 0 )
         {
             x86_emul_pagefault(PFEC_write_access,
                                addr + bytes_per_rep - rc, ctxt);
@@ -716,7 +717,8 @@ static int rep_outs(enum x86_segment seg, unsigned long offset,
         if ( rc != X86EMUL_OKAY )
             return rc;
 
-        if ( (rc = __copy_from_user(&data, (void *)addr, bytes_per_rep)) != 0 )
+        if ( (rc = __copy_from_guest_pv(&data, (void __user *)addr,
+                                        bytes_per_rep)) != 0 )
         {
             x86_emul_pagefault(0, addr + bytes_per_rep - rc, ctxt);
             return X86EMUL_EXCEPTION;
@@ -1253,12 +1255,12 @@ static int insn_fetch(enum x86_segment seg,
     if ( rc != X86EMUL_OKAY )
         return rc;
 
-    if ( (rc = __copy_from_user(p_data, (void *)addr, bytes)) != 0 )
+    if ( (rc = __copy_from_guest_pv(p_data, (void __user *)addr, bytes)) != 0 )
     {
         /*
          * TODO: This should report PFEC_insn_fetch when goc->insn_fetch &&
          * cpu_has_nx, but we'd then need a "fetch" variant of
-         * __copy_from_user() respecting NX, SMEP, and protection keys.
+         * __copy_from_guest_pv() respecting NX, SMEP, and protection keys.
          */
         x86_emul_pagefault(0, addr + bytes - rc, ctxt);
         return X86EMUL_EXCEPTION;
diff --git a/xen/arch/x86/pv/mm.c b/xen/arch/x86/pv/mm.c
index 5d74d11cba..cb86143832 100644
--- a/xen/arch/x86/pv/mm.c
+++ b/xen/arch/x86/pv/mm.c
@@ -41,7 +41,7 @@ l1_pgentry_t *map_guest_l1e(unsigned long linear, mfn_t *gl1mfn)
         return NULL;
 
     /* Find this l1e and its enclosing l1mfn in the linear map. */
-    if ( __copy_from_user(&l2e,
+    if ( copy_from_unsafe(&l2e,
                           &__linear_l2_table[l2_linear_offset(linear)],
                           sizeof(l2_pgentry_t)) )
         return NULL;
diff --git a/xen/arch/x86/pv/mm.h b/xen/arch/x86/pv/mm.h
index a11cc88e5a..7e2259c488 100644
--- a/xen/arch/x86/pv/mm.h
+++ b/xen/arch/x86/pv/mm.h
@@ -22,7 +22,7 @@ static inline l1_pgentry_t guest_get_eff_kern_l1e(unsigned long linear)
         toggle_guest_pt(curr);
 
     if ( unlikely(!__addr_ok(linear)) ||
-         __copy_from_user(&l1e,
+         copy_from_unsafe(&l1e,
                           &__linear_l1_table[l1_linear_offset(linear)],
                           sizeof(l1_pgentry_t)) )
         l1e = l1e_empty();
diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c
index 8d0007ede5..5d2dd9fae0 100644
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -43,7 +43,7 @@ static int ptwr_emulated_read(enum x86_segment seg, unsigned long offset,
     unsigned long addr = offset;
 
     if ( !__addr_ok(addr) ||
-         (rc = __copy_from_user(p_data, (void *)addr, bytes)) )
+         (rc = __copy_from_guest_pv(p_data, (void *)addr, bytes)) )
     {
         x86_emul_pagefault(0, addr + bytes - rc, ctxt);  /* Read fault. */
         return X86EMUL_EXCEPTION;
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index c65835844d..3c2e563cce 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1103,7 +1103,7 @@ void do_invalid_op(struct cpu_user_regs *regs)
     }
 
     if ( !is_active_kernel_text(regs->rip) ||
-         __copy_from_user(bug_insn, eip, sizeof(bug_insn)) ||
+         copy_from_unsafe(bug_insn, eip, sizeof(bug_insn)) ||
          memcmp(bug_insn, "\xf\xb", sizeof(bug_insn)) )
         goto die;
 
diff --git a/xen/arch/x86/usercopy.c b/xen/arch/x86/usercopy.c
index 1d1ef075c9..84f83d2a46 100644
--- a/xen/arch/x86/usercopy.c
+++ b/xen/arch/x86/usercopy.c
@@ -110,7 +110,7 @@ unsigned __copy_from_user_ll(void *to, const void __user *from, unsigned n)
 unsigned copy_to_user(void __user *to, const void *from, unsigned n)
 {
     if ( access_ok(to, n) )
-        n = __copy_to_user(to, from, n);
+        n = __copy_to_guest_pv(to, from, n);
     return n;
 }
 
@@ -168,7 +168,7 @@ unsigned clear_user(void __user *to, unsigned n)
 unsigned copy_from_user(void *to, const void __user *from, unsigned n)
 {
     if ( access_ok(from, n) )
-        n = __copy_from_user(to, from, n);
+        n = __copy_from_guest_pv(to, from, n);
     else
         memset(to, 0, n);
     return n;
diff --git a/xen/include/asm-x86/guest_access.h b/xen/include/asm-x86/guest_access.h
index 8f0e2c71f1..45e28f3220 100644
--- a/xen/include/asm-x86/guest_access.h
+++ b/xen/include/asm-x86/guest_access.h
@@ -28,11 +28,11 @@
 #define __raw_copy_to_guest(dst, src, len)      \
     (is_hvm_vcpu(current) ?                     \
      copy_to_user_hvm((dst), (src), (len)) :    \
-     __copy_to_user((dst), (src), (len)))
+     __copy_to_guest_pv(dst, src, len))
 #define __raw_copy_from_guest(dst, src, len)    \
     (is_hvm_vcpu(current) ?                     \
      copy_from_user_hvm((dst), (src), (len)) :  \
-     __copy_from_user((dst), (src), (len)))
+     __copy_from_guest_pv(dst, src, len))
 #define __raw_clear_guest(dst,  len)            \
     (is_hvm_vcpu(current) ?                     \
      clear_user_hvm((dst), (len)) :             \
diff --git a/xen/include/asm-x86/uaccess.h b/xen/include/asm-x86/uaccess.h
index 570b6b8080..db0802c4be 100644
--- a/xen/include/asm-x86/uaccess.h
+++ b/xen/include/asm-x86/uaccess.h
@@ -196,21 +196,20 @@ do {                                                                       \
 #define get_guest_size get_unsafe_size
 
 /**
- * __copy_to_user: - Copy a block of data into user space, with less checking
- * @to:   Destination address, in user space.
- * @from: Source address, in kernel space.
+ * __copy_to_guest_pv: - Copy a block of data into guest space, with less
+ *                       checking
+ * @to:   Destination address, in guest space.
+ * @from: Source address, in hypervisor space.
  * @n:    Number of bytes to copy.
  *
- * Context: User context only.  This function may sleep.
- *
- * Copy data from kernel space to user space.  Caller must check
+ * Copy data from hypervisor space to guest space.  Caller must check
  * the specified block with access_ok() before calling this function.
  *
  * Returns number of bytes that could not be copied.
  * On success, this will be zero.
  */
 static always_inline unsigned long
-__copy_to_user(void __user *to, const void *from, unsigned long n)
+__copy_to_guest_pv(void __user *to, const void *from, unsigned long n)
 {
     if (__builtin_constant_p(n)) {
         unsigned long ret;
@@ -232,16 +231,16 @@ __copy_to_user(void __user *to, const void *from, unsigned long n)
     }
     return __copy_to_user_ll(to, from, n);
 }
+#define copy_to_unsafe __copy_to_guest_pv
 
 /**
- * __copy_from_user: - Copy a block of data from user space, with less checking
- * @to:   Destination address, in kernel space.
- * @from: Source address, in user space.
+ * __copy_from_guest_pv: - Copy a block of data from guest space, with less
+ *                         checking
+ * @to:   Destination address, in hypervisor space.
+ * @from: Source address, in guest space.
  * @n:    Number of bytes to copy.
  *
- * Context: User context only.  This function may sleep.
- *
- * Copy data from user space to kernel space.  Caller must check
+ * Copy data from guest space to hypervisor space.  Caller must check
  * the specified block with access_ok() before calling this function.
  *
  * Returns number of bytes that could not be copied.
@@ -251,7 +250,7 @@ __copy_to_user(void __user *to, const void *from, unsigned long n)
  * data to the requested size using zero bytes.
  */
 static always_inline unsigned long
-__copy_from_user(void *to, const void __user *from, unsigned long n)
+__copy_from_guest_pv(void *to, const void __user *from, unsigned long n)
 {
     if (__builtin_constant_p(n)) {
         unsigned long ret;
@@ -273,6 +272,7 @@ __copy_from_user(void *to, const void __user *from, unsigned long n)
     }
     return __copy_from_user_ll(to, from, n);
 }
+#define copy_from_unsafe __copy_from_guest_pv
 
 /*
  * The exception table consists of pairs of addresses: the first is the
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 16:33:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 16:33:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86977.163752 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD8ic-00010T-K1; Fri, 19 Feb 2021 16:33:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86977.163752; Fri, 19 Feb 2021 16:33:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD8ic-00010L-Gw; Fri, 19 Feb 2021 16:33:26 +0000
Received: by outflank-mailman (input) for mailman id 86977;
 Fri, 19 Feb 2021 16:33:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD8ib-00010F-Pz
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16:33:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD8ib-0004cM-PC
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD8ib-0001gY-Nv
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16:33:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DZ8XW3MO5IQ0F7Cr2/Sr1bc5AVqoDtF2SiEC4AJ7wjg=; b=uLxs6IUplGAgmdgo4K1/eox9Uy
	1vrwQgWxWF7cg6yet4eoaX66tvq5PxtVOQ9nTVPRmzGeoWaC0OWxLWxo5HO9EPEzVsJuFS2Zzt8y7
	6tMRy/TL6X1UUrydn739QCWHh2DbTr8N8e9jqrIxxjQmT/LcEbwAucgMD7n3cHq2Dh+k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/PV: harden guest memory accesses against speculative abuse
Message-Id: <E1lD8ib-0001gY-Nv@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 16:33:25 +0000

commit 4dc1815991420b809ce18dddfdf9c0af48944204
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 19 17:19:56 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 19 17:19:56 2021 +0100

    x86/PV: harden guest memory accesses against speculative abuse
    
    Inspired by
    https://lore.kernel.org/lkml/f12e7d3cecf41b2c29734ea45a393be21d4a8058.1597848273.git.jpoimboe@redhat.com/
    and prior work in that area of x86 Linux, suppress speculation with
    guest specified pointer values by suitably masking the addresses to
    non-canonical space in case they fall into Xen's virtual address range.
    
    Introduce a new Kconfig control.
    
    Note that it is necessary in such code to avoid using "m" kind operands:
    If we didn't, there would be no guarantee that the register passed to
    guest_access_mask_ptr is also the (base) one used for the memory access.
    
    As a minor unrelated change in get_unsafe_asm() the unnecessary "itype"
    parameter gets dropped and the XOR on the fixup path gets changed to be
    a 32-bit one in all cases: This way we avoid pointless REX.W or operand
    size overrides, or writes to partial registers.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/usercopy.c         |  34 +++++++-
 xen/arch/x86/x86_64/entry.S     |   2 +
 xen/common/Kconfig              |  18 ++++
 xen/include/asm-x86/asm-defns.h |  20 +++++
 xen/include/asm-x86/uaccess.h   | 182 +++++++++++++++++++++++++++++++++-------
 5 files changed, 222 insertions(+), 34 deletions(-)

diff --git a/xen/arch/x86/usercopy.c b/xen/arch/x86/usercopy.c
index 84f83d2a46..b17d680dde 100644
--- a/xen/arch/x86/usercopy.c
+++ b/xen/arch/x86/usercopy.c
@@ -10,12 +10,19 @@
 #include <xen/sched.h>
 #include <asm/uaccess.h>
 
-unsigned __copy_to_user_ll(void __user *to, const void *from, unsigned n)
+#ifndef GUARD
+# define GUARD UA_KEEP
+#endif
+
+unsigned int copy_to_guest_ll(void __user *to, const void *from, unsigned int n)
 {
     unsigned dummy;
 
     stac();
     asm volatile (
+        GUARD(
+        "    guest_access_mask_ptr %[to], %q[scratch1], %q[scratch2]\n"
+        )
         "    cmp  $"STR(2*BYTES_PER_LONG-1)", %[cnt]\n"
         "    jbe  1f\n"
         "    mov  %k[to], %[cnt]\n"
@@ -42,6 +49,7 @@ unsigned __copy_to_user_ll(void __user *to, const void *from, unsigned n)
         _ASM_EXTABLE(1b, 2b)
         : [cnt] "+c" (n), [to] "+D" (to), [from] "+S" (from),
           [aux] "=&r" (dummy)
+          GUARD(, [scratch1] "=&r" (dummy), [scratch2] "=&r" (dummy))
         : "[aux]" (n)
         : "memory" );
     clac();
@@ -49,12 +57,15 @@ unsigned __copy_to_user_ll(void __user *to, const void *from, unsigned n)
     return n;
 }
 
-unsigned __copy_from_user_ll(void *to, const void __user *from, unsigned n)
+unsigned int copy_from_guest_ll(void *to, const void __user *from, unsigned int n)
 {
     unsigned dummy;
 
     stac();
     asm volatile (
+        GUARD(
+        "    guest_access_mask_ptr %[from], %q[scratch1], %q[scratch2]\n"
+        )
         "    cmp  $"STR(2*BYTES_PER_LONG-1)", %[cnt]\n"
         "    jbe  1f\n"
         "    mov  %k[to], %[cnt]\n"
@@ -87,6 +98,7 @@ unsigned __copy_from_user_ll(void *to, const void __user *from, unsigned n)
         _ASM_EXTABLE(1b, 6b)
         : [cnt] "+c" (n), [to] "+D" (to), [from] "+S" (from),
           [aux] "=&r" (dummy)
+          GUARD(, [scratch1] "=&r" (dummy), [scratch2] "=&r" (dummy))
         : "[aux]" (n)
         : "memory" );
     clac();
@@ -94,6 +106,8 @@ unsigned __copy_from_user_ll(void *to, const void __user *from, unsigned n)
     return n;
 }
 
+#if GUARD(1) + 0
+
 /**
  * copy_to_user: - Copy a block of data into user space.
  * @to:   Destination address, in user space.
@@ -128,8 +142,11 @@ unsigned clear_user(void __user *to, unsigned n)
 {
     if ( access_ok(to, n) )
     {
+        long dummy;
+
         stac();
         asm volatile (
+            "    guest_access_mask_ptr %[to], %[scratch1], %[scratch2]\n"
             "0:  rep stos"__OS"\n"
             "    mov  %[bytes], %[cnt]\n"
             "1:  rep stosb\n"
@@ -140,7 +157,8 @@ unsigned clear_user(void __user *to, unsigned n)
             ".previous\n"
             _ASM_EXTABLE(0b,3b)
             _ASM_EXTABLE(1b,2b)
-            : [cnt] "=&c" (n), [to] "+D" (to)
+            : [cnt] "=&c" (n), [to] "+D" (to), [scratch1] "=&r" (dummy),
+              [scratch2] "=&r" (dummy)
             : [bytes] "r" (n & (BYTES_PER_LONG - 1)),
               [longs] "0" (n / BYTES_PER_LONG), "a" (0) );
         clac();
@@ -174,6 +192,16 @@ unsigned copy_from_user(void *to, const void __user *from, unsigned n)
     return n;
 }
 
+# undef GUARD
+# define GUARD UA_DROP
+# define copy_to_guest_ll copy_to_unsafe_ll
+# define copy_from_guest_ll copy_from_unsafe_ll
+# undef __user
+# define __user
+# include __FILE__
+
+#endif /* GUARD(1) */
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 6422687fbf..e2ff4a9018 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -458,6 +458,8 @@ UNLIKELY_START(g, create_bounce_frame_bad_sp)
         jmp   asm_domain_crash_synchronous  /* Does not return */
 __UNLIKELY_END(create_bounce_frame_bad_sp)
 
+        guest_access_mask_ptr %rsi, %rax, %rcx
+
 #define STORE_GUEST_STACK(reg, n) \
 0:      movq  %reg,(n)*8(%rsi); \
         _ASM_EXTABLE(0b, domain_crash_page_fault_ ## n ## x8)
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 1f658cfac3..eb953d171e 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -111,6 +111,24 @@ config SPECULATIVE_HARDEN_BRANCH
 
 	  If unsure, say Y.
 
+config SPECULATIVE_HARDEN_GUEST_ACCESS
+	bool "Speculative PV Guest Memory Access Hardening"
+	default y
+	depends on PV
+	help
+	  Contemporary processors may use speculative execution as a
+	  performance optimisation, but this can potentially be abused by an
+	  attacker to leak data via speculative sidechannels.
+
+	  One source of data leakage is via speculative accesses to hypervisor
+	  memory through guest controlled values used to access guest memory.
+
+	  When enabled, code paths accessing PV guest memory will have guest
+	  controlled addresses massaged such that memory accesses through them
+	  won't touch hypervisor address space.
+
+	  If unsure, say Y.
+
 endmenu
 
 config HYPFS
diff --git a/xen/include/asm-x86/asm-defns.h b/xen/include/asm-x86/asm-defns.h
index 2e3ec0ac01..505f39ad5f 100644
--- a/xen/include/asm-x86/asm-defns.h
+++ b/xen/include/asm-x86/asm-defns.h
@@ -56,3 +56,23 @@
 .macro INDIRECT_JMP arg:req
     INDIRECT_BRANCH jmp \arg
 .endm
+
+.macro guest_access_mask_ptr ptr:req, scratch1:req, scratch2:req
+#if defined(CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS)
+    /*
+     * Here we want
+     *
+     * ptr &= ~0ull >> (ptr < HYPERVISOR_VIRT_END);
+     *
+     * but guaranteed without any conditional branches (hence in assembly).
+     */
+    mov $(HYPERVISOR_VIRT_END - 1), \scratch1
+    mov $~0, \scratch2
+    cmp \ptr, \scratch1
+    rcr $1, \scratch2
+    and \scratch2, \ptr
+#elif defined(CONFIG_DEBUG) && defined(CONFIG_PV)
+    xor $~\@, \scratch1
+    xor $~\@, \scratch2
+#endif
+.endm
diff --git a/xen/include/asm-x86/uaccess.h b/xen/include/asm-x86/uaccess.h
index db0802c4be..f55c2f8729 100644
--- a/xen/include/asm-x86/uaccess.h
+++ b/xen/include/asm-x86/uaccess.h
@@ -12,13 +12,19 @@
 unsigned copy_to_user(void *to, const void *from, unsigned len);
 unsigned clear_user(void *to, unsigned len);
 unsigned copy_from_user(void *to, const void *from, unsigned len);
+
 /* Handles exceptions in both to and from, but doesn't do access_ok */
-unsigned __copy_to_user_ll(void __user*to, const void *from, unsigned n);
-unsigned __copy_from_user_ll(void *to, const void __user *from, unsigned n);
+unsigned int copy_to_guest_ll(void __user*to, const void *from, unsigned int n);
+unsigned int copy_from_guest_ll(void *to, const void __user *from, unsigned int n);
+unsigned int copy_to_unsafe_ll(void *to, const void *from, unsigned int n);
+unsigned int copy_from_unsafe_ll(void *to, const void *from, unsigned int n);
 
 extern long __get_user_bad(void);
 extern void __put_user_bad(void);
 
+#define UA_KEEP(args...) args
+#define UA_DROP(args...)
+
 /**
  * get_user: - Get a simple variable from user space.
  * @x:   Variable to store result.
@@ -77,7 +83,6 @@ extern void __put_user_bad(void);
  * On error, the variable @x is set to zero.
  */
 #define __get_guest(x, ptr) get_guest_nocheck(x, ptr, sizeof(*(ptr)))
-#define get_unsafe __get_guest
 
 /**
  * __put_guest: - Write a simple value into guest space, with less checking.
@@ -98,7 +103,13 @@ extern void __put_user_bad(void);
  */
 #define __put_guest(x, ptr) \
     put_guest_nocheck((__typeof__(*(ptr)))(x), ptr, sizeof(*(ptr)))
-#define put_unsafe __put_guest
+
+#define put_unsafe(x, ptr)						\
+({									\
+	int err_; 							\
+	put_unsafe_size(x, ptr, sizeof(*(ptr)), UA_DROP, err_, -EFAULT);\
+	err_;								\
+})
 
 #define put_guest_nocheck(x, ptr, size)					\
 ({									\
@@ -115,6 +126,13 @@ extern void __put_user_bad(void);
 			       : -EFAULT;				\
 })
 
+#define get_unsafe(x, ptr)						\
+({									\
+	int err_; 							\
+	get_unsafe_size(x, ptr, sizeof(*(ptr)), UA_DROP, err_, -EFAULT);\
+	err_;								\
+})
+
 #define get_guest_nocheck(x, ptr, size)					\
 ({									\
 	int err_; 							\
@@ -138,62 +156,87 @@ struct __large_struct { unsigned long buf[100]; };
  * we do not write to any memory gcc knows about, so there are no
  * aliasing issues.
  */
-#define put_unsafe_asm(x, addr, err, itype, rtype, ltype, errret)	\
+#define put_unsafe_asm(x, addr, GUARD, err, itype, rtype, ltype, errret) \
 	stac();								\
 	__asm__ __volatile__(						\
-		"1:	mov"itype" %"rtype"1,%2\n"			\
+		GUARD(							\
+		"	guest_access_mask_ptr %[ptr], %[scr1], %[scr2]\n" \
+		)							\
+		"1:	mov"itype" %"rtype"[val], (%[ptr])\n"		\
 		"2:\n"							\
 		".section .fixup,\"ax\"\n"				\
-		"3:	mov %3,%0\n"					\
+		"3:	mov %[errno], %[ret]\n"				\
 		"	jmp 2b\n"					\
 		".previous\n"						\
 		_ASM_EXTABLE(1b, 3b)					\
-		: "=r"(err)						\
-		: ltype (x), "m"(__m(addr)), "i"(errret), "0"(err));	\
+		: [ret] "+r" (err), [ptr] "=&r" (dummy_)		\
+		  GUARD(, [scr1] "=&r" (dummy_), [scr2] "=&r" (dummy_))	\
+		: [val] ltype (x), "m" (__m(addr)),			\
+		  "[ptr]" (addr), [errno] "i" (errret));		\
 	clac()
 
-#define get_unsafe_asm(x, addr, err, itype, rtype, ltype, errret)	\
+#define get_unsafe_asm(x, addr, GUARD, err, rtype, ltype, errret)	\
 	stac();								\
 	__asm__ __volatile__(						\
-		"1:	mov"itype" %2,%"rtype"1\n"			\
+		GUARD(							\
+		"	guest_access_mask_ptr %[ptr], %[scr1], %[scr2]\n" \
+		)							\
+		"1:	mov (%[ptr]), %"rtype"[val]\n"			\
 		"2:\n"							\
 		".section .fixup,\"ax\"\n"				\
-		"3:	mov %3,%0\n"					\
-		"	xor"itype" %"rtype"1,%"rtype"1\n"		\
+		"3:	mov %[errno], %[ret]\n"				\
+		"	xor %k[val], %k[val]\n"				\
 		"	jmp 2b\n"					\
 		".previous\n"						\
 		_ASM_EXTABLE(1b, 3b)					\
-		: "=r"(err), ltype (x)					\
-		: "m"(__m(addr)), "i"(errret), "0"(err));		\
+		: [ret] "+r" (err), [val] ltype (x),			\
+		  [ptr] "=&r" (dummy_)					\
+		  GUARD(, [scr1] "=&r" (dummy_), [scr2] "=&r" (dummy_))	\
+		: "m" (__m(addr)), "[ptr]" (addr),			\
+		  [errno] "i" (errret));				\
 	clac()
 
-#define put_unsafe_size(x, ptr, size, retval, errret)                      \
+#define put_unsafe_size(x, ptr, size, grd, retval, errret)                 \
 do {                                                                       \
     retval = 0;                                                            \
     switch ( size )                                                        \
     {                                                                      \
-    case 1: put_unsafe_asm(x, ptr, retval, "b", "b", "iq", errret); break; \
-    case 2: put_unsafe_asm(x, ptr, retval, "w", "w", "ir", errret); break; \
-    case 4: put_unsafe_asm(x, ptr, retval, "l", "k", "ir", errret); break; \
-    case 8: put_unsafe_asm(x, ptr, retval, "q",  "", "ir", errret); break; \
+    long dummy_;                                                           \
+    case 1:                                                                \
+        put_unsafe_asm(x, ptr, grd, retval, "b", "b", "iq", errret);       \
+        break;                                                             \
+    case 2:                                                                \
+        put_unsafe_asm(x, ptr, grd, retval, "w", "w", "ir", errret);       \
+        break;                                                             \
+    case 4:                                                                \
+        put_unsafe_asm(x, ptr, grd, retval, "l", "k", "ir", errret);       \
+        break;                                                             \
+    case 8:                                                                \
+        put_unsafe_asm(x, ptr, grd, retval, "q",  "", "ir", errret);       \
+        break;                                                             \
     default: __put_user_bad();                                             \
     }                                                                      \
 } while ( false )
-#define put_guest_size put_unsafe_size
 
-#define get_unsafe_size(x, ptr, size, retval, errret)                      \
+#define put_guest_size(x, ptr, size, retval, errret) \
+    put_unsafe_size(x, ptr, size, UA_KEEP, retval, errret)
+
+#define get_unsafe_size(x, ptr, size, grd, retval, errret)                 \
 do {                                                                       \
     retval = 0;                                                            \
     switch ( size )                                                        \
     {                                                                      \
-    case 1: get_unsafe_asm(x, ptr, retval, "b", "b", "=q", errret); break; \
-    case 2: get_unsafe_asm(x, ptr, retval, "w", "w", "=r", errret); break; \
-    case 4: get_unsafe_asm(x, ptr, retval, "l", "k", "=r", errret); break; \
-    case 8: get_unsafe_asm(x, ptr, retval, "q",  "", "=r", errret); break; \
+    long dummy_;                                                           \
+    case 1: get_unsafe_asm(x, ptr, grd, retval, "b", "=q", errret); break; \
+    case 2: get_unsafe_asm(x, ptr, grd, retval, "w", "=r", errret); break; \
+    case 4: get_unsafe_asm(x, ptr, grd, retval, "k", "=r", errret); break; \
+    case 8: get_unsafe_asm(x, ptr, grd, retval,  "", "=r", errret); break; \
     default: __get_user_bad();                                             \
     }                                                                      \
 } while ( false )
-#define get_guest_size get_unsafe_size
+
+#define get_guest_size(x, ptr, size, retval, errret)                       \
+    get_unsafe_size(x, ptr, size, UA_KEEP, retval, errret)
 
 /**
  * __copy_to_guest_pv: - Copy a block of data into guest space, with less
@@ -229,9 +272,8 @@ __copy_to_guest_pv(void __user *to, const void *from, unsigned long n)
             return ret;
         }
     }
-    return __copy_to_user_ll(to, from, n);
+    return copy_to_guest_ll(to, from, n);
 }
-#define copy_to_unsafe __copy_to_guest_pv
 
 /**
  * __copy_from_guest_pv: - Copy a block of data from guest space, with less
@@ -270,9 +312,87 @@ __copy_from_guest_pv(void *to, const void __user *from, unsigned long n)
             return ret;
         }
     }
-    return __copy_from_user_ll(to, from, n);
+    return copy_from_guest_ll(to, from, n);
+}
+
+/**
+ * copy_to_unsafe: - Copy a block of data to unsafe space, with exception
+ *                   checking
+ * @to:   Unsafe destination address.
+ * @from: Safe source address, in hypervisor space.
+ * @n:    Number of bytes to copy.
+ *
+ * Copy data from hypervisor space to a potentially unmapped area.
+ *
+ * Returns number of bytes that could not be copied.
+ * On success, this will be zero.
+ */
+static always_inline unsigned int
+copy_to_unsafe(void __user *to, const void *from, unsigned int n)
+{
+    if (__builtin_constant_p(n)) {
+        unsigned long ret;
+
+        switch (n) {
+        case 1:
+            put_unsafe_size(*(const uint8_t *)from, to, 1, UA_DROP, ret, 1);
+            return ret;
+        case 2:
+            put_unsafe_size(*(const uint16_t *)from, to, 2, UA_DROP, ret, 2);
+            return ret;
+        case 4:
+            put_unsafe_size(*(const uint32_t *)from, to, 4, UA_DROP, ret, 4);
+            return ret;
+        case 8:
+            put_unsafe_size(*(const uint64_t *)from, to, 8, UA_DROP, ret, 8);
+            return ret;
+        }
+    }
+
+    return copy_to_unsafe_ll(to, from, n);
+}
+
+/**
+ * copy_from_unsafe: - Copy a block of data from unsafe space, with exception
+ *                     checking
+ * @to:   Safe destination address, in hypervisor space.
+ * @from: Unsafe source address.
+ * @n:    Number of bytes to copy.
+ *
+ * Copy data from a potentially unmapped area space to hypervisor space.
+ *
+ * Returns number of bytes that could not be copied.
+ * On success, this will be zero.
+ *
+ * If some data could not be copied, this function will pad the copied
+ * data to the requested size using zero bytes.
+ */
+static always_inline unsigned int
+copy_from_unsafe(void *to, const void __user *from, unsigned int n)
+{
+    if ( __builtin_constant_p(n) )
+    {
+        unsigned long ret;
+
+        switch ( n )
+        {
+        case 1:
+            get_unsafe_size(*(uint8_t *)to, from, 1, UA_DROP, ret, 1);
+            return ret;
+        case 2:
+            get_unsafe_size(*(uint16_t *)to, from, 2, UA_DROP, ret, 2);
+            return ret;
+        case 4:
+            get_unsafe_size(*(uint32_t *)to, from, 4, UA_DROP, ret, 4);
+            return ret;
+        case 8:
+            get_unsafe_size(*(uint64_t *)to, from, 8, UA_DROP, ret, 8);
+            return ret;
+        }
+    }
+
+    return copy_from_unsafe_ll(to, from, n);
 }
-#define copy_from_unsafe __copy_from_guest_pv
 
 /*
  * The exception table consists of pairs of addresses: the first is the
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 16:33:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 16:33:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86978.163756 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD8im-00011h-Lj; Fri, 19 Feb 2021 16:33:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86978.163756; Fri, 19 Feb 2021 16:33:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD8im-00011Z-IX; Fri, 19 Feb 2021 16:33:36 +0000
Received: by outflank-mailman (input) for mailman id 86978;
 Fri, 19 Feb 2021 16:33:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD8il-00011T-To
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16: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 1lD8il-0004cW-Sy
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16:33:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD8il-0001hW-RM
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16:33:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=X5TRu1K3SDAEcnlJPUCMYQHptwjd0MXPh9QJZ8X0BSE=; b=jPNJwjOHB0zV9E3g/g86Y1jOr2
	021rfQ0KVYmlPjZTxhx6+FkN/z9DITILgp6bh01H928ekQkGDHoyuFezrZ5KwKYmHikPf/e+na0Ia
	j02hM4gX4u4tJnzpmvCkw+t4G5xKHVmganiTQChHxhtTMxn1/9Z96KvHixkukUdTU21s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/time: change initiation of the calibration timer
Message-Id: <E1lD8il-0001hW-RM@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 16:33:35 +0000

commit f954a1bf5f74ad6edce361d1bf1a29137ff374e8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 19 17:20:46 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 19 17:20:46 2021 +0100

    x86/time: change initiation of the calibration timer
    
    Setting the timer a second (EPOCH) into the future at a random point
    during boot (prior to bringing up APs and prior to launching Dom0) does
    not yield predictable results: The timer may expire while we're still
    bringing up APs (too early) or when Dom0 already boots (too late).
    Instead invoke the timer handler function explicitly at a predictable
    point in time, once we've established the rendezvous function to use
    (and hence also once all APs are online). This will, through the raising
    and handling of TIMER_SOFTIRQ, then also have the effect of arming the
    timer.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/time.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 8938c0f435..23971ed7ac 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -854,9 +854,7 @@ static void resume_platform_timer(void)
 
 static void __init reset_platform_timer(void)
 {
-    /* Deactivate any timers running */
     kill_timer(&plt_overflow_timer);
-    kill_timer(&calibration_timer);
 
     /* Reset counters and stamps */
     spin_lock_irq(&platform_timer_lock);
@@ -1956,19 +1954,13 @@ static void __init reset_percpu_time(void *unused)
     t->stamp.master_stime = t->stamp.local_stime;
 }
 
-static void __init try_platform_timer_tail(bool late)
+static void __init try_platform_timer_tail(void)
 {
     init_timer(&plt_overflow_timer, plt_overflow, NULL, 0);
     plt_overflow(NULL);
 
     platform_timer_stamp = plt_stamp64;
     stime_platform_stamp = NOW();
-
-    if ( !late )
-        init_percpu_time();
-
-    init_timer(&calibration_timer, time_calibration, NULL, 0);
-    set_timer(&calibration_timer, NOW() + EPOCH);
 }
 
 /* Late init function, after all cpus have booted */
@@ -2009,10 +2001,13 @@ static int __init verify_tsc_reliability(void)
             time_calibration_rendezvous_fn = time_calibration_nop_rendezvous;
 
             /* Finish platform timer switch. */
-            try_platform_timer_tail(true);
+            try_platform_timer_tail();
 
             printk("Switched to Platform timer %s TSC\n",
                    freq_string(plt_src.frequency));
+
+            time_calibration(NULL);
+
             return 0;
         }
     }
@@ -2033,6 +2028,8 @@ static int __init verify_tsc_reliability(void)
          !boot_cpu_has(X86_FEATURE_TSC_RELIABLE) )
         time_calibration_rendezvous_fn = time_calibration_tsc_rendezvous;
 
+    time_calibration(NULL);
+
     return 0;
 }
 __initcall(verify_tsc_reliability);
@@ -2048,7 +2045,11 @@ int __init init_xen_time(void)
     do_settime(get_wallclock_time(), 0, NOW());
 
     /* Finish platform timer initialization. */
-    try_platform_timer_tail(false);
+    try_platform_timer_tail();
+
+    init_percpu_time();
+
+    init_timer(&calibration_timer, time_calibration, NULL, 0);
 
     /*
      * Setup space to track per-socket TSC_ADJUST values. Don't fiddle with
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 16:33:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 16:33:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86979.163759 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD8iw-00013A-My; Fri, 19 Feb 2021 16:33:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86979.163759; Fri, 19 Feb 2021 16:33:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD8iw-000132-K2; Fri, 19 Feb 2021 16:33:46 +0000
Received: by outflank-mailman (input) for mailman id 86979;
 Fri, 19 Feb 2021 16: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 1lD8iw-00012t-1e
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16: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 1lD8iv-0004cg-W7
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16:33:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD8iv-0001iK-VI
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16:33:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=N9exIRI93WN+RPLc8dGMYjHHSUWvpMhA8dwfdUTkYuI=; b=iYM2YZ8aozOeiunBRdHSeYGGdV
	kRiQsl9e66c/Zh3t27/kLjtLcyCsJfU4YvfOwgqFpXrAxBJp3VDttdRzvNpCC1Tn1I/H6bbiNyjOE
	kVmekFLOp0lQ3Pj/i01E0rj5N0ROCYHv4mBilgXFyfEI139oCIhm7OAMQntLbuqd0JDI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/time: adjust time recording in time_calibration_tsc_rendezvous()
Message-Id: <E1lD8iv-0001iK-VI@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 16:33:45 +0000

commit a2639824e8458a8f3826e184081a13bfa27ea884
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 19 17:21:12 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 19 17:21:12 2021 +0100

    x86/time: adjust time recording in time_calibration_tsc_rendezvous()
    
    The (stime,tsc) tuple is the basis for extrapolation by get_s_time().
    Therefore the two better get taken as close to one another as possible.
    This means two things: First, reading platform time is too early when
    done on the first iteration. The closest we can get is on the last
    iteration, immediately before telling other CPUs to write their TSCs
    (and then also writing CPU0's). While at the first glance it may seem
    not overly relevant when exactly platform time is read (when assuming
    that only stime is ever relevant anywhere, and hence the association
    with the precise TSC values is of lower interest), both CPU frequency
    changes and the effects of SMT make it unpredictable (between individual
    rendezvous instances) how long the loop iterations will take. This will
    in turn lead to higher an error than neccesary in how close to linear
    stime movement we can get.
    
    Second, re-reading the TSC for local recording is increasing the overall
    error as well, when we already know a more precise value - the one just
    written.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/time.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 23971ed7ac..a894f74b88 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1662,11 +1662,12 @@ struct calibration_rendezvous {
 };
 
 static void
-time_calibration_rendezvous_tail(const struct calibration_rendezvous *r)
+time_calibration_rendezvous_tail(const struct calibration_rendezvous *r,
+                                 uint64_t tsc)
 {
     struct cpu_time_stamp *c = &this_cpu(cpu_calibration);
 
-    c->local_tsc    = rdtsc_ordered();
+    c->local_tsc    = tsc;
     c->local_stime  = get_s_time_fixed(c->local_tsc);
     c->master_stime = r->master_stime;
 
@@ -1691,11 +1692,11 @@ static void time_calibration_tsc_rendezvous(void *_r)
             while ( atomic_read(&r->semaphore) != (total_cpus - 1) )
                 cpu_relax();
 
-            if ( r->master_stime == 0 )
-            {
-                r->master_stime = read_platform_stime(NULL);
+            if ( r->master_tsc_stamp == 0 )
                 r->master_tsc_stamp = rdtsc_ordered();
-            }
+            else if ( i == 0 )
+                r->master_stime = read_platform_stime(NULL);
+
             atomic_inc(&r->semaphore);
 
             if ( i == 0 )
@@ -1720,7 +1721,7 @@ static void time_calibration_tsc_rendezvous(void *_r)
         }
     }
 
-    time_calibration_rendezvous_tail(r);
+    time_calibration_rendezvous_tail(r, r->master_tsc_stamp);
 }
 
 /* Ordinary rendezvous function which does not modify TSC values. */
@@ -1745,7 +1746,7 @@ static void time_calibration_std_rendezvous(void *_r)
         smp_rmb(); /* receive signal /then/ read r->master_stime */
     }
 
-    time_calibration_rendezvous_tail(r);
+    time_calibration_rendezvous_tail(r, rdtsc_ordered());
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 16:33:56 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 16:33:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86980.163764 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD8j6-00014q-Pq; Fri, 19 Feb 2021 16:33:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86980.163764; Fri, 19 Feb 2021 16:33:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD8j6-00014i-Ms; Fri, 19 Feb 2021 16:33:56 +0000
Received: by outflank-mailman (input) for mailman id 86980;
 Fri, 19 Feb 2021 16: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 1lD8j6-00014c-3g
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16: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 1lD8j6-0004d4-2t
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16:33:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD8j6-0001jE-2B
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16:33:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GSbFseab03nOXku+7V/kCPLFX9bKAit2hh7tZ3GhV2U=; b=YJkmKOEjygUXbQqGseupmkIVuL
	4ICLRBcJHUcsiZfz8xNpUh+jvAfNRG9x6EYTvff9HlC9NGugb/ciC2j6eudE4FIa1WuZXAYerIFaw
	Meo5+o1/23erPRjPZEf+xrHlkx6ohOPZ2XU0R89rgJ8D1oeaIrXJqoZ+sC+tu5Mwxano=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/time: don't move TSC backwards in time_calibration_tsc_rendezvous()
Message-Id: <E1lD8j6-0001jE-2B@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 16:33:56 +0000

commit 76aff7f6336b0ce19559700717537449972531be
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 19 17:21:41 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 19 17:21:41 2021 +0100

    x86/time: don't move TSC backwards in time_calibration_tsc_rendezvous()
    
    While doing this for small amounts may be okay, the unconditional use
    of CPU0's value here has been found to be a problem when the boot time
    TSC of the BSP was behind that of all APs by more than a second. In
    particular because of get_s_time_fixed() producing insane output when
    the calculated delta is negative, we can't allow this to happen.
    
    On the first iteration have all other CPUs sort out the highest TSC
    value any one of them has read. On the second iteration, if that
    maximum is higher than CPU0's, update its recorded value from that
    taken in the first iteration. Use the resulting value on the last
    iteration to write everyone's TSCs.
    
    To account for the possible discontinuity, have
    time_calibration_rendezvous_tail() record the newly written value, but
    extrapolate local stime using the value read.
    
    Reported-by: Claudemir Todo Bom <claudemir@todobom.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/time.c | 36 ++++++++++++++++++++++++++++--------
 1 file changed, 28 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index a894f74b88..6bc1fd11d6 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1658,17 +1658,17 @@ struct calibration_rendezvous {
     cpumask_t cpu_calibration_map;
     atomic_t semaphore;
     s_time_t master_stime;
-    u64 master_tsc_stamp;
+    uint64_t master_tsc_stamp, max_tsc_stamp;
 };
 
 static void
 time_calibration_rendezvous_tail(const struct calibration_rendezvous *r,
-                                 uint64_t tsc)
+                                 uint64_t old_tsc, uint64_t new_tsc)
 {
     struct cpu_time_stamp *c = &this_cpu(cpu_calibration);
 
-    c->local_tsc    = tsc;
-    c->local_stime  = get_s_time_fixed(c->local_tsc);
+    c->local_tsc    = new_tsc;
+    c->local_stime  = get_s_time_fixed(old_tsc ?: new_tsc);
     c->master_stime = r->master_stime;
 
     raise_softirq(TIME_CALIBRATE_SOFTIRQ);
@@ -1683,6 +1683,7 @@ static void time_calibration_tsc_rendezvous(void *_r)
     int i;
     struct calibration_rendezvous *r = _r;
     unsigned int total_cpus = cpumask_weight(&r->cpu_calibration_map);
+    uint64_t tsc = 0;
 
     /* Loop to get rid of cache effects on TSC skew. */
     for ( i = 4; i >= 0; i-- )
@@ -1692,8 +1693,15 @@ static void time_calibration_tsc_rendezvous(void *_r)
             while ( atomic_read(&r->semaphore) != (total_cpus - 1) )
                 cpu_relax();
 
-            if ( r->master_tsc_stamp == 0 )
-                r->master_tsc_stamp = rdtsc_ordered();
+            if ( tsc == 0 )
+                r->master_tsc_stamp = tsc = rdtsc_ordered();
+            else if ( r->master_tsc_stamp < r->max_tsc_stamp )
+                /*
+                 * We want to avoid moving the TSC backwards for any CPU.
+                 * Use the largest value observed anywhere on the first
+                 * iteration.
+                 */
+                r->master_tsc_stamp = r->max_tsc_stamp;
             else if ( i == 0 )
                 r->master_stime = read_platform_stime(NULL);
 
@@ -1712,6 +1720,15 @@ static void time_calibration_tsc_rendezvous(void *_r)
             while ( atomic_read(&r->semaphore) < total_cpus )
                 cpu_relax();
 
+            if ( tsc == 0 )
+            {
+                uint64_t cur = ACCESS_ONCE(r->max_tsc_stamp);
+
+                tsc = rdtsc_ordered();
+                while ( tsc > cur )
+                    cur = cmpxchg(&r->max_tsc_stamp, cur, tsc);
+            }
+
             if ( i == 0 )
                 write_tsc(r->master_tsc_stamp);
 
@@ -1719,9 +1736,12 @@ static void time_calibration_tsc_rendezvous(void *_r)
             while ( atomic_read(&r->semaphore) > total_cpus )
                 cpu_relax();
         }
+
+        /* Just in case a read above ended up reading zero. */
+        tsc += !tsc;
     }
 
-    time_calibration_rendezvous_tail(r, r->master_tsc_stamp);
+    time_calibration_rendezvous_tail(r, tsc, r->master_tsc_stamp);
 }
 
 /* Ordinary rendezvous function which does not modify TSC values. */
@@ -1746,7 +1766,7 @@ static void time_calibration_std_rendezvous(void *_r)
         smp_rmb(); /* receive signal /then/ read r->master_stime */
     }
 
-    time_calibration_rendezvous_tail(r, rdtsc_ordered());
+    time_calibration_rendezvous_tail(r, 0, rdtsc_ordered());
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 16:34:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 16:34:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.86981.163768 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD8jH-000167-RN; Fri, 19 Feb 2021 16:34:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 86981.163768; Fri, 19 Feb 2021 16:34:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD8jH-00015z-OR; Fri, 19 Feb 2021 16:34:07 +0000
Received: by outflank-mailman (input) for mailman id 86981;
 Fri, 19 Feb 2021 16: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 1lD8jG-00015p-8Q
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16: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 1lD8jG-0004dP-6q
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16:34:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD8jG-0001kZ-5Y
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 16:34:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mEsBYD7J71bGPVxmtiT0rUPXvIlof7l5TWRkLLN7Iak=; b=MsV61euLW0gmzoV9bmDAAPqiwb
	iZE+Gu6c/A7aijbmv3Yrz5XelnP7jj10yVz5fgg4p1s2sb9YhyCp58qT+HZiDG2dvVfMuy2Aakmkb
	I0Bu9tUdGwzsdPxo1FraqPYCujt4BwMt57HPxZlDjo948G3Uy2Upvu0JW1b8mNxh5DLs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hvm: refactor set param
Message-Id: <E1lD8jG-0001kZ-5Y@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 16:34:06 +0000

commit 336fbbdf61562e5ae1112f24bc90c1164adf2144
Author:     Norbert Manthey <nmanthey@amazon.de>
AuthorDate: Fri Feb 19 17:24:03 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 19 17:24:03 2021 +0100

    x86/hvm: refactor set param
    
    To prevent leaking HVM params via L1TF and similar issues on a
    hyperthread pair, let's load values of domains only after performing all
    relevant checks, and blocking speculative execution.
    
    For both get and set, the value of the index is already checked in the
    outer calling function. The block_speculation calls in hvmop_get_param
    and hvmop_set_param are removed, because is_hvm_domain already blocks
    speculation.
    
    Furthermore, speculative barriers are re-arranged to make sure we do not
    allow guests running on co-located VCPUs to leak hvm parameter values of
    other domains.
    
    To improve symmetry between the get and set operations, function
    hvmop_set_param is made static.
    
    This is part of the speculative hardening effort.
    
    Reported-by: Hongyan Xia <hongyxia@amazon.co.uk>
    Signed-off-by: Norbert Manthey <nmanthey@amazon.de>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/hvm/hvm.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index a2ecd54ab7..e7bcffebc4 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4060,7 +4060,7 @@ static int hvm_allow_set_param(struct domain *d,
                                uint32_t index,
                                uint64_t new_value)
 {
-    uint64_t value = d->arch.hvm.params[index];
+    uint64_t value;
     int rc;
 
     rc = xsm_hvm_param(XSM_TARGET, d, HVMOP_set_param);
@@ -4108,6 +4108,10 @@ static int hvm_allow_set_param(struct domain *d,
     if ( rc )
         return rc;
 
+    /* Make sure we evaluate permissions before loading data of domains. */
+    block_speculation();
+
+    value = d->arch.hvm.params[index];
     switch ( index )
     {
     /* The following parameters should only be changed once. */
@@ -4134,13 +4138,13 @@ static int hvm_set_param(struct domain *d, uint32_t index, uint64_t value)
     struct vcpu *v;
     int rc;
 
-    if ( index >= HVM_NR_PARAMS )
-        return -EINVAL;
-
     rc = hvm_allow_set_param(d, index, value);
     if ( rc )
         return rc;
 
+    /* Make sure we evaluate permissions before loading data of domains. */
+    block_speculation();
+
     switch ( index )
     {
     case HVM_PARAM_CALLBACK_IRQ:
@@ -4305,7 +4309,7 @@ static int hvm_set_param(struct domain *d, uint32_t index, uint64_t value)
     return rc;
 }
 
-int hvmop_set_param(
+static int hvmop_set_param(
     XEN_GUEST_HANDLE_PARAM(xen_hvm_param_t) arg)
 {
     struct xen_hvm_param a;
@@ -4318,9 +4322,6 @@ int hvmop_set_param(
     if ( a.index >= HVM_NR_PARAMS )
         return -EINVAL;
 
-    /* Make sure the above bound check is not bypassed during speculation. */
-    block_speculation();
-
     d = rcu_lock_domain_by_any_id(a.domid);
     if ( d == NULL )
         return -ESRCH;
@@ -4388,6 +4389,9 @@ int hvm_get_param(struct domain *d, uint32_t index, uint64_t *value)
     if ( rc )
         return rc;
 
+    /* Make sure the above domain permissions check is respected. */
+    block_speculation();
+
     switch ( index )
     {
     case HVM_PARAM_ACPI_S_STATE:
@@ -4428,9 +4432,6 @@ static int hvmop_get_param(
     if ( a.index >= HVM_NR_PARAMS )
         return -EINVAL;
 
-    /* Make sure the above bound check is not bypassed during speculation. */
-    block_speculation();
-
     d = rcu_lock_domain_by_any_id(a.domid);
     if ( d == NULL )
         return -ESRCH;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 17:22:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 17:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.87008.163880 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD9Ti-0007QB-I2; Fri, 19 Feb 2021 17:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 87008.163880; Fri, 19 Feb 2021 17:22:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD9Ti-0007Q3-Ef; Fri, 19 Feb 2021 17:22:06 +0000
Received: by outflank-mailman (input) for mailman id 87008;
 Fri, 19 Feb 2021 17: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 1lD9Th-0007Py-Bd
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 17: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 1lD9Th-0005Uw-8t
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 17:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD9Th-0001MQ-7M
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 17:22:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zvUI2evwW3liFho5Gk5iI1bJcRxA68yMS0uuMzzLPiI=; b=lZsv9hW9DPOqe2g7PttlVSv5D9
	A4JCFb7VBi40l+5FiIZnBpbUclvrGvwl4NxOtKDgGLmr2Uz1m5sIW31foe2TO7xdg8GEM3ywsocEJ
	/RfWBkW9BTMYosqOR/Vk30gOlm+XuyRhd+Rzx3MQaf8D/85NwnjAsb8MlX12qWzG7ODU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libxl: Work around unintialised variable libxl__domain_get_device_model_uid()
Message-Id: <E1lD9Th-0001MQ-7M@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 17:22:05 +0000

commit 2ff2adc61fcfa09118b76b4b64cbf8a78f7f2882
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 15:29:12 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 19 17:10:33 2021 +0000

    tools/libxl: Work around unintialised variable libxl__domain_get_device_model_uid()
    
    Various version of gcc, when compiling with -Og, complain:
    
      libxl_dm.c: In function 'libxl__domain_get_device_model_uid':
      libxl_dm.c:256:12: error: 'kill_by_uid' may be used uninitialized in this function [-Werror=maybe-uninitialized]
        256 |         if (kill_by_uid)
            |            ^
    
    The logic is very tangled.  Set kill_by_uid on every path.
    
    No funcational change.
    
    Requested-by: Ian Jackson <iwj@xenproject.org>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Not-acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/light/libxl_dm.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index db4cec6a76..5309496c58 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -152,13 +152,16 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,
     user = b_info->device_model_user;
     if (user) {
         rc = userlookup_helper_getpwnam(gc, user, &user_pwbuf, &user_base);
-        if (rc)
+        if (rc) {
+            kill_by_uid = false;
             goto out;
+        }
 
         if (!user_base) {
             LOGD(ERROR, guest_domid, "Couldn't find device_model_user %s",
                  user);
             rc = ERROR_INVAL;
+            kill_by_uid = false;
             goto out;
         }
 
@@ -187,22 +190,29 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,
      */
     rc = userlookup_helper_getpwnam(gc, LIBXL_QEMU_USER_RANGE_BASE,
                                          &user_pwbuf, &user_base);
-    if (rc)
+    if (rc) {
+        kill_by_uid = false;
         goto out;
+    }
+
     if (user_base) {
         struct passwd *user_clash, user_clash_pwbuf;
 
         intended_uid = user_base->pw_uid + guest_domid;
         rc = userlookup_helper_getpwuid(gc, intended_uid,
                                          &user_clash_pwbuf, &user_clash);
-        if (rc)
+        if (rc) {
+            kill_by_uid = false;
             goto out;
+        }
+
         if (user_clash) {
             LOGD(ERROR, guest_domid,
                  "wanted to use uid %ld (%s + %d) but that is user %s !",
                  (long)intended_uid, LIBXL_QEMU_USER_RANGE_BASE,
                  guest_domid, user_clash->pw_name);
             rc = ERROR_INVAL;
+            kill_by_uid = false;
             goto out;
         }
 
@@ -221,8 +231,11 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,
      */
     user = LIBXL_QEMU_USER_SHARED;
     rc = userlookup_helper_getpwnam(gc, user, &user_pwbuf, &user_base);
-    if (rc)
+    if (rc) {
+        kill_by_uid = false;
         goto out;
+    }
+
     if (user_base) {
         LOGD(WARN, guest_domid, "Could not find user %s, falling back to %s",
              LIBXL_QEMU_USER_RANGE_BASE, LIBXL_QEMU_USER_SHARED);
@@ -240,6 +253,7 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,
          "Could not find user %s or range base pseudo-user %s, cannot restrict",
          LIBXL_QEMU_USER_SHARED, LIBXL_QEMU_USER_RANGE_BASE);
     rc = ERROR_INVAL;
+    kill_by_uid = false;
 
 out:
     /* First, do a root check if appropriate */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 17:22:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 17:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.87009.163884 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD9Ts-0007Qy-J5; Fri, 19 Feb 2021 17:22:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 87009.163884; Fri, 19 Feb 2021 17:22:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD9Ts-0007Qq-GD; Fri, 19 Feb 2021 17:22:16 +0000
Received: by outflank-mailman (input) for mailman id 87009;
 Fri, 19 Feb 2021 17: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 1lD9Tr-0007Qk-F8
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 17:22:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD9Tr-0005V6-DW
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 17:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD9Tr-0001NE-Ay
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 17:22:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KlCTkX+agGGdMZvdASAQbxKUN096FfqQNQtHPCNTX5I=; b=X9SoPqdLTIkWgmMzdool3B4Uul
	ZMIvhF1iubpV40jgfL39YqgheyDZ0RYGqLviObXqPIxsC/zfMUARcNWaE5jaq2GKqlBP2nbBHrYKN
	ItntP1CF6Q/6PchvbeYnKJmTub+fnj12tU807MrQc1WZvcnzVbdf2WsAyEKs8ysTm3fY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: Use -Og for debug builds when available
Message-Id: <E1lD9Tr-0001NE-Ay@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 17:22:15 +0000

commit 4abb20e321626c3d3cb0e922eac2048dc15d7c87
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 14:22:44 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 19 17:10:33 2021 +0000

    tools: Use -Og for debug builds when available
    
    The recommended optimisation level for debugging is -Og, and is what tools
    such as gdb prefer.  In practice, it equates to -01 with a few specific
    optimisations turned off.
    
    abi-dumper in particular wants the libraries it inspects in this form.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/Rules.mk | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index f61da81f4a..2907ed2d39 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -106,8 +106,9 @@ endif
 CFLAGS_libxenlight += $(CFLAGS_libxenctrl)
 
 ifeq ($(debug),y)
-# Disable optimizations
-CFLAGS += -O0 -fno-omit-frame-pointer
+# Use -Og if available, -O0 otherwise
+dbg_opt_level := $(call cc-option,$(CC),-Og,-O0)
+CFLAGS += $(dbg_opt_level) -fno-omit-frame-pointer
 # But allow an override to -O0 in case Python enforces -D_FORTIFY_SOURCE=<n>.
 PY_CFLAGS += $(PY_NOOPT_CFLAGS)
 else
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 17:22:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 17:22:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.87010.163888 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD9U2-0007SK-Kw; Fri, 19 Feb 2021 17:22:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 87010.163888; Fri, 19 Feb 2021 17:22:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD9U2-0007SA-Hk; Fri, 19 Feb 2021 17:22:26 +0000
Received: by outflank-mailman (input) for mailman id 87010;
 Fri, 19 Feb 2021 17:22:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD9U1-0007Rz-Hi
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 17:22:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD9U1-0005VG-Gr
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 17:22:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD9U1-0001Nz-G1
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 17:22:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nNCfhIKW9mDuHTtEFLyr3QvrYbuEON1727AUpIslm1I=; b=VbOWg5yXY1ihBBYTuchYLt2zyc
	OY22hRTlJPpbG+0JcJpgtq9dHIt1lDax4wzqqlHZELO+JeNbK+QWCkE+f8IChcGDJuWuZASWkY0FW
	qpuCaeO9DsanjUmukqbonEyF3VpFcnjN4CsLQC5XdcDAhinG5+wjFOaW1hx3wCcLudRk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: Check for abi-dumper in ./configure
Message-Id: <E1lD9U1-0001Nz-G1@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 17:22:25 +0000

commit 5398d16105594835e1878629eb9ce2c403667a00
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 12 11:51:04 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 19 17:10:33 2021 +0000

    tools: Check for abi-dumper in ./configure
    
    This will be optional.  No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 config/Tools.mk.in |  1 +
 tools/configure    | 41 +++++++++++++++++++++++++++++++++++++++++
 tools/configure.ac |  1 +
 3 files changed, 43 insertions(+)

diff --git a/config/Tools.mk.in b/config/Tools.mk.in
index 48bd9ab731..d47936686b 100644
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -19,6 +19,7 @@ BCC                 := @BCC@
 IASL                := @IASL@
 AWK                 := @AWK@
 FETCHER             := @FETCHER@
+ABI_DUMPER          := @ABI_DUMPER@
 
 # Extra folder for libs/includes
 PREPEND_INCLUDES    := @PREPEND_INCLUDES@
diff --git a/tools/configure b/tools/configure
index e63ca3797d..bb5acf9d43 100755
--- a/tools/configure
+++ b/tools/configure
@@ -682,6 +682,7 @@ OCAMLOPT
 OCAMLLIB
 OCAMLVERSION
 OCAMLC
+ABI_DUMPER
 INSTALL_DATA
 INSTALL_SCRIPT
 INSTALL_PROGRAM
@@ -5442,6 +5443,46 @@ $as_echo "no" >&6; }
 fi
 
 
+# Extract the first word of "abi-dumper", so it can be a program name with args.
+set dummy abi-dumper; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ABI_DUMPER+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ABI_DUMPER in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ABI_DUMPER="$ABI_DUMPER" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_ABI_DUMPER="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ABI_DUMPER=$ac_cv_path_ABI_DUMPER
+if test -n "$ABI_DUMPER"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ABI_DUMPER" >&5
+$as_echo "$ABI_DUMPER" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Extract the first word of "perl", so it can be a program name with args.
 set dummy perl; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
diff --git a/tools/configure.ac b/tools/configure.ac
index 6b611deb13..636e7077be 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -310,6 +310,7 @@ AC_PROG_CC
 AC_PROG_MAKE_SET
 AC_PROG_INSTALL
 AC_PATH_PROG([FLEX], [flex])
+AC_PATH_PROG([ABI_DUMPER], [abi-dumper])
 AX_PATH_PROG_OR_FAIL([PERL], [perl])
 AX_PATH_PROG_OR_FAIL([AWK], [awk])
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 17:22:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 17:22:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.87011.163893 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD9UC-0007TX-NW; Fri, 19 Feb 2021 17:22:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 87011.163893; Fri, 19 Feb 2021 17:22:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD9UC-0007TN-JD; Fri, 19 Feb 2021 17:22:36 +0000
Received: by outflank-mailman (input) for mailman id 87011;
 Fri, 19 Feb 2021 17:22:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD9UB-0007T9-KQ
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 17:22:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD9UB-0005VS-Jf
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 17:22:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD9UB-0001Os-Iu
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 17:22:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=f3dxzQ1Duo4NOt8wtcuTtnWMZK50U3nVS8SGKTumTqQ=; b=2cCBvgXccwXyGIi84Wap04qlED
	0GvSvQhPXrUQ960Br4HS6AVuHnhr0g3kT0r3ypp/KQS36b5nSRxAjr1WWDWOzRs2OKheIzKNx674W
	E03nvCv/zOUTlfiDYZFZgOuJ2olwpmXGk+tlrk0J2RqMX/uuUs1RMXUcxrZM98w92aKs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs: Add rule to generate headers.lst
Message-Id: <E1lD9UB-0001Os-Iu@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 17:22:35 +0000

commit 0670834c50e2eedc6a281e084fb9c181817f26ce
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 06:29:31 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 19 17:10:33 2021 +0000

    tools/libs: Add rule to generate headers.lst
    
    abi-dumper needs a list of the public header files for shared objects, and
    only accepts this in the form of a file.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/.gitignore | 1 +
 tools/libs/libs.mk    | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/libs/.gitignore b/tools/libs/.gitignore
new file mode 100644
index 0000000000..4a13126144
--- /dev/null
+++ b/tools/libs/.gitignore
@@ -0,0 +1 @@
+*/headers.lst
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 0b3381755a..7970627ac8 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -76,6 +76,10 @@ endif
 
 headers.chk: $(AUTOINCS)
 
+headers.lst: FORCE
+	@{ set -e; $(foreach h,$(LIBHEADERS),echo $(h);) } > $@.tmp
+	@$(call move-if-changed,$@.tmp,$@)
+
 libxen$(LIBNAME).map:
 	echo 'VERS_$(MAJOR).$(MINOR) { global: *; };' >$@
 
@@ -118,9 +122,12 @@ TAGS:
 clean:
 	rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
 	rm -f lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) lib$(LIB_FILE_NAME).so.$(MAJOR)
-	rm -f headers.chk
+	rm -f headers.chk headers.lst
 	rm -f $(PKG_CONFIG)
 	rm -f _paths.h
 
 .PHONY: distclean
 distclean: clean
+
+.PHONY: FORCE
+FORCE:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 17:22:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 17:22:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.87012.163896 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD9UM-0007V8-PI; Fri, 19 Feb 2021 17:22:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 87012.163896; Fri, 19 Feb 2021 17:22:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD9UM-0007V0-MJ; Fri, 19 Feb 2021 17:22:46 +0000
Received: by outflank-mailman (input) for mailman id 87012;
 Fri, 19 Feb 2021 17:22:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD9UL-0007Up-NX
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 17:22:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD9UL-0005VZ-Ml
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 17:22:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD9UL-0001Po-Ln
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 17:22:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lGaLDy4Xx1K2r9QguztWFs4oJmvmzt43W1Q80psZ84c=; b=ocT+r4qqXQ5lYpZE1aOVbbIjvQ
	p1nQqAsMBKfhLRmG2qRG556hTD6Bv0y3uZkEr6uVVEjeqlx+BtUVy72HyNkmBaRYBGMOw5TZLlKxn
	Ukv/qx+r9BZGn94MKwO6+L+50FIWGhN7S7BZm9c6XnOnBMh2y00pvALSmPgj5v/rx8YE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs: Write out an ABI analysis when abi-dumper is available
Message-Id: <E1lD9UL-0001Po-Ln@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 17:22:45 +0000

commit d7c9f7a7a3959913b4b37e782069bf91f0285f9d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 06:39:03 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 19 17:10:33 2021 +0000

    tools/libs: Write out an ABI analysis when abi-dumper is available
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/libs.mk | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 7970627ac8..a68cec244c 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -49,6 +49,8 @@ PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG)
 LIBHEADER ?= $(LIB_FILE_NAME).h
 LIBHEADERS = $(foreach h, $(LIBHEADER), $(XEN_INCLUDE)/$(h))
 
+PKG_ABI := lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)-$(XEN_TARGET_ARCH)-abi.dump
+
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
@@ -94,6 +96,13 @@ lib$(LIB_FILE_NAME).so.$(MAJOR): lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)
 lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxen$(LIBNAME).map
 	$(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,lib$(LIB_FILE_NAME).so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDUSELIBS) $(APPEND_LDFLAGS)
 
+# If abi-dumper is available, write out the ABI analysis
+ifneq ($(ABI_DUMPER),)
+libs: $(PKG_ABI)
+$(PKG_ABI): lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) headers.lst
+	$(ABI_DUMPER) $< -o $@ -public-headers headers.lst -lver $(MAJOR).$(MINOR)
+endif
+
 .PHONY: install
 install: build
 	$(INSTALL_DIR) $(DESTDIR)$(libdir)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 19 17:55:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Feb 2021 17:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.87059.164095 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD9ze-0003ju-GV; Fri, 19 Feb 2021 17:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 87059.164095; Fri, 19 Feb 2021 17:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lD9ze-0003jm-Dc; Fri, 19 Feb 2021 17:55:06 +0000
Received: by outflank-mailman (input) for mailman id 87059;
 Fri, 19 Feb 2021 17:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD9zd-0003jg-GK
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 17:55:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD9zd-00062M-Ee
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 17:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lD9zd-0004A1-D7
 for xen-changelog@lists.xenproject.org; Fri, 19 Feb 2021 17:55:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q/WfXVjvG70Bd+QhVV8vLvm7SuiFjppQLTUrg46Cr/E=; b=F/waevZlZvPG6mrhsj7lCh9dXH
	0nFi/YC5t7S5CNLj1Wns0Ie7OYZFDtuxdNPuKq0ivrnXxxeF0Jy0oo7lYiuvCSE6T1IH/zJPUMzNp
	obo1xqkgUgktQGJcPb67Ph+m+gm9uDFfG16Vev33ENY2dsYelMcoD23zxWOglZa/lhM8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs/light: fix xl save -c handling
Message-Id: <E1lD9zd-0004A1-D7@xenbits.xenproject.org>
Date: Fri, 19 Feb 2021 17:55:05 +0000

commit 87a067fd8f4d4f7c6be02c3d38145115ac542017
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Feb 19 15:13:37 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 19 17:52:41 2021 +0000

    tools/libs/light: fix xl save -c handling
    
    libxl_domain_resume() won't work correctly for the case it was called
    due to a "xl save -c" command, i.e. to continue the suspended domain.
    
    The information to do that is not saved in libxl__dm_resume_state for
    non-HVM domains.
    
    Fixes: 6298f0eb8f443 ("libxl: Re-introduce libxl__domain_resume")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/light/libxl_dom_suspend.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_dom_suspend.c b/tools/libs/light/libxl_dom_suspend.c
index 25d1571895..f7823bbc8f 100644
--- a/tools/libs/light/libxl_dom_suspend.c
+++ b/tools/libs/light/libxl_dom_suspend.c
@@ -630,12 +630,13 @@ void libxl__domain_resume(libxl__egc *egc,
         goto out;
     }
 
+    dmrs->suspend_cancel = suspend_cancel;
+
     if (type != LIBXL_DOMAIN_TYPE_HVM) {
         rc = 0;
         goto out;
     }
 
-    dmrs->suspend_cancel = suspend_cancel;
     dmrs->dm_resumed_callback = domain_resume_done;
     libxl__dm_resume(egc, dmrs); /* must be last */
     return;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Feb 20 04:33:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Feb 2021 04:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.87139.164258 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lDJx2-0003uC-3g; Sat, 20 Feb 2021 04:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 87139.164258; Sat, 20 Feb 2021 04:33:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lDJx1-0003u3-WA; Sat, 20 Feb 2021 04:33:03 +0000
Received: by outflank-mailman (input) for mailman id 87139;
 Sat, 20 Feb 2021 04:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lDJx0-0003ti-M8
 for xen-changelog@lists.xenproject.org; Sat, 20 Feb 2021 04:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lDJx0-0002BF-JP
 for xen-changelog@lists.xenproject.org; Sat, 20 Feb 2021 04:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lDJx0-0005fG-IR
 for xen-changelog@lists.xenproject.org; Sat, 20 Feb 2021 04:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Smc6blIF5Igh5SDKA58p/UWXGm2IoLZ280diwmqrI3M=; b=emmHcrlrlP7mJ8HNVVrIx3zXfm
	KWlAXQJ/8mkcA35jsE94eKBMtp5uuDIOgKg/MZv+r0PqsRs1OVvjoHHGMqvfc9j6dxaLozD+eJUoB
	0jZgK946aazcoMdFCQKg2+wfa/yx7xWsqkt6RNiG8U5wUHqzFvKG0fNnRvV846lG1jZc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] IOREQ: refine when to send mapcache invalidation request
Message-Id: <E1lDJx0-0005fG-IR@xenbits.xenproject.org>
Date: Sat, 20 Feb 2021 04:33:02 +0000

commit 588d961d15d1af5b51d7c33b5278ac7269a961ef
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 18 13:11:19 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 18 13:11:19 2021 +0100

    IOREQ: refine when to send mapcache invalidation request
    
    XENMEM_decrease_reservation isn't the only means by which pages can get
    removed from a guest, yet all removals ought to be signaled to qemu. Put
    setting of the flag into the central p2m_remove_page() underlying all
    respective hypercalls as well as a few similar places, mainly in PoD
    code.
    
    Additionally there's no point sending the request for the local domain
    when the domain acted upon is a different one. The latter domain's ioreq
    server mapcaches need invalidating. We assume that domain to be paused
    at the point the operation takes place, so sending the request in this
    case happens from the hvm_do_resume() path, which as one of its first
    steps calls handle_hvm_io_completion().
    
    Even without the remote operation aspect a single domain-wide flag
    doesn't do: Guests may e.g. decrease-reservation on multiple vCPU-s in
    parallel. Each of them needs to issue an invalidation request in due
    course, in particular because exiting to guest context should not happen
    before the request was actually seen by (all) the emulator(s).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/p2m.c           |  7 +++----
 xen/arch/arm/traps.c         |  4 ++--
 xen/arch/x86/hvm/hypercall.c | 12 +++++-------
 xen/arch/x86/mm/p2m-pod.c    |  9 +++++++++
 xen/arch/x86/mm/p2m.c        |  5 +++++
 xen/common/ioreq.c           | 32 +++++++++++++++++++++++++++-----
 xen/include/xen/ioreq.h      |  1 +
 xen/include/xen/sched.h      | 13 ++++++++-----
 8 files changed, 60 insertions(+), 23 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 6895804379..ac50312620 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -759,10 +759,9 @@ static void p2m_free_entry(struct p2m_domain *p2m,
          * has failed (error case).
          * So, at worst, the spurious mapcache invalidation might be sent.
          */
-        if ( (p2m->domain == current->domain) &&
-              domain_has_ioreq_server(p2m->domain) &&
-              p2m_is_ram(entry.p2m.type) )
-            p2m->domain->mapcache_invalidate = true;
+        if ( p2m_is_ram(entry.p2m.type) &&
+             domain_has_ioreq_server(p2m->domain) )
+            ioreq_request_mapcache_invalidate(p2m->domain);
 #endif
 
         p2m->stats.mappings[level]--;
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 6fa135050b..ccc0827107 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1509,8 +1509,8 @@ static void do_trap_hypercall(struct cpu_user_regs *regs, register_t *nr,
      * Note that sending the invalidation request causes the vCPU to block
      * until all the IOREQ servers have acknowledged the invalidation.
      */
-    if ( unlikely(curr->domain->mapcache_invalidate) &&
-         test_and_clear_bool(curr->domain->mapcache_invalidate) )
+    if ( unlikely(curr->mapcache_invalidate) &&
+         test_and_clear_bool(curr->mapcache_invalidate) )
         ioreq_signal_mapcache_invalidate();
 #endif
 }
diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index 6d41c563e1..b084afcbce 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -32,7 +32,6 @@
 
 static long hvm_memory_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
-    const struct vcpu *curr = current;
     long rc;
 
     switch ( cmd & MEMOP_CMD_MASK )
@@ -42,14 +41,11 @@ static long hvm_memory_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         return -ENOSYS;
     }
 
-    if ( !curr->hcall_compat )
+    if ( !current->hcall_compat )
         rc = do_memory_op(cmd, arg);
     else
         rc = compat_memory_op(cmd, arg);
 
-    if ( (cmd & MEMOP_CMD_MASK) == XENMEM_decrease_reservation )
-        curr->domain->mapcache_invalidate = true;
-
     return rc;
 }
 
@@ -327,9 +323,11 @@ int hvm_hypercall(struct cpu_user_regs *regs)
 
     HVM_DBG_LOG(DBG_LEVEL_HCALL, "hcall%lu -> %lx", eax, regs->rax);
 
-    if ( unlikely(currd->mapcache_invalidate) &&
-         test_and_clear_bool(currd->mapcache_invalidate) )
+    if ( unlikely(curr->mapcache_invalidate) )
+    {
+        curr->mapcache_invalidate = false;
         ioreq_signal_mapcache_invalidate();
+    }
 
     return curr->hcall_preempted ? HVM_HCALL_preempted : HVM_HCALL_completed;
 }
diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index 48e609d1ed..ae153fa6e6 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -20,6 +20,7 @@
  */
 
 #include <xen/event.h>
+#include <xen/ioreq.h>
 #include <xen/mm.h>
 #include <xen/sched.h>
 #include <xen/trace.h>
@@ -647,6 +648,8 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
                 set_gpfn_from_mfn(mfn_x(mfn), INVALID_M2P_ENTRY);
             p2m_pod_cache_add(p2m, page, cur_order);
 
+            ioreq_request_mapcache_invalidate(d);
+
             steal_for_cache =  ( p2m->pod.entry_count > p2m->pod.count );
 
             ram -= n;
@@ -835,6 +838,8 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn)
     p2m_pod_cache_add(p2m, mfn_to_page(mfn0), PAGE_ORDER_2M);
     p2m->pod.entry_count += SUPERPAGE_PAGES;
 
+    ioreq_request_mapcache_invalidate(d);
+
     ret = SUPERPAGE_PAGES;
 
 out_reset:
@@ -997,6 +1002,8 @@ p2m_pod_zero_check(struct p2m_domain *p2m, const gfn_t *gfns, unsigned int count
             /* Add to cache, and account for the new p2m PoD entry */
             p2m_pod_cache_add(p2m, mfn_to_page(mfns[i]), PAGE_ORDER_4K);
             p2m->pod.entry_count++;
+
+            ioreq_request_mapcache_invalidate(d);
         }
     }
 
@@ -1315,6 +1322,8 @@ guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
         p2m->pod.entry_count -= pod_count;
         BUG_ON(p2m->pod.entry_count < 0);
         pod_unlock(p2m);
+
+        ioreq_request_mapcache_invalidate(d);
     }
 
 out:
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 2091aed4a6..3840f167b0 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -28,6 +28,7 @@
 #include <xen/vm_event.h>
 #include <xen/event.h>
 #include <xen/grant_table.h>
+#include <xen/ioreq.h>
 #include <xen/param.h>
 #include <public/vm_event.h>
 #include <asm/domain.h>
@@ -815,6 +816,8 @@ p2m_remove_page(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
         }
     }
 
+    ioreq_request_mapcache_invalidate(p2m->domain);
+
     return p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
                          p2m->default_access);
 }
@@ -1301,6 +1304,8 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
             ASSERT(mfn_valid(mfn_add(omfn, i)));
             set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
         }
+
+        ioreq_request_mapcache_invalidate(d);
     }
 
     P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
diff --git a/xen/common/ioreq.c b/xen/common/ioreq.c
index 5b603c0520..d732dc045d 100644
--- a/xen/common/ioreq.c
+++ b/xen/common/ioreq.c
@@ -35,6 +35,17 @@
 #include <public/hvm/ioreq.h>
 #include <public/hvm/params.h>
 
+void ioreq_request_mapcache_invalidate(const struct domain *d)
+{
+    struct vcpu *v = current;
+
+    if ( d == v->domain )
+        v->mapcache_invalidate = true;
+    else if ( d->creation_finished )
+        for_each_vcpu ( d, v )
+            v->mapcache_invalidate = true;
+}
+
 /* Ask ioemu mapcache to invalidate mappings. */
 void ioreq_signal_mapcache_invalidate(void)
 {
@@ -206,6 +217,7 @@ bool vcpu_ioreq_handle_completion(struct vcpu *v)
     struct ioreq_server *s;
     struct ioreq_vcpu *sv;
     enum vio_completion completion;
+    bool res = true;
 
     if ( has_vpci(d) && vpci_process_pending(v) )
     {
@@ -232,17 +244,27 @@ bool vcpu_ioreq_handle_completion(struct vcpu *v)
         break;
 
     case VIO_mmio_completion:
-        return arch_ioreq_complete_mmio();
+        res = arch_ioreq_complete_mmio();
+        break;
 
     case VIO_pio_completion:
-        return handle_pio(vio->req.addr, vio->req.size,
-                          vio->req.dir);
+        res = handle_pio(vio->req.addr, vio->req.size,
+                         vio->req.dir);
+        break;
 
     default:
-        return arch_vcpu_ioreq_completion(completion);
+        res = arch_vcpu_ioreq_completion(completion);
+        break;
     }
 
-    return true;
+    if ( res && unlikely(v->mapcache_invalidate) )
+    {
+        v->mapcache_invalidate = false;
+        ioreq_signal_mapcache_invalidate();
+        res = false;
+    }
+
+    return res;
 }
 
 static int ioreq_server_alloc_mfn(struct ioreq_server *s, bool buf)
diff --git a/xen/include/xen/ioreq.h b/xen/include/xen/ioreq.h
index a54a637bef..a26614d331 100644
--- a/xen/include/xen/ioreq.h
+++ b/xen/include/xen/ioreq.h
@@ -103,6 +103,7 @@ struct ioreq_server *ioreq_server_select(struct domain *d,
 int ioreq_send(struct ioreq_server *s, ioreq_t *proto_p,
                bool buffered);
 unsigned int ioreq_broadcast(ioreq_t *p, bool buffered);
+void ioreq_request_mapcache_invalidate(const struct domain *d);
 void ioreq_signal_mapcache_invalidate(void);
 
 void ioreq_domain_init(struct domain *d);
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index bc78a09a53..5485d08afb 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -225,6 +225,14 @@ struct vcpu
     bool             hcall_compat;
 #endif
 
+#ifdef CONFIG_IOREQ_SERVER
+    /*
+     * Indicates that mapcache invalidation request should be sent to
+     * the device emulator.
+     */
+    bool             mapcache_invalidate;
+#endif
+
     /* The CPU, if any, which is holding onto this VCPU's state. */
 #define VCPU_CPU_CLEAN (~0u)
     unsigned int     dirty_cpu;
@@ -448,11 +456,6 @@ struct domain
      * unpaused for the first time by the systemcontroller.
      */
     bool             creation_finished;
-    /*
-     * Indicates that mapcache invalidation request should be sent to
-     * the device emulator.
-     */
-    bool             mapcache_invalidate;
 
     /* Which guest this guest has privileges on */
     struct domain   *target;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 20 04:33:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Feb 2021 04:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.87140.164262 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lDJxC-0003v5-4S; Sat, 20 Feb 2021 04:33:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 87140.164262; Sat, 20 Feb 2021 04:33:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lDJxC-0003ux-1X; Sat, 20 Feb 2021 04:33:14 +0000
Received: by outflank-mailman (input) for mailman id 87140;
 Sat, 20 Feb 2021 04:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lDJxA-0003us-Nj
 for xen-changelog@lists.xenproject.org; Sat, 20 Feb 2021 04:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lDJxA-0002BN-Mv
 for xen-changelog@lists.xenproject.org; Sat, 20 Feb 2021 04:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lDJxA-0005gC-Lt
 for xen-changelog@lists.xenproject.org; Sat, 20 Feb 2021 04:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MCQ+Ke6JQid48G+MVpGaXpBLmBhXFCySKIyKhswKtbc=; b=AyAenCrRQqQ9qKP8c6w9bNP8FZ
	mzfUItBB6IVA7Zj4nuDv2nAWKrW6qUXAYzW2VEre1ou95W06LCXTqDH/K5dt/3d6Od7C6uqo4O8OP
	aWM6lJRz/zPvzx4RqR0aIvKmz5/TUoqpnag9mvfCAjUnLrzEoNpkqdDnhBwdVJX6RttE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] gnttab: never permit mapping transitive grants
Message-Id: <E1lDJxA-0005gC-Lt@xenbits.xenproject.org>
Date: Sat, 20 Feb 2021 04:33:12 +0000

commit b339e3a976b1680f57051adabcb98281198f7eac
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 18 13:16:12 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 18 13:16:12 2021 +0100

    gnttab: never permit mapping transitive grants
    
    Transitive grants allow an intermediate domain I to grant a target
    domain T access to a page which origin domain O did grant I access to.
    As an implementation restriction, T is not allowed to map such a grant.
    This restriction is currently tried to be enforced by marking active
    entries resulting from transitive grants as is-sub-page; sub-page grants
    for obvious reasons don't allow mapping. However, marking (and checking)
    only active entries is insufficient, as a map attempt may also occur on
    a grant not otherwise in use. When not presently in use (pin count zero)
    the grant type itself needs checking. Otherwise T may be able to map an
    unrelated page owned by I. This is because the "transitive" sub-
    structure of the v2 union would end up being interpreted as "full_page"
    sub-structure instead. The low 32 bits of the GFN used would match the
    grant reference specified in I's transitive grant entry, while the upper
    32 bits could be random (depending on how exactly I sets up its grant
    table entries).
    
    Note that if one mapping already exists and the granting domain _then_
    changes the grant to GTF_transitive (which the domain is not supposed to
    do), the changed type will only be honored after the pin count has gone
    back to zero. This is no different from e.g. GTF_readonly or
    GTF_sub_page becoming set when a grant is already in use.
    
    While adjusting the implementation, also adjust commentary in the public
    header to better reflect reality.
    
    Fixes: 3672ce675c93 ("Transitive grant support")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/grant_table.c         | 9 +++++----
 xen/include/public/grant_table.h | 6 ++++--
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index b95403695f..4902598c8f 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -851,9 +851,10 @@ static int _set_status_v2(const grant_entry_header_t *shah,
         mask |= GTF_sub_page;
 
     /* If not already pinned, check the grant domid and type. */
-    if ( !act->pin && ((((scombo.flags & mask) != GTF_permit_access) &&
-                        ((scombo.flags & mask) != GTF_transitive)) ||
-                       (scombo.domid != ldomid)) )
+    if ( !act->pin &&
+         ((((scombo.flags & mask) != GTF_permit_access) &&
+           (mapflag || ((scombo.flags & mask) != GTF_transitive))) ||
+          (scombo.domid != ldomid)) )
         PIN_FAIL(done, GNTST_general_error,
                  "Bad flags (%x) or dom (%d); expected d%d, flags %x\n",
                  scombo.flags, scombo.domid, ldomid, mask);
@@ -879,7 +880,7 @@ static int _set_status_v2(const grant_entry_header_t *shah,
     if ( !act->pin )
     {
         if ( (((scombo.flags & mask) != GTF_permit_access) &&
-              ((scombo.flags & mask) != GTF_transitive)) ||
+              (mapflag || ((scombo.flags & mask) != GTF_transitive))) ||
              (scombo.domid != ldomid) ||
              (!readonly && (scombo.flags & GTF_readonly)) )
         {
diff --git a/xen/include/public/grant_table.h b/xen/include/public/grant_table.h
index 3b7bf93d74..84b1d26b36 100644
--- a/xen/include/public/grant_table.h
+++ b/xen/include/public/grant_table.h
@@ -166,11 +166,13 @@ typedef struct grant_entry_v1 grant_entry_v1_t;
 #define GTF_type_mask       (3U<<0)
 
 /*
- * Subflags for GTF_permit_access.
+ * Subflags for GTF_permit_access and GTF_transitive.
  *  GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST]
  *  GTF_reading: Grant entry is currently mapped for reading by @domid. [XEN]
  *  GTF_writing: Grant entry is currently mapped for writing by @domid. [XEN]
- *  GTF_PAT, GTF_PWT, GTF_PCD: (x86) cache attribute flags for the grant [GST]
+ * Further subflags for GTF_permit_access only.
+ *  GTF_PAT, GTF_PWT, GTF_PCD: (x86) cache attribute flags to be used for
+ *                             mappings of the grant [GST]
  *  GTF_sub_page: Grant access to only a subrange of the page.  @domid
  *                will only be allowed to copy from the grant, and not
  *                map it. [GST]
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 20 04:33:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Feb 2021 04:33:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.87141.164266 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lDJxM-0003wV-6E; Sat, 20 Feb 2021 04:33:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 87141.164266; Sat, 20 Feb 2021 04:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lDJxM-0003wN-34; Sat, 20 Feb 2021 04:33:24 +0000
Received: by outflank-mailman (input) for mailman id 87141;
 Sat, 20 Feb 2021 04:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lDJxK-0003wD-Ra
 for xen-changelog@lists.xenproject.org; Sat, 20 Feb 2021 04:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lDJxK-0002BV-Qv
 for xen-changelog@lists.xenproject.org; Sat, 20 Feb 2021 04:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lDJxK-0005gy-PC
 for xen-changelog@lists.xenproject.org; Sat, 20 Feb 2021 04:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ln8sm2oK80JTfRhCY8kqOhlU98Q0cs83h4Vo6CQzDa4=; b=XzVwzE1kQbknEL826T1Z/MeRA2
	hmr6aTUHsBmvSkhTACG8PkY+j2iPF0YJ02hL7zdoI/oNbiDdkkOuW/89he10dsA5UZKQa9LRzst6J
	4Lrn6BsyOceB+OHsgcEBYMTWExXTJe0Ag1Ab74Kmd26Lqf/uZnDQF2yQ4r9JLKYumeSI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] gnttab: bypass IOMMU (un)mapping when a domain is (un)mapping its own grant
Message-Id: <E1lDJxK-0005gy-PC@xenbits.xenproject.org>
Date: Sat, 20 Feb 2021 04:33:22 +0000

commit e8185c5f01c68f7d29d23a4a91bc1be1ff2cc1ca
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 18 13:16:59 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 18 13:16:59 2021 +0100

    gnttab: bypass IOMMU (un)mapping when a domain is (un)mapping its own grant
    
    Mappings for a domain's own pages should already be present in the
    IOMMU. While installing the same mapping again is merely redundant (and
    inefficient), removing the mapping when the grant mapping gets removed
    is outright wrong in this case: The mapping was there before the map, so
    should remain in place after unmapping.
    
    This affects
    - Arm Dom0 in the direct mapped case,
    - x86 PV Dom0 in the "iommu=dom0-strict" / "dom0-iommu=strict" case,
    - all x86 PV DomU-s, including driver domains.
    
    See the code comment for why it's the original domain and not the page
    owner that gets compared against.
    
    Reported-by: Rahul Singh <Rahul.Singh@arm.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/grant_table.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 4902598c8f..f937c1d350 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1243,7 +1243,14 @@ map_grant_ref(
         goto undo_out;
     }
 
-    need_iommu = gnttab_need_iommu_mapping(ld);
+    /*
+     * This is deliberately not checking the page's owner: get_paged_frame()
+     * explicitly rejects foreign pages, and all success paths above yield
+     * either owner == rd or owner == dom_io (the dom_cow case is irrelevant
+     * as mem-sharing and IOMMU use are incompatible). The dom_io case would
+     * need checking separately if we compared against owner here.
+     */
+    need_iommu = ld != rd && gnttab_need_iommu_mapping(ld);
     if ( need_iommu )
     {
         unsigned int kind;
@@ -1493,7 +1500,8 @@ unmap_common(
     if ( put_handle )
         put_maptrack_handle(lgt, op->handle);
 
-    if ( rc == GNTST_okay && gnttab_need_iommu_mapping(ld) )
+    /* See the respective comment in map_grant_ref(). */
+    if ( rc == GNTST_okay && ld != rd && gnttab_need_iommu_mapping(ld) )
     {
         unsigned int kind;
         int err = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Feb 22 11:22:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 22 Feb 2021 11:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.87977.165272 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lE9Hy-0007lf-Rq; Mon, 22 Feb 2021 11:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 87977.165272; Mon, 22 Feb 2021 11:22:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lE9Hy-0007lY-Op; Mon, 22 Feb 2021 11:22:06 +0000
Received: by outflank-mailman (input) for mailman id 87977;
 Mon, 22 Feb 2021 11: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 1lE9Hx-0007lT-4T
 for xen-changelog@lists.xenproject.org; Mon, 22 Feb 2021 11: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 1lE9Hx-0006tW-06
 for xen-changelog@lists.xenproject.org; Mon, 22 Feb 2021 11:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lE9Hw-0006gl-V2
 for xen-changelog@lists.xenproject.org; Mon, 22 Feb 2021 11:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=T1oA9rf23U3WcMTI00zbK6cn6w7r34mL3z6FI4fijSc=; b=ExeMY1KLHLoSXA+nEL6sJaqpLR
	vHFgSAkRnWolMYZwv+tlvLtKZI5jh7psBizGrpi0/V9UcEmVVw0dNPnQ4jkqfPgJ3gF/9qD+iNFU9
	E0VNPmSnoELx18/pBv9iRWiJB7qfw+Kih3BCVqejeVvHmNe/o9NiR/rM02CXXQYNBCJI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/misc/xen-vmtrace: use reset and enable
Message-Id: <E1lE9Hw-0006gl-V2@xenbits.xenproject.org>
Date: Mon, 22 Feb 2021 11:22:04 +0000

commit f894c3d8e705fea9cb3244fa61684bfd8bdd1b2a
Author:     Tamas K Lengyel <tamas@tklengyel.com>
AuthorDate: Sat Feb 20 16:07:38 2021 -0500
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Feb 22 11:15:31 2021 +0000

    tools/misc/xen-vmtrace: use reset and enable
    
    The expected behavior while using xen-vmtrace is to get a clean start, even if
    the tool was used previously on the same VM.
    
    Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
---
 tools/misc/xen-vmtrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/misc/xen-vmtrace.c b/tools/misc/xen-vmtrace.c
index 7572e880c5..35d14c6a9b 100644
--- a/tools/misc/xen-vmtrace.c
+++ b/tools/misc/xen-vmtrace.c
@@ -119,7 +119,7 @@ int main(int argc, char **argv)
         goto out;
     }
 
-    if ( xc_vmtrace_enable(xch, domid, vcpu) )
+    if ( xc_vmtrace_reset_and_enable(xch, domid, vcpu) )
     {
         perror("xc_vmtrace_enable()");
         goto out;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Feb 23 19:55:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Feb 2021 19:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.89076.167542 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lEdlz-0004HZ-8U; Tue, 23 Feb 2021 19:55:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 89076.167542; Tue, 23 Feb 2021 19:55: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 1lEdlz-0004HR-5a; Tue, 23 Feb 2021 19:55:07 +0000
Received: by outflank-mailman (input) for mailman id 89076;
 Tue, 23 Feb 2021 19:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lEdlx-0004HM-SE
 for xen-changelog@lists.xenproject.org; Tue, 23 Feb 2021 19:55:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lEdlx-00028L-M9
 for xen-changelog@lists.xenproject.org; Tue, 23 Feb 2021 19:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lEdlx-0002VB-KQ
 for xen-changelog@lists.xenproject.org; Tue, 23 Feb 2021 19:55:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0zxrIFrK9H5iA0Vf8hPzZZmCL85luvttYNWdJDCySXs=; b=ihIT5FYOc6nabK4Dhsf1GQZsMW
	JCCGNbiXlt9mbGaYuAxI1Ke3ULdSLKxJXfHDy17XeV4qBepi0jvREmNHY5EGTW+7UdhVP0j8EQ0AA
	zHve+S9Yn16WbyMC+m0KhE+2fuboJ8+/Dnq+HfRkb5oRj8D9/ZayIl3t5qWM5SdXLZxY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] cirrus-ci: introduce some basic FreeBSD testing
Message-Id: <E1lEdlx-0002VB-KQ@xenbits.xenproject.org>
Date: Tue, 23 Feb 2021 19:55:05 +0000

commit 5d94433a66df29ce314696a13bdd324ec0e342fe
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 23 16:53:53 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 23 19:44:25 2021 +0000

    cirrus-ci: introduce some basic FreeBSD testing
    
    Cirrus-CI supports FreeBSD natively, so introduce some build tests on
    FreeBSD.
    
    The Cirrus-CI requires a Github repository in order to trigger the
    tests.
    
    A sample run output can be seen at:
    
    https://github.com/royger/xen/runs/1962451343
    
    Note the FreeBSD 11 task fails to build QEMU and is not part of this
    patch.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 .cirrus.yml | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/.cirrus.yml b/.cirrus.yml
new file mode 100644
index 0000000000..5e3e46368e
--- /dev/null
+++ b/.cirrus.yml
@@ -0,0 +1,26 @@
+# https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
+freebsd_template: &FREEBSD_TEMPLATE
+  environment:
+    APPEND_LIB: /usr/local/lib
+    APPEND_INCLUDES: /usr/local/include
+
+  install_script: pkg install -y seabios markdown gettext-tools gmake
+                                 pkgconf python libiconv bison perl5
+                                 yajl lzo2 pixman argp-standalone
+                                 libxml2 glib git
+
+  build_script:
+    - ./configure --with-system-seabios=/usr/local/share/seabios/bios.bin
+    - gmake -j`sysctl -n hw.ncpu` clang=y
+
+task:
+  name: 'FreeBSD 12'
+  freebsd_instance:
+    image_family: freebsd-12-2
+  << : *FREEBSD_TEMPLATE
+
+task:
+  name: 'FreeBSD 13'
+  freebsd_instance:
+    image_family: freebsd-13-0
+  << : *FREEBSD_TEMPLATE
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 24 11:55:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Feb 2021 11:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.89283.168078 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lEsl0-0000et-KK; Wed, 24 Feb 2021 11:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 89283.168078; Wed, 24 Feb 2021 11:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lEsl0-0000el-HP; Wed, 24 Feb 2021 11:55:06 +0000
Received: by outflank-mailman (input) for mailman id 89283;
 Wed, 24 Feb 2021 11:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lEsky-0000eg-TE
 for xen-changelog@lists.xenproject.org; Wed, 24 Feb 2021 11:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lEsky-0004cL-O3
 for xen-changelog@lists.xenproject.org; Wed, 24 Feb 2021 11:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lEsky-0002hj-N9
 for xen-changelog@lists.xenproject.org; Wed, 24 Feb 2021 11:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5ZxsfSeLJ7aUcvaCHYCTrDMZP8+X8oFKNHdAZh2HtWg=; b=WdCyDTGiEzjl2T83OupdV1iV7A
	73TZ57QhV9PXImu2bwLPWnxx0stGmpzfpSKYv3RdqQeQR3jEazs/ssDLCArV6dbf8TP24TPwnIeK9
	HhT4gkWAG8HPAnScqUA2ltX9XB+NQVuIMGG1FSc17ubxVVdNsH+llKGztq1fdo3kdqNg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] build: remove more absolute paths from dependency tracking files
Message-Id: <E1lEsky-0002hj-N9@xenbits.xenproject.org>
Date: Wed, 24 Feb 2021 11:55:04 +0000

commit 10bb8aa0d5d029bd56da4a2a92e1e42bef880210
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Feb 24 12:47:34 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 24 12:47:34 2021 +0100

    build: remove more absolute paths from dependency tracking files
    
    d6b12add90da ("DEPS handling: Remove absolute paths from references to
    cwd") took care of massaging the dependencies of the output file, but
    for our passing of -MP to the compiler to take effect the same needs to
    be done on the "phony" rules that the compiler emits.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 259e68863d..eb28e498be 100644
--- a/Config.mk
+++ b/Config.mk
@@ -63,7 +63,7 @@ DEPS_INCLUDE = $(addsuffix .d2, $(basename $(wildcard $(DEPS))))
 DEPS_RM = $(DEPS) $(DEPS_INCLUDE)
 
 %.d2: %.d
-	sed "s! $$PWD/! !" $^ >$@.tmp && mv -f $@.tmp $@
+	sed "s!\(^\| \)$$PWD/! !" $^ >$@.tmp && mv -f $@.tmp $@
 
 include $(XEN_ROOT)/config/$(XEN_OS).mk
 include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 24 11:55:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Feb 2021 11:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.89284.168082 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lEslA-0000fr-Lu; Wed, 24 Feb 2021 11:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 89284.168082; Wed, 24 Feb 2021 11:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lEslA-0000fj-Iw; Wed, 24 Feb 2021 11:55:16 +0000
Received: by outflank-mailman (input) for mailman id 89284;
 Wed, 24 Feb 2021 11:55:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lEsl8-0000fU-U8
 for xen-changelog@lists.xenproject.org; Wed, 24 Feb 2021 11:55:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lEsl8-0004cO-St
 for xen-changelog@lists.xenproject.org; Wed, 24 Feb 2021 11:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lEsl8-0002iV-QE
 for xen-changelog@lists.xenproject.org; Wed, 24 Feb 2021 11:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8NQ/HqYG4l8Beh7WjhsRTgCb4Doa4eHD9jnKKtCOopQ=; b=QRS0rriWovVWw3VZoNIh2RuIfl
	7PZ9WdYLg+0AlWw+p1x+tD/2LVTcu/GXnzuYKBXPVqTBx6CYBMlz1JGiRxnaKW5f9GQ7xQ7cMioSc
	MyBylIC/NiSs9lZ1u6s4hr2oiCL1Dk31/KP1ExhFww4HqKlrOmwj4ep0pOE8oTjEznOc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] hvmloader: use Xen private header for elf structs
Message-Id: <E1lEsl8-0002iV-QE@xenbits.xenproject.org>
Date: Wed, 24 Feb 2021 11:55:14 +0000

commit 81b2b328a26c1b89c275898d12e8ab26c0673dad
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Feb 24 12:48:13 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 24 12:48:13 2021 +0100

    hvmloader: use Xen private header for elf structs
    
    Do not use the system provided elf.h, and instead use elfstructs.h
    from libelf.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/firmware/hvmloader/32bitbios_support.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/firmware/hvmloader/32bitbios_support.c b/tools/firmware/hvmloader/32bitbios_support.c
index 114135022e..e726946a7b 100644
--- a/tools/firmware/hvmloader/32bitbios_support.c
+++ b/tools/firmware/hvmloader/32bitbios_support.c
@@ -21,7 +21,7 @@
  */
 
 #include <inttypes.h>
-#include <elf.h>
+#include <xen/libelf/elfstructs.h>
 #ifdef __sun__
 #include <sys/machelf.h>
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Feb 24 15:44:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Feb 2021 15:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.89406.168371 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lEwKc-000850-9A; Wed, 24 Feb 2021 15:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 89406.168371; Wed, 24 Feb 2021 15:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lEwKc-00084s-5u; Wed, 24 Feb 2021 15:44:06 +0000
Received: by outflank-mailman (input) for mailman id 89406;
 Wed, 24 Feb 2021 15:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lEwKa-00084n-RQ
 for xen-changelog@lists.xenproject.org; Wed, 24 Feb 2021 15:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lEwKa-0000Ns-Ol
 for xen-changelog@lists.xenproject.org; Wed, 24 Feb 2021 15:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lEwKa-0003vy-MB
 for xen-changelog@lists.xenproject.org; Wed, 24 Feb 2021 15:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rpqUl4B6kg297YMjLUug9HKwp0YqcuKwesRtVZbdWuI=; b=llvMoTx8vwAOcySBA8pcofkh8Q
	VBQpS61QBbHcsicdZMIeTxXvhOcbWlJKTdPwqekqUUz+9LRnJu621DrN9Rtp7UwYGkAcaVtU57sPS
	veCufi7cV9ONvtDkVipEO2boKHAsWZssVLzz5PLA10SQEag8zRGSKVZ8ZX1KK9yhTbi4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] elfstructs: add relocation defines for i386
Message-Id: <E1lEwKa-0003vy-MB@xenbits.xenproject.org>
Date: Wed, 24 Feb 2021 15:44:04 +0000

commit 60390ccb8b9b2dbf85010f8b47779bb231aa2533
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Feb 24 16:31:12 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 24 16:31:12 2021 +0100

    elfstructs: add relocation defines for i386
    
    Those are need by the rombios relocation code in hvmloader. Fixes the
    following build error:
    
    32bitbios_support.c: In function 'relocate_32bitbios':
    32bitbios_support.c:130:18: error: 'R_386_PC32' undeclared (first use in this function); did you mean 'R_X86_64_PC32'?
                 case R_386_PC32:
                      ^~~~~~~~~~
                      R_X86_64_PC32
    32bitbios_support.c:130:18: note: each undeclared identifier is reported only once for each function it appears in
    32bitbios_support.c:134:18: error: 'R_386_32' undeclared (first use in this function)
                 case R_386_32:
                      ^~~~~~~~
    
    Only add the two defines that are actually used, which seems to match
    what we do for amd64.
    
    Fixes: 81b2b328a26c1b ('hvmloader: use Xen private header for elf structs')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/include/xen/elfstructs.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/include/xen/elfstructs.h b/xen/include/xen/elfstructs.h
index 726ca8f60d..616ebf9269 100644
--- a/xen/include/xen/elfstructs.h
+++ b/xen/include/xen/elfstructs.h
@@ -436,6 +436,13 @@ typedef struct {
 #define R_AARCH64_MOVW_PREL_G2_NC	292
 #define R_AARCH64_MOVW_PREL_G3		293
 
+/*
+ * Relocation definitions required by the rombios hvmloader relocation
+ * code.
+ */
+#define R_386_32           1            /* Direct 32 bit  */
+#define R_386_PC32         2            /* PC relative 32 bit */
+
 /* Program Header */
 typedef struct {
 	Elf32_Word	p_type;		/* segment type */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 25 12:33:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Feb 2021 12:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.89708.169211 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFFpK-0003n3-Dt; Thu, 25 Feb 2021 12:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 89708.169211; Thu, 25 Feb 2021 12:33:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFFpK-0003mw-Aa; Thu, 25 Feb 2021 12:33:06 +0000
Received: by outflank-mailman (input) for mailman id 89708;
 Thu, 25 Feb 2021 12:33:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFFpI-0003mk-Ox
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 12:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFFpI-0008QO-Ho
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 12:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFFpI-0000Bm-FI
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 12:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zKL3EEh2B0wh2WEZ7URK4FuyVOXfCGhFo0YcpStPV7c=; b=ApVho/6R2n9xer6Rumxd6GFNaA
	X7xT/sTNhd08FxosUhfpfaMNqPXibAXtGK036yf7DgJ62tDJBeRZJtEUall7w7KM6BLhssIH0L9Ca
	B3DPgLWgtR69J4UQMyz6TAkEp0LEGndwmYOvRrCmfoim5lcOVNtNfVsoJ12tMD+3a5cU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/vgic: Implement write to ISPENDR in vGICv{2, 3}
Message-Id: <E1lFFpI-0000Bm-FI@xenbits.xenproject.org>
Date: Thu, 25 Feb 2021 12:33:04 +0000

commit 067935804a8e7a33ff7170a2db8ce94bb46d9a63
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sat Feb 20 14:04:12 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Feb 25 12:09:27 2021 +0000

    xen/vgic: Implement write to ISPENDR in vGICv{2, 3}
    
    Currently, Xen will send a data abort to a guest trying to write to the
    ISPENDR.
    
    Unfortunately, recent version of Linux (at least 5.9+) will start
    writing to the register if the interrupt needs to be re-triggered
    (see the callback irq_retrigger). This can happen when a driver (such as
    the xgbe network driver on AMD Seattle) re-enable an interrupt:
    
    (XEN) d0v0: vGICD: unhandled word write 0x00000004000000 to ISPENDR44
    [...]
    [   25.635837] Unhandled fault at 0xffff80001000522c
    [...]
    [   25.818716]  gic_retrigger+0x2c/0x38
    [   25.822361]  irq_startup+0x78/0x138
    [   25.825920]  __enable_irq+0x70/0x80
    [   25.829478]  enable_irq+0x50/0xa0
    [   25.832864]  xgbe_one_poll+0xc8/0xd8
    [   25.836509]  net_rx_action+0x110/0x3a8
    [   25.840328]  __do_softirq+0x124/0x288
    [   25.844061]  irq_exit+0xe0/0xf0
    [   25.847272]  __handle_domain_irq+0x68/0xc0
    [   25.851442]  gic_handle_irq+0xa8/0xe0
    [   25.855171]  el1_irq+0xb0/0x180
    [   25.858383]  arch_cpu_idle+0x18/0x28
    [   25.862028]  default_idle_call+0x24/0x5c
    [   25.866021]  do_idle+0x204/0x278
    [   25.869319]  cpu_startup_entry+0x24/0x68
    [   25.873313]  rest_init+0xd4/0xe4
    [   25.876611]  arch_call_rest_init+0x10/0x1c
    [   25.880777]  start_kernel+0x5b8/0x5ec
    
    As a consequence, the OS may become unusable.
    
    Implementing the write part of ISPENDR is somewhat easy. For
    virtual interrupt, we only need to inject the interrupt again.
    
    For physical interrupt, we need to be more careful as the de-activation
    of the virtual interrupt will be propagated to the physical distributor.
    For simplicity, the physical interrupt will be set pending so the
    workflow will not differ from a "real" interrupt.
    
    Longer term, we could possible directly activate the physical interrupt
    and avoid taking an exception to inject the interrupt to the domain.
    (This is the approach taken by the new vGIC based on KVM).
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/arm/vgic-v2.c     | 10 ++++++----
 xen/arch/arm/vgic-v3.c     | 18 +++++++-----------
 xen/arch/arm/vgic.c        | 47 ++++++++++++++++++++++++++++++++++++++++++++++
 xen/include/asm-arm/vgic.h |  2 ++
 4 files changed, 62 insertions(+), 15 deletions(-)

diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c
index 64b141fea5..b2da886adc 100644
--- a/xen/arch/arm/vgic-v2.c
+++ b/xen/arch/arm/vgic-v2.c
@@ -472,10 +472,12 @@ static int vgic_v2_distr_mmio_write(struct vcpu *v, mmio_info_t *info,
 
     case VRANGE32(GICD_ISPENDR, GICD_ISPENDRN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        printk(XENLOG_G_ERR
-               "%pv: vGICD: unhandled word write %#"PRIregister" to ISPENDR%d\n",
-               v, r, gicd_reg - GICD_ISPENDR);
-        return 0;
+        rank = vgic_rank_offset(v, 1, gicd_reg - GICD_ISPENDR, DABT_WORD);
+        if ( rank == NULL ) goto write_ignore;
+
+        vgic_set_irqs_pending(v, r, rank->index);
+
+        return 1;
 
     case VRANGE32(GICD_ICPENDR, GICD_ICPENDRN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index fd8cfc156d..613f37abab 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -808,10 +808,12 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,
 
     case VRANGE32(GICD_ISPENDR, GICD_ISPENDRN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        printk(XENLOG_G_ERR
-               "%pv: %s: unhandled word write %#"PRIregister" to ISPENDR%d\n",
-               v, name, r, reg - GICD_ISPENDR);
-        return 0;
+        rank = vgic_rank_offset(v, 1, reg - GICD_ISPENDR, DABT_WORD);
+        if ( rank == NULL ) goto write_ignore;
+
+        vgic_set_irqs_pending(v, r, rank->index);
+
+        return 1;
 
     case VRANGE32(GICD_ICPENDR, GICD_ICPENDRN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
@@ -975,6 +977,7 @@ static int vgic_v3_rdistr_sgi_mmio_write(struct vcpu *v, mmio_info_t *info,
     case VREG32(GICR_ICACTIVER0):
     case VREG32(GICR_ICFGR1):
     case VRANGE32(GICR_IPRIORITYR0, GICR_IPRIORITYR7):
+    case VREG32(GICR_ISPENDR0):
          /*
           * Above registers offset are common with GICD.
           * So handle common with GICD handling
@@ -982,13 +985,6 @@ static int vgic_v3_rdistr_sgi_mmio_write(struct vcpu *v, mmio_info_t *info,
         return __vgic_v3_distr_common_mmio_write("vGICR: SGI", v,
                                                  info, gicr_reg, r);
 
-    case VREG32(GICR_ISPENDR0):
-        if ( dabt.size != DABT_WORD ) goto bad_width;
-        printk(XENLOG_G_ERR
-               "%pv: vGICR: SGI: unhandled word write %#"PRIregister" to ISPENDR0\n",
-               v, r);
-        return 0;
-
     case VREG32(GICR_ICPENDR0):
         if ( dabt.size != DABT_WORD ) goto bad_width;
         printk(XENLOG_G_ERR
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 82f524a35c..8f9400a519 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -423,6 +423,53 @@ void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n)
     }
 }
 
+void vgic_set_irqs_pending(struct vcpu *v, uint32_t r, unsigned int rank)
+{
+    const unsigned long mask = r;
+    unsigned int i;
+    /* The first rank is always per-vCPU */
+    bool private = rank == 0;
+
+    /* LPIs will never be set pending via this function */
+    ASSERT(!is_lpi(32 * rank + 31));
+
+    for_each_set_bit( i, &mask, 32 )
+    {
+        unsigned int irq = i + 32 * rank;
+
+        if ( !private )
+        {
+            struct pending_irq *p = spi_to_pending(v->domain, irq);
+
+            /*
+             * When the domain sets the pending state for a HW interrupt on
+             * the virtual distributor, we set the pending state on the
+             * physical distributor.
+             *
+             * XXX: Investigate whether we would be able to set the
+             * physical interrupt active and save an interruption. (This
+             * is what the new vGIC does).
+             */
+            if ( p->desc != NULL )
+            {
+                unsigned long flags;
+
+                spin_lock_irqsave(&p->desc->lock, flags);
+                gic_set_pending_state(p->desc, true);
+                spin_unlock_irqrestore(&p->desc->lock, flags);
+                continue;
+            }
+        }
+
+        /*
+         * If the interrupt is per-vCPU, then we want to inject the vIRQ
+         * to v, otherwise we should let the function figuring out the
+         * correct vCPU.
+         */
+        vgic_inject_irq(v->domain, private ? v : NULL, irq, true);
+    }
+}
+
 bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode,
                  int virq, const struct sgi_target *target)
 {
diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h
index ce1e3c4bbd..62c2ae538d 100644
--- a/xen/include/asm-arm/vgic.h
+++ b/xen/include/asm-arm/vgic.h
@@ -288,6 +288,8 @@ extern struct vgic_irq_rank *vgic_rank_offset(struct vcpu *v, int b, int n, int
 extern struct vgic_irq_rank *vgic_rank_irq(struct vcpu *v, unsigned int irq);
 extern void vgic_disable_irqs(struct vcpu *v, uint32_t r, int n);
 extern void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n);
+extern void vgic_set_irqs_pending(struct vcpu *v, uint32_t r,
+                                  unsigned int rank);
 extern void register_vgic_ops(struct domain *d, const struct vgic_ops *ops);
 int vgic_v2_init(struct domain *d, int *mmio_count);
 int vgic_v3_init(struct domain *d, int *mmio_count);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 25 14:22:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Feb 2021 14:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.89794.169458 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFHWo-0008Tp-Qw; Thu, 25 Feb 2021 14:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 89794.169458; Thu, 25 Feb 2021 14:22:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFHWo-0008Th-O1; Thu, 25 Feb 2021 14:22:06 +0000
Received: by outflank-mailman (input) for mailman id 89794;
 Thu, 25 Feb 2021 14: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 1lFHWn-0008TV-0h
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14: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 1lFHWm-0001xl-Qk
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFHWm-0001N8-L5
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 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>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TGH3vnBBqlJGco5qHoy8E5HasYBknqXj5LRBagBPhRE=; b=G8Ze1sWDztDF8eCnsCjc594DEq
	fDwtR6fd0nD8Bes2bPl+mSKSMH4wNYfcn5p5Q0uLBFR3CFTW0ReYvcFAqMbbi4BKnHYjz13EsPRIE
	TtgS0VizoiMTOGD+EnHQoFhqhsHh2DLsxHBUs1Q1v/6EkrB7e2KXpKOvka00awiJEfXs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: mirror compat argument translation area for 32-bit PV
Message-Id: <E1lFHWm-0001N8-L5@xenbits.xenproject.org>
Date: Thu, 25 Feb 2021 14:22:04 +0000

commit cda16c1bb223bfaa83022d97d87da7909d604896
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 25 15:10:47 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 25 15:10:47 2021 +0100

    x86: mirror compat argument translation area for 32-bit PV
    
    Now that we guard the entire Xen VA space against speculative abuse
    through hypervisor accesses to guest memory, the argument translation
    area's VA also needs to live outside this range, at least for 32-bit PV
    guests. To avoid extra is_hvm_*() conditionals, use the alternative VA
    uniformly.
    
    While this could be conditionalized upon CONFIG_PV32 &&
    CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS, omitting such extra conditionals
    keeps the code more legible imo.
    
    Fixes: 4dc181599142 ("x86/PV: harden guest memory accesses against speculative abuse")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/mm.c                    |  7 +++++++
 xen/include/asm-x86/config.h         |  8 +++++++-
 xen/include/asm-x86/x86_64/uaccess.h | 12 +++++++++++-
 3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 4366ea34d1..afb4febf6f 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -1691,6 +1691,13 @@ void init_xen_l4_slots(l4_pgentry_t *l4t, mfn_t l4mfn,
     l4t[l4_table_offset(PERDOMAIN_VIRT_START)] =
         l4e_from_page(d->arch.perdomain_l3_pg, __PAGE_HYPERVISOR_RW);
 
+    /* Slot 4: Per-domain mappings mirror. */
+    BUILD_BUG_ON(IS_ENABLED(CONFIG_PV32) &&
+                 !l4_table_offset(PERDOMAIN_ALT_VIRT_START));
+    if ( !is_pv_64bit_domain(d) )
+        l4t[l4_table_offset(PERDOMAIN_ALT_VIRT_START)] =
+            l4t[l4_table_offset(PERDOMAIN_VIRT_START)];
+
     /* Slot 261-: text/data/bss, RW M2P, vmap, frametable, directmap. */
 #ifndef NDEBUG
     if ( short_directmap &&
diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h
index 74406f0239..883c2ef0df 100644
--- a/xen/include/asm-x86/config.h
+++ b/xen/include/asm-x86/config.h
@@ -170,7 +170,11 @@ extern unsigned char boot_edid_info[128];
  *    Guest-defined use.
  *  0x00000000f5800000 - 0x00000000ffffffff [168MB,             PML4:0]
  *    Read-only machine-to-phys translation table (GUEST ACCESSIBLE).
- *  0x0000000100000000 - 0x00007fffffffffff [128TB-4GB,         PML4:0-255]
+ *  0x0000000100000000 - 0x000001ffffffffff [2TB-4GB,           PML4:0-3]
+ *    Unused / Reserved for future use.
+ *  0x0000020000000000 - 0x0000027fffffffff [512GB, 2^39 bytes, PML4:4]
+ *    Mirror of per-domain mappings (for argument translation area; also HVM).
+ *  0x0000028000000000 - 0x00007fffffffffff [125.5TB,           PML4:5-255]
  *    Unused / Reserved for future use.
  */
 
@@ -207,6 +211,8 @@ extern unsigned char boot_edid_info[128];
 #define PERDOMAIN_SLOTS         3
 #define PERDOMAIN_VIRT_SLOT(s)  (PERDOMAIN_VIRT_START + (s) * \
                                  (PERDOMAIN_SLOT_MBYTES << 20))
+/* Slot 4: mirror of per-domain mappings (for compat xlat area accesses). */
+#define PERDOMAIN_ALT_VIRT_START PML4_ADDR(4)
 /* Slot 261: machine-to-phys conversion table (256GB). */
 #define RDWR_MPT_VIRT_START     (PML4_ADDR(261))
 #define RDWR_MPT_VIRT_END       (RDWR_MPT_VIRT_START + MPT_VIRT_SIZE)
diff --git a/xen/include/asm-x86/x86_64/uaccess.h b/xen/include/asm-x86/x86_64/uaccess.h
index c48e57bf09..ba79f950fb 100644
--- a/xen/include/asm-x86/x86_64/uaccess.h
+++ b/xen/include/asm-x86/x86_64/uaccess.h
@@ -1,7 +1,17 @@
 #ifndef __X86_64_UACCESS_H
 #define __X86_64_UACCESS_H
 
-#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current))
+/*
+ * With CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS (apparent) PV guest accesses
+ * are prohibited to touch the Xen private VA range.  The compat argument
+ * translation area, therefore, can't live within this range.  Domains
+ * (potentially) in need of argument translation (32-bit PV, possibly HVM) get
+ * a secondary mapping installed, which needs to be used for such accesses in
+ * the PV case, and will also be used for HVM to avoid extra conditionals.
+ */
+#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current) + \
+                                   (PERDOMAIN_ALT_VIRT_START - \
+                                    PERDOMAIN_VIRT_START))
 #define COMPAT_ARG_XLAT_SIZE      (2*PAGE_SIZE)
 struct vcpu;
 int setup_compat_arg_xlat(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 25 14:22:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Feb 2021 14:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.89795.169462 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFHWy-0008Uj-Sw; Thu, 25 Feb 2021 14:22:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 89795.169462; Thu, 25 Feb 2021 14:22:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFHWy-0008UX-PX; Thu, 25 Feb 2021 14:22:16 +0000
Received: by outflank-mailman (input) for mailman id 89795;
 Thu, 25 Feb 2021 14: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 1lFHWx-0008UN-0n
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14:22:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFHWw-0001xs-UL
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFHWw-0001Nx-TF
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YGLTin5AN7/pOP4+35MYbp+rfX4sUyyH7Xq0sJvaTyk=; b=plHkauCnaNvV1f/kXS9sy3DO3V
	qPEqXqkAWE51L1dn8jwSmp+g3IQmqIe7Yd0OfFs5eNhrR+0AT+S024Skc6lM2eP/wgarBqS2nI3IH
	WI2YC6SH8K7sIRMzJunMflmHrG8bPsQDwvyKC7hT3WmUF5HTkJqlta7tZdq0a4T8g/h4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/EFI: suppress GNU ld 2.36'es creation of base relocs
Message-Id: <E1lFHWw-0001Nx-TF@xenbits.xenproject.org>
Date: Thu, 25 Feb 2021 14:22:14 +0000

commit 76cbb9c3f4dd9ab6aa44eeacab84fb88b2e8bfc1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 25 15:11:58 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 25 15:11:58 2021 +0100

    x86/EFI: suppress GNU ld 2.36'es creation of base relocs
    
    All of the sudden ld creates base relocations itself, for PE
    executables - as a result we now have two of them for every entity to
    be relocated. While we will likely want to use this down the road, it
    doesn't work quite right yet in corner cases, so rather than suppressing
    our own way of creating the relocations we need to tell ld to avoid
    doing so.
    
    Probe whether --disable-reloc-section (which was introduced by the same
    commit making relocation generation the default) is recognized by ld's PE
    emulation, and use the option if so. (To limit redundancy, move the first
    part of setting EFI_LDFLAGS earlier, and use it already while probing.)
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/Makefile | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index dff597f30c..b6567c4127 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -123,8 +123,13 @@ ifneq ($(efi-y),)
 # Check if the compiler supports the MS ABI.
 export XEN_BUILD_EFI := $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o efi/check.o 2>/dev/null && echo y)
 # Check if the linker supports PE.
-XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) -mi386pep --subsystem=10 -S -o efi/check.efi efi/check.o 2>/dev/null && echo y))
+EFI_LDFLAGS = $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=10 --strip-debug
+XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) $(EFI_LDFLAGS) -o efi/check.efi efi/check.o 2>/dev/null && echo y))
 CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
+# Check if the linker produces fixups in PE by default (we need to disable it doing so for now).
+XEN_NO_PE_FIXUPS := $(if $(XEN_BUILD_EFI), \
+                         $(shell $(LD) $(EFI_LDFLAGS) --disable-reloc-section -o efi/check.efi efi/check.o 2>/dev/null && \
+                                 echo --disable-reloc-section))
 endif
 
 ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS)
@@ -177,8 +182,7 @@ note.o: $(TARGET)-syms
 		--rename-section=.data=.note.gnu.build-id -S $@.bin $@
 	rm -f $@.bin
 
-EFI_LDFLAGS = $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=10
-EFI_LDFLAGS += --image-base=$(1) --stack=0,0 --heap=0,0 --strip-debug
+EFI_LDFLAGS += --image-base=$(1) --stack=0,0 --heap=0,0 $(XEN_NO_PE_FIXUPS)
 EFI_LDFLAGS += --section-alignment=0x200000 --file-alignment=0x20
 EFI_LDFLAGS += --major-image-version=$(XEN_VERSION)
 EFI_LDFLAGS += --minor-image-version=$(XEN_SUBVERSION)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 25 14:44:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Feb 2021 14:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.89803.169484 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFHs6-0002Ag-Rj; Thu, 25 Feb 2021 14:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 89803.169484; Thu, 25 Feb 2021 14:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFHs6-0002AY-Og; Thu, 25 Feb 2021 14:44:06 +0000
Received: by outflank-mailman (input) for mailman id 89803;
 Thu, 25 Feb 2021 14:44:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFHs5-0002AT-JC
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14:44:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFHs5-0002IZ-Ft
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFHs5-00030Q-Em
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14:44:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EIAHu/oXIyLTnejwW/czbFM5vBjpayWXIL31iFSMz7M=; b=KVAgi6JxTgroRLgzXi+9vx7e12
	z7ny87W+8A4TD/K0pU5xj1mfwMvhc4dgkjhBFC9jNPI2S7TB8wa6g/NkxCj/4jGJ1r+V50LRijTxg
	WkpnmuNjalRfvHBye2wmvzTwDt3vxq+6Y2hyAR8S4d3gFfAznYOnoxvVTbXtBivjbLFM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: rename {get,put}_user() to {get,put}_guest()
Message-Id: <E1lFHs5-00030Q-Em@xenbits.xenproject.org>
Date: Thu, 25 Feb 2021 14:44:05 +0000

commit a70f4935b4ff4b3b46ae4ec7645717777271062b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 25 15:36:10 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 25 15:36:10 2021 +0100

    x86: rename {get,put}_user() to {get,put}_guest()
    
    Bring them (back) in line with __{get,put}_guest().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/domain.c         | 40 ++++++++++++++++++++--------------------
 xen/include/asm-x86/uaccess.h | 33 ++++++++++++++-------------------
 2 files changed, 34 insertions(+), 39 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 6c7ee25f3b..97fd9456c2 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1649,19 +1649,19 @@ static void load_segments(struct vcpu *n)
 
             if ( !ring_1(regs) )
             {
-                ret  = put_user(regs->ss,       esp-1);
-                ret |= put_user(regs->esp,      esp-2);
+                ret  = put_guest(regs->ss,  esp - 1);
+                ret |= put_guest(regs->esp, esp - 2);
                 esp -= 2;
             }
 
             if ( ret |
-                 put_user(rflags,              esp-1) |
-                 put_user(cs_and_mask,         esp-2) |
-                 put_user(regs->eip,           esp-3) |
-                 put_user(uregs->gs,           esp-4) |
-                 put_user(uregs->fs,           esp-5) |
-                 put_user(uregs->es,           esp-6) |
-                 put_user(uregs->ds,           esp-7) )
+                 put_guest(rflags,      esp - 1) |
+                 put_guest(cs_and_mask, esp - 2) |
+                 put_guest(regs->eip,   esp - 3) |
+                 put_guest(uregs->gs,   esp - 4) |
+                 put_guest(uregs->fs,   esp - 5) |
+                 put_guest(uregs->es,   esp - 6) |
+                 put_guest(uregs->ds,   esp - 7) )
             {
                 gprintk(XENLOG_ERR,
                         "error while creating compat failsafe callback frame\n");
@@ -1690,17 +1690,17 @@ static void load_segments(struct vcpu *n)
         cs_and_mask = (unsigned long)regs->cs |
             ((unsigned long)vcpu_info(n, evtchn_upcall_mask) << 32);
 
-        if ( put_user(regs->ss,            rsp- 1) |
-             put_user(regs->rsp,           rsp- 2) |
-             put_user(rflags,              rsp- 3) |
-             put_user(cs_and_mask,         rsp- 4) |
-             put_user(regs->rip,           rsp- 5) |
-             put_user(uregs->gs,           rsp- 6) |
-             put_user(uregs->fs,           rsp- 7) |
-             put_user(uregs->es,           rsp- 8) |
-             put_user(uregs->ds,           rsp- 9) |
-             put_user(regs->r11,           rsp-10) |
-             put_user(regs->rcx,           rsp-11) )
+        if ( put_guest(regs->ss,    rsp -  1) |
+             put_guest(regs->rsp,   rsp -  2) |
+             put_guest(rflags,      rsp -  3) |
+             put_guest(cs_and_mask, rsp -  4) |
+             put_guest(regs->rip,   rsp -  5) |
+             put_guest(uregs->gs,   rsp -  6) |
+             put_guest(uregs->fs,   rsp -  7) |
+             put_guest(uregs->es,   rsp -  8) |
+             put_guest(uregs->ds,   rsp -  9) |
+             put_guest(regs->r11,   rsp - 10) |
+             put_guest(regs->rcx,   rsp - 11) )
         {
             gprintk(XENLOG_ERR,
                     "error while creating failsafe callback frame\n");
diff --git a/xen/include/asm-x86/uaccess.h b/xen/include/asm-x86/uaccess.h
index f55c2f8729..4a375450c3 100644
--- a/xen/include/asm-x86/uaccess.h
+++ b/xen/include/asm-x86/uaccess.h
@@ -26,14 +26,12 @@ extern void __put_user_bad(void);
 #define UA_DROP(args...)
 
 /**
- * get_user: - Get a simple variable from user space.
+ * get_guest: - Get a simple variable from guest space.
  * @x:   Variable to store result.
- * @ptr: Source address, in user space.
- *
- * Context: User context only.  This function may sleep.
+ * @ptr: Source address, in guest space.
  *
- * This macro copies a single simple variable from user space to kernel
- * space.  It supports simple types like char and int, but not larger
+ * This macro load a single simple variable from guest space.
+ * It supports simple types like char and int, but not larger
  * data types like structures or arrays.
  *
  * @ptr must have pointer-to-simple-variable type, and the result of
@@ -42,18 +40,15 @@ extern void __put_user_bad(void);
  * Returns zero on success, or -EFAULT on error.
  * On error, the variable @x is set to zero.
  */
-#define get_user(x,ptr)	\
-  __get_user_check((x),(ptr),sizeof(*(ptr)))
+#define get_guest(x, ptr) get_guest_check(x, ptr, sizeof(*(ptr)))
 
 /**
- * put_user: - Write a simple value into user space.
- * @x:   Value to copy to user space.
- * @ptr: Destination address, in user space.
- *
- * Context: User context only.  This function may sleep.
+ * put_guest: - Write a simple value into guest space.
+ * @x:   Value to store in guest space.
+ * @ptr: Destination address, in guest space.
  *
- * This macro copies a single simple value from kernel space to user
- * space.  It supports simple types like char and int, but not larger
+ * This macro stores a single simple value from to guest space.
+ * It supports simple types like char and int, but not larger
  * data types like structures or arrays.
  *
  * @ptr must have pointer-to-simple-variable type, and @x must be assignable
@@ -61,8 +56,8 @@ extern void __put_user_bad(void);
  *
  * Returns zero on success, or -EFAULT on error.
  */
-#define put_user(x,ptr)							\
-  __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
+#define put_guest(x, ptr) \
+    put_guest_check((__typeof__(*(ptr)))(x), ptr, sizeof(*(ptr)))
 
 /**
  * __get_guest: - Get a simple variable from guest space, with less checking.
@@ -118,7 +113,7 @@ extern void __put_user_bad(void);
 	err_;								\
 })
 
-#define __put_user_check(x, ptr, size)					\
+#define put_guest_check(x, ptr, size)					\
 ({									\
 	__typeof__(*(ptr)) __user *ptr_ = (ptr);			\
 	__typeof__(size) size_ = (size);				\
@@ -140,7 +135,7 @@ extern void __put_user_bad(void);
 	err_;								\
 })
 
-#define __get_user_check(x, ptr, size)					\
+#define get_guest_check(x, ptr, size)					\
 ({									\
 	__typeof__(*(ptr)) __user *ptr_ = (ptr);			\
 	__typeof__(size) size_ = (size);				\
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 25 14:44:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Feb 2021 14:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.89804.169488 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFHsG-0002Bk-Ug; Thu, 25 Feb 2021 14:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 89804.169488; Thu, 25 Feb 2021 14:44:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFHsG-0002Bc-Rk; Thu, 25 Feb 2021 14:44:16 +0000
Received: by outflank-mailman (input) for mailman id 89804;
 Thu, 25 Feb 2021 14:44:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFHsF-0002BV-MR
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14:44:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFHsF-0002If-LZ
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFHsF-00031D-IV
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14:44:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KBZ9iwrmMynPhm1zS+bMlRRjYFbPvBH0PZcgwFyN4bo=; b=qTFym38WUPzaC7mWLu4ILHloen
	4hQTDVCg3VsIhAbRJFzHRrq5S2O4cpHPRfHGK214lRKn6x257zCeafl54gIGkP2iSx4050Zjv8B14
	dFmeIYsA1sygXjsoQtywmo7+k87xQvJ9PdayJC1AW+x5/pCrRdGNF2ZuHG5LAxujtkIA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/gdbsx: convert "user" to "guest" accesses
Message-Id: <E1lFHsF-00031D-IV@xenbits.xenproject.org>
Date: Thu, 25 Feb 2021 14:44:15 +0000

commit ef20ffd13d76c9be6f14c01296d44fc1a9e055f8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 25 15:36:54 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 25 15:36:54 2021 +0100

    x86/gdbsx: convert "user" to "guest" accesses
    
    Using copy_{from,to}_user(), this code was assuming to be called only by
    PV guests. Use copy_{from,to}_guest() instead, transforming the incoming
    structure field into a guest handle (the field should really have been
    one in the first place). Also do not transform the debuggee address into
    a pointer.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/debug.c           | 21 +++++++++------------
 xen/arch/x86/domctl.c          |  6 ++----
 xen/include/asm-x86/debugger.h |  2 +-
 3 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/debug.c b/xen/arch/x86/debug.c
index f32d4b0bcc..d90dc93056 100644
--- a/xen/arch/x86/debug.c
+++ b/xen/arch/x86/debug.c
@@ -108,12 +108,11 @@ dbg_pv_va2mfn(dbgva_t vaddr, struct domain *dp, uint64_t pgd3val)
 }
 
 /* Returns: number of bytes remaining to be copied */
-static unsigned int dbg_rw_guest_mem(struct domain *dp, void * __user gaddr,
-                                     void * __user buf, unsigned int len,
-                                     bool toaddr, uint64_t pgd3)
+static unsigned int dbg_rw_guest_mem(struct domain *dp, unsigned long addr,
+                                     XEN_GUEST_HANDLE_PARAM(void) buf,
+                                     unsigned int len, bool toaddr,
+                                     uint64_t pgd3)
 {
-    unsigned long addr = (unsigned long)gaddr;
-
     while ( len > 0 )
     {
         char *va;
@@ -134,20 +133,18 @@ static unsigned int dbg_rw_guest_mem(struct domain *dp, void * __user gaddr,
 
         if ( toaddr )
         {
-            copy_from_user(va, buf, pagecnt);    /* va = buf */
+            copy_from_guest(va, buf, pagecnt);
             paging_mark_dirty(dp, mfn);
         }
         else
-        {
-            copy_to_user(buf, va, pagecnt);    /* buf = va */
-        }
+            copy_to_guest(buf, va, pagecnt);
 
         unmap_domain_page(va);
         if ( !gfn_eq(gfn, INVALID_GFN) )
             put_gfn(dp, gfn_x(gfn));
 
         addr += pagecnt;
-        buf += pagecnt;
+        guest_handle_add_offset(buf, pagecnt);
         len -= pagecnt;
     }
 
@@ -161,7 +158,7 @@ static unsigned int dbg_rw_guest_mem(struct domain *dp, void * __user gaddr,
  * pgd3: value of init_mm.pgd[3] in guest. see above.
  * Returns: number of bytes remaining to be copied.
  */
-unsigned int dbg_rw_mem(void * __user addr, void * __user buf,
+unsigned int dbg_rw_mem(unsigned long gva, XEN_GUEST_HANDLE_PARAM(void) buf,
                         unsigned int len, domid_t domid, bool toaddr,
                         uint64_t pgd3)
 {
@@ -170,7 +167,7 @@ unsigned int dbg_rw_mem(void * __user addr, void * __user buf,
     if ( d )
     {
         if ( !d->is_dying )
-            len = dbg_rw_guest_mem(d, addr, buf, len, toaddr, pgd3);
+            len = dbg_rw_guest_mem(d, gva, buf, len, toaddr, pgd3);
         rcu_unlock_domain(d);
     }
 
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index b464465230..b129d2cc2f 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -40,10 +40,8 @@
 #ifdef CONFIG_GDBSX
 static int gdbsx_guest_mem_io(domid_t domid, struct xen_domctl_gdbsx_memio *iop)
 {
-    void * __user gva = (void *)iop->gva, * __user uva = (void *)iop->uva;
-
-    iop->remain = dbg_rw_mem(gva, uva, iop->len, domid,
-                             !!iop->gwr, iop->pgd3val);
+    iop->remain = dbg_rw_mem(iop->gva, guest_handle_from_ptr(iop->uva, void),
+                             iop->len, domid, iop->gwr, iop->pgd3val);
 
     return iop->remain ? -EFAULT : 0;
 }
diff --git a/xen/include/asm-x86/debugger.h b/xen/include/asm-x86/debugger.h
index a9ddb01433..99803bfd0c 100644
--- a/xen/include/asm-x86/debugger.h
+++ b/xen/include/asm-x86/debugger.h
@@ -93,7 +93,7 @@ static inline bool debugger_trap_entry(
 #endif
 
 #ifdef CONFIG_GDBSX
-unsigned int dbg_rw_mem(void * __user addr, void * __user buf,
+unsigned int dbg_rw_mem(unsigned long gva, XEN_GUEST_HANDLE_PARAM(void) buf,
                         unsigned int len, domid_t domid, bool toaddr,
                         uint64_t pgd3);
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 25 14:44:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Feb 2021 14:44:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.89805.169492 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFHsR-0002DC-0L; Thu, 25 Feb 2021 14:44:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 89805.169492; Thu, 25 Feb 2021 14:44:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFHsQ-0002D4-TK; Thu, 25 Feb 2021 14:44:26 +0000
Received: by outflank-mailman (input) for mailman id 89805;
 Thu, 25 Feb 2021 14:44:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFHsP-0002Cu-Rv
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14:44:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFHsP-0002JC-R0
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFHsP-000321-Nx
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14:44:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=k0pWtMqVlBwrfIVeE+WY2uiTHhpLYHyQJRDiPb4iRhQ=; b=kwssI3s/9XJ5LaTBTD66THeHnr
	+FqSpq8bPuwKedZuolfj5kwy/ziALRgAJ1WYg18uXnUDInYUxhgdrukTWn+70HnQZAc3CLKML5Cq1
	eVvsX1qQps2gvWIj6K3p9fwfQ2QBDmGmsYvcRnjmWObh2Uuyt8wOeq0s3yIj/cPaurhI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: rename copy_{from,to}_user() to copy_{from,to}_guest_pv()
Message-Id: <E1lFHsP-000321-Nx@xenbits.xenproject.org>
Date: Thu, 25 Feb 2021 14:44:25 +0000

commit d700690a3bf3115d36d055489a0360fd33416e96
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 25 15:37:35 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 25 15:37:35 2021 +0100

    x86: rename copy_{from,to}_user() to copy_{from,to}_guest_pv()
    
    Bring them (back) in line with __copy_{from,to}_guest_pv(). Since it
    falls in the same group, also convert clear_user(). Instead of adjusting
    __raw_clear_guest(), drop it - it's unused and would require a non-
    checking __clear_guest_pv() which we don't have.
    
    Add previously missing __user at some call sites and in the function
    declarations.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/pv/emul-inv-op.c      |  5 +++--
 xen/arch/x86/pv/iret.c             |  4 ++--
 xen/arch/x86/pv/ro-page-fault.c    |  3 ++-
 xen/arch/x86/usercopy.c            | 33 +++++++++++++++------------------
 xen/include/asm-x86/guest_access.h | 10 +++-------
 xen/include/asm-x86/uaccess.h      |  8 +++++---
 6 files changed, 30 insertions(+), 33 deletions(-)

diff --git a/xen/arch/x86/pv/emul-inv-op.c b/xen/arch/x86/pv/emul-inv-op.c
index 59e3edc8c4..b15f302bca 100644
--- a/xen/arch/x86/pv/emul-inv-op.c
+++ b/xen/arch/x86/pv/emul-inv-op.c
@@ -33,7 +33,7 @@ static int emulate_forced_invalid_op(struct cpu_user_regs *regs)
     eip = regs->rip;
 
     /* Check for forced emulation signature: ud2 ; .ascii "xen". */
-    if ( (rc = copy_from_user(sig, (char *)eip, sizeof(sig))) != 0 )
+    if ( (rc = copy_from_guest_pv(sig, (char __user *)eip, sizeof(sig))) != 0 )
     {
         pv_inject_page_fault(0, eip + sizeof(sig) - rc);
         return EXCRET_fault_fixed;
@@ -43,7 +43,8 @@ static int emulate_forced_invalid_op(struct cpu_user_regs *regs)
     eip += sizeof(sig);
 
     /* We only emulate CPUID. */
-    if ( ( rc = copy_from_user(instr, (char *)eip, sizeof(instr))) != 0 )
+    if ( (rc = copy_from_guest_pv(instr, (char __user *)eip,
+                                  sizeof(instr))) != 0 )
     {
         pv_inject_page_fault(0, eip + sizeof(instr) - rc);
         return EXCRET_fault_fixed;
diff --git a/xen/arch/x86/pv/iret.c b/xen/arch/x86/pv/iret.c
index 39b18b04f3..b508dc17b7 100644
--- a/xen/arch/x86/pv/iret.c
+++ b/xen/arch/x86/pv/iret.c
@@ -54,8 +54,8 @@ unsigned long do_iret(void)
     struct iret_context iret_saved;
     struct vcpu *v = current;
 
-    if ( unlikely(copy_from_user(&iret_saved, (void *)regs->rsp,
-                                 sizeof(iret_saved))) )
+    if ( unlikely(copy_from_guest_pv(&iret_saved, (void __user *)regs->rsp,
+                                     sizeof(iret_saved))) )
     {
         gprintk(XENLOG_ERR,
                 "Fault while reading IRET context from guest stack\n");
diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c
index 5d2dd9fae0..335aa8dc5d 100644
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -90,7 +90,8 @@ static int ptwr_emulated_update(unsigned long addr, intpte_t *p_old,
 
         /* Align address; read full word. */
         addr &= ~(sizeof(full) - 1);
-        if ( (rc = copy_from_user(&full, (void *)addr, sizeof(full))) != 0 )
+        if ( (rc = copy_from_guest_pv(&full, (void __user *)addr,
+                                      sizeof(full))) != 0 )
         {
             x86_emul_pagefault(0, /* Read fault. */
                                addr + sizeof(full) - rc,
diff --git a/xen/arch/x86/usercopy.c b/xen/arch/x86/usercopy.c
index b17d680dde..b8c2d1cc0b 100644
--- a/xen/arch/x86/usercopy.c
+++ b/xen/arch/x86/usercopy.c
@@ -109,19 +109,17 @@ unsigned int copy_from_guest_ll(void *to, const void __user *from, unsigned int
 #if GUARD(1) + 0
 
 /**
- * copy_to_user: - Copy a block of data into user space.
- * @to:   Destination address, in user space.
- * @from: Source address, in kernel space.
+ * copy_to_guest_pv: - Copy a block of data into PV guest space.
+ * @to:   Destination address, in PV guest space.
+ * @from: Source address, in hypervisor space.
  * @n:    Number of bytes to copy.
  *
- * Context: User context only.  This function may sleep.
- *
- * Copy data from kernel space to user space.
+ * Copy data from hypervisor space to PV guest space.
  *
  * Returns number of bytes that could not be copied.
  * On success, this will be zero.
  */
-unsigned copy_to_user(void __user *to, const void *from, unsigned n)
+unsigned int copy_to_guest_pv(void __user *to, const void *from, unsigned int n)
 {
     if ( access_ok(to, n) )
         n = __copy_to_guest_pv(to, from, n);
@@ -129,16 +127,16 @@ unsigned copy_to_user(void __user *to, const void *from, unsigned n)
 }
 
 /**
- * clear_user: - Zero a block of memory in user space.
- * @to:   Destination address, in user space.
+ * clear_guest_pv: - Zero a block of memory in PV guest space.
+ * @to:   Destination address, in PV guest space.
  * @n:    Number of bytes to zero.
  *
- * Zero a block of memory in user space.
+ * Zero a block of memory in PV guest space.
  *
  * Returns number of bytes that could not be cleared.
  * On success, this will be zero.
  */
-unsigned clear_user(void __user *to, unsigned n)
+unsigned int clear_guest_pv(void __user *to, unsigned int n)
 {
     if ( access_ok(to, n) )
     {
@@ -168,14 +166,12 @@ unsigned clear_user(void __user *to, unsigned n)
 }
 
 /**
- * copy_from_user: - Copy a block of data from user space.
- * @to:   Destination address, in kernel space.
- * @from: Source address, in user space.
+ * copy_from_guest_pv: - Copy a block of data from PV guest space.
+ * @to:   Destination address, in hypervisor space.
+ * @from: Source address, in PV guest space.
  * @n:    Number of bytes to copy.
  *
- * Context: User context only.  This function may sleep.
- *
- * Copy data from user space to kernel space.
+ * Copy data from PV guest space to hypervisor space.
  *
  * Returns number of bytes that could not be copied.
  * On success, this will be zero.
@@ -183,7 +179,8 @@ unsigned clear_user(void __user *to, unsigned n)
  * If some data could not be copied, this function will pad the copied
  * data to the requested size using zero bytes.
  */
-unsigned copy_from_user(void *to, const void __user *from, unsigned n)
+unsigned int copy_from_guest_pv(void *to, const void __user *from,
+                                unsigned int n)
 {
     if ( access_ok(from, n) )
         n = __copy_from_guest_pv(to, from, n);
diff --git a/xen/include/asm-x86/guest_access.h b/xen/include/asm-x86/guest_access.h
index 45e28f3220..dbf789fa58 100644
--- a/xen/include/asm-x86/guest_access.h
+++ b/xen/include/asm-x86/guest_access.h
@@ -16,15 +16,15 @@
 #define raw_copy_to_guest(dst, src, len)        \
     (is_hvm_vcpu(current) ?                     \
      copy_to_user_hvm((dst), (src), (len)) :    \
-     copy_to_user((dst), (src), (len)))
+     copy_to_guest_pv(dst, src, len))
 #define raw_copy_from_guest(dst, src, len)      \
     (is_hvm_vcpu(current) ?                     \
      copy_from_user_hvm((dst), (src), (len)) :  \
-     copy_from_user((dst), (src), (len)))
+     copy_from_guest_pv(dst, src, len))
 #define raw_clear_guest(dst,  len)              \
     (is_hvm_vcpu(current) ?                     \
      clear_user_hvm((dst), (len)) :             \
-     clear_user((dst), (len)))
+     clear_guest_pv(dst, len))
 #define __raw_copy_to_guest(dst, src, len)      \
     (is_hvm_vcpu(current) ?                     \
      copy_to_user_hvm((dst), (src), (len)) :    \
@@ -33,10 +33,6 @@
     (is_hvm_vcpu(current) ?                     \
      copy_from_user_hvm((dst), (src), (len)) :  \
      __copy_from_guest_pv(dst, src, len))
-#define __raw_clear_guest(dst,  len)            \
-    (is_hvm_vcpu(current) ?                     \
-     clear_user_hvm((dst), (len)) :             \
-     clear_user((dst), (len)))
 
 /*
  * Pre-validate a guest handle.
diff --git a/xen/include/asm-x86/uaccess.h b/xen/include/asm-x86/uaccess.h
index 4a375450c3..4ca9bfc478 100644
--- a/xen/include/asm-x86/uaccess.h
+++ b/xen/include/asm-x86/uaccess.h
@@ -9,9 +9,11 @@
 
 #include <asm/x86_64/uaccess.h>
 
-unsigned copy_to_user(void *to, const void *from, unsigned len);
-unsigned clear_user(void *to, unsigned len);
-unsigned copy_from_user(void *to, const void *from, unsigned len);
+unsigned int copy_to_guest_pv(void __user *to, const void *from,
+                              unsigned int len);
+unsigned int clear_guest_pv(void __user *to, unsigned int len);
+unsigned int copy_from_guest_pv(void *to, const void __user *from,
+                                unsigned int len);
 
 /* Handles exceptions in both to and from, but doesn't do access_ok */
 unsigned int copy_to_guest_ll(void __user*to, const void *from, unsigned int n);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 25 14:44:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Feb 2021 14:44:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.89806.169496 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFHsb-0002Ef-1o; Thu, 25 Feb 2021 14:44:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 89806.169496; Thu, 25 Feb 2021 14:44:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFHsa-0002EW-Ur; Thu, 25 Feb 2021 14:44:36 +0000
Received: by outflank-mailman (input) for mailman id 89806;
 Thu, 25 Feb 2021 14:44: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 1lFHsZ-0002EG-VJ
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14:44:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFHsZ-0002JP-UB
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFHsZ-00032n-TE
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14:44:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ICZgusyHinSjGpm9YT8y9FXYk90U0OiC4MpqlVdWfTA=; b=sOIfBZk2+4u8Yd9Cq+S74xchxs
	E1aZXOD73bdnEJekCkfWOJRf6HZKw+/g7eB73WoeftQHaNc7VcvZXDNoxy9T781toS7Lvfjl5Tn5T
	yTkbHnfeQLq5peiEl5gg1AHrU3+wGy0EYZqsAWSzpRZNIdPzko8TAMvTCF8XhvTuC7Os=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: move stac()/clac() from {get,put}_unsafe_asm() ...
Message-Id: <E1lFHsZ-00032n-TE@xenbits.xenproject.org>
Date: Thu, 25 Feb 2021 14:44:35 +0000

commit e0d42bdbbde39522c5730730f18722e5452b700c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 25 15:38:35 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 25 15:38:35 2021 +0100

    x86: move stac()/clac() from {get,put}_unsafe_asm() ...
    
    ... to {get,put}_unsafe_size(). There's no need to have the macros
    expanded once per case label in the latter. This also makes the former
    well-formed single statements again. No change in generated code.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/include/asm-x86/uaccess.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/include/asm-x86/uaccess.h b/xen/include/asm-x86/uaccess.h
index 4ca9bfc478..684fccd95c 100644
--- a/xen/include/asm-x86/uaccess.h
+++ b/xen/include/asm-x86/uaccess.h
@@ -154,7 +154,6 @@ struct __large_struct { unsigned long buf[100]; };
  * aliasing issues.
  */
 #define put_unsafe_asm(x, addr, GUARD, err, itype, rtype, ltype, errret) \
-	stac();								\
 	__asm__ __volatile__(						\
 		GUARD(							\
 		"	guest_access_mask_ptr %[ptr], %[scr1], %[scr2]\n" \
@@ -169,11 +168,9 @@ struct __large_struct { unsigned long buf[100]; };
 		: [ret] "+r" (err), [ptr] "=&r" (dummy_)		\
 		  GUARD(, [scr1] "=&r" (dummy_), [scr2] "=&r" (dummy_))	\
 		: [val] ltype (x), "m" (__m(addr)),			\
-		  "[ptr]" (addr), [errno] "i" (errret));		\
-	clac()
+		  "[ptr]" (addr), [errno] "i" (errret))
 
 #define get_unsafe_asm(x, addr, GUARD, err, rtype, ltype, errret)	\
-	stac();								\
 	__asm__ __volatile__(						\
 		GUARD(							\
 		"	guest_access_mask_ptr %[ptr], %[scr1], %[scr2]\n" \
@@ -190,12 +187,12 @@ struct __large_struct { unsigned long buf[100]; };
 		  [ptr] "=&r" (dummy_)					\
 		  GUARD(, [scr1] "=&r" (dummy_), [scr2] "=&r" (dummy_))	\
 		: "m" (__m(addr)), "[ptr]" (addr),			\
-		  [errno] "i" (errret));				\
-	clac()
+		  [errno] "i" (errret))
 
 #define put_unsafe_size(x, ptr, size, grd, retval, errret)                 \
 do {                                                                       \
     retval = 0;                                                            \
+    stac();                                                                \
     switch ( size )                                                        \
     {                                                                      \
     long dummy_;                                                           \
@@ -213,6 +210,7 @@ do {                                                                       \
         break;                                                             \
     default: __put_user_bad();                                             \
     }                                                                      \
+    clac();                                                                \
 } while ( false )
 
 #define put_guest_size(x, ptr, size, retval, errret) \
@@ -221,6 +219,7 @@ do {                                                                       \
 #define get_unsafe_size(x, ptr, size, grd, retval, errret)                 \
 do {                                                                       \
     retval = 0;                                                            \
+    stac();                                                                \
     switch ( size )                                                        \
     {                                                                      \
     long dummy_;                                                           \
@@ -230,6 +229,7 @@ do {                                                                       \
     case 8: get_unsafe_asm(x, ptr, grd, retval,  "", "=r", errret); break; \
     default: __get_user_bad();                                             \
     }                                                                      \
+    clac();                                                                \
 } while ( false )
 
 #define get_guest_size(x, ptr, size, retval, errret)                       \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 25 14:44:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Feb 2021 14:44:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.89807.169499 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFHsl-0002Fq-37; Thu, 25 Feb 2021 14:44:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 89807.169499; Thu, 25 Feb 2021 14:44:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFHsl-0002Fi-09; Thu, 25 Feb 2021 14:44:47 +0000
Received: by outflank-mailman (input) for mailman id 89807;
 Thu, 25 Feb 2021 14:44:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFHsk-0002FZ-4v
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14:44: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 1lFHsk-0002JX-2a
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14:44:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFHsk-00033e-07
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 14: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>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6TBcAy/nGG9wJZTwdhXTm37VT7NsNwFL0UJmqbdQgXc=; b=hA+HllzPaLt/eJB2rbhw5OihHu
	pMf3q6kOuM1bAX8B7kry3QQn5Frnvbb5bp1+sOivzOyz2DgWLP0kDPpnJb41UJsVwzvfI0Co6pP2B
	FYs9zWpNunouwO38CqQFmpJZ/TVPrkDgD58kV4KmS1OGRSOXF3d/N6+a+mJ69SPr86tQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/PV: use get_unsafe() instead of copy_from_unsafe()
Message-Id: <E1lFHsk-00033e-07@xenbits.xenproject.org>
Date: Thu, 25 Feb 2021 14:44:46 +0000

commit 972cd4308775f4eb48cbba3cc4efaf39e55c8057
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 25 15:39:09 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 25 15:39:09 2021 +0100

    x86/PV: use get_unsafe() instead of copy_from_unsafe()
    
    The former expands to a single (memory accessing) insn, which the latter
    does not guarantee (the __builtin_constant_p() based switch() statement
    there is just an optimization). Yet we'd prefer to read consistent PTEs
    rather than risking a split read racing with an update done elsewhere.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/pv/mm.c | 4 +---
 xen/arch/x86/pv/mm.h | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/pv/mm.c b/xen/arch/x86/pv/mm.c
index cb86143832..5ed7b3ccdb 100644
--- a/xen/arch/x86/pv/mm.c
+++ b/xen/arch/x86/pv/mm.c
@@ -41,9 +41,7 @@ l1_pgentry_t *map_guest_l1e(unsigned long linear, mfn_t *gl1mfn)
         return NULL;
 
     /* Find this l1e and its enclosing l1mfn in the linear map. */
-    if ( copy_from_unsafe(&l2e,
-                          &__linear_l2_table[l2_linear_offset(linear)],
-                          sizeof(l2_pgentry_t)) )
+    if ( get_unsafe(l2e, &__linear_l2_table[l2_linear_offset(linear)]) )
         return NULL;
 
     /* Check flags that it will be safe to read the l1e. */
diff --git a/xen/arch/x86/pv/mm.h b/xen/arch/x86/pv/mm.h
index 7e2259c488..5a117c735d 100644
--- a/xen/arch/x86/pv/mm.h
+++ b/xen/arch/x86/pv/mm.h
@@ -22,9 +22,7 @@ static inline l1_pgentry_t guest_get_eff_kern_l1e(unsigned long linear)
         toggle_guest_pt(curr);
 
     if ( unlikely(!__addr_ok(linear)) ||
-         copy_from_unsafe(&l1e,
-                          &__linear_l1_table[l1_linear_offset(linear)],
-                          sizeof(l1_pgentry_t)) )
+         get_unsafe(l1e, &__linear_l1_table[l1_linear_offset(linear)]) )
         l1e = l1e_empty();
 
     if ( user_mode )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 25 15:33:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Feb 2021 15:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.89831.169600 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFIdX-00082h-7s; Thu, 25 Feb 2021 15:33:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 89831.169600; Thu, 25 Feb 2021 15:33:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFIdX-00082a-4T; Thu, 25 Feb 2021 15:33:07 +0000
Received: by outflank-mailman (input) for mailman id 89831;
 Thu, 25 Feb 2021 15:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFIdV-00082V-L5
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 15: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 1lFIdV-000390-K3
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 15:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFIdV-0006lJ-Hf
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 15:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bjpEM08so5IxYTrf3zfrliQh4W529ok61zRO+ZKWWeY=; b=v8RY4GfFqhC7xkLRf3K9kkrdw4
	0Y+qa5UIWxNV/HaZkSfYl/9b+mirKB0UrMv4U1486c0rLUa980T66grHzcz5OmGwQNGnkvHQW8FHi
	7L0TQL94R6tfkPSzpLrhcDmtNusa5O9aNZ53bR1VatMeTPJTMQmbQ+eg/b6xSTK+4KCs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: Fix containerize to understand the Alpine container
Message-Id: <E1lFIdV-0006lJ-Hf@xenbits.xenproject.org>
Date: Thu, 25 Feb 2021 15:33:05 +0000

commit 75b0505547f79cd16b19ca64fc92037bc23cbdf1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 25 14:09:26 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 25 15:22:40 2021 +0000

    automation: Fix containerize to understand the Alpine container
    
    This was missing from the work to add the alpine container.
    
    Fixes: a9afe7768bd ("automation: add alpine linux 3.12 x86 build container")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 automation/scripts/containerize | 1 +
 1 file changed, 1 insertion(+)

diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index da45baed4e..b7c81559fb 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -24,6 +24,7 @@ die() {
 #
 BASE="registry.gitlab.com/xen-project/xen"
 case "_${CONTAINER}" in
+    _alpine) CONTAINER="${BASE}/alpine:3.12" ;;
     _archlinux|_arch) CONTAINER="${BASE}/archlinux:current" ;;
     _centos7) CONTAINER="${BASE}/centos:7" ;;
     _centos72) CONTAINER="${BASE}/centos:7.2" ;;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Feb 25 15:33:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Feb 2021 15:33:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.89832.169604 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFIdh-00083m-AP; Thu, 25 Feb 2021 15:33:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 89832.169604; Thu, 25 Feb 2021 15:33:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFIdh-00083e-7S; Thu, 25 Feb 2021 15:33:17 +0000
Received: by outflank-mailman (input) for mailman id 89832;
 Thu, 25 Feb 2021 15:33:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFIdf-00083X-Om
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 15: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 1lFIdf-000399-NS
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 15:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFIdf-0006lu-MS
 for xen-changelog@lists.xenproject.org; Thu, 25 Feb 2021 15:33:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iKO+DVFgVJ4CEwjm0a60Hi9AJI8QKyx0Dxqx0wN8EQQ=; b=OXny3yI57cZFk4PBiVdwUG+6zT
	07bfXopWp3nNNyNHf4cN1m0pjR6HajFCWW5MozBJVpfY60Qo0YyJsw3HtP+mVxunZJs6PLjlX7U/c
	CrvY1QNY6b5WnmSWmjRyPOiRqjwlwSmNdK4ntGMBUZzAVVtXv2TdxaksG6KBZjc2v6HE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: Fix typo in xc_vmtrace_set_option comment
Message-Id: <E1lFIdf-0006lu-MS@xenbits.xenproject.org>
Date: Thu, 25 Feb 2021 15:33:15 +0000

commit fc8fb368515391374e5f170a1e07205d914bc14a
Author:     Hubert Jasudowicz <hubert.jasudowicz@cert.pl>
AuthorDate: Thu Feb 25 12:43:07 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 25 15:22:40 2021 +0000

    tools: Fix typo in xc_vmtrace_set_option comment
    
    Signed-off-by: Hubert Jasudowicz <hubert.jasudowicz@cert.pl>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/include/xenctrl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 0efcdae8b4..318920166c 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1644,7 +1644,7 @@ int xc_vmtrace_get_option(xc_interface *xch, uint32_t domid,
                           uint32_t vcpu, uint64_t key, uint64_t *value);
 
 /**
- * Set platform specific vntvmtrace options.
+ * Set platform specific vmtrace options.
  *
  * @parm xch a handle to an open hypervisor interface
  * @parm domid domain identifier
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 09:22:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 09:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90168.170634 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFZK2-0001yI-DM; Fri, 26 Feb 2021 09:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90168.170634; Fri, 26 Feb 2021 09:22:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFZK2-0001yA-AL; Fri, 26 Feb 2021 09:22:06 +0000
Received: by outflank-mailman (input) for mailman id 90168;
 Fri, 26 Feb 2021 09:22:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFZK0-0001y5-VQ
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 09: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 1lFZK0-0008Go-O1
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 09:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFZK0-000148-MB
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 09:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eU/gxB4zVFC297V/XHb/2/PXtiGEVZDFFjTaOWazxjw=; b=W9Vi9Z8ihXUBPWCH5iCPNe8Bpq
	bPO9McKjsxbsa6XDMQhJ5T2u/H11dsv47GTqj4nAHe1cpiBKQXRoz1pFvcDqYdXTWfzLzwMXBjWhf
	vWLUO6niaUDKX1979ftwr8ZC3+/NymaYiqxNxzGfiVX8Jio/fB+FOg5sz9BLMOfHav00=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VMX: delay p2m insertion of APIC access page
Message-Id: <E1lFZK0-000148-MB@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 09:22:04 +0000

commit 68b92ee7fef27f85846ef892e3d2e1763807b72d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 26 10:18:59 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 26 10:18:59 2021 +0100

    VMX: delay p2m insertion of APIC access page
    
    Inserting the mapping at domain creation time leads to a memory leak
    when the creation fails later on and the domain uses separate CPU and
    IOMMU page tables - the latter requires intermediate page tables to be
    allocated, but there's no freeing of them at present in this case. Since
    we don't need the p2m insertion to happen this early, avoid the problem
    altogether by deferring it until the last possible point. This comes at
    the price of not being able to handle an error other than by crashing
    the domain.
    
    Reported-by: Julien Grall <julien@xen.org>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/domain.c         |  2 ++
 xen/arch/x86/hvm/vmx/vmx.c    | 12 ++++++++++--
 xen/include/asm-x86/hvm/hvm.h | 12 ++++++++++++
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 97fd9456c2..5e3c94d3fa 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1007,6 +1007,8 @@ int arch_domain_soft_reset(struct domain *d)
 
 void arch_domain_creation_finished(struct domain *d)
 {
+    if ( is_hvm_domain(d) )
+        hvm_domain_creation_finished(d);
 }
 
 #define xen_vcpu_guest_context vcpu_guest_context
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index faba95d057..bfea1b0f8a 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -428,6 +428,14 @@ static void vmx_domain_relinquish_resources(struct domain *d)
     vmx_free_vlapic_mapping(d);
 }
 
+static void domain_creation_finished(struct domain *d)
+{
+    if ( has_vlapic(d) && !mfn_eq(d->arch.hvm.vmx.apic_access_mfn, _mfn(0)) &&
+         set_mmio_p2m_entry(d, gaddr_to_gfn(APIC_DEFAULT_PHYS_BASE),
+                            d->arch.hvm.vmx.apic_access_mfn, PAGE_ORDER_4K) )
+        domain_crash(d);
+}
+
 static void vmx_init_ipt(struct vcpu *v)
 {
     unsigned int size = v->domain->vmtrace_size;
@@ -2408,6 +2416,7 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .cpu_dead             = vmx_cpu_dead,
     .domain_initialise    = vmx_domain_initialise,
     .domain_relinquish_resources = vmx_domain_relinquish_resources,
+    .domain_creation_finished = domain_creation_finished,
     .vcpu_initialise      = vmx_vcpu_initialise,
     .vcpu_destroy         = vmx_vcpu_destroy,
     .save_cpu_ctxt        = vmx_save_vmcs_ctxt,
@@ -3234,8 +3243,7 @@ static int vmx_alloc_vlapic_mapping(struct domain *d)
     clear_domain_page(mfn);
     d->arch.hvm.vmx.apic_access_mfn = mfn;
 
-    return set_mmio_p2m_entry(d, gaddr_to_gfn(APIC_DEFAULT_PHYS_BASE), mfn,
-                              PAGE_ORDER_4K);
+    return 0;
 }
 
 static void vmx_free_vlapic_mapping(struct domain *d)
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index 150746de66..4a8fb571de 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -106,6 +106,7 @@ struct hvm_function_table {
      * Initialise/destroy HVM domain/vcpu resources
      */
     int  (*domain_initialise)(struct domain *d);
+    void (*domain_creation_finished)(struct domain *d);
     void (*domain_relinquish_resources)(struct domain *d);
     void (*domain_destroy)(struct domain *d);
     int  (*vcpu_initialise)(struct vcpu *v);
@@ -390,6 +391,12 @@ static inline bool hvm_has_set_descriptor_access_exiting(void)
     return hvm_funcs.set_descriptor_access_exiting;
 }
 
+static inline void hvm_domain_creation_finished(struct domain *d)
+{
+    if ( hvm_funcs.domain_creation_finished )
+        alternative_vcall(hvm_funcs.domain_creation_finished, d);
+}
+
 static inline int
 hvm_guest_x86_mode(struct vcpu *v)
 {
@@ -766,6 +773,11 @@ static inline void hvm_invlpg(const struct vcpu *v, unsigned long linear)
     ASSERT_UNREACHABLE();
 }
 
+static inline void hvm_domain_creation_finished(struct domain *d)
+{
+    ASSERT_UNREACHABLE();
+}
+
 /*
  * Shadow code needs further cleanup to eliminate some HVM-only paths. For
  * now provide the stubs here but assert they will never be reached.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 09:55:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 09:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90180.170671 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFZpz-0005Im-FS; Fri, 26 Feb 2021 09:55:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90180.170671; Fri, 26 Feb 2021 09:55: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 1lFZpz-0005Ie-CX; Fri, 26 Feb 2021 09:55:07 +0000
Received: by outflank-mailman (input) for mailman id 90180;
 Fri, 26 Feb 2021 09:55: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 1lFZpy-0005IZ-DG
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 09:55: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 1lFZpy-0000Mf-Ao
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 09:55:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFZpy-0003Bw-9G
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 09: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>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BWN0YS+nklUAbDHfSgGp0YfgqKmDTRGVe/6VkTBkg1Q=; b=WzLrFHDkfOvZUh3Am4aG1ED1tL
	mOzLpsvUcYLTtxieY5jC9U1xD8oW2k/QJItIgqpftDZbeaiE1qKllYOPFMgHjQoENq6P48BcLLNo7
	purrow7OoTGQgNLLXvxvKcJXHai+EUAtwZ9Jld5Y9cUgAnR/5Olyz4epaPwZckOP2nB4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: Avoid unnecessary talloc_strdup() in do_control_lu()
Message-Id: <E1lFZpy-0003Bw-9G@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 09:55:06 +0000

commit 2fc7939e26d223b2a8ce37204ea479d013444b7f
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Feb 25 15:15:23 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Feb 26 09:45:41 2021 +0000

    tools/xenstored: Avoid unnecessary talloc_strdup() in do_control_lu()
    
    At the moment, the return of talloc_strdup() is not checked. This means
    we may dereference a NULL pointer if the allocation failed.
    
    However, it is pointless to allocate the memory as send_reply() will
    copy the data to a different buffer. So drop the use of talloc_strdup().
    
    This bug was discovered and resolved using Coverity Static Analysis
    Security Testing (SAST) by Synopsys, Inc.
    
    Fixes: fecab256d474 ("tools/xenstore: add basic live-update command parsing")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xenstore/xenstored_control.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index f10beaf85e..e8a501acdb 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -691,7 +691,6 @@ static const char *lu_start(const void *ctx, struct connection *conn,
 static int do_control_lu(void *ctx, struct connection *conn,
 			 char **vec, int num)
 {
-	const char *resp;
 	const char *ret = NULL;
 	unsigned int i;
 	bool force = false;
@@ -734,8 +733,7 @@ static int do_control_lu(void *ctx, struct connection *conn,
 
 	if (!ret)
 		ret = "OK";
-	resp = talloc_strdup(ctx, ret);
-	send_reply(conn, XS_CONTROL, resp, strlen(resp) + 1);
+	send_reply(conn, XS_CONTROL, ret, strlen(ret) + 1);
 	return 0;
 }
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 09:55:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 09:55:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90181.170674 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFZq9-0005Ja-HH; Fri, 26 Feb 2021 09:55:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90181.170674; Fri, 26 Feb 2021 09:55: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 1lFZq9-0005JT-E4; Fri, 26 Feb 2021 09:55:17 +0000
Received: by outflank-mailman (input) for mailman id 90181;
 Fri, 26 Feb 2021 09:55: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 1lFZq8-0005JN-JW
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 09:55: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 1lFZq8-0000Ml-H9
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 09:55:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFZq8-0003Cl-ED
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 09:55:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=C3MrGIJ37UGrcu5X22qKlpfg6LbBiz1OgqRm6Gq6/Lw=; b=FYDay4aAKdRjJHVR8JT71PbFkz
	H2/2wUi28Ko/mSIEadUoDyGMjIgkONs292Hih9ILmJboA7etf4aLn2Cox1o8bTRDhce+fP9qNhJyd
	RlVqilxky6+/YdyN7ZQCnt/8sYzUnNwczxFCHRUKL0sYGfUHrpG669SZpU2Ur9kAfVc8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: Avoid unnecessary talloc_strdup() in do_lu_start()
Message-Id: <E1lFZq8-0003Cl-ED@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 09:55:16 +0000

commit 702b44be43b431695dd9ab49ca4a89ea50e31711
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Feb 25 15:43:04 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Feb 26 09:45:58 2021 +0000

    tools/xenstored: Avoid unnecessary talloc_strdup() in do_lu_start()
    
    At the moment, the return of talloc_strdup() is not checked. This means
    we may dereference a NULL pointer if the allocation failed.
    
    However, it is pointless to allocate the memory as send_reply() will
    copy the data to a different buffer. So drop the use of talloc_strdup().
    
    This bug was discovered and resolved using Coverity Static Analysis
    Security Testing (SAST) by Synopsys, Inc.
    
    Fixes: af216a99fb4a ("tools/xenstore: add the basic framework for doing the live update")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xenstore/xenstored_control.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index e8a501acdb..8eb5782776 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -638,7 +638,6 @@ static bool do_lu_start(struct delayed_request *req)
 {
 	time_t now = time(NULL);
 	const char *ret;
-	char *resp;
 
 	if (!lu_check_lu_allowed()) {
 		if (now < lu_status->started_at + lu_status->timeout)
@@ -660,8 +659,7 @@ static bool do_lu_start(struct delayed_request *req)
  out:
 	talloc_free(lu_status);
 
-	resp = talloc_strdup(req->in, ret);
-	send_reply(lu_status->conn, XS_CONTROL, resp, strlen(resp) + 1);
+	send_reply(lu_status->conn, XS_CONTROL, ret, strlen(ret) + 1);
 
 	return true;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 09:55:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 09:55:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90182.170679 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFZqJ-0005Kv-Ik; Fri, 26 Feb 2021 09:55:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90182.170679; Fri, 26 Feb 2021 09:55:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFZqJ-0005Ko-Fj; Fri, 26 Feb 2021 09:55:27 +0000
Received: by outflank-mailman (input) for mailman id 90182;
 Fri, 26 Feb 2021 09:55: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 1lFZqI-0005Kg-Nf
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 09:55: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 1lFZqI-0000Ms-KU
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 09:55:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFZqI-0003DL-JW
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 09:55:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FDveu8C9Y4WX8RhtwxfUEMMfhUqGb0W1MXj27wB+Bms=; b=qrhsbFAcUHyplA7lF2bLYlKS/t
	UKCEKJkHLl2tyFhCaN+1TW91gu/spZEESCzzIk8iUbWzwrbeGkw+i68AVaA8AZGi75+JyQRLyvEXR
	x/uGwfbRMXBcHsiE8F6PzeE5/90yWMOPNoSS4ACvTM7vHky1WkubyVD0JV193V+vU05A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: control: Store the save filename in lu_dump_state
Message-Id: <E1lFZqI-0003DL-JW@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 09:55:26 +0000

commit 11d9933f6bf0cdb69cdd82c5ad2213fcbe73502f
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Feb 25 16:33:23 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Feb 26 09:46:12 2021 +0000

    tools/xenstored: control: Store the save filename in lu_dump_state
    
    The function lu_close_dump_state() will use talloc_asprintf() without
    checking whether the allocation succeeded. In the unlikely case we are
    out of memory, we would dereference a NULL pointer.
    
    As we already computed the filename in lu_get_dump_state(), we can store
    the name in the lu_dump_state. This is avoiding to deal with memory file
    in the close path and also reduce the risk to use the different
    filename.
    
    This bug was discovered and resolved using Coverity Static Analysis
    Security Testing (SAST) by Synopsys, Inc.
    
    Fixes: c0dc6a3e7c41 ("tools/xenstore: read internal state when doing live upgrade")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xenstore/xenstored_control.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index 8eb5782776..653890f2d9 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -16,6 +16,7 @@ Interactive commands for Xen Store Daemon.
     along with this program; If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <assert.h>
 #include <ctype.h>
 #include <errno.h>
 #include <stdarg.h>
@@ -74,6 +75,7 @@ struct lu_dump_state {
 	unsigned int size;
 #ifndef __MINIOS__
 	int fd;
+	char *filename;
 #endif
 };
 
@@ -399,17 +401,16 @@ static void lu_dump_close(FILE *fp)
 
 static void lu_get_dump_state(struct lu_dump_state *state)
 {
-	char *filename;
 	struct stat statbuf;
 
 	state->size = 0;
 
-	filename = talloc_asprintf(NULL, "%s/state_dump", xs_daemon_rootdir());
-	if (!filename)
+	state->filename = talloc_asprintf(NULL, "%s/state_dump",
+					  xs_daemon_rootdir());
+	if (!state->filename)
 		barf("Allocation failure");
 
-	state->fd = open(filename, O_RDONLY);
-	talloc_free(filename);
+	state->fd = open(state->filename, O_RDONLY);
 	if (state->fd < 0)
 		return;
 	if (fstat(state->fd, &statbuf) != 0)
@@ -431,14 +432,13 @@ static void lu_get_dump_state(struct lu_dump_state *state)
 
 static void lu_close_dump_state(struct lu_dump_state *state)
 {
-	char *filename;
+	assert(state->filename != NULL);
 
 	munmap(state->buf, state->size);
 	close(state->fd);
 
-	filename = talloc_asprintf(NULL, "%s/state_dump", xs_daemon_rootdir());
-	unlink(filename);
-	talloc_free(filename);
+	unlink(state->filename);
+	talloc_free(state->filename);
 }
 
 static char *lu_exec(const void *ctx, int argc, char **argv)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 09:55:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 09:55:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90183.170683 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFZqT-0005MG-KS; Fri, 26 Feb 2021 09:55:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90183.170683; Fri, 26 Feb 2021 09:55:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFZqT-0005M8-HV; Fri, 26 Feb 2021 09:55:37 +0000
Received: by outflank-mailman (input) for mailman id 90183;
 Fri, 26 Feb 2021 09:55: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 1lFZqS-0005M0-Q0
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 09:55: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 1lFZqS-0000NF-Nm
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 09:55:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFZqS-0003E0-Mg
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 09:55:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q///6oOISbWdXslCXGD38n/fNkndnnbBhdSAGQCWO+I=; b=GV6RBAjZXgQXxoHEcsNnfS/Q9d
	I1S7UExHW+DBHtS7e4Gyn18pZiDsl+HaukaAvjtRXNLULHq1bvXoCsEo0eUoaFAOStHDSlHgAAsgm
	pCUPoIo7/TWX4P1pjFNxNSogkcxEhfgtKcd9JhBTZ6xQ3bOX8gd+VVAJxsQP94bt/8q0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstore-control: Don't leak buf in live_update_start()
Message-Id: <E1lFZqS-0003E0-Mg@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 09:55:36 +0000

commit 79b6574f8ecea39c14557bdd7049c7e2d21ddcbd
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Feb 25 17:08:49 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Feb 26 09:46:36 2021 +0000

    tools/xenstore-control: Don't leak buf in live_update_start()
    
    All the error paths but one will free buf. Cover the remaining path so
    buf can't be leaked.
    
    This bug was discovered and resolved using Coverity Static Analysis
    Security Testing (SAST) by Synopsys, Inc.
    
    Fixes: 7f97193e6aa8 ("tools/xenstore: add live update command to xenstore-control")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xenstore/xenstore_control.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/xenstore/xenstore_control.c b/tools/xenstore/xenstore_control.c
index f6f4626c06..548363ee70 100644
--- a/tools/xenstore/xenstore_control.c
+++ b/tools/xenstore/xenstore_control.c
@@ -44,8 +44,10 @@ static int live_update_start(struct xs_handle *xsh, bool force, unsigned int to)
         return 1;
 
     ret = strdup("BUSY");
-    if (!ret)
+    if (!ret) {
+        free(buf);
         return 1;
+    }
 
     for (time_start = time(NULL); time(NULL) - time_start < to;) {
         free(ret);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 09:55:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 09:55:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90184.170687 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFZqd-0005Nz-M1; Fri, 26 Feb 2021 09:55:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90184.170687; Fri, 26 Feb 2021 09:55:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFZqd-0005Nr-J1; Fri, 26 Feb 2021 09:55:47 +0000
Received: by outflank-mailman (input) for mailman id 90184;
 Fri, 26 Feb 2021 09:55: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 1lFZqc-0005Nd-SH
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 09:55: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 1lFZqc-0000NM-R5
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 09:55:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFZqc-0003Eb-QB
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 09:55:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pK+1/SkfTuPHUk8o9FZ2PMSm7OGvP6iyNCmj82AWml8=; b=nyxACAnuGQp7NlqQw3RKIIgDJ4
	lU8mo+kZKs2LlA58m1/29QcFNpNVo0R59WlhQI98uGBmplJxiznw7yqdHYXNdMlNXbdeMm5JUPLkL
	qAdLZRRFZKRgPkr0bim1ZIrY8NRU78rMW/WTSvtA3fGBQoRXw4kNfoE80kfipQZx9Q+4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/sched: Add missing memory barrier in vcpu_block()
Message-Id: <E1lFZqc-0003Eb-QB@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 09:55:46 +0000

commit 109e8177fd4a225e7025c4c17d2c9537b550b4ed
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sat Feb 20 19:22:34 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Feb 26 09:47:23 2021 +0000

    xen/sched: Add missing memory barrier in vcpu_block()
    
    The comment in vcpu_block() states that the events should be checked
    /after/ blocking to avoids wakeup waiting race. However, from a generic
    perspective, set_bit() doesn't prevent re-ordering. So the following
    could happen:
    
    CPU0  (blocking vCPU A)         |   CPU1 ( unblock vCPU A)
                                    |
    A <- read local events          |
                                    |   set local events
                                    |   test_and_clear_bit(_VPF_blocked)
                                    |       -> Bail out as the bit if not set
                                    |
    set_bit(_VFP_blocked)           |
                                    |
    check A                         |
    
    The variable A will be 0 and therefore the vCPU will be blocked when it
    should continue running.
    
    vcpu_block() is now gaining an smp_mb__after_atomic() to prevent the CPU
    to read any information about local events before the flag _VPF_blocked
    is set.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Ash Wilding <ash.j.wilding@gmail.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Dario Faggioli <dfaggioli@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/common/sched/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index 9745a77eee..2b974fd6f8 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -1418,6 +1418,8 @@ void vcpu_block(void)
 
     set_bit(_VPF_blocked, &v->pause_flags);
 
+    smp_mb__after_atomic();
+
     arch_vcpu_block(v);
 
     /* Check for events /after/ blocking: avoids wakeup waiting race. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 12:44:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 12:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90291.170849 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFcTW-0007BM-92; Fri, 26 Feb 2021 12:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90291.170849; Fri, 26 Feb 2021 12:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFcTW-0007BE-5g; Fri, 26 Feb 2021 12:44:06 +0000
Received: by outflank-mailman (input) for mailman id 90291;
 Fri, 26 Feb 2021 12:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFcTU-0007B7-L2
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 12:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFcTU-0003DN-IG
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 12:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFcTU-0006Cc-Gx
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 12:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ypxyg8txF4rNuxgB6FHEsVG6SfQXYARI+NKH8I5eJjs=; b=K8mjXnIUZodzhnl+b+b0ybxxaV
	sJZbdPf8xIeP7SytaLn9DfaiqoRofifpjPAj7CbNATmMm+ojMGfyvEuSUh5ltQs26LCLnHQNsQoYx
	hAdWdpeWOPjFcqj5Aiex3EzYF6Mz7ruxnz+x34ejLe6jPXHby8pREtmE0ScXG10Rs3C8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/dmop: Properly fail for PV guests
Message-Id: <E1lFcTU-0006Cc-Gx@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 12:44:04 +0000

commit 615367b5275a5b0123f1f1ee86c985fab234a5a4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 25 16:54:17 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 26 12:28:52 2021 +0000

    x86/dmop: Properly fail for PV guests
    
    The current code has an early exit for PV guests, but it returns 0 having done
    nothing.
    
    Fixes: 524a98c2ac5 ("public / x86: introduce __HYPERCALL_dm_op...")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/hvm/dm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
index 5bc172a5d4..612749442e 100644
--- a/xen/arch/x86/hvm/dm.c
+++ b/xen/arch/x86/hvm/dm.c
@@ -365,6 +365,7 @@ int dm_op(const struct dmop_args *op_args)
     if ( rc )
         return rc;
 
+    rc = -EINVAL;
     if ( !is_hvm_domain(d) )
         goto out;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 12:44:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 12:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90292.170853 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFcTg-0007CR-Ao; Fri, 26 Feb 2021 12:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90292.170853; Fri, 26 Feb 2021 12:44:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFcTg-0007CJ-7V; Fri, 26 Feb 2021 12:44:16 +0000
Received: by outflank-mailman (input) for mailman id 90292;
 Fri, 26 Feb 2021 12:44:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFcTe-0007C7-NK
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 12:44:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFcTe-0003DQ-MP
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 12:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFcTe-0006DJ-Kp
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 12:44:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tvEDaw5wAGeD1OqQXIcv6iz6W0gVyZx63B2kfwpHkTI=; b=qUiJ1nRFkalzhHkq9NMFpYZkDF
	/+9Shp/QQhWMG19QQpcgDIF+9KixPvZcMSsarod/SKAF60wGTsbD/e7eyQT3exN82OPCxQCdo5IpL
	/FL2DWIEZYaQ48sB5OHjHOxG5V+IIodbaj5iYSdOl+iSyZOYICmRaZXNszvXiKYzHBEQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] dmop: Add XEN_DMOP_nr_vcpus
Message-Id: <E1lFcTe-0006DJ-Kp@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 12:44:14 +0000

commit c4441ab1f1d506a942002ccc55fdde2fe30ef626
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 25 15:46:10 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 26 12:28:52 2021 +0000

    dmop: Add XEN_DMOP_nr_vcpus
    
    Curiously absent from the stable API/ABIs is an ability to query the number of
    vcpus which a domain has.  Emulators need to know this information in
    particular to know how many stuct ioreq's live in the ioreq server mappings.
    
    In practice, this forces all userspace to link against libxenctrl to use
    xc_domain_getinfo(), which rather defeats the purpose of the stable libraries.
    
    Introduce a DMOP to retrieve this information and surface it in
    libxendevicemodel to help emulators shed their use of unstable interfaces.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    ---
    CC: Jan Beulich <JBeulich@suse.com>
    CC: Roger Pau Monné <roger.pau@citrix.com>
    CC: Wei Liu <wl@xen.org>
    CC: Paul Durrant <paul@xen.org>
    CC: Stefano Stabellini <sstabellini@kernel.org>
    CC: Julien Grall <julien@xen.org>
    CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
    CC: Ian Jackson <iwj@xenproject.org>
    
    For 4.15.  This was a surprise discovery in the massive ABI untangling effort
    I'm currently doing for XenServer's new build system.
    
    This is one new read-only op to obtain information which isn't otherwise
    available under a stable API/ABI.  As such, its risk for 4.15 is very low,
    with a very real quality-of-life improvement for downstreams.
    
    I realise this is technically a new feature and we're long past feature
    freeze, but I'm hoping that "really lets some emulators move off the unstable
    libraries" is sufficiently convincing argument.
    
    It's not sufficient to let Qemu move off unstable libraries yet - at a
    minimum, the add_to_phymap hypercalls need stabilising to support PCI
    Passthrough and BAR remapping.
    
    I'd prefer not to duplicate the op handling between ARM and x86, and if this
    weren't a release window, I'd submit a prereq patch to dedup the common dmop
    handling.  That can wait to 4.16 at this point.  Also, this op ought to work
    against x86 PV guests, but fixing that up will also need this rearrangement
    into common code, so needs to wait.
---
 tools/include/xendevicemodel.h               | 10 ++++++++++
 tools/libs/devicemodel/core.c                | 15 +++++++++++++++
 tools/libs/devicemodel/libxendevicemodel.map |  1 +
 xen/arch/arm/dm.c                            | 10 ++++++++++
 xen/arch/x86/hvm/dm.c                        | 11 +++++++++++
 xen/include/public/hvm/dm_op.h               | 16 ++++++++++++++++
 xen/include/xlat.lst                         |  1 +
 7 files changed, 64 insertions(+)

diff --git a/tools/include/xendevicemodel.h b/tools/include/xendevicemodel.h
index c06b3c84b9..33698d67f3 100644
--- a/tools/include/xendevicemodel.h
+++ b/tools/include/xendevicemodel.h
@@ -357,6 +357,16 @@ int xendevicemodel_pin_memory_cacheattr(
     xendevicemodel_handle *dmod, domid_t domid, uint64_t start, uint64_t end,
     uint32_t type);
 
+/**
+ * Query for the number of vCPUs that a domain has.
+ * @parm dmod a handle to an open devicemodel interface.
+ * @parm domid the domain id to be serviced.
+ * @parm vcpus Number of vcpus.
+ * @return 0 on success and fills @p vcpus, or -1 on failure.
+ */
+int xendevicemodel_nr_vcpus(
+    xendevicemodel_handle *dmod, domid_t domid, unsigned int *vcpus);
+
 /**
  * This function restricts the use of this handle to the specified
  * domain.
diff --git a/tools/libs/devicemodel/core.c b/tools/libs/devicemodel/core.c
index 30bd79f8ba..8e619eeb0a 100644
--- a/tools/libs/devicemodel/core.c
+++ b/tools/libs/devicemodel/core.c
@@ -630,6 +630,21 @@ int xendevicemodel_pin_memory_cacheattr(
     return xendevicemodel_op(dmod, domid, 1, &op, sizeof(op));
 }
 
+int xendevicemodel_nr_vcpus(
+    xendevicemodel_handle *dmod, domid_t domid, unsigned int *vcpus)
+{
+    struct xen_dm_op op = {
+        .op = XEN_DMOP_nr_vcpus,
+    };
+
+    int rc = xendevicemodel_op(dmod, domid, 1, &op, sizeof(op));
+    if ( rc )
+        return rc;
+
+    *vcpus = op.u.nr_vcpus.vcpus;
+    return 0;
+}
+
 int xendevicemodel_restrict(xendevicemodel_handle *dmod, domid_t domid)
 {
     return osdep_xendevicemodel_restrict(dmod, domid);
diff --git a/tools/libs/devicemodel/libxendevicemodel.map b/tools/libs/devicemodel/libxendevicemodel.map
index 733549327b..f7f9e3d932 100644
--- a/tools/libs/devicemodel/libxendevicemodel.map
+++ b/tools/libs/devicemodel/libxendevicemodel.map
@@ -42,4 +42,5 @@ VERS_1.3 {
 VERS_1.4 {
 	global:
 		xendevicemodel_set_irq_level;
+		xendevicemodel_nr_vcpus;
 } VERS_1.3;
diff --git a/xen/arch/arm/dm.c b/xen/arch/arm/dm.c
index 785413372c..d689e336fd 100644
--- a/xen/arch/arm/dm.c
+++ b/xen/arch/arm/dm.c
@@ -38,6 +38,7 @@ int dm_op(const struct dmop_args *op_args)
         [XEN_DMOP_set_ioreq_server_state]           = sizeof(struct xen_dm_op_set_ioreq_server_state),
         [XEN_DMOP_destroy_ioreq_server]             = sizeof(struct xen_dm_op_destroy_ioreq_server),
         [XEN_DMOP_set_irq_level]                    = sizeof(struct xen_dm_op_set_irq_level),
+        [XEN_DMOP_nr_vcpus]                         = sizeof(struct xen_dm_op_nr_vcpus),
     };
 
     rc = rcu_lock_remote_domain_by_id(op_args->domid, &d);
@@ -122,6 +123,15 @@ int dm_op(const struct dmop_args *op_args)
         break;
     }
 
+    case XEN_DMOP_nr_vcpus:
+    {
+        struct xen_dm_op_nr_vcpus *data = &op.u.nr_vcpus;
+
+        data->vcpus = d->max_vcpus;
+        rc = 0;
+        break;
+    }
+
     default:
         rc = ioreq_server_dm_op(&op, d, &const_op);
         break;
diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
index 612749442e..f4f0910463 100644
--- a/xen/arch/x86/hvm/dm.c
+++ b/xen/arch/x86/hvm/dm.c
@@ -359,6 +359,7 @@ int dm_op(const struct dmop_args *op_args)
         [XEN_DMOP_remote_shutdown]                  = sizeof(struct xen_dm_op_remote_shutdown),
         [XEN_DMOP_relocate_memory]                  = sizeof(struct xen_dm_op_relocate_memory),
         [XEN_DMOP_pin_memory_cacheattr]             = sizeof(struct xen_dm_op_pin_memory_cacheattr),
+        [XEN_DMOP_nr_vcpus]                         = sizeof(struct xen_dm_op_nr_vcpus),
     };
 
     rc = rcu_lock_remote_domain_by_id(op_args->domid, &d);
@@ -606,6 +607,15 @@ int dm_op(const struct dmop_args *op_args)
         break;
     }
 
+    case XEN_DMOP_nr_vcpus:
+    {
+        struct xen_dm_op_nr_vcpus *data = &op.u.nr_vcpus;
+
+        data->vcpus = d->max_vcpus;
+        rc = 0;
+        break;
+    }
+
     default:
         rc = ioreq_server_dm_op(&op, d, &const_op);
         break;
@@ -641,6 +651,7 @@ CHECK_dm_op_map_mem_type_to_ioreq_server;
 CHECK_dm_op_remote_shutdown;
 CHECK_dm_op_relocate_memory;
 CHECK_dm_op_pin_memory_cacheattr;
+CHECK_dm_op_nr_vcpus;
 
 int compat_dm_op(domid_t domid,
                  unsigned int nr_bufs,
diff --git a/xen/include/public/hvm/dm_op.h b/xen/include/public/hvm/dm_op.h
index 1f70d58caa..ef7fbc0d3d 100644
--- a/xen/include/public/hvm/dm_op.h
+++ b/xen/include/public/hvm/dm_op.h
@@ -449,6 +449,21 @@ struct xen_dm_op_set_irq_level {
 };
 typedef struct xen_dm_op_set_irq_level xen_dm_op_set_irq_level_t;
 
+/*
+ * XEN_DMOP_nr_vcpus: Query the number of vCPUs a domain has.
+ *
+ * This is the number of vcpu objects allocated in Xen for the domain, and is
+ * fixed from creation time.  This bound is applicable to e.g. the vcpuid
+ * parameter of XEN_DMOP_inject_event, or number of struct ioreq objects
+ * mapped via XENMEM_acquire_resource.
+ */
+#define XEN_DMOP_nr_vcpus 20
+
+struct xen_dm_op_nr_vcpus {
+    uint32_t vcpus; /* OUT */
+};
+typedef struct xen_dm_op_nr_vcpus xen_dm_op_nr_vcpus_t;
+
 struct xen_dm_op {
     uint32_t op;
     uint32_t pad;
@@ -472,6 +487,7 @@ struct xen_dm_op {
         xen_dm_op_remote_shutdown_t remote_shutdown;
         xen_dm_op_relocate_memory_t relocate_memory;
         xen_dm_op_pin_memory_cacheattr_t pin_memory_cacheattr;
+        xen_dm_op_nr_vcpus_t nr_vcpus;
     } u;
 };
 
diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst
index 398993d5f4..65f7fe3811 100644
--- a/xen/include/xlat.lst
+++ b/xen/include/xlat.lst
@@ -98,6 +98,7 @@
 ?	dm_op_ioreq_server_range	hvm/dm_op.h
 ?	dm_op_map_mem_type_to_ioreq_server hvm/dm_op.h
 ?	dm_op_modified_memory		hvm/dm_op.h
+?	dm_op_nr_vcpus			hvm/dm_op.h
 ?	dm_op_pin_memory_cacheattr	hvm/dm_op.h
 ?	dm_op_relocate_memory		hvm/dm_op.h
 ?	dm_op_remote_shutdown		hvm/dm_op.h
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:11:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90482.171310 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgdr-0005UL-R7; Fri, 26 Feb 2021 17:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90482.171310; Fri, 26 Feb 2021 17:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgdr-0005UD-OD; Fri, 26 Feb 2021 17:11:03 +0000
Received: by outflank-mailman (input) for mailman id 90482;
 Fri, 26 Feb 2021 17: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 1lFgdq-0005U8-9g
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17: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 1lFgdq-0008Jm-6s
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgdq-0002pr-60
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5RBhMyDmZ76fbxGMxRXmm9b06oDDv+E5s4eAlHrE8Z8=; b=w5ZP8eboZZPGMLBDzUtwZTa7p1
	NPYlsD01SApkMVj4UhooNfLn7t1zokZL/5aBz0uk+s6crxA98B2X2C7BTY5nuH/Fpd65IyjCPHHPU
	eTi1daQNEbsKzhTykeiywIcgbHujJN1RQ/bkKIJmE0JeGjYIjgrX3dF8FnTijkTXzpuI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm : smmuv3: Fix to handle multiple StreamIds per device.
Message-Id: <E1lFgdq-0002pr-60@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:11:02 +0000

commit 6794cdd08ea8b3512c53b8f162cb3f88fef54d0d
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Wed Feb 17 10:05:14 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Feb 19 14:55:54 2021 +0000

    xen/arm : smmuv3: Fix to handle multiple StreamIds per device.
    
    SMMUv3 driver does not handle multiple StreamId if the master device
    supports more than one StreamID.
    
    This bug was introduced when the driver was ported from Linux to XEN.
    dt_device_set_protected(..) should be called from add_device(..) not
    from the dt_xlate(..).
    
    Move dt_device_set_protected(..) from dt_xlate(..) to add_device().
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/drivers/passthrough/arm/smmu-v3.c | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c
index 914cdc1cf4..53d150cdb6 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.c
+++ b/xen/drivers/passthrough/arm/smmu-v3.c
@@ -2207,24 +2207,6 @@ static int arm_smmu_add_device(u8 devfn, struct device *dev)
 	 */
 	arm_smmu_enable_pasid(master);
 
-	return 0;
-
-err_free_master:
-	xfree(master);
-	dev_iommu_priv_set(dev, NULL);
-	return ret;
-}
-
-static int arm_smmu_dt_xlate(struct device *dev,
-				const struct dt_phandle_args *args)
-{
-	int ret;
-	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
-
-	ret = iommu_fwspec_add_ids(dev, args->args, 1);
-	if (ret)
-		return ret;
-
 	if (dt_device_is_protected(dev_to_dt(dev))) {
 		dev_err(dev, "Already added to SMMUv3\n");
 		return -EEXIST;
@@ -2237,6 +2219,17 @@ static int arm_smmu_dt_xlate(struct device *dev,
 			dev_name(fwspec->iommu_dev), fwspec->num_ids);
 
 	return 0;
+
+err_free_master:
+	xfree(master);
+	dev_iommu_priv_set(dev, NULL);
+	return ret;
+}
+
+static int arm_smmu_dt_xlate(struct device *dev,
+				const struct dt_phandle_args *args)
+{
+	return iommu_fwspec_add_ids(dev, args->args, 1);
 }
 
 /* Probing and initialisation functions */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:11:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90483.171314 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFge1-0005WY-Tv; Fri, 26 Feb 2021 17:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90483.171314; Fri, 26 Feb 2021 17:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFge1-0005WP-Pl; Fri, 26 Feb 2021 17:11:13 +0000
Received: by outflank-mailman (input) for mailman id 90483;
 Fri, 26 Feb 2021 17: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 1lFge0-0005Ux-Ee
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17: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 1lFge0-0008Jv-Cn
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFge0-0002qb-9k
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WV/WFuMJlCfQzdiqIhPszIjWz93Sl/t25yrEB99VsuM=; b=4t8wBlL3DnDHpLZcsttCYVGcAx
	Mo3/8FoXJ59LcR/lJvQAzw2wOL6a/4qeUTO4uwVwpD58uyizNGKkNIqC6dJ9R8g6YKt9BOlRAHvE8
	JsBEGhyHvysl9mU8V+N6fqVyAHnaxPKxw+F3OvbRn6M///ebN5io/WBr5n0vrcRKg4Zw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: split __{get,put}_user() into "guest" and "unsafe" variants
Message-Id: <E1lFge0-0002qb-9k@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:11:12 +0000

commit 6a1d72d3739e330caf728ea07d656d7bf568824b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 19 17:18:27 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 19 17:18:27 2021 +0100

    x86: split __{get,put}_user() into "guest" and "unsafe" variants
    
    The "guest" variants are intended to work with (potentially) fully guest
    controlled addresses, while the "unsafe" variants are intended to be
    used in order to access addresses not (directly) under guest control,
    within Xen's part of virtual address space. (For linear page table and
    descriptor table accesses the low bits of the addresses may still be
    guest controlled, but this still won't allow speculation to "escape"
    into unwanted areas.) Subsequently we will want them to have distinct
    behavior, so as first step identify which one is which. For now, both
    groups of constructs alias one another.
    
    Double underscore prefixes are retained only on __{get,put}_guest(), to
    allow still distinguishing them from their "checking" counterparts once
    they also get renamed (to {get,put}_guest()).
    
    Since for them it's almost a full re-write, move what becomes
    {get,put}_unsafe_size() into the "common" uaccess.h (x86_64/*.h should
    disappear at some point anyway).
    
    In __copy_to_user() one of the two casts in each put_guest_size()
    invocation gets dropped. They're not needed and did break symmetry with
    __copy_from_user().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org> [shadow]
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/mm/shadow/multi.c            |  4 +-
 xen/arch/x86/pv/emul-gate-op.c            |  8 +--
 xen/arch/x86/pv/emulate.c                 |  4 +-
 xen/arch/x86/pv/iret.c                    | 22 ++++----
 xen/arch/x86/traps.c                      |  4 +-
 xen/include/asm-x86/uaccess.h             | 87 ++++++++++++++++++++-----------
 xen/include/asm-x86/x86_64/uaccess.h      | 24 ---------
 xen/test/livepatch/xen_hello_world_func.c |  2 +-
 8 files changed, 78 insertions(+), 77 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index da46eae835..36f548b554 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -776,9 +776,9 @@ shadow_write_entries(void *d, void *s, int entries, mfn_t mfn)
     /* Because we mirror access rights at all levels in the shadow, an
      * l2 (or higher) entry with the RW bit cleared will leave us with
      * no write access through the linear map.
-     * We detect that by writing to the shadow with __put_user() and
+     * We detect that by writing to the shadow with put_unsafe() and
      * using map_domain_page() to get a writeable mapping if we need to. */
-    if ( __put_user(*dst, dst) )
+    if ( put_unsafe(*dst, dst) )
     {
         perfc_incr(shadow_linear_map_failed);
         map = map_domain_page(mfn);
diff --git a/xen/arch/x86/pv/emul-gate-op.c b/xen/arch/x86/pv/emul-gate-op.c
index 61e65ce521..90a0a47aef 100644
--- a/xen/arch/x86/pv/emul-gate-op.c
+++ b/xen/arch/x86/pv/emul-gate-op.c
@@ -40,7 +40,7 @@ static int read_gate_descriptor(unsigned int gate_sel,
          ((gate_sel >> 3) + !is_pv_32bit_vcpu(v) >=
           (gate_sel & 4 ? v->arch.pv.ldt_ents
                         : v->arch.pv.gdt_ents)) ||
-         __get_user(desc, pdesc) )
+         get_unsafe(desc, pdesc) )
         return 0;
 
     *sel = (desc.a >> 16) & 0x0000fffc;
@@ -59,7 +59,7 @@ static int read_gate_descriptor(unsigned int gate_sel,
     {
         if ( (*ar & 0x1f00) != 0x0c00 ||
              /* Limit check done above already. */
-             __get_user(desc, pdesc + 1) ||
+             get_unsafe(desc, pdesc + 1) ||
              (desc.b & 0x1f00) )
             return 0;
 
@@ -294,7 +294,7 @@ void pv_emulate_gate_op(struct cpu_user_regs *regs)
         { \
             --stkp; \
             esp -= 4; \
-            rc = __put_user(item, stkp); \
+            rc = __put_guest(item, stkp); \
             if ( rc ) \
             { \
                 pv_inject_page_fault(PFEC_write_access, \
@@ -362,7 +362,7 @@ void pv_emulate_gate_op(struct cpu_user_regs *regs)
                     unsigned int parm;
 
                     --ustkp;
-                    rc = __get_user(parm, ustkp);
+                    rc = __get_guest(parm, ustkp);
                     if ( rc )
                     {
                         pv_inject_page_fault(0, (unsigned long)(ustkp + 1) - rc);
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index c0b153e2c5..e8bb326efd 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -34,13 +34,13 @@ int pv_emul_read_descriptor(unsigned int sel, const struct vcpu *v,
     if ( sel < 4 ||
          /*
           * Don't apply the GDT limit here, as the selector may be a Xen
-          * provided one. __get_user() will fail (without taking further
+          * provided one. get_unsafe() will fail (without taking further
           * action) for ones falling in the gap between guest populated
           * and Xen ones.
           */
          ((sel & 4) && (sel >> 3) >= v->arch.pv.ldt_ents) )
         desc.b = desc.a = 0;
-    else if ( __get_user(desc, gdt_ldt_desc_ptr(sel)) )
+    else if ( get_unsafe(desc, gdt_ldt_desc_ptr(sel)) )
         return 0;
     if ( !insn_fetch )
         desc.b &= ~_SEGMENT_L;
diff --git a/xen/arch/x86/pv/iret.c b/xen/arch/x86/pv/iret.c
index 9e34b616f9..39b18b04f3 100644
--- a/xen/arch/x86/pv/iret.c
+++ b/xen/arch/x86/pv/iret.c
@@ -114,15 +114,15 @@ unsigned int compat_iret(void)
     regs->rsp = (u32)regs->rsp;
 
     /* Restore EAX (clobbered by hypercall). */
-    if ( unlikely(__get_user(regs->eax, (u32 *)regs->rsp)) )
+    if ( unlikely(__get_guest(regs->eax, (u32 *)regs->rsp)) )
     {
         domain_crash(v->domain);
         return 0;
     }
 
     /* Restore CS and EIP. */
-    if ( unlikely(__get_user(regs->eip, (u32 *)regs->rsp + 1)) ||
-        unlikely(__get_user(regs->cs, (u32 *)regs->rsp + 2)) )
+    if ( unlikely(__get_guest(regs->eip, (u32 *)regs->rsp + 1)) ||
+        unlikely(__get_guest(regs->cs, (u32 *)regs->rsp + 2)) )
     {
         domain_crash(v->domain);
         return 0;
@@ -132,7 +132,7 @@ unsigned int compat_iret(void)
      * Fix up and restore EFLAGS. We fix up in a local staging area
      * to avoid firing the BUG_ON(IOPL) check in arch_get_info_guest.
      */
-    if ( unlikely(__get_user(eflags, (u32 *)regs->rsp + 3)) )
+    if ( unlikely(__get_guest(eflags, (u32 *)regs->rsp + 3)) )
     {
         domain_crash(v->domain);
         return 0;
@@ -164,16 +164,16 @@ unsigned int compat_iret(void)
         {
             for (i = 1; i < 10; ++i)
             {
-                rc |= __get_user(x, (u32 *)regs->rsp + i);
-                rc |= __put_user(x, (u32 *)(unsigned long)ksp + i);
+                rc |= __get_guest(x, (u32 *)regs->rsp + i);
+                rc |= __put_guest(x, (u32 *)(unsigned long)ksp + i);
             }
         }
         else if ( ksp > regs->esp )
         {
             for ( i = 9; i > 0; --i )
             {
-                rc |= __get_user(x, (u32 *)regs->rsp + i);
-                rc |= __put_user(x, (u32 *)(unsigned long)ksp + i);
+                rc |= __get_guest(x, (u32 *)regs->rsp + i);
+                rc |= __put_guest(x, (u32 *)(unsigned long)ksp + i);
             }
         }
         if ( rc )
@@ -189,7 +189,7 @@ unsigned int compat_iret(void)
             eflags &= ~X86_EFLAGS_IF;
         regs->eflags &= ~(X86_EFLAGS_VM|X86_EFLAGS_RF|
                           X86_EFLAGS_NT|X86_EFLAGS_TF);
-        if ( unlikely(__put_user(0, (u32 *)regs->rsp)) )
+        if ( unlikely(__put_guest(0, (u32 *)regs->rsp)) )
         {
             domain_crash(v->domain);
             return 0;
@@ -205,8 +205,8 @@ unsigned int compat_iret(void)
     else if ( ring_1(regs) )
         regs->esp += 16;
     /* Return to ring 2/3: restore ESP and SS. */
-    else if ( __get_user(regs->ss, (u32 *)regs->rsp + 5) ||
-              __get_user(regs->esp, (u32 *)regs->rsp + 4) )
+    else if ( __get_guest(regs->ss, (u32 *)regs->rsp + 5) ||
+              __get_guest(regs->esp, (u32 *)regs->rsp + 4) )
     {
         domain_crash(v->domain);
         return 0;
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index a6f1d45e77..c65835844d 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -274,7 +274,7 @@ static void compat_show_guest_stack(struct vcpu *v,
     {
         if ( (((long)stack - 1) ^ ((long)(stack + 1) - 1)) & mask )
             break;
-        if ( __get_user(addr, stack) )
+        if ( __get_guest(addr, stack) )
         {
             if ( i != 0 )
                 printk("\n    ");
@@ -343,7 +343,7 @@ static void show_guest_stack(struct vcpu *v, const struct cpu_user_regs *regs)
     {
         if ( (((long)stack - 1) ^ ((long)(stack + 1) - 1)) & mask )
             break;
-        if ( __get_user(addr, stack) )
+        if ( __get_guest(addr, stack) )
         {
             if ( i != 0 )
                 printk("\n    ");
diff --git a/xen/include/asm-x86/uaccess.h b/xen/include/asm-x86/uaccess.h
index 8411fb9586..570b6b8080 100644
--- a/xen/include/asm-x86/uaccess.h
+++ b/xen/include/asm-x86/uaccess.h
@@ -59,13 +59,11 @@ extern void __put_user_bad(void);
   __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
 
 /**
- * __get_user: - Get a simple variable from user space, with less checking.
+ * __get_guest: - Get a simple variable from guest space, with less checking.
  * @x:   Variable to store result.
- * @ptr: Source address, in user space.
- *
- * Context: User context only.  This function may sleep.
+ * @ptr: Source address, in guest space.
  *
- * This macro copies a single simple variable from user space to kernel
+ * This macro copies a single simple variable from guest space to hypervisor
  * space.  It supports simple types like char and int, but not larger
  * data types like structures or arrays.
  *
@@ -78,17 +76,15 @@ extern void __put_user_bad(void);
  * Returns zero on success, or -EFAULT on error.
  * On error, the variable @x is set to zero.
  */
-#define __get_user(x,ptr) \
-  __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
+#define __get_guest(x, ptr) get_guest_nocheck(x, ptr, sizeof(*(ptr)))
+#define get_unsafe __get_guest
 
 /**
- * __put_user: - Write a simple value into user space, with less checking.
- * @x:   Value to copy to user space.
- * @ptr: Destination address, in user space.
+ * __put_guest: - Write a simple value into guest space, with less checking.
+ * @x:   Value to store in guest space.
+ * @ptr: Destination address, in guest space.
  *
- * Context: User context only.  This function may sleep.
- *
- * This macro copies a single simple value from kernel space to user
+ * This macro copies a single simple value from hypervisor space to guest
  * space.  It supports simple types like char and int, but not larger
  * data types like structures or arrays.
  *
@@ -100,13 +96,14 @@ extern void __put_user_bad(void);
  *
  * Returns zero on success, or -EFAULT on error.
  */
-#define __put_user(x,ptr) \
-  __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
+#define __put_guest(x, ptr) \
+    put_guest_nocheck((__typeof__(*(ptr)))(x), ptr, sizeof(*(ptr)))
+#define put_unsafe __put_guest
 
-#define __put_user_nocheck(x, ptr, size)				\
+#define put_guest_nocheck(x, ptr, size)					\
 ({									\
 	int err_; 							\
-	__put_user_size(x, ptr, size, err_, -EFAULT);			\
+	put_guest_size(x, ptr, size, err_, -EFAULT);			\
 	err_;								\
 })
 
@@ -114,14 +111,14 @@ extern void __put_user_bad(void);
 ({									\
 	__typeof__(*(ptr)) __user *ptr_ = (ptr);			\
 	__typeof__(size) size_ = (size);				\
-	access_ok(ptr_, size_) ? __put_user_nocheck(x, ptr_, size_)	\
+	access_ok(ptr_, size_) ? put_guest_nocheck(x, ptr_, size_)	\
 			       : -EFAULT;				\
 })
 
-#define __get_user_nocheck(x, ptr, size)				\
+#define get_guest_nocheck(x, ptr, size)					\
 ({									\
 	int err_; 							\
-	__get_user_size(x, ptr, size, err_, -EFAULT);			\
+	get_guest_size(x, ptr, size, err_, -EFAULT);			\
 	err_;								\
 })
 
@@ -129,7 +126,7 @@ extern void __put_user_bad(void);
 ({									\
 	__typeof__(*(ptr)) __user *ptr_ = (ptr);			\
 	__typeof__(size) size_ = (size);				\
-	access_ok(ptr_, size_) ? __get_user_nocheck(x, ptr_, size_)	\
+	access_ok(ptr_, size_) ? get_guest_nocheck(x, ptr_, size_)	\
 			       : -EFAULT;				\
 })
 
@@ -141,7 +138,7 @@ struct __large_struct { unsigned long buf[100]; };
  * we do not write to any memory gcc knows about, so there are no
  * aliasing issues.
  */
-#define __put_user_asm(x, addr, err, itype, rtype, ltype, errret)	\
+#define put_unsafe_asm(x, addr, err, itype, rtype, ltype, errret)	\
 	stac();								\
 	__asm__ __volatile__(						\
 		"1:	mov"itype" %"rtype"1,%2\n"			\
@@ -155,7 +152,7 @@ struct __large_struct { unsigned long buf[100]; };
 		: ltype (x), "m"(__m(addr)), "i"(errret), "0"(err));	\
 	clac()
 
-#define __get_user_asm(x, addr, err, itype, rtype, ltype, errret)	\
+#define get_unsafe_asm(x, addr, err, itype, rtype, ltype, errret)	\
 	stac();								\
 	__asm__ __volatile__(						\
 		"1:	mov"itype" %2,%"rtype"1\n"			\
@@ -170,6 +167,34 @@ struct __large_struct { unsigned long buf[100]; };
 		: "m"(__m(addr)), "i"(errret), "0"(err));		\
 	clac()
 
+#define put_unsafe_size(x, ptr, size, retval, errret)                      \
+do {                                                                       \
+    retval = 0;                                                            \
+    switch ( size )                                                        \
+    {                                                                      \
+    case 1: put_unsafe_asm(x, ptr, retval, "b", "b", "iq", errret); break; \
+    case 2: put_unsafe_asm(x, ptr, retval, "w", "w", "ir", errret); break; \
+    case 4: put_unsafe_asm(x, ptr, retval, "l", "k", "ir", errret); break; \
+    case 8: put_unsafe_asm(x, ptr, retval, "q",  "", "ir", errret); break; \
+    default: __put_user_bad();                                             \
+    }                                                                      \
+} while ( false )
+#define put_guest_size put_unsafe_size
+
+#define get_unsafe_size(x, ptr, size, retval, errret)                      \
+do {                                                                       \
+    retval = 0;                                                            \
+    switch ( size )                                                        \
+    {                                                                      \
+    case 1: get_unsafe_asm(x, ptr, retval, "b", "b", "=q", errret); break; \
+    case 2: get_unsafe_asm(x, ptr, retval, "w", "w", "=r", errret); break; \
+    case 4: get_unsafe_asm(x, ptr, retval, "l", "k", "=r", errret); break; \
+    case 8: get_unsafe_asm(x, ptr, retval, "q",  "", "=r", errret); break; \
+    default: __get_user_bad();                                             \
+    }                                                                      \
+} while ( false )
+#define get_guest_size get_unsafe_size
+
 /**
  * __copy_to_user: - Copy a block of data into user space, with less checking
  * @to:   Destination address, in user space.
@@ -192,16 +217,16 @@ __copy_to_user(void __user *to, const void *from, unsigned long n)
 
         switch (n) {
         case 1:
-            __put_user_size(*(const u8 *)from, (u8 __user *)to, 1, ret, 1);
+            put_guest_size(*(const uint8_t *)from, to, 1, ret, 1);
             return ret;
         case 2:
-            __put_user_size(*(const u16 *)from, (u16 __user *)to, 2, ret, 2);
+            put_guest_size(*(const uint16_t *)from, to, 2, ret, 2);
             return ret;
         case 4:
-            __put_user_size(*(const u32 *)from, (u32 __user *)to, 4, ret, 4);
+            put_guest_size(*(const uint32_t *)from, to, 4, ret, 4);
             return ret;
         case 8:
-            __put_user_size(*(const u64 *)from, (u64 __user *)to, 8, ret, 8);
+            put_guest_size(*(const uint64_t *)from, to, 8, ret, 8);
             return ret;
         }
     }
@@ -233,16 +258,16 @@ __copy_from_user(void *to, const void __user *from, unsigned long n)
 
         switch (n) {
         case 1:
-            __get_user_size(*(u8 *)to, from, 1, ret, 1);
+            get_guest_size(*(uint8_t *)to, from, 1, ret, 1);
             return ret;
         case 2:
-            __get_user_size(*(u16 *)to, from, 2, ret, 2);
+            get_guest_size(*(uint16_t *)to, from, 2, ret, 2);
             return ret;
         case 4:
-            __get_user_size(*(u32 *)to, from, 4, ret, 4);
+            get_guest_size(*(uint32_t *)to, from, 4, ret, 4);
             return ret;
         case 8:
-            __get_user_size(*(u64*)to, from, 8, ret, 8);
+            get_guest_size(*(uint64_t *)to, from, 8, ret, 8);
             return ret;
         }
     }
diff --git a/xen/include/asm-x86/x86_64/uaccess.h b/xen/include/asm-x86/x86_64/uaccess.h
index d7dad4f8bc..c48e57bf09 100644
--- a/xen/include/asm-x86/x86_64/uaccess.h
+++ b/xen/include/asm-x86/x86_64/uaccess.h
@@ -57,28 +57,4 @@ extern void *xlat_malloc(unsigned long *xlat_page_current, size_t size);
     (likely((count) < (~0U / (size))) && \
      compat_access_ok(addr, 0 + (count) * (size)))
 
-#define __put_user_size(x,ptr,size,retval,errret)			\
-do {									\
-	retval = 0;							\
-	switch (size) {							\
-	case 1: __put_user_asm(x,ptr,retval,"b","b","iq",errret);break;	\
-	case 2: __put_user_asm(x,ptr,retval,"w","w","ir",errret);break; \
-	case 4: __put_user_asm(x,ptr,retval,"l","k","ir",errret);break;	\
-	case 8: __put_user_asm(x,ptr,retval,"q","","ir",errret);break;	\
-	default: __put_user_bad();					\
-	}								\
-} while (0)
-
-#define __get_user_size(x,ptr,size,retval,errret)			\
-do {									\
-	retval = 0;							\
-	switch (size) {							\
-	case 1: __get_user_asm(x,ptr,retval,"b","b","=q",errret);break;	\
-	case 2: __get_user_asm(x,ptr,retval,"w","w","=r",errret);break;	\
-	case 4: __get_user_asm(x,ptr,retval,"l","k","=r",errret);break;	\
-	case 8: __get_user_asm(x,ptr,retval,"q","","=r",errret); break;	\
-	default: __get_user_bad();					\
-	}								\
-} while (0)
-
 #endif /* __X86_64_UACCESS_H */
diff --git a/xen/test/livepatch/xen_hello_world_func.c b/xen/test/livepatch/xen_hello_world_func.c
index b358224e3e..161066d8c1 100644
--- a/xen/test/livepatch/xen_hello_world_func.c
+++ b/xen/test/livepatch/xen_hello_world_func.c
@@ -26,7 +26,7 @@ const char *xen_hello_world(void)
      * Any BUG, or WARN_ON will contain symbol and payload name. Furthermore
      * exceptions will be caught and processed properly.
      */
-    rc = __get_user(tmp, non_canonical_addr);
+    rc = get_unsafe(tmp, non_canonical_addr);
     BUG_ON(rc != -EFAULT);
 #endif
 #if defined(CONFIG_ARM)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:11:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90484.171318 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgeB-0005YC-Vs; Fri, 26 Feb 2021 17:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90484.171318; Fri, 26 Feb 2021 17:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgeB-0005Y4-Sj; Fri, 26 Feb 2021 17:11:23 +0000
Received: by outflank-mailman (input) for mailman id 90484;
 Fri, 26 Feb 2021 17: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 1lFgeA-0005Xt-I5
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17: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 1lFgeA-0008K3-Gq
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgeA-0002rV-Fl
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HE4JyRs2umSqnXLdmlZf4Ec29oxOv3mvYJcx+T+Kof0=; b=x83w/OGHjSlOd+UTPPDMPxBiNM
	pbNMybPj1ggPw/NabL7Qwb+/fHv0ZC5pAaKNol1Kkhc3yxLhSCxe1u3rCdjoweRp9eMaVeLdLCgtv
	wXFLKPWUfDz7cuVC6fnBsSEQEJL58EBy1P3aiWCqbSbWy/k1oCUrMJmNtfEF87ILz69I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: split __copy_{from,to}_user() into "guest" and "unsafe" variants
Message-Id: <E1lFgeA-0002rV-Fl@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:11:22 +0000

commit 2d824791504f4119f04f95bafffec2e37d319c25
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 19 17:19:19 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 19 17:19:19 2021 +0100

    x86: split __copy_{from,to}_user() into "guest" and "unsafe" variants
    
    The "guest" variants are intended to work with (potentially) fully guest
    controlled addresses, while the "unsafe" variants are intended to be
    used in order to access addresses not (directly) under guest control,
    within Xen's part of virtual address space. Subsequently we will want
    them to have distinct behavior, so as first step identify which one is
    which. For now, both groups of constructs alias one another.
    
    Double underscore prefixes are retained only on
    __copy_{from,to}_guest_pv(), to allow still distinguishing them from
    their "checking" counterparts once they also get renamed (to
    copy_{from,to}_guest_pv()).
    
    Add previously missing __user at some call sites.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org> [shadow]
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/gdbstub.c             |  4 ++--
 xen/arch/x86/mm/shadow/multi.c     | 16 ++++++++--------
 xen/arch/x86/pv/emul-gate-op.c     |  4 ++--
 xen/arch/x86/pv/emul-priv-op.c     | 10 ++++++----
 xen/arch/x86/pv/mm.c               |  2 +-
 xen/arch/x86/pv/mm.h               |  2 +-
 xen/arch/x86/pv/ro-page-fault.c    |  2 +-
 xen/arch/x86/traps.c               |  2 +-
 xen/arch/x86/usercopy.c            |  4 ++--
 xen/include/asm-x86/guest_access.h |  4 ++--
 xen/include/asm-x86/uaccess.h      | 28 ++++++++++++++--------------
 11 files changed, 40 insertions(+), 38 deletions(-)

diff --git a/xen/arch/x86/gdbstub.c b/xen/arch/x86/gdbstub.c
index ff9f7f9a69..8f4f49fd3b 100644
--- a/xen/arch/x86/gdbstub.c
+++ b/xen/arch/x86/gdbstub.c
@@ -33,13 +33,13 @@ gdb_arch_signal_num(struct cpu_user_regs *regs, unsigned long cookie)
 unsigned int
 gdb_arch_copy_from_user(void *dest, const void *src, unsigned len)
 {
-    return __copy_from_user(dest, src, len);
+    return copy_from_unsafe(dest, src, len);
 }
 
 unsigned int 
 gdb_arch_copy_to_user(void *dest, const void *src, unsigned len)
 {
-    return __copy_to_user(dest, src, len);
+    return copy_to_unsafe(dest, src, len);
 }
 
 void
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 36f548b554..797ebde586 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -2614,7 +2614,7 @@ static int sh_page_fault(struct vcpu *v,
         {
             shadow_l2e_t sl2e;
             mfn_t gl1mfn;
-            if ( (__copy_from_user(&sl2e,
+            if ( (copy_from_unsafe(&sl2e,
                                    (sh_linear_l2_table(v)
                                     + shadow_l2_linear_offset(va)),
                                    sizeof(sl2e)) != 0)
@@ -2633,7 +2633,7 @@ static int sh_page_fault(struct vcpu *v,
 #endif /* SHOPT_OUT_OF_SYNC */
         /* The only reasons for reserved bits to be set in shadow entries
          * are the two "magic" shadow_l1e entries. */
-        if ( likely((__copy_from_user(&sl1e,
+        if ( likely((copy_from_unsafe(&sl1e,
                                       (sh_linear_l1_table(v)
                                        + shadow_l1_linear_offset(va)),
                                       sizeof(sl1e)) == 0)
@@ -3308,10 +3308,10 @@ static bool sh_invlpg(struct vcpu *v, unsigned long linear)
                    sh_linear_l4_table(v)[shadow_l4_linear_offset(linear)])
                & _PAGE_PRESENT) )
             return false;
-        /* This must still be a copy-from-user because we don't have the
+        /* This must still be a copy-from-unsafe because we don't have the
          * paging lock, and the higher-level shadows might disappear
          * under our feet. */
-        if ( __copy_from_user(&sl3e, (sh_linear_l3_table(v)
+        if ( copy_from_unsafe(&sl3e, (sh_linear_l3_table(v)
                                       + shadow_l3_linear_offset(linear)),
                               sizeof (sl3e)) != 0 )
         {
@@ -3330,9 +3330,9 @@ static bool sh_invlpg(struct vcpu *v, unsigned long linear)
         return false;
 #endif
 
-    /* This must still be a copy-from-user because we don't have the shadow
+    /* This must still be a copy-from-unsafe because we don't have the shadow
      * lock, and the higher-level shadows might disappear under our feet. */
-    if ( __copy_from_user(&sl2e,
+    if ( copy_from_unsafe(&sl2e,
                           sh_linear_l2_table(v) + shadow_l2_linear_offset(linear),
                           sizeof (sl2e)) != 0 )
     {
@@ -3371,11 +3371,11 @@ static bool sh_invlpg(struct vcpu *v, unsigned long linear)
              * hold the paging lock yet.  Check again with the lock held. */
             paging_lock(d);
 
-            /* This must still be a copy-from-user because we didn't
+            /* This must still be a copy-from-unsafe because we didn't
              * have the paging lock last time we checked, and the
              * higher-level shadows might have disappeared under our
              * feet. */
-            if ( __copy_from_user(&sl2e,
+            if ( copy_from_unsafe(&sl2e,
                                   sh_linear_l2_table(v)
                                   + shadow_l2_linear_offset(linear),
                                   sizeof (sl2e)) != 0 )
diff --git a/xen/arch/x86/pv/emul-gate-op.c b/xen/arch/x86/pv/emul-gate-op.c
index 90a0a47aef..43d847abd0 100644
--- a/xen/arch/x86/pv/emul-gate-op.c
+++ b/xen/arch/x86/pv/emul-gate-op.c
@@ -149,12 +149,12 @@ static int read_mem(enum x86_segment seg, unsigned long offset, void *p_data,
 
     addr = (uint32_t)addr;
 
-    if ( (rc = __copy_from_user(p_data, (void *)addr, bytes)) )
+    if ( (rc = __copy_from_guest_pv(p_data, (void __user *)addr, bytes)) )
     {
         /*
          * TODO: This should report PFEC_insn_fetch when goc->insn_fetch &&
          * cpu_has_nx, but we'd then need a "fetch" variant of
-         * __copy_from_user() respecting NX, SMEP, and protection keys.
+         * __copy_from_guest_pv() respecting NX, SMEP, and protection keys.
          */
         x86_emul_pagefault(0, addr + bytes - rc, ctxt);
         return X86EMUL_EXCEPTION;
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index dbceed8a05..e5a22b9347 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -649,7 +649,8 @@ static int rep_ins(uint16_t port,
         if ( rc != X86EMUL_OKAY )
             return rc;
 
-        if ( (rc = __copy_to_user((void *)addr, &data, bytes_per_rep)) != 0 )
+        if ( (rc = __copy_to_guest_pv((void __user *)addr, &data,
+                                      bytes_per_rep)) != 0 )
         {
             x86_emul_pagefault(PFEC_write_access,
                                addr + bytes_per_rep - rc, ctxt);
@@ -716,7 +717,8 @@ static int rep_outs(enum x86_segment seg, unsigned long offset,
         if ( rc != X86EMUL_OKAY )
             return rc;
 
-        if ( (rc = __copy_from_user(&data, (void *)addr, bytes_per_rep)) != 0 )
+        if ( (rc = __copy_from_guest_pv(&data, (void __user *)addr,
+                                        bytes_per_rep)) != 0 )
         {
             x86_emul_pagefault(0, addr + bytes_per_rep - rc, ctxt);
             return X86EMUL_EXCEPTION;
@@ -1253,12 +1255,12 @@ static int insn_fetch(enum x86_segment seg,
     if ( rc != X86EMUL_OKAY )
         return rc;
 
-    if ( (rc = __copy_from_user(p_data, (void *)addr, bytes)) != 0 )
+    if ( (rc = __copy_from_guest_pv(p_data, (void __user *)addr, bytes)) != 0 )
     {
         /*
          * TODO: This should report PFEC_insn_fetch when goc->insn_fetch &&
          * cpu_has_nx, but we'd then need a "fetch" variant of
-         * __copy_from_user() respecting NX, SMEP, and protection keys.
+         * __copy_from_guest_pv() respecting NX, SMEP, and protection keys.
          */
         x86_emul_pagefault(0, addr + bytes - rc, ctxt);
         return X86EMUL_EXCEPTION;
diff --git a/xen/arch/x86/pv/mm.c b/xen/arch/x86/pv/mm.c
index 5d74d11cba..cb86143832 100644
--- a/xen/arch/x86/pv/mm.c
+++ b/xen/arch/x86/pv/mm.c
@@ -41,7 +41,7 @@ l1_pgentry_t *map_guest_l1e(unsigned long linear, mfn_t *gl1mfn)
         return NULL;
 
     /* Find this l1e and its enclosing l1mfn in the linear map. */
-    if ( __copy_from_user(&l2e,
+    if ( copy_from_unsafe(&l2e,
                           &__linear_l2_table[l2_linear_offset(linear)],
                           sizeof(l2_pgentry_t)) )
         return NULL;
diff --git a/xen/arch/x86/pv/mm.h b/xen/arch/x86/pv/mm.h
index a11cc88e5a..7e2259c488 100644
--- a/xen/arch/x86/pv/mm.h
+++ b/xen/arch/x86/pv/mm.h
@@ -22,7 +22,7 @@ static inline l1_pgentry_t guest_get_eff_kern_l1e(unsigned long linear)
         toggle_guest_pt(curr);
 
     if ( unlikely(!__addr_ok(linear)) ||
-         __copy_from_user(&l1e,
+         copy_from_unsafe(&l1e,
                           &__linear_l1_table[l1_linear_offset(linear)],
                           sizeof(l1_pgentry_t)) )
         l1e = l1e_empty();
diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c
index 8d0007ede5..5d2dd9fae0 100644
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -43,7 +43,7 @@ static int ptwr_emulated_read(enum x86_segment seg, unsigned long offset,
     unsigned long addr = offset;
 
     if ( !__addr_ok(addr) ||
-         (rc = __copy_from_user(p_data, (void *)addr, bytes)) )
+         (rc = __copy_from_guest_pv(p_data, (void *)addr, bytes)) )
     {
         x86_emul_pagefault(0, addr + bytes - rc, ctxt);  /* Read fault. */
         return X86EMUL_EXCEPTION;
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index c65835844d..3c2e563cce 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1103,7 +1103,7 @@ void do_invalid_op(struct cpu_user_regs *regs)
     }
 
     if ( !is_active_kernel_text(regs->rip) ||
-         __copy_from_user(bug_insn, eip, sizeof(bug_insn)) ||
+         copy_from_unsafe(bug_insn, eip, sizeof(bug_insn)) ||
          memcmp(bug_insn, "\xf\xb", sizeof(bug_insn)) )
         goto die;
 
diff --git a/xen/arch/x86/usercopy.c b/xen/arch/x86/usercopy.c
index 1d1ef075c9..84f83d2a46 100644
--- a/xen/arch/x86/usercopy.c
+++ b/xen/arch/x86/usercopy.c
@@ -110,7 +110,7 @@ unsigned __copy_from_user_ll(void *to, const void __user *from, unsigned n)
 unsigned copy_to_user(void __user *to, const void *from, unsigned n)
 {
     if ( access_ok(to, n) )
-        n = __copy_to_user(to, from, n);
+        n = __copy_to_guest_pv(to, from, n);
     return n;
 }
 
@@ -168,7 +168,7 @@ unsigned clear_user(void __user *to, unsigned n)
 unsigned copy_from_user(void *to, const void __user *from, unsigned n)
 {
     if ( access_ok(from, n) )
-        n = __copy_from_user(to, from, n);
+        n = __copy_from_guest_pv(to, from, n);
     else
         memset(to, 0, n);
     return n;
diff --git a/xen/include/asm-x86/guest_access.h b/xen/include/asm-x86/guest_access.h
index 8f0e2c71f1..45e28f3220 100644
--- a/xen/include/asm-x86/guest_access.h
+++ b/xen/include/asm-x86/guest_access.h
@@ -28,11 +28,11 @@
 #define __raw_copy_to_guest(dst, src, len)      \
     (is_hvm_vcpu(current) ?                     \
      copy_to_user_hvm((dst), (src), (len)) :    \
-     __copy_to_user((dst), (src), (len)))
+     __copy_to_guest_pv(dst, src, len))
 #define __raw_copy_from_guest(dst, src, len)    \
     (is_hvm_vcpu(current) ?                     \
      copy_from_user_hvm((dst), (src), (len)) :  \
-     __copy_from_user((dst), (src), (len)))
+     __copy_from_guest_pv(dst, src, len))
 #define __raw_clear_guest(dst,  len)            \
     (is_hvm_vcpu(current) ?                     \
      clear_user_hvm((dst), (len)) :             \
diff --git a/xen/include/asm-x86/uaccess.h b/xen/include/asm-x86/uaccess.h
index 570b6b8080..db0802c4be 100644
--- a/xen/include/asm-x86/uaccess.h
+++ b/xen/include/asm-x86/uaccess.h
@@ -196,21 +196,20 @@ do {                                                                       \
 #define get_guest_size get_unsafe_size
 
 /**
- * __copy_to_user: - Copy a block of data into user space, with less checking
- * @to:   Destination address, in user space.
- * @from: Source address, in kernel space.
+ * __copy_to_guest_pv: - Copy a block of data into guest space, with less
+ *                       checking
+ * @to:   Destination address, in guest space.
+ * @from: Source address, in hypervisor space.
  * @n:    Number of bytes to copy.
  *
- * Context: User context only.  This function may sleep.
- *
- * Copy data from kernel space to user space.  Caller must check
+ * Copy data from hypervisor space to guest space.  Caller must check
  * the specified block with access_ok() before calling this function.
  *
  * Returns number of bytes that could not be copied.
  * On success, this will be zero.
  */
 static always_inline unsigned long
-__copy_to_user(void __user *to, const void *from, unsigned long n)
+__copy_to_guest_pv(void __user *to, const void *from, unsigned long n)
 {
     if (__builtin_constant_p(n)) {
         unsigned long ret;
@@ -232,16 +231,16 @@ __copy_to_user(void __user *to, const void *from, unsigned long n)
     }
     return __copy_to_user_ll(to, from, n);
 }
+#define copy_to_unsafe __copy_to_guest_pv
 
 /**
- * __copy_from_user: - Copy a block of data from user space, with less checking
- * @to:   Destination address, in kernel space.
- * @from: Source address, in user space.
+ * __copy_from_guest_pv: - Copy a block of data from guest space, with less
+ *                         checking
+ * @to:   Destination address, in hypervisor space.
+ * @from: Source address, in guest space.
  * @n:    Number of bytes to copy.
  *
- * Context: User context only.  This function may sleep.
- *
- * Copy data from user space to kernel space.  Caller must check
+ * Copy data from guest space to hypervisor space.  Caller must check
  * the specified block with access_ok() before calling this function.
  *
  * Returns number of bytes that could not be copied.
@@ -251,7 +250,7 @@ __copy_to_user(void __user *to, const void *from, unsigned long n)
  * data to the requested size using zero bytes.
  */
 static always_inline unsigned long
-__copy_from_user(void *to, const void __user *from, unsigned long n)
+__copy_from_guest_pv(void *to, const void __user *from, unsigned long n)
 {
     if (__builtin_constant_p(n)) {
         unsigned long ret;
@@ -273,6 +272,7 @@ __copy_from_user(void *to, const void __user *from, unsigned long n)
     }
     return __copy_from_user_ll(to, from, n);
 }
+#define copy_from_unsafe __copy_from_guest_pv
 
 /*
  * The exception table consists of pairs of addresses: the first is the
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:11:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90485.171321 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgeM-0005Za-1R; Fri, 26 Feb 2021 17:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90485.171321; Fri, 26 Feb 2021 17:11:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgeL-0005ZS-UR; Fri, 26 Feb 2021 17:11:33 +0000
Received: by outflank-mailman (input) for mailman id 90485;
 Fri, 26 Feb 2021 17:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgeK-0005ZI-NB
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgeK-0008KD-MG
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgeK-0002sB-JK
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=g/WAueq1OcPfA69SP8E6Xokdk2xSNRD8GUqgHxoZDaU=; b=p1Kof7PvwEKwGL/GPfWUv37wOY
	7A2F22CmA0kdvgT0mVxDWDsjOMJBzWDoSokdWe78k3DmGViDnJoz872ss9s/HlRHIFhSu7Gyw6Lxe
	F7VaTJY7aNlBma2FQyB1sT+F1aDsYNm/NtADo2iPV7LVTbxdgiMHo8uZDF5+wQmmkxWE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/PV: harden guest memory accesses against speculative abuse
Message-Id: <E1lFgeK-0002sB-JK@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:11:32 +0000

commit 4dc1815991420b809ce18dddfdf9c0af48944204
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 19 17:19:56 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 19 17:19:56 2021 +0100

    x86/PV: harden guest memory accesses against speculative abuse
    
    Inspired by
    https://lore.kernel.org/lkml/f12e7d3cecf41b2c29734ea45a393be21d4a8058.1597848273.git.jpoimboe@redhat.com/
    and prior work in that area of x86 Linux, suppress speculation with
    guest specified pointer values by suitably masking the addresses to
    non-canonical space in case they fall into Xen's virtual address range.
    
    Introduce a new Kconfig control.
    
    Note that it is necessary in such code to avoid using "m" kind operands:
    If we didn't, there would be no guarantee that the register passed to
    guest_access_mask_ptr is also the (base) one used for the memory access.
    
    As a minor unrelated change in get_unsafe_asm() the unnecessary "itype"
    parameter gets dropped and the XOR on the fixup path gets changed to be
    a 32-bit one in all cases: This way we avoid pointless REX.W or operand
    size overrides, or writes to partial registers.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/usercopy.c         |  34 +++++++-
 xen/arch/x86/x86_64/entry.S     |   2 +
 xen/common/Kconfig              |  18 ++++
 xen/include/asm-x86/asm-defns.h |  20 +++++
 xen/include/asm-x86/uaccess.h   | 182 +++++++++++++++++++++++++++++++++-------
 5 files changed, 222 insertions(+), 34 deletions(-)

diff --git a/xen/arch/x86/usercopy.c b/xen/arch/x86/usercopy.c
index 84f83d2a46..b17d680dde 100644
--- a/xen/arch/x86/usercopy.c
+++ b/xen/arch/x86/usercopy.c
@@ -10,12 +10,19 @@
 #include <xen/sched.h>
 #include <asm/uaccess.h>
 
-unsigned __copy_to_user_ll(void __user *to, const void *from, unsigned n)
+#ifndef GUARD
+# define GUARD UA_KEEP
+#endif
+
+unsigned int copy_to_guest_ll(void __user *to, const void *from, unsigned int n)
 {
     unsigned dummy;
 
     stac();
     asm volatile (
+        GUARD(
+        "    guest_access_mask_ptr %[to], %q[scratch1], %q[scratch2]\n"
+        )
         "    cmp  $"STR(2*BYTES_PER_LONG-1)", %[cnt]\n"
         "    jbe  1f\n"
         "    mov  %k[to], %[cnt]\n"
@@ -42,6 +49,7 @@ unsigned __copy_to_user_ll(void __user *to, const void *from, unsigned n)
         _ASM_EXTABLE(1b, 2b)
         : [cnt] "+c" (n), [to] "+D" (to), [from] "+S" (from),
           [aux] "=&r" (dummy)
+          GUARD(, [scratch1] "=&r" (dummy), [scratch2] "=&r" (dummy))
         : "[aux]" (n)
         : "memory" );
     clac();
@@ -49,12 +57,15 @@ unsigned __copy_to_user_ll(void __user *to, const void *from, unsigned n)
     return n;
 }
 
-unsigned __copy_from_user_ll(void *to, const void __user *from, unsigned n)
+unsigned int copy_from_guest_ll(void *to, const void __user *from, unsigned int n)
 {
     unsigned dummy;
 
     stac();
     asm volatile (
+        GUARD(
+        "    guest_access_mask_ptr %[from], %q[scratch1], %q[scratch2]\n"
+        )
         "    cmp  $"STR(2*BYTES_PER_LONG-1)", %[cnt]\n"
         "    jbe  1f\n"
         "    mov  %k[to], %[cnt]\n"
@@ -87,6 +98,7 @@ unsigned __copy_from_user_ll(void *to, const void __user *from, unsigned n)
         _ASM_EXTABLE(1b, 6b)
         : [cnt] "+c" (n), [to] "+D" (to), [from] "+S" (from),
           [aux] "=&r" (dummy)
+          GUARD(, [scratch1] "=&r" (dummy), [scratch2] "=&r" (dummy))
         : "[aux]" (n)
         : "memory" );
     clac();
@@ -94,6 +106,8 @@ unsigned __copy_from_user_ll(void *to, const void __user *from, unsigned n)
     return n;
 }
 
+#if GUARD(1) + 0
+
 /**
  * copy_to_user: - Copy a block of data into user space.
  * @to:   Destination address, in user space.
@@ -128,8 +142,11 @@ unsigned clear_user(void __user *to, unsigned n)
 {
     if ( access_ok(to, n) )
     {
+        long dummy;
+
         stac();
         asm volatile (
+            "    guest_access_mask_ptr %[to], %[scratch1], %[scratch2]\n"
             "0:  rep stos"__OS"\n"
             "    mov  %[bytes], %[cnt]\n"
             "1:  rep stosb\n"
@@ -140,7 +157,8 @@ unsigned clear_user(void __user *to, unsigned n)
             ".previous\n"
             _ASM_EXTABLE(0b,3b)
             _ASM_EXTABLE(1b,2b)
-            : [cnt] "=&c" (n), [to] "+D" (to)
+            : [cnt] "=&c" (n), [to] "+D" (to), [scratch1] "=&r" (dummy),
+              [scratch2] "=&r" (dummy)
             : [bytes] "r" (n & (BYTES_PER_LONG - 1)),
               [longs] "0" (n / BYTES_PER_LONG), "a" (0) );
         clac();
@@ -174,6 +192,16 @@ unsigned copy_from_user(void *to, const void __user *from, unsigned n)
     return n;
 }
 
+# undef GUARD
+# define GUARD UA_DROP
+# define copy_to_guest_ll copy_to_unsafe_ll
+# define copy_from_guest_ll copy_from_unsafe_ll
+# undef __user
+# define __user
+# include __FILE__
+
+#endif /* GUARD(1) */
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 6422687fbf..e2ff4a9018 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -458,6 +458,8 @@ UNLIKELY_START(g, create_bounce_frame_bad_sp)
         jmp   asm_domain_crash_synchronous  /* Does not return */
 __UNLIKELY_END(create_bounce_frame_bad_sp)
 
+        guest_access_mask_ptr %rsi, %rax, %rcx
+
 #define STORE_GUEST_STACK(reg, n) \
 0:      movq  %reg,(n)*8(%rsi); \
         _ASM_EXTABLE(0b, domain_crash_page_fault_ ## n ## x8)
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 1f658cfac3..eb953d171e 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -111,6 +111,24 @@ config SPECULATIVE_HARDEN_BRANCH
 
 	  If unsure, say Y.
 
+config SPECULATIVE_HARDEN_GUEST_ACCESS
+	bool "Speculative PV Guest Memory Access Hardening"
+	default y
+	depends on PV
+	help
+	  Contemporary processors may use speculative execution as a
+	  performance optimisation, but this can potentially be abused by an
+	  attacker to leak data via speculative sidechannels.
+
+	  One source of data leakage is via speculative accesses to hypervisor
+	  memory through guest controlled values used to access guest memory.
+
+	  When enabled, code paths accessing PV guest memory will have guest
+	  controlled addresses massaged such that memory accesses through them
+	  won't touch hypervisor address space.
+
+	  If unsure, say Y.
+
 endmenu
 
 config HYPFS
diff --git a/xen/include/asm-x86/asm-defns.h b/xen/include/asm-x86/asm-defns.h
index 2e3ec0ac01..505f39ad5f 100644
--- a/xen/include/asm-x86/asm-defns.h
+++ b/xen/include/asm-x86/asm-defns.h
@@ -56,3 +56,23 @@
 .macro INDIRECT_JMP arg:req
     INDIRECT_BRANCH jmp \arg
 .endm
+
+.macro guest_access_mask_ptr ptr:req, scratch1:req, scratch2:req
+#if defined(CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS)
+    /*
+     * Here we want
+     *
+     * ptr &= ~0ull >> (ptr < HYPERVISOR_VIRT_END);
+     *
+     * but guaranteed without any conditional branches (hence in assembly).
+     */
+    mov $(HYPERVISOR_VIRT_END - 1), \scratch1
+    mov $~0, \scratch2
+    cmp \ptr, \scratch1
+    rcr $1, \scratch2
+    and \scratch2, \ptr
+#elif defined(CONFIG_DEBUG) && defined(CONFIG_PV)
+    xor $~\@, \scratch1
+    xor $~\@, \scratch2
+#endif
+.endm
diff --git a/xen/include/asm-x86/uaccess.h b/xen/include/asm-x86/uaccess.h
index db0802c4be..f55c2f8729 100644
--- a/xen/include/asm-x86/uaccess.h
+++ b/xen/include/asm-x86/uaccess.h
@@ -12,13 +12,19 @@
 unsigned copy_to_user(void *to, const void *from, unsigned len);
 unsigned clear_user(void *to, unsigned len);
 unsigned copy_from_user(void *to, const void *from, unsigned len);
+
 /* Handles exceptions in both to and from, but doesn't do access_ok */
-unsigned __copy_to_user_ll(void __user*to, const void *from, unsigned n);
-unsigned __copy_from_user_ll(void *to, const void __user *from, unsigned n);
+unsigned int copy_to_guest_ll(void __user*to, const void *from, unsigned int n);
+unsigned int copy_from_guest_ll(void *to, const void __user *from, unsigned int n);
+unsigned int copy_to_unsafe_ll(void *to, const void *from, unsigned int n);
+unsigned int copy_from_unsafe_ll(void *to, const void *from, unsigned int n);
 
 extern long __get_user_bad(void);
 extern void __put_user_bad(void);
 
+#define UA_KEEP(args...) args
+#define UA_DROP(args...)
+
 /**
  * get_user: - Get a simple variable from user space.
  * @x:   Variable to store result.
@@ -77,7 +83,6 @@ extern void __put_user_bad(void);
  * On error, the variable @x is set to zero.
  */
 #define __get_guest(x, ptr) get_guest_nocheck(x, ptr, sizeof(*(ptr)))
-#define get_unsafe __get_guest
 
 /**
  * __put_guest: - Write a simple value into guest space, with less checking.
@@ -98,7 +103,13 @@ extern void __put_user_bad(void);
  */
 #define __put_guest(x, ptr) \
     put_guest_nocheck((__typeof__(*(ptr)))(x), ptr, sizeof(*(ptr)))
-#define put_unsafe __put_guest
+
+#define put_unsafe(x, ptr)						\
+({									\
+	int err_; 							\
+	put_unsafe_size(x, ptr, sizeof(*(ptr)), UA_DROP, err_, -EFAULT);\
+	err_;								\
+})
 
 #define put_guest_nocheck(x, ptr, size)					\
 ({									\
@@ -115,6 +126,13 @@ extern void __put_user_bad(void);
 			       : -EFAULT;				\
 })
 
+#define get_unsafe(x, ptr)						\
+({									\
+	int err_; 							\
+	get_unsafe_size(x, ptr, sizeof(*(ptr)), UA_DROP, err_, -EFAULT);\
+	err_;								\
+})
+
 #define get_guest_nocheck(x, ptr, size)					\
 ({									\
 	int err_; 							\
@@ -138,62 +156,87 @@ struct __large_struct { unsigned long buf[100]; };
  * we do not write to any memory gcc knows about, so there are no
  * aliasing issues.
  */
-#define put_unsafe_asm(x, addr, err, itype, rtype, ltype, errret)	\
+#define put_unsafe_asm(x, addr, GUARD, err, itype, rtype, ltype, errret) \
 	stac();								\
 	__asm__ __volatile__(						\
-		"1:	mov"itype" %"rtype"1,%2\n"			\
+		GUARD(							\
+		"	guest_access_mask_ptr %[ptr], %[scr1], %[scr2]\n" \
+		)							\
+		"1:	mov"itype" %"rtype"[val], (%[ptr])\n"		\
 		"2:\n"							\
 		".section .fixup,\"ax\"\n"				\
-		"3:	mov %3,%0\n"					\
+		"3:	mov %[errno], %[ret]\n"				\
 		"	jmp 2b\n"					\
 		".previous\n"						\
 		_ASM_EXTABLE(1b, 3b)					\
-		: "=r"(err)						\
-		: ltype (x), "m"(__m(addr)), "i"(errret), "0"(err));	\
+		: [ret] "+r" (err), [ptr] "=&r" (dummy_)		\
+		  GUARD(, [scr1] "=&r" (dummy_), [scr2] "=&r" (dummy_))	\
+		: [val] ltype (x), "m" (__m(addr)),			\
+		  "[ptr]" (addr), [errno] "i" (errret));		\
 	clac()
 
-#define get_unsafe_asm(x, addr, err, itype, rtype, ltype, errret)	\
+#define get_unsafe_asm(x, addr, GUARD, err, rtype, ltype, errret)	\
 	stac();								\
 	__asm__ __volatile__(						\
-		"1:	mov"itype" %2,%"rtype"1\n"			\
+		GUARD(							\
+		"	guest_access_mask_ptr %[ptr], %[scr1], %[scr2]\n" \
+		)							\
+		"1:	mov (%[ptr]), %"rtype"[val]\n"			\
 		"2:\n"							\
 		".section .fixup,\"ax\"\n"				\
-		"3:	mov %3,%0\n"					\
-		"	xor"itype" %"rtype"1,%"rtype"1\n"		\
+		"3:	mov %[errno], %[ret]\n"				\
+		"	xor %k[val], %k[val]\n"				\
 		"	jmp 2b\n"					\
 		".previous\n"						\
 		_ASM_EXTABLE(1b, 3b)					\
-		: "=r"(err), ltype (x)					\
-		: "m"(__m(addr)), "i"(errret), "0"(err));		\
+		: [ret] "+r" (err), [val] ltype (x),			\
+		  [ptr] "=&r" (dummy_)					\
+		  GUARD(, [scr1] "=&r" (dummy_), [scr2] "=&r" (dummy_))	\
+		: "m" (__m(addr)), "[ptr]" (addr),			\
+		  [errno] "i" (errret));				\
 	clac()
 
-#define put_unsafe_size(x, ptr, size, retval, errret)                      \
+#define put_unsafe_size(x, ptr, size, grd, retval, errret)                 \
 do {                                                                       \
     retval = 0;                                                            \
     switch ( size )                                                        \
     {                                                                      \
-    case 1: put_unsafe_asm(x, ptr, retval, "b", "b", "iq", errret); break; \
-    case 2: put_unsafe_asm(x, ptr, retval, "w", "w", "ir", errret); break; \
-    case 4: put_unsafe_asm(x, ptr, retval, "l", "k", "ir", errret); break; \
-    case 8: put_unsafe_asm(x, ptr, retval, "q",  "", "ir", errret); break; \
+    long dummy_;                                                           \
+    case 1:                                                                \
+        put_unsafe_asm(x, ptr, grd, retval, "b", "b", "iq", errret);       \
+        break;                                                             \
+    case 2:                                                                \
+        put_unsafe_asm(x, ptr, grd, retval, "w", "w", "ir", errret);       \
+        break;                                                             \
+    case 4:                                                                \
+        put_unsafe_asm(x, ptr, grd, retval, "l", "k", "ir", errret);       \
+        break;                                                             \
+    case 8:                                                                \
+        put_unsafe_asm(x, ptr, grd, retval, "q",  "", "ir", errret);       \
+        break;                                                             \
     default: __put_user_bad();                                             \
     }                                                                      \
 } while ( false )
-#define put_guest_size put_unsafe_size
 
-#define get_unsafe_size(x, ptr, size, retval, errret)                      \
+#define put_guest_size(x, ptr, size, retval, errret) \
+    put_unsafe_size(x, ptr, size, UA_KEEP, retval, errret)
+
+#define get_unsafe_size(x, ptr, size, grd, retval, errret)                 \
 do {                                                                       \
     retval = 0;                                                            \
     switch ( size )                                                        \
     {                                                                      \
-    case 1: get_unsafe_asm(x, ptr, retval, "b", "b", "=q", errret); break; \
-    case 2: get_unsafe_asm(x, ptr, retval, "w", "w", "=r", errret); break; \
-    case 4: get_unsafe_asm(x, ptr, retval, "l", "k", "=r", errret); break; \
-    case 8: get_unsafe_asm(x, ptr, retval, "q",  "", "=r", errret); break; \
+    long dummy_;                                                           \
+    case 1: get_unsafe_asm(x, ptr, grd, retval, "b", "=q", errret); break; \
+    case 2: get_unsafe_asm(x, ptr, grd, retval, "w", "=r", errret); break; \
+    case 4: get_unsafe_asm(x, ptr, grd, retval, "k", "=r", errret); break; \
+    case 8: get_unsafe_asm(x, ptr, grd, retval,  "", "=r", errret); break; \
     default: __get_user_bad();                                             \
     }                                                                      \
 } while ( false )
-#define get_guest_size get_unsafe_size
+
+#define get_guest_size(x, ptr, size, retval, errret)                       \
+    get_unsafe_size(x, ptr, size, UA_KEEP, retval, errret)
 
 /**
  * __copy_to_guest_pv: - Copy a block of data into guest space, with less
@@ -229,9 +272,8 @@ __copy_to_guest_pv(void __user *to, const void *from, unsigned long n)
             return ret;
         }
     }
-    return __copy_to_user_ll(to, from, n);
+    return copy_to_guest_ll(to, from, n);
 }
-#define copy_to_unsafe __copy_to_guest_pv
 
 /**
  * __copy_from_guest_pv: - Copy a block of data from guest space, with less
@@ -270,9 +312,87 @@ __copy_from_guest_pv(void *to, const void __user *from, unsigned long n)
             return ret;
         }
     }
-    return __copy_from_user_ll(to, from, n);
+    return copy_from_guest_ll(to, from, n);
+}
+
+/**
+ * copy_to_unsafe: - Copy a block of data to unsafe space, with exception
+ *                   checking
+ * @to:   Unsafe destination address.
+ * @from: Safe source address, in hypervisor space.
+ * @n:    Number of bytes to copy.
+ *
+ * Copy data from hypervisor space to a potentially unmapped area.
+ *
+ * Returns number of bytes that could not be copied.
+ * On success, this will be zero.
+ */
+static always_inline unsigned int
+copy_to_unsafe(void __user *to, const void *from, unsigned int n)
+{
+    if (__builtin_constant_p(n)) {
+        unsigned long ret;
+
+        switch (n) {
+        case 1:
+            put_unsafe_size(*(const uint8_t *)from, to, 1, UA_DROP, ret, 1);
+            return ret;
+        case 2:
+            put_unsafe_size(*(const uint16_t *)from, to, 2, UA_DROP, ret, 2);
+            return ret;
+        case 4:
+            put_unsafe_size(*(const uint32_t *)from, to, 4, UA_DROP, ret, 4);
+            return ret;
+        case 8:
+            put_unsafe_size(*(const uint64_t *)from, to, 8, UA_DROP, ret, 8);
+            return ret;
+        }
+    }
+
+    return copy_to_unsafe_ll(to, from, n);
+}
+
+/**
+ * copy_from_unsafe: - Copy a block of data from unsafe space, with exception
+ *                     checking
+ * @to:   Safe destination address, in hypervisor space.
+ * @from: Unsafe source address.
+ * @n:    Number of bytes to copy.
+ *
+ * Copy data from a potentially unmapped area space to hypervisor space.
+ *
+ * Returns number of bytes that could not be copied.
+ * On success, this will be zero.
+ *
+ * If some data could not be copied, this function will pad the copied
+ * data to the requested size using zero bytes.
+ */
+static always_inline unsigned int
+copy_from_unsafe(void *to, const void __user *from, unsigned int n)
+{
+    if ( __builtin_constant_p(n) )
+    {
+        unsigned long ret;
+
+        switch ( n )
+        {
+        case 1:
+            get_unsafe_size(*(uint8_t *)to, from, 1, UA_DROP, ret, 1);
+            return ret;
+        case 2:
+            get_unsafe_size(*(uint16_t *)to, from, 2, UA_DROP, ret, 2);
+            return ret;
+        case 4:
+            get_unsafe_size(*(uint32_t *)to, from, 4, UA_DROP, ret, 4);
+            return ret;
+        case 8:
+            get_unsafe_size(*(uint64_t *)to, from, 8, UA_DROP, ret, 8);
+            return ret;
+        }
+    }
+
+    return copy_from_unsafe_ll(to, from, n);
 }
-#define copy_from_unsafe __copy_from_guest_pv
 
 /*
  * The exception table consists of pairs of addresses: the first is the
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:11:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90486.171326 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgeW-0005b3-6d; Fri, 26 Feb 2021 17:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90486.171326; Fri, 26 Feb 2021 17:11:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgeW-0005av-2j; Fri, 26 Feb 2021 17:11:44 +0000
Received: by outflank-mailman (input) for mailman id 90486;
 Fri, 26 Feb 2021 17:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgeU-0005ao-QM
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgeU-0008Kf-PV
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgeU-0002uP-Oa
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=n2WUmPWQd0KwikiWbCZlJdkQbVSsB2Kc7SJcibndN2I=; b=wEaQY4FvdUmAE10xJ+xdU2D5QJ
	RatbSFM4DoLQhI9kP2hgvCQ391mcTVJ18BNLYSdyxK3fEgnuOnhbcHnKoPQ/1irGUNEKvVL9P4R6N
	cuczJDbW82IzIY/D9239GO+OX9llTKBiTyMP+77JyewMm1YosQoa5uzXw2/2wAx9ngk4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: change initiation of the calibration timer
Message-Id: <E1lFgeU-0002uP-Oa@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:11:42 +0000

commit f954a1bf5f74ad6edce361d1bf1a29137ff374e8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 19 17:20:46 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 19 17:20:46 2021 +0100

    x86/time: change initiation of the calibration timer
    
    Setting the timer a second (EPOCH) into the future at a random point
    during boot (prior to bringing up APs and prior to launching Dom0) does
    not yield predictable results: The timer may expire while we're still
    bringing up APs (too early) or when Dom0 already boots (too late).
    Instead invoke the timer handler function explicitly at a predictable
    point in time, once we've established the rendezvous function to use
    (and hence also once all APs are online). This will, through the raising
    and handling of TIMER_SOFTIRQ, then also have the effect of arming the
    timer.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/time.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 8938c0f435..23971ed7ac 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -854,9 +854,7 @@ static void resume_platform_timer(void)
 
 static void __init reset_platform_timer(void)
 {
-    /* Deactivate any timers running */
     kill_timer(&plt_overflow_timer);
-    kill_timer(&calibration_timer);
 
     /* Reset counters and stamps */
     spin_lock_irq(&platform_timer_lock);
@@ -1956,19 +1954,13 @@ static void __init reset_percpu_time(void *unused)
     t->stamp.master_stime = t->stamp.local_stime;
 }
 
-static void __init try_platform_timer_tail(bool late)
+static void __init try_platform_timer_tail(void)
 {
     init_timer(&plt_overflow_timer, plt_overflow, NULL, 0);
     plt_overflow(NULL);
 
     platform_timer_stamp = plt_stamp64;
     stime_platform_stamp = NOW();
-
-    if ( !late )
-        init_percpu_time();
-
-    init_timer(&calibration_timer, time_calibration, NULL, 0);
-    set_timer(&calibration_timer, NOW() + EPOCH);
 }
 
 /* Late init function, after all cpus have booted */
@@ -2009,10 +2001,13 @@ static int __init verify_tsc_reliability(void)
             time_calibration_rendezvous_fn = time_calibration_nop_rendezvous;
 
             /* Finish platform timer switch. */
-            try_platform_timer_tail(true);
+            try_platform_timer_tail();
 
             printk("Switched to Platform timer %s TSC\n",
                    freq_string(plt_src.frequency));
+
+            time_calibration(NULL);
+
             return 0;
         }
     }
@@ -2033,6 +2028,8 @@ static int __init verify_tsc_reliability(void)
          !boot_cpu_has(X86_FEATURE_TSC_RELIABLE) )
         time_calibration_rendezvous_fn = time_calibration_tsc_rendezvous;
 
+    time_calibration(NULL);
+
     return 0;
 }
 __initcall(verify_tsc_reliability);
@@ -2048,7 +2045,11 @@ int __init init_xen_time(void)
     do_settime(get_wallclock_time(), 0, NOW());
 
     /* Finish platform timer initialization. */
-    try_platform_timer_tail(false);
+    try_platform_timer_tail();
+
+    init_percpu_time();
+
+    init_timer(&calibration_timer, time_calibration, NULL, 0);
 
     /*
      * Setup space to track per-socket TSC_ADJUST values. Don't fiddle with
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:11:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90487.171330 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgeg-0005cg-7W; Fri, 26 Feb 2021 17:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90487.171330; Fri, 26 Feb 2021 17:11:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgeg-0005cY-4Y; Fri, 26 Feb 2021 17:11:54 +0000
Received: by outflank-mailman (input) for mailman id 90487;
 Fri, 26 Feb 2021 17:11:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgee-0005cO-T9
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:11:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgee-0008MP-SO
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgee-0002vG-Rj
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EvJ+DVbZTbWfFebWrX3C913YfkHkUlgjJu4YgqvxFRs=; b=LpmnsGqgeThssA+Y8oNoH0IUDy
	gT6Q6X4454JuW8NXEbM6iAQlT8bvp9PahSxiMW5z45A1WFD3rM/6ISPP+M19pmpLZPD5vLoiNhTax
	kY3mfAZS8F1uJnOM5DB2i1yp1NpvAScFEQxmmfGWUvXQPSRlj48bb90yl2uh+o+x05Is=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: adjust time recording in time_calibration_tsc_rendezvous()
Message-Id: <E1lFgee-0002vG-Rj@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:11:52 +0000

commit a2639824e8458a8f3826e184081a13bfa27ea884
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 19 17:21:12 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 19 17:21:12 2021 +0100

    x86/time: adjust time recording in time_calibration_tsc_rendezvous()
    
    The (stime,tsc) tuple is the basis for extrapolation by get_s_time().
    Therefore the two better get taken as close to one another as possible.
    This means two things: First, reading platform time is too early when
    done on the first iteration. The closest we can get is on the last
    iteration, immediately before telling other CPUs to write their TSCs
    (and then also writing CPU0's). While at the first glance it may seem
    not overly relevant when exactly platform time is read (when assuming
    that only stime is ever relevant anywhere, and hence the association
    with the precise TSC values is of lower interest), both CPU frequency
    changes and the effects of SMT make it unpredictable (between individual
    rendezvous instances) how long the loop iterations will take. This will
    in turn lead to higher an error than neccesary in how close to linear
    stime movement we can get.
    
    Second, re-reading the TSC for local recording is increasing the overall
    error as well, when we already know a more precise value - the one just
    written.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/time.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 23971ed7ac..a894f74b88 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1662,11 +1662,12 @@ struct calibration_rendezvous {
 };
 
 static void
-time_calibration_rendezvous_tail(const struct calibration_rendezvous *r)
+time_calibration_rendezvous_tail(const struct calibration_rendezvous *r,
+                                 uint64_t tsc)
 {
     struct cpu_time_stamp *c = &this_cpu(cpu_calibration);
 
-    c->local_tsc    = rdtsc_ordered();
+    c->local_tsc    = tsc;
     c->local_stime  = get_s_time_fixed(c->local_tsc);
     c->master_stime = r->master_stime;
 
@@ -1691,11 +1692,11 @@ static void time_calibration_tsc_rendezvous(void *_r)
             while ( atomic_read(&r->semaphore) != (total_cpus - 1) )
                 cpu_relax();
 
-            if ( r->master_stime == 0 )
-            {
-                r->master_stime = read_platform_stime(NULL);
+            if ( r->master_tsc_stamp == 0 )
                 r->master_tsc_stamp = rdtsc_ordered();
-            }
+            else if ( i == 0 )
+                r->master_stime = read_platform_stime(NULL);
+
             atomic_inc(&r->semaphore);
 
             if ( i == 0 )
@@ -1720,7 +1721,7 @@ static void time_calibration_tsc_rendezvous(void *_r)
         }
     }
 
-    time_calibration_rendezvous_tail(r);
+    time_calibration_rendezvous_tail(r, r->master_tsc_stamp);
 }
 
 /* Ordinary rendezvous function which does not modify TSC values. */
@@ -1745,7 +1746,7 @@ static void time_calibration_std_rendezvous(void *_r)
         smp_rmb(); /* receive signal /then/ read r->master_stime */
     }
 
-    time_calibration_rendezvous_tail(r);
+    time_calibration_rendezvous_tail(r, rdtsc_ordered());
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:12:04 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90488.171334 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgeq-0005du-9S; Fri, 26 Feb 2021 17:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90488.171334; Fri, 26 Feb 2021 17:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgeq-0005dl-64; Fri, 26 Feb 2021 17:12:04 +0000
Received: by outflank-mailman (input) for mailman id 90488;
 Fri, 26 Feb 2021 17:12:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgeo-0005da-W9
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:12:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgeo-0008Mk-VU
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgeo-0002wC-Uf
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:12:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MIwDcqqej5YeZAcGgpjFzKYrk4K7+iLsRobast2UklU=; b=tVhDhzL60tBMKRSasvzinxhf+D
	k0oGSk01nBc1QEAff+UJVRpUR9zd0FdgIg+LqMr6TUvFpRkk5m58zqLFTbAXvKsmdMPCy4+mCLdRR
	4xL48Y3VZAamY6iaBWdCUo8PSGcaoU3ZG4ZZjTxrDB/ObGBzTCAtc9v9EAeVDhzdUZH0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: don't move TSC backwards in time_calibration_tsc_rendezvous()
Message-Id: <E1lFgeo-0002wC-Uf@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:12:02 +0000

commit 76aff7f6336b0ce19559700717537449972531be
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 19 17:21:41 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 19 17:21:41 2021 +0100

    x86/time: don't move TSC backwards in time_calibration_tsc_rendezvous()
    
    While doing this for small amounts may be okay, the unconditional use
    of CPU0's value here has been found to be a problem when the boot time
    TSC of the BSP was behind that of all APs by more than a second. In
    particular because of get_s_time_fixed() producing insane output when
    the calculated delta is negative, we can't allow this to happen.
    
    On the first iteration have all other CPUs sort out the highest TSC
    value any one of them has read. On the second iteration, if that
    maximum is higher than CPU0's, update its recorded value from that
    taken in the first iteration. Use the resulting value on the last
    iteration to write everyone's TSCs.
    
    To account for the possible discontinuity, have
    time_calibration_rendezvous_tail() record the newly written value, but
    extrapolate local stime using the value read.
    
    Reported-by: Claudemir Todo Bom <claudemir@todobom.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/time.c | 36 ++++++++++++++++++++++++++++--------
 1 file changed, 28 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index a894f74b88..6bc1fd11d6 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1658,17 +1658,17 @@ struct calibration_rendezvous {
     cpumask_t cpu_calibration_map;
     atomic_t semaphore;
     s_time_t master_stime;
-    u64 master_tsc_stamp;
+    uint64_t master_tsc_stamp, max_tsc_stamp;
 };
 
 static void
 time_calibration_rendezvous_tail(const struct calibration_rendezvous *r,
-                                 uint64_t tsc)
+                                 uint64_t old_tsc, uint64_t new_tsc)
 {
     struct cpu_time_stamp *c = &this_cpu(cpu_calibration);
 
-    c->local_tsc    = tsc;
-    c->local_stime  = get_s_time_fixed(c->local_tsc);
+    c->local_tsc    = new_tsc;
+    c->local_stime  = get_s_time_fixed(old_tsc ?: new_tsc);
     c->master_stime = r->master_stime;
 
     raise_softirq(TIME_CALIBRATE_SOFTIRQ);
@@ -1683,6 +1683,7 @@ static void time_calibration_tsc_rendezvous(void *_r)
     int i;
     struct calibration_rendezvous *r = _r;
     unsigned int total_cpus = cpumask_weight(&r->cpu_calibration_map);
+    uint64_t tsc = 0;
 
     /* Loop to get rid of cache effects on TSC skew. */
     for ( i = 4; i >= 0; i-- )
@@ -1692,8 +1693,15 @@ static void time_calibration_tsc_rendezvous(void *_r)
             while ( atomic_read(&r->semaphore) != (total_cpus - 1) )
                 cpu_relax();
 
-            if ( r->master_tsc_stamp == 0 )
-                r->master_tsc_stamp = rdtsc_ordered();
+            if ( tsc == 0 )
+                r->master_tsc_stamp = tsc = rdtsc_ordered();
+            else if ( r->master_tsc_stamp < r->max_tsc_stamp )
+                /*
+                 * We want to avoid moving the TSC backwards for any CPU.
+                 * Use the largest value observed anywhere on the first
+                 * iteration.
+                 */
+                r->master_tsc_stamp = r->max_tsc_stamp;
             else if ( i == 0 )
                 r->master_stime = read_platform_stime(NULL);
 
@@ -1712,6 +1720,15 @@ static void time_calibration_tsc_rendezvous(void *_r)
             while ( atomic_read(&r->semaphore) < total_cpus )
                 cpu_relax();
 
+            if ( tsc == 0 )
+            {
+                uint64_t cur = ACCESS_ONCE(r->max_tsc_stamp);
+
+                tsc = rdtsc_ordered();
+                while ( tsc > cur )
+                    cur = cmpxchg(&r->max_tsc_stamp, cur, tsc);
+            }
+
             if ( i == 0 )
                 write_tsc(r->master_tsc_stamp);
 
@@ -1719,9 +1736,12 @@ static void time_calibration_tsc_rendezvous(void *_r)
             while ( atomic_read(&r->semaphore) > total_cpus )
                 cpu_relax();
         }
+
+        /* Just in case a read above ended up reading zero. */
+        tsc += !tsc;
     }
 
-    time_calibration_rendezvous_tail(r, r->master_tsc_stamp);
+    time_calibration_rendezvous_tail(r, tsc, r->master_tsc_stamp);
 }
 
 /* Ordinary rendezvous function which does not modify TSC values. */
@@ -1746,7 +1766,7 @@ static void time_calibration_std_rendezvous(void *_r)
         smp_rmb(); /* receive signal /then/ read r->master_stime */
     }
 
-    time_calibration_rendezvous_tail(r, rdtsc_ordered());
+    time_calibration_rendezvous_tail(r, 0, rdtsc_ordered());
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:12:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:12:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90491.171353 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgez-0005hj-RK; Fri, 26 Feb 2021 17:12:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90491.171353; Fri, 26 Feb 2021 17:12:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgez-0005hb-NT; Fri, 26 Feb 2021 17:12:13 +0000
Received: by outflank-mailman (input) for mailman id 90491;
 Fri, 26 Feb 2021 17:12:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgez-0005hJ-3D
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:12:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgez-0008N3-2W
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgez-0002x9-1h
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:12:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=z3OpdRYqsYp2YmL1S+35VwDk+lS+FGrqVvs/DUoffDg=; b=xguRv3PxwEUdhDL5lSJ0js2kJT
	4P/Fj+joI4STmOcq9KBgcrSgLSoP2AjZ7N3aqUMLkSeDUZVe5bVS27wYl6olbbepmw7e31asNa+Aa
	TQqRtsgVA+d6NEb3m1OvZVvgpsXxnTgiovNB9weFuhg9jh7dyqGNv9L+kabtSU7LxUoo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: refactor set param
Message-Id: <E1lFgez-0002x9-1h@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:12:13 +0000

commit 336fbbdf61562e5ae1112f24bc90c1164adf2144
Author:     Norbert Manthey <nmanthey@amazon.de>
AuthorDate: Fri Feb 19 17:24:03 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 19 17:24:03 2021 +0100

    x86/hvm: refactor set param
    
    To prevent leaking HVM params via L1TF and similar issues on a
    hyperthread pair, let's load values of domains only after performing all
    relevant checks, and blocking speculative execution.
    
    For both get and set, the value of the index is already checked in the
    outer calling function. The block_speculation calls in hvmop_get_param
    and hvmop_set_param are removed, because is_hvm_domain already blocks
    speculation.
    
    Furthermore, speculative barriers are re-arranged to make sure we do not
    allow guests running on co-located VCPUs to leak hvm parameter values of
    other domains.
    
    To improve symmetry between the get and set operations, function
    hvmop_set_param is made static.
    
    This is part of the speculative hardening effort.
    
    Reported-by: Hongyan Xia <hongyxia@amazon.co.uk>
    Signed-off-by: Norbert Manthey <nmanthey@amazon.de>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/hvm/hvm.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index a2ecd54ab7..e7bcffebc4 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4060,7 +4060,7 @@ static int hvm_allow_set_param(struct domain *d,
                                uint32_t index,
                                uint64_t new_value)
 {
-    uint64_t value = d->arch.hvm.params[index];
+    uint64_t value;
     int rc;
 
     rc = xsm_hvm_param(XSM_TARGET, d, HVMOP_set_param);
@@ -4108,6 +4108,10 @@ static int hvm_allow_set_param(struct domain *d,
     if ( rc )
         return rc;
 
+    /* Make sure we evaluate permissions before loading data of domains. */
+    block_speculation();
+
+    value = d->arch.hvm.params[index];
     switch ( index )
     {
     /* The following parameters should only be changed once. */
@@ -4134,13 +4138,13 @@ static int hvm_set_param(struct domain *d, uint32_t index, uint64_t value)
     struct vcpu *v;
     int rc;
 
-    if ( index >= HVM_NR_PARAMS )
-        return -EINVAL;
-
     rc = hvm_allow_set_param(d, index, value);
     if ( rc )
         return rc;
 
+    /* Make sure we evaluate permissions before loading data of domains. */
+    block_speculation();
+
     switch ( index )
     {
     case HVM_PARAM_CALLBACK_IRQ:
@@ -4305,7 +4309,7 @@ static int hvm_set_param(struct domain *d, uint32_t index, uint64_t value)
     return rc;
 }
 
-int hvmop_set_param(
+static int hvmop_set_param(
     XEN_GUEST_HANDLE_PARAM(xen_hvm_param_t) arg)
 {
     struct xen_hvm_param a;
@@ -4318,9 +4322,6 @@ int hvmop_set_param(
     if ( a.index >= HVM_NR_PARAMS )
         return -EINVAL;
 
-    /* Make sure the above bound check is not bypassed during speculation. */
-    block_speculation();
-
     d = rcu_lock_domain_by_any_id(a.domid);
     if ( d == NULL )
         return -ESRCH;
@@ -4388,6 +4389,9 @@ int hvm_get_param(struct domain *d, uint32_t index, uint64_t *value)
     if ( rc )
         return rc;
 
+    /* Make sure the above domain permissions check is respected. */
+    block_speculation();
+
     switch ( index )
     {
     case HVM_PARAM_ACPI_S_STATE:
@@ -4428,9 +4432,6 @@ static int hvmop_get_param(
     if ( a.index >= HVM_NR_PARAMS )
         return -EINVAL;
 
-    /* Make sure the above bound check is not bypassed during speculation. */
-    block_speculation();
-
     d = rcu_lock_domain_by_any_id(a.domid);
     if ( d == NULL )
         return -ESRCH;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:12:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:12:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90492.171356 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgf9-0005l9-ST; Fri, 26 Feb 2021 17:12:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90492.171356; Fri, 26 Feb 2021 17:12:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgf9-0005kz-PH; Fri, 26 Feb 2021 17:12:23 +0000
Received: by outflank-mailman (input) for mailman id 90492;
 Fri, 26 Feb 2021 17:12:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgf9-0005kk-6V
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:12:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgf9-0008NA-5k
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgf9-0002y0-4y
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:12:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zDpk2jArAKKEurg8Zzc5L6z5KCKARjzaueEtdsoo7MQ=; b=GfktkgB6PIsaRWyz69167HBxGF
	PFCHbGFXefr51uihHcYh3xsh5cWF9ScGe3DOFvkFkh8667CYLpJdiAV+I5D5Lugg73YO4xYRbp5dp
	9FKmEdr1zQnHxxdKrSb3bkDOzelwW8j4qz/zfL9oVIrGBsmHJUFsfFNa8z7XhlrgyFfQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxl: Work around unintialised variable libxl__domain_get_device_model_uid()
Message-Id: <E1lFgf9-0002y0-4y@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:12:23 +0000

commit 2ff2adc61fcfa09118b76b4b64cbf8a78f7f2882
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 15:29:12 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 19 17:10:33 2021 +0000

    tools/libxl: Work around unintialised variable libxl__domain_get_device_model_uid()
    
    Various version of gcc, when compiling with -Og, complain:
    
      libxl_dm.c: In function 'libxl__domain_get_device_model_uid':
      libxl_dm.c:256:12: error: 'kill_by_uid' may be used uninitialized in this function [-Werror=maybe-uninitialized]
        256 |         if (kill_by_uid)
            |            ^
    
    The logic is very tangled.  Set kill_by_uid on every path.
    
    No funcational change.
    
    Requested-by: Ian Jackson <iwj@xenproject.org>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Not-acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/light/libxl_dm.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index db4cec6a76..5309496c58 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -152,13 +152,16 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,
     user = b_info->device_model_user;
     if (user) {
         rc = userlookup_helper_getpwnam(gc, user, &user_pwbuf, &user_base);
-        if (rc)
+        if (rc) {
+            kill_by_uid = false;
             goto out;
+        }
 
         if (!user_base) {
             LOGD(ERROR, guest_domid, "Couldn't find device_model_user %s",
                  user);
             rc = ERROR_INVAL;
+            kill_by_uid = false;
             goto out;
         }
 
@@ -187,22 +190,29 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,
      */
     rc = userlookup_helper_getpwnam(gc, LIBXL_QEMU_USER_RANGE_BASE,
                                          &user_pwbuf, &user_base);
-    if (rc)
+    if (rc) {
+        kill_by_uid = false;
         goto out;
+    }
+
     if (user_base) {
         struct passwd *user_clash, user_clash_pwbuf;
 
         intended_uid = user_base->pw_uid + guest_domid;
         rc = userlookup_helper_getpwuid(gc, intended_uid,
                                          &user_clash_pwbuf, &user_clash);
-        if (rc)
+        if (rc) {
+            kill_by_uid = false;
             goto out;
+        }
+
         if (user_clash) {
             LOGD(ERROR, guest_domid,
                  "wanted to use uid %ld (%s + %d) but that is user %s !",
                  (long)intended_uid, LIBXL_QEMU_USER_RANGE_BASE,
                  guest_domid, user_clash->pw_name);
             rc = ERROR_INVAL;
+            kill_by_uid = false;
             goto out;
         }
 
@@ -221,8 +231,11 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,
      */
     user = LIBXL_QEMU_USER_SHARED;
     rc = userlookup_helper_getpwnam(gc, user, &user_pwbuf, &user_base);
-    if (rc)
+    if (rc) {
+        kill_by_uid = false;
         goto out;
+    }
+
     if (user_base) {
         LOGD(WARN, guest_domid, "Could not find user %s, falling back to %s",
              LIBXL_QEMU_USER_RANGE_BASE, LIBXL_QEMU_USER_SHARED);
@@ -240,6 +253,7 @@ static int libxl__domain_get_device_model_uid(libxl__gc *gc,
          "Could not find user %s or range base pseudo-user %s, cannot restrict",
          LIBXL_QEMU_USER_SHARED, LIBXL_QEMU_USER_RANGE_BASE);
     rc = ERROR_INVAL;
+    kill_by_uid = false;
 
 out:
     /* First, do a root check if appropriate */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:12:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:12:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90493.171361 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgfJ-0005nO-Tf; Fri, 26 Feb 2021 17:12:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90493.171361; Fri, 26 Feb 2021 17:12:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgfJ-0005nG-Qp; Fri, 26 Feb 2021 17:12:33 +0000
Received: by outflank-mailman (input) for mailman id 90493;
 Fri, 26 Feb 2021 17:12:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgfJ-0005n7-9u
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:12:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgfJ-0008NL-9D
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgfJ-0002yc-8N
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:12:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/EuPCiVQxFl7viD088H4PP0YvZvt7euLXrAk+coVtMY=; b=hpxCLk0HKZGFeBtox6diIJV/wT
	zEhuOLhsfU1+Se5O9FlZQaYF2JOgtNkJJ/8qroqH7NiBkiM8MZxifLqWPZSluLxoPyVPuF9ewOAqP
	Wcl/8r/dTMJtJFlZWnfXtph0GrzpB5tAgyp6NUwulR8i4OMBXf3PMQLYDryg8QpxOPMc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Use -Og for debug builds when available
Message-Id: <E1lFgfJ-0002yc-8N@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:12:33 +0000

commit 4abb20e321626c3d3cb0e922eac2048dc15d7c87
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 14:22:44 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 19 17:10:33 2021 +0000

    tools: Use -Og for debug builds when available
    
    The recommended optimisation level for debugging is -Og, and is what tools
    such as gdb prefer.  In practice, it equates to -01 with a few specific
    optimisations turned off.
    
    abi-dumper in particular wants the libraries it inspects in this form.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/Rules.mk | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index f61da81f4a..2907ed2d39 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -106,8 +106,9 @@ endif
 CFLAGS_libxenlight += $(CFLAGS_libxenctrl)
 
 ifeq ($(debug),y)
-# Disable optimizations
-CFLAGS += -O0 -fno-omit-frame-pointer
+# Use -Og if available, -O0 otherwise
+dbg_opt_level := $(call cc-option,$(CC),-Og,-O0)
+CFLAGS += $(dbg_opt_level) -fno-omit-frame-pointer
 # But allow an override to -O0 in case Python enforces -D_FORTIFY_SOURCE=<n>.
 PY_CFLAGS += $(PY_NOOPT_CFLAGS)
 else
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:12:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:12:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90496.171366 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgfU-0005pW-16; Fri, 26 Feb 2021 17:12:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90496.171366; Fri, 26 Feb 2021 17:12:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgfT-0005pN-Te; Fri, 26 Feb 2021 17:12:43 +0000
Received: by outflank-mailman (input) for mailman id 90496;
 Fri, 26 Feb 2021 17:12:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgfT-0005pC-Ei
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:12:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgfT-0008Np-Cu
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgfT-0002zZ-C8
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:12:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pUta5WfSB9PdIm149lQM0jKCjfbRJFhyfh6OBs2rJJ8=; b=ZYs4mLTPzeJa9LRkw8KlaShb1y
	18IgLVXy0NyIwLDxnVDA+VeOZtEsbmSdinLco6xT3tA02H9Blc50fagXk8CObNm/44qd7OQklnqdx
	a85s5YW9Qw2fcPaBgrBaAJXWjakPXw3KaqQkiV0nxum5DXhk+0d+dDSpxx9HYe8PJPl4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Check for abi-dumper in ./configure
Message-Id: <E1lFgfT-0002zZ-C8@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:12:43 +0000

commit 5398d16105594835e1878629eb9ce2c403667a00
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 12 11:51:04 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 19 17:10:33 2021 +0000

    tools: Check for abi-dumper in ./configure
    
    This will be optional.  No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 config/Tools.mk.in |  1 +
 tools/configure    | 41 +++++++++++++++++++++++++++++++++++++++++
 tools/configure.ac |  1 +
 3 files changed, 43 insertions(+)

diff --git a/config/Tools.mk.in b/config/Tools.mk.in
index 48bd9ab731..d47936686b 100644
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -19,6 +19,7 @@ BCC                 := @BCC@
 IASL                := @IASL@
 AWK                 := @AWK@
 FETCHER             := @FETCHER@
+ABI_DUMPER          := @ABI_DUMPER@
 
 # Extra folder for libs/includes
 PREPEND_INCLUDES    := @PREPEND_INCLUDES@
diff --git a/tools/configure b/tools/configure
index e63ca3797d..bb5acf9d43 100755
--- a/tools/configure
+++ b/tools/configure
@@ -682,6 +682,7 @@ OCAMLOPT
 OCAMLLIB
 OCAMLVERSION
 OCAMLC
+ABI_DUMPER
 INSTALL_DATA
 INSTALL_SCRIPT
 INSTALL_PROGRAM
@@ -5442,6 +5443,46 @@ $as_echo "no" >&6; }
 fi
 
 
+# Extract the first word of "abi-dumper", so it can be a program name with args.
+set dummy abi-dumper; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ABI_DUMPER+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ABI_DUMPER in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ABI_DUMPER="$ABI_DUMPER" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_ABI_DUMPER="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ABI_DUMPER=$ac_cv_path_ABI_DUMPER
+if test -n "$ABI_DUMPER"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ABI_DUMPER" >&5
+$as_echo "$ABI_DUMPER" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # Extract the first word of "perl", so it can be a program name with args.
 set dummy perl; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
diff --git a/tools/configure.ac b/tools/configure.ac
index 6b611deb13..636e7077be 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -310,6 +310,7 @@ AC_PROG_CC
 AC_PROG_MAKE_SET
 AC_PROG_INSTALL
 AC_PATH_PROG([FLEX], [flex])
+AC_PATH_PROG([ABI_DUMPER], [abi-dumper])
 AX_PATH_PROG_OR_FAIL([PERL], [perl])
 AX_PATH_PROG_OR_FAIL([AWK], [awk])
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:12:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:12:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90498.171368 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgfe-0005rJ-1o; Fri, 26 Feb 2021 17:12:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90498.171368; Fri, 26 Feb 2021 17:12:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgfd-0005rA-V9; Fri, 26 Feb 2021 17:12:53 +0000
Received: by outflank-mailman (input) for mailman id 90498;
 Fri, 26 Feb 2021 17:12:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgfd-0005r4-Gr
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:12:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgfd-0008O0-G1
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgfd-00039V-F7
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:12:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oO0bggMiMQ8MJ4KFpkYDQd1Cv0gKVYtPEXPg3Mb2xCw=; b=I6Phzi7cb2fIlsK2DJdcTHrOcn
	HVN6dd51ANnBg9D8kC3/GLfKTwRQw86duG8Nsu0FWgcwDPjXDn5BYfZhyf7VBv5M5ahd2avexewxI
	anTSC2ij7kt73+vO68Rm3hSR3WNxX7X14PPHpMeCQjMtFv0j4MnoE9gbbLyWvrDU2QcU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs: Add rule to generate headers.lst
Message-Id: <E1lFgfd-00039V-F7@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:12:53 +0000

commit 0670834c50e2eedc6a281e084fb9c181817f26ce
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 06:29:31 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 19 17:10:33 2021 +0000

    tools/libs: Add rule to generate headers.lst
    
    abi-dumper needs a list of the public header files for shared objects, and
    only accepts this in the form of a file.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/.gitignore | 1 +
 tools/libs/libs.mk    | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/libs/.gitignore b/tools/libs/.gitignore
new file mode 100644
index 0000000000..4a13126144
--- /dev/null
+++ b/tools/libs/.gitignore
@@ -0,0 +1 @@
+*/headers.lst
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 0b3381755a..7970627ac8 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -76,6 +76,10 @@ endif
 
 headers.chk: $(AUTOINCS)
 
+headers.lst: FORCE
+	@{ set -e; $(foreach h,$(LIBHEADERS),echo $(h);) } > $@.tmp
+	@$(call move-if-changed,$@.tmp,$@)
+
 libxen$(LIBNAME).map:
 	echo 'VERS_$(MAJOR).$(MINOR) { global: *; };' >$@
 
@@ -118,9 +122,12 @@ TAGS:
 clean:
 	rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
 	rm -f lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) lib$(LIB_FILE_NAME).so.$(MAJOR)
-	rm -f headers.chk
+	rm -f headers.chk headers.lst
 	rm -f $(PKG_CONFIG)
 	rm -f _paths.h
 
 .PHONY: distclean
 distclean: clean
+
+.PHONY: FORCE
+FORCE:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:13:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:13:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90499.171373 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgfp-0005ss-3Y; Fri, 26 Feb 2021 17:13:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90499.171373; Fri, 26 Feb 2021 17:13:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgfp-0005sk-0S; Fri, 26 Feb 2021 17:13:05 +0000
Received: by outflank-mailman (input) for mailman id 90499;
 Fri, 26 Feb 2021 17:13:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgfn-0005sX-K3
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:13:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgfn-0008ON-J4
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:13:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgfn-0003AG-IG
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:13:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=V9CLsjoArxpYUKisauHbLrTcUuFtWjEzcYuQmTdcwno=; b=jSw7W1BIMaSitn1cYBYHxnnXcj
	7don8ANUtUrVB+mV/c7ld1sUma0C7eOn9g0CdWgGTYnq67R7kZmR+DnrdsgANPoQIv4YItavl+jE8
	SBLZJiRaq9oEeLGWFSXThH2uWHFd1EEibaNvgK2r+F6W7vp+KBtAY4gsZcRJnDrRqCc8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs: Write out an ABI analysis when abi-dumper is available
Message-Id: <E1lFgfn-0003AG-IG@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:13:03 +0000

commit d7c9f7a7a3959913b4b37e782069bf91f0285f9d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 11 06:39:03 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 19 17:10:33 2021 +0000

    tools/libs: Write out an ABI analysis when abi-dumper is available
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/libs.mk | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 7970627ac8..a68cec244c 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -49,6 +49,8 @@ PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG)
 LIBHEADER ?= $(LIB_FILE_NAME).h
 LIBHEADERS = $(foreach h, $(LIBHEADER), $(XEN_INCLUDE)/$(h))
 
+PKG_ABI := lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)-$(XEN_TARGET_ARCH)-abi.dump
+
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_PREFIX = $(XEN_ROOT)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
@@ -94,6 +96,13 @@ lib$(LIB_FILE_NAME).so.$(MAJOR): lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)
 lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxen$(LIBNAME).map
 	$(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,lib$(LIB_FILE_NAME).so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDUSELIBS) $(APPEND_LDFLAGS)
 
+# If abi-dumper is available, write out the ABI analysis
+ifneq ($(ABI_DUMPER),)
+libs: $(PKG_ABI)
+$(PKG_ABI): lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) headers.lst
+	$(ABI_DUMPER) $< -o $@ -public-headers headers.lst -lver $(MAJOR).$(MINOR)
+endif
+
 .PHONY: install
 install: build
 	$(INSTALL_DIR) $(DESTDIR)$(libdir)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:13:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:13:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90500.171377 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgfz-0005uF-5N; Fri, 26 Feb 2021 17:13:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90500.171377; Fri, 26 Feb 2021 17:13:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgfz-0005u7-25; Fri, 26 Feb 2021 17:13:15 +0000
Received: by outflank-mailman (input) for mailman id 90500;
 Fri, 26 Feb 2021 17:13:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgfx-0005tz-Mt
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:13:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgfx-0008Oa-M9
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:13:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgfx-0003As-LP
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:13:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=58t4GpuiOZ4sIZF3MM/8w0XZ0+x4IFpd9n7CT0H7kyE=; b=tCx1A9FZeIDyiNjaSf8kc3OGuY
	G9IUkO7zsebtm9NOh7vAKr1JFt7C26VoY39t187dTUEJ0cBKA18BejzS9ObKz4yx4UKrVH0AsXQur
	GeMqCkEpBZBpGujpUEm5WRRL1uTvvrjGYCKBDY5KFhzDP5Nk0qYDqq2iMmnjJUc6W0Hw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs/light: fix xl save -c handling
Message-Id: <E1lFgfx-0003As-LP@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:13:13 +0000

commit 87a067fd8f4d4f7c6be02c3d38145115ac542017
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Feb 19 15:13:37 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 19 17:52:41 2021 +0000

    tools/libs/light: fix xl save -c handling
    
    libxl_domain_resume() won't work correctly for the case it was called
    due to a "xl save -c" command, i.e. to continue the suspended domain.
    
    The information to do that is not saved in libxl__dm_resume_state for
    non-HVM domains.
    
    Fixes: 6298f0eb8f443 ("libxl: Re-introduce libxl__domain_resume")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/light/libxl_dom_suspend.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_dom_suspend.c b/tools/libs/light/libxl_dom_suspend.c
index 25d1571895..f7823bbc8f 100644
--- a/tools/libs/light/libxl_dom_suspend.c
+++ b/tools/libs/light/libxl_dom_suspend.c
@@ -630,12 +630,13 @@ void libxl__domain_resume(libxl__egc *egc,
         goto out;
     }
 
+    dmrs->suspend_cancel = suspend_cancel;
+
     if (type != LIBXL_DOMAIN_TYPE_HVM) {
         rc = 0;
         goto out;
     }
 
-    dmrs->suspend_cancel = suspend_cancel;
     dmrs->dm_resumed_callback = domain_resume_done;
     libxl__dm_resume(egc, dmrs); /* must be last */
     return;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:13:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:13:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90501.171381 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgg9-0005vg-6d; Fri, 26 Feb 2021 17:13:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90501.171381; Fri, 26 Feb 2021 17:13:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgg9-0005vY-3h; Fri, 26 Feb 2021 17:13:25 +0000
Received: by outflank-mailman (input) for mailman id 90501;
 Fri, 26 Feb 2021 17:13:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgg7-0005vM-RL
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:13:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgg7-0008Oi-Qe
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:13:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgg7-0003Bo-OJ
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:13:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=d8pOu98UHIIjl9nhqhIVMLBQ7w/qEBoCi+OeN/w9jY0=; b=qs+cpVKzq5Op67qj1QsMUSHoOl
	4Er9euRnY3Rxr0azVKKmIkyzA16ezQS4/2aJY5OVbBCT0hk64GJvAyd9fEEQtPh/PuCmoEfoixoP7
	B+0pXnBwy6u1xSgxYqjXV1sEvzEoJg87L9liKbrU7nYUEaKwHn6drR2MR7kbI813dc8A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/misc/xen-vmtrace: use reset and enable
Message-Id: <E1lFgg7-0003Bo-OJ@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:13:23 +0000

commit f894c3d8e705fea9cb3244fa61684bfd8bdd1b2a
Author:     Tamas K Lengyel <tamas@tklengyel.com>
AuthorDate: Sat Feb 20 16:07:38 2021 -0500
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Feb 22 11:15:31 2021 +0000

    tools/misc/xen-vmtrace: use reset and enable
    
    The expected behavior while using xen-vmtrace is to get a clean start, even if
    the tool was used previously on the same VM.
    
    Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
---
 tools/misc/xen-vmtrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/misc/xen-vmtrace.c b/tools/misc/xen-vmtrace.c
index 7572e880c5..35d14c6a9b 100644
--- a/tools/misc/xen-vmtrace.c
+++ b/tools/misc/xen-vmtrace.c
@@ -119,7 +119,7 @@ int main(int argc, char **argv)
         goto out;
     }
 
-    if ( xc_vmtrace_enable(xch, domid, vcpu) )
+    if ( xc_vmtrace_reset_and_enable(xch, domid, vcpu) )
     {
         perror("xc_vmtrace_enable()");
         goto out;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:13:35 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:13:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90502.171385 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFggJ-0005xJ-8R; Fri, 26 Feb 2021 17:13:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90502.171385; Fri, 26 Feb 2021 17:13:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFggJ-0005xB-5I; Fri, 26 Feb 2021 17:13:35 +0000
Received: by outflank-mailman (input) for mailman id 90502;
 Fri, 26 Feb 2021 17:13:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFggH-0005wx-Ud
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:13:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFggH-0008Op-Ts
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:13:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFggH-0003Cl-Sw
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:13:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HER2KTzs4ZvLwxbfeN1rTtifaEx9feTBUeW4J+vwKug=; b=1wuKBRaVJ9inXBqU3cfROilaP+
	6eoWCT8uxNUQBegGuFmiY6BVcttgb+fUmOcDAPTolpfgP5f2rFQ2FlzZteYW0ojyFvpG6WbMo5fkb
	8V2YRf72Jw/Tk6xeShPRlvDruj0iLfZjxVGkIC00W5y8Aoo41jC4hiPvysEgLbLJv0z0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] cirrus-ci: introduce some basic FreeBSD testing
Message-Id: <E1lFggH-0003Cl-Sw@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:13:33 +0000

commit 5d94433a66df29ce314696a13bdd324ec0e342fe
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Feb 23 16:53:53 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 23 19:44:25 2021 +0000

    cirrus-ci: introduce some basic FreeBSD testing
    
    Cirrus-CI supports FreeBSD natively, so introduce some build tests on
    FreeBSD.
    
    The Cirrus-CI requires a Github repository in order to trigger the
    tests.
    
    A sample run output can be seen at:
    
    https://github.com/royger/xen/runs/1962451343
    
    Note the FreeBSD 11 task fails to build QEMU and is not part of this
    patch.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 .cirrus.yml | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/.cirrus.yml b/.cirrus.yml
new file mode 100644
index 0000000000..5e3e46368e
--- /dev/null
+++ b/.cirrus.yml
@@ -0,0 +1,26 @@
+# https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
+freebsd_template: &FREEBSD_TEMPLATE
+  environment:
+    APPEND_LIB: /usr/local/lib
+    APPEND_INCLUDES: /usr/local/include
+
+  install_script: pkg install -y seabios markdown gettext-tools gmake
+                                 pkgconf python libiconv bison perl5
+                                 yajl lzo2 pixman argp-standalone
+                                 libxml2 glib git
+
+  build_script:
+    - ./configure --with-system-seabios=/usr/local/share/seabios/bios.bin
+    - gmake -j`sysctl -n hw.ncpu` clang=y
+
+task:
+  name: 'FreeBSD 12'
+  freebsd_instance:
+    image_family: freebsd-12-2
+  << : *FREEBSD_TEMPLATE
+
+task:
+  name: 'FreeBSD 13'
+  freebsd_instance:
+    image_family: freebsd-13-0
+  << : *FREEBSD_TEMPLATE
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:13:45 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:13:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90503.171389 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFggT-0005yY-A4; Fri, 26 Feb 2021 17:13:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90503.171389; Fri, 26 Feb 2021 17:13:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFggT-0005yQ-6s; Fri, 26 Feb 2021 17:13:45 +0000
Received: by outflank-mailman (input) for mailman id 90503;
 Fri, 26 Feb 2021 17:13:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFggS-0005yI-1T
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:13:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFggS-0008PH-0c
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:13:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFggR-0003DP-W6
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:13:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ETTgKJMt/0MtaodNV+2zAojW7vfbkFG5CbTaGPV7FYc=; b=PBBgn8RQw7mzVd7dDkI02muH13
	dxrss44d/nCqOP+h2//lLwnV3J0X0q0c7zlXZ1y8DTXrxvHL2OgfHfH+3xPaavJh7/kyUpjEmXIVM
	o4/6ntLcEwcFKhTr4fiDiZGMK398OCYdNxrHvqjZZoC8BB6iWGvb++R8qrPmqSvBwJgA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build: remove more absolute paths from dependency tracking files
Message-Id: <E1lFggR-0003DP-W6@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:13:43 +0000

commit 10bb8aa0d5d029bd56da4a2a92e1e42bef880210
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Feb 24 12:47:34 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 24 12:47:34 2021 +0100

    build: remove more absolute paths from dependency tracking files
    
    d6b12add90da ("DEPS handling: Remove absolute paths from references to
    cwd") took care of massaging the dependencies of the output file, but
    for our passing of -MP to the compiler to take effect the same needs to
    be done on the "phony" rules that the compiler emits.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 259e68863d..eb28e498be 100644
--- a/Config.mk
+++ b/Config.mk
@@ -63,7 +63,7 @@ DEPS_INCLUDE = $(addsuffix .d2, $(basename $(wildcard $(DEPS))))
 DEPS_RM = $(DEPS) $(DEPS_INCLUDE)
 
 %.d2: %.d
-	sed "s! $$PWD/! !" $^ >$@.tmp && mv -f $@.tmp $@
+	sed "s!\(^\| \)$$PWD/! !" $^ >$@.tmp && mv -f $@.tmp $@
 
 include $(XEN_ROOT)/config/$(XEN_OS).mk
 include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:13:55 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:13:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90504.171392 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFggd-000600-Bs; Fri, 26 Feb 2021 17:13:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90504.171392; Fri, 26 Feb 2021 17:13:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFggd-0005zs-8a; Fri, 26 Feb 2021 17:13:55 +0000
Received: by outflank-mailman (input) for mailman id 90504;
 Fri, 26 Feb 2021 17:13:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFggc-0005zj-4L
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:13:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFggc-0008PO-3h
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:13:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFggc-0003Eb-2z
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:13:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4HjgKx31S4KAJBjrlMmUjkCTlGBtKXl1sYnk2l3CWGE=; b=C52mpqrdUDJYrLPApfyfI72wkE
	8L9fxGeommQat1OdQML0uUXBJ9v1Sa7iV02+fiAsOZxbBsmUAx27UkXQfyTOKfeF/uhgoHc+dI246
	EqY6ysWuYFv29xx7YipYAY9LjcfOitsRrJ9/jsUewRRJTYtVJCI1mwKfKlpk76SQ6ZIQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] hvmloader: use Xen private header for elf structs
Message-Id: <E1lFggc-0003Eb-2z@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:13:54 +0000

commit 81b2b328a26c1b89c275898d12e8ab26c0673dad
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Feb 24 12:48:13 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 24 12:48:13 2021 +0100

    hvmloader: use Xen private header for elf structs
    
    Do not use the system provided elf.h, and instead use elfstructs.h
    from libelf.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/firmware/hvmloader/32bitbios_support.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/firmware/hvmloader/32bitbios_support.c b/tools/firmware/hvmloader/32bitbios_support.c
index 114135022e..e726946a7b 100644
--- a/tools/firmware/hvmloader/32bitbios_support.c
+++ b/tools/firmware/hvmloader/32bitbios_support.c
@@ -21,7 +21,7 @@
  */
 
 #include <inttypes.h>
-#include <elf.h>
+#include <xen/libelf/elfstructs.h>
 #ifdef __sun__
 #include <sys/machelf.h>
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:14:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:14:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90505.171396 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFggn-00061f-EF; Fri, 26 Feb 2021 17:14:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90505.171396; Fri, 26 Feb 2021 17:14:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFggn-00061X-BL; Fri, 26 Feb 2021 17:14:05 +0000
Received: by outflank-mailman (input) for mailman id 90505;
 Fri, 26 Feb 2021 17:14:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFggm-00061P-7V
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:14:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFggm-0008Pi-6o
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:14:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFggm-0003FL-63
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:14:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ImGIa13smfsL96C4B043EY3fD+vMMdrmBYXTioLOhu8=; b=E26aWx7APVpxWh8iZdsDFsZQQ8
	LmKnyNANpYv8TnVrjdy2AQo5MqjM4hVJLcc+uGf/lhp6NorEjOecmTukzpaOWfeTuNMCz7H7Eeayr
	tLQO01ETHOne3k75gFdPMO+tZt99nBWkMCmLmYxhMDK2sjphnJFyj6Hp20CoHkoprbzU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] elfstructs: add relocation defines for i386
Message-Id: <E1lFggm-0003FL-63@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:14:04 +0000

commit 60390ccb8b9b2dbf85010f8b47779bb231aa2533
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Feb 24 16:31:12 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 24 16:31:12 2021 +0100

    elfstructs: add relocation defines for i386
    
    Those are need by the rombios relocation code in hvmloader. Fixes the
    following build error:
    
    32bitbios_support.c: In function 'relocate_32bitbios':
    32bitbios_support.c:130:18: error: 'R_386_PC32' undeclared (first use in this function); did you mean 'R_X86_64_PC32'?
                 case R_386_PC32:
                      ^~~~~~~~~~
                      R_X86_64_PC32
    32bitbios_support.c:130:18: note: each undeclared identifier is reported only once for each function it appears in
    32bitbios_support.c:134:18: error: 'R_386_32' undeclared (first use in this function)
                 case R_386_32:
                      ^~~~~~~~
    
    Only add the two defines that are actually used, which seems to match
    what we do for amd64.
    
    Fixes: 81b2b328a26c1b ('hvmloader: use Xen private header for elf structs')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/include/xen/elfstructs.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/include/xen/elfstructs.h b/xen/include/xen/elfstructs.h
index 726ca8f60d..616ebf9269 100644
--- a/xen/include/xen/elfstructs.h
+++ b/xen/include/xen/elfstructs.h
@@ -436,6 +436,13 @@ typedef struct {
 #define R_AARCH64_MOVW_PREL_G2_NC	292
 #define R_AARCH64_MOVW_PREL_G3		293
 
+/*
+ * Relocation definitions required by the rombios hvmloader relocation
+ * code.
+ */
+#define R_386_32           1            /* Direct 32 bit  */
+#define R_386_PC32         2            /* PC relative 32 bit */
+
 /* Program Header */
 typedef struct {
 	Elf32_Word	p_type;		/* segment type */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:14:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:14:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90506.171400 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFggx-00062y-Fn; Fri, 26 Feb 2021 17:14:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90506.171400; Fri, 26 Feb 2021 17:14:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFggx-00062s-Cp; Fri, 26 Feb 2021 17:14:15 +0000
Received: by outflank-mailman (input) for mailman id 90506;
 Fri, 26 Feb 2021 17:14:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFggw-00062g-CQ
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:14:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFggw-0008Pl-Bf
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:14:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFggw-0003GG-9F
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:14:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TLKrS8KyEzT5d5T9oiyDqvn/2Sc0kJqMcdMy9nekAMo=; b=JIpEXhTbhQRJd3l/hxEuX/uzV3
	MySZMsfQmK7kOqL6tvHciRPTg/ioxk7ZTUr88qr/s4BRT7C0GQEvQ/CshwlbkMw4b/xCNhkR7XGA5
	TJ4Vuuk7Mb4jkBGTVKnEVKMTYVpOPmKyOv8po3MK/NKtNzezUTRsEdJyiKGri5NhROgQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/vgic: Implement write to ISPENDR in vGICv{2, 3}
Message-Id: <E1lFggw-0003GG-9F@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:14:14 +0000

commit 067935804a8e7a33ff7170a2db8ce94bb46d9a63
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sat Feb 20 14:04:12 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Feb 25 12:09:27 2021 +0000

    xen/vgic: Implement write to ISPENDR in vGICv{2, 3}
    
    Currently, Xen will send a data abort to a guest trying to write to the
    ISPENDR.
    
    Unfortunately, recent version of Linux (at least 5.9+) will start
    writing to the register if the interrupt needs to be re-triggered
    (see the callback irq_retrigger). This can happen when a driver (such as
    the xgbe network driver on AMD Seattle) re-enable an interrupt:
    
    (XEN) d0v0: vGICD: unhandled word write 0x00000004000000 to ISPENDR44
    [...]
    [   25.635837] Unhandled fault at 0xffff80001000522c
    [...]
    [   25.818716]  gic_retrigger+0x2c/0x38
    [   25.822361]  irq_startup+0x78/0x138
    [   25.825920]  __enable_irq+0x70/0x80
    [   25.829478]  enable_irq+0x50/0xa0
    [   25.832864]  xgbe_one_poll+0xc8/0xd8
    [   25.836509]  net_rx_action+0x110/0x3a8
    [   25.840328]  __do_softirq+0x124/0x288
    [   25.844061]  irq_exit+0xe0/0xf0
    [   25.847272]  __handle_domain_irq+0x68/0xc0
    [   25.851442]  gic_handle_irq+0xa8/0xe0
    [   25.855171]  el1_irq+0xb0/0x180
    [   25.858383]  arch_cpu_idle+0x18/0x28
    [   25.862028]  default_idle_call+0x24/0x5c
    [   25.866021]  do_idle+0x204/0x278
    [   25.869319]  cpu_startup_entry+0x24/0x68
    [   25.873313]  rest_init+0xd4/0xe4
    [   25.876611]  arch_call_rest_init+0x10/0x1c
    [   25.880777]  start_kernel+0x5b8/0x5ec
    
    As a consequence, the OS may become unusable.
    
    Implementing the write part of ISPENDR is somewhat easy. For
    virtual interrupt, we only need to inject the interrupt again.
    
    For physical interrupt, we need to be more careful as the de-activation
    of the virtual interrupt will be propagated to the physical distributor.
    For simplicity, the physical interrupt will be set pending so the
    workflow will not differ from a "real" interrupt.
    
    Longer term, we could possible directly activate the physical interrupt
    and avoid taking an exception to inject the interrupt to the domain.
    (This is the approach taken by the new vGIC based on KVM).
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/arm/vgic-v2.c     | 10 ++++++----
 xen/arch/arm/vgic-v3.c     | 18 +++++++-----------
 xen/arch/arm/vgic.c        | 47 ++++++++++++++++++++++++++++++++++++++++++++++
 xen/include/asm-arm/vgic.h |  2 ++
 4 files changed, 62 insertions(+), 15 deletions(-)

diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c
index 64b141fea5..b2da886adc 100644
--- a/xen/arch/arm/vgic-v2.c
+++ b/xen/arch/arm/vgic-v2.c
@@ -472,10 +472,12 @@ static int vgic_v2_distr_mmio_write(struct vcpu *v, mmio_info_t *info,
 
     case VRANGE32(GICD_ISPENDR, GICD_ISPENDRN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        printk(XENLOG_G_ERR
-               "%pv: vGICD: unhandled word write %#"PRIregister" to ISPENDR%d\n",
-               v, r, gicd_reg - GICD_ISPENDR);
-        return 0;
+        rank = vgic_rank_offset(v, 1, gicd_reg - GICD_ISPENDR, DABT_WORD);
+        if ( rank == NULL ) goto write_ignore;
+
+        vgic_set_irqs_pending(v, r, rank->index);
+
+        return 1;
 
     case VRANGE32(GICD_ICPENDR, GICD_ICPENDRN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index fd8cfc156d..613f37abab 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -808,10 +808,12 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,
 
     case VRANGE32(GICD_ISPENDR, GICD_ISPENDRN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
-        printk(XENLOG_G_ERR
-               "%pv: %s: unhandled word write %#"PRIregister" to ISPENDR%d\n",
-               v, name, r, reg - GICD_ISPENDR);
-        return 0;
+        rank = vgic_rank_offset(v, 1, reg - GICD_ISPENDR, DABT_WORD);
+        if ( rank == NULL ) goto write_ignore;
+
+        vgic_set_irqs_pending(v, r, rank->index);
+
+        return 1;
 
     case VRANGE32(GICD_ICPENDR, GICD_ICPENDRN):
         if ( dabt.size != DABT_WORD ) goto bad_width;
@@ -975,6 +977,7 @@ static int vgic_v3_rdistr_sgi_mmio_write(struct vcpu *v, mmio_info_t *info,
     case VREG32(GICR_ICACTIVER0):
     case VREG32(GICR_ICFGR1):
     case VRANGE32(GICR_IPRIORITYR0, GICR_IPRIORITYR7):
+    case VREG32(GICR_ISPENDR0):
          /*
           * Above registers offset are common with GICD.
           * So handle common with GICD handling
@@ -982,13 +985,6 @@ static int vgic_v3_rdistr_sgi_mmio_write(struct vcpu *v, mmio_info_t *info,
         return __vgic_v3_distr_common_mmio_write("vGICR: SGI", v,
                                                  info, gicr_reg, r);
 
-    case VREG32(GICR_ISPENDR0):
-        if ( dabt.size != DABT_WORD ) goto bad_width;
-        printk(XENLOG_G_ERR
-               "%pv: vGICR: SGI: unhandled word write %#"PRIregister" to ISPENDR0\n",
-               v, r);
-        return 0;
-
     case VREG32(GICR_ICPENDR0):
         if ( dabt.size != DABT_WORD ) goto bad_width;
         printk(XENLOG_G_ERR
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 82f524a35c..8f9400a519 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -423,6 +423,53 @@ void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n)
     }
 }
 
+void vgic_set_irqs_pending(struct vcpu *v, uint32_t r, unsigned int rank)
+{
+    const unsigned long mask = r;
+    unsigned int i;
+    /* The first rank is always per-vCPU */
+    bool private = rank == 0;
+
+    /* LPIs will never be set pending via this function */
+    ASSERT(!is_lpi(32 * rank + 31));
+
+    for_each_set_bit( i, &mask, 32 )
+    {
+        unsigned int irq = i + 32 * rank;
+
+        if ( !private )
+        {
+            struct pending_irq *p = spi_to_pending(v->domain, irq);
+
+            /*
+             * When the domain sets the pending state for a HW interrupt on
+             * the virtual distributor, we set the pending state on the
+             * physical distributor.
+             *
+             * XXX: Investigate whether we would be able to set the
+             * physical interrupt active and save an interruption. (This
+             * is what the new vGIC does).
+             */
+            if ( p->desc != NULL )
+            {
+                unsigned long flags;
+
+                spin_lock_irqsave(&p->desc->lock, flags);
+                gic_set_pending_state(p->desc, true);
+                spin_unlock_irqrestore(&p->desc->lock, flags);
+                continue;
+            }
+        }
+
+        /*
+         * If the interrupt is per-vCPU, then we want to inject the vIRQ
+         * to v, otherwise we should let the function figuring out the
+         * correct vCPU.
+         */
+        vgic_inject_irq(v->domain, private ? v : NULL, irq, true);
+    }
+}
+
 bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode,
                  int virq, const struct sgi_target *target)
 {
diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h
index ce1e3c4bbd..62c2ae538d 100644
--- a/xen/include/asm-arm/vgic.h
+++ b/xen/include/asm-arm/vgic.h
@@ -288,6 +288,8 @@ extern struct vgic_irq_rank *vgic_rank_offset(struct vcpu *v, int b, int n, int
 extern struct vgic_irq_rank *vgic_rank_irq(struct vcpu *v, unsigned int irq);
 extern void vgic_disable_irqs(struct vcpu *v, uint32_t r, int n);
 extern void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n);
+extern void vgic_set_irqs_pending(struct vcpu *v, uint32_t r,
+                                  unsigned int rank);
 extern void register_vgic_ops(struct domain *d, const struct vgic_ops *ops);
 int vgic_v2_init(struct domain *d, int *mmio_count);
 int vgic_v3_init(struct domain *d, int *mmio_count);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:14:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:14:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90507.171405 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgh7-00064H-HA; Fri, 26 Feb 2021 17:14:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90507.171405; Fri, 26 Feb 2021 17:14:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgh7-000649-EL; Fri, 26 Feb 2021 17:14:25 +0000
Received: by outflank-mailman (input) for mailman id 90507;
 Fri, 26 Feb 2021 17:14:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgh6-00063z-FX
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:14:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgh6-0008Px-Et
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:14:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgh6-0003H3-EG
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:14:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oSN1BdEQKWr8IsUuwiNtezJTwjA9M3XOA5XM+aeGqLs=; b=rzm2NW6kKdZZGoc1ivllRARUJk
	HFxWoYhk5bB+S0m8Qp2VQqq9Od4zPpmwLN7jUGjCn9eMxhrCu1TPvrImx7NrItATxaaoqj0SXrXe1
	sQBoBkv0YYSGteH/sUt+RVvSLvSo4r1xJGLR5QMGL6I2wGLSMf/cvMtsG7dAmRwsPB20=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: mirror compat argument translation area for 32-bit PV
Message-Id: <E1lFgh6-0003H3-EG@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:14:24 +0000

commit cda16c1bb223bfaa83022d97d87da7909d604896
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 25 15:10:47 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 25 15:10:47 2021 +0100

    x86: mirror compat argument translation area for 32-bit PV
    
    Now that we guard the entire Xen VA space against speculative abuse
    through hypervisor accesses to guest memory, the argument translation
    area's VA also needs to live outside this range, at least for 32-bit PV
    guests. To avoid extra is_hvm_*() conditionals, use the alternative VA
    uniformly.
    
    While this could be conditionalized upon CONFIG_PV32 &&
    CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS, omitting such extra conditionals
    keeps the code more legible imo.
    
    Fixes: 4dc181599142 ("x86/PV: harden guest memory accesses against speculative abuse")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/mm.c                    |  7 +++++++
 xen/include/asm-x86/config.h         |  8 +++++++-
 xen/include/asm-x86/x86_64/uaccess.h | 12 +++++++++++-
 3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 4366ea34d1..afb4febf6f 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -1691,6 +1691,13 @@ void init_xen_l4_slots(l4_pgentry_t *l4t, mfn_t l4mfn,
     l4t[l4_table_offset(PERDOMAIN_VIRT_START)] =
         l4e_from_page(d->arch.perdomain_l3_pg, __PAGE_HYPERVISOR_RW);
 
+    /* Slot 4: Per-domain mappings mirror. */
+    BUILD_BUG_ON(IS_ENABLED(CONFIG_PV32) &&
+                 !l4_table_offset(PERDOMAIN_ALT_VIRT_START));
+    if ( !is_pv_64bit_domain(d) )
+        l4t[l4_table_offset(PERDOMAIN_ALT_VIRT_START)] =
+            l4t[l4_table_offset(PERDOMAIN_VIRT_START)];
+
     /* Slot 261-: text/data/bss, RW M2P, vmap, frametable, directmap. */
 #ifndef NDEBUG
     if ( short_directmap &&
diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h
index 74406f0239..883c2ef0df 100644
--- a/xen/include/asm-x86/config.h
+++ b/xen/include/asm-x86/config.h
@@ -170,7 +170,11 @@ extern unsigned char boot_edid_info[128];
  *    Guest-defined use.
  *  0x00000000f5800000 - 0x00000000ffffffff [168MB,             PML4:0]
  *    Read-only machine-to-phys translation table (GUEST ACCESSIBLE).
- *  0x0000000100000000 - 0x00007fffffffffff [128TB-4GB,         PML4:0-255]
+ *  0x0000000100000000 - 0x000001ffffffffff [2TB-4GB,           PML4:0-3]
+ *    Unused / Reserved for future use.
+ *  0x0000020000000000 - 0x0000027fffffffff [512GB, 2^39 bytes, PML4:4]
+ *    Mirror of per-domain mappings (for argument translation area; also HVM).
+ *  0x0000028000000000 - 0x00007fffffffffff [125.5TB,           PML4:5-255]
  *    Unused / Reserved for future use.
  */
 
@@ -207,6 +211,8 @@ extern unsigned char boot_edid_info[128];
 #define PERDOMAIN_SLOTS         3
 #define PERDOMAIN_VIRT_SLOT(s)  (PERDOMAIN_VIRT_START + (s) * \
                                  (PERDOMAIN_SLOT_MBYTES << 20))
+/* Slot 4: mirror of per-domain mappings (for compat xlat area accesses). */
+#define PERDOMAIN_ALT_VIRT_START PML4_ADDR(4)
 /* Slot 261: machine-to-phys conversion table (256GB). */
 #define RDWR_MPT_VIRT_START     (PML4_ADDR(261))
 #define RDWR_MPT_VIRT_END       (RDWR_MPT_VIRT_START + MPT_VIRT_SIZE)
diff --git a/xen/include/asm-x86/x86_64/uaccess.h b/xen/include/asm-x86/x86_64/uaccess.h
index c48e57bf09..ba79f950fb 100644
--- a/xen/include/asm-x86/x86_64/uaccess.h
+++ b/xen/include/asm-x86/x86_64/uaccess.h
@@ -1,7 +1,17 @@
 #ifndef __X86_64_UACCESS_H
 #define __X86_64_UACCESS_H
 
-#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current))
+/*
+ * With CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS (apparent) PV guest accesses
+ * are prohibited to touch the Xen private VA range.  The compat argument
+ * translation area, therefore, can't live within this range.  Domains
+ * (potentially) in need of argument translation (32-bit PV, possibly HVM) get
+ * a secondary mapping installed, which needs to be used for such accesses in
+ * the PV case, and will also be used for HVM to avoid extra conditionals.
+ */
+#define COMPAT_ARG_XLAT_VIRT_BASE ((void *)ARG_XLAT_START(current) + \
+                                   (PERDOMAIN_ALT_VIRT_START - \
+                                    PERDOMAIN_VIRT_START))
 #define COMPAT_ARG_XLAT_SIZE      (2*PAGE_SIZE)
 struct vcpu;
 int setup_compat_arg_xlat(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:14:35 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:14:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90508.171409 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFghH-00065W-Im; Fri, 26 Feb 2021 17:14:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90508.171409; Fri, 26 Feb 2021 17:14:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFghH-00065O-Fr; Fri, 26 Feb 2021 17:14:35 +0000
Received: by outflank-mailman (input) for mailman id 90508;
 Fri, 26 Feb 2021 17:14:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFghG-00065G-IS
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:14:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFghG-0008Q0-Hl
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:14:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFghG-0003Ht-H3
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:14:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kJkMd4EGqFzlgtlYQ0Il24BSIDl4tzGf5jdmmhakVyo=; b=VKHmevpjiujBP40YdloAdxY/9K
	O94HQx31UOPeuKKP5nldTCZqqBUmbEIPPnNKiMSyXj4IYewDxlaTmXfO7QVWFFsLPKKHShUnS88km
	FMIw9o0aymlv7W9SGtf9kGMay9gyTfSFH3qa6jtQQ8ABYgdQngaSeghx13hlKXvEycyI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/EFI: suppress GNU ld 2.36'es creation of base relocs
Message-Id: <E1lFghG-0003Ht-H3@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:14:34 +0000

commit 76cbb9c3f4dd9ab6aa44eeacab84fb88b2e8bfc1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 25 15:11:58 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 25 15:11:58 2021 +0100

    x86/EFI: suppress GNU ld 2.36'es creation of base relocs
    
    All of the sudden ld creates base relocations itself, for PE
    executables - as a result we now have two of them for every entity to
    be relocated. While we will likely want to use this down the road, it
    doesn't work quite right yet in corner cases, so rather than suppressing
    our own way of creating the relocations we need to tell ld to avoid
    doing so.
    
    Probe whether --disable-reloc-section (which was introduced by the same
    commit making relocation generation the default) is recognized by ld's PE
    emulation, and use the option if so. (To limit redundancy, move the first
    part of setting EFI_LDFLAGS earlier, and use it already while probing.)
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/Makefile | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index dff597f30c..b6567c4127 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -123,8 +123,13 @@ ifneq ($(efi-y),)
 # Check if the compiler supports the MS ABI.
 export XEN_BUILD_EFI := $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o efi/check.o 2>/dev/null && echo y)
 # Check if the linker supports PE.
-XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) -mi386pep --subsystem=10 -S -o efi/check.efi efi/check.o 2>/dev/null && echo y))
+EFI_LDFLAGS = $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=10 --strip-debug
+XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) $(EFI_LDFLAGS) -o efi/check.efi efi/check.o 2>/dev/null && echo y))
 CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
+# Check if the linker produces fixups in PE by default (we need to disable it doing so for now).
+XEN_NO_PE_FIXUPS := $(if $(XEN_BUILD_EFI), \
+                         $(shell $(LD) $(EFI_LDFLAGS) --disable-reloc-section -o efi/check.efi efi/check.o 2>/dev/null && \
+                                 echo --disable-reloc-section))
 endif
 
 ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS)
@@ -177,8 +182,7 @@ note.o: $(TARGET)-syms
 		--rename-section=.data=.note.gnu.build-id -S $@.bin $@
 	rm -f $@.bin
 
-EFI_LDFLAGS = $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=10
-EFI_LDFLAGS += --image-base=$(1) --stack=0,0 --heap=0,0 --strip-debug
+EFI_LDFLAGS += --image-base=$(1) --stack=0,0 --heap=0,0 $(XEN_NO_PE_FIXUPS)
 EFI_LDFLAGS += --section-alignment=0x200000 --file-alignment=0x20
 EFI_LDFLAGS += --major-image-version=$(XEN_VERSION)
 EFI_LDFLAGS += --minor-image-version=$(XEN_SUBVERSION)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:14:45 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:14:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90509.171413 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFghR-00066t-LD; Fri, 26 Feb 2021 17:14:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90509.171413; Fri, 26 Feb 2021 17:14:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFghR-00066l-HN; Fri, 26 Feb 2021 17:14:45 +0000
Received: by outflank-mailman (input) for mailman id 90509;
 Fri, 26 Feb 2021 17:14:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFghQ-00066e-Lf
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:14:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFghQ-0008QW-Kr
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:14:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFghQ-0003Ik-K7
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:14:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rnbKeXKUJUBjw001A3qEjVde+L59nj6Fhvz7x7XNpSk=; b=boFKkHtcAC7xAK5Sz4WV8+PxFZ
	A2dQbf9BNogKDW1D3/2H0C3s4VXfHQncVH3aI9+pUajd4oliqIJk1X/wtKdfynqqcodUpbKwuhcRG
	i5AV9EwCAAph4QV2o5RMQAP+EZOPrITu5NHyArhsja42VoHv+dskKAy2Fyr8XXZI6M6A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: rename {get,put}_user() to {get,put}_guest()
Message-Id: <E1lFghQ-0003Ik-K7@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:14:44 +0000

commit a70f4935b4ff4b3b46ae4ec7645717777271062b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 25 15:36:10 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 25 15:36:10 2021 +0100

    x86: rename {get,put}_user() to {get,put}_guest()
    
    Bring them (back) in line with __{get,put}_guest().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/domain.c         | 40 ++++++++++++++++++++--------------------
 xen/include/asm-x86/uaccess.h | 33 ++++++++++++++-------------------
 2 files changed, 34 insertions(+), 39 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 6c7ee25f3b..97fd9456c2 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1649,19 +1649,19 @@ static void load_segments(struct vcpu *n)
 
             if ( !ring_1(regs) )
             {
-                ret  = put_user(regs->ss,       esp-1);
-                ret |= put_user(regs->esp,      esp-2);
+                ret  = put_guest(regs->ss,  esp - 1);
+                ret |= put_guest(regs->esp, esp - 2);
                 esp -= 2;
             }
 
             if ( ret |
-                 put_user(rflags,              esp-1) |
-                 put_user(cs_and_mask,         esp-2) |
-                 put_user(regs->eip,           esp-3) |
-                 put_user(uregs->gs,           esp-4) |
-                 put_user(uregs->fs,           esp-5) |
-                 put_user(uregs->es,           esp-6) |
-                 put_user(uregs->ds,           esp-7) )
+                 put_guest(rflags,      esp - 1) |
+                 put_guest(cs_and_mask, esp - 2) |
+                 put_guest(regs->eip,   esp - 3) |
+                 put_guest(uregs->gs,   esp - 4) |
+                 put_guest(uregs->fs,   esp - 5) |
+                 put_guest(uregs->es,   esp - 6) |
+                 put_guest(uregs->ds,   esp - 7) )
             {
                 gprintk(XENLOG_ERR,
                         "error while creating compat failsafe callback frame\n");
@@ -1690,17 +1690,17 @@ static void load_segments(struct vcpu *n)
         cs_and_mask = (unsigned long)regs->cs |
             ((unsigned long)vcpu_info(n, evtchn_upcall_mask) << 32);
 
-        if ( put_user(regs->ss,            rsp- 1) |
-             put_user(regs->rsp,           rsp- 2) |
-             put_user(rflags,              rsp- 3) |
-             put_user(cs_and_mask,         rsp- 4) |
-             put_user(regs->rip,           rsp- 5) |
-             put_user(uregs->gs,           rsp- 6) |
-             put_user(uregs->fs,           rsp- 7) |
-             put_user(uregs->es,           rsp- 8) |
-             put_user(uregs->ds,           rsp- 9) |
-             put_user(regs->r11,           rsp-10) |
-             put_user(regs->rcx,           rsp-11) )
+        if ( put_guest(regs->ss,    rsp -  1) |
+             put_guest(regs->rsp,   rsp -  2) |
+             put_guest(rflags,      rsp -  3) |
+             put_guest(cs_and_mask, rsp -  4) |
+             put_guest(regs->rip,   rsp -  5) |
+             put_guest(uregs->gs,   rsp -  6) |
+             put_guest(uregs->fs,   rsp -  7) |
+             put_guest(uregs->es,   rsp -  8) |
+             put_guest(uregs->ds,   rsp -  9) |
+             put_guest(regs->r11,   rsp - 10) |
+             put_guest(regs->rcx,   rsp - 11) )
         {
             gprintk(XENLOG_ERR,
                     "error while creating failsafe callback frame\n");
diff --git a/xen/include/asm-x86/uaccess.h b/xen/include/asm-x86/uaccess.h
index f55c2f8729..4a375450c3 100644
--- a/xen/include/asm-x86/uaccess.h
+++ b/xen/include/asm-x86/uaccess.h
@@ -26,14 +26,12 @@ extern void __put_user_bad(void);
 #define UA_DROP(args...)
 
 /**
- * get_user: - Get a simple variable from user space.
+ * get_guest: - Get a simple variable from guest space.
  * @x:   Variable to store result.
- * @ptr: Source address, in user space.
- *
- * Context: User context only.  This function may sleep.
+ * @ptr: Source address, in guest space.
  *
- * This macro copies a single simple variable from user space to kernel
- * space.  It supports simple types like char and int, but not larger
+ * This macro load a single simple variable from guest space.
+ * It supports simple types like char and int, but not larger
  * data types like structures or arrays.
  *
  * @ptr must have pointer-to-simple-variable type, and the result of
@@ -42,18 +40,15 @@ extern void __put_user_bad(void);
  * Returns zero on success, or -EFAULT on error.
  * On error, the variable @x is set to zero.
  */
-#define get_user(x,ptr)	\
-  __get_user_check((x),(ptr),sizeof(*(ptr)))
+#define get_guest(x, ptr) get_guest_check(x, ptr, sizeof(*(ptr)))
 
 /**
- * put_user: - Write a simple value into user space.
- * @x:   Value to copy to user space.
- * @ptr: Destination address, in user space.
- *
- * Context: User context only.  This function may sleep.
+ * put_guest: - Write a simple value into guest space.
+ * @x:   Value to store in guest space.
+ * @ptr: Destination address, in guest space.
  *
- * This macro copies a single simple value from kernel space to user
- * space.  It supports simple types like char and int, but not larger
+ * This macro stores a single simple value from to guest space.
+ * It supports simple types like char and int, but not larger
  * data types like structures or arrays.
  *
  * @ptr must have pointer-to-simple-variable type, and @x must be assignable
@@ -61,8 +56,8 @@ extern void __put_user_bad(void);
  *
  * Returns zero on success, or -EFAULT on error.
  */
-#define put_user(x,ptr)							\
-  __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
+#define put_guest(x, ptr) \
+    put_guest_check((__typeof__(*(ptr)))(x), ptr, sizeof(*(ptr)))
 
 /**
  * __get_guest: - Get a simple variable from guest space, with less checking.
@@ -118,7 +113,7 @@ extern void __put_user_bad(void);
 	err_;								\
 })
 
-#define __put_user_check(x, ptr, size)					\
+#define put_guest_check(x, ptr, size)					\
 ({									\
 	__typeof__(*(ptr)) __user *ptr_ = (ptr);			\
 	__typeof__(size) size_ = (size);				\
@@ -140,7 +135,7 @@ extern void __put_user_bad(void);
 	err_;								\
 })
 
-#define __get_user_check(x, ptr, size)					\
+#define get_guest_check(x, ptr, size)					\
 ({									\
 	__typeof__(*(ptr)) __user *ptr_ = (ptr);			\
 	__typeof__(size) size_ = (size);				\
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:14:55 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:14:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90510.171417 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFghb-00068c-NY; Fri, 26 Feb 2021 17:14:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90510.171417; Fri, 26 Feb 2021 17:14:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFghb-00068U-KR; Fri, 26 Feb 2021 17:14:55 +0000
Received: by outflank-mailman (input) for mailman id 90510;
 Fri, 26 Feb 2021 17:14:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgha-00068N-Oe
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:14:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgha-0008Qf-Nx
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:14:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgha-0003JN-ND
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:14:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zePtX/rXM8fYiz4+mjnrcDO/DprD5uV9CRRfmG0X1e0=; b=GicfLyhiU+POZVAgxH0rxFB8HX
	amyKaaQOtel29AW8lgr8CWZQIVX6X2mfaYaNF7w8Z9uHh6v9H1BeUnQZdKqHXYXUIAZ0pByqm6J/E
	dg0s45NrDTuAY0GWlZN7skb9q85nZgJ83SOFQC/3Ld0Cqr5YwZavMokzp18qSyrQ5fEI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/gdbsx: convert "user" to "guest" accesses
Message-Id: <E1lFgha-0003JN-ND@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:14:54 +0000

commit ef20ffd13d76c9be6f14c01296d44fc1a9e055f8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 25 15:36:54 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 25 15:36:54 2021 +0100

    x86/gdbsx: convert "user" to "guest" accesses
    
    Using copy_{from,to}_user(), this code was assuming to be called only by
    PV guests. Use copy_{from,to}_guest() instead, transforming the incoming
    structure field into a guest handle (the field should really have been
    one in the first place). Also do not transform the debuggee address into
    a pointer.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/debug.c           | 21 +++++++++------------
 xen/arch/x86/domctl.c          |  6 ++----
 xen/include/asm-x86/debugger.h |  2 +-
 3 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/debug.c b/xen/arch/x86/debug.c
index f32d4b0bcc..d90dc93056 100644
--- a/xen/arch/x86/debug.c
+++ b/xen/arch/x86/debug.c
@@ -108,12 +108,11 @@ dbg_pv_va2mfn(dbgva_t vaddr, struct domain *dp, uint64_t pgd3val)
 }
 
 /* Returns: number of bytes remaining to be copied */
-static unsigned int dbg_rw_guest_mem(struct domain *dp, void * __user gaddr,
-                                     void * __user buf, unsigned int len,
-                                     bool toaddr, uint64_t pgd3)
+static unsigned int dbg_rw_guest_mem(struct domain *dp, unsigned long addr,
+                                     XEN_GUEST_HANDLE_PARAM(void) buf,
+                                     unsigned int len, bool toaddr,
+                                     uint64_t pgd3)
 {
-    unsigned long addr = (unsigned long)gaddr;
-
     while ( len > 0 )
     {
         char *va;
@@ -134,20 +133,18 @@ static unsigned int dbg_rw_guest_mem(struct domain *dp, void * __user gaddr,
 
         if ( toaddr )
         {
-            copy_from_user(va, buf, pagecnt);    /* va = buf */
+            copy_from_guest(va, buf, pagecnt);
             paging_mark_dirty(dp, mfn);
         }
         else
-        {
-            copy_to_user(buf, va, pagecnt);    /* buf = va */
-        }
+            copy_to_guest(buf, va, pagecnt);
 
         unmap_domain_page(va);
         if ( !gfn_eq(gfn, INVALID_GFN) )
             put_gfn(dp, gfn_x(gfn));
 
         addr += pagecnt;
-        buf += pagecnt;
+        guest_handle_add_offset(buf, pagecnt);
         len -= pagecnt;
     }
 
@@ -161,7 +158,7 @@ static unsigned int dbg_rw_guest_mem(struct domain *dp, void * __user gaddr,
  * pgd3: value of init_mm.pgd[3] in guest. see above.
  * Returns: number of bytes remaining to be copied.
  */
-unsigned int dbg_rw_mem(void * __user addr, void * __user buf,
+unsigned int dbg_rw_mem(unsigned long gva, XEN_GUEST_HANDLE_PARAM(void) buf,
                         unsigned int len, domid_t domid, bool toaddr,
                         uint64_t pgd3)
 {
@@ -170,7 +167,7 @@ unsigned int dbg_rw_mem(void * __user addr, void * __user buf,
     if ( d )
     {
         if ( !d->is_dying )
-            len = dbg_rw_guest_mem(d, addr, buf, len, toaddr, pgd3);
+            len = dbg_rw_guest_mem(d, gva, buf, len, toaddr, pgd3);
         rcu_unlock_domain(d);
     }
 
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index b464465230..b129d2cc2f 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -40,10 +40,8 @@
 #ifdef CONFIG_GDBSX
 static int gdbsx_guest_mem_io(domid_t domid, struct xen_domctl_gdbsx_memio *iop)
 {
-    void * __user gva = (void *)iop->gva, * __user uva = (void *)iop->uva;
-
-    iop->remain = dbg_rw_mem(gva, uva, iop->len, domid,
-                             !!iop->gwr, iop->pgd3val);
+    iop->remain = dbg_rw_mem(iop->gva, guest_handle_from_ptr(iop->uva, void),
+                             iop->len, domid, iop->gwr, iop->pgd3val);
 
     return iop->remain ? -EFAULT : 0;
 }
diff --git a/xen/include/asm-x86/debugger.h b/xen/include/asm-x86/debugger.h
index a9ddb01433..99803bfd0c 100644
--- a/xen/include/asm-x86/debugger.h
+++ b/xen/include/asm-x86/debugger.h
@@ -93,7 +93,7 @@ static inline bool debugger_trap_entry(
 #endif
 
 #ifdef CONFIG_GDBSX
-unsigned int dbg_rw_mem(void * __user addr, void * __user buf,
+unsigned int dbg_rw_mem(unsigned long gva, XEN_GUEST_HANDLE_PARAM(void) buf,
                         unsigned int len, domid_t domid, bool toaddr,
                         uint64_t pgd3);
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:15:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:15:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90511.171421 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFghl-00069z-P9; Fri, 26 Feb 2021 17:15:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90511.171421; Fri, 26 Feb 2021 17:15:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFghl-00069q-M0; Fri, 26 Feb 2021 17:15:05 +0000
Received: by outflank-mailman (input) for mailman id 90511;
 Fri, 26 Feb 2021 17:15:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFghk-00069i-S7
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:15:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFghk-0008RD-RQ
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:15:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFghk-0003KS-Qe
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:15:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pzd16MSGrZI/Pc4RzkfNRw1PBnP3r35svuzZH2LxxOc=; b=uV+54el8jTaY3JuHUv0ZrtQnix
	QV9xnDicYujIv5oCeo07HdyBJ86/kPia0JBX/EE2W/V8glXxsycVJW1KiVva2NVVF5wdjGeVX1QOj
	/kJ7++ClzTxv5+zU32wVXi6K9AHcFQ3U4ir8T9Pw1jEFQe6eGoR4YGXCN4iVVZDerM+U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: rename copy_{from,to}_user() to copy_{from,to}_guest_pv()
Message-Id: <E1lFghk-0003KS-Qe@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:15:04 +0000

commit d700690a3bf3115d36d055489a0360fd33416e96
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 25 15:37:35 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 25 15:37:35 2021 +0100

    x86: rename copy_{from,to}_user() to copy_{from,to}_guest_pv()
    
    Bring them (back) in line with __copy_{from,to}_guest_pv(). Since it
    falls in the same group, also convert clear_user(). Instead of adjusting
    __raw_clear_guest(), drop it - it's unused and would require a non-
    checking __clear_guest_pv() which we don't have.
    
    Add previously missing __user at some call sites and in the function
    declarations.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/pv/emul-inv-op.c      |  5 +++--
 xen/arch/x86/pv/iret.c             |  4 ++--
 xen/arch/x86/pv/ro-page-fault.c    |  3 ++-
 xen/arch/x86/usercopy.c            | 33 +++++++++++++++------------------
 xen/include/asm-x86/guest_access.h | 10 +++-------
 xen/include/asm-x86/uaccess.h      |  8 +++++---
 6 files changed, 30 insertions(+), 33 deletions(-)

diff --git a/xen/arch/x86/pv/emul-inv-op.c b/xen/arch/x86/pv/emul-inv-op.c
index 59e3edc8c4..b15f302bca 100644
--- a/xen/arch/x86/pv/emul-inv-op.c
+++ b/xen/arch/x86/pv/emul-inv-op.c
@@ -33,7 +33,7 @@ static int emulate_forced_invalid_op(struct cpu_user_regs *regs)
     eip = regs->rip;
 
     /* Check for forced emulation signature: ud2 ; .ascii "xen". */
-    if ( (rc = copy_from_user(sig, (char *)eip, sizeof(sig))) != 0 )
+    if ( (rc = copy_from_guest_pv(sig, (char __user *)eip, sizeof(sig))) != 0 )
     {
         pv_inject_page_fault(0, eip + sizeof(sig) - rc);
         return EXCRET_fault_fixed;
@@ -43,7 +43,8 @@ static int emulate_forced_invalid_op(struct cpu_user_regs *regs)
     eip += sizeof(sig);
 
     /* We only emulate CPUID. */
-    if ( ( rc = copy_from_user(instr, (char *)eip, sizeof(instr))) != 0 )
+    if ( (rc = copy_from_guest_pv(instr, (char __user *)eip,
+                                  sizeof(instr))) != 0 )
     {
         pv_inject_page_fault(0, eip + sizeof(instr) - rc);
         return EXCRET_fault_fixed;
diff --git a/xen/arch/x86/pv/iret.c b/xen/arch/x86/pv/iret.c
index 39b18b04f3..b508dc17b7 100644
--- a/xen/arch/x86/pv/iret.c
+++ b/xen/arch/x86/pv/iret.c
@@ -54,8 +54,8 @@ unsigned long do_iret(void)
     struct iret_context iret_saved;
     struct vcpu *v = current;
 
-    if ( unlikely(copy_from_user(&iret_saved, (void *)regs->rsp,
-                                 sizeof(iret_saved))) )
+    if ( unlikely(copy_from_guest_pv(&iret_saved, (void __user *)regs->rsp,
+                                     sizeof(iret_saved))) )
     {
         gprintk(XENLOG_ERR,
                 "Fault while reading IRET context from guest stack\n");
diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c
index 5d2dd9fae0..335aa8dc5d 100644
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -90,7 +90,8 @@ static int ptwr_emulated_update(unsigned long addr, intpte_t *p_old,
 
         /* Align address; read full word. */
         addr &= ~(sizeof(full) - 1);
-        if ( (rc = copy_from_user(&full, (void *)addr, sizeof(full))) != 0 )
+        if ( (rc = copy_from_guest_pv(&full, (void __user *)addr,
+                                      sizeof(full))) != 0 )
         {
             x86_emul_pagefault(0, /* Read fault. */
                                addr + sizeof(full) - rc,
diff --git a/xen/arch/x86/usercopy.c b/xen/arch/x86/usercopy.c
index b17d680dde..b8c2d1cc0b 100644
--- a/xen/arch/x86/usercopy.c
+++ b/xen/arch/x86/usercopy.c
@@ -109,19 +109,17 @@ unsigned int copy_from_guest_ll(void *to, const void __user *from, unsigned int
 #if GUARD(1) + 0
 
 /**
- * copy_to_user: - Copy a block of data into user space.
- * @to:   Destination address, in user space.
- * @from: Source address, in kernel space.
+ * copy_to_guest_pv: - Copy a block of data into PV guest space.
+ * @to:   Destination address, in PV guest space.
+ * @from: Source address, in hypervisor space.
  * @n:    Number of bytes to copy.
  *
- * Context: User context only.  This function may sleep.
- *
- * Copy data from kernel space to user space.
+ * Copy data from hypervisor space to PV guest space.
  *
  * Returns number of bytes that could not be copied.
  * On success, this will be zero.
  */
-unsigned copy_to_user(void __user *to, const void *from, unsigned n)
+unsigned int copy_to_guest_pv(void __user *to, const void *from, unsigned int n)
 {
     if ( access_ok(to, n) )
         n = __copy_to_guest_pv(to, from, n);
@@ -129,16 +127,16 @@ unsigned copy_to_user(void __user *to, const void *from, unsigned n)
 }
 
 /**
- * clear_user: - Zero a block of memory in user space.
- * @to:   Destination address, in user space.
+ * clear_guest_pv: - Zero a block of memory in PV guest space.
+ * @to:   Destination address, in PV guest space.
  * @n:    Number of bytes to zero.
  *
- * Zero a block of memory in user space.
+ * Zero a block of memory in PV guest space.
  *
  * Returns number of bytes that could not be cleared.
  * On success, this will be zero.
  */
-unsigned clear_user(void __user *to, unsigned n)
+unsigned int clear_guest_pv(void __user *to, unsigned int n)
 {
     if ( access_ok(to, n) )
     {
@@ -168,14 +166,12 @@ unsigned clear_user(void __user *to, unsigned n)
 }
 
 /**
- * copy_from_user: - Copy a block of data from user space.
- * @to:   Destination address, in kernel space.
- * @from: Source address, in user space.
+ * copy_from_guest_pv: - Copy a block of data from PV guest space.
+ * @to:   Destination address, in hypervisor space.
+ * @from: Source address, in PV guest space.
  * @n:    Number of bytes to copy.
  *
- * Context: User context only.  This function may sleep.
- *
- * Copy data from user space to kernel space.
+ * Copy data from PV guest space to hypervisor space.
  *
  * Returns number of bytes that could not be copied.
  * On success, this will be zero.
@@ -183,7 +179,8 @@ unsigned clear_user(void __user *to, unsigned n)
  * If some data could not be copied, this function will pad the copied
  * data to the requested size using zero bytes.
  */
-unsigned copy_from_user(void *to, const void __user *from, unsigned n)
+unsigned int copy_from_guest_pv(void *to, const void __user *from,
+                                unsigned int n)
 {
     if ( access_ok(from, n) )
         n = __copy_from_guest_pv(to, from, n);
diff --git a/xen/include/asm-x86/guest_access.h b/xen/include/asm-x86/guest_access.h
index 45e28f3220..dbf789fa58 100644
--- a/xen/include/asm-x86/guest_access.h
+++ b/xen/include/asm-x86/guest_access.h
@@ -16,15 +16,15 @@
 #define raw_copy_to_guest(dst, src, len)        \
     (is_hvm_vcpu(current) ?                     \
      copy_to_user_hvm((dst), (src), (len)) :    \
-     copy_to_user((dst), (src), (len)))
+     copy_to_guest_pv(dst, src, len))
 #define raw_copy_from_guest(dst, src, len)      \
     (is_hvm_vcpu(current) ?                     \
      copy_from_user_hvm((dst), (src), (len)) :  \
-     copy_from_user((dst), (src), (len)))
+     copy_from_guest_pv(dst, src, len))
 #define raw_clear_guest(dst,  len)              \
     (is_hvm_vcpu(current) ?                     \
      clear_user_hvm((dst), (len)) :             \
-     clear_user((dst), (len)))
+     clear_guest_pv(dst, len))
 #define __raw_copy_to_guest(dst, src, len)      \
     (is_hvm_vcpu(current) ?                     \
      copy_to_user_hvm((dst), (src), (len)) :    \
@@ -33,10 +33,6 @@
     (is_hvm_vcpu(current) ?                     \
      copy_from_user_hvm((dst), (src), (len)) :  \
      __copy_from_guest_pv(dst, src, len))
-#define __raw_clear_guest(dst,  len)            \
-    (is_hvm_vcpu(current) ?                     \
-     clear_user_hvm((dst), (len)) :             \
-     clear_user((dst), (len)))
 
 /*
  * Pre-validate a guest handle.
diff --git a/xen/include/asm-x86/uaccess.h b/xen/include/asm-x86/uaccess.h
index 4a375450c3..4ca9bfc478 100644
--- a/xen/include/asm-x86/uaccess.h
+++ b/xen/include/asm-x86/uaccess.h
@@ -9,9 +9,11 @@
 
 #include <asm/x86_64/uaccess.h>
 
-unsigned copy_to_user(void *to, const void *from, unsigned len);
-unsigned clear_user(void *to, unsigned len);
-unsigned copy_from_user(void *to, const void *from, unsigned len);
+unsigned int copy_to_guest_pv(void __user *to, const void *from,
+                              unsigned int len);
+unsigned int clear_guest_pv(void __user *to, unsigned int len);
+unsigned int copy_from_guest_pv(void *to, const void __user *from,
+                                unsigned int len);
 
 /* Handles exceptions in both to and from, but doesn't do access_ok */
 unsigned int copy_to_guest_ll(void __user*to, const void *from, unsigned int n);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:15:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:15:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90512.171425 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFghw-0006BI-QW; Fri, 26 Feb 2021 17:15:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90512.171425; Fri, 26 Feb 2021 17:15:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFghw-0006BA-NY; Fri, 26 Feb 2021 17:15:16 +0000
Received: by outflank-mailman (input) for mailman id 90512;
 Fri, 26 Feb 2021 17:15:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFghu-0006Ay-VS
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:15:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFghu-0008RL-Uj
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:15:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFghu-0003L7-Tz
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:15:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7+RUUri+WiaOuLC+8LVUOx+ugxATAhUC1SsCIUGFw8E=; b=M781fwFaN6RYf9P7SRLii69Y60
	Xxxf7R1/awI8wcaOPbXaYVMq7TFEZ8Ln/FSUGWMjU/MXveWsK6gjMiosCLrK0GpB7YlKvzM/tlrS6
	elhCbeHUh8y4kBMjyKZWFoXiN7WGyO7Xd2xtOzlE5nviLGCoRtpH7I1b15DRHQsh/Rag=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: move stac()/clac() from {get,put}_unsafe_asm() ...
Message-Id: <E1lFghu-0003L7-Tz@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:15:14 +0000

commit e0d42bdbbde39522c5730730f18722e5452b700c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 25 15:38:35 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 25 15:38:35 2021 +0100

    x86: move stac()/clac() from {get,put}_unsafe_asm() ...
    
    ... to {get,put}_unsafe_size(). There's no need to have the macros
    expanded once per case label in the latter. This also makes the former
    well-formed single statements again. No change in generated code.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/include/asm-x86/uaccess.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/include/asm-x86/uaccess.h b/xen/include/asm-x86/uaccess.h
index 4ca9bfc478..684fccd95c 100644
--- a/xen/include/asm-x86/uaccess.h
+++ b/xen/include/asm-x86/uaccess.h
@@ -154,7 +154,6 @@ struct __large_struct { unsigned long buf[100]; };
  * aliasing issues.
  */
 #define put_unsafe_asm(x, addr, GUARD, err, itype, rtype, ltype, errret) \
-	stac();								\
 	__asm__ __volatile__(						\
 		GUARD(							\
 		"	guest_access_mask_ptr %[ptr], %[scr1], %[scr2]\n" \
@@ -169,11 +168,9 @@ struct __large_struct { unsigned long buf[100]; };
 		: [ret] "+r" (err), [ptr] "=&r" (dummy_)		\
 		  GUARD(, [scr1] "=&r" (dummy_), [scr2] "=&r" (dummy_))	\
 		: [val] ltype (x), "m" (__m(addr)),			\
-		  "[ptr]" (addr), [errno] "i" (errret));		\
-	clac()
+		  "[ptr]" (addr), [errno] "i" (errret))
 
 #define get_unsafe_asm(x, addr, GUARD, err, rtype, ltype, errret)	\
-	stac();								\
 	__asm__ __volatile__(						\
 		GUARD(							\
 		"	guest_access_mask_ptr %[ptr], %[scr1], %[scr2]\n" \
@@ -190,12 +187,12 @@ struct __large_struct { unsigned long buf[100]; };
 		  [ptr] "=&r" (dummy_)					\
 		  GUARD(, [scr1] "=&r" (dummy_), [scr2] "=&r" (dummy_))	\
 		: "m" (__m(addr)), "[ptr]" (addr),			\
-		  [errno] "i" (errret));				\
-	clac()
+		  [errno] "i" (errret))
 
 #define put_unsafe_size(x, ptr, size, grd, retval, errret)                 \
 do {                                                                       \
     retval = 0;                                                            \
+    stac();                                                                \
     switch ( size )                                                        \
     {                                                                      \
     long dummy_;                                                           \
@@ -213,6 +210,7 @@ do {                                                                       \
         break;                                                             \
     default: __put_user_bad();                                             \
     }                                                                      \
+    clac();                                                                \
 } while ( false )
 
 #define put_guest_size(x, ptr, size, retval, errret) \
@@ -221,6 +219,7 @@ do {                                                                       \
 #define get_unsafe_size(x, ptr, size, grd, retval, errret)                 \
 do {                                                                       \
     retval = 0;                                                            \
+    stac();                                                                \
     switch ( size )                                                        \
     {                                                                      \
     long dummy_;                                                           \
@@ -230,6 +229,7 @@ do {                                                                       \
     case 8: get_unsafe_asm(x, ptr, grd, retval,  "", "=r", errret); break; \
     default: __get_user_bad();                                             \
     }                                                                      \
+    clac();                                                                \
 } while ( false )
 
 #define get_guest_size(x, ptr, size, retval, errret)                       \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:15:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:15:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90513.171428 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgi6-0006Cb-Rr; Fri, 26 Feb 2021 17:15:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90513.171428; Fri, 26 Feb 2021 17:15:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgi6-0006CU-P5; Fri, 26 Feb 2021 17:15:26 +0000
Received: by outflank-mailman (input) for mailman id 90513;
 Fri, 26 Feb 2021 17:15:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgi5-0006CK-2K
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:15:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgi5-0008RT-1Y
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:15:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgi5-0003Lu-0r
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:15:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RV4xUWQVMBGYmbBFqeCyvBRfCGZbMZ6GVzbwW4LVqhQ=; b=dkIWbVxCWXmcI71A88Oz06xnpv
	p9T+xYdTFgNocC4sappl9dbejd+WP/IQJRZ0Lfu6qZt4VkjiA3FS0PAsPIjUy1SJzVOs2FflBAGFU
	ArDYJ3LVf8HlpMBxAjvDrYIWE7L6MAVFmPdYcgEdLNc5KZ1HxmVWSby7HkyU4U/w3ZmI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/PV: use get_unsafe() instead of copy_from_unsafe()
Message-Id: <E1lFgi5-0003Lu-0r@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:15:25 +0000

commit 972cd4308775f4eb48cbba3cc4efaf39e55c8057
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 25 15:39:09 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 25 15:39:09 2021 +0100

    x86/PV: use get_unsafe() instead of copy_from_unsafe()
    
    The former expands to a single (memory accessing) insn, which the latter
    does not guarantee (the __builtin_constant_p() based switch() statement
    there is just an optimization). Yet we'd prefer to read consistent PTEs
    rather than risking a split read racing with an update done elsewhere.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/pv/mm.c | 4 +---
 xen/arch/x86/pv/mm.h | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/pv/mm.c b/xen/arch/x86/pv/mm.c
index cb86143832..5ed7b3ccdb 100644
--- a/xen/arch/x86/pv/mm.c
+++ b/xen/arch/x86/pv/mm.c
@@ -41,9 +41,7 @@ l1_pgentry_t *map_guest_l1e(unsigned long linear, mfn_t *gl1mfn)
         return NULL;
 
     /* Find this l1e and its enclosing l1mfn in the linear map. */
-    if ( copy_from_unsafe(&l2e,
-                          &__linear_l2_table[l2_linear_offset(linear)],
-                          sizeof(l2_pgentry_t)) )
+    if ( get_unsafe(l2e, &__linear_l2_table[l2_linear_offset(linear)]) )
         return NULL;
 
     /* Check flags that it will be safe to read the l1e. */
diff --git a/xen/arch/x86/pv/mm.h b/xen/arch/x86/pv/mm.h
index 7e2259c488..5a117c735d 100644
--- a/xen/arch/x86/pv/mm.h
+++ b/xen/arch/x86/pv/mm.h
@@ -22,9 +22,7 @@ static inline l1_pgentry_t guest_get_eff_kern_l1e(unsigned long linear)
         toggle_guest_pt(curr);
 
     if ( unlikely(!__addr_ok(linear)) ||
-         copy_from_unsafe(&l1e,
-                          &__linear_l1_table[l1_linear_offset(linear)],
-                          sizeof(l1_pgentry_t)) )
+         get_unsafe(l1e, &__linear_l1_table[l1_linear_offset(linear)]) )
         l1e = l1e_empty();
 
     if ( user_mode )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:15:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:15:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90515.171434 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgiG-0006E8-Up; Fri, 26 Feb 2021 17:15:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90515.171434; Fri, 26 Feb 2021 17:15:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgiG-0006Dz-QV; Fri, 26 Feb 2021 17:15:36 +0000
Received: by outflank-mailman (input) for mailman id 90515;
 Fri, 26 Feb 2021 17:15:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgiF-0006Dl-5B
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:15:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgiF-0008Rb-4V
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:15:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgiF-0003Mc-3k
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:15:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S4oEnk9fEBDiztd0M4zP1YkrJNdpHmow1rpgO+fP/rY=; b=eCPc3zsmP37iopRcr9BKmgdTQk
	qIoFN+ULMO9uMn0WmvUU6RJLdF7g7NZ0sD35DOIB6TBVdbCos6ymVK6+y5owrdVPMEkSZhP2Xc+ow
	B5U0FKra2J9O9cYdSxYOt7bsWT+YSRDsVPkBO8St9M4131xTyAk704uS28frWpF+a9oY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Fix containerize to understand the Alpine container
Message-Id: <E1lFgiF-0003Mc-3k@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:15:35 +0000

commit 75b0505547f79cd16b19ca64fc92037bc23cbdf1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 25 14:09:26 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 25 15:22:40 2021 +0000

    automation: Fix containerize to understand the Alpine container
    
    This was missing from the work to add the alpine container.
    
    Fixes: a9afe7768bd ("automation: add alpine linux 3.12 x86 build container")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 automation/scripts/containerize | 1 +
 1 file changed, 1 insertion(+)

diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index da45baed4e..b7c81559fb 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -24,6 +24,7 @@ die() {
 #
 BASE="registry.gitlab.com/xen-project/xen"
 case "_${CONTAINER}" in
+    _alpine) CONTAINER="${BASE}/alpine:3.12" ;;
     _archlinux|_arch) CONTAINER="${BASE}/archlinux:current" ;;
     _centos7) CONTAINER="${BASE}/centos:7" ;;
     _centos72) CONTAINER="${BASE}/centos:7.2" ;;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 26 17:15:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Feb 2021 17:15:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90516.171437 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgiR-0006Fa-0T; Fri, 26 Feb 2021 17:15:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90516.171437; Fri, 26 Feb 2021 17:15:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lFgiQ-0006FS-TZ; Fri, 26 Feb 2021 17:15:46 +0000
Received: by outflank-mailman (input) for mailman id 90516;
 Fri, 26 Feb 2021 17:15:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgiP-0006FG-8O
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:15:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgiP-0008Rz-7f
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:15:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lFgiP-0003NG-6w
 for xen-changelog@lists.xenproject.org; Fri, 26 Feb 2021 17:15:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DuDF8+4faJbedCU/cP2coSjEAaIVMKeUB03L/ApDUOA=; b=Y5AvZUFnVu9v+LeJgUJXUXWrQ2
	V64UEKaEqfmHr05yX5h2Le1EeQWzEzeBhedpPWCp/D09Z6Wnlqtc20RBbyDnjX/VclbTyGqNpncZ8
	HwCd+N9/cQP0Q+44ynVwjuQq5fmZ1emCUpXewUv+5hYHDJBmMM5TmV4hzal3oA0rA+Fo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Fix typo in xc_vmtrace_set_option comment
Message-Id: <E1lFgiP-0003NG-6w@xenbits.xenproject.org>
Date: Fri, 26 Feb 2021 17:15:45 +0000

commit fc8fb368515391374e5f170a1e07205d914bc14a
Author:     Hubert Jasudowicz <hubert.jasudowicz@cert.pl>
AuthorDate: Thu Feb 25 12:43:07 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 25 15:22:40 2021 +0000

    tools: Fix typo in xc_vmtrace_set_option comment
    
    Signed-off-by: Hubert Jasudowicz <hubert.jasudowicz@cert.pl>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/include/xenctrl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 0efcdae8b4..318920166c 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1644,7 +1644,7 @@ int xc_vmtrace_get_option(xc_interface *xch, uint32_t domid,
                           uint32_t vcpu, uint64_t key, uint64_t *value);
 
 /**
- * Set platform specific vntvmtrace options.
+ * Set platform specific vmtrace options.
  *
  * @parm xch a handle to an open hypervisor interface
  * @parm domid domain identifier
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 27 21:44:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Feb 2021 21:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90979.172104 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lG7Nb-00085D-F1; Sat, 27 Feb 2021 21:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90979.172104; Sat, 27 Feb 2021 21:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lG7Nb-000853-Bs; Sat, 27 Feb 2021 21:44:03 +0000
Received: by outflank-mailman (input) for mailman id 90979;
 Sat, 27 Feb 2021 21:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7Na-00084w-4G
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7Na-0006xx-2w
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7Na-00087g-1p
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ho5u8CcsXWuVXC4gdnP4m2bSapQVIdBrRk7m6wJbXT8=; b=W4ldI47woimNB5q3fcSouBOIIq
	LUj0LBlK02DwooXF+CbPlB4FHZIRI9Z5En/qmpAgFYSvaf3R0Y/r0Od2Ez0YnUjnhIgzlz/4rQnDw
	22o1YGEAYqKvP8hP0QBQ6Fkybt1K/VQscQu5R0/EMxpcYtvAX0WBlsM5x7c0PmKrYKRY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VMX: delay p2m insertion of APIC access page
Message-Id: <E1lG7Na-00087g-1p@xenbits.xenproject.org>
Date: Sat, 27 Feb 2021 21:44:02 +0000

commit 68b92ee7fef27f85846ef892e3d2e1763807b72d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 26 10:18:59 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 26 10:18:59 2021 +0100

    VMX: delay p2m insertion of APIC access page
    
    Inserting the mapping at domain creation time leads to a memory leak
    when the creation fails later on and the domain uses separate CPU and
    IOMMU page tables - the latter requires intermediate page tables to be
    allocated, but there's no freeing of them at present in this case. Since
    we don't need the p2m insertion to happen this early, avoid the problem
    altogether by deferring it until the last possible point. This comes at
    the price of not being able to handle an error other than by crashing
    the domain.
    
    Reported-by: Julien Grall <julien@xen.org>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/domain.c         |  2 ++
 xen/arch/x86/hvm/vmx/vmx.c    | 12 ++++++++++--
 xen/include/asm-x86/hvm/hvm.h | 12 ++++++++++++
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 97fd9456c2..5e3c94d3fa 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1007,6 +1007,8 @@ int arch_domain_soft_reset(struct domain *d)
 
 void arch_domain_creation_finished(struct domain *d)
 {
+    if ( is_hvm_domain(d) )
+        hvm_domain_creation_finished(d);
 }
 
 #define xen_vcpu_guest_context vcpu_guest_context
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index faba95d057..bfea1b0f8a 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -428,6 +428,14 @@ static void vmx_domain_relinquish_resources(struct domain *d)
     vmx_free_vlapic_mapping(d);
 }
 
+static void domain_creation_finished(struct domain *d)
+{
+    if ( has_vlapic(d) && !mfn_eq(d->arch.hvm.vmx.apic_access_mfn, _mfn(0)) &&
+         set_mmio_p2m_entry(d, gaddr_to_gfn(APIC_DEFAULT_PHYS_BASE),
+                            d->arch.hvm.vmx.apic_access_mfn, PAGE_ORDER_4K) )
+        domain_crash(d);
+}
+
 static void vmx_init_ipt(struct vcpu *v)
 {
     unsigned int size = v->domain->vmtrace_size;
@@ -2408,6 +2416,7 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .cpu_dead             = vmx_cpu_dead,
     .domain_initialise    = vmx_domain_initialise,
     .domain_relinquish_resources = vmx_domain_relinquish_resources,
+    .domain_creation_finished = domain_creation_finished,
     .vcpu_initialise      = vmx_vcpu_initialise,
     .vcpu_destroy         = vmx_vcpu_destroy,
     .save_cpu_ctxt        = vmx_save_vmcs_ctxt,
@@ -3234,8 +3243,7 @@ static int vmx_alloc_vlapic_mapping(struct domain *d)
     clear_domain_page(mfn);
     d->arch.hvm.vmx.apic_access_mfn = mfn;
 
-    return set_mmio_p2m_entry(d, gaddr_to_gfn(APIC_DEFAULT_PHYS_BASE), mfn,
-                              PAGE_ORDER_4K);
+    return 0;
 }
 
 static void vmx_free_vlapic_mapping(struct domain *d)
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index 150746de66..4a8fb571de 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -106,6 +106,7 @@ struct hvm_function_table {
      * Initialise/destroy HVM domain/vcpu resources
      */
     int  (*domain_initialise)(struct domain *d);
+    void (*domain_creation_finished)(struct domain *d);
     void (*domain_relinquish_resources)(struct domain *d);
     void (*domain_destroy)(struct domain *d);
     int  (*vcpu_initialise)(struct vcpu *v);
@@ -390,6 +391,12 @@ static inline bool hvm_has_set_descriptor_access_exiting(void)
     return hvm_funcs.set_descriptor_access_exiting;
 }
 
+static inline void hvm_domain_creation_finished(struct domain *d)
+{
+    if ( hvm_funcs.domain_creation_finished )
+        alternative_vcall(hvm_funcs.domain_creation_finished, d);
+}
+
 static inline int
 hvm_guest_x86_mode(struct vcpu *v)
 {
@@ -766,6 +773,11 @@ static inline void hvm_invlpg(const struct vcpu *v, unsigned long linear)
     ASSERT_UNREACHABLE();
 }
 
+static inline void hvm_domain_creation_finished(struct domain *d)
+{
+    ASSERT_UNREACHABLE();
+}
+
 /*
  * Shadow code needs further cleanup to eliminate some HVM-only paths. For
  * now provide the stubs here but assert they will never be reached.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 27 21:44:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Feb 2021 21:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90980.172108 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lG7Nl-00086W-GC; Sat, 27 Feb 2021 21:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90980.172108; Sat, 27 Feb 2021 21:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lG7Nl-00086O-DM; Sat, 27 Feb 2021 21:44:13 +0000
Received: by outflank-mailman (input) for mailman id 90980;
 Sat, 27 Feb 2021 21:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7Nk-00086G-7J
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7Nk-0006y4-6Q
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7Nk-00088l-5J
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9Vsk5NNBCgHFukHe5q0a/EOEACUd9Fz5haDWDNboApU=; b=C2BDXUr9HLKALhBsqvUR48LJ5E
	HDk23dgu2nWdZVKUTFoXgM6zDts/PmMSHAN5KsADfiHUGa8O6Vd2ooob5kAUX1p5FwgTLK0C/kE/f
	BoX13R8AzExUE9Ct+OAUix0ATwNIuoUn7KmSJPSolLZViO7rC0XV/EgdZMD22kkOklAw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: Avoid unnecessary talloc_strdup() in do_control_lu()
Message-Id: <E1lG7Nk-00088l-5J@xenbits.xenproject.org>
Date: Sat, 27 Feb 2021 21:44:12 +0000

commit 2fc7939e26d223b2a8ce37204ea479d013444b7f
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Feb 25 15:15:23 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Feb 26 09:45:41 2021 +0000

    tools/xenstored: Avoid unnecessary talloc_strdup() in do_control_lu()
    
    At the moment, the return of talloc_strdup() is not checked. This means
    we may dereference a NULL pointer if the allocation failed.
    
    However, it is pointless to allocate the memory as send_reply() will
    copy the data to a different buffer. So drop the use of talloc_strdup().
    
    This bug was discovered and resolved using Coverity Static Analysis
    Security Testing (SAST) by Synopsys, Inc.
    
    Fixes: fecab256d474 ("tools/xenstore: add basic live-update command parsing")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xenstore/xenstored_control.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index f10beaf85e..e8a501acdb 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -691,7 +691,6 @@ static const char *lu_start(const void *ctx, struct connection *conn,
 static int do_control_lu(void *ctx, struct connection *conn,
 			 char **vec, int num)
 {
-	const char *resp;
 	const char *ret = NULL;
 	unsigned int i;
 	bool force = false;
@@ -734,8 +733,7 @@ static int do_control_lu(void *ctx, struct connection *conn,
 
 	if (!ret)
 		ret = "OK";
-	resp = talloc_strdup(ctx, ret);
-	send_reply(conn, XS_CONTROL, resp, strlen(resp) + 1);
+	send_reply(conn, XS_CONTROL, ret, strlen(ret) + 1);
 	return 0;
 }
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 27 21:44:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Feb 2021 21:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90981.172112 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lG7Nv-00087q-Hk; Sat, 27 Feb 2021 21:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90981.172112; Sat, 27 Feb 2021 21:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lG7Nv-00087i-Et; Sat, 27 Feb 2021 21:44:23 +0000
Received: by outflank-mailman (input) for mailman id 90981;
 Sat, 27 Feb 2021 21:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7Nu-00087V-Dt
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7Nu-0006yK-BI
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7Nu-00089c-8o
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mjW77WqVSixxUXeJj+cfjA+u7274JEnmY/Da7ComWRg=; b=jTfkO/1FtvRJ8kjg8nJqto2h0D
	AaMgOLRpm3UbjfFWrwU1j4OfNcwOMpbtNNs37JFqT8et8o5TmcZ9CogDBaT37MoJzHTlQaKydINAH
	s80r3Z/yIvIrIOfZYsVTQj1IMMW1+o2w4QGA3EFGmUA/WnqoKQzny4YXiQnEteKBosKw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: Avoid unnecessary talloc_strdup() in do_lu_start()
Message-Id: <E1lG7Nu-00089c-8o@xenbits.xenproject.org>
Date: Sat, 27 Feb 2021 21:44:22 +0000

commit 702b44be43b431695dd9ab49ca4a89ea50e31711
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Feb 25 15:43:04 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Feb 26 09:45:58 2021 +0000

    tools/xenstored: Avoid unnecessary talloc_strdup() in do_lu_start()
    
    At the moment, the return of talloc_strdup() is not checked. This means
    we may dereference a NULL pointer if the allocation failed.
    
    However, it is pointless to allocate the memory as send_reply() will
    copy the data to a different buffer. So drop the use of talloc_strdup().
    
    This bug was discovered and resolved using Coverity Static Analysis
    Security Testing (SAST) by Synopsys, Inc.
    
    Fixes: af216a99fb4a ("tools/xenstore: add the basic framework for doing the live update")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xenstore/xenstored_control.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index e8a501acdb..8eb5782776 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -638,7 +638,6 @@ static bool do_lu_start(struct delayed_request *req)
 {
 	time_t now = time(NULL);
 	const char *ret;
-	char *resp;
 
 	if (!lu_check_lu_allowed()) {
 		if (now < lu_status->started_at + lu_status->timeout)
@@ -660,8 +659,7 @@ static bool do_lu_start(struct delayed_request *req)
  out:
 	talloc_free(lu_status);
 
-	resp = talloc_strdup(req->in, ret);
-	send_reply(lu_status->conn, XS_CONTROL, resp, strlen(resp) + 1);
+	send_reply(lu_status->conn, XS_CONTROL, ret, strlen(ret) + 1);
 
 	return true;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 27 21:44:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Feb 2021 21:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90982.172115 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lG7O5-00089R-JV; Sat, 27 Feb 2021 21:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90982.172115; Sat, 27 Feb 2021 21:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lG7O5-00089J-GV; Sat, 27 Feb 2021 21:44:33 +0000
Received: by outflank-mailman (input) for mailman id 90982;
 Sat, 27 Feb 2021 21:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7O4-000898-Gr
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7O4-0006yR-GA
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7O4-0008AX-De
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oU7+Yr7Mtcmr7Qiw3NqjuqiEqWcyn2Cl4OcPfiuhRkA=; b=0IyPyjXzy2gB3rk4aPiyXKaSlq
	uvDoa/GFPfwK4ubQqlbkXjHfBNw7jLpL5NEF4tNOgR2HMUcC+kNww5NGphfTyiKSTSUKjde+Qp8P9
	60yV462+UpVls8wg+/H5ndpEUf2jVAbOba8AQetbt8tp03MYXoiEd6H5WKgm4U3uiL68=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: control: Store the save filename in lu_dump_state
Message-Id: <E1lG7O4-0008AX-De@xenbits.xenproject.org>
Date: Sat, 27 Feb 2021 21:44:32 +0000

commit 11d9933f6bf0cdb69cdd82c5ad2213fcbe73502f
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Feb 25 16:33:23 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Feb 26 09:46:12 2021 +0000

    tools/xenstored: control: Store the save filename in lu_dump_state
    
    The function lu_close_dump_state() will use talloc_asprintf() without
    checking whether the allocation succeeded. In the unlikely case we are
    out of memory, we would dereference a NULL pointer.
    
    As we already computed the filename in lu_get_dump_state(), we can store
    the name in the lu_dump_state. This is avoiding to deal with memory file
    in the close path and also reduce the risk to use the different
    filename.
    
    This bug was discovered and resolved using Coverity Static Analysis
    Security Testing (SAST) by Synopsys, Inc.
    
    Fixes: c0dc6a3e7c41 ("tools/xenstore: read internal state when doing live upgrade")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xenstore/xenstored_control.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index 8eb5782776..653890f2d9 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -16,6 +16,7 @@ Interactive commands for Xen Store Daemon.
     along with this program; If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <assert.h>
 #include <ctype.h>
 #include <errno.h>
 #include <stdarg.h>
@@ -74,6 +75,7 @@ struct lu_dump_state {
 	unsigned int size;
 #ifndef __MINIOS__
 	int fd;
+	char *filename;
 #endif
 };
 
@@ -399,17 +401,16 @@ static void lu_dump_close(FILE *fp)
 
 static void lu_get_dump_state(struct lu_dump_state *state)
 {
-	char *filename;
 	struct stat statbuf;
 
 	state->size = 0;
 
-	filename = talloc_asprintf(NULL, "%s/state_dump", xs_daemon_rootdir());
-	if (!filename)
+	state->filename = talloc_asprintf(NULL, "%s/state_dump",
+					  xs_daemon_rootdir());
+	if (!state->filename)
 		barf("Allocation failure");
 
-	state->fd = open(filename, O_RDONLY);
-	talloc_free(filename);
+	state->fd = open(state->filename, O_RDONLY);
 	if (state->fd < 0)
 		return;
 	if (fstat(state->fd, &statbuf) != 0)
@@ -431,14 +432,13 @@ static void lu_get_dump_state(struct lu_dump_state *state)
 
 static void lu_close_dump_state(struct lu_dump_state *state)
 {
-	char *filename;
+	assert(state->filename != NULL);
 
 	munmap(state->buf, state->size);
 	close(state->fd);
 
-	filename = talloc_asprintf(NULL, "%s/state_dump", xs_daemon_rootdir());
-	unlink(filename);
-	talloc_free(filename);
+	unlink(state->filename);
+	talloc_free(state->filename);
 }
 
 static char *lu_exec(const void *ctx, int argc, char **argv)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 27 21:44:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Feb 2021 21:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90983.172122 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lG7OF-0008An-M6; Sat, 27 Feb 2021 21:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90983.172122; Sat, 27 Feb 2021 21:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lG7OF-0008Af-Hz; Sat, 27 Feb 2021 21:44:43 +0000
Received: by outflank-mailman (input) for mailman id 90983;
 Sat, 27 Feb 2021 21:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7OE-0008AW-K2
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7OE-0006yh-JF
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7OE-0008BM-IH
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uVH+YTVf696cnJ0R7SGr0fQ5DifFsvhr/IKJvmL+9SU=; b=HOLkVRfb9P/AAAbslQyqfeveW/
	2wUZ5y8j/H0CrDYWlKnUhBOLJov9Gthss9I9vSLdPRCE0ZDC+AQKhzHh0S1RaM5NTvc+4BVJ+4pQ7
	CipzsFvTY2eMgekd/nRgjCLCXr+DZ24ZmD0QAOFu2DukmkLu1C6Z0BzAiHsFsyAHNKN4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore-control: Don't leak buf in live_update_start()
Message-Id: <E1lG7OE-0008BM-IH@xenbits.xenproject.org>
Date: Sat, 27 Feb 2021 21:44:42 +0000

commit 79b6574f8ecea39c14557bdd7049c7e2d21ddcbd
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Feb 25 17:08:49 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Feb 26 09:46:36 2021 +0000

    tools/xenstore-control: Don't leak buf in live_update_start()
    
    All the error paths but one will free buf. Cover the remaining path so
    buf can't be leaked.
    
    This bug was discovered and resolved using Coverity Static Analysis
    Security Testing (SAST) by Synopsys, Inc.
    
    Fixes: 7f97193e6aa8 ("tools/xenstore: add live update command to xenstore-control")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/xenstore/xenstore_control.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/xenstore/xenstore_control.c b/tools/xenstore/xenstore_control.c
index f6f4626c06..548363ee70 100644
--- a/tools/xenstore/xenstore_control.c
+++ b/tools/xenstore/xenstore_control.c
@@ -44,8 +44,10 @@ static int live_update_start(struct xs_handle *xsh, bool force, unsigned int to)
         return 1;
 
     ret = strdup("BUSY");
-    if (!ret)
+    if (!ret) {
+        free(buf);
         return 1;
+    }
 
     for (time_start = time(NULL); time(NULL) - time_start < to;) {
         free(ret);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 27 21:44:53 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Feb 2021 21:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90984.172123 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lG7OP-0008CD-MZ; Sat, 27 Feb 2021 21:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90984.172123; Sat, 27 Feb 2021 21:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lG7OP-0008C6-Jh; Sat, 27 Feb 2021 21:44:53 +0000
Received: by outflank-mailman (input) for mailman id 90984;
 Sat, 27 Feb 2021 21:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7OO-0008Bw-NS
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7OO-0006yq-Mi
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7OO-0008C6-Lp
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5O/j1fK8uXUApS0mICVGFUjV62K7HK0O18NJdaHO2XI=; b=qtX9l35TdzKxjYRwunEyZgIwgZ
	m0s2CFaPvBxVkKJUsNiwyrWigqid2EwuNbhdeuvTx87NOOqgLIl9ImmvUoaSEI8cNsaCAA51vZADs
	+qu16lTPDnjcKqcYxKmL1NPlSZ4JiGr4qaq7I9NgO+HIGP9PiH5UzY1tnzlptlWZlJ3k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/sched: Add missing memory barrier in vcpu_block()
Message-Id: <E1lG7OO-0008C6-Lp@xenbits.xenproject.org>
Date: Sat, 27 Feb 2021 21:44:52 +0000

commit 109e8177fd4a225e7025c4c17d2c9537b550b4ed
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sat Feb 20 19:22:34 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Feb 26 09:47:23 2021 +0000

    xen/sched: Add missing memory barrier in vcpu_block()
    
    The comment in vcpu_block() states that the events should be checked
    /after/ blocking to avoids wakeup waiting race. However, from a generic
    perspective, set_bit() doesn't prevent re-ordering. So the following
    could happen:
    
    CPU0  (blocking vCPU A)         |   CPU1 ( unblock vCPU A)
                                    |
    A <- read local events          |
                                    |   set local events
                                    |   test_and_clear_bit(_VPF_blocked)
                                    |       -> Bail out as the bit if not set
                                    |
    set_bit(_VFP_blocked)           |
                                    |
    check A                         |
    
    The variable A will be 0 and therefore the vCPU will be blocked when it
    should continue running.
    
    vcpu_block() is now gaining an smp_mb__after_atomic() to prevent the CPU
    to read any information about local events before the flag _VPF_blocked
    is set.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Ash Wilding <ash.j.wilding@gmail.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Dario Faggioli <dfaggioli@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/common/sched/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index 9745a77eee..2b974fd6f8 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -1418,6 +1418,8 @@ void vcpu_block(void)
 
     set_bit(_VPF_blocked, &v->pause_flags);
 
+    smp_mb__after_atomic();
+
     arch_vcpu_block(v);
 
     /* Check for events /after/ blocking: avoids wakeup waiting race. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 27 21:45:04 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Feb 2021 21:45:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90985.172127 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lG7Oa-0008DZ-Oq; Sat, 27 Feb 2021 21:45:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90985.172127; Sat, 27 Feb 2021 21:45:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lG7Oa-0008DR-LN; Sat, 27 Feb 2021 21:45:04 +0000
Received: by outflank-mailman (input) for mailman id 90985;
 Sat, 27 Feb 2021 21:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7OY-0008DE-SL
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7OY-000706-Rc
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7OY-0008D7-P9
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mRxhOpopUhCPFxQodY1YBwfRBeDXdj5AXL+/EQbEacQ=; b=mC2uAYJ+Q3oC/01EgiPPsFBlx6
	M3NqtuQCSWrIQDl4/ay17NJs1WYN7jG6+Ft5x8UYt0pI2sH/k7vuEF9z8ZoIGAXUyjTLt/ol5iH10
	TgMhvDFqTE9/C7LaQp8dbX9vnR1aSNmKm1DOiuTl7EBJlpQcBP0qKcLMK0oCtjA6srCM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/dmop: Properly fail for PV guests
Message-Id: <E1lG7OY-0008D7-P9@xenbits.xenproject.org>
Date: Sat, 27 Feb 2021 21:45:02 +0000

commit 615367b5275a5b0123f1f1ee86c985fab234a5a4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 25 16:54:17 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 26 12:28:52 2021 +0000

    x86/dmop: Properly fail for PV guests
    
    The current code has an early exit for PV guests, but it returns 0 having done
    nothing.
    
    Fixes: 524a98c2ac5 ("public / x86: introduce __HYPERCALL_dm_op...")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/hvm/dm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
index 5bc172a5d4..612749442e 100644
--- a/xen/arch/x86/hvm/dm.c
+++ b/xen/arch/x86/hvm/dm.c
@@ -365,6 +365,7 @@ int dm_op(const struct dmop_args *op_args)
     if ( rc )
         return rc;
 
+    rc = -EINVAL;
     if ( !is_hvm_domain(d) )
         goto out;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 27 21:45:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Feb 2021 21:45:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90986.172132 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lG7Ok-0008FB-Ri; Sat, 27 Feb 2021 21:45:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90986.172132; Sat, 27 Feb 2021 21:45:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lG7Ok-0008F3-OY; Sat, 27 Feb 2021 21:45:14 +0000
Received: by outflank-mailman (input) for mailman id 90986;
 Sat, 27 Feb 2021 21:45: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 1lG7Oi-0008Et-Vs
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:45:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7Oi-00070F-V3
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lG7Oi-0008Dr-UB
 for xen-changelog@lists.xenproject.org; Sat, 27 Feb 2021 21:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xHVqshEQNPhBqd//OUxwgMtC4o+v+zUe47jXu0xODUs=; b=27yFQFYU+Cwtdl6rV/suhClL9i
	IjVM+/hINY9zrAO3PG8D6clypH6r+NqKweL1APbinld0jCJm7VliYna7gmOYI7dJOjgV9uGRMk6vU
	MmxpFGzEsrP+iwU9PEh0n0S2ewZzyrrdjlxXDik8R2ZODOv7I/1sksv8aZvp0VrunQms=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] dmop: Add XEN_DMOP_nr_vcpus
Message-Id: <E1lG7Oi-0008Dr-UB@xenbits.xenproject.org>
Date: Sat, 27 Feb 2021 21:45:12 +0000

commit c4441ab1f1d506a942002ccc55fdde2fe30ef626
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 25 15:46:10 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 26 12:28:52 2021 +0000

    dmop: Add XEN_DMOP_nr_vcpus
    
    Curiously absent from the stable API/ABIs is an ability to query the number of
    vcpus which a domain has.  Emulators need to know this information in
    particular to know how many stuct ioreq's live in the ioreq server mappings.
    
    In practice, this forces all userspace to link against libxenctrl to use
    xc_domain_getinfo(), which rather defeats the purpose of the stable libraries.
    
    Introduce a DMOP to retrieve this information and surface it in
    libxendevicemodel to help emulators shed their use of unstable interfaces.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    ---
    CC: Jan Beulich <JBeulich@suse.com>
    CC: Roger Pau Monné <roger.pau@citrix.com>
    CC: Wei Liu <wl@xen.org>
    CC: Paul Durrant <paul@xen.org>
    CC: Stefano Stabellini <sstabellini@kernel.org>
    CC: Julien Grall <julien@xen.org>
    CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
    CC: Ian Jackson <iwj@xenproject.org>
    
    For 4.15.  This was a surprise discovery in the massive ABI untangling effort
    I'm currently doing for XenServer's new build system.
    
    This is one new read-only op to obtain information which isn't otherwise
    available under a stable API/ABI.  As such, its risk for 4.15 is very low,
    with a very real quality-of-life improvement for downstreams.
    
    I realise this is technically a new feature and we're long past feature
    freeze, but I'm hoping that "really lets some emulators move off the unstable
    libraries" is sufficiently convincing argument.
    
    It's not sufficient to let Qemu move off unstable libraries yet - at a
    minimum, the add_to_phymap hypercalls need stabilising to support PCI
    Passthrough and BAR remapping.
    
    I'd prefer not to duplicate the op handling between ARM and x86, and if this
    weren't a release window, I'd submit a prereq patch to dedup the common dmop
    handling.  That can wait to 4.16 at this point.  Also, this op ought to work
    against x86 PV guests, but fixing that up will also need this rearrangement
    into common code, so needs to wait.
---
 tools/include/xendevicemodel.h               | 10 ++++++++++
 tools/libs/devicemodel/core.c                | 15 +++++++++++++++
 tools/libs/devicemodel/libxendevicemodel.map |  1 +
 xen/arch/arm/dm.c                            | 10 ++++++++++
 xen/arch/x86/hvm/dm.c                        | 11 +++++++++++
 xen/include/public/hvm/dm_op.h               | 16 ++++++++++++++++
 xen/include/xlat.lst                         |  1 +
 7 files changed, 64 insertions(+)

diff --git a/tools/include/xendevicemodel.h b/tools/include/xendevicemodel.h
index c06b3c84b9..33698d67f3 100644
--- a/tools/include/xendevicemodel.h
+++ b/tools/include/xendevicemodel.h
@@ -357,6 +357,16 @@ int xendevicemodel_pin_memory_cacheattr(
     xendevicemodel_handle *dmod, domid_t domid, uint64_t start, uint64_t end,
     uint32_t type);
 
+/**
+ * Query for the number of vCPUs that a domain has.
+ * @parm dmod a handle to an open devicemodel interface.
+ * @parm domid the domain id to be serviced.
+ * @parm vcpus Number of vcpus.
+ * @return 0 on success and fills @p vcpus, or -1 on failure.
+ */
+int xendevicemodel_nr_vcpus(
+    xendevicemodel_handle *dmod, domid_t domid, unsigned int *vcpus);
+
 /**
  * This function restricts the use of this handle to the specified
  * domain.
diff --git a/tools/libs/devicemodel/core.c b/tools/libs/devicemodel/core.c
index 30bd79f8ba..8e619eeb0a 100644
--- a/tools/libs/devicemodel/core.c
+++ b/tools/libs/devicemodel/core.c
@@ -630,6 +630,21 @@ int xendevicemodel_pin_memory_cacheattr(
     return xendevicemodel_op(dmod, domid, 1, &op, sizeof(op));
 }
 
+int xendevicemodel_nr_vcpus(
+    xendevicemodel_handle *dmod, domid_t domid, unsigned int *vcpus)
+{
+    struct xen_dm_op op = {
+        .op = XEN_DMOP_nr_vcpus,
+    };
+
+    int rc = xendevicemodel_op(dmod, domid, 1, &op, sizeof(op));
+    if ( rc )
+        return rc;
+
+    *vcpus = op.u.nr_vcpus.vcpus;
+    return 0;
+}
+
 int xendevicemodel_restrict(xendevicemodel_handle *dmod, domid_t domid)
 {
     return osdep_xendevicemodel_restrict(dmod, domid);
diff --git a/tools/libs/devicemodel/libxendevicemodel.map b/tools/libs/devicemodel/libxendevicemodel.map
index 733549327b..f7f9e3d932 100644
--- a/tools/libs/devicemodel/libxendevicemodel.map
+++ b/tools/libs/devicemodel/libxendevicemodel.map
@@ -42,4 +42,5 @@ VERS_1.3 {
 VERS_1.4 {
 	global:
 		xendevicemodel_set_irq_level;
+		xendevicemodel_nr_vcpus;
 } VERS_1.3;
diff --git a/xen/arch/arm/dm.c b/xen/arch/arm/dm.c
index 785413372c..d689e336fd 100644
--- a/xen/arch/arm/dm.c
+++ b/xen/arch/arm/dm.c
@@ -38,6 +38,7 @@ int dm_op(const struct dmop_args *op_args)
         [XEN_DMOP_set_ioreq_server_state]           = sizeof(struct xen_dm_op_set_ioreq_server_state),
         [XEN_DMOP_destroy_ioreq_server]             = sizeof(struct xen_dm_op_destroy_ioreq_server),
         [XEN_DMOP_set_irq_level]                    = sizeof(struct xen_dm_op_set_irq_level),
+        [XEN_DMOP_nr_vcpus]                         = sizeof(struct xen_dm_op_nr_vcpus),
     };
 
     rc = rcu_lock_remote_domain_by_id(op_args->domid, &d);
@@ -122,6 +123,15 @@ int dm_op(const struct dmop_args *op_args)
         break;
     }
 
+    case XEN_DMOP_nr_vcpus:
+    {
+        struct xen_dm_op_nr_vcpus *data = &op.u.nr_vcpus;
+
+        data->vcpus = d->max_vcpus;
+        rc = 0;
+        break;
+    }
+
     default:
         rc = ioreq_server_dm_op(&op, d, &const_op);
         break;
diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
index 612749442e..f4f0910463 100644
--- a/xen/arch/x86/hvm/dm.c
+++ b/xen/arch/x86/hvm/dm.c
@@ -359,6 +359,7 @@ int dm_op(const struct dmop_args *op_args)
         [XEN_DMOP_remote_shutdown]                  = sizeof(struct xen_dm_op_remote_shutdown),
         [XEN_DMOP_relocate_memory]                  = sizeof(struct xen_dm_op_relocate_memory),
         [XEN_DMOP_pin_memory_cacheattr]             = sizeof(struct xen_dm_op_pin_memory_cacheattr),
+        [XEN_DMOP_nr_vcpus]                         = sizeof(struct xen_dm_op_nr_vcpus),
     };
 
     rc = rcu_lock_remote_domain_by_id(op_args->domid, &d);
@@ -606,6 +607,15 @@ int dm_op(const struct dmop_args *op_args)
         break;
     }
 
+    case XEN_DMOP_nr_vcpus:
+    {
+        struct xen_dm_op_nr_vcpus *data = &op.u.nr_vcpus;
+
+        data->vcpus = d->max_vcpus;
+        rc = 0;
+        break;
+    }
+
     default:
         rc = ioreq_server_dm_op(&op, d, &const_op);
         break;
@@ -641,6 +651,7 @@ CHECK_dm_op_map_mem_type_to_ioreq_server;
 CHECK_dm_op_remote_shutdown;
 CHECK_dm_op_relocate_memory;
 CHECK_dm_op_pin_memory_cacheattr;
+CHECK_dm_op_nr_vcpus;
 
 int compat_dm_op(domid_t domid,
                  unsigned int nr_bufs,
diff --git a/xen/include/public/hvm/dm_op.h b/xen/include/public/hvm/dm_op.h
index 1f70d58caa..ef7fbc0d3d 100644
--- a/xen/include/public/hvm/dm_op.h
+++ b/xen/include/public/hvm/dm_op.h
@@ -449,6 +449,21 @@ struct xen_dm_op_set_irq_level {
 };
 typedef struct xen_dm_op_set_irq_level xen_dm_op_set_irq_level_t;
 
+/*
+ * XEN_DMOP_nr_vcpus: Query the number of vCPUs a domain has.
+ *
+ * This is the number of vcpu objects allocated in Xen for the domain, and is
+ * fixed from creation time.  This bound is applicable to e.g. the vcpuid
+ * parameter of XEN_DMOP_inject_event, or number of struct ioreq objects
+ * mapped via XENMEM_acquire_resource.
+ */
+#define XEN_DMOP_nr_vcpus 20
+
+struct xen_dm_op_nr_vcpus {
+    uint32_t vcpus; /* OUT */
+};
+typedef struct xen_dm_op_nr_vcpus xen_dm_op_nr_vcpus_t;
+
 struct xen_dm_op {
     uint32_t op;
     uint32_t pad;
@@ -472,6 +487,7 @@ struct xen_dm_op {
         xen_dm_op_remote_shutdown_t remote_shutdown;
         xen_dm_op_relocate_memory_t relocate_memory;
         xen_dm_op_pin_memory_cacheattr_t pin_memory_cacheattr;
+        xen_dm_op_nr_vcpus_t nr_vcpus;
     } u;
 };
 
diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst
index 398993d5f4..65f7fe3811 100644
--- a/xen/include/xlat.lst
+++ b/xen/include/xlat.lst
@@ -98,6 +98,7 @@
 ?	dm_op_ioreq_server_range	hvm/dm_op.h
 ?	dm_op_map_mem_type_to_ioreq_server hvm/dm_op.h
 ?	dm_op_modified_memory		hvm/dm_op.h
+?	dm_op_nr_vcpus			hvm/dm_op.h
 ?	dm_op_pin_memory_cacheattr	hvm/dm_op.h
 ?	dm_op_relocate_memory		hvm/dm_op.h
 ?	dm_op_remote_shutdown		hvm/dm_op.h
--
generated by git-patchbot for /home/xen/git/xen.git#master


