From xen-changelog-bounces@lists.xenproject.org Mon Nov 01 12:44:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Nov 2021 12:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.219164.379842 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mhWfV-0006by-JK; Mon, 01 Nov 2021 12:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 219164.379842; Mon, 01 Nov 2021 12:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mhWfV-0006bq-GM; Mon, 01 Nov 2021 12:44:05 +0000
Received: by outflank-mailman (input) for mailman id 219164;
 Mon, 01 Nov 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 1mhWfU-0006bk-DY
 for xen-changelog@lists.xenproject.org; Mon, 01 Nov 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 1mhWfU-0007gO-Bl
 for xen-changelog@lists.xenproject.org; Mon, 01 Nov 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 1mhWfU-0007BJ-Am
 for xen-changelog@lists.xenproject.org; Mon, 01 Nov 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=bEMCfRFttqq26WIBu2eAGeLlYy2IT+eEpOCi+YgV+UI=; b=6YtfTtjDoUUVloGifRMSerh+/q
	BYuB2+k8qYhVCTkGl3Xv+8Zzb42GYOiJMrpqF7gZF1NiChLQeA9nQRAdV1EzIltv2SITxp9MdUC4F
	KSNuxMbxCbxklvP2jDlnON9LL8BDSUXQDLb6Rj71Kn+1w7GtaHeJgFAjE2feHJPB9Sxw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Config.mk: pin QEMU_UPSTREAM_REVISION (prep for Xen 4.16 RC1)
Message-Id: <E1mhWfU-0007BJ-Am@xenbits.xenproject.org>
Date: Mon, 01 Nov 2021 12:44:04 +0000

commit c9ce6afbf2d7772f47fc572bb7fc9555724927ed
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Mon Nov 1 12:33:54 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 1 12:33:54 2021 +0000

    Config.mk: pin QEMU_UPSTREAM_REVISION (prep for Xen 4.16 RC1)
    
    Signed-off-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 6587c7d626..6be010c7ce 100644
--- a/Config.mk
+++ b/Config.mk
@@ -239,7 +239,7 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
-QEMU_UPSTREAM_REVISION ?= master
+QEMU_UPSTREAM_REVISION ?= b6e539830bf45e2d7a6bd86ddfdf003088b173b0
 MINIOS_UPSTREAM_REVISION ?= 9f09744aa3e5982a083ecf8e9cd2123f477081f9
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 01 12:44:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 01 Nov 2021 12:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.219165.379846 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mhWff-0006dS-Kw; Mon, 01 Nov 2021 12:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 219165.379846; Mon, 01 Nov 2021 12:44:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mhWff-0006dK-Hs; Mon, 01 Nov 2021 12:44:15 +0000
Received: by outflank-mailman (input) for mailman id 219165;
 Mon, 01 Nov 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 1mhWfe-0006d7-G1
 for xen-changelog@lists.xenproject.org; Mon, 01 Nov 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 1mhWfe-0007gS-F5
 for xen-changelog@lists.xenproject.org; Mon, 01 Nov 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 1mhWfe-0007C7-E9
 for xen-changelog@lists.xenproject.org; Mon, 01 Nov 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=kyvjrsacmDQJawa07r1tqdH5DICc9Q6sO0jGeGAmtzA=; b=tTzgnod9AwVealJuQHFpfQPYkb
	2cvJDqqd/DfYGLYUFQN+XzSQ/KVRFrI9aNETaiCyVF0lJXGOiwnOfA5egtGzfhwiMmI0mxJ/SDVil
	J7GngC70nzUr+XjEfmx/3/zG6x86jjhtOY4G+By54t5L77cYoq6ItIWpojFHKAzs86yc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] README, xen/Makefile: Change version to 4.16-rc
Message-Id: <E1mhWfe-0007C7-E9@xenbits.xenproject.org>
Date: Mon, 01 Nov 2021 12:44:14 +0000

commit 9f8434d77859462ad98a51ec49ad8e23769d9b10
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Mon Nov 1 12:36:26 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 1 12:36:26 2021 +0000

    README, xen/Makefile: Change version to 4.16-rc
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 README       | 10 +++++-----
 xen/Makefile |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/README b/README
index 562b808080..a626e56436 100644
--- a/README
+++ b/README
@@ -1,9 +1,9 @@
 ############################################################
-__  __                                _        _     _
-\ \/ /___ _ __        _   _ _ __  ___| |_ __ _| |__ | | ___
- \  // _ \ '_ \ _____| | | | '_ \/ __| __/ _` | '_ \| |/ _ \
- /  \  __/ | | |_____| |_| | | | \__ \ || (_| | |_) | |  __/
-/_/\_\___|_| |_|      \__,_|_| |_|___/\__\__,_|_.__/|_|\___|
+__  __            _  _    _  __
+\ \/ /___ _ __   | || |  / |/ /_        _ __ ___
+ \  // _ \ '_ \  | || |_ | | '_ \ _____| '__/ __|
+ /  \  __/ | | | |__   _|| | (_) |_____| | | (__
+/_/\_\___|_| |_|    |_|(_)_|\___/      |_|  \___|
 
 ############################################################
 
diff --git a/xen/Makefile b/xen/Makefile
index a3189eb47c..2fc83f266b 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 16
-export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= -rc$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 02 11:44:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Nov 2021 11:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.220137.381278 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mhsCw-0004xS-LU; Tue, 02 Nov 2021 11:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 220137.381278; Tue, 02 Nov 2021 11:44:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mhsCw-0004xK-IT; Tue, 02 Nov 2021 11:44:02 +0000
Received: by outflank-mailman (input) for mailman id 220137;
 Tue, 02 Nov 2021 11:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mhsCv-0004xE-Hz
 for xen-changelog@lists.xenproject.org; Tue, 02 Nov 2021 11: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 1mhsCv-00048W-G4
 for xen-changelog@lists.xenproject.org; Tue, 02 Nov 2021 11:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mhsCv-0000Nj-Ew
 for xen-changelog@lists.xenproject.org; Tue, 02 Nov 2021 11: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=DaVYLfjLzlfwCnLr/QuVZe5SPJsPC2Ev/4GtVD22/80=; b=NLnknD+4sylAMdxukptcieGI4E
	x7KkWGPFF+y4aU23K3l3/omUVPWDH3arJpQJw1GWTLatk2EQOO6iH4p5ddzApCgEJfX4OZ/fs2h0R
	VZOEG3ziAKjtDMAnHIVEhi/P2WS7wpqe/LWdfc1ilRoW84WVGjPwDXVeNVkGOVq6DywQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Config.mk: pin QEMU_UPSTREAM_REVISION (prep for Xen 4.16 RC1)
Message-Id: <E1mhsCv-0000Nj-Ew@xenbits.xenproject.org>
Date: Tue, 02 Nov 2021 11:44:01 +0000

commit c9ce6afbf2d7772f47fc572bb7fc9555724927ed
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Mon Nov 1 12:33:54 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 1 12:33:54 2021 +0000

    Config.mk: pin QEMU_UPSTREAM_REVISION (prep for Xen 4.16 RC1)
    
    Signed-off-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 6587c7d626..6be010c7ce 100644
--- a/Config.mk
+++ b/Config.mk
@@ -239,7 +239,7 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
-QEMU_UPSTREAM_REVISION ?= master
+QEMU_UPSTREAM_REVISION ?= b6e539830bf45e2d7a6bd86ddfdf003088b173b0
 MINIOS_UPSTREAM_REVISION ?= 9f09744aa3e5982a083ecf8e9cd2123f477081f9
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Nov 02 11:44:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 02 Nov 2021 11:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.220139.381293 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mhsD6-0005Gp-UE; Tue, 02 Nov 2021 11:44:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 220139.381293; Tue, 02 Nov 2021 11:44:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mhsD6-0005Gg-RR; Tue, 02 Nov 2021 11:44:12 +0000
Received: by outflank-mailman (input) for mailman id 220139;
 Tue, 02 Nov 2021 11:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mhsD5-0005Fy-KH
 for xen-changelog@lists.xenproject.org; Tue, 02 Nov 2021 11:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mhsD5-00048a-JN
 for xen-changelog@lists.xenproject.org; Tue, 02 Nov 2021 11:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mhsD5-0000OU-IQ
 for xen-changelog@lists.xenproject.org; Tue, 02 Nov 2021 11: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=vsdc3ZJGeIB3v0VV6yLJ4V47h5wWnY7sS1VPcDE4S14=; b=wJctzpO13neiBgaavIPDru/YqN
	wErGS1V/h6GO9BkdTcKW8PzfyopoPV4R7YkL/Z+g9dT6KLY3qffF3AmxD0ZaKYmCpNDCNyeEsZbbt
	6xld4fafmzArmrjhzoV2N3diQyz/HYDLXE9KBaFpEkH+jnP6OneF9uBNU/RpN7DXl8Wc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] README, xen/Makefile: Change version to 4.16-rc
Message-Id: <E1mhsD5-0000OU-IQ@xenbits.xenproject.org>
Date: Tue, 02 Nov 2021 11:44:11 +0000

commit 9f8434d77859462ad98a51ec49ad8e23769d9b10
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Mon Nov 1 12:36:26 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 1 12:36:26 2021 +0000

    README, xen/Makefile: Change version to 4.16-rc
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 README       | 10 +++++-----
 xen/Makefile |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/README b/README
index 562b808080..a626e56436 100644
--- a/README
+++ b/README
@@ -1,9 +1,9 @@
 ############################################################
-__  __                                _        _     _
-\ \/ /___ _ __        _   _ _ __  ___| |_ __ _| |__ | | ___
- \  // _ \ '_ \ _____| | | | '_ \/ __| __/ _` | '_ \| |/ _ \
- /  \  __/ | | |_____| |_| | | | \__ \ || (_| | |_) | |  __/
-/_/\_\___|_| |_|      \__,_|_| |_|___/\__\__,_|_.__/|_|\___|
+__  __            _  _    _  __
+\ \/ /___ _ __   | || |  / |/ /_        _ __ ___
+ \  // _ \ '_ \  | || |_ | | '_ \ _____| '__/ __|
+ /  \  __/ | | | |__   _|| | (_) |_____| | | (__
+/_/\_\___|_| |_|    |_|(_)_|\___/      |_|  \___|
 
 ############################################################
 
diff --git a/xen/Makefile b/xen/Makefile
index a3189eb47c..2fc83f266b 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 16
-export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= -rc$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Nov 03 09:22:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Nov 2021 09:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.220656.381997 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1miCT7-00088X-M9; Wed, 03 Nov 2021 09:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 220656.381997; Wed, 03 Nov 2021 09:22:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1miCT7-00088P-J5; Wed, 03 Nov 2021 09:22:05 +0000
Received: by outflank-mailman (input) for mailman id 220656;
 Wed, 03 Nov 2021 09: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 1miCT6-00088J-DZ
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 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 1miCT6-00055C-B2
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 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 1miCT6-0006VV-A5
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 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=pyE4eavG7v5OTFABD+OU55h0/RSrnDbFXEnodM6Lyhw=; b=7GtGhFXUxba6pX8Y3YsNEAL0y1
	spaqccHpeYlRYGq5LMMx7BqNdRLkIYgUc26OK3FA/7p8nC0SL0o96D2vF4KmqYhpS4adKnMV7AOqm
	gC6O6mvw5+X6XMgwiZSjWUwUycpnDIr3iRgsJoDurlCBhgYX2aKXtCzpOPUYM/5aNTvs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: de-duplicate MONITOR/MWAIT CPUID-related definitions
Message-Id: <E1miCT6-0006VV-A5@xenbits.xenproject.org>
Date: Wed, 03 Nov 2021 09:22:04 +0000

commit e41a5bae01f08f7084cb5668d9922b498edbc403
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 3 10:17:47 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 3 10:17:47 2021 +0100

    x86: de-duplicate MONITOR/MWAIT CPUID-related definitions
    
    As of 724b55f48a6c ("x86: introduce MWAIT-based, ACPI-less CPU idle
    driver") they (also) live in asm/mwait.h; no idea how I missed the
    duplicates back at the time.
    
    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/acpi/lib.c          | 1 +
 xen/include/asm-x86/cpufeature.h | 4 ----
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/xen/arch/x86/acpi/lib.c b/xen/arch/x86/acpi/lib.c
index a22414a05c..b66e7338e7 100644
--- a/xen/arch/x86/acpi/lib.c
+++ b/xen/arch/x86/acpi/lib.c
@@ -24,6 +24,7 @@
 #include <xen/acpi.h>
 #include <asm/apic.h>
 #include <asm/fixmap.h>
+#include <asm/mwait.h>
 
 u32 __read_mostly acpi_smi_cmd;
 u8 __read_mostly acpi_enable_value;
diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h
index 802d9257b0..ba0fe7c0aa 100644
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -22,10 +22,6 @@
 #define cpu_has(c, bit)		test_bit(bit, (c)->x86_capability)
 #define boot_cpu_has(bit)	test_bit(bit, boot_cpu_data.x86_capability)
 
-#define CPUID_MWAIT_LEAF                5
-#define CPUID5_ECX_EXTENSIONS_SUPPORTED 0x1
-#define CPUID5_ECX_INTERRUPT_BREAK      0x2
-
 #define CPUID_PM_LEAF                    6
 #define CPUID6_ECX_APERFMPERF_CAPABILITY 0x1
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 03 09:22:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Nov 2021 09:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.220657.382001 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1miCTH-0008AK-O6; Wed, 03 Nov 2021 09:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 220657.382001; Wed, 03 Nov 2021 09:22:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1miCTH-0008AC-Kh; Wed, 03 Nov 2021 09:22:15 +0000
Received: by outflank-mailman (input) for mailman id 220657;
 Wed, 03 Nov 2021 09:22:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1miCTG-0008A1-FK
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 2021 09: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 1miCTG-00055G-EY
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 2021 09:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1miCTG-0006WQ-Db
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 2021 09: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=Sv3ZRUf7cbyBR+eqcb28j7ERriGVGS8mS8cwEfILX0g=; b=RLNcb0tkK2q1sOBgspdh+oufB2
	echVfh2+ulcgfqlNWSiiK/Y8C1+5texkcWbUyydhddObnwrbd8ONSsJal+Lp7N/8l9GQhd8xUF3EH
	huWpjsTKGXWfzK6wcs3197ZqbbCYxT0+GeSh2etGJwyMpoCbZvRmBaNdnteee/3Za+7Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] update system time immediately when VCPUOP_register_vcpu_info
Message-Id: <E1miCTG-0006WQ-Db@xenbits.xenproject.org>
Date: Wed, 03 Nov 2021 09:22:14 +0000

commit b67f09721f136cc3a9afcb6a82466d1bd27aa6c0
Author:     Dongli Zhang <dongli.zhang@oracle.com>
AuthorDate: Wed Nov 3 10:19:06 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 3 10:19:06 2021 +0100

    update system time immediately when VCPUOP_register_vcpu_info
    
    The guest may access the pv vcpu_time_info immediately after
    VCPUOP_register_vcpu_info. This is to borrow the idea of
    VCPUOP_register_vcpu_time_memory_area, where the
    force_update_vcpu_system_time() is called immediately when the new memory
    area is registered.
    
    Otherwise, we may observe clock drift at the VM side if the VM accesses
    the clocksource immediately after VCPUOP_register_vcpu_info().
    
    Reference: https://lists.xenproject.org/archives/html/xen-devel/2021-10/msg00571.html
    Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/arm/time.c        | 5 +++++
 xen/common/domain.c        | 2 ++
 xen/include/asm-arm/time.h | 2 ++
 3 files changed, 9 insertions(+)

diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
index 7dbd363537..dec53b5f7d 100644
--- a/xen/arch/arm/time.c
+++ b/xen/arch/arm/time.c
@@ -351,6 +351,11 @@ void update_vcpu_system_time(struct vcpu *v)
     /* XXX update shared_info->wc_* */
 }
 
+void force_update_vcpu_system_time(struct vcpu *v)
+{
+    update_vcpu_system_time(v);
+}
+
 void domain_set_time_offset(struct domain *d, int64_t time_offset_seconds)
 {
     d->time_offset.seconds = time_offset_seconds;
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 8b53c49d1e..d71fcab88c 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1704,6 +1704,8 @@ long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg)
         rc = map_vcpu_info(v, info.mfn, info.offset);
         domain_unlock(d);
 
+        force_update_vcpu_system_time(v);
+
         break;
     }
 
diff --git a/xen/include/asm-arm/time.h b/xen/include/asm-arm/time.h
index 6b8fd839dd..4b401c1110 100644
--- a/xen/include/asm-arm/time.h
+++ b/xen/include/asm-arm/time.h
@@ -105,6 +105,8 @@ extern uint64_t ns_to_ticks(s_time_t ns);
 
 void preinit_xen_time(void);
 
+void force_update_vcpu_system_time(struct vcpu *v);
+
 #endif /* __ARM_TIME_H__ */
 /*
  * Local variables:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 03 12:55:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Nov 2021 12:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.220882.382319 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1miFnF-00015f-W7; Wed, 03 Nov 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 220882.382319; Wed, 03 Nov 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 1miFnF-00015X-T8; Wed, 03 Nov 2021 12:55:05 +0000
Received: by outflank-mailman (input) for mailman id 220882;
 Wed, 03 Nov 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 1miFnE-00013i-KE
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 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 1miFnE-0000MN-JM
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 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 1miFnE-0005Fg-IG
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 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=IcMhc9ZG9TQmP1J5a3i2C2rIpoB8+4W/GP5ma0u+u7o=; b=CHIjyWwWbXeQlk/DwYYYNoOZAW
	ZM21oa/Mdu+nQBp248JzikQcP8rUCA6FJpO4QZYZ+BZebWbADnxV3brIyFpjHTyW7XLdyDsabNGlL
	zsoz3egPtaaFKBWAbut6PnFBunjGZZfM2Z5lgl1Shc8QHybaaXel3OCnlbjU0htmzCTk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: disable building qemu-trad per default
Message-Id: <E1miFnE-0005Fg-IG@xenbits.xenproject.org>
Date: Wed, 03 Nov 2021 12:55:04 +0000

commit ce309942c791628ff42082d1b74bfaeaa5267ae0
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Sep 10 07:55:18 2021 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Wed Nov 3 12:54:40 2021 +0000

    tools: disable building qemu-trad per default
    
    Using qemu-traditional as device model is deprecated for some time now.
    
    So change the default for building it to "disable". This will affect
    ioemu-stubdom, too, as there is a direct dependency between the two.
    
    Today it is possible to use a PVH/HVM Linux-based stubdom as device
    model. Additionally using ioemu-stubdom isn't really helping for
    security, as it requires to run a very old and potentially buggy qemu
    version in a PV domain. This is adding probably more security problems
    than it is removing by using a stubdom.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Acked-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 CHANGELOG.md         |  3 +++
 stubdom/configure    |  8 --------
 stubdom/configure.ac |  8 +-------
 tools/configure      | 17 ++---------------
 tools/configure.ac   | 13 +------------
 5 files changed, 7 insertions(+), 42 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e7107ac3de..e5ab49e779 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    or by passing "iommu=quarantine=scratch-page" on the hypervisor command line.
  - pv-grub stubdoms will no longer be built per default. In order to be able to use pv-grub
    configure needs to be called with "--enable-pv-grub" as parameter.
+ - qemu-traditional based device models (both, qemu-traditional and ioemu-stubdom) will
+   no longer be built per default. In order to be able to use those, configure needs to
+   be called with "--enable-qemu-traditional" as parameter.
 
 ## [4.15.0 UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - TBD
 
diff --git a/stubdom/configure b/stubdom/configure
index df31532abb..07b709f998 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -2286,14 +2286,6 @@ fi
 # Check whether --enable-qemu-traditional was given.
 if test "${enable_qemu_traditional+set}" = set; then :
   enableval=$enable_qemu_traditional;
-else
-
-    case "$host_cpu" in
-        i[3456]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-
 fi
 
 if test "x$enable_qemu_traditional" = "xyes"; then :
diff --git a/stubdom/configure.ac b/stubdom/configure.ac
index a07a1edae5..e20d99edac 100644
--- a/stubdom/configure.ac
+++ b/stubdom/configure.ac
@@ -27,13 +27,7 @@ AX_STUBDOM_DEFAULT_ENABLE([xenstorepvh-stubdom], [xenstorepvh])
 AX_STUBDOM_CONDITIONAL([vtpm-stubdom], [vtpm])
 AX_STUBDOM_CONDITIONAL([vtpmmgr-stubdom], [vtpmmgr])
 
-AC_ARG_ENABLE([qemu-traditional],,,[
-    case "$host_cpu" in
-        i[[3456]]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-])
+AC_ARG_ENABLE([qemu-traditional])
 AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
     qemu_traditional=y],[
     qemu_traditional=n
diff --git a/tools/configure b/tools/configure
index 33814b24b3..8bf8fe75b8 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1502,8 +1502,8 @@ Optional Features:
   --disable-seabios       Disable SeaBIOS (default is ENABLED)
   --disable-golang        Disable Go tools (default is ENABLED)
   --enable-qemu-traditional
-                          Enable qemu traditional device model, (DEFAULT is on
-                          for Linux or NetBSD x86, otherwise off)
+                          Enable qemu traditional device model, (DEFAULT is
+                          off)
   --enable-rombios        Enable ROMBIOS, (DEFAULT is on if qemu-traditional
                           is enabled, otherwise off)
   --disable-ipxe          Enable in-tree IPXE, (DEFAULT is on if rombios is
@@ -4287,19 +4287,6 @@ LINUX_BACKEND_MODULES="`eval echo $LINUX_BACKEND_MODULES`"
 # Check whether --enable-qemu-traditional was given.
 if test "${enable_qemu_traditional+set}" = set; then :
   enableval=$enable_qemu_traditional;
-else
-
-    case "$host_cpu" in
-        i[3456]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-    case "$host_os" in
-        freebsd*)
-           enable_qemu_traditional="no";;
-    esac
-
-
 fi
 
 if test "x$enable_qemu_traditional" = "xyes"; then :
diff --git a/tools/configure.ac b/tools/configure.ac
index 6414fcbb44..a713fd34d6 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -120,18 +120,7 @@ AC_SUBST(LINUX_BACKEND_MODULES)
 
 AC_ARG_ENABLE([qemu-traditional],
     AS_HELP_STRING([--enable-qemu-traditional],
-                   [Enable qemu traditional device model, (DEFAULT is on for Linux or NetBSD x86, otherwise off)]),,[
-    case "$host_cpu" in
-        i[[3456]]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-    case "$host_os" in
-        freebsd*)
-           enable_qemu_traditional="no";;
-    esac
-
-])
+                   [Enable qemu traditional device model, (DEFAULT is off)]))
 AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
 AC_DEFINE([HAVE_QEMU_TRADITIONAL], [1], [Qemu traditional enabled])
     qemu_traditional=y],[
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 03 13:11:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Nov 2021 13:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.220897.382334 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1miG2k-0003iI-IE; Wed, 03 Nov 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 220897.382334; Wed, 03 Nov 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 1miG2k-0003iA-FD; Wed, 03 Nov 2021 13:11:06 +0000
Received: by outflank-mailman (input) for mailman id 220897;
 Wed, 03 Nov 2021 13: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 1miG2i-0003i4-Od
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 2021 13: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 1miG2i-0000f1-MR
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 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 1miG2i-0006Wu-Kt
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 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=9a753uQRfLp+GW96S7Prk3YQuPApmsjSbGPnlNw2pb4=; b=Qaz3c0ZmFLe/uagxjeCeoBVcO+
	OS60Ku9UV+QiO3vA0jn/eLyy3gBoCR2XZskEYENOZkUVQ2yZM84BbkXm0X/d+rG587Z2YQHY7xrMQ
	iUjPSqcZqY34bYH9pZOfXyAl2lu7Sj6lmTHsC54ATa+wskWT1iZGkLgs8VFrjyvsIurs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shstk: Fix use of shadow stacks with XPTI active
Message-Id: <E1miG2i-0006Wu-Kt@xenbits.xenproject.org>
Date: Wed, 03 Nov 2021 13:11:04 +0000

commit b2851580b1f2ff121737a37cb25a370d7692ae3b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Nov 1 20:45:26 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Nov 3 13:08:42 2021 +0000

    x86/shstk: Fix use of shadow stacks with XPTI active
    
    The call to setup_cpu_root_pgt(0) in smp_prepare_cpus() is too early.  It
    clones the BSP's stack while the .data mapping is still in use, causing all
    mappings to be fully read read/write (and with no guard pages either).  This
    ultimately causes #DF when trying to enter the dom0 kernel for the first time.
    
    Defer setting up BSPs XPTI pagetable until reinit_bsp_stack() after we've set
    up proper shadow stack permissions.
    
    Fixes: 60016604739b ("x86/shstk: Rework the stack layout to support shadow stacks")
    Fixes: b60ab42db2f0 ("x86/shstk: Activate Supervisor Shadow Stacks")
    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/setup.c   | 5 +++++
 xen/arch/x86/smpboot.c | 9 ++-------
 xen/include/xen/smp.h  | 1 +
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index b101565f14..fea86530f9 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -666,6 +666,7 @@ static void noreturn init_done(void)
 static void __init noreturn reinit_bsp_stack(void)
 {
     unsigned long *stack = (void*)(get_stack_bottom() & ~(STACK_SIZE - 1));
+    int rc;
 
     /* Update TSS and ISTs */
     load_system_tables();
@@ -676,6 +677,10 @@ static void __init noreturn reinit_bsp_stack(void)
     stack_base[0] = stack;
     memguard_guard_stack(stack);
 
+    rc = setup_cpu_root_pgt(0);
+    if ( rc )
+        panic("Error %d setting up PV root page table\n", rc);
+
     if ( IS_ENABLED(CONFIG_XEN_SHSTK) && cpu_has_xen_shstk )
     {
         wrmsrl(MSR_PL0_SSP,
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 0dce1ae872..329cfdb6c9 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -821,7 +821,7 @@ static root_pgentry_t common_pgt;
 
 extern const char _stextentry[], _etextentry[];
 
-static int setup_cpu_root_pgt(unsigned int cpu)
+int setup_cpu_root_pgt(unsigned int cpu)
 {
     root_pgentry_t *rpt;
     unsigned int off;
@@ -1138,8 +1138,6 @@ static struct notifier_block cpu_smpboot_nfb = {
 
 void __init smp_prepare_cpus(void)
 {
-    int rc;
-
     register_cpu_notifier(&cpu_smpboot_nfb);
 
     mtrr_aps_sync_begin();
@@ -1153,10 +1151,7 @@ void __init smp_prepare_cpus(void)
 
     stack_base[0] = (void *)((unsigned long)stack_start & ~(STACK_SIZE - 1));
 
-    rc = setup_cpu_root_pgt(0);
-    if ( rc )
-        panic("Error %d setting up PV root page table\n", rc);
-    if ( per_cpu(root_pgt, 0) )
+    if ( opt_xpti_hwdom || opt_xpti_domu )
     {
         get_cpu_info()->pv_cr3 = 0;
 
diff --git a/xen/include/xen/smp.h b/xen/include/xen/smp.h
index d5a3644611..0a9219173f 100644
--- a/xen/include/xen/smp.h
+++ b/xen/include/xen/smp.h
@@ -70,5 +70,6 @@ int alloc_cpu_id(void);
 extern void *stack_base[NR_CPUS];
 
 void initialize_cpu_data(unsigned int cpu);
+int setup_cpu_root_pgt(unsigned int cpu);
 
 #endif /* __XEN_SMP_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 03 15:22:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Nov 2021 15:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.221007.382506 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1miI5W-0007Ib-GM; Wed, 03 Nov 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 221007.382506; Wed, 03 Nov 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 1miI5W-0007IT-D9; Wed, 03 Nov 2021 15:22:06 +0000
Received: by outflank-mailman (input) for mailman id 221007;
 Wed, 03 Nov 2021 15:22:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1miI5U-0007IE-Ht
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 2021 15:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1miI5U-0003FQ-GH
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 2021 15:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1miI5U-00078K-FY
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 2021 15:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A6LUObxXIRwiTMsayIqn9Zv/oXwrcAVJLNRFcLvSg7M=; b=0SnsL0vgX3fDlYE724r2foDD/A
	HXyM9h6R8BK1IU+oHGmbSnlS1Be0b2/pCb8UQtAyQEJl18iD/PNDbBQyeiXRNQWb2r21CyLyUGrF6
	3NIq86NDW8j+3W26CwE6rjmL0v95g6gsOrbLuv60pKrZQK9Fxv1uKqwa0I6IV2R6mjQA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Revert "tools: disable building qemu-trad per default"
Message-Id: <E1miI5U-00078K-FY@xenbits.xenproject.org>
Date: Wed, 03 Nov 2021 15:22:04 +0000

commit f6507f1a11cb91f527c7ffdffb8e35289a58d0f5
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Wed Nov 3 15:20:02 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Wed Nov 3 15:20:41 2021 +0000

    Revert "tools: disable building qemu-trad per default"
    
    Unfortunately this breaks the gitlab CI.  See mails on-list.
    
    This reverts commit ce309942c791628ff42082d1b74bfaeaa5267ae0.
---
 CHANGELOG.md         |  3 ---
 stubdom/configure    |  8 ++++++++
 stubdom/configure.ac |  8 +++++++-
 tools/configure      | 17 +++++++++++++++--
 tools/configure.ac   | 13 ++++++++++++-
 5 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e5ab49e779..e7107ac3de 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,9 +18,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    or by passing "iommu=quarantine=scratch-page" on the hypervisor command line.
  - pv-grub stubdoms will no longer be built per default. In order to be able to use pv-grub
    configure needs to be called with "--enable-pv-grub" as parameter.
- - qemu-traditional based device models (both, qemu-traditional and ioemu-stubdom) will
-   no longer be built per default. In order to be able to use those, configure needs to
-   be called with "--enable-qemu-traditional" as parameter.
 
 ## [4.15.0 UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - TBD
 
diff --git a/stubdom/configure b/stubdom/configure
index 07b709f998..df31532abb 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -2286,6 +2286,14 @@ fi
 # Check whether --enable-qemu-traditional was given.
 if test "${enable_qemu_traditional+set}" = set; then :
   enableval=$enable_qemu_traditional;
+else
+
+    case "$host_cpu" in
+        i[3456]86|x86_64)
+           enable_qemu_traditional="yes";;
+        *) enable_qemu_traditional="no";;
+    esac
+
 fi
 
 if test "x$enable_qemu_traditional" = "xyes"; then :
diff --git a/stubdom/configure.ac b/stubdom/configure.ac
index e20d99edac..a07a1edae5 100644
--- a/stubdom/configure.ac
+++ b/stubdom/configure.ac
@@ -27,7 +27,13 @@ AX_STUBDOM_DEFAULT_ENABLE([xenstorepvh-stubdom], [xenstorepvh])
 AX_STUBDOM_CONDITIONAL([vtpm-stubdom], [vtpm])
 AX_STUBDOM_CONDITIONAL([vtpmmgr-stubdom], [vtpmmgr])
 
-AC_ARG_ENABLE([qemu-traditional])
+AC_ARG_ENABLE([qemu-traditional],,,[
+    case "$host_cpu" in
+        i[[3456]]86|x86_64)
+           enable_qemu_traditional="yes";;
+        *) enable_qemu_traditional="no";;
+    esac
+])
 AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
     qemu_traditional=y],[
     qemu_traditional=n
diff --git a/tools/configure b/tools/configure
index 8bf8fe75b8..33814b24b3 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1502,8 +1502,8 @@ Optional Features:
   --disable-seabios       Disable SeaBIOS (default is ENABLED)
   --disable-golang        Disable Go tools (default is ENABLED)
   --enable-qemu-traditional
-                          Enable qemu traditional device model, (DEFAULT is
-                          off)
+                          Enable qemu traditional device model, (DEFAULT is on
+                          for Linux or NetBSD x86, otherwise off)
   --enable-rombios        Enable ROMBIOS, (DEFAULT is on if qemu-traditional
                           is enabled, otherwise off)
   --disable-ipxe          Enable in-tree IPXE, (DEFAULT is on if rombios is
@@ -4287,6 +4287,19 @@ LINUX_BACKEND_MODULES="`eval echo $LINUX_BACKEND_MODULES`"
 # Check whether --enable-qemu-traditional was given.
 if test "${enable_qemu_traditional+set}" = set; then :
   enableval=$enable_qemu_traditional;
+else
+
+    case "$host_cpu" in
+        i[3456]86|x86_64)
+           enable_qemu_traditional="yes";;
+        *) enable_qemu_traditional="no";;
+    esac
+    case "$host_os" in
+        freebsd*)
+           enable_qemu_traditional="no";;
+    esac
+
+
 fi
 
 if test "x$enable_qemu_traditional" = "xyes"; then :
diff --git a/tools/configure.ac b/tools/configure.ac
index a713fd34d6..6414fcbb44 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -120,7 +120,18 @@ AC_SUBST(LINUX_BACKEND_MODULES)
 
 AC_ARG_ENABLE([qemu-traditional],
     AS_HELP_STRING([--enable-qemu-traditional],
-                   [Enable qemu traditional device model, (DEFAULT is off)]))
+                   [Enable qemu traditional device model, (DEFAULT is on for Linux or NetBSD x86, otherwise off)]),,[
+    case "$host_cpu" in
+        i[[3456]]86|x86_64)
+           enable_qemu_traditional="yes";;
+        *) enable_qemu_traditional="no";;
+    esac
+    case "$host_os" in
+        freebsd*)
+           enable_qemu_traditional="no";;
+    esac
+
+])
 AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
 AC_DEFINE([HAVE_QEMU_TRADITIONAL], [1], [Qemu traditional enabled])
     qemu_traditional=y],[
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 03 18:22:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Nov 2021 18:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.221116.382656 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1miKth-00061L-W1; Wed, 03 Nov 2021 18:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 221116.382656; Wed, 03 Nov 2021 18:22:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1miKth-00061D-T1; Wed, 03 Nov 2021 18:22:05 +0000
Received: by outflank-mailman (input) for mailman id 221116;
 Wed, 03 Nov 2021 18: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 1miKth-000617-1n
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 2021 18: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 1miKtg-0006sk-Sx
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 2021 18:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1miKtg-0007DE-Rf
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 2021 18: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=tuYdJucpffDr8DTybzypzjKfXpWMBHml8dKMaUPLXcE=; b=QTIs+Qy62NDTf/xfW+HQpRYgbn
	iB1ny7d7WecSJaatxJVSP0YFILLbKFDLZ7/PXy1Q791Z8XeDlqPC+MPjrgEbIlukBSZ2bHjUPRMxh
	1oJ9v88dA4rbopf7kGSEgsKjQFb07dKAU32cFGmv3ByTN4GEpQexKomIeZP6iaycJJDk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: fix SBDF calculation for vPCI MMIO handlers
Message-Id: <E1miKtg-0007DE-Rf@xenbits.xenproject.org>
Date: Wed, 03 Nov 2021 18:22:04 +0000

commit 3231ddf9dc384a386df43fd1c0a0bcbba9d79569
Author:     Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
AuthorDate: Tue Nov 2 13:20:41 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Nov 3 18:15:21 2021 +0000

    xen/arm: fix SBDF calculation for vPCI MMIO handlers
    
    While in vPCI MMIO trap handlers for the guest PCI host bridge it is not
    enough for SBDF translation to simply call VPCI_ECAM_BDF(info->gpa) as
    the base address may not be aligned in the way that the translation
    always work. If not adjusted with respect to the base address it may not be
    able to properly convert SBDF.
    Fix this by adjusting the gpa with respect to the host bridge base address
    in a way as it is done for x86.
    
    Please note, that this change is not strictly required given the current
    value of GUEST_VPCI_ECAM_BASE which has bits 0 to 27 clear, but could cause
    issues if such value is changed, or when handlers for dom0 ECAM
    regions are added as those will be mapped over existing hardware
    regions that could use non-aligned base addresses.
    
    Fixes: d59168dc05a5 ("xen/arm: Enable the existing x86 virtual PCI support for ARM")
    
    Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/arm/vpci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/vpci.c b/xen/arch/arm/vpci.c
index 8f40a0dec6..23f45386f4 100644
--- a/xen/arch/arm/vpci.c
+++ b/xen/arch/arm/vpci.c
@@ -24,7 +24,7 @@ static int vpci_mmio_read(struct vcpu *v, mmio_info_t *info,
     unsigned long data;
 
     /* We ignore segment part and always handle segment 0 */
-    sbdf.sbdf = VPCI_ECAM_BDF(info->gpa);
+    sbdf.sbdf = VPCI_ECAM_BDF(info->gpa - GUEST_VPCI_ECAM_BASE);
 
     if ( vpci_ecam_read(sbdf, ECAM_REG_OFFSET(info->gpa),
                         1U << info->dabt.size, &data) )
@@ -44,7 +44,7 @@ static int vpci_mmio_write(struct vcpu *v, mmio_info_t *info,
     pci_sbdf_t sbdf;
 
     /* We ignore segment part and always handle segment 0 */
-    sbdf.sbdf = VPCI_ECAM_BDF(info->gpa);
+    sbdf.sbdf = VPCI_ECAM_BDF(info->gpa - GUEST_VPCI_ECAM_BASE);
 
     return vpci_ecam_write(sbdf, ECAM_REG_OFFSET(info->gpa),
                            1U << info->dabt.size, r);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 03 19:22:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 03 Nov 2021 19:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.221150.382707 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1miLpl-0005DM-Aq; Wed, 03 Nov 2021 19:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 221150.382707; Wed, 03 Nov 2021 19:22:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1miLpl-0005DE-7n; Wed, 03 Nov 2021 19:22:05 +0000
Received: by outflank-mailman (input) for mailman id 221150;
 Wed, 03 Nov 2021 19: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 1miLpk-0005D8-HU
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 2021 19: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 1miLpk-0007s5-EC
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 2021 19:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1miLpk-0002oH-DA
 for xen-changelog@lists.xenproject.org; Wed, 03 Nov 2021 19: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=+2h5EMpD0apJ8eSeHc41w6iox/RSw15zwWYV6YEsX0g=; b=UZJpgx8Y3oOXgPt4htZUtBbW/n
	LVXs/kZGoO64a+IzPShdNQeIAsnoUtM5OFKnazTqRThtwqaY10I/Gi+yz+6thIh2aBmvdC7AON+++
	iBEH+X0aQOx5SlW2an5OWjMxMbFt2AYdyTSVKiE1N9bIBTuJnt6pKlTMOVllY8jyBaJI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Fix typo in do_entry_CP()
Message-Id: <E1miLpk-0002oH-DA@xenbits.xenproject.org>
Date: Wed, 03 Nov 2021 19:22:04 +0000

commit 512863ed238d7390f74d43f0ba298b1dfa8f4803
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 28 21:55:56 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Nov 3 19:13:17 2021 +0000

    x86/traps: Fix typo in do_entry_CP()
    
    The call to debugger_trap_entry() should pass the correct vector.  The
    break-for-gdbsx logic is in practice unreachable because PV guests can't
    generate #CP, but it will interfere with anyone inserting custom debugging
    into debugger_trap_entry().
    
    Fixes: 5ad05b9c2490 ("x86/traps: Implement #CP handler and extend #PF for shadow stacks")
    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/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 79fd276a41..d483aa91f2 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2134,7 +2134,7 @@ void do_entry_CP(struct cpu_user_regs *regs)
     const char *err = "??";
     unsigned int ec = regs->error_code;
 
-    if ( debugger_trap_entry(TRAP_debug, regs) )
+    if ( debugger_trap_entry(X86_EXC_CP, regs) )
         return;
 
     /* Decode ec if possible */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Nov 04 07:44:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Nov 2021 07:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.221273.382902 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1miXPn-0006YJ-AD; Thu, 04 Nov 2021 07:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 221273.382902; Thu, 04 Nov 2021 07:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1miXPn-0006YB-78; Thu, 04 Nov 2021 07:44:03 +0000
Received: by outflank-mailman (input) for mailman id 221273;
 Thu, 04 Nov 2021 07:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1miXPl-0006Y4-UU
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 2021 07:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1miXPl-0006Z1-JQ
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 2021 07:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1miXPl-0005Kk-IT
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 2021 07:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iuPT4bLYpV9po5qCdfqokxH6xon2vwUiYSKo9IG9dVE=; b=DGPYcc2yg7PKpAG4zPkIDqvpPw
	+dkh3r6imMDa5BV9vkcVZDL9+lrRbJKN6IyYRIGob1NxBB6cI3Xfbu/gujgMGEH4whgWUe+JNXZoe
	DlCHGd0OImHnyoJJvF2zGZKKhrVbG9y14tUfO85fYBzb5EPvKraMLwkpxm7kk8r8/hIE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: de-duplicate MONITOR/MWAIT CPUID-related definitions
Message-Id: <E1miXPl-0005Kk-IT@xenbits.xenproject.org>
Date: Thu, 04 Nov 2021 07:44:01 +0000

commit e41a5bae01f08f7084cb5668d9922b498edbc403
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 3 10:17:47 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 3 10:17:47 2021 +0100

    x86: de-duplicate MONITOR/MWAIT CPUID-related definitions
    
    As of 724b55f48a6c ("x86: introduce MWAIT-based, ACPI-less CPU idle
    driver") they (also) live in asm/mwait.h; no idea how I missed the
    duplicates back at the time.
    
    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/acpi/lib.c          | 1 +
 xen/include/asm-x86/cpufeature.h | 4 ----
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/xen/arch/x86/acpi/lib.c b/xen/arch/x86/acpi/lib.c
index a22414a05c..b66e7338e7 100644
--- a/xen/arch/x86/acpi/lib.c
+++ b/xen/arch/x86/acpi/lib.c
@@ -24,6 +24,7 @@
 #include <xen/acpi.h>
 #include <asm/apic.h>
 #include <asm/fixmap.h>
+#include <asm/mwait.h>
 
 u32 __read_mostly acpi_smi_cmd;
 u8 __read_mostly acpi_enable_value;
diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h
index 802d9257b0..ba0fe7c0aa 100644
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -22,10 +22,6 @@
 #define cpu_has(c, bit)		test_bit(bit, (c)->x86_capability)
 #define boot_cpu_has(bit)	test_bit(bit, boot_cpu_data.x86_capability)
 
-#define CPUID_MWAIT_LEAF                5
-#define CPUID5_ECX_EXTENSIONS_SUPPORTED 0x1
-#define CPUID5_ECX_INTERRUPT_BREAK      0x2
-
 #define CPUID_PM_LEAF                    6
 #define CPUID6_ECX_APERFMPERF_CAPABILITY 0x1
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 04 07:44:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Nov 2021 07:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.221274.382906 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1miXPw-0006al-De; Thu, 04 Nov 2021 07:44:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 221274.382906; Thu, 04 Nov 2021 07:44:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1miXPw-0006ac-AB; Thu, 04 Nov 2021 07:44:12 +0000
Received: by outflank-mailman (input) for mailman id 221274;
 Thu, 04 Nov 2021 07:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1miXPv-0006aV-OI
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 2021 07:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1miXPv-0006Z5-NV
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 2021 07:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1miXPv-0005LJ-Lr
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 2021 07: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=VRhKk21Ol2LbLC5b3UvHW+N++iCAfXKkV4h8GeT2DKA=; b=n46a9DRsB9I15xjVzdGTLp1Cxl
	7fKdENYFuWjtkVieKLaaY8XzP0TndfdvbpHOAc3cJ+6Jbd3rEAZiEBmE3XM+rA+eF99eI4Ed6rkQl
	z2gkPrJyzKtSceU2ZntVKqZZjRjwh+qqHjCxM3Nb1BR11PpepsTHzNDbWl2oAAw6C8SI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] update system time immediately when VCPUOP_register_vcpu_info
Message-Id: <E1miXPv-0005LJ-Lr@xenbits.xenproject.org>
Date: Thu, 04 Nov 2021 07:44:11 +0000

commit b67f09721f136cc3a9afcb6a82466d1bd27aa6c0
Author:     Dongli Zhang <dongli.zhang@oracle.com>
AuthorDate: Wed Nov 3 10:19:06 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 3 10:19:06 2021 +0100

    update system time immediately when VCPUOP_register_vcpu_info
    
    The guest may access the pv vcpu_time_info immediately after
    VCPUOP_register_vcpu_info. This is to borrow the idea of
    VCPUOP_register_vcpu_time_memory_area, where the
    force_update_vcpu_system_time() is called immediately when the new memory
    area is registered.
    
    Otherwise, we may observe clock drift at the VM side if the VM accesses
    the clocksource immediately after VCPUOP_register_vcpu_info().
    
    Reference: https://lists.xenproject.org/archives/html/xen-devel/2021-10/msg00571.html
    Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/arm/time.c        | 5 +++++
 xen/common/domain.c        | 2 ++
 xen/include/asm-arm/time.h | 2 ++
 3 files changed, 9 insertions(+)

diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
index 7dbd363537..dec53b5f7d 100644
--- a/xen/arch/arm/time.c
+++ b/xen/arch/arm/time.c
@@ -351,6 +351,11 @@ void update_vcpu_system_time(struct vcpu *v)
     /* XXX update shared_info->wc_* */
 }
 
+void force_update_vcpu_system_time(struct vcpu *v)
+{
+    update_vcpu_system_time(v);
+}
+
 void domain_set_time_offset(struct domain *d, int64_t time_offset_seconds)
 {
     d->time_offset.seconds = time_offset_seconds;
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 8b53c49d1e..d71fcab88c 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1704,6 +1704,8 @@ long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg)
         rc = map_vcpu_info(v, info.mfn, info.offset);
         domain_unlock(d);
 
+        force_update_vcpu_system_time(v);
+
         break;
     }
 
diff --git a/xen/include/asm-arm/time.h b/xen/include/asm-arm/time.h
index 6b8fd839dd..4b401c1110 100644
--- a/xen/include/asm-arm/time.h
+++ b/xen/include/asm-arm/time.h
@@ -105,6 +105,8 @@ extern uint64_t ns_to_ticks(s_time_t ns);
 
 void preinit_xen_time(void);
 
+void force_update_vcpu_system_time(struct vcpu *v);
+
 #endif /* __ARM_TIME_H__ */
 /*
  * Local variables:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 04 13:55:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Nov 2021 13:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.221541.383296 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1midCs-0000np-AC; Thu, 04 Nov 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 221541.383296; Thu, 04 Nov 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 1midCs-0000nh-7F; Thu, 04 Nov 2021 13:55:06 +0000
Received: by outflank-mailman (input) for mailman id 221541;
 Thu, 04 Nov 2021 13: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 1midCq-0000nb-Qe
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 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 1midCq-00051b-Nq
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 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 1midCq-0004jr-MK
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 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=dW+zJTM/daMEsPKFAE4L6XM92RD4R73UzZ97C2nM+AE=; b=Urf2B1ny2tYVixNpSTOGH+BrVq
	HB6cW7a9+zYRCkZqhrpTVxnq1Rkfw2FzbONvEkEpk57ZjtTEi5UXnEhLOA8hNwvA4DtZoEVSDa4Tn
	5BhgVHyPzh6pC3+EbaTMNNkpkLLN+FwGZyzM09U5zpFFKiRBD6b6XU3UJwnChnWtf3HA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/xstate: reset cached register values on resume
Message-Id: <E1midCq-0004jr-MK@xenbits.xenproject.org>
Date: Thu, 04 Nov 2021 13:55:04 +0000

commit f7f4a523927fa4c7598e4647a16bc3e3cf8009d0
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Nov 4 14:42:37 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Nov 4 14:42:37 2021 +0100

    x86/xstate: reset cached register values on resume
    
    set_xcr0() and set_msr_xss() use cached value to avoid setting the
    register to the same value over and over. But suspend/resume implicitly
    reset the registers and since percpu areas are not deallocated on
    suspend anymore, the cache gets stale.
    Reset the cache on resume, to ensure the next write will really hit the
    hardware. Choose value 0, as it will never be a legitimate write to
    those registers - and so, will force write (and cache update).
    
    Note the cache is used io get_xcr0() and get_msr_xss() too, but:
    - set_xcr0() is called few lines below in xstate_init(), so it will
      update the cache with appropriate value
    - get_msr_xss() is not used anywhere - and thus not before any
      set_msr_xss() that will fill the cache
    
    Fixes: aca2a985a55a "xen: don't free percpu areas during suspend"
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/xstate.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 6aaf9a2f15..3b32bdc51c 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -642,6 +642,13 @@ void xstate_init(struct cpuinfo_x86 *c)
         return;
     }
 
+    /*
+     * Zap the cached values to make set_xcr0() and set_msr_xss() really
+     * write it.
+     */
+    this_cpu(xcr0) = 0;
+    this_cpu(xss) = ~0;
+
     cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx);
     feature_mask = (((u64)edx << 32) | eax) & XCNTXT_MASK;
     BUG_ON(!valid_xcr0(feature_mask));
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Nov 04 13:55:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Nov 2021 13:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.221542.383300 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1midD2-0000rE-Bk; Thu, 04 Nov 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 221542.383300; Thu, 04 Nov 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 1midD2-0000r6-8j; Thu, 04 Nov 2021 13:55:16 +0000
Received: by outflank-mailman (input) for mailman id 221542;
 Thu, 04 Nov 2021 13: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 1midD0-0000qy-S3
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 2021 13: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 1midD0-00051l-RK
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 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 1midD0-0004kP-QL
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 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=R8he9iC7UTl7iowt1gmz+ej2aQI25zgC1C9g2CNs0wM=; b=GfpNySq4cB3EO5E2hQbKUXN8nP
	SWPYEr0B8wyI9z/dPMJ/8c+Td2J0w+ocEfvX2VNI3WH6LbiMDbkgtP9CqtUupOwq+7ZkiYe9oxM6Z
	SBv9lTzkSao5rtcL53ovhkTRtY8Tu09sjtHZ3euRDWcrK7fzfxSjLI/y7BWEQYDMUR08=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/IOMMU: mark IOMMU / intremap not in use when ACPI tables are missing
Message-Id: <E1midD0-0004kP-QL@xenbits.xenproject.org>
Date: Thu, 04 Nov 2021 13:55:14 +0000

commit 46c4061cd2bf69e8039021af615c2bdb94e50088
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Nov 4 14:44:01 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Nov 4 14:44:01 2021 +0100

    x86/IOMMU: mark IOMMU / intremap not in use when ACPI tables are missing
    
    x2apic_bsp_setup() gets called ahead of iommu_setup(), and since x2APIC
    mode (physical vs clustered) depends on iommu_intremap, that variable
    needs to be set to off as soon as we know we can't / won't enable
    interrupt remapping, i.e. in particular when parsing of the respective
    ACPI tables failed. Move the turning off of iommu_intremap from AMD
    specific code into acpi_iommu_init(), accompanying it by clearing of
    iommu_enable.
    
    Take the opportunity and also fully skip ACPI table parsing logic on
    VT-d when both "iommu=off" and "iommu=no-intremap" are in effect anyway,
    like was already the case for AMD.
    
    The tag below only references the commit uncovering a pre-existing
    anomaly.
    
    Fixes: d8bd82327b0f ("AMD/IOMMU: obtain IVHD type to use earlier")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  6 ------
 xen/drivers/passthrough/vtd/dmar.c          |  6 +-----
 xen/drivers/passthrough/x86/iommu.c         | 18 ++++++++++++++++++
 xen/include/asm-x86/acpi.h                  |  8 +-------
 4 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index 03228a9952..9642bba43a 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -183,9 +183,6 @@ int __init acpi_ivrs_init(void)
 {
     int rc;
 
-    if ( !iommu_enable && !iommu_intremap )
-        return 0;
-
     rc = amd_iommu_get_supported_ivhd_type();
     if ( rc < 0 )
         return rc;
@@ -193,10 +190,7 @@ int __init acpi_ivrs_init(void)
     ivhd_type = rc;
 
     if ( (amd_iommu_detect_acpi() !=0) || (iommu_found() == 0) )
-    {
-        iommu_intremap = iommu_intremap_off;
         return -ENODEV;
-    }
 
     iommu_init_ops = &_iommu_init_ops;
 
diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index d5ee367599..33a12b2ae9 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -777,11 +777,7 @@ static int __init acpi_parse_dmar(struct acpi_table_header *table)
     dmar = (struct acpi_table_dmar *)table;
     dmar_flags = dmar->flags;
 
-    if ( !iommu_enable && !iommu_intremap )
-    {
-        ret = -EINVAL;
-        goto out;
-    }
+    ASSERT(iommu_enable || iommu_intremap);
 
     if ( !dmar->width )
     {
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index 01dbd9b098..b2284ae001 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -41,6 +41,24 @@ enum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full;
 bool __read_mostly iommu_intpost;
 #endif
 
+void __init acpi_iommu_init(void)
+{
+    int ret;
+
+    if ( !iommu_enable && !iommu_intremap )
+        return;
+
+    ret = acpi_dmar_init();
+    if ( ret == -ENODEV )
+        ret = acpi_ivrs_init();
+
+    if ( ret )
+    {
+        iommu_enable = false;
+        iommu_intremap = iommu_intremap_off;
+    }
+}
+
 int __init iommu_hardware_setup(void)
 {
     struct IO_APIC_route_entry **ioapic_entries = NULL;
diff --git a/xen/include/asm-x86/acpi.h b/xen/include/asm-x86/acpi.h
index 7032f3a001..9a9cc4c240 100644
--- a/xen/include/asm-x86/acpi.h
+++ b/xen/include/asm-x86/acpi.h
@@ -141,16 +141,10 @@ extern u32 x86_acpiid_to_apicid[];
 extern u32 pmtmr_ioport;
 extern unsigned int pmtmr_width;
 
+void acpi_iommu_init(void);
 int acpi_dmar_init(void);
 int acpi_ivrs_init(void);
 
-static inline int acpi_iommu_init(void)
-{
-    int ret = acpi_dmar_init();
-
-    return ret == -ENODEV ? acpi_ivrs_init() : ret;
-}
-
 void acpi_mmcfg_init(void);
 
 /* Incremented whenever we transition through S3. Value is 1 during boot. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Nov 04 13:55:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Nov 2021 13:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.221543.383303 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1midDC-0000u3-D4; Thu, 04 Nov 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 221543.383303; Thu, 04 Nov 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 1midDC-0000tv-AD; Thu, 04 Nov 2021 13:55:26 +0000
Received: by outflank-mailman (input) for mailman id 221543;
 Thu, 04 Nov 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 1midDA-0000ti-Vr
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 2021 13:55:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1midDA-00052J-V3
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 2021 13:55:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1midDA-0004l6-Tf
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 2021 13:55:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Dwf/A0RZI1UVrb4ybhamP8i44ee/vN7MFL+alI2sbVk=; b=JIy/tpeDd5klGSItSqzTuJOzn2
	Q2VErFRNxwfaoNKd7oP/OcFGvH0qzaJ/dCErLfYkiVMMYfDlVN7FaB1UnwE/eTbswMDs3n5QJjM/4
	Q7PI3dHcezXru+X5T+PaLkGFM/E25/2CmwiiuMLyV05kFj6Ix7WI3/Qpti5qBcx1+M5o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/APIC: avoid iommu_supports_x2apic() on error path
Message-Id: <E1midDA-0004l6-Tf@xenbits.xenproject.org>
Date: Thu, 04 Nov 2021 13:55:24 +0000

commit 0f50d1696b3c13cbf0b18fec817fc291d5a30a31
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Nov 4 14:44:43 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Nov 4 14:44:43 2021 +0100

    x86/APIC: avoid iommu_supports_x2apic() on error path
    
    The value it returns may change from true to false in case
    iommu_enable_x2apic() fails and, as a side effect, clears iommu_intremap
    (as can happen at least on AMD). Latch the return value from the first
    invocation to replace the second one.
    
    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/apic.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 8ab8214559..030792cabb 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -865,6 +865,7 @@ void x2apic_ap_setup(void)
 void __init x2apic_bsp_setup(void)
 {
     struct IO_APIC_route_entry **ioapic_entries = NULL;
+    bool iommu_x2apic;
     const char *orig_name;
 
     if ( !cpu_has_x2apic )
@@ -880,7 +881,8 @@ void __init x2apic_bsp_setup(void)
         printk("x2APIC: Already enabled by BIOS: Ignoring cmdline disable.\n");
     }
 
-    if ( iommu_supports_x2apic() )
+    iommu_x2apic = iommu_supports_x2apic();
+    if ( iommu_x2apic )
     {
         if ( (ioapic_entries = alloc_ioapic_entries()) == NULL )
         {
@@ -933,8 +935,11 @@ void __init x2apic_bsp_setup(void)
         printk("Switched to APIC driver %s\n", genapic.name);
 
 restore_out:
-    /* iommu_x2apic_enabled cannot be used here in the error case. */
-    if ( iommu_supports_x2apic() )
+    /*
+     * iommu_x2apic_enabled and iommu_supports_x2apic() cannot be used here
+     * in the error case.
+     */
+    if ( iommu_x2apic )
     {
         /*
          * NB: do not use raw mode when restoring entries if the iommu has
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Nov 04 19:11:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Nov 2021 19:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.221860.383754 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mii8h-0002lI-4F; Thu, 04 Nov 2021 19:11:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 221860.383754; Thu, 04 Nov 2021 19:11:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mii8h-0002lA-1T; Thu, 04 Nov 2021 19:11:07 +0000
Received: by outflank-mailman (input) for mailman id 221860;
 Thu, 04 Nov 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 1mii8e-0002l4-Tr
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 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 1mii8e-0002eB-Ra
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 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 1mii8e-0003tZ-Q3
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 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=vVN3fIWVWOcZoUsKJvFkCMkNGfL8LM73D96Hq6ovs04=; b=EigBQFUgus+px4FqwAWsXlkpXg
	C+ww12TZ7jgfipT6aLGJt5iAtvNdijKGQm6kP8KGDjN8mNglWt0AsBmC7jjvus1btUdsysX6DbHZT
	sDf+ddjjSmSyDEjXjKixX7jEr/kRiPJKMV6E8L8dF5cfhch2mA4qG6S3hL8Kl/FryzV4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/helpers: fix broken xenstore stubdom init
Message-Id: <E1mii8e-0003tZ-Q3@xenbits.xenproject.org>
Date: Thu, 04 Nov 2021 19:11:04 +0000

commit 86a192e511bd826c59ae1643d06fd52a5bc21ca6
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Nov 4 15:42:42 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Nov 4 18:43:20 2021 +0000

    tools/helpers: fix broken xenstore stubdom init
    
    Commit 1787cc167906f3f ("libs/guest: Move the guest ABI check earlier
    into xc_dom_parse_image()") broke starting the xenstore stubdom. This
    is due to a rather special way the xenstore stubdom domain config is
    being initialized: in order to support both, PV and PVH stubdom,
    init-xenstore-domain is using xc_dom_parse_image() to find the correct
    domain type. Unfortunately above commit requires xc_dom_boot_xen_init()
    to have been called before using xc_dom_parse_image(). This requires
    the domid, which is known only after xc_domain_create(), which requires
    the domain type.
    
    In order to break this circular dependency, call xc_dom_boot_xen_init()
    with an arbitrary domid first, and then set dom->guest_domid later.
    
    Fixes: 1787cc167906f3f ("libs/guest: Move the guest ABI check earlier into xc_dom_parse_image()")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Release-acked-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/helpers/init-xenstore-domain.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xenstore-domain.c
index 6836002f0b..a79662bd1b 100644
--- a/tools/helpers/init-xenstore-domain.c
+++ b/tools/helpers/init-xenstore-domain.c
@@ -132,6 +132,13 @@ static int build(xc_interface *xch)
         }
     }
 
+    rv = xc_dom_boot_xen_init(dom, xch, domid);
+    if ( rv )
+    {
+        fprintf(stderr, "xc_dom_boot_xen_init failed\n");
+        goto err;
+    }
+
     dom->container_type = XC_DOM_HVM_CONTAINER;
     rv = xc_dom_parse_image(dom);
     if ( rv )
@@ -214,16 +221,11 @@ static int build(xc_interface *xch)
     else
         snprintf(cmdline, 512, "--event %d --internal-db", rv);
 
+    dom->guest_domid = domid;
     dom->cmdline = xc_dom_strdup(dom, cmdline);
     dom->xenstore_domid = domid;
     dom->console_evtchn = console_evtchn;
 
-    rv = xc_dom_boot_xen_init(dom, xch, domid);
-    if ( rv )
-    {
-        fprintf(stderr, "xc_dom_boot_xen_init failed\n");
-        goto err;
-    }
     rv = xc_dom_mem_init(dom, memory);
     if ( rv )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Nov 04 19:11:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Nov 2021 19:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.221861.383759 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mii8q-0002n1-7i; Thu, 04 Nov 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 221861.383759; Thu, 04 Nov 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 1mii8q-0002mu-2s; Thu, 04 Nov 2021 19:11:16 +0000
Received: by outflank-mailman (input) for mailman id 221861;
 Thu, 04 Nov 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 1mii8o-0002mg-W2
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 2021 19: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 1mii8o-0002fr-V8
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 2021 19:11:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mii8o-0003u8-UB
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 2021 19: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=Xc5afWwfghTwpdWVZXDnCGBxQtO21YeL4BfMp9VfqQA=; b=WyzkkEtG/KFyLmYzP9S3X9XVWd
	hd7jWnvBQahB+popR+vYWkredjfu3HdfG7hSIKRBB2u8MmjTAMw0SRqd6+wysfw30au1YaxKV93FA
	XN8joBCc3nggzPlaf7nrd43fvJWXhsaCU6xnOMfMoeYB13+bpS0a1H+871H6cwPPS0Es=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] configure: modify default of building rombios
Message-Id: <E1mii8o-0003u8-UB@xenbits.xenproject.org>
Date: Thu, 04 Nov 2021 19:11:14 +0000

commit bcf77ce510047b9d311d9276646cc449c526e3a5
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Nov 4 17:11:20 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Nov 4 18:43:20 2021 +0000

    configure: modify default of building rombios
    
    The tools/configure script will default to build rombios if qemu
    traditional is enabled. If rombios is being built, ipxe will be built
    per default, too.
    
    This results in rombios and ipxe no longer being built by default when
    disabling qemu traditional.
    
    Fix that be rearranging the dependencies:
    
    - build ipxe by default
    - build rombios by default if either ipxe or qemu traditional are
      being built
    
    This modification prepares not building qemu traditional by default
    without affecting build of rombios and ipxe.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/configure    | 115 ++++++++++++++++++++++++-----------------------------
 tools/configure.ac |  67 +++++++++++++++----------------
 2 files changed, 85 insertions(+), 97 deletions(-)

diff --git a/tools/configure b/tools/configure
index 33814b24b3..d980b3ffc9 100755
--- a/tools/configure
+++ b/tools/configure
@@ -698,7 +698,6 @@ APPEND_INCLUDES
 PREPEND_LIB
 PREPEND_INCLUDES
 EXTRA_QEMUU_CONFIGURE_ARGS
-ipxe
 qemu_xen_systemd
 qemu_xen_path
 qemu_xen
@@ -706,6 +705,7 @@ rombios
 BCC
 LD86
 AS86
+ipxe
 qemu_traditional
 LINUX_BACKEND_MODULES
 golang
@@ -815,13 +815,13 @@ enable_seabios
 enable_golang
 with_linux_backend_modules
 enable_qemu_traditional
+enable_ipxe
+with_system_ipxe
 enable_rombios
 with_system_qemu
 with_stubdom_qmp_proxy
 with_system_seabios
 with_system_ovmf
-enable_ipxe
-with_system_ipxe
 with_extra_qemuu_configure_args
 with_xenstored
 enable_systemd
@@ -1504,10 +1504,10 @@ Optional Features:
   --enable-qemu-traditional
                           Enable qemu traditional device model, (DEFAULT is on
                           for Linux or NetBSD x86, otherwise off)
+  --enable-ipxe           Enable in-tree IPXE, (DEFAULT is on for x86,
+                          otherwise off, see also --with-system-ipxe)
   --enable-rombios        Enable ROMBIOS, (DEFAULT is on if qemu-traditional
-                          is enabled, otherwise off)
-  --disable-ipxe          Enable in-tree IPXE, (DEFAULT is on if rombios is
-                          enabled, otherwise off, see also --with-system-ipxe)
+                          or ipxe is enabled, otherwise off)
   --enable-systemd        Enable systemd support (default is DISABLED)
   --enable-9pfs           Explicitly enable 9pfs support in QEMU build
                           (default is to defer to QEMU configure default)
@@ -1538,6 +1538,11 @@ Optional Packages:
   --with-linux-backend-modules="mod1 mod2"
                           List of Linux backend module or modalias names to be
                           autoloaded on startup.
+  --with-system-ipxe[=PATH]
+                          Use system supplied IPXE PATH instead of building
+                          and installing our own version, it takes precedence
+                          over --{en,dis}able-ipxe, --without-system-ipxe is
+                          an error
   --with-system-qemu[=PATH]
                           Use system supplied qemu PATH or qemu (taken from
                           $PATH) as qemu-xen device model instead of building
@@ -1551,12 +1556,6 @@ Optional Packages:
   --with-system-ovmf[=PATH]
                           Use system supplied OVMF PATH instead of building
                           and installing our own version
-  --with-system-ipxe[=PATH]
-                          Use system supplied IPXE PATH instead of building
-                          and installing our own version, it takes precedence
-                          over --{en,dis}able-ipxe and is bound by the
-                          presence of rombios, --without-system-ipxe is an
-                          error
   --with-extra-qemuu-configure-args[="--ARG1 ..."]
                           List of additional configure options for upstream
                           qemu
@@ -4314,13 +4313,54 @@ else
 
 fi
 
+if test "x$enable_ipxe" = "xno"; then :
+  ipxe=n
+else
+  ipxe=y
+fi
+
+# Check whether --enable-ipxe was given.
+if test "${enable_ipxe+set}" = set; then :
+  enableval=$enable_ipxe;
+else
+
+    case "$host_cpu" in
+        i[3456]86|x86_64)
+           enable_ipxe="yes";;
+        *) enable_ipxe="no";;
+    esac
+
+fi
+
+
+# Check whether --with-system-ipxe was given.
+if test "${with_system_ipxe+set}" = set; then :
+  withval=$with_system_ipxe;
+    case $withval in
+        no) as_fn_error $? "--without-system-ipxe has no effect" "$LINENO" 5 ;;
+        /*)  ipxe_path=$withval; ipxe=n ;;
+        *) as_fn_error $? "IPXE specified, but is not an absolute path" "$LINENO" 5 ;;
+    esac
+
+fi
+
+if test "x$ipxe" = "xy" -o -n "$ipxe_path" ; then :
+
+
+cat >>confdefs.h <<_ACEOF
+#define IPXE_PATH "${ipxe_path:-$XENFIRMWAREDIR/ipxe.bin}"
+_ACEOF
+
+
+fi
+
 
 # Check whether --enable-rombios was given.
 if test "${enable_rombios+set}" = set; then :
   enableval=$enable_rombios;
 else
 
-    if test "x$enable_qemu_traditional" = "xyes"; then :
+    if test "x$enable_qemu_traditional" = "xyes" -o "x$enable_ipxe" = "xyes"; then :
 
         enable_rombios="yes"
 
@@ -4635,55 +4675,6 @@ _ACEOF
 
 fi
 
-# Check whether --enable-ipxe was given.
-if test "${enable_ipxe+set}" = set; then :
-  enableval=$enable_ipxe;
-     if test "x$enable_ipxe" = "xno"; then :
-  ipxe=n
-else
-  ipxe=y
-fi
-
-else
-
-    if test "x$enable_rombios" = "xno"; then :
-  ipxe=n
-else
-  ipxe=y
-fi
-
-fi
-
-
-# Check whether --with-system-ipxe was given.
-if test "${with_system_ipxe+set}" = set; then :
-  withval=$with_system_ipxe;
-    case $withval in
-        no) as_fn_error $? "--without-system-ipxe has no effect" "$LINENO" 5 ;;
-        /*)  ipxe_path=$withval; ipxe=n ;;
-        *) as_fn_error $? "IPXE specified, but is not an absolute path" "$LINENO" 5 ;;
-    esac
-
-fi
-
-if test "x$ipxe" = "xy" -o -n "$ipxe_path" ; then :
-
-
-    if test "x$enable_rombios" = "xno"; then :
-
-        as_fn_error $? "Rombios is required to use IPXE" "$LINENO" 5
-
-fi
-
-
-cat >>confdefs.h <<_ACEOF
-#define IPXE_PATH "${ipxe_path:-$XENFIRMWAREDIR/ipxe.bin}"
-_ACEOF
-
-
-fi
-
-
 
 # Check whether --with-extra-qemuu-configure-args was given.
 if test "${with_extra_qemuu_configure_args+set}" = set; then :
diff --git a/tools/configure.ac b/tools/configure.ac
index 6414fcbb44..97582951c8 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -139,10 +139,40 @@ AC_DEFINE([HAVE_QEMU_TRADITIONAL], [1], [Qemu traditional enabled])
 ])
 AC_SUBST(qemu_traditional)
 
+AC_ARG_ENABLE([ipxe],
+    AS_HELP_STRING([--enable-ipxe],
+                   [Enable in-tree IPXE, (DEFAULT is on for x86,
+                    otherwise off, see also --with-system-ipxe)]),,[
+    case "$host_cpu" in
+        i[[3456]]86|x86_64)
+           enable_ipxe="yes";;
+        *) enable_ipxe="no";;
+    esac
+])
+AS_IF([test "x$enable_ipxe" = "xno"], [ipxe=n], [ipxe=y])
+AC_ARG_WITH([system-ipxe],
+    AS_HELP_STRING([--with-system-ipxe@<:@=PATH@:>@],
+       [Use system supplied IPXE PATH instead of building and installing
+        our own version, it takes precedence over --{en,dis}able-ipxe,
+        --without-system-ipxe is an error]),[
+    case $withval in
+        no) AC_MSG_ERROR([--without-system-ipxe has no effect]) ;;
+        /*)  ipxe_path=$withval; ipxe=n ;;
+        *) AC_MSG_ERROR([IPXE specified, but is not an absolute path]) ;;
+    esac
+],[])
+AS_IF([test "x$ipxe" = "xy" -o -n "$ipxe_path" ], [
+    AC_DEFINE_UNQUOTED([IPXE_PATH],
+                       ["${ipxe_path:-$XENFIRMWAREDIR/ipxe.bin}"],
+                       [IPXE path])
+])
+AC_SUBST(ipxe)
+
 AC_ARG_ENABLE([rombios],
     AS_HELP_STRING([--enable-rombios],
-                   [Enable ROMBIOS, (DEFAULT is on if qemu-traditional is enabled, otherwise off)]),,[
-    AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
+                   [Enable ROMBIOS, (DEFAULT is on if qemu-traditional or ipxe is enabled,
+                    otherwise off)]),,[
+    AS_IF([test "x$enable_qemu_traditional" = "xyes" -o "x$enable_ipxe" = "xyes"], [
         enable_rombios="yes"
     ], [
         enable_rombios="no"
@@ -240,39 +270,6 @@ AS_IF([test "x$ovmf" = "xy" -o -n "$ovmf_path" ], [
                        [OVMF path])
 ])
 
-AC_ARG_ENABLE([ipxe],
-    AS_HELP_STRING([--disable-ipxe],
-                   [Enable in-tree IPXE, (DEFAULT is on if rombios is enabled,
-                    otherwise off, see also --with-system-ipxe)]),
-    [
-     AS_IF([test "x$enable_ipxe" = "xno"], [ipxe=n], [ipxe=y])
-    ],
-    [
-    AS_IF([test "x$enable_rombios" = "xno"], [ipxe=n], [ipxe=y])
-])
-AC_ARG_WITH([system-ipxe],
-    AS_HELP_STRING([--with-system-ipxe@<:@=PATH@:>@],
-       [Use system supplied IPXE PATH instead of building and installing
-        our own version, it takes precedence over --{en,dis}able-ipxe and is
-        bound by the presence of rombios, --without-system-ipxe is an error]),[
-    case $withval in
-        no) AC_MSG_ERROR([--without-system-ipxe has no effect]) ;;
-        /*)  ipxe_path=$withval; ipxe=n ;;
-        *) AC_MSG_ERROR([IPXE specified, but is not an absolute path]) ;;
-    esac
-],[])
-AS_IF([test "x$ipxe" = "xy" -o -n "$ipxe_path" ], [
-
-    AS_IF([test "x$enable_rombios" = "xno"], [
-        AC_MSG_ERROR([Rombios is required to use IPXE])
-    ], [])
-
-    AC_DEFINE_UNQUOTED([IPXE_PATH],
-                       ["${ipxe_path:-$XENFIRMWAREDIR/ipxe.bin}"],
-                       [IPXE path])
-])
-AC_SUBST(ipxe)
-
 AC_ARG_WITH([extra-qemuu-configure-args],
     AS_HELP_STRING([--with-extra-qemuu-configure-args@<:@="--ARG1 ..."@:>@],
        [List of additional configure options for upstream qemu]),[
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Nov 04 19:11:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 04 Nov 2021 19:11:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.221862.383762 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mii90-0002qs-8n; Thu, 04 Nov 2021 19:11:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 221862.383762; Thu, 04 Nov 2021 19: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 1mii90-0002qk-5s; Thu, 04 Nov 2021 19:11:26 +0000
Received: by outflank-mailman (input) for mailman id 221862;
 Thu, 04 Nov 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 1mii8z-0002qD-4D
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 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 1mii8z-0002g9-3L
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 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 1mii8z-0003uj-1u
 for xen-changelog@lists.xenproject.org; Thu, 04 Nov 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=w5bCM5NNf5qp+L/+dTbVXRGtypytee1lHRORl6BTDn0=; b=679MOR8TdRDzPjcXPFc5mbjTM/
	FATezfJEV9IbMl1GoMIiJXGC87aW35tojxHeBI6EVrOc/EV6VLMc7854PlYJ1saNYkAD1QuFmoFMv
	zo6A3SKibBJhjeRjS6FxS4vVdyuh3ivf4kEQi4lKhw7WOTgSZRU+ZaHjrI1OZRlM0HMI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: disable building qemu-trad per default
Message-Id: <E1mii8z-0003uj-1u@xenbits.xenproject.org>
Date: Thu, 04 Nov 2021 19:11:25 +0000

commit faddd16e367530fe4de5480610f69d8ceb6011d8
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Nov 4 17:11:21 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Nov 4 18:43:20 2021 +0000

    tools: disable building qemu-trad per default
    
    Using qemu-traditional as device model is deprecated for some time now.
    
    So change the default for building it to "disable". This will affect
    ioemu-stubdom, too, as there is a direct dependency between the two.
    
    Today it is possible to use a PVH/HVM Linux-based stubdom as device
    model. Additionally using ioemu-stubdom isn't really helping for
    security, as it requires to run a very old and potentially buggy qemu
    version in a PV domain. This is adding probably more security problems
    than it is removing by using a stubdom.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Acked-by: Ian Jackson <iwj@xenproject.org>
    Release-acked-by: Ian Jackson <iwj@xenproject.org>
---
 CHANGELOG.md         |  3 +++
 stubdom/configure    |  8 --------
 stubdom/configure.ac |  8 +-------
 tools/configure      | 17 ++---------------
 tools/configure.ac   | 13 +------------
 5 files changed, 7 insertions(+), 42 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e7107ac3de..e5ab49e779 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    or by passing "iommu=quarantine=scratch-page" on the hypervisor command line.
  - pv-grub stubdoms will no longer be built per default. In order to be able to use pv-grub
    configure needs to be called with "--enable-pv-grub" as parameter.
+ - qemu-traditional based device models (both, qemu-traditional and ioemu-stubdom) will
+   no longer be built per default. In order to be able to use those, configure needs to
+   be called with "--enable-qemu-traditional" as parameter.
 
 ## [4.15.0 UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - TBD
 
diff --git a/stubdom/configure b/stubdom/configure
index df31532abb..07b709f998 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -2286,14 +2286,6 @@ fi
 # Check whether --enable-qemu-traditional was given.
 if test "${enable_qemu_traditional+set}" = set; then :
   enableval=$enable_qemu_traditional;
-else
-
-    case "$host_cpu" in
-        i[3456]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-
 fi
 
 if test "x$enable_qemu_traditional" = "xyes"; then :
diff --git a/stubdom/configure.ac b/stubdom/configure.ac
index a07a1edae5..e20d99edac 100644
--- a/stubdom/configure.ac
+++ b/stubdom/configure.ac
@@ -27,13 +27,7 @@ AX_STUBDOM_DEFAULT_ENABLE([xenstorepvh-stubdom], [xenstorepvh])
 AX_STUBDOM_CONDITIONAL([vtpm-stubdom], [vtpm])
 AX_STUBDOM_CONDITIONAL([vtpmmgr-stubdom], [vtpmmgr])
 
-AC_ARG_ENABLE([qemu-traditional],,,[
-    case "$host_cpu" in
-        i[[3456]]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-])
+AC_ARG_ENABLE([qemu-traditional])
 AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
     qemu_traditional=y],[
     qemu_traditional=n
diff --git a/tools/configure b/tools/configure
index d980b3ffc9..a3d33eb907 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1502,8 +1502,8 @@ Optional Features:
   --disable-seabios       Disable SeaBIOS (default is ENABLED)
   --disable-golang        Disable Go tools (default is ENABLED)
   --enable-qemu-traditional
-                          Enable qemu traditional device model, (DEFAULT is on
-                          for Linux or NetBSD x86, otherwise off)
+                          Enable qemu traditional device model, (DEFAULT is
+                          off)
   --enable-ipxe           Enable in-tree IPXE, (DEFAULT is on for x86,
                           otherwise off, see also --with-system-ipxe)
   --enable-rombios        Enable ROMBIOS, (DEFAULT is on if qemu-traditional
@@ -4286,19 +4286,6 @@ LINUX_BACKEND_MODULES="`eval echo $LINUX_BACKEND_MODULES`"
 # Check whether --enable-qemu-traditional was given.
 if test "${enable_qemu_traditional+set}" = set; then :
   enableval=$enable_qemu_traditional;
-else
-
-    case "$host_cpu" in
-        i[3456]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-    case "$host_os" in
-        freebsd*)
-           enable_qemu_traditional="no";;
-    esac
-
-
 fi
 
 if test "x$enable_qemu_traditional" = "xyes"; then :
diff --git a/tools/configure.ac b/tools/configure.ac
index 97582951c8..03eb7cf146 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -120,18 +120,7 @@ AC_SUBST(LINUX_BACKEND_MODULES)
 
 AC_ARG_ENABLE([qemu-traditional],
     AS_HELP_STRING([--enable-qemu-traditional],
-                   [Enable qemu traditional device model, (DEFAULT is on for Linux or NetBSD x86, otherwise off)]),,[
-    case "$host_cpu" in
-        i[[3456]]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-    case "$host_os" in
-        freebsd*)
-           enable_qemu_traditional="no";;
-    esac
-
-])
+                   [Enable qemu traditional device model, (DEFAULT is off)]))
 AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
 AC_DEFINE([HAVE_QEMU_TRADITIONAL], [1], [Qemu traditional enabled])
     qemu_traditional=y],[
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 05 01:55:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Nov 2021 01:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.221979.383937 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mioRb-0006vw-0Q; Fri, 05 Nov 2021 01:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 221979.383937; Fri, 05 Nov 2021 01:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mioRa-0006vm-TR; Fri, 05 Nov 2021 01:55:02 +0000
Received: by outflank-mailman (input) for mailman id 221979;
 Fri, 05 Nov 2021 01: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 1mioRa-0006vg-1F
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 01: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 1mioRa-00039P-0Q
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 01:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mioRZ-000382-V1
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 01: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=ovqoyXnSlH3iQEHJOz4XLekJu8Dn7O8ojKqXfV7zxb8=; b=oxGBgb29SRE1QNRqNb/98dTQlH
	oMdFwU5n5cb3TS0DYfcomELmXQIHO2UShoz356IwqY8ZWRR41rdgt7gcqu3ja+4IcmmDWTpO3hrHS
	gBJEkF0vV1YeH41yYBRj6eZmjl4kooW49rWn6+o2/fPmjmMmGE91Yzx1jwi03MkD/vyI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: disable building qemu-trad per default
Message-Id: <E1mioRZ-000382-V1@xenbits.xenproject.org>
Date: Fri, 05 Nov 2021 01:55:01 +0000

commit ce309942c791628ff42082d1b74bfaeaa5267ae0
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Sep 10 07:55:18 2021 +0200
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Wed Nov 3 12:54:40 2021 +0000

    tools: disable building qemu-trad per default
    
    Using qemu-traditional as device model is deprecated for some time now.
    
    So change the default for building it to "disable". This will affect
    ioemu-stubdom, too, as there is a direct dependency between the two.
    
    Today it is possible to use a PVH/HVM Linux-based stubdom as device
    model. Additionally using ioemu-stubdom isn't really helping for
    security, as it requires to run a very old and potentially buggy qemu
    version in a PV domain. This is adding probably more security problems
    than it is removing by using a stubdom.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Acked-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 CHANGELOG.md         |  3 +++
 stubdom/configure    |  8 --------
 stubdom/configure.ac |  8 +-------
 tools/configure      | 17 ++---------------
 tools/configure.ac   | 13 +------------
 5 files changed, 7 insertions(+), 42 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e7107ac3de..e5ab49e779 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    or by passing "iommu=quarantine=scratch-page" on the hypervisor command line.
  - pv-grub stubdoms will no longer be built per default. In order to be able to use pv-grub
    configure needs to be called with "--enable-pv-grub" as parameter.
+ - qemu-traditional based device models (both, qemu-traditional and ioemu-stubdom) will
+   no longer be built per default. In order to be able to use those, configure needs to
+   be called with "--enable-qemu-traditional" as parameter.
 
 ## [4.15.0 UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - TBD
 
diff --git a/stubdom/configure b/stubdom/configure
index df31532abb..07b709f998 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -2286,14 +2286,6 @@ fi
 # Check whether --enable-qemu-traditional was given.
 if test "${enable_qemu_traditional+set}" = set; then :
   enableval=$enable_qemu_traditional;
-else
-
-    case "$host_cpu" in
-        i[3456]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-
 fi
 
 if test "x$enable_qemu_traditional" = "xyes"; then :
diff --git a/stubdom/configure.ac b/stubdom/configure.ac
index a07a1edae5..e20d99edac 100644
--- a/stubdom/configure.ac
+++ b/stubdom/configure.ac
@@ -27,13 +27,7 @@ AX_STUBDOM_DEFAULT_ENABLE([xenstorepvh-stubdom], [xenstorepvh])
 AX_STUBDOM_CONDITIONAL([vtpm-stubdom], [vtpm])
 AX_STUBDOM_CONDITIONAL([vtpmmgr-stubdom], [vtpmmgr])
 
-AC_ARG_ENABLE([qemu-traditional],,,[
-    case "$host_cpu" in
-        i[[3456]]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-])
+AC_ARG_ENABLE([qemu-traditional])
 AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
     qemu_traditional=y],[
     qemu_traditional=n
diff --git a/tools/configure b/tools/configure
index 33814b24b3..8bf8fe75b8 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1502,8 +1502,8 @@ Optional Features:
   --disable-seabios       Disable SeaBIOS (default is ENABLED)
   --disable-golang        Disable Go tools (default is ENABLED)
   --enable-qemu-traditional
-                          Enable qemu traditional device model, (DEFAULT is on
-                          for Linux or NetBSD x86, otherwise off)
+                          Enable qemu traditional device model, (DEFAULT is
+                          off)
   --enable-rombios        Enable ROMBIOS, (DEFAULT is on if qemu-traditional
                           is enabled, otherwise off)
   --disable-ipxe          Enable in-tree IPXE, (DEFAULT is on if rombios is
@@ -4287,19 +4287,6 @@ LINUX_BACKEND_MODULES="`eval echo $LINUX_BACKEND_MODULES`"
 # Check whether --enable-qemu-traditional was given.
 if test "${enable_qemu_traditional+set}" = set; then :
   enableval=$enable_qemu_traditional;
-else
-
-    case "$host_cpu" in
-        i[3456]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-    case "$host_os" in
-        freebsd*)
-           enable_qemu_traditional="no";;
-    esac
-
-
 fi
 
 if test "x$enable_qemu_traditional" = "xyes"; then :
diff --git a/tools/configure.ac b/tools/configure.ac
index 6414fcbb44..a713fd34d6 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -120,18 +120,7 @@ AC_SUBST(LINUX_BACKEND_MODULES)
 
 AC_ARG_ENABLE([qemu-traditional],
     AS_HELP_STRING([--enable-qemu-traditional],
-                   [Enable qemu traditional device model, (DEFAULT is on for Linux or NetBSD x86, otherwise off)]),,[
-    case "$host_cpu" in
-        i[[3456]]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-    case "$host_os" in
-        freebsd*)
-           enable_qemu_traditional="no";;
-    esac
-
-])
+                   [Enable qemu traditional device model, (DEFAULT is off)]))
 AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
 AC_DEFINE([HAVE_QEMU_TRADITIONAL], [1], [Qemu traditional enabled])
     qemu_traditional=y],[
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 05 01:55:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Nov 2021 01:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.221980.383941 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mioRl-0006zG-1a; Fri, 05 Nov 2021 01:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 221980.383941; Fri, 05 Nov 2021 01: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 1mioRk-0006z8-Ux; Fri, 05 Nov 2021 01:55:12 +0000
Received: by outflank-mailman (input) for mailman id 221980;
 Fri, 05 Nov 2021 01: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 1mioRk-0006z0-4u
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 01: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 1mioRk-00039a-42
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 01:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mioRk-00038n-37
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 01: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=HAK/0qL+Qkp8fhwAuQdNwIOUeAuCEG8/PBghRsnWkng=; b=2j6Y8Av9j7w+NMiYJd5tJf5RAi
	+mHM5F85WB2I6vRQCr11JxqzluMWkBMoHQmSWP08jcAAG3x+gIbiSaGY2xrMYf9+WQH3tcCQxqysa
	oktp+HK/FR8e9FUCey8TZCUy2nWYybZvfSUC4RtcN6ZWOp9zhwA2v8+37ekf6g/ka4Io=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shstk: Fix use of shadow stacks with XPTI active
Message-Id: <E1mioRk-00038n-37@xenbits.xenproject.org>
Date: Fri, 05 Nov 2021 01:55:12 +0000

commit b2851580b1f2ff121737a37cb25a370d7692ae3b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Nov 1 20:45:26 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Nov 3 13:08:42 2021 +0000

    x86/shstk: Fix use of shadow stacks with XPTI active
    
    The call to setup_cpu_root_pgt(0) in smp_prepare_cpus() is too early.  It
    clones the BSP's stack while the .data mapping is still in use, causing all
    mappings to be fully read read/write (and with no guard pages either).  This
    ultimately causes #DF when trying to enter the dom0 kernel for the first time.
    
    Defer setting up BSPs XPTI pagetable until reinit_bsp_stack() after we've set
    up proper shadow stack permissions.
    
    Fixes: 60016604739b ("x86/shstk: Rework the stack layout to support shadow stacks")
    Fixes: b60ab42db2f0 ("x86/shstk: Activate Supervisor Shadow Stacks")
    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/setup.c   | 5 +++++
 xen/arch/x86/smpboot.c | 9 ++-------
 xen/include/xen/smp.h  | 1 +
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index b101565f14..fea86530f9 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -666,6 +666,7 @@ static void noreturn init_done(void)
 static void __init noreturn reinit_bsp_stack(void)
 {
     unsigned long *stack = (void*)(get_stack_bottom() & ~(STACK_SIZE - 1));
+    int rc;
 
     /* Update TSS and ISTs */
     load_system_tables();
@@ -676,6 +677,10 @@ static void __init noreturn reinit_bsp_stack(void)
     stack_base[0] = stack;
     memguard_guard_stack(stack);
 
+    rc = setup_cpu_root_pgt(0);
+    if ( rc )
+        panic("Error %d setting up PV root page table\n", rc);
+
     if ( IS_ENABLED(CONFIG_XEN_SHSTK) && cpu_has_xen_shstk )
     {
         wrmsrl(MSR_PL0_SSP,
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 0dce1ae872..329cfdb6c9 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -821,7 +821,7 @@ static root_pgentry_t common_pgt;
 
 extern const char _stextentry[], _etextentry[];
 
-static int setup_cpu_root_pgt(unsigned int cpu)
+int setup_cpu_root_pgt(unsigned int cpu)
 {
     root_pgentry_t *rpt;
     unsigned int off;
@@ -1138,8 +1138,6 @@ static struct notifier_block cpu_smpboot_nfb = {
 
 void __init smp_prepare_cpus(void)
 {
-    int rc;
-
     register_cpu_notifier(&cpu_smpboot_nfb);
 
     mtrr_aps_sync_begin();
@@ -1153,10 +1151,7 @@ void __init smp_prepare_cpus(void)
 
     stack_base[0] = (void *)((unsigned long)stack_start & ~(STACK_SIZE - 1));
 
-    rc = setup_cpu_root_pgt(0);
-    if ( rc )
-        panic("Error %d setting up PV root page table\n", rc);
-    if ( per_cpu(root_pgt, 0) )
+    if ( opt_xpti_hwdom || opt_xpti_domu )
     {
         get_cpu_info()->pv_cr3 = 0;
 
diff --git a/xen/include/xen/smp.h b/xen/include/xen/smp.h
index d5a3644611..0a9219173f 100644
--- a/xen/include/xen/smp.h
+++ b/xen/include/xen/smp.h
@@ -70,5 +70,6 @@ int alloc_cpu_id(void);
 extern void *stack_base[NR_CPUS];
 
 void initialize_cpu_data(unsigned int cpu);
+int setup_cpu_root_pgt(unsigned int cpu);
 
 #endif /* __XEN_SMP_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 05 01:55:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Nov 2021 01:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.221981.383944 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mioRw-00072e-3E; Fri, 05 Nov 2021 01:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 221981.383944; Fri, 05 Nov 2021 01:55:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mioRw-00072W-0F; Fri, 05 Nov 2021 01:55:24 +0000
Received: by outflank-mailman (input) for mailman id 221981;
 Fri, 05 Nov 2021 01:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mioRu-00071q-8N
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 01:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mioRu-00039q-7c
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 01:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mioRu-00039X-6m
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 01:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HBGBGga84vVXz91a9Z4woPUptym/B8XaZH6u/9wKSmQ=; b=ODJSH6u8YKQEaV6NbSisVPRX0i
	l6mFtvFuZzMxwWpISUAMQXXELrdHl14pmWz2vzbWwdKYVaEJhF31Sjqr2p3k48OE96k8WWP0QVelT
	23NxFUdpdb3fkeRreRa5r8PgvaApp+tFKfDb5s2GcjXD1rygnQ8gOaaU2zrE3LOmS25Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Revert "tools: disable building qemu-trad per default"
Message-Id: <E1mioRu-00039X-6m@xenbits.xenproject.org>
Date: Fri, 05 Nov 2021 01:55:22 +0000

commit f6507f1a11cb91f527c7ffdffb8e35289a58d0f5
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Wed Nov 3 15:20:02 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Wed Nov 3 15:20:41 2021 +0000

    Revert "tools: disable building qemu-trad per default"
    
    Unfortunately this breaks the gitlab CI.  See mails on-list.
    
    This reverts commit ce309942c791628ff42082d1b74bfaeaa5267ae0.
---
 CHANGELOG.md         |  3 ---
 stubdom/configure    |  8 ++++++++
 stubdom/configure.ac |  8 +++++++-
 tools/configure      | 17 +++++++++++++++--
 tools/configure.ac   | 13 ++++++++++++-
 5 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e5ab49e779..e7107ac3de 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,9 +18,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    or by passing "iommu=quarantine=scratch-page" on the hypervisor command line.
  - pv-grub stubdoms will no longer be built per default. In order to be able to use pv-grub
    configure needs to be called with "--enable-pv-grub" as parameter.
- - qemu-traditional based device models (both, qemu-traditional and ioemu-stubdom) will
-   no longer be built per default. In order to be able to use those, configure needs to
-   be called with "--enable-qemu-traditional" as parameter.
 
 ## [4.15.0 UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - TBD
 
diff --git a/stubdom/configure b/stubdom/configure
index 07b709f998..df31532abb 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -2286,6 +2286,14 @@ fi
 # Check whether --enable-qemu-traditional was given.
 if test "${enable_qemu_traditional+set}" = set; then :
   enableval=$enable_qemu_traditional;
+else
+
+    case "$host_cpu" in
+        i[3456]86|x86_64)
+           enable_qemu_traditional="yes";;
+        *) enable_qemu_traditional="no";;
+    esac
+
 fi
 
 if test "x$enable_qemu_traditional" = "xyes"; then :
diff --git a/stubdom/configure.ac b/stubdom/configure.ac
index e20d99edac..a07a1edae5 100644
--- a/stubdom/configure.ac
+++ b/stubdom/configure.ac
@@ -27,7 +27,13 @@ AX_STUBDOM_DEFAULT_ENABLE([xenstorepvh-stubdom], [xenstorepvh])
 AX_STUBDOM_CONDITIONAL([vtpm-stubdom], [vtpm])
 AX_STUBDOM_CONDITIONAL([vtpmmgr-stubdom], [vtpmmgr])
 
-AC_ARG_ENABLE([qemu-traditional])
+AC_ARG_ENABLE([qemu-traditional],,,[
+    case "$host_cpu" in
+        i[[3456]]86|x86_64)
+           enable_qemu_traditional="yes";;
+        *) enable_qemu_traditional="no";;
+    esac
+])
 AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
     qemu_traditional=y],[
     qemu_traditional=n
diff --git a/tools/configure b/tools/configure
index 8bf8fe75b8..33814b24b3 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1502,8 +1502,8 @@ Optional Features:
   --disable-seabios       Disable SeaBIOS (default is ENABLED)
   --disable-golang        Disable Go tools (default is ENABLED)
   --enable-qemu-traditional
-                          Enable qemu traditional device model, (DEFAULT is
-                          off)
+                          Enable qemu traditional device model, (DEFAULT is on
+                          for Linux or NetBSD x86, otherwise off)
   --enable-rombios        Enable ROMBIOS, (DEFAULT is on if qemu-traditional
                           is enabled, otherwise off)
   --disable-ipxe          Enable in-tree IPXE, (DEFAULT is on if rombios is
@@ -4287,6 +4287,19 @@ LINUX_BACKEND_MODULES="`eval echo $LINUX_BACKEND_MODULES`"
 # Check whether --enable-qemu-traditional was given.
 if test "${enable_qemu_traditional+set}" = set; then :
   enableval=$enable_qemu_traditional;
+else
+
+    case "$host_cpu" in
+        i[3456]86|x86_64)
+           enable_qemu_traditional="yes";;
+        *) enable_qemu_traditional="no";;
+    esac
+    case "$host_os" in
+        freebsd*)
+           enable_qemu_traditional="no";;
+    esac
+
+
 fi
 
 if test "x$enable_qemu_traditional" = "xyes"; then :
diff --git a/tools/configure.ac b/tools/configure.ac
index a713fd34d6..6414fcbb44 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -120,7 +120,18 @@ AC_SUBST(LINUX_BACKEND_MODULES)
 
 AC_ARG_ENABLE([qemu-traditional],
     AS_HELP_STRING([--enable-qemu-traditional],
-                   [Enable qemu traditional device model, (DEFAULT is off)]))
+                   [Enable qemu traditional device model, (DEFAULT is on for Linux or NetBSD x86, otherwise off)]),,[
+    case "$host_cpu" in
+        i[[3456]]86|x86_64)
+           enable_qemu_traditional="yes";;
+        *) enable_qemu_traditional="no";;
+    esac
+    case "$host_os" in
+        freebsd*)
+           enable_qemu_traditional="no";;
+    esac
+
+])
 AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
 AC_DEFINE([HAVE_QEMU_TRADITIONAL], [1], [Qemu traditional enabled])
     qemu_traditional=y],[
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 05 01:55:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Nov 2021 01:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.221982.383949 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mioS6-00075h-5J; Fri, 05 Nov 2021 01:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 221982.383949; Fri, 05 Nov 2021 01:55:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mioS6-00075Z-1v; Fri, 05 Nov 2021 01:55:34 +0000
Received: by outflank-mailman (input) for mailman id 221982;
 Fri, 05 Nov 2021 01:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mioS4-00075A-CY
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 01:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mioS4-0003AH-Bk
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 01:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mioS4-0003AH-9z
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 01:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WvJ+jy+12JrVpz6QRv0U94LODj7F5WsVnnY098OKQ7g=; b=DfZhTyiWwTq4oKrLRKS+OKi3G0
	wicHNT3+nod5a7/4iQaQ5MgK2S6DPhuZXmllXzsTpMSBRwFocqmLYgKyQO8BMFpoeFQGNdJvMxmeA
	n94/Oj+/fXdx6p5NZHj4iNa/P77vvaxQGl25Qqx/hEzco1WhYSrYZKSsXgahgx5dTaiY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: fix SBDF calculation for vPCI MMIO handlers
Message-Id: <E1mioS4-0003AH-9z@xenbits.xenproject.org>
Date: Fri, 05 Nov 2021 01:55:32 +0000

commit 3231ddf9dc384a386df43fd1c0a0bcbba9d79569
Author:     Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
AuthorDate: Tue Nov 2 13:20:41 2021 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Nov 3 18:15:21 2021 +0000

    xen/arm: fix SBDF calculation for vPCI MMIO handlers
    
    While in vPCI MMIO trap handlers for the guest PCI host bridge it is not
    enough for SBDF translation to simply call VPCI_ECAM_BDF(info->gpa) as
    the base address may not be aligned in the way that the translation
    always work. If not adjusted with respect to the base address it may not be
    able to properly convert SBDF.
    Fix this by adjusting the gpa with respect to the host bridge base address
    in a way as it is done for x86.
    
    Please note, that this change is not strictly required given the current
    value of GUEST_VPCI_ECAM_BASE which has bits 0 to 27 clear, but could cause
    issues if such value is changed, or when handlers for dom0 ECAM
    regions are added as those will be mapped over existing hardware
    regions that could use non-aligned base addresses.
    
    Fixes: d59168dc05a5 ("xen/arm: Enable the existing x86 virtual PCI support for ARM")
    
    Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/arm/vpci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/vpci.c b/xen/arch/arm/vpci.c
index 8f40a0dec6..23f45386f4 100644
--- a/xen/arch/arm/vpci.c
+++ b/xen/arch/arm/vpci.c
@@ -24,7 +24,7 @@ static int vpci_mmio_read(struct vcpu *v, mmio_info_t *info,
     unsigned long data;
 
     /* We ignore segment part and always handle segment 0 */
-    sbdf.sbdf = VPCI_ECAM_BDF(info->gpa);
+    sbdf.sbdf = VPCI_ECAM_BDF(info->gpa - GUEST_VPCI_ECAM_BASE);
 
     if ( vpci_ecam_read(sbdf, ECAM_REG_OFFSET(info->gpa),
                         1U << info->dabt.size, &data) )
@@ -44,7 +44,7 @@ static int vpci_mmio_write(struct vcpu *v, mmio_info_t *info,
     pci_sbdf_t sbdf;
 
     /* We ignore segment part and always handle segment 0 */
-    sbdf.sbdf = VPCI_ECAM_BDF(info->gpa);
+    sbdf.sbdf = VPCI_ECAM_BDF(info->gpa - GUEST_VPCI_ECAM_BASE);
 
     return vpci_ecam_write(sbdf, ECAM_REG_OFFSET(info->gpa),
                            1U << info->dabt.size, r);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 05 01:55:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Nov 2021 01:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.221983.383953 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mioSG-000796-7x; Fri, 05 Nov 2021 01:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 221983.383953; Fri, 05 Nov 2021 01:55:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mioSG-00078y-4r; Fri, 05 Nov 2021 01:55:44 +0000
Received: by outflank-mailman (input) for mailman id 221983;
 Fri, 05 Nov 2021 01:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mioSE-00078j-GI
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 01:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mioSE-0003AS-Fc
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 01:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mioSE-0003Aq-E8
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 01:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nAZVH8u8h8FjXgcKoj+taGkLla1H2flzQRy6cN6rmHo=; b=at1PnrD2Zb/PsdDH2P7Dhk8Dlr
	Johaumqo79TdQfw/hbPRqER40LW4YS8WByD566f+Mcl9NFQBdAwuFvgzdgLCWZn+OhNeWu970Xny2
	dMaGQxGK5sQophL5POZ4JBLhn656jQaxe208NAY8PCVTwqf6fIMBm+ZB0ioCqnL+hnys=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/traps: Fix typo in do_entry_CP()
Message-Id: <E1mioSE-0003Aq-E8@xenbits.xenproject.org>
Date: Fri, 05 Nov 2021 01:55:42 +0000

commit 512863ed238d7390f74d43f0ba298b1dfa8f4803
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Sep 28 21:55:56 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Nov 3 19:13:17 2021 +0000

    x86/traps: Fix typo in do_entry_CP()
    
    The call to debugger_trap_entry() should pass the correct vector.  The
    break-for-gdbsx logic is in practice unreachable because PV guests can't
    generate #CP, but it will interfere with anyone inserting custom debugging
    into debugger_trap_entry().
    
    Fixes: 5ad05b9c2490 ("x86/traps: Implement #CP handler and extend #PF for shadow stacks")
    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/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 79fd276a41..d483aa91f2 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2134,7 +2134,7 @@ void do_entry_CP(struct cpu_user_regs *regs)
     const char *err = "??";
     unsigned int ec = regs->error_code;
 
-    if ( debugger_trap_entry(TRAP_debug, regs) )
+    if ( debugger_trap_entry(X86_EXC_CP, regs) )
         return;
 
     /* Decode ec if possible */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 05 15:22:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Nov 2021 15:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.222465.384657 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mj12Y-0006ke-Vq; Fri, 05 Nov 2021 15:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 222465.384657; Fri, 05 Nov 2021 15:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mj12Y-0006kW-Sw; Fri, 05 Nov 2021 15:22:02 +0000
Received: by outflank-mailman (input) for mailman id 222465;
 Fri, 05 Nov 2021 15:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mj12X-0006kQ-Rz
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 15:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mj12X-0001Q9-RA
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 15:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mj12X-0003qH-PV
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 15:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RLoPlzjxLwjb9rqQ1Nw/gXd2trD0sbg2RslUh1Ibes0=; b=j2lZdWIhBk2yPgEV0dS3AHPRwU
	yMI+J097fYfeySdNssIJimoPw74KfOY6v7QSZXtTK/THA/vXXxihc9nDDXe9t/P+0fLZw1xFr+ub8
	2CEOf+19Rmvn0QPdR6kB3ATs//ITZooZLcvBeTjwKir383PP1fTKxpE8dds+xfRtfC1M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/xstate: reset cached register values on resume
Message-Id: <E1mj12X-0003qH-PV@xenbits.xenproject.org>
Date: Fri, 05 Nov 2021 15:22:01 +0000

commit f7f4a523927fa4c7598e4647a16bc3e3cf8009d0
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Nov 4 14:42:37 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Nov 4 14:42:37 2021 +0100

    x86/xstate: reset cached register values on resume
    
    set_xcr0() and set_msr_xss() use cached value to avoid setting the
    register to the same value over and over. But suspend/resume implicitly
    reset the registers and since percpu areas are not deallocated on
    suspend anymore, the cache gets stale.
    Reset the cache on resume, to ensure the next write will really hit the
    hardware. Choose value 0, as it will never be a legitimate write to
    those registers - and so, will force write (and cache update).
    
    Note the cache is used io get_xcr0() and get_msr_xss() too, but:
    - set_xcr0() is called few lines below in xstate_init(), so it will
      update the cache with appropriate value
    - get_msr_xss() is not used anywhere - and thus not before any
      set_msr_xss() that will fill the cache
    
    Fixes: aca2a985a55a "xen: don't free percpu areas during suspend"
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/x86/xstate.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 6aaf9a2f15..3b32bdc51c 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -642,6 +642,13 @@ void xstate_init(struct cpuinfo_x86 *c)
         return;
     }
 
+    /*
+     * Zap the cached values to make set_xcr0() and set_msr_xss() really
+     * write it.
+     */
+    this_cpu(xcr0) = 0;
+    this_cpu(xss) = ~0;
+
     cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx);
     feature_mask = (((u64)edx << 32) | eax) & XCNTXT_MASK;
     BUG_ON(!valid_xcr0(feature_mask));
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 05 15:22:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Nov 2021 15:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.222466.384661 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mj12j-0006mS-1U; Fri, 05 Nov 2021 15:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 222466.384661; Fri, 05 Nov 2021 15: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 1mj12i-0006mI-UP; Fri, 05 Nov 2021 15:22:12 +0000
Received: by outflank-mailman (input) for mailman id 222466;
 Fri, 05 Nov 2021 15: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 1mj12h-0006mA-VZ
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 15:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mj12h-0001QG-Uv
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 15:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mj12h-0003rL-Tq
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 15:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+3wv03arwkDqMby/uXdzuSviAdNPxygm1/0iX7b+GS8=; b=TTgDfCDh1vGB4SpazrzB7Zhbqp
	IptN6X5r/sGWgeWgVbBe138fYCse4O2qGhjtAyHJ0J/uFK1z1WGNktIXQWdPthZvjSRRX1UraJb0H
	vwDFxnx3qmuvhMEguEshRsJsGyBmuwDPCg4SB9RfcCJ5fCXyy25Tp+3rjWUlxUmfGxp0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/IOMMU: mark IOMMU / intremap not in use when ACPI tables are missing
Message-Id: <E1mj12h-0003rL-Tq@xenbits.xenproject.org>
Date: Fri, 05 Nov 2021 15:22:11 +0000

commit 46c4061cd2bf69e8039021af615c2bdb94e50088
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Nov 4 14:44:01 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Nov 4 14:44:01 2021 +0100

    x86/IOMMU: mark IOMMU / intremap not in use when ACPI tables are missing
    
    x2apic_bsp_setup() gets called ahead of iommu_setup(), and since x2APIC
    mode (physical vs clustered) depends on iommu_intremap, that variable
    needs to be set to off as soon as we know we can't / won't enable
    interrupt remapping, i.e. in particular when parsing of the respective
    ACPI tables failed. Move the turning off of iommu_intremap from AMD
    specific code into acpi_iommu_init(), accompanying it by clearing of
    iommu_enable.
    
    Take the opportunity and also fully skip ACPI table parsing logic on
    VT-d when both "iommu=off" and "iommu=no-intremap" are in effect anyway,
    like was already the case for AMD.
    
    The tag below only references the commit uncovering a pre-existing
    anomaly.
    
    Fixes: d8bd82327b0f ("AMD/IOMMU: obtain IVHD type to use earlier")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  6 ------
 xen/drivers/passthrough/vtd/dmar.c          |  6 +-----
 xen/drivers/passthrough/x86/iommu.c         | 18 ++++++++++++++++++
 xen/include/asm-x86/acpi.h                  |  8 +-------
 4 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index 03228a9952..9642bba43a 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -183,9 +183,6 @@ int __init acpi_ivrs_init(void)
 {
     int rc;
 
-    if ( !iommu_enable && !iommu_intremap )
-        return 0;
-
     rc = amd_iommu_get_supported_ivhd_type();
     if ( rc < 0 )
         return rc;
@@ -193,10 +190,7 @@ int __init acpi_ivrs_init(void)
     ivhd_type = rc;
 
     if ( (amd_iommu_detect_acpi() !=0) || (iommu_found() == 0) )
-    {
-        iommu_intremap = iommu_intremap_off;
         return -ENODEV;
-    }
 
     iommu_init_ops = &_iommu_init_ops;
 
diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index d5ee367599..33a12b2ae9 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -777,11 +777,7 @@ static int __init acpi_parse_dmar(struct acpi_table_header *table)
     dmar = (struct acpi_table_dmar *)table;
     dmar_flags = dmar->flags;
 
-    if ( !iommu_enable && !iommu_intremap )
-    {
-        ret = -EINVAL;
-        goto out;
-    }
+    ASSERT(iommu_enable || iommu_intremap);
 
     if ( !dmar->width )
     {
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index 01dbd9b098..b2284ae001 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -41,6 +41,24 @@ enum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full;
 bool __read_mostly iommu_intpost;
 #endif
 
+void __init acpi_iommu_init(void)
+{
+    int ret;
+
+    if ( !iommu_enable && !iommu_intremap )
+        return;
+
+    ret = acpi_dmar_init();
+    if ( ret == -ENODEV )
+        ret = acpi_ivrs_init();
+
+    if ( ret )
+    {
+        iommu_enable = false;
+        iommu_intremap = iommu_intremap_off;
+    }
+}
+
 int __init iommu_hardware_setup(void)
 {
     struct IO_APIC_route_entry **ioapic_entries = NULL;
diff --git a/xen/include/asm-x86/acpi.h b/xen/include/asm-x86/acpi.h
index 7032f3a001..9a9cc4c240 100644
--- a/xen/include/asm-x86/acpi.h
+++ b/xen/include/asm-x86/acpi.h
@@ -141,16 +141,10 @@ extern u32 x86_acpiid_to_apicid[];
 extern u32 pmtmr_ioport;
 extern unsigned int pmtmr_width;
 
+void acpi_iommu_init(void);
 int acpi_dmar_init(void);
 int acpi_ivrs_init(void);
 
-static inline int acpi_iommu_init(void)
-{
-    int ret = acpi_dmar_init();
-
-    return ret == -ENODEV ? acpi_ivrs_init() : ret;
-}
-
 void acpi_mmcfg_init(void);
 
 /* Incremented whenever we transition through S3. Value is 1 during boot. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 05 15:22:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Nov 2021 15:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.222467.384664 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mj12t-0006pU-2n; Fri, 05 Nov 2021 15:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 222467.384664; Fri, 05 Nov 2021 15: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 1mj12s-0006pM-W3; Fri, 05 Nov 2021 15:22:22 +0000
Received: by outflank-mailman (input) for mailman id 222467;
 Fri, 05 Nov 2021 15: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 1mj12s-0006pA-33
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 15: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 1mj12s-0001QZ-2P
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 15:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mj12s-0003ty-0x
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 15: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=o1cFQdja9P/s2I0IdA2FXau/cp2ip0gBr9svDZBbYnI=; b=dUn74DrfjnvcXDPc4g6J9ajoXD
	f3LGJnp+jx8nitp6+bkcrUYqsEohJAptKDemw3RIKqpeMxUxPvvSoCEcl2m+cTzGBj1ULqrTMbDsd
	6BwM94OXVjsdihF69LxcJOxuQKMyh0ESsEc3l6WieNmdRLuYtK3aRaqSKuQllypmkauI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/APIC: avoid iommu_supports_x2apic() on error path
Message-Id: <E1mj12s-0003ty-0x@xenbits.xenproject.org>
Date: Fri, 05 Nov 2021 15:22:22 +0000

commit 0f50d1696b3c13cbf0b18fec817fc291d5a30a31
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Nov 4 14:44:43 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Nov 4 14:44:43 2021 +0100

    x86/APIC: avoid iommu_supports_x2apic() on error path
    
    The value it returns may change from true to false in case
    iommu_enable_x2apic() fails and, as a side effect, clears iommu_intremap
    (as can happen at least on AMD). Latch the return value from the first
    invocation to replace the second one.
    
    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/apic.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 8ab8214559..030792cabb 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -865,6 +865,7 @@ void x2apic_ap_setup(void)
 void __init x2apic_bsp_setup(void)
 {
     struct IO_APIC_route_entry **ioapic_entries = NULL;
+    bool iommu_x2apic;
     const char *orig_name;
 
     if ( !cpu_has_x2apic )
@@ -880,7 +881,8 @@ void __init x2apic_bsp_setup(void)
         printk("x2APIC: Already enabled by BIOS: Ignoring cmdline disable.\n");
     }
 
-    if ( iommu_supports_x2apic() )
+    iommu_x2apic = iommu_supports_x2apic();
+    if ( iommu_x2apic )
     {
         if ( (ioapic_entries = alloc_ioapic_entries()) == NULL )
         {
@@ -933,8 +935,11 @@ void __init x2apic_bsp_setup(void)
         printk("Switched to APIC driver %s\n", genapic.name);
 
 restore_out:
-    /* iommu_x2apic_enabled cannot be used here in the error case. */
-    if ( iommu_supports_x2apic() )
+    /*
+     * iommu_x2apic_enabled and iommu_supports_x2apic() cannot be used here
+     * in the error case.
+     */
+    if ( iommu_x2apic )
     {
         /*
          * NB: do not use raw mode when restoring entries if the iommu has
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 05 15:22:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Nov 2021 15:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.222468.384669 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mj133-0006sv-48; Fri, 05 Nov 2021 15:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 222468.384669; Fri, 05 Nov 2021 15: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 1mj133-0006sn-1I; Fri, 05 Nov 2021 15:22:33 +0000
Received: by outflank-mailman (input) for mailman id 222468;
 Fri, 05 Nov 2021 15: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 1mj132-0006sa-77
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 15: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 1mj132-0001Qo-6M
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 15:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mj132-0003uy-4o
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 15: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=0EHpVylgGes8K0dwCdVNVZzv/r/sQ6jzvQ5JnjdBfI8=; b=iioqeTS17L3p+IbSeBfmEb3L+j
	OLMyhAUGi7X+NbgnOLAAAaN89o3Z1C/WcRF8QphptrMOepm6vja5cAyqwNPY4zp68NWj2sePs4qyY
	PBzHd9YvcfzO6dmPSCh6la7FvqQkv6cKB7wx05oossYsbQR7+WUsZ0seVojlHRtm5uds=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/helpers: fix broken xenstore stubdom init
Message-Id: <E1mj132-0003uy-4o@xenbits.xenproject.org>
Date: Fri, 05 Nov 2021 15:22:32 +0000

commit 86a192e511bd826c59ae1643d06fd52a5bc21ca6
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Nov 4 15:42:42 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Nov 4 18:43:20 2021 +0000

    tools/helpers: fix broken xenstore stubdom init
    
    Commit 1787cc167906f3f ("libs/guest: Move the guest ABI check earlier
    into xc_dom_parse_image()") broke starting the xenstore stubdom. This
    is due to a rather special way the xenstore stubdom domain config is
    being initialized: in order to support both, PV and PVH stubdom,
    init-xenstore-domain is using xc_dom_parse_image() to find the correct
    domain type. Unfortunately above commit requires xc_dom_boot_xen_init()
    to have been called before using xc_dom_parse_image(). This requires
    the domid, which is known only after xc_domain_create(), which requires
    the domain type.
    
    In order to break this circular dependency, call xc_dom_boot_xen_init()
    with an arbitrary domid first, and then set dom->guest_domid later.
    
    Fixes: 1787cc167906f3f ("libs/guest: Move the guest ABI check earlier into xc_dom_parse_image()")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Release-acked-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/helpers/init-xenstore-domain.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xenstore-domain.c
index 6836002f0b..a79662bd1b 100644
--- a/tools/helpers/init-xenstore-domain.c
+++ b/tools/helpers/init-xenstore-domain.c
@@ -132,6 +132,13 @@ static int build(xc_interface *xch)
         }
     }
 
+    rv = xc_dom_boot_xen_init(dom, xch, domid);
+    if ( rv )
+    {
+        fprintf(stderr, "xc_dom_boot_xen_init failed\n");
+        goto err;
+    }
+
     dom->container_type = XC_DOM_HVM_CONTAINER;
     rv = xc_dom_parse_image(dom);
     if ( rv )
@@ -214,16 +221,11 @@ static int build(xc_interface *xch)
     else
         snprintf(cmdline, 512, "--event %d --internal-db", rv);
 
+    dom->guest_domid = domid;
     dom->cmdline = xc_dom_strdup(dom, cmdline);
     dom->xenstore_domid = domid;
     dom->console_evtchn = console_evtchn;
 
-    rv = xc_dom_boot_xen_init(dom, xch, domid);
-    if ( rv )
-    {
-        fprintf(stderr, "xc_dom_boot_xen_init failed\n");
-        goto err;
-    }
     rv = xc_dom_mem_init(dom, memory);
     if ( rv )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 05 15:22:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Nov 2021 15:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.222469.384674 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mj13D-0006vY-6X; Fri, 05 Nov 2021 15:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 222469.384674; Fri, 05 Nov 2021 15: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 1mj13D-0006vS-2p; Fri, 05 Nov 2021 15:22:43 +0000
Received: by outflank-mailman (input) for mailman id 222469;
 Fri, 05 Nov 2021 15: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 1mj13C-0006vM-BD
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 15: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 1mj13C-0001RH-AT
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 15:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mj13C-0003wN-93
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 15: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=VscPQHkoz+0xdzSdMmFnVgLfzsnFJn1cWIWqJEd9glw=; b=h+/wjfjJy5/4OvHzQkwy4hWGEL
	wA3fP4P8AhYiG1lo+qQBblX/0g3shXbyCodmqN1eUG/KKLLhaMsPjWh+Wek9vR3G3WnTfThfbDGAA
	RexjFRJc25c2ymvJ77gT+a4k4gQbwHBmEoQ5Wag6ao3ST+aLO8PO8BW0NqVgMWXWwbLs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] configure: modify default of building rombios
Message-Id: <E1mj13C-0003wN-93@xenbits.xenproject.org>
Date: Fri, 05 Nov 2021 15:22:42 +0000

commit bcf77ce510047b9d311d9276646cc449c526e3a5
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Nov 4 17:11:20 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Nov 4 18:43:20 2021 +0000

    configure: modify default of building rombios
    
    The tools/configure script will default to build rombios if qemu
    traditional is enabled. If rombios is being built, ipxe will be built
    per default, too.
    
    This results in rombios and ipxe no longer being built by default when
    disabling qemu traditional.
    
    Fix that be rearranging the dependencies:
    
    - build ipxe by default
    - build rombios by default if either ipxe or qemu traditional are
      being built
    
    This modification prepares not building qemu traditional by default
    without affecting build of rombios and ipxe.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/configure    | 115 ++++++++++++++++++++++++-----------------------------
 tools/configure.ac |  67 +++++++++++++++----------------
 2 files changed, 85 insertions(+), 97 deletions(-)

diff --git a/tools/configure b/tools/configure
index 33814b24b3..d980b3ffc9 100755
--- a/tools/configure
+++ b/tools/configure
@@ -698,7 +698,6 @@ APPEND_INCLUDES
 PREPEND_LIB
 PREPEND_INCLUDES
 EXTRA_QEMUU_CONFIGURE_ARGS
-ipxe
 qemu_xen_systemd
 qemu_xen_path
 qemu_xen
@@ -706,6 +705,7 @@ rombios
 BCC
 LD86
 AS86
+ipxe
 qemu_traditional
 LINUX_BACKEND_MODULES
 golang
@@ -815,13 +815,13 @@ enable_seabios
 enable_golang
 with_linux_backend_modules
 enable_qemu_traditional
+enable_ipxe
+with_system_ipxe
 enable_rombios
 with_system_qemu
 with_stubdom_qmp_proxy
 with_system_seabios
 with_system_ovmf
-enable_ipxe
-with_system_ipxe
 with_extra_qemuu_configure_args
 with_xenstored
 enable_systemd
@@ -1504,10 +1504,10 @@ Optional Features:
   --enable-qemu-traditional
                           Enable qemu traditional device model, (DEFAULT is on
                           for Linux or NetBSD x86, otherwise off)
+  --enable-ipxe           Enable in-tree IPXE, (DEFAULT is on for x86,
+                          otherwise off, see also --with-system-ipxe)
   --enable-rombios        Enable ROMBIOS, (DEFAULT is on if qemu-traditional
-                          is enabled, otherwise off)
-  --disable-ipxe          Enable in-tree IPXE, (DEFAULT is on if rombios is
-                          enabled, otherwise off, see also --with-system-ipxe)
+                          or ipxe is enabled, otherwise off)
   --enable-systemd        Enable systemd support (default is DISABLED)
   --enable-9pfs           Explicitly enable 9pfs support in QEMU build
                           (default is to defer to QEMU configure default)
@@ -1538,6 +1538,11 @@ Optional Packages:
   --with-linux-backend-modules="mod1 mod2"
                           List of Linux backend module or modalias names to be
                           autoloaded on startup.
+  --with-system-ipxe[=PATH]
+                          Use system supplied IPXE PATH instead of building
+                          and installing our own version, it takes precedence
+                          over --{en,dis}able-ipxe, --without-system-ipxe is
+                          an error
   --with-system-qemu[=PATH]
                           Use system supplied qemu PATH or qemu (taken from
                           $PATH) as qemu-xen device model instead of building
@@ -1551,12 +1556,6 @@ Optional Packages:
   --with-system-ovmf[=PATH]
                           Use system supplied OVMF PATH instead of building
                           and installing our own version
-  --with-system-ipxe[=PATH]
-                          Use system supplied IPXE PATH instead of building
-                          and installing our own version, it takes precedence
-                          over --{en,dis}able-ipxe and is bound by the
-                          presence of rombios, --without-system-ipxe is an
-                          error
   --with-extra-qemuu-configure-args[="--ARG1 ..."]
                           List of additional configure options for upstream
                           qemu
@@ -4314,13 +4313,54 @@ else
 
 fi
 
+if test "x$enable_ipxe" = "xno"; then :
+  ipxe=n
+else
+  ipxe=y
+fi
+
+# Check whether --enable-ipxe was given.
+if test "${enable_ipxe+set}" = set; then :
+  enableval=$enable_ipxe;
+else
+
+    case "$host_cpu" in
+        i[3456]86|x86_64)
+           enable_ipxe="yes";;
+        *) enable_ipxe="no";;
+    esac
+
+fi
+
+
+# Check whether --with-system-ipxe was given.
+if test "${with_system_ipxe+set}" = set; then :
+  withval=$with_system_ipxe;
+    case $withval in
+        no) as_fn_error $? "--without-system-ipxe has no effect" "$LINENO" 5 ;;
+        /*)  ipxe_path=$withval; ipxe=n ;;
+        *) as_fn_error $? "IPXE specified, but is not an absolute path" "$LINENO" 5 ;;
+    esac
+
+fi
+
+if test "x$ipxe" = "xy" -o -n "$ipxe_path" ; then :
+
+
+cat >>confdefs.h <<_ACEOF
+#define IPXE_PATH "${ipxe_path:-$XENFIRMWAREDIR/ipxe.bin}"
+_ACEOF
+
+
+fi
+
 
 # Check whether --enable-rombios was given.
 if test "${enable_rombios+set}" = set; then :
   enableval=$enable_rombios;
 else
 
-    if test "x$enable_qemu_traditional" = "xyes"; then :
+    if test "x$enable_qemu_traditional" = "xyes" -o "x$enable_ipxe" = "xyes"; then :
 
         enable_rombios="yes"
 
@@ -4635,55 +4675,6 @@ _ACEOF
 
 fi
 
-# Check whether --enable-ipxe was given.
-if test "${enable_ipxe+set}" = set; then :
-  enableval=$enable_ipxe;
-     if test "x$enable_ipxe" = "xno"; then :
-  ipxe=n
-else
-  ipxe=y
-fi
-
-else
-
-    if test "x$enable_rombios" = "xno"; then :
-  ipxe=n
-else
-  ipxe=y
-fi
-
-fi
-
-
-# Check whether --with-system-ipxe was given.
-if test "${with_system_ipxe+set}" = set; then :
-  withval=$with_system_ipxe;
-    case $withval in
-        no) as_fn_error $? "--without-system-ipxe has no effect" "$LINENO" 5 ;;
-        /*)  ipxe_path=$withval; ipxe=n ;;
-        *) as_fn_error $? "IPXE specified, but is not an absolute path" "$LINENO" 5 ;;
-    esac
-
-fi
-
-if test "x$ipxe" = "xy" -o -n "$ipxe_path" ; then :
-
-
-    if test "x$enable_rombios" = "xno"; then :
-
-        as_fn_error $? "Rombios is required to use IPXE" "$LINENO" 5
-
-fi
-
-
-cat >>confdefs.h <<_ACEOF
-#define IPXE_PATH "${ipxe_path:-$XENFIRMWAREDIR/ipxe.bin}"
-_ACEOF
-
-
-fi
-
-
 
 # Check whether --with-extra-qemuu-configure-args was given.
 if test "${with_extra_qemuu_configure_args+set}" = set; then :
diff --git a/tools/configure.ac b/tools/configure.ac
index 6414fcbb44..97582951c8 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -139,10 +139,40 @@ AC_DEFINE([HAVE_QEMU_TRADITIONAL], [1], [Qemu traditional enabled])
 ])
 AC_SUBST(qemu_traditional)
 
+AC_ARG_ENABLE([ipxe],
+    AS_HELP_STRING([--enable-ipxe],
+                   [Enable in-tree IPXE, (DEFAULT is on for x86,
+                    otherwise off, see also --with-system-ipxe)]),,[
+    case "$host_cpu" in
+        i[[3456]]86|x86_64)
+           enable_ipxe="yes";;
+        *) enable_ipxe="no";;
+    esac
+])
+AS_IF([test "x$enable_ipxe" = "xno"], [ipxe=n], [ipxe=y])
+AC_ARG_WITH([system-ipxe],
+    AS_HELP_STRING([--with-system-ipxe@<:@=PATH@:>@],
+       [Use system supplied IPXE PATH instead of building and installing
+        our own version, it takes precedence over --{en,dis}able-ipxe,
+        --without-system-ipxe is an error]),[
+    case $withval in
+        no) AC_MSG_ERROR([--without-system-ipxe has no effect]) ;;
+        /*)  ipxe_path=$withval; ipxe=n ;;
+        *) AC_MSG_ERROR([IPXE specified, but is not an absolute path]) ;;
+    esac
+],[])
+AS_IF([test "x$ipxe" = "xy" -o -n "$ipxe_path" ], [
+    AC_DEFINE_UNQUOTED([IPXE_PATH],
+                       ["${ipxe_path:-$XENFIRMWAREDIR/ipxe.bin}"],
+                       [IPXE path])
+])
+AC_SUBST(ipxe)
+
 AC_ARG_ENABLE([rombios],
     AS_HELP_STRING([--enable-rombios],
-                   [Enable ROMBIOS, (DEFAULT is on if qemu-traditional is enabled, otherwise off)]),,[
-    AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
+                   [Enable ROMBIOS, (DEFAULT is on if qemu-traditional or ipxe is enabled,
+                    otherwise off)]),,[
+    AS_IF([test "x$enable_qemu_traditional" = "xyes" -o "x$enable_ipxe" = "xyes"], [
         enable_rombios="yes"
     ], [
         enable_rombios="no"
@@ -240,39 +270,6 @@ AS_IF([test "x$ovmf" = "xy" -o -n "$ovmf_path" ], [
                        [OVMF path])
 ])
 
-AC_ARG_ENABLE([ipxe],
-    AS_HELP_STRING([--disable-ipxe],
-                   [Enable in-tree IPXE, (DEFAULT is on if rombios is enabled,
-                    otherwise off, see also --with-system-ipxe)]),
-    [
-     AS_IF([test "x$enable_ipxe" = "xno"], [ipxe=n], [ipxe=y])
-    ],
-    [
-    AS_IF([test "x$enable_rombios" = "xno"], [ipxe=n], [ipxe=y])
-])
-AC_ARG_WITH([system-ipxe],
-    AS_HELP_STRING([--with-system-ipxe@<:@=PATH@:>@],
-       [Use system supplied IPXE PATH instead of building and installing
-        our own version, it takes precedence over --{en,dis}able-ipxe and is
-        bound by the presence of rombios, --without-system-ipxe is an error]),[
-    case $withval in
-        no) AC_MSG_ERROR([--without-system-ipxe has no effect]) ;;
-        /*)  ipxe_path=$withval; ipxe=n ;;
-        *) AC_MSG_ERROR([IPXE specified, but is not an absolute path]) ;;
-    esac
-],[])
-AS_IF([test "x$ipxe" = "xy" -o -n "$ipxe_path" ], [
-
-    AS_IF([test "x$enable_rombios" = "xno"], [
-        AC_MSG_ERROR([Rombios is required to use IPXE])
-    ], [])
-
-    AC_DEFINE_UNQUOTED([IPXE_PATH],
-                       ["${ipxe_path:-$XENFIRMWAREDIR/ipxe.bin}"],
-                       [IPXE path])
-])
-AC_SUBST(ipxe)
-
 AC_ARG_WITH([extra-qemuu-configure-args],
     AS_HELP_STRING([--with-extra-qemuu-configure-args@<:@="--ARG1 ..."@:>@],
        [List of additional configure options for upstream qemu]),[
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 05 15:22:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Nov 2021 15:22:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.222470.384677 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mj13O-0006z3-9C; Fri, 05 Nov 2021 15:22:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 222470.384677; Fri, 05 Nov 2021 15:22:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mj13O-0006yv-6L; Fri, 05 Nov 2021 15:22:54 +0000
Received: by outflank-mailman (input) for mailman id 222470;
 Fri, 05 Nov 2021 15: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 1mj13M-0006yY-Hm
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 15: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 1mj13M-0001RS-EM
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 15:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mj13M-0003x1-DU
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 15: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=A00l6YQAT09pW4PrEB4UY56TIMDYx7HKz7TvUtl5JVI=; b=CNa/fssakeLEtQ7XdqcBXzE6Xz
	xx9qDQhuaIo4xAFWP6DVl3byL7c2ofY9BJl/xpLZB73EEPQSnkfyJi4ZiPIOgyXiAtYrudZdiOVwq
	wooKcFo1bwJvc63v9Zt1OQIW28SbImunuoe5UwlkbWBo0gSucldupUW2+nBgJIJyxkXc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: disable building qemu-trad per default
Message-Id: <E1mj13M-0003x1-DU@xenbits.xenproject.org>
Date: Fri, 05 Nov 2021 15:22:52 +0000

commit faddd16e367530fe4de5480610f69d8ceb6011d8
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Nov 4 17:11:21 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Nov 4 18:43:20 2021 +0000

    tools: disable building qemu-trad per default
    
    Using qemu-traditional as device model is deprecated for some time now.
    
    So change the default for building it to "disable". This will affect
    ioemu-stubdom, too, as there is a direct dependency between the two.
    
    Today it is possible to use a PVH/HVM Linux-based stubdom as device
    model. Additionally using ioemu-stubdom isn't really helping for
    security, as it requires to run a very old and potentially buggy qemu
    version in a PV domain. This is adding probably more security problems
    than it is removing by using a stubdom.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Acked-by: Ian Jackson <iwj@xenproject.org>
    Release-acked-by: Ian Jackson <iwj@xenproject.org>
---
 CHANGELOG.md         |  3 +++
 stubdom/configure    |  8 --------
 stubdom/configure.ac |  8 +-------
 tools/configure      | 17 ++---------------
 tools/configure.ac   | 13 +------------
 5 files changed, 7 insertions(+), 42 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e7107ac3de..e5ab49e779 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    or by passing "iommu=quarantine=scratch-page" on the hypervisor command line.
  - pv-grub stubdoms will no longer be built per default. In order to be able to use pv-grub
    configure needs to be called with "--enable-pv-grub" as parameter.
+ - qemu-traditional based device models (both, qemu-traditional and ioemu-stubdom) will
+   no longer be built per default. In order to be able to use those, configure needs to
+   be called with "--enable-qemu-traditional" as parameter.
 
 ## [4.15.0 UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - TBD
 
diff --git a/stubdom/configure b/stubdom/configure
index df31532abb..07b709f998 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -2286,14 +2286,6 @@ fi
 # Check whether --enable-qemu-traditional was given.
 if test "${enable_qemu_traditional+set}" = set; then :
   enableval=$enable_qemu_traditional;
-else
-
-    case "$host_cpu" in
-        i[3456]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-
 fi
 
 if test "x$enable_qemu_traditional" = "xyes"; then :
diff --git a/stubdom/configure.ac b/stubdom/configure.ac
index a07a1edae5..e20d99edac 100644
--- a/stubdom/configure.ac
+++ b/stubdom/configure.ac
@@ -27,13 +27,7 @@ AX_STUBDOM_DEFAULT_ENABLE([xenstorepvh-stubdom], [xenstorepvh])
 AX_STUBDOM_CONDITIONAL([vtpm-stubdom], [vtpm])
 AX_STUBDOM_CONDITIONAL([vtpmmgr-stubdom], [vtpmmgr])
 
-AC_ARG_ENABLE([qemu-traditional],,,[
-    case "$host_cpu" in
-        i[[3456]]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-])
+AC_ARG_ENABLE([qemu-traditional])
 AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
     qemu_traditional=y],[
     qemu_traditional=n
diff --git a/tools/configure b/tools/configure
index d980b3ffc9..a3d33eb907 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1502,8 +1502,8 @@ Optional Features:
   --disable-seabios       Disable SeaBIOS (default is ENABLED)
   --disable-golang        Disable Go tools (default is ENABLED)
   --enable-qemu-traditional
-                          Enable qemu traditional device model, (DEFAULT is on
-                          for Linux or NetBSD x86, otherwise off)
+                          Enable qemu traditional device model, (DEFAULT is
+                          off)
   --enable-ipxe           Enable in-tree IPXE, (DEFAULT is on for x86,
                           otherwise off, see also --with-system-ipxe)
   --enable-rombios        Enable ROMBIOS, (DEFAULT is on if qemu-traditional
@@ -4286,19 +4286,6 @@ LINUX_BACKEND_MODULES="`eval echo $LINUX_BACKEND_MODULES`"
 # Check whether --enable-qemu-traditional was given.
 if test "${enable_qemu_traditional+set}" = set; then :
   enableval=$enable_qemu_traditional;
-else
-
-    case "$host_cpu" in
-        i[3456]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-    case "$host_os" in
-        freebsd*)
-           enable_qemu_traditional="no";;
-    esac
-
-
 fi
 
 if test "x$enable_qemu_traditional" = "xyes"; then :
diff --git a/tools/configure.ac b/tools/configure.ac
index 97582951c8..03eb7cf146 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -120,18 +120,7 @@ AC_SUBST(LINUX_BACKEND_MODULES)
 
 AC_ARG_ENABLE([qemu-traditional],
     AS_HELP_STRING([--enable-qemu-traditional],
-                   [Enable qemu traditional device model, (DEFAULT is on for Linux or NetBSD x86, otherwise off)]),,[
-    case "$host_cpu" in
-        i[[3456]]86|x86_64)
-           enable_qemu_traditional="yes";;
-        *) enable_qemu_traditional="no";;
-    esac
-    case "$host_os" in
-        freebsd*)
-           enable_qemu_traditional="no";;
-    esac
-
-])
+                   [Enable qemu traditional device model, (DEFAULT is off)]))
 AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
 AC_DEFINE([HAVE_QEMU_TRADITIONAL], [1], [Qemu traditional enabled])
     qemu_traditional=y],[
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 05 16:00:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 05 Nov 2021 16:00:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.222522.384769 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mj1dO-0006u3-0w; Fri, 05 Nov 2021 16:00:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 222522.384769; Fri, 05 Nov 2021 16:00:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mj1dN-0006tv-TF; Fri, 05 Nov 2021 16:00:05 +0000
Received: by outflank-mailman (input) for mailman id 222522;
 Fri, 05 Nov 2021 16: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 1mj1dM-0006ka-UC
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 16:00:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mj1dM-0002Xh-T4
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 16:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mj1dM-0006St-SD
 for xen-changelog@lists.xenproject.org; Fri, 05 Nov 2021 16:00:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Bt16kl2O+2/09GC2dO8E2H8VHHS24mB+mzCS+rBS94c=; b=ETMOm9rw6a/5mXohk9nJ5zrshQ
	0cBDfuUrjtgGoG4NfHkpl1j927Wmv0SDPgCOH2iVbMwnRjJLwEVkCthMwgjQE/NOMzUDetjG6wc7o
	HhbYsstWuckXAkEcqTo8t0Qiae/Q1EkTUzYT9skgKxbHM/72npP+BREiew1OmyivgxZg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/efi: Fix Grub2 boot on arm64
Message-Id: <E1mj1dM-0006St-SD@xenbits.xenproject.org>
Date: Fri, 05 Nov 2021 16:00:04 +0000

commit 9bc9fff04ba077c4a9782f12578362d8947c534b
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Fri Nov 5 13:07:28 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Fri Nov 5 15:59:43 2021 +0000

    xen/efi: Fix Grub2 boot on arm64
    
    The code introduced by commit a1743fc3a9fe9b68c265c45264dddf214fd9b882
    ("arm/efi: Use dom0less configuration when using EFI boot") is
    introducing a problem to boot Xen using Grub2 on ARM machine using EDK2.
    
    Despite UEFI specification, EDK2+Grub2 is returning a NULL DeviceHandle
    inside the interface given by the LOADED_IMAGE_PROTOCOL service, this
    handle is used later by efi_bs->HandleProtocol(...) inside
    get_parent_handle(...) when requesting the SIMPLE_FILE_SYSTEM_PROTOCOL
    interface, causing Xen to stop the boot because of an EFI_INVALID_PARAMETER
    error.
    
    Before the commit above, the function was never called because the
    logic was skipping the call when there were multiboot modules in the
    DT because the filesystem was never used and the bootloader had
    put in place all the right modules in memory and the addresses
    in the DT.
    
    To fix the problem the old logic is put back in place. Because the handle
    was given to the efi_check_dt_boot(...), but the revert put the handle
    out of scope, the signature of the function is changed to use an
    EFI_LOADED_IMAGE handle and request the EFI_FILE_HANDLE only when
    needed (module found using xen,uefi-binary).
    
    Another problem is found when the UEFI stub tries to check if Dom0
    image or DomUs are present.
    The logic doesn't work when the UEFI stub is not responsible to load
    any modules, so the efi_check_dt_boot(...) return value is modified
    to return the number of multiboot module found and not only the number
    of module loaded by the stub.
    Taking the occasion to update the comment in handle_module_node(...)
    to explain why we return success even if xen,uefi-binary is not found.
    
    Fixes: a1743fc3a9 ("arm/efi: Use dom0less configuration when using EFI boot")
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/efi/efi-boot.h | 61 +++++++++++++++++++++++++++++----------------
 xen/common/efi/boot.c       | 18 +++++++------
 2 files changed, 50 insertions(+), 29 deletions(-)

diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
index 8b88dd26a5..458cfbbed4 100644
--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -44,17 +44,17 @@ void __flush_dcache_area(const void *vaddr, unsigned long size);
 
 static int get_module_file_index(const char *name, unsigned int name_len);
 static void PrintMessage(const CHAR16 *s);
-static int allocate_module_file(EFI_FILE_HANDLE dir_handle,
+static int allocate_module_file(EFI_LOADED_IMAGE *loaded_image,
                                 const char *name,
                                 unsigned int name_len);
-static int handle_module_node(EFI_FILE_HANDLE dir_handle,
+static int handle_module_node(EFI_LOADED_IMAGE *loaded_image,
                               int module_node_offset,
                               int reg_addr_cells,
                               int reg_size_cells,
                               bool is_domu_module);
-static int handle_dom0less_domain_node(EFI_FILE_HANDLE dir_handle,
+static int handle_dom0less_domain_node(EFI_LOADED_IMAGE *loaded_image,
                                        int domain_node);
-static int efi_check_dt_boot(EFI_FILE_HANDLE dir_handle);
+static int efi_check_dt_boot(EFI_LOADED_IMAGE *loaded_image);
 
 #define DEVICE_TREE_GUID \
 {0xb1b621d5, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0}}
@@ -647,11 +647,13 @@ static void __init PrintMessage(const CHAR16 *s)
  * This function allocates a binary and keeps track of its name, it returns the
  * index of the file in the modules array or a negative number on error.
  */
-static int __init allocate_module_file(EFI_FILE_HANDLE dir_handle,
+static int __init allocate_module_file(EFI_LOADED_IMAGE *loaded_image,
                                        const char *name,
                                        unsigned int name_len)
 {
+    EFI_FILE_HANDLE dir_handle;
     module_name *file_name;
+    CHAR16 *fname;
     union string module_name;
     int ret;
 
@@ -683,9 +685,14 @@ static int __init allocate_module_file(EFI_FILE_HANDLE dir_handle,
     strlcpy(file_name->name, name, name_len + 1);
     file_name->name_len = name_len;
 
+    /* Get the file system interface. */
+    dir_handle = get_parent_handle(loaded_image, &fname);
+
     /* Load the binary in memory */
     read_file(dir_handle, s2w(&module_name), &module_binary, NULL);
 
+    dir_handle->Close(dir_handle);
+
     /* Save address and size */
     file_name->addr = module_binary.addr;
     file_name->size = module_binary.size;
@@ -702,8 +709,9 @@ static int __init allocate_module_file(EFI_FILE_HANDLE dir_handle,
  * This function checks for the presence of the xen,uefi-binary property in the
  * module, if found it loads the binary as module and sets the right address
  * for the reg property into the module DT node.
+ * Returns 1 if module is multiboot,module, 0 if not, < 0 on error
  */
-static int __init handle_module_node(EFI_FILE_HANDLE dir_handle,
+static int __init handle_module_node(EFI_LOADED_IMAGE *loaded_image,
                                      int module_node_offset,
                                      int reg_addr_cells,
                                      int reg_size_cells,
@@ -730,13 +738,13 @@ static int __init handle_module_node(EFI_FILE_HANDLE dir_handle,
                                  &uefi_name_len);
 
     if ( !uefi_name_prop )
-        /* Property not found */
-        return 0;
+        /* Property not found, but signal this is a multiboot,module */
+        return 1;
 
     file_idx = get_module_file_index(uefi_name_prop, uefi_name_len);
     if ( file_idx < 0 )
     {
-        file_idx = allocate_module_file(dir_handle, uefi_name_prop,
+        file_idx = allocate_module_file(loaded_image, uefi_name_prop,
                                         uefi_name_len);
         if ( file_idx < 0 )
             return file_idx;
@@ -795,19 +803,20 @@ static int __init handle_module_node(EFI_FILE_HANDLE dir_handle,
         }
     }
 
-    return 0;
+    return 1;
 }
 
 /*
  * This function checks for boot modules under the domU guest domain node
  * in the DT.
- * Returns 0 on success, negative number on error.
+ * Returns number of multiboot,module found or negative number on error.
  */
-static int __init handle_dom0less_domain_node(EFI_FILE_HANDLE dir_handle,
+static int __init handle_dom0less_domain_node(EFI_LOADED_IMAGE *loaded_image,
                                               int domain_node)
 {
     int module_node, addr_cells, size_cells, len;
     const struct fdt_property *prop;
+    unsigned int mb_modules_found = 0;
 
     /* Get #address-cells and #size-cells from domain node */
     prop = fdt_get_property(fdt, domain_node, "#address-cells", &len);
@@ -833,24 +842,26 @@ static int __init handle_dom0less_domain_node(EFI_FILE_HANDLE dir_handle,
           module_node > 0;
           module_node = fdt_next_subnode(fdt, module_node) )
     {
-        int ret = handle_module_node(dir_handle, module_node, addr_cells,
+        int ret = handle_module_node(loaded_image, module_node, addr_cells,
                                      size_cells, true);
         if ( ret < 0 )
             return ret;
+
+        mb_modules_found += ret;
     }
 
-    return 0;
+    return mb_modules_found;
 }
 
 /*
  * This function checks for xen domain nodes under the /chosen node for possible
  * dom0 and domU guests to be loaded.
- * Returns the number of modules loaded or a negative number for error.
+ * Returns the number of multiboot modules found or a negative number for error.
  */
-static int __init efi_check_dt_boot(EFI_FILE_HANDLE dir_handle)
+static int __init efi_check_dt_boot(EFI_LOADED_IMAGE *loaded_image)
 {
     int chosen, node, addr_len, size_len;
-    unsigned int i = 0;
+    unsigned int i = 0, modules_found = 0;
 
     /* Check for the chosen node in the current DTB */
     chosen = setup_chosen_node(fdt, &addr_len, &size_len);
@@ -865,15 +876,23 @@ static int __init efi_check_dt_boot(EFI_FILE_HANDLE dir_handle)
           node > 0;
           node = fdt_next_subnode(fdt, node) )
     {
+        int ret;
+
         if ( !fdt_node_check_compatible(fdt, node, "xen,domain") )
         {
             /* Found a node with compatible xen,domain; handle this node. */
-            if ( handle_dom0less_domain_node(dir_handle, node) < 0 )
+            ret = handle_dom0less_domain_node(loaded_image, node);
+            if ( ret < 0 )
                 return ERROR_DT_MODULE_DOMU;
         }
-        else if ( handle_module_node(dir_handle, node, addr_len, size_len,
-                                     false) < 0 )
+        else
+        {
+            ret = handle_module_node(loaded_image, node, addr_len, size_len,
+                                     false);
+            if ( ret < 0 )
                  return ERROR_DT_MODULE_DOM0;
+        }
+        modules_found += ret;
     }
 
     /* Free boot modules file names if any */
@@ -883,7 +902,7 @@ static int __init efi_check_dt_boot(EFI_FILE_HANDLE dir_handle)
         efi_bs->FreePool(modules[i].name);
     }
 
-    return modules_idx;
+    return modules_found;
 }
 
 static void __init efi_arch_cpu(void)
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 392ff3ac9b..8fd5e2d078 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -121,6 +121,8 @@ static char *get_value(const struct file *cfg, const char *section,
 static char *split_string(char *s);
 static CHAR16 *s2w(union string *str);
 static char *w2s(const union string *str);
+static EFI_FILE_HANDLE get_parent_handle(EFI_LOADED_IMAGE *loaded_image,
+                                         CHAR16 **leaf);
 static bool read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name,
                       struct file *file, const char *options);
 static bool read_section(const EFI_LOADED_IMAGE *image, const CHAR16 *name,
@@ -167,7 +169,7 @@ static void __init PrintErr(const CHAR16 *s)
 }
 
 #ifndef CONFIG_HAS_DEVICE_TREE
-static int __init efi_check_dt_boot(EFI_FILE_HANDLE dir_handle)
+static int __init efi_check_dt_boot(EFI_LOADED_IMAGE *loaded_image)
 {
     return 0;
 }
@@ -1144,7 +1146,6 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
     const char *option_str;
     bool use_cfg_file;
     int dt_modules_found;
-    EFI_FILE_HANDLE dir_handle;
 
     __set_bit(EFI_BOOT, &efi_flags);
     __set_bit(EFI_LOADER, &efi_flags);
@@ -1225,11 +1226,9 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
 
     efi_arch_relocate_image(0);
 
-    /* Get the file system interface. */
-    dir_handle = get_parent_handle(loaded_image, &file_name);
-
     if ( use_cfg_file )
     {
+        EFI_FILE_HANDLE dir_handle;
         UINTN depth, cols, rows, size;
 
         size = cols = rows = depth = 0;
@@ -1240,6 +1239,9 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
 
         gop = efi_get_gop();
 
+        /* Get the file system interface. */
+        dir_handle = get_parent_handle(loaded_image, &file_name);
+
         /* Read and parse the config file. */
         if ( read_section(loaded_image, L"config", &cfg, NULL) )
             PrintStr(L"Using builtin config file\r\n");
@@ -1362,14 +1364,14 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
         efi_bs->FreePages(cfg.addr, PFN_UP(cfg.size));
         cfg.addr = 0;
 
+        dir_handle->Close(dir_handle);
+
         if ( gop && !base_video )
             gop_mode = efi_find_gop_mode(gop, cols, rows, depth);
     }
 
     /* Get the number of boot modules specified on the DT or an error (<0) */
-    dt_modules_found = efi_check_dt_boot(dir_handle);
-
-    dir_handle->Close(dir_handle);
+    dt_modules_found = efi_check_dt_boot(loaded_image);
 
     if ( dt_modules_found < 0 )
         /* efi_check_dt_boot throws some error */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Nov 06 05:55:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 06 Nov 2021 05:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.222708.385044 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mjEfP-0002or-EG; Sat, 06 Nov 2021 05:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 222708.385044; Sat, 06 Nov 2021 05:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mjEfP-0002oi-B3; Sat, 06 Nov 2021 05:55:03 +0000
Received: by outflank-mailman (input) for mailman id 222708;
 Sat, 06 Nov 2021 05:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mjEfO-0002oc-70
 for xen-changelog@lists.xenproject.org; Sat, 06 Nov 2021 05:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mjEfO-0002kr-0o
 for xen-changelog@lists.xenproject.org; Sat, 06 Nov 2021 05:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mjEfN-0003IK-W2
 for xen-changelog@lists.xenproject.org; Sat, 06 Nov 2021 05: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=aeMobOcWqVZtGj9M3yh8R0Y3Ze3LzTjerO1pltZxmEU=; b=mB3GYnALZ4XsI1+iOpzNGxpPfy
	IV9ofCrQNpy7ck02o4AjSMm7XarkZhon9UoFZQ1sDiWz1W0ZhtxNhd/wHPkrG8b1W4UBN1aD6Mf9a
	X7T53aLmQjCp0WETDIkGSGXJpTbDvm4UpB3sl9k2v7FyC1DoUFuzWJM39RMzoEgy8hK0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/efi: Fix Grub2 boot on arm64
Message-Id: <E1mjEfN-0003IK-W2@xenbits.xenproject.org>
Date: Sat, 06 Nov 2021 05:55:01 +0000

commit 9bc9fff04ba077c4a9782f12578362d8947c534b
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Fri Nov 5 13:07:28 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Fri Nov 5 15:59:43 2021 +0000

    xen/efi: Fix Grub2 boot on arm64
    
    The code introduced by commit a1743fc3a9fe9b68c265c45264dddf214fd9b882
    ("arm/efi: Use dom0less configuration when using EFI boot") is
    introducing a problem to boot Xen using Grub2 on ARM machine using EDK2.
    
    Despite UEFI specification, EDK2+Grub2 is returning a NULL DeviceHandle
    inside the interface given by the LOADED_IMAGE_PROTOCOL service, this
    handle is used later by efi_bs->HandleProtocol(...) inside
    get_parent_handle(...) when requesting the SIMPLE_FILE_SYSTEM_PROTOCOL
    interface, causing Xen to stop the boot because of an EFI_INVALID_PARAMETER
    error.
    
    Before the commit above, the function was never called because the
    logic was skipping the call when there were multiboot modules in the
    DT because the filesystem was never used and the bootloader had
    put in place all the right modules in memory and the addresses
    in the DT.
    
    To fix the problem the old logic is put back in place. Because the handle
    was given to the efi_check_dt_boot(...), but the revert put the handle
    out of scope, the signature of the function is changed to use an
    EFI_LOADED_IMAGE handle and request the EFI_FILE_HANDLE only when
    needed (module found using xen,uefi-binary).
    
    Another problem is found when the UEFI stub tries to check if Dom0
    image or DomUs are present.
    The logic doesn't work when the UEFI stub is not responsible to load
    any modules, so the efi_check_dt_boot(...) return value is modified
    to return the number of multiboot module found and not only the number
    of module loaded by the stub.
    Taking the occasion to update the comment in handle_module_node(...)
    to explain why we return success even if xen,uefi-binary is not found.
    
    Fixes: a1743fc3a9 ("arm/efi: Use dom0less configuration when using EFI boot")
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/efi/efi-boot.h | 61 +++++++++++++++++++++++++++++----------------
 xen/common/efi/boot.c       | 18 +++++++------
 2 files changed, 50 insertions(+), 29 deletions(-)

diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
index 8b88dd26a5..458cfbbed4 100644
--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -44,17 +44,17 @@ void __flush_dcache_area(const void *vaddr, unsigned long size);
 
 static int get_module_file_index(const char *name, unsigned int name_len);
 static void PrintMessage(const CHAR16 *s);
-static int allocate_module_file(EFI_FILE_HANDLE dir_handle,
+static int allocate_module_file(EFI_LOADED_IMAGE *loaded_image,
                                 const char *name,
                                 unsigned int name_len);
-static int handle_module_node(EFI_FILE_HANDLE dir_handle,
+static int handle_module_node(EFI_LOADED_IMAGE *loaded_image,
                               int module_node_offset,
                               int reg_addr_cells,
                               int reg_size_cells,
                               bool is_domu_module);
-static int handle_dom0less_domain_node(EFI_FILE_HANDLE dir_handle,
+static int handle_dom0less_domain_node(EFI_LOADED_IMAGE *loaded_image,
                                        int domain_node);
-static int efi_check_dt_boot(EFI_FILE_HANDLE dir_handle);
+static int efi_check_dt_boot(EFI_LOADED_IMAGE *loaded_image);
 
 #define DEVICE_TREE_GUID \
 {0xb1b621d5, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0}}
@@ -647,11 +647,13 @@ static void __init PrintMessage(const CHAR16 *s)
  * This function allocates a binary and keeps track of its name, it returns the
  * index of the file in the modules array or a negative number on error.
  */
-static int __init allocate_module_file(EFI_FILE_HANDLE dir_handle,
+static int __init allocate_module_file(EFI_LOADED_IMAGE *loaded_image,
                                        const char *name,
                                        unsigned int name_len)
 {
+    EFI_FILE_HANDLE dir_handle;
     module_name *file_name;
+    CHAR16 *fname;
     union string module_name;
     int ret;
 
@@ -683,9 +685,14 @@ static int __init allocate_module_file(EFI_FILE_HANDLE dir_handle,
     strlcpy(file_name->name, name, name_len + 1);
     file_name->name_len = name_len;
 
+    /* Get the file system interface. */
+    dir_handle = get_parent_handle(loaded_image, &fname);
+
     /* Load the binary in memory */
     read_file(dir_handle, s2w(&module_name), &module_binary, NULL);
 
+    dir_handle->Close(dir_handle);
+
     /* Save address and size */
     file_name->addr = module_binary.addr;
     file_name->size = module_binary.size;
@@ -702,8 +709,9 @@ static int __init allocate_module_file(EFI_FILE_HANDLE dir_handle,
  * This function checks for the presence of the xen,uefi-binary property in the
  * module, if found it loads the binary as module and sets the right address
  * for the reg property into the module DT node.
+ * Returns 1 if module is multiboot,module, 0 if not, < 0 on error
  */
-static int __init handle_module_node(EFI_FILE_HANDLE dir_handle,
+static int __init handle_module_node(EFI_LOADED_IMAGE *loaded_image,
                                      int module_node_offset,
                                      int reg_addr_cells,
                                      int reg_size_cells,
@@ -730,13 +738,13 @@ static int __init handle_module_node(EFI_FILE_HANDLE dir_handle,
                                  &uefi_name_len);
 
     if ( !uefi_name_prop )
-        /* Property not found */
-        return 0;
+        /* Property not found, but signal this is a multiboot,module */
+        return 1;
 
     file_idx = get_module_file_index(uefi_name_prop, uefi_name_len);
     if ( file_idx < 0 )
     {
-        file_idx = allocate_module_file(dir_handle, uefi_name_prop,
+        file_idx = allocate_module_file(loaded_image, uefi_name_prop,
                                         uefi_name_len);
         if ( file_idx < 0 )
             return file_idx;
@@ -795,19 +803,20 @@ static int __init handle_module_node(EFI_FILE_HANDLE dir_handle,
         }
     }
 
-    return 0;
+    return 1;
 }
 
 /*
  * This function checks for boot modules under the domU guest domain node
  * in the DT.
- * Returns 0 on success, negative number on error.
+ * Returns number of multiboot,module found or negative number on error.
  */
-static int __init handle_dom0less_domain_node(EFI_FILE_HANDLE dir_handle,
+static int __init handle_dom0less_domain_node(EFI_LOADED_IMAGE *loaded_image,
                                               int domain_node)
 {
     int module_node, addr_cells, size_cells, len;
     const struct fdt_property *prop;
+    unsigned int mb_modules_found = 0;
 
     /* Get #address-cells and #size-cells from domain node */
     prop = fdt_get_property(fdt, domain_node, "#address-cells", &len);
@@ -833,24 +842,26 @@ static int __init handle_dom0less_domain_node(EFI_FILE_HANDLE dir_handle,
           module_node > 0;
           module_node = fdt_next_subnode(fdt, module_node) )
     {
-        int ret = handle_module_node(dir_handle, module_node, addr_cells,
+        int ret = handle_module_node(loaded_image, module_node, addr_cells,
                                      size_cells, true);
         if ( ret < 0 )
             return ret;
+
+        mb_modules_found += ret;
     }
 
-    return 0;
+    return mb_modules_found;
 }
 
 /*
  * This function checks for xen domain nodes under the /chosen node for possible
  * dom0 and domU guests to be loaded.
- * Returns the number of modules loaded or a negative number for error.
+ * Returns the number of multiboot modules found or a negative number for error.
  */
-static int __init efi_check_dt_boot(EFI_FILE_HANDLE dir_handle)
+static int __init efi_check_dt_boot(EFI_LOADED_IMAGE *loaded_image)
 {
     int chosen, node, addr_len, size_len;
-    unsigned int i = 0;
+    unsigned int i = 0, modules_found = 0;
 
     /* Check for the chosen node in the current DTB */
     chosen = setup_chosen_node(fdt, &addr_len, &size_len);
@@ -865,15 +876,23 @@ static int __init efi_check_dt_boot(EFI_FILE_HANDLE dir_handle)
           node > 0;
           node = fdt_next_subnode(fdt, node) )
     {
+        int ret;
+
         if ( !fdt_node_check_compatible(fdt, node, "xen,domain") )
         {
             /* Found a node with compatible xen,domain; handle this node. */
-            if ( handle_dom0less_domain_node(dir_handle, node) < 0 )
+            ret = handle_dom0less_domain_node(loaded_image, node);
+            if ( ret < 0 )
                 return ERROR_DT_MODULE_DOMU;
         }
-        else if ( handle_module_node(dir_handle, node, addr_len, size_len,
-                                     false) < 0 )
+        else
+        {
+            ret = handle_module_node(loaded_image, node, addr_len, size_len,
+                                     false);
+            if ( ret < 0 )
                  return ERROR_DT_MODULE_DOM0;
+        }
+        modules_found += ret;
     }
 
     /* Free boot modules file names if any */
@@ -883,7 +902,7 @@ static int __init efi_check_dt_boot(EFI_FILE_HANDLE dir_handle)
         efi_bs->FreePool(modules[i].name);
     }
 
-    return modules_idx;
+    return modules_found;
 }
 
 static void __init efi_arch_cpu(void)
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 392ff3ac9b..8fd5e2d078 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -121,6 +121,8 @@ static char *get_value(const struct file *cfg, const char *section,
 static char *split_string(char *s);
 static CHAR16 *s2w(union string *str);
 static char *w2s(const union string *str);
+static EFI_FILE_HANDLE get_parent_handle(EFI_LOADED_IMAGE *loaded_image,
+                                         CHAR16 **leaf);
 static bool read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name,
                       struct file *file, const char *options);
 static bool read_section(const EFI_LOADED_IMAGE *image, const CHAR16 *name,
@@ -167,7 +169,7 @@ static void __init PrintErr(const CHAR16 *s)
 }
 
 #ifndef CONFIG_HAS_DEVICE_TREE
-static int __init efi_check_dt_boot(EFI_FILE_HANDLE dir_handle)
+static int __init efi_check_dt_boot(EFI_LOADED_IMAGE *loaded_image)
 {
     return 0;
 }
@@ -1144,7 +1146,6 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
     const char *option_str;
     bool use_cfg_file;
     int dt_modules_found;
-    EFI_FILE_HANDLE dir_handle;
 
     __set_bit(EFI_BOOT, &efi_flags);
     __set_bit(EFI_LOADER, &efi_flags);
@@ -1225,11 +1226,9 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
 
     efi_arch_relocate_image(0);
 
-    /* Get the file system interface. */
-    dir_handle = get_parent_handle(loaded_image, &file_name);
-
     if ( use_cfg_file )
     {
+        EFI_FILE_HANDLE dir_handle;
         UINTN depth, cols, rows, size;
 
         size = cols = rows = depth = 0;
@@ -1240,6 +1239,9 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
 
         gop = efi_get_gop();
 
+        /* Get the file system interface. */
+        dir_handle = get_parent_handle(loaded_image, &file_name);
+
         /* Read and parse the config file. */
         if ( read_section(loaded_image, L"config", &cfg, NULL) )
             PrintStr(L"Using builtin config file\r\n");
@@ -1362,14 +1364,14 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
         efi_bs->FreePages(cfg.addr, PFN_UP(cfg.size));
         cfg.addr = 0;
 
+        dir_handle->Close(dir_handle);
+
         if ( gop && !base_video )
             gop_mode = efi_find_gop_mode(gop, cols, rows, depth);
     }
 
     /* Get the number of boot modules specified on the DT or an error (<0) */
-    dt_modules_found = efi_check_dt_boot(dir_handle);
-
-    dir_handle->Close(dir_handle);
+    dt_modules_found = efi_check_dt_boot(loaded_image);
 
     if ( dt_modules_found < 0 )
         /* efi_check_dt_boot throws some error */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Nov 08 15:22:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Nov 2021 15:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.223466.386192 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mk6TG-0003CQ-Hm; Mon, 08 Nov 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 223466.386192; Mon, 08 Nov 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 1mk6TG-0003CI-Eu; Mon, 08 Nov 2021 15:22:06 +0000
Received: by outflank-mailman (input) for mailman id 223466;
 Mon, 08 Nov 2021 15:22:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mk6TE-0003CC-SW
 for xen-changelog@lists.xenproject.org; Mon, 08 Nov 2021 15:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mk6TE-0006sd-Qp
 for xen-changelog@lists.xenproject.org; Mon, 08 Nov 2021 15:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mk6TE-0005o9-Ps
 for xen-changelog@lists.xenproject.org; Mon, 08 Nov 2021 15:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PKPA+SEoemeGVcF2YnPYEvMWP2HRqO5yzt22XXlQKyQ=; b=w+0OAbAbvu1Nh4RWOM8JLo5ph5
	XdWrI0AwJc87FQmOULIP1ZSZQeHTcVp0GptVDxdnEFQnXY1HrsFbvPgUBK3hbdna5j2Jy/lJkSTAv
	Xh5Tuq3e/DID1pImNo6k6FBbyptECVpx5HBBoeTbtkEPglMwcNhPTBXmQeMz0s0ruu1U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: Report grant table v1/v2 capabilities to the toolstack
Message-Id: <E1mk6TE-0005o9-Ps@xenbits.xenproject.org>
Date: Mon, 08 Nov 2021 15:22:04 +0000

commit b36c23eada769f647e5352d5691f793be06afd62
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Oct 29 18:38:13 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 8 15:09:16 2021 +0000

    xen: Report grant table v1/v2 capabilities to the toolstack
    
    In order to let the toolstack be able to set the gnttab version on a
    per-domain basis, it needs to know which ABIs Xen supports.  Introduce
    XEN_SYSCTL_PHYSCAP_gnttab_v{1,2} for the purpose, and plumb in down into
    userspace.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Releae-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/golang/xenlight/helpers.gen.go | 4 ++++
 tools/golang/xenlight/types.gen.go   | 2 ++
 tools/include/libxl.h                | 6 ++++++
 tools/libs/light/libxl.c             | 4 ++++
 tools/libs/light/libxl_types.idl     | 2 ++
 tools/ocaml/libs/xc/xenctrl.ml       | 2 ++
 tools/ocaml/libs/xc/xenctrl.mli      | 2 ++
 tools/xl/xl_info.c                   | 6 ++++--
 xen/common/grant_table.c             | 2 +-
 xen/common/sysctl.c                  | 6 ++++++
 xen/include/public/sysctl.h          | 6 +++++-
 xen/include/xen/grant_table.h        | 2 ++
 12 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 2449580bad..6e1b054310 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -3367,6 +3367,8 @@ x.CapShadow = bool(xc.cap_shadow)
 x.CapIommuHapPtShare = bool(xc.cap_iommu_hap_pt_share)
 x.CapVmtrace = bool(xc.cap_vmtrace)
 x.CapVpmu = bool(xc.cap_vpmu)
+x.CapGnttabV1 = bool(xc.cap_gnttab_v1)
+x.CapGnttabV2 = bool(xc.cap_gnttab_v2)
 
  return nil}
 
@@ -3399,6 +3401,8 @@ xc.cap_shadow = C.bool(x.CapShadow)
 xc.cap_iommu_hap_pt_share = C.bool(x.CapIommuHapPtShare)
 xc.cap_vmtrace = C.bool(x.CapVmtrace)
 xc.cap_vpmu = C.bool(x.CapVpmu)
+xc.cap_gnttab_v1 = C.bool(x.CapGnttabV1)
+xc.cap_gnttab_v2 = C.bool(x.CapGnttabV2)
 
  return nil
  }
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index b2e8bd1a85..a0acfaacc3 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -1010,6 +1010,8 @@ CapShadow bool
 CapIommuHapPtShare bool
 CapVmtrace bool
 CapVpmu bool
+CapGnttabV1 bool
+CapGnttabV2 bool
 }
 
 type Connectorinfo struct {
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index 2e8679dbcb..54c10f6efe 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -514,6 +514,12 @@
  */
 #define LIBXL_HAVE_VPMU 1
 
+/*
+ * LIBXL_HAVE_PHYSINFO_CAP_GNTTAB indicates that libxl_physinfo has a
+ * cap_gnttab_v1/2 fields, which indicates the available grant table ABIs.
+ */
+#define LIBXL_HAVE_PHYSINFO_CAP_GNTTAB 1
+
 /*
  * libxl ABI compatibility
  *
diff --git a/tools/libs/light/libxl.c b/tools/libs/light/libxl.c
index a032723fde..a77aa856fd 100644
--- a/tools/libs/light/libxl.c
+++ b/tools/libs/light/libxl.c
@@ -405,6 +405,10 @@ int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo)
     physinfo->cap_vmtrace =
         !!(xcphysinfo.capabilities & XEN_SYSCTL_PHYSCAP_vmtrace);
     physinfo->cap_vpmu = !!(xcphysinfo.capabilities & XEN_SYSCTL_PHYSCAP_vpmu);
+    physinfo->cap_gnttab_v1 =
+        !!(xcphysinfo.capabilities & XEN_SYSCTL_PHYSCAP_gnttab_v1);
+    physinfo->cap_gnttab_v2 =
+        !!(xcphysinfo.capabilities & XEN_SYSCTL_PHYSCAP_gnttab_v2);
 
     GC_FREE;
     return 0;
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index 608d55a456..573bba68ee 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -1065,6 +1065,8 @@ libxl_physinfo = Struct("physinfo", [
     ("cap_iommu_hap_pt_share", bool),
     ("cap_vmtrace", bool),
     ("cap_vpmu", bool),
+    ("cap_gnttab_v1", bool),
+    ("cap_gnttab_v2", bool),
     ], dir=DIR_OUT)
 
 libxl_connectorinfo = Struct("connectorinfo", [
diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
index addcf4cc59..ed2924a2b3 100644
--- a/tools/ocaml/libs/xc/xenctrl.ml
+++ b/tools/ocaml/libs/xc/xenctrl.ml
@@ -123,6 +123,8 @@ type physinfo_cap_flag =
 	| CAP_IOMMU_HAP_PT_SHARE
 	| CAP_Vmtrace
 	| CAP_Vpmu
+	| CAP_Gnttab_v1
+	| CAP_Gnttab_v2
 
 type physinfo =
 {
diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli
index 0a5ce529e9..d20dc0108d 100644
--- a/tools/ocaml/libs/xc/xenctrl.mli
+++ b/tools/ocaml/libs/xc/xenctrl.mli
@@ -108,6 +108,8 @@ type physinfo_cap_flag =
   | CAP_IOMMU_HAP_PT_SHARE
   | CAP_Vmtrace
   | CAP_Vpmu
+  | CAP_Gnttab_v1
+  | CAP_Gnttab_v2
 
 type physinfo = {
   threads_per_core : int;
diff --git a/tools/xl/xl_info.c b/tools/xl/xl_info.c
index 2c86b317b7..712b7638b0 100644
--- a/tools/xl/xl_info.c
+++ b/tools/xl/xl_info.c
@@ -210,7 +210,7 @@ static void output_physinfo(void)
          info.hw_cap[4], info.hw_cap[5], info.hw_cap[6], info.hw_cap[7]
         );
 
-    maybe_printf("virt_caps              :%s%s%s%s%s%s%s%s%s\n",
+    maybe_printf("virt_caps              :%s%s%s%s%s%s%s%s%s%s%s\n",
          info.cap_pv ? " pv" : "",
          info.cap_hvm ? " hvm" : "",
          info.cap_hvm && info.cap_hvm_directio ? " hvm_directio" : "",
@@ -219,7 +219,9 @@ static void output_physinfo(void)
          info.cap_shadow ? " shadow" : "",
          info.cap_iommu_hap_pt_share ? " iommu_hap_pt_share" : "",
          info.cap_vmtrace ? " vmtrace" : "",
-         info.cap_vpmu ? " vpmu" : ""
+         info.cap_vpmu ? " vpmu" : "",
+         info.cap_gnttab_v1 ? " gnttab-v1" : "",
+         info.cap_gnttab_v2 ? " gnttab-v2" : ""
         );
 
     vinfo = libxl_get_version_info(ctx);
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index e510395d08..a20319b22a 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -178,7 +178,7 @@ static int parse_gnttab_max_maptrack_frames(const char *arg)
 #define GNTTAB_MAX_VERSION 2
 #endif
 
-static unsigned int __read_mostly opt_gnttab_max_version = GNTTAB_MAX_VERSION;
+unsigned int __read_mostly opt_gnttab_max_version = GNTTAB_MAX_VERSION;
 static bool __read_mostly opt_transitive_grants = true;
 
 static int __init parse_gnttab(const char *s)
diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c
index f2dab722b6..1ad3c29351 100644
--- a/xen/common/sysctl.c
+++ b/xen/common/sysctl.c
@@ -12,6 +12,7 @@
 #include <xen/sched.h>
 #include <xen/domain.h>
 #include <xen/event.h>
+#include <xen/grant_table.h>
 #include <xen/domain_page.h>
 #include <xen/trace.h>
 #include <xen/console.h>
@@ -283,6 +284,11 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
         if ( vpmu_is_available )
             pi->capabilities |= XEN_SYSCTL_PHYSCAP_vpmu;
 
+        if ( opt_gnttab_max_version >= 1 )
+            pi->capabilities |= XEN_SYSCTL_PHYSCAP_gnttab_v1;
+        if ( opt_gnttab_max_version >= 2 )
+            pi->capabilities |= XEN_SYSCTL_PHYSCAP_gnttab_v2;
+
         if ( copy_to_guest(u_sysctl, op, 1) )
             ret = -EFAULT;
     }
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index 3e53681b43..55252e97f2 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -104,8 +104,12 @@ struct xen_sysctl_tbuf_op {
 /* The platform supports vPMU. */
 #define XEN_SYSCTL_PHYSCAP_vpmu          (1u << 7)
 
+/* Xen supports the Grant v1 and/or v2 ABIs. */
+#define XEN_SYSCTL_PHYSCAP_gnttab_v1     (1u << 8)
+#define XEN_SYSCTL_PHYSCAP_gnttab_v2     (1u << 9)
+
 /* Max XEN_SYSCTL_PHYSCAP_* constant.  Used for ABI checking. */
-#define XEN_SYSCTL_PHYSCAP_MAX XEN_SYSCTL_PHYSCAP_vpmu
+#define XEN_SYSCTL_PHYSCAP_MAX XEN_SYSCTL_PHYSCAP_gnttab_v2
 
 struct xen_sysctl_physinfo {
     uint32_t threads_per_core;
diff --git a/xen/include/xen/grant_table.h b/xen/include/xen/grant_table.h
index 41713e2726..9ee830cfd0 100644
--- a/xen/include/xen/grant_table.h
+++ b/xen/include/xen/grant_table.h
@@ -32,6 +32,7 @@ struct grant_table;
 
 #ifdef CONFIG_GRANT_TABLE
 
+extern unsigned int opt_gnttab_max_version;
 extern unsigned int opt_max_grant_frames;
 
 /* Create/destroy per-domain grant table context. */
@@ -63,6 +64,7 @@ int gnttab_acquire_resource(
 
 #else
 
+#define opt_gnttab_max_version 0
 #define opt_max_grant_frames 0
 
 static inline int grant_table_init(struct domain *d,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 08 15:22:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 08 Nov 2021 15:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.223467.386197 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mk6TQ-0003E5-JJ; Mon, 08 Nov 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 223467.386197; Mon, 08 Nov 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 1mk6TQ-0003Dx-GS; Mon, 08 Nov 2021 15:22:16 +0000
Received: by outflank-mailman (input) for mailman id 223467;
 Mon, 08 Nov 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 1mk6TP-0003Dg-0C
 for xen-changelog@lists.xenproject.org; Mon, 08 Nov 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 1mk6TO-0006sm-Va
 for xen-changelog@lists.xenproject.org; Mon, 08 Nov 2021 15:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mk6TO-0005pI-Uh
 for xen-changelog@lists.xenproject.org; Mon, 08 Nov 2021 15:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WuF3BM7RluF534e2XjmLEtmGTen1eGQhSlbNhXHTelQ=; b=UL3yzBzQnVmuFMFjBVHhbznC4m
	zOBDg5dOsWESFVgkqNLYmqdZ4HKcqIDtaFsMa5ImUVdrPnZWEaTFLBJ6l6upmdUyXjObKyY0DLWsw
	6uReqfZrYvYG9rhgsZ1u5BSgNIlTlOqCWH/BzbOV8PXKakddld94kUwMKtP4riwSwKYY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] gnttab: allow setting max version per-domain
Message-Id: <E1mk6TO-0005pI-Uh@xenbits.xenproject.org>
Date: Mon, 08 Nov 2021 15:22:14 +0000

commit 7379f9e10a3b13ec8bcea756384b2ace8af7064d
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Nov 4 11:48:34 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 8 15:10:05 2021 +0000

    gnttab: allow setting max version per-domain
    
    Introduce a new domain create field so that toolstack can specify the
    maximum grant table version usable by the domain. This is plumbed into
    xl and settable by the user as max_grant_version.
    
    Previously this was only settable on a per host basis using the
    gnttab command line option.
    
    Note the version is specified using 4 bits, which leaves room to
    specify up to grant table version 15. Given that we only have 2 grant
    table versions right now, and a new version is unlikely in the near
    future using 4 bits seems more than enough.
    
    xenstored stubdomains are limited to grant table v1 because the
    current MiniOS code used to build them only has support for grants v1.
    There are existing limits set for xenstored stubdomains at creation
    time that already match the defaults in MiniOS.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 docs/man/xl.cfg.5.pod.in             |  5 +++++
 docs/man/xl.conf.5.pod.in            |  6 ++++++
 tools/helpers/init-xenstore-domain.c |  2 ++
 tools/include/libxl.h                |  7 +++++++
 tools/libs/light/libxl_create.c      | 23 +++++++++++++++++++++++
 tools/libs/light/libxl_dm.c          |  1 +
 tools/libs/light/libxl_types.idl     |  1 +
 tools/ocaml/libs/xc/xenctrl.ml       |  1 +
 tools/ocaml/libs/xc/xenctrl.mli      |  1 +
 tools/ocaml/libs/xc/xenctrl_stubs.c  |  5 ++++-
 tools/xl/xl.c                        |  8 ++++++++
 tools/xl/xl.h                        |  1 +
 tools/xl/xl_parse.c                  |  9 +++++++++
 xen/arch/arm/domain_build.c          |  2 ++
 xen/arch/x86/setup.c                 |  1 +
 xen/common/domain.c                  |  9 ++++++++-
 xen/common/grant_table.c             | 21 +++++++++++++++++++--
 xen/include/public/domctl.h          |  5 +++++
 xen/include/xen/grant_table.h        |  8 ++++++--
 19 files changed, 110 insertions(+), 6 deletions(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index 55c4881205..b98d161398 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -580,6 +580,11 @@ to have. This value controls how many pages of foreign domains can be accessed
 via the grant mechanism by this domain. The default value is settable via
 L<xl.conf(5)>.
 
+=item B<max_grant_version=NUMBER>
+
+Specify the maximum grant table version the domain is allowed to use. The
+default value is settable via L<xl.conf(5)>.
+
 =item B<nomigrate=BOOLEAN>
 
 Disable migration of this domain.  This enables certain other features
diff --git a/docs/man/xl.conf.5.pod.in b/docs/man/xl.conf.5.pod.in
index b48e99131a..df20c08137 100644
--- a/docs/man/xl.conf.5.pod.in
+++ b/docs/man/xl.conf.5.pod.in
@@ -101,6 +101,12 @@ 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<max_grant_version=NUMBER>
+
+Sets the default value for the C<max_grant_version> domain config value.
+
+Default: maximum grant version supported by the hypervisor.
+
 =item B<vif.default.script="PATH">
 
 Configures the default hotplug script used by virtual network devices.
diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xenstore-domain.c
index a79662bd1b..60469161bd 100644
--- a/tools/helpers/init-xenstore-domain.c
+++ b/tools/helpers/init-xenstore-domain.c
@@ -85,9 +85,11 @@ static int build(xc_interface *xch)
          * 1 grant frame is enough: we don't need many grants.
          * Mini-OS doesn't like less than 4, though, so use 4.
          * 128 maptrack frames: 256 entries per frame, enough for 32768 domains.
+         * Currently Mini-OS only supports grant v1.
          */
         .max_grant_frames = 4,
         .max_maptrack_frames = 128,
+        .grant_opts = 1,
     };
 
     xs_fd = open("/dev/xen/xenbus_backend", O_RDWR);
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index 54c10f6efe..2bbbd21f0b 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -520,6 +520,13 @@
  */
 #define LIBXL_HAVE_PHYSINFO_CAP_GNTTAB 1
 
+/*
+ * LIBXL_HAVE_MAX_GRANT_VERSION indicates libxl_domain_build_info has a
+ * max_grant_version field for setting the max grant table version per
+ * domain.
+ */
+#define LIBXL_HAVE_MAX_GRANT_VERSION 1
+
 /*
  * libxl ABI compatibility
  *
diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index 5a61d01722..b6855c7b46 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -454,6 +454,28 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
         libxl_defbool_setdefault(&b_info->nested_hvm,               false);
     }
 
+    if (b_info->max_grant_version == LIBXL_MAX_GRANT_DEFAULT) {
+        libxl_physinfo info;
+
+        rc = libxl_get_physinfo(CTX, &info);
+        if (rc) {
+            LOG(ERROR, "failed to get hypervisor info");
+            return rc;
+        }
+
+        if (info.cap_gnttab_v2)
+            b_info->max_grant_version = 2;
+        else if (info.cap_gnttab_v1)
+            b_info->max_grant_version = 1;
+        else
+            /* No grant table support reported */
+            b_info->max_grant_version = 0;
+    } else if (b_info->max_grant_version & ~XEN_DOMCTL_GRANT_version_mask) {
+        LOG(ERROR, "max grant version %d out of range",
+            b_info->max_grant_version);
+        return -ERROR_INVAL;
+    }
+
     return 0;
 }
 
@@ -607,6 +629,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,
+            .grant_opts = b_info->max_grant_version,
             .vmtrace_size = ROUNDUP(b_info->vmtrace_buf_kb << 10, XC_PAGE_SHIFT),
         };
 
diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 9d93056b5c..9a8ddbe188 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -2320,6 +2320,7 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
 
     dm_config->b_info.max_grant_frames = guest_config->b_info.max_grant_frames;
     dm_config->b_info.max_maptrack_frames = guest_config->b_info.max_maptrack_frames;
+    dm_config->b_info.max_grant_version = guest_config->b_info.max_grant_version;
 
     dm_config->b_info.u.pv.features = "";
 
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index 573bba68ee..2a42da2f7d 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -519,6 +519,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
 
     ("max_grant_frames",    uint32, {'init_val': 'LIBXL_MAX_GRANT_DEFAULT'}),
     ("max_maptrack_frames", uint32, {'init_val': 'LIBXL_MAX_GRANT_DEFAULT'}),
+    ("max_grant_version",   integer, {'init_val': 'LIBXL_MAX_GRANT_DEFAULT'}),
     
     ("device_model_version", libxl_device_model_version),
     ("device_model_stubdomain", libxl_defbool),
diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
index ed2924a2b3..7503031d8f 100644
--- a/tools/ocaml/libs/xc/xenctrl.ml
+++ b/tools/ocaml/libs/xc/xenctrl.ml
@@ -84,6 +84,7 @@ type domctl_create_config =
 	max_evtchn_port: int;
 	max_grant_frames: int;
 	max_maptrack_frames: int;
+	max_grant_version: int;
 	arch: arch_domainconfig;
 }
 
diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli
index d20dc0108d..d1d9c9247a 100644
--- a/tools/ocaml/libs/xc/xenctrl.mli
+++ b/tools/ocaml/libs/xc/xenctrl.mli
@@ -76,6 +76,7 @@ type domctl_create_config = {
   max_evtchn_port: int;
   max_grant_frames: int;
   max_maptrack_frames: int;
+  max_grant_version: int;
   arch: arch_domainconfig;
 }
 
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index ad953d36bd..eca0b8b334 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -188,7 +188,8 @@ CAMLprim value stub_xc_domain_create(value xch, value wanted_domid, value config
 #define VAL_MAX_EVTCHN_PORT     Field(config, 5)
 #define VAL_MAX_GRANT_FRAMES    Field(config, 6)
 #define VAL_MAX_MAPTRACK_FRAMES Field(config, 7)
-#define VAL_ARCH                Field(config, 8)
+#define VAL_MAX_GRANT_VERSION   Field(config, 8)
+#define VAL_ARCH                Field(config, 9)
 
 	uint32_t domid = Int_val(wanted_domid);
 	int result;
@@ -198,6 +199,7 @@ CAMLprim value stub_xc_domain_create(value xch, value wanted_domid, value config
 		.max_evtchn_port = Int_val(VAL_MAX_EVTCHN_PORT),
 		.max_grant_frames = Int_val(VAL_MAX_GRANT_FRAMES),
 		.max_maptrack_frames = Int_val(VAL_MAX_MAPTRACK_FRAMES),
+		.grant_opts = Int_val(VAL_MAX_GRANT_VERSION),
 	};
 
 	domain_handle_of_uuid_string(cfg.handle, String_val(VAL_HANDLE));
@@ -251,6 +253,7 @@ CAMLprim value stub_xc_domain_create(value xch, value wanted_domid, value config
 	}
 
 #undef VAL_ARCH
+#undef VAL_MAX_GRANT_VERSION
 #undef VAL_MAX_MAPTRACK_FRAMES
 #undef VAL_MAX_GRANT_FRAMES
 #undef VAL_MAX_EVTCHN_PORT
diff --git a/tools/xl/xl.c b/tools/xl/xl.c
index f422f9fed5..2d1ec18ea3 100644
--- a/tools/xl/xl.c
+++ b/tools/xl/xl.c
@@ -55,6 +55,7 @@ bool progress_use_cr = 0;
 bool timestamps = 0;
 int max_grant_frames = -1;
 int max_maptrack_frames = -1;
+int max_grant_version = LIBXL_MAX_GRANT_DEFAULT;
 libxl_domid domid_policy = INVALID_DOMID;
 
 xentoollog_level minmsglevel = minmsglevel_default;
@@ -219,6 +220,13 @@ static void parse_global_config(const char *configfile,
     else if (e != ESRCH)
         exit(1);
 
+    e = xlu_cfg_get_bounded_long (config, "max_grant_version", 0,
+                                  INT_MAX, &l, 1);
+    if (!e)
+        max_grant_version = l;
+    else if (e != ESRCH)
+        exit(1);
+
     libxl_cpu_bitmap_alloc(ctx, &global_vm_affinity_mask, 0);
     libxl_cpu_bitmap_alloc(ctx, &global_hvm_affinity_mask, 0);
     libxl_cpu_bitmap_alloc(ctx, &global_pv_affinity_mask, 0);
diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index 7e23f30192..cf12c79a9b 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -282,6 +282,7 @@ extern char *default_colo_proxy_script;
 extern char *blkdev_start;
 extern int max_grant_frames;
 extern int max_maptrack_frames;
+extern int max_grant_version;
 extern libxl_bitmap global_vm_affinity_mask;
 extern libxl_bitmap global_hvm_affinity_mask;
 extern libxl_bitmap global_pv_affinity_mask;
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index c503b9be00..117fcdcb2b 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1431,6 +1431,15 @@ void parse_config_data(const char *config_source,
     else
         exit(1);
 
+    e = xlu_cfg_get_bounded_long (config, "max_grant_version", 0,
+                                  INT_MAX, &l, 1);
+    if (e == ESRCH) /* not specified */
+        b_info->max_grant_version = max_grant_version;
+    else if (!e)
+        b_info->max_grant_version = l;
+    else
+        exit(1);
+
     libxl_defbool_set(&b_info->claim_mode, claim_mode);
 
     if (xlu_cfg_get_string (config, "on_poweroff", &buf, 0))
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 0167731ab0..9e92b640cd 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2967,6 +2967,7 @@ void __init create_domUs(void)
             .max_evtchn_port = -1,
             .max_grant_frames = -1,
             .max_maptrack_frames = -1,
+            .grant_opts = opt_gnttab_max_version,
         };
 
         if ( !dt_device_is_compatible(node, "xen,domain") )
@@ -3074,6 +3075,7 @@ void __init create_dom0(void)
         .max_evtchn_port = -1,
         .max_grant_frames = gnttab_dom0_frames(),
         .max_maptrack_frames = -1,
+        .grant_opts = opt_gnttab_max_version,
     };
 
     /* The vGIC for DOM0 is exactly emulating the hardware GIC */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index fea86530f9..ec6e686fac 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -755,6 +755,7 @@ static struct domain *__init create_dom0(const module_t *image,
         .max_evtchn_port = -1,
         .max_grant_frames = -1,
         .max_maptrack_frames = -1,
+        .grant_opts = opt_gnttab_max_version,
         .max_vcpus = dom0_max_vcpus(),
         .arch = {
             .misc_flags = opt_dom0_msr_relaxed ? XEN_X86_MSR_RELAXED : 0,
diff --git a/xen/common/domain.c b/xen/common/domain.c
index d71fcab88c..56d47dd664 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -492,6 +492,12 @@ static int sanitise_domain_config(struct xen_domctl_createdomain *config)
         return -EINVAL;
     }
 
+    if ( config->grant_opts & ~XEN_DOMCTL_GRANT_version_mask )
+    {
+        dprintk(XENLOG_INFO, "Unknown grant options %#x\n", config->grant_opts);
+        return -EINVAL;
+    }
+
     if ( config->max_vcpus < 1 )
     {
         dprintk(XENLOG_INFO, "No vCPUS\n");
@@ -678,7 +684,8 @@ struct domain *domain_create(domid_t domid,
         init_status |= INIT_evtchn;
 
         if ( (err = grant_table_init(d, config->max_grant_frames,
-                                     config->max_maptrack_frames)) != 0 )
+                                     config->max_maptrack_frames,
+                                     config->grant_opts)) != 0 )
             goto fail;
         init_status |= INIT_gnttab;
 
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index a20319b22a..8b322b51c0 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -53,6 +53,7 @@ struct grant_table {
     percpu_rwlock_t       lock;
     /* Lock protecting the maptrack limit */
     spinlock_t            maptrack_lock;
+    unsigned int          max_version;
     /*
      * Defaults to v1.  May be changed with GNTTABOP_set_version.  All other
      * values are invalid.
@@ -1917,11 +1918,26 @@ active_alloc_failed:
 }
 
 int grant_table_init(struct domain *d, int max_grant_frames,
-                     int max_maptrack_frames)
+                     int max_maptrack_frames, unsigned int options)
 {
     struct grant_table *gt;
+    unsigned int max_grant_version = options & XEN_DOMCTL_GRANT_version_mask;
     int ret = -ENOMEM;
 
+    if ( !max_grant_version )
+    {
+        dprintk(XENLOG_INFO, "%pd: invalid grant table version 0 requested\n",
+                d);
+        return -EINVAL;
+    }
+    if ( max_grant_version > opt_gnttab_max_version )
+    {
+        dprintk(XENLOG_INFO,
+                "%pd: requested grant version (%u) greater than supported (%u)\n",
+                d, max_grant_version, opt_gnttab_max_version);
+        return -EINVAL;
+    }
+
     /* Default to maximum value if no value was specified */
     if ( max_grant_frames < 0 )
         max_grant_frames = opt_max_grant_frames;
@@ -1947,6 +1963,7 @@ int grant_table_init(struct domain *d, int max_grant_frames,
     gt->gt_version = 1;
     gt->max_grant_frames = max_grant_frames;
     gt->max_maptrack_frames = max_maptrack_frames;
+    gt->max_version = max_grant_version;
 
     /* Install the structure early to simplify the error path. */
     gt->domain = d;
@@ -3076,7 +3093,7 @@ gnttab_set_version(XEN_GUEST_HANDLE_PARAM(gnttab_set_version_t) uop)
         goto out;
 
     res = -ENOSYS;
-    if ( op.version == 2 && opt_gnttab_max_version == 1 )
+    if ( op.version == 2 && gt->max_version == 1 )
         goto out; /* Behave as before set_version was introduced. */
 
     res = 0;
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 51017b47bc..1c21d4dc75 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -97,6 +97,11 @@ struct xen_domctl_createdomain {
     int32_t max_grant_frames;
     int32_t max_maptrack_frames;
 
+/* Grant version, use low 4 bits. */
+#define XEN_DOMCTL_GRANT_version_mask    0xf
+
+    uint32_t grant_opts;
+
     /* Per-vCPU buffer size in bytes.  0 to disable. */
     uint32_t vmtrace_size;
 
diff --git a/xen/include/xen/grant_table.h b/xen/include/xen/grant_table.h
index 9ee830cfd0..85fe6b7b5e 100644
--- a/xen/include/xen/grant_table.h
+++ b/xen/include/xen/grant_table.h
@@ -37,7 +37,7 @@ extern unsigned int opt_max_grant_frames;
 
 /* Create/destroy per-domain grant table context. */
 int grant_table_init(struct domain *d, int max_grant_frames,
-                     int max_maptrack_frames);
+                     int max_maptrack_frames, unsigned int options);
 void grant_table_destroy(
     struct domain *d);
 void grant_table_init_vcpu(struct vcpu *v);
@@ -69,8 +69,12 @@ int gnttab_acquire_resource(
 
 static inline int grant_table_init(struct domain *d,
                                    int max_grant_frames,
-                                   int max_maptrack_frames)
+                                   int max_maptrack_frames,
+                                   unsigned int options)
 {
+    if ( options )
+        return -EINVAL;
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 09 09:11:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Nov 2021 09:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.223803.386686 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mkN9i-0004iF-Rw; Tue, 09 Nov 2021 09:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 223803.386686; Tue, 09 Nov 2021 09:11:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mkN9i-0004i7-Om; Tue, 09 Nov 2021 09:11:02 +0000
Received: by outflank-mailman (input) for mailman id 223803;
 Tue, 09 Nov 2021 09:11:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mkN9h-0004i1-ST
 for xen-changelog@lists.xenproject.org; Tue, 09 Nov 2021 09:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mkN9h-0003X9-Oe
 for xen-changelog@lists.xenproject.org; Tue, 09 Nov 2021 09:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mkN9h-00013K-NQ
 for xen-changelog@lists.xenproject.org; Tue, 09 Nov 2021 09:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AQ+6lFPb+Yy55lWQpElssPTzIj2J3+X1Uu4DlZsojsE=; b=Kvocyahs4yj37+XgwwW2mXrTOX
	u4spXnWWN1YxHfsGskymjvMytiuZlhsAFao8ATbrD2PQKsax1IjLA7RCRk1NEktN+UljyN57oBJUY
	VGXSBwCEpbQVySXjglVAkvKLcLHJKd/9Zkix0UkCIWY1zDY8Umu7zyiI30atCK7aQfsQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: Report grant table v1/v2 capabilities to the toolstack
Message-Id: <E1mkN9h-00013K-NQ@xenbits.xenproject.org>
Date: Tue, 09 Nov 2021 09:11:01 +0000

commit b36c23eada769f647e5352d5691f793be06afd62
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Oct 29 18:38:13 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 8 15:09:16 2021 +0000

    xen: Report grant table v1/v2 capabilities to the toolstack
    
    In order to let the toolstack be able to set the gnttab version on a
    per-domain basis, it needs to know which ABIs Xen supports.  Introduce
    XEN_SYSCTL_PHYSCAP_gnttab_v{1,2} for the purpose, and plumb in down into
    userspace.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Releae-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/golang/xenlight/helpers.gen.go | 4 ++++
 tools/golang/xenlight/types.gen.go   | 2 ++
 tools/include/libxl.h                | 6 ++++++
 tools/libs/light/libxl.c             | 4 ++++
 tools/libs/light/libxl_types.idl     | 2 ++
 tools/ocaml/libs/xc/xenctrl.ml       | 2 ++
 tools/ocaml/libs/xc/xenctrl.mli      | 2 ++
 tools/xl/xl_info.c                   | 6 ++++--
 xen/common/grant_table.c             | 2 +-
 xen/common/sysctl.c                  | 6 ++++++
 xen/include/public/sysctl.h          | 6 +++++-
 xen/include/xen/grant_table.h        | 2 ++
 12 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 2449580bad..6e1b054310 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -3367,6 +3367,8 @@ x.CapShadow = bool(xc.cap_shadow)
 x.CapIommuHapPtShare = bool(xc.cap_iommu_hap_pt_share)
 x.CapVmtrace = bool(xc.cap_vmtrace)
 x.CapVpmu = bool(xc.cap_vpmu)
+x.CapGnttabV1 = bool(xc.cap_gnttab_v1)
+x.CapGnttabV2 = bool(xc.cap_gnttab_v2)
 
  return nil}
 
@@ -3399,6 +3401,8 @@ xc.cap_shadow = C.bool(x.CapShadow)
 xc.cap_iommu_hap_pt_share = C.bool(x.CapIommuHapPtShare)
 xc.cap_vmtrace = C.bool(x.CapVmtrace)
 xc.cap_vpmu = C.bool(x.CapVpmu)
+xc.cap_gnttab_v1 = C.bool(x.CapGnttabV1)
+xc.cap_gnttab_v2 = C.bool(x.CapGnttabV2)
 
  return nil
  }
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index b2e8bd1a85..a0acfaacc3 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -1010,6 +1010,8 @@ CapShadow bool
 CapIommuHapPtShare bool
 CapVmtrace bool
 CapVpmu bool
+CapGnttabV1 bool
+CapGnttabV2 bool
 }
 
 type Connectorinfo struct {
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index 2e8679dbcb..54c10f6efe 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -514,6 +514,12 @@
  */
 #define LIBXL_HAVE_VPMU 1
 
+/*
+ * LIBXL_HAVE_PHYSINFO_CAP_GNTTAB indicates that libxl_physinfo has a
+ * cap_gnttab_v1/2 fields, which indicates the available grant table ABIs.
+ */
+#define LIBXL_HAVE_PHYSINFO_CAP_GNTTAB 1
+
 /*
  * libxl ABI compatibility
  *
diff --git a/tools/libs/light/libxl.c b/tools/libs/light/libxl.c
index a032723fde..a77aa856fd 100644
--- a/tools/libs/light/libxl.c
+++ b/tools/libs/light/libxl.c
@@ -405,6 +405,10 @@ int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo)
     physinfo->cap_vmtrace =
         !!(xcphysinfo.capabilities & XEN_SYSCTL_PHYSCAP_vmtrace);
     physinfo->cap_vpmu = !!(xcphysinfo.capabilities & XEN_SYSCTL_PHYSCAP_vpmu);
+    physinfo->cap_gnttab_v1 =
+        !!(xcphysinfo.capabilities & XEN_SYSCTL_PHYSCAP_gnttab_v1);
+    physinfo->cap_gnttab_v2 =
+        !!(xcphysinfo.capabilities & XEN_SYSCTL_PHYSCAP_gnttab_v2);
 
     GC_FREE;
     return 0;
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index 608d55a456..573bba68ee 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -1065,6 +1065,8 @@ libxl_physinfo = Struct("physinfo", [
     ("cap_iommu_hap_pt_share", bool),
     ("cap_vmtrace", bool),
     ("cap_vpmu", bool),
+    ("cap_gnttab_v1", bool),
+    ("cap_gnttab_v2", bool),
     ], dir=DIR_OUT)
 
 libxl_connectorinfo = Struct("connectorinfo", [
diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
index addcf4cc59..ed2924a2b3 100644
--- a/tools/ocaml/libs/xc/xenctrl.ml
+++ b/tools/ocaml/libs/xc/xenctrl.ml
@@ -123,6 +123,8 @@ type physinfo_cap_flag =
 	| CAP_IOMMU_HAP_PT_SHARE
 	| CAP_Vmtrace
 	| CAP_Vpmu
+	| CAP_Gnttab_v1
+	| CAP_Gnttab_v2
 
 type physinfo =
 {
diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli
index 0a5ce529e9..d20dc0108d 100644
--- a/tools/ocaml/libs/xc/xenctrl.mli
+++ b/tools/ocaml/libs/xc/xenctrl.mli
@@ -108,6 +108,8 @@ type physinfo_cap_flag =
   | CAP_IOMMU_HAP_PT_SHARE
   | CAP_Vmtrace
   | CAP_Vpmu
+  | CAP_Gnttab_v1
+  | CAP_Gnttab_v2
 
 type physinfo = {
   threads_per_core : int;
diff --git a/tools/xl/xl_info.c b/tools/xl/xl_info.c
index 2c86b317b7..712b7638b0 100644
--- a/tools/xl/xl_info.c
+++ b/tools/xl/xl_info.c
@@ -210,7 +210,7 @@ static void output_physinfo(void)
          info.hw_cap[4], info.hw_cap[5], info.hw_cap[6], info.hw_cap[7]
         );
 
-    maybe_printf("virt_caps              :%s%s%s%s%s%s%s%s%s\n",
+    maybe_printf("virt_caps              :%s%s%s%s%s%s%s%s%s%s%s\n",
          info.cap_pv ? " pv" : "",
          info.cap_hvm ? " hvm" : "",
          info.cap_hvm && info.cap_hvm_directio ? " hvm_directio" : "",
@@ -219,7 +219,9 @@ static void output_physinfo(void)
          info.cap_shadow ? " shadow" : "",
          info.cap_iommu_hap_pt_share ? " iommu_hap_pt_share" : "",
          info.cap_vmtrace ? " vmtrace" : "",
-         info.cap_vpmu ? " vpmu" : ""
+         info.cap_vpmu ? " vpmu" : "",
+         info.cap_gnttab_v1 ? " gnttab-v1" : "",
+         info.cap_gnttab_v2 ? " gnttab-v2" : ""
         );
 
     vinfo = libxl_get_version_info(ctx);
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index e510395d08..a20319b22a 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -178,7 +178,7 @@ static int parse_gnttab_max_maptrack_frames(const char *arg)
 #define GNTTAB_MAX_VERSION 2
 #endif
 
-static unsigned int __read_mostly opt_gnttab_max_version = GNTTAB_MAX_VERSION;
+unsigned int __read_mostly opt_gnttab_max_version = GNTTAB_MAX_VERSION;
 static bool __read_mostly opt_transitive_grants = true;
 
 static int __init parse_gnttab(const char *s)
diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c
index f2dab722b6..1ad3c29351 100644
--- a/xen/common/sysctl.c
+++ b/xen/common/sysctl.c
@@ -12,6 +12,7 @@
 #include <xen/sched.h>
 #include <xen/domain.h>
 #include <xen/event.h>
+#include <xen/grant_table.h>
 #include <xen/domain_page.h>
 #include <xen/trace.h>
 #include <xen/console.h>
@@ -283,6 +284,11 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
         if ( vpmu_is_available )
             pi->capabilities |= XEN_SYSCTL_PHYSCAP_vpmu;
 
+        if ( opt_gnttab_max_version >= 1 )
+            pi->capabilities |= XEN_SYSCTL_PHYSCAP_gnttab_v1;
+        if ( opt_gnttab_max_version >= 2 )
+            pi->capabilities |= XEN_SYSCTL_PHYSCAP_gnttab_v2;
+
         if ( copy_to_guest(u_sysctl, op, 1) )
             ret = -EFAULT;
     }
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index 3e53681b43..55252e97f2 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -104,8 +104,12 @@ struct xen_sysctl_tbuf_op {
 /* The platform supports vPMU. */
 #define XEN_SYSCTL_PHYSCAP_vpmu          (1u << 7)
 
+/* Xen supports the Grant v1 and/or v2 ABIs. */
+#define XEN_SYSCTL_PHYSCAP_gnttab_v1     (1u << 8)
+#define XEN_SYSCTL_PHYSCAP_gnttab_v2     (1u << 9)
+
 /* Max XEN_SYSCTL_PHYSCAP_* constant.  Used for ABI checking. */
-#define XEN_SYSCTL_PHYSCAP_MAX XEN_SYSCTL_PHYSCAP_vpmu
+#define XEN_SYSCTL_PHYSCAP_MAX XEN_SYSCTL_PHYSCAP_gnttab_v2
 
 struct xen_sysctl_physinfo {
     uint32_t threads_per_core;
diff --git a/xen/include/xen/grant_table.h b/xen/include/xen/grant_table.h
index 41713e2726..9ee830cfd0 100644
--- a/xen/include/xen/grant_table.h
+++ b/xen/include/xen/grant_table.h
@@ -32,6 +32,7 @@ struct grant_table;
 
 #ifdef CONFIG_GRANT_TABLE
 
+extern unsigned int opt_gnttab_max_version;
 extern unsigned int opt_max_grant_frames;
 
 /* Create/destroy per-domain grant table context. */
@@ -63,6 +64,7 @@ int gnttab_acquire_resource(
 
 #else
 
+#define opt_gnttab_max_version 0
 #define opt_max_grant_frames 0
 
 static inline int grant_table_init(struct domain *d,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Nov 09 09:11:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Nov 2021 09:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.223804.386691 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mkN9s-0004kw-Vz; Tue, 09 Nov 2021 09:11:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 223804.386691; Tue, 09 Nov 2021 09:11:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mkN9s-0004kn-Se; Tue, 09 Nov 2021 09:11:12 +0000
Received: by outflank-mailman (input) for mailman id 223804;
 Tue, 09 Nov 2021 09:11:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mkN9r-0004kc-UD
 for xen-changelog@lists.xenproject.org; Tue, 09 Nov 2021 09:11:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mkN9r-0003XZ-TN
 for xen-changelog@lists.xenproject.org; Tue, 09 Nov 2021 09:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mkN9r-00013t-SM
 for xen-changelog@lists.xenproject.org; Tue, 09 Nov 2021 09:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S7178ufJINbhRgF/yR39+wYQa29VTpaTF/T6cKXejMo=; b=tWxAG2qs55NSNKea9XR3+i3bVh
	G2dMaVFkpy3B7wdtrg6WIdrhwHnGS/ui1K4jZxLoaSUijoHbnM6IWlYceLHxEoD3+OEASNvqK7y9r
	ktFFMQo3QE9NYsssstgF+XRlhBsV2VzcLemuewZQ9yKRGso3dgFTQQFE7Kb4JPtF2btA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] gnttab: allow setting max version per-domain
Message-Id: <E1mkN9r-00013t-SM@xenbits.xenproject.org>
Date: Tue, 09 Nov 2021 09:11:11 +0000

commit 7379f9e10a3b13ec8bcea756384b2ace8af7064d
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Nov 4 11:48:34 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 8 15:10:05 2021 +0000

    gnttab: allow setting max version per-domain
    
    Introduce a new domain create field so that toolstack can specify the
    maximum grant table version usable by the domain. This is plumbed into
    xl and settable by the user as max_grant_version.
    
    Previously this was only settable on a per host basis using the
    gnttab command line option.
    
    Note the version is specified using 4 bits, which leaves room to
    specify up to grant table version 15. Given that we only have 2 grant
    table versions right now, and a new version is unlikely in the near
    future using 4 bits seems more than enough.
    
    xenstored stubdomains are limited to grant table v1 because the
    current MiniOS code used to build them only has support for grants v1.
    There are existing limits set for xenstored stubdomains at creation
    time that already match the defaults in MiniOS.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 docs/man/xl.cfg.5.pod.in             |  5 +++++
 docs/man/xl.conf.5.pod.in            |  6 ++++++
 tools/helpers/init-xenstore-domain.c |  2 ++
 tools/include/libxl.h                |  7 +++++++
 tools/libs/light/libxl_create.c      | 23 +++++++++++++++++++++++
 tools/libs/light/libxl_dm.c          |  1 +
 tools/libs/light/libxl_types.idl     |  1 +
 tools/ocaml/libs/xc/xenctrl.ml       |  1 +
 tools/ocaml/libs/xc/xenctrl.mli      |  1 +
 tools/ocaml/libs/xc/xenctrl_stubs.c  |  5 ++++-
 tools/xl/xl.c                        |  8 ++++++++
 tools/xl/xl.h                        |  1 +
 tools/xl/xl_parse.c                  |  9 +++++++++
 xen/arch/arm/domain_build.c          |  2 ++
 xen/arch/x86/setup.c                 |  1 +
 xen/common/domain.c                  |  9 ++++++++-
 xen/common/grant_table.c             | 21 +++++++++++++++++++--
 xen/include/public/domctl.h          |  5 +++++
 xen/include/xen/grant_table.h        |  8 ++++++--
 19 files changed, 110 insertions(+), 6 deletions(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index 55c4881205..b98d161398 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -580,6 +580,11 @@ to have. This value controls how many pages of foreign domains can be accessed
 via the grant mechanism by this domain. The default value is settable via
 L<xl.conf(5)>.
 
+=item B<max_grant_version=NUMBER>
+
+Specify the maximum grant table version the domain is allowed to use. The
+default value is settable via L<xl.conf(5)>.
+
 =item B<nomigrate=BOOLEAN>
 
 Disable migration of this domain.  This enables certain other features
diff --git a/docs/man/xl.conf.5.pod.in b/docs/man/xl.conf.5.pod.in
index b48e99131a..df20c08137 100644
--- a/docs/man/xl.conf.5.pod.in
+++ b/docs/man/xl.conf.5.pod.in
@@ -101,6 +101,12 @@ 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<max_grant_version=NUMBER>
+
+Sets the default value for the C<max_grant_version> domain config value.
+
+Default: maximum grant version supported by the hypervisor.
+
 =item B<vif.default.script="PATH">
 
 Configures the default hotplug script used by virtual network devices.
diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xenstore-domain.c
index a79662bd1b..60469161bd 100644
--- a/tools/helpers/init-xenstore-domain.c
+++ b/tools/helpers/init-xenstore-domain.c
@@ -85,9 +85,11 @@ static int build(xc_interface *xch)
          * 1 grant frame is enough: we don't need many grants.
          * Mini-OS doesn't like less than 4, though, so use 4.
          * 128 maptrack frames: 256 entries per frame, enough for 32768 domains.
+         * Currently Mini-OS only supports grant v1.
          */
         .max_grant_frames = 4,
         .max_maptrack_frames = 128,
+        .grant_opts = 1,
     };
 
     xs_fd = open("/dev/xen/xenbus_backend", O_RDWR);
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index 54c10f6efe..2bbbd21f0b 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -520,6 +520,13 @@
  */
 #define LIBXL_HAVE_PHYSINFO_CAP_GNTTAB 1
 
+/*
+ * LIBXL_HAVE_MAX_GRANT_VERSION indicates libxl_domain_build_info has a
+ * max_grant_version field for setting the max grant table version per
+ * domain.
+ */
+#define LIBXL_HAVE_MAX_GRANT_VERSION 1
+
 /*
  * libxl ABI compatibility
  *
diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index 5a61d01722..b6855c7b46 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -454,6 +454,28 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
         libxl_defbool_setdefault(&b_info->nested_hvm,               false);
     }
 
+    if (b_info->max_grant_version == LIBXL_MAX_GRANT_DEFAULT) {
+        libxl_physinfo info;
+
+        rc = libxl_get_physinfo(CTX, &info);
+        if (rc) {
+            LOG(ERROR, "failed to get hypervisor info");
+            return rc;
+        }
+
+        if (info.cap_gnttab_v2)
+            b_info->max_grant_version = 2;
+        else if (info.cap_gnttab_v1)
+            b_info->max_grant_version = 1;
+        else
+            /* No grant table support reported */
+            b_info->max_grant_version = 0;
+    } else if (b_info->max_grant_version & ~XEN_DOMCTL_GRANT_version_mask) {
+        LOG(ERROR, "max grant version %d out of range",
+            b_info->max_grant_version);
+        return -ERROR_INVAL;
+    }
+
     return 0;
 }
 
@@ -607,6 +629,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,
+            .grant_opts = b_info->max_grant_version,
             .vmtrace_size = ROUNDUP(b_info->vmtrace_buf_kb << 10, XC_PAGE_SHIFT),
         };
 
diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 9d93056b5c..9a8ddbe188 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -2320,6 +2320,7 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
 
     dm_config->b_info.max_grant_frames = guest_config->b_info.max_grant_frames;
     dm_config->b_info.max_maptrack_frames = guest_config->b_info.max_maptrack_frames;
+    dm_config->b_info.max_grant_version = guest_config->b_info.max_grant_version;
 
     dm_config->b_info.u.pv.features = "";
 
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index 573bba68ee..2a42da2f7d 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -519,6 +519,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
 
     ("max_grant_frames",    uint32, {'init_val': 'LIBXL_MAX_GRANT_DEFAULT'}),
     ("max_maptrack_frames", uint32, {'init_val': 'LIBXL_MAX_GRANT_DEFAULT'}),
+    ("max_grant_version",   integer, {'init_val': 'LIBXL_MAX_GRANT_DEFAULT'}),
     
     ("device_model_version", libxl_device_model_version),
     ("device_model_stubdomain", libxl_defbool),
diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
index ed2924a2b3..7503031d8f 100644
--- a/tools/ocaml/libs/xc/xenctrl.ml
+++ b/tools/ocaml/libs/xc/xenctrl.ml
@@ -84,6 +84,7 @@ type domctl_create_config =
 	max_evtchn_port: int;
 	max_grant_frames: int;
 	max_maptrack_frames: int;
+	max_grant_version: int;
 	arch: arch_domainconfig;
 }
 
diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli
index d20dc0108d..d1d9c9247a 100644
--- a/tools/ocaml/libs/xc/xenctrl.mli
+++ b/tools/ocaml/libs/xc/xenctrl.mli
@@ -76,6 +76,7 @@ type domctl_create_config = {
   max_evtchn_port: int;
   max_grant_frames: int;
   max_maptrack_frames: int;
+  max_grant_version: int;
   arch: arch_domainconfig;
 }
 
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index ad953d36bd..eca0b8b334 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -188,7 +188,8 @@ CAMLprim value stub_xc_domain_create(value xch, value wanted_domid, value config
 #define VAL_MAX_EVTCHN_PORT     Field(config, 5)
 #define VAL_MAX_GRANT_FRAMES    Field(config, 6)
 #define VAL_MAX_MAPTRACK_FRAMES Field(config, 7)
-#define VAL_ARCH                Field(config, 8)
+#define VAL_MAX_GRANT_VERSION   Field(config, 8)
+#define VAL_ARCH                Field(config, 9)
 
 	uint32_t domid = Int_val(wanted_domid);
 	int result;
@@ -198,6 +199,7 @@ CAMLprim value stub_xc_domain_create(value xch, value wanted_domid, value config
 		.max_evtchn_port = Int_val(VAL_MAX_EVTCHN_PORT),
 		.max_grant_frames = Int_val(VAL_MAX_GRANT_FRAMES),
 		.max_maptrack_frames = Int_val(VAL_MAX_MAPTRACK_FRAMES),
+		.grant_opts = Int_val(VAL_MAX_GRANT_VERSION),
 	};
 
 	domain_handle_of_uuid_string(cfg.handle, String_val(VAL_HANDLE));
@@ -251,6 +253,7 @@ CAMLprim value stub_xc_domain_create(value xch, value wanted_domid, value config
 	}
 
 #undef VAL_ARCH
+#undef VAL_MAX_GRANT_VERSION
 #undef VAL_MAX_MAPTRACK_FRAMES
 #undef VAL_MAX_GRANT_FRAMES
 #undef VAL_MAX_EVTCHN_PORT
diff --git a/tools/xl/xl.c b/tools/xl/xl.c
index f422f9fed5..2d1ec18ea3 100644
--- a/tools/xl/xl.c
+++ b/tools/xl/xl.c
@@ -55,6 +55,7 @@ bool progress_use_cr = 0;
 bool timestamps = 0;
 int max_grant_frames = -1;
 int max_maptrack_frames = -1;
+int max_grant_version = LIBXL_MAX_GRANT_DEFAULT;
 libxl_domid domid_policy = INVALID_DOMID;
 
 xentoollog_level minmsglevel = minmsglevel_default;
@@ -219,6 +220,13 @@ static void parse_global_config(const char *configfile,
     else if (e != ESRCH)
         exit(1);
 
+    e = xlu_cfg_get_bounded_long (config, "max_grant_version", 0,
+                                  INT_MAX, &l, 1);
+    if (!e)
+        max_grant_version = l;
+    else if (e != ESRCH)
+        exit(1);
+
     libxl_cpu_bitmap_alloc(ctx, &global_vm_affinity_mask, 0);
     libxl_cpu_bitmap_alloc(ctx, &global_hvm_affinity_mask, 0);
     libxl_cpu_bitmap_alloc(ctx, &global_pv_affinity_mask, 0);
diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index 7e23f30192..cf12c79a9b 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -282,6 +282,7 @@ extern char *default_colo_proxy_script;
 extern char *blkdev_start;
 extern int max_grant_frames;
 extern int max_maptrack_frames;
+extern int max_grant_version;
 extern libxl_bitmap global_vm_affinity_mask;
 extern libxl_bitmap global_hvm_affinity_mask;
 extern libxl_bitmap global_pv_affinity_mask;
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index c503b9be00..117fcdcb2b 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1431,6 +1431,15 @@ void parse_config_data(const char *config_source,
     else
         exit(1);
 
+    e = xlu_cfg_get_bounded_long (config, "max_grant_version", 0,
+                                  INT_MAX, &l, 1);
+    if (e == ESRCH) /* not specified */
+        b_info->max_grant_version = max_grant_version;
+    else if (!e)
+        b_info->max_grant_version = l;
+    else
+        exit(1);
+
     libxl_defbool_set(&b_info->claim_mode, claim_mode);
 
     if (xlu_cfg_get_string (config, "on_poweroff", &buf, 0))
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 0167731ab0..9e92b640cd 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2967,6 +2967,7 @@ void __init create_domUs(void)
             .max_evtchn_port = -1,
             .max_grant_frames = -1,
             .max_maptrack_frames = -1,
+            .grant_opts = opt_gnttab_max_version,
         };
 
         if ( !dt_device_is_compatible(node, "xen,domain") )
@@ -3074,6 +3075,7 @@ void __init create_dom0(void)
         .max_evtchn_port = -1,
         .max_grant_frames = gnttab_dom0_frames(),
         .max_maptrack_frames = -1,
+        .grant_opts = opt_gnttab_max_version,
     };
 
     /* The vGIC for DOM0 is exactly emulating the hardware GIC */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index fea86530f9..ec6e686fac 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -755,6 +755,7 @@ static struct domain *__init create_dom0(const module_t *image,
         .max_evtchn_port = -1,
         .max_grant_frames = -1,
         .max_maptrack_frames = -1,
+        .grant_opts = opt_gnttab_max_version,
         .max_vcpus = dom0_max_vcpus(),
         .arch = {
             .misc_flags = opt_dom0_msr_relaxed ? XEN_X86_MSR_RELAXED : 0,
diff --git a/xen/common/domain.c b/xen/common/domain.c
index d71fcab88c..56d47dd664 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -492,6 +492,12 @@ static int sanitise_domain_config(struct xen_domctl_createdomain *config)
         return -EINVAL;
     }
 
+    if ( config->grant_opts & ~XEN_DOMCTL_GRANT_version_mask )
+    {
+        dprintk(XENLOG_INFO, "Unknown grant options %#x\n", config->grant_opts);
+        return -EINVAL;
+    }
+
     if ( config->max_vcpus < 1 )
     {
         dprintk(XENLOG_INFO, "No vCPUS\n");
@@ -678,7 +684,8 @@ struct domain *domain_create(domid_t domid,
         init_status |= INIT_evtchn;
 
         if ( (err = grant_table_init(d, config->max_grant_frames,
-                                     config->max_maptrack_frames)) != 0 )
+                                     config->max_maptrack_frames,
+                                     config->grant_opts)) != 0 )
             goto fail;
         init_status |= INIT_gnttab;
 
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index a20319b22a..8b322b51c0 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -53,6 +53,7 @@ struct grant_table {
     percpu_rwlock_t       lock;
     /* Lock protecting the maptrack limit */
     spinlock_t            maptrack_lock;
+    unsigned int          max_version;
     /*
      * Defaults to v1.  May be changed with GNTTABOP_set_version.  All other
      * values are invalid.
@@ -1917,11 +1918,26 @@ active_alloc_failed:
 }
 
 int grant_table_init(struct domain *d, int max_grant_frames,
-                     int max_maptrack_frames)
+                     int max_maptrack_frames, unsigned int options)
 {
     struct grant_table *gt;
+    unsigned int max_grant_version = options & XEN_DOMCTL_GRANT_version_mask;
     int ret = -ENOMEM;
 
+    if ( !max_grant_version )
+    {
+        dprintk(XENLOG_INFO, "%pd: invalid grant table version 0 requested\n",
+                d);
+        return -EINVAL;
+    }
+    if ( max_grant_version > opt_gnttab_max_version )
+    {
+        dprintk(XENLOG_INFO,
+                "%pd: requested grant version (%u) greater than supported (%u)\n",
+                d, max_grant_version, opt_gnttab_max_version);
+        return -EINVAL;
+    }
+
     /* Default to maximum value if no value was specified */
     if ( max_grant_frames < 0 )
         max_grant_frames = opt_max_grant_frames;
@@ -1947,6 +1963,7 @@ int grant_table_init(struct domain *d, int max_grant_frames,
     gt->gt_version = 1;
     gt->max_grant_frames = max_grant_frames;
     gt->max_maptrack_frames = max_maptrack_frames;
+    gt->max_version = max_grant_version;
 
     /* Install the structure early to simplify the error path. */
     gt->domain = d;
@@ -3076,7 +3093,7 @@ gnttab_set_version(XEN_GUEST_HANDLE_PARAM(gnttab_set_version_t) uop)
         goto out;
 
     res = -ENOSYS;
-    if ( op.version == 2 && opt_gnttab_max_version == 1 )
+    if ( op.version == 2 && gt->max_version == 1 )
         goto out; /* Behave as before set_version was introduced. */
 
     res = 0;
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 51017b47bc..1c21d4dc75 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -97,6 +97,11 @@ struct xen_domctl_createdomain {
     int32_t max_grant_frames;
     int32_t max_maptrack_frames;
 
+/* Grant version, use low 4 bits. */
+#define XEN_DOMCTL_GRANT_version_mask    0xf
+
+    uint32_t grant_opts;
+
     /* Per-vCPU buffer size in bytes.  0 to disable. */
     uint32_t vmtrace_size;
 
diff --git a/xen/include/xen/grant_table.h b/xen/include/xen/grant_table.h
index 9ee830cfd0..85fe6b7b5e 100644
--- a/xen/include/xen/grant_table.h
+++ b/xen/include/xen/grant_table.h
@@ -37,7 +37,7 @@ extern unsigned int opt_max_grant_frames;
 
 /* Create/destroy per-domain grant table context. */
 int grant_table_init(struct domain *d, int max_grant_frames,
-                     int max_maptrack_frames);
+                     int max_maptrack_frames, unsigned int options);
 void grant_table_destroy(
     struct domain *d);
 void grant_table_init_vcpu(struct vcpu *v);
@@ -69,8 +69,12 @@ int gnttab_acquire_resource(
 
 static inline int grant_table_init(struct domain *d,
                                    int max_grant_frames,
-                                   int max_maptrack_frames)
+                                   int max_maptrack_frames,
+                                   unsigned int options)
 {
+    if ( options )
+        return -EINVAL;
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Nov 09 10:55:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 09 Nov 2021 10:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.223866.386794 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mkOmQ-00025s-0r; Tue, 09 Nov 2021 10:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 223866.386794; Tue, 09 Nov 2021 10:55:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mkOmP-00025k-U7; Tue, 09 Nov 2021 10:55:05 +0000
Received: by outflank-mailman (input) for mailman id 223866;
 Tue, 09 Nov 2021 10:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mkOmO-00025J-Tn
 for xen-changelog@lists.xenproject.org; Tue, 09 Nov 2021 10:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mkOmO-0005KN-Sz
 for xen-changelog@lists.xenproject.org; Tue, 09 Nov 2021 10:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mkOmO-0007Kc-Ru
 for xen-changelog@lists.xenproject.org; Tue, 09 Nov 2021 10:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=r0n9cS3X90ESBKxx+ixdWrnfvtsvuBbd9N2qUrGbo2A=; b=ymVC7PwBEyhuTYc3diSCoJ7N1T
	MLxuSocp557voK1wVXDFQBJJWYg1iMWeq1acCYZ7Apz4Y0j97gC0JGqgpkL7ALmS58Z94+gIWQMTP
	6LAj3jQJZsl6mUm0G9GNJhXNqpAfZ1RoY243DptHd56uIwBEZWgz/xjwrJQ+8yXAPNao=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/configure: make iPXE dependent on QEMU traditional
Message-Id: <E1mkOmO-0007Kc-Ru@xenbits.xenproject.org>
Date: Tue, 09 Nov 2021 10:55:04 +0000

commit 9d9cd0c6f5b16652f61e7f21233ec8dfd6cf7df2
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Nov 9 10:47:21 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 9 10:53:52 2021 +0000

    tools/configure: make iPXE dependent on QEMU traditional
    
    iPXE is only used by QEMU traditional, so make it off by default
    unless QEMU traditional is enabled.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Fixes: bcf77ce510 ('configure: modify default of building rombios')
    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    | 28 ++++++++++++++++------------
 tools/configure.ac | 14 +++++++-------
 2 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/tools/configure b/tools/configure
index a3d33eb907..40f970b14b 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1504,8 +1504,8 @@ Optional Features:
   --enable-qemu-traditional
                           Enable qemu traditional device model, (DEFAULT is
                           off)
-  --enable-ipxe           Enable in-tree IPXE, (DEFAULT is on for x86,
-                          otherwise off, see also --with-system-ipxe)
+  --enable-ipxe           Enable in-tree IPXE, (DEFAULT is off, see also
+                          --with-system-ipxe)
   --enable-rombios        Enable ROMBIOS, (DEFAULT is on if qemu-traditional
                           or ipxe is enabled, otherwise off)
   --enable-systemd        Enable systemd support (default is DISABLED)
@@ -4300,25 +4300,29 @@ else
 
 fi
 
-if test "x$enable_ipxe" = "xno"; then :
-  ipxe=n
-else
-  ipxe=y
-fi
 
 # Check whether --enable-ipxe was given.
 if test "${enable_ipxe+set}" = set; then :
   enableval=$enable_ipxe;
 else
 
-    case "$host_cpu" in
-        i[3456]86|x86_64)
-           enable_ipxe="yes";;
-        *) enable_ipxe="no";;
-    esac
+    if test "x$enable_qemu_traditional" = "xyes"; then :
+
+        enable_ipxe="yes"
+
+else
+
+        enable_ipxe="no"
 
 fi
 
+fi
+
+if test "x$enable_ipxe" = "xno"; then :
+  ipxe=n
+else
+  ipxe=y
+fi
 
 # Check whether --with-system-ipxe was given.
 if test "${with_system_ipxe+set}" = set; then :
diff --git a/tools/configure.ac b/tools/configure.ac
index 03eb7cf146..3ac62626a5 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -130,13 +130,13 @@ AC_SUBST(qemu_traditional)
 
 AC_ARG_ENABLE([ipxe],
     AS_HELP_STRING([--enable-ipxe],
-                   [Enable in-tree IPXE, (DEFAULT is on for x86,
-                    otherwise off, see also --with-system-ipxe)]),,[
-    case "$host_cpu" in
-        i[[3456]]86|x86_64)
-           enable_ipxe="yes";;
-        *) enable_ipxe="no";;
-    esac
+                   [Enable in-tree IPXE,
+                    (DEFAULT is off, see also --with-system-ipxe)]),,[
+    AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
+        enable_ipxe="yes"
+    ], [
+        enable_ipxe="no"
+    ])
 ])
 AS_IF([test "x$enable_ipxe" = "xno"], [ipxe=n], [ipxe=y])
 AC_ARG_WITH([system-ipxe],
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 10 06:55:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 10 Nov 2021 06:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.224209.387368 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mkhVe-0003ks-7d; Wed, 10 Nov 2021 06:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 224209.387368; Wed, 10 Nov 2021 06:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mkhVe-0003kj-4N; Wed, 10 Nov 2021 06:55:02 +0000
Received: by outflank-mailman (input) for mailman id 224209;
 Wed, 10 Nov 2021 06:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mkhVd-0003kd-CK
 for xen-changelog@lists.xenproject.org; Wed, 10 Nov 2021 06: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 1mkhVd-0003qE-AW
 for xen-changelog@lists.xenproject.org; Wed, 10 Nov 2021 06:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mkhVd-0005ui-9c
 for xen-changelog@lists.xenproject.org; Wed, 10 Nov 2021 06: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=RCop9WT0/kRePsvrQqzWhSis4e4USZEmkk8t6VXNakI=; b=ViiA5Yw0AJ6jCRwkNqdMBeH37W
	ffcqjEu2YSmSZL8Y7jpx4wapdje2tVppNjKIo4RBMWcGVogLCqKrvmHjfCFqK4rfhq235ZvC4jhiZ
	fW1dsKrTiDkP77MxB9FhZTiQSDgT23wAqWawg9SBr8m+zHTbcxawh+urIKeEE6sQ/SeE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/configure: make iPXE dependent on QEMU traditional
Message-Id: <E1mkhVd-0005ui-9c@xenbits.xenproject.org>
Date: Wed, 10 Nov 2021 06:55:01 +0000

commit 9d9cd0c6f5b16652f61e7f21233ec8dfd6cf7df2
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Nov 9 10:47:21 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 9 10:53:52 2021 +0000

    tools/configure: make iPXE dependent on QEMU traditional
    
    iPXE is only used by QEMU traditional, so make it off by default
    unless QEMU traditional is enabled.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Fixes: bcf77ce510 ('configure: modify default of building rombios')
    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    | 28 ++++++++++++++++------------
 tools/configure.ac | 14 +++++++-------
 2 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/tools/configure b/tools/configure
index a3d33eb907..40f970b14b 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1504,8 +1504,8 @@ Optional Features:
   --enable-qemu-traditional
                           Enable qemu traditional device model, (DEFAULT is
                           off)
-  --enable-ipxe           Enable in-tree IPXE, (DEFAULT is on for x86,
-                          otherwise off, see also --with-system-ipxe)
+  --enable-ipxe           Enable in-tree IPXE, (DEFAULT is off, see also
+                          --with-system-ipxe)
   --enable-rombios        Enable ROMBIOS, (DEFAULT is on if qemu-traditional
                           or ipxe is enabled, otherwise off)
   --enable-systemd        Enable systemd support (default is DISABLED)
@@ -4300,25 +4300,29 @@ else
 
 fi
 
-if test "x$enable_ipxe" = "xno"; then :
-  ipxe=n
-else
-  ipxe=y
-fi
 
 # Check whether --enable-ipxe was given.
 if test "${enable_ipxe+set}" = set; then :
   enableval=$enable_ipxe;
 else
 
-    case "$host_cpu" in
-        i[3456]86|x86_64)
-           enable_ipxe="yes";;
-        *) enable_ipxe="no";;
-    esac
+    if test "x$enable_qemu_traditional" = "xyes"; then :
+
+        enable_ipxe="yes"
+
+else
+
+        enable_ipxe="no"
 
 fi
 
+fi
+
+if test "x$enable_ipxe" = "xno"; then :
+  ipxe=n
+else
+  ipxe=y
+fi
 
 # Check whether --with-system-ipxe was given.
 if test "${with_system_ipxe+set}" = set; then :
diff --git a/tools/configure.ac b/tools/configure.ac
index 03eb7cf146..3ac62626a5 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -130,13 +130,13 @@ AC_SUBST(qemu_traditional)
 
 AC_ARG_ENABLE([ipxe],
     AS_HELP_STRING([--enable-ipxe],
-                   [Enable in-tree IPXE, (DEFAULT is on for x86,
-                    otherwise off, see also --with-system-ipxe)]),,[
-    case "$host_cpu" in
-        i[[3456]]86|x86_64)
-           enable_ipxe="yes";;
-        *) enable_ipxe="no";;
-    esac
+                   [Enable in-tree IPXE,
+                    (DEFAULT is off, see also --with-system-ipxe)]),,[
+    AS_IF([test "x$enable_qemu_traditional" = "xyes"], [
+        enable_ipxe="yes"
+    ], [
+        enable_ipxe="no"
+    ])
 ])
 AS_IF([test "x$enable_ipxe" = "xno"], [ipxe=n], [ipxe=y])
 AC_ARG_WITH([system-ipxe],
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 11 18:44:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Nov 2021 18:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.224882.388422 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mlF3O-00063k-67; Thu, 11 Nov 2021 18:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 224882.388422; Thu, 11 Nov 2021 18: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 1mlF3O-00063d-3B; Thu, 11 Nov 2021 18:44:06 +0000
Received: by outflank-mailman (input) for mailman id 224882;
 Thu, 11 Nov 2021 18: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 1mlF3N-00063V-0u
 for xen-changelog@lists.xenproject.org; Thu, 11 Nov 2021 18: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 1mlF3M-0003Wa-Uh
 for xen-changelog@lists.xenproject.org; Thu, 11 Nov 2021 18:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlF3M-0002a5-Tk
 for xen-changelog@lists.xenproject.org; Thu, 11 Nov 2021 18:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6zZQud0XhwTroOV7ieUKCoucHsC10O8+zLDkTuro8wk=; b=a2YbO8JQuZPZrkP5uCFbR2GFUl
	L2bG076AUiikIWNz9PButF9/2ki1XEMordSAXRfJDIa9cSPbVa+dSsy9GyBHDiai1hF5QkrMKUpkj
	IC6gaCJb4SU9VL7//ItR2FU8YNxkBvaRSWuhu+XqAxAIgYvOEi9ZTmwjZlqHzriJ490M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: don't assign domU static-mem to dom0 as reserved-memory
Message-Id: <E1mlF3M-0002a5-Tk@xenbits.xenproject.org>
Date: Thu, 11 Nov 2021 18:44:04 +0000

commit 9aaf437cd3612fea26d5a645da83b8f21cf34a79
Author:     Stefano Stabellini <stefano.stabellini@xilinx.com>
AuthorDate: Wed Nov 10 12:18:12 2021 -0800
Commit:     Stefano Stabellini <stefano.stabellini@xilinx.com>
CommitDate: Thu Nov 11 10:34:18 2021 -0800

    xen/arm: don't assign domU static-mem to dom0 as reserved-memory
    
    DomUs static-mem ranges are added to the reserved_mem array for
    accounting, but they shouldn't be assigned to dom0 as the other regular
    reserved-memory ranges in device tree.
    
    In make_memory_nodes, fix the error by skipping banks with xen_domain
    set to true in the reserved-memory array. Also make sure to use the
    first valid (!xen_domain) start address for the memory node name.
    
    Fixes: 41c031ff437b ("xen/arm: introduce domain on Static Allocation")
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Reviewed-by: Penny Zheng <penny.zheng@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/arm/domain_build.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 9e92b640cd..dafbc13962 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -862,21 +862,25 @@ static int __init make_memory_node(const struct domain *d,
 {
     int res, i;
     int reg_size = addrcells + sizecells;
-    int nr_cells = reg_size * mem->nr_banks;
+    int nr_cells = 0;
     /* Placeholder for memory@ + a 64-bit number + \0 */
     char buf[24];
     __be32 reg[NR_MEM_BANKS * 4 /* Worst case addrcells + sizecells */];
     __be32 *cells;
 
-    BUG_ON(nr_cells >= ARRAY_SIZE(reg));
     if ( mem->nr_banks == 0 )
         return -ENOENT;
 
-    dt_dprintk("Create memory node (reg size %d, nr cells %d)\n",
-               reg_size, nr_cells);
+    /* find first memory range not bound to a Xen domain */
+    for ( i = 0; i < mem->nr_banks && mem->bank[i].xen_domain; i++ )
+        ;
+    if ( i == mem->nr_banks )
+        return 0;
+
+    dt_dprintk("Create memory node\n");
 
     /* ePAPR 3.4 */
-    snprintf(buf, sizeof(buf), "memory@%"PRIx64, mem->bank[0].start);
+    snprintf(buf, sizeof(buf), "memory@%"PRIx64, mem->bank[i].start);
     res = fdt_begin_node(fdt, buf);
     if ( res )
         return res;
@@ -886,17 +890,24 @@ static int __init make_memory_node(const struct domain *d,
         return res;
 
     cells = &reg[0];
-    for ( i = 0 ; i < mem->nr_banks; i++ )
+    for ( ; i < mem->nr_banks; i++ )
     {
         u64 start = mem->bank[i].start;
         u64 size = mem->bank[i].size;
 
+        if ( mem->bank[i].xen_domain )
+            continue;
+
         dt_dprintk("  Bank %d: %#"PRIx64"->%#"PRIx64"\n",
                    i, start, start + size);
 
+        nr_cells += reg_size;
+        BUG_ON(nr_cells >= ARRAY_SIZE(reg));
         dt_child_set_range(&cells, addrcells, sizecells, start, size);
     }
 
+    dt_dprintk("(reg size %d, nr cells %d)\n", reg_size, nr_cells);
+
     res = fdt_property(fdt, "reg", reg, nr_cells * sizeof(*reg));
     if ( res )
         return res;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Nov 11 18:44:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Nov 2021 18:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.224883.388425 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mlF3Y-00065W-7X; Thu, 11 Nov 2021 18:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 224883.388425; Thu, 11 Nov 2021 18: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 1mlF3Y-00065O-4m; Thu, 11 Nov 2021 18:44:16 +0000
Received: by outflank-mailman (input) for mailman id 224883;
 Thu, 11 Nov 2021 18: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 1mlF3X-00065C-2f
 for xen-changelog@lists.xenproject.org; Thu, 11 Nov 2021 18: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 1mlF3X-0003Wl-1p
 for xen-changelog@lists.xenproject.org; Thu, 11 Nov 2021 18:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlF3X-0002ah-0u
 for xen-changelog@lists.xenproject.org; Thu, 11 Nov 2021 18: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=Ovwha3cxakTypMyvLkrGpE8ziJy4QNNBr9V+55XFJFg=; b=p2xFCyG929NbC4hU2kGNHkI6d0
	ooBSQ4QGID86zDmBpiN5hC6C+AbNks2rhNR5cKUHTm6sNlz14EYNeKAkAxU7EaLU3gC5vhxdFqwb1
	Q7WxozyrHx22//3eWVUxSpGG3NbegNJt0rnV4UYaaQhkVjQ6FLuFTUDeu/62OFtrb6hc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: allocate_bank_memory: don't create memory banks of size zero
Message-Id: <E1mlF3X-0002ah-0u@xenbits.xenproject.org>
Date: Thu, 11 Nov 2021 18:44:15 +0000

commit d8e1ed865ac4804c2ba98fc9ef1b53bfa8357f43
Author:     Stefano Stabellini <stefano.stabellini@xilinx.com>
AuthorDate: Wed Nov 10 12:55:55 2021 -0800
Commit:     Stefano Stabellini <stefano.stabellini@xilinx.com>
CommitDate: Thu Nov 11 10:35:13 2021 -0800

    xen/arm: allocate_bank_memory: don't create memory banks of size zero
    
    allocate_bank_memory can be called with a tot_size of zero, as an
    example see the implementation of allocate_memory which can call
    allocate_bank_memory with a tot_size of zero for the second memory bank.
    
    If tot_size == 0, don't create an empty memory bank, just return
    immediately without error. Otherwise a zero-size memory bank will be
    added to the domain device tree.
    
    Note that Linux is known to be able to cope with zero-size memory banks,
    and Xen more recently gained the ability to do so as well (5a37207df520
    "xen/arm: bootfdt: Ignore empty memory bank"). However, there might be
    other non-Linux OSes that are not able to cope with empty memory banks
    as well as Linux (and now Xen). It would be more robust to avoid
    zero-size memory banks unless required.
    
    Moreover, the code to find empty address regions in make_hypervisor_node
    in Xen is not able to cope with empty memory banks today and would
    result in a Xen crash. This is only a latent bug because
    make_hypervisor_node is only called for Dom0 at present and
    allocate_memory is only called for DomU at the moment. (But if
    make_hypervisor_node was to be called for a DomU, then the Xen crash
    would become manifest.)
    
    Fixes: f2931b4233ec ("xen/arm: introduce allocate_memory")
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/arm/domain_build.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index dafbc13962..19487c79da 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -395,6 +395,14 @@ static bool __init allocate_bank_memory(struct domain *d,
     struct membank *bank;
     unsigned int max_order = ~0;
 
+    /*
+     * allocate_bank_memory can be called with a tot_size of zero for
+     * the second memory bank. It is not an error and we can safely
+     * avoid creating a zero-size memory bank.
+     */
+    if ( tot_size == 0 )
+        return true;
+
     bank = &kinfo->mem.bank[kinfo->mem.nr_banks];
     bank->start = gfn_to_gaddr(sgfn);
     bank->size = tot_size;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Nov 11 18:44:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 11 Nov 2021 18:44:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.224884.388430 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mlF3i-00068d-99; Thu, 11 Nov 2021 18:44:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 224884.388430; Thu, 11 Nov 2021 18: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 1mlF3i-00068V-6B; Thu, 11 Nov 2021 18:44:26 +0000
Received: by outflank-mailman (input) for mailman id 224884;
 Thu, 11 Nov 2021 18: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 1mlF3h-00068C-5d
 for xen-changelog@lists.xenproject.org; Thu, 11 Nov 2021 18: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 1mlF3h-0003X5-4o
 for xen-changelog@lists.xenproject.org; Thu, 11 Nov 2021 18:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlF3h-0002bP-42
 for xen-changelog@lists.xenproject.org; Thu, 11 Nov 2021 18: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=vt+w8O8PlV0Mcyzx1Jzapw/ALIP8HdEntrn9B49/gtE=; b=UcEWuTnTrXrQ2zYYRc0mcr9+SF
	WP7XJs+G8SAdLGiaceV+fswQuYjmKkU1cqHzqg5zPnfoeYLaTyxdn8O1lDI/HfuUOGEpCPHwE2zVr
	Xke+OFw6DeuMbj7i0L7oF/6DAPFzcYFjhBNKGs/tj58rmDG8DdMm0nJ6WY3QpkLjLObA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] MAINTAINERS: add Bertrand to the ARM reviewers
Message-Id: <E1mlF3h-0002bP-42@xenbits.xenproject.org>
Date: Thu, 11 Nov 2021 18:44:25 +0000

commit e2d0a42381b686451bed3e0e3ab8551f6c2d4090
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Fri Nov 5 08:44:45 2021 -0700
Commit:     Stefano Stabellini <stefano.stabellini@xilinx.com>
CommitDate: Thu Nov 11 10:35:56 2021 -0800

    MAINTAINERS: add Bertrand to the ARM reviewers
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 9be4ad653a..4956db1011 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -232,6 +232,7 @@ ARM (W/ VIRTUALISATION EXTENSIONS) ARCHITECTURE
 M:	Stefano Stabellini <sstabellini@kernel.org>
 M:	Julien Grall <julien@xen.org>
 R:	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
+R:	Bertrand Marquis <bertrand.marquis@arm.com>
 S:	Supported
 L:	xen-devel@lists.xenproject.org
 F:	docs/misc/arm/
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 12 09:55:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Nov 2021 09:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.225070.388705 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mlTGw-0000cc-Ue; Fri, 12 Nov 2021 09:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 225070.388705; Fri, 12 Nov 2021 09:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mlTGw-0000cU-Rf; Fri, 12 Nov 2021 09:55:02 +0000
Received: by outflank-mailman (input) for mailman id 225070;
 Fri, 12 Nov 2021 09:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlTGv-0000cO-IL
 for xen-changelog@lists.xenproject.org; Fri, 12 Nov 2021 09: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 1mlTGv-0005Gb-Ee
 for xen-changelog@lists.xenproject.org; Fri, 12 Nov 2021 09:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlTGv-000507-DY
 for xen-changelog@lists.xenproject.org; Fri, 12 Nov 2021 09: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=V0SyRcBNeGV5ve0Zk/xXi0wuz+qThvh6BlmuCCJ1JuQ=; b=ABzD9ZP1EqhUHqIOvUlmIBD4Wj
	ZvHvks9BLubIb9flfyIBoS4SgiGx/F87ADlt4ayqx5GQDf9VjZ9IxN7yR81YlC5KJLP+3lfT67G3Y
	kzZPJ2aL++9g3gid61Ja6e3qSXTRRM1TDoHfPjFu+IG2FBoq8VltlwSKrV7l8XRR+oZQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: don't assign domU static-mem to dom0 as reserved-memory
Message-Id: <E1mlTGv-000507-DY@xenbits.xenproject.org>
Date: Fri, 12 Nov 2021 09:55:01 +0000

commit 9aaf437cd3612fea26d5a645da83b8f21cf34a79
Author:     Stefano Stabellini <stefano.stabellini@xilinx.com>
AuthorDate: Wed Nov 10 12:18:12 2021 -0800
Commit:     Stefano Stabellini <stefano.stabellini@xilinx.com>
CommitDate: Thu Nov 11 10:34:18 2021 -0800

    xen/arm: don't assign domU static-mem to dom0 as reserved-memory
    
    DomUs static-mem ranges are added to the reserved_mem array for
    accounting, but they shouldn't be assigned to dom0 as the other regular
    reserved-memory ranges in device tree.
    
    In make_memory_nodes, fix the error by skipping banks with xen_domain
    set to true in the reserved-memory array. Also make sure to use the
    first valid (!xen_domain) start address for the memory node name.
    
    Fixes: 41c031ff437b ("xen/arm: introduce domain on Static Allocation")
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Reviewed-by: Penny Zheng <penny.zheng@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/arm/domain_build.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 9e92b640cd..dafbc13962 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -862,21 +862,25 @@ static int __init make_memory_node(const struct domain *d,
 {
     int res, i;
     int reg_size = addrcells + sizecells;
-    int nr_cells = reg_size * mem->nr_banks;
+    int nr_cells = 0;
     /* Placeholder for memory@ + a 64-bit number + \0 */
     char buf[24];
     __be32 reg[NR_MEM_BANKS * 4 /* Worst case addrcells + sizecells */];
     __be32 *cells;
 
-    BUG_ON(nr_cells >= ARRAY_SIZE(reg));
     if ( mem->nr_banks == 0 )
         return -ENOENT;
 
-    dt_dprintk("Create memory node (reg size %d, nr cells %d)\n",
-               reg_size, nr_cells);
+    /* find first memory range not bound to a Xen domain */
+    for ( i = 0; i < mem->nr_banks && mem->bank[i].xen_domain; i++ )
+        ;
+    if ( i == mem->nr_banks )
+        return 0;
+
+    dt_dprintk("Create memory node\n");
 
     /* ePAPR 3.4 */
-    snprintf(buf, sizeof(buf), "memory@%"PRIx64, mem->bank[0].start);
+    snprintf(buf, sizeof(buf), "memory@%"PRIx64, mem->bank[i].start);
     res = fdt_begin_node(fdt, buf);
     if ( res )
         return res;
@@ -886,17 +890,24 @@ static int __init make_memory_node(const struct domain *d,
         return res;
 
     cells = &reg[0];
-    for ( i = 0 ; i < mem->nr_banks; i++ )
+    for ( ; i < mem->nr_banks; i++ )
     {
         u64 start = mem->bank[i].start;
         u64 size = mem->bank[i].size;
 
+        if ( mem->bank[i].xen_domain )
+            continue;
+
         dt_dprintk("  Bank %d: %#"PRIx64"->%#"PRIx64"\n",
                    i, start, start + size);
 
+        nr_cells += reg_size;
+        BUG_ON(nr_cells >= ARRAY_SIZE(reg));
         dt_child_set_range(&cells, addrcells, sizecells, start, size);
     }
 
+    dt_dprintk("(reg size %d, nr cells %d)\n", reg_size, nr_cells);
+
     res = fdt_property(fdt, "reg", reg, nr_cells * sizeof(*reg));
     if ( res )
         return res;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 12 09:55:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Nov 2021 09:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.225071.388709 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mlTH6-0000eO-W8; Fri, 12 Nov 2021 09:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 225071.388709; Fri, 12 Nov 2021 09:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mlTH6-0000eG-TE; Fri, 12 Nov 2021 09:55:12 +0000
Received: by outflank-mailman (input) for mailman id 225071;
 Fri, 12 Nov 2021 09:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlTH5-0000e6-IW
 for xen-changelog@lists.xenproject.org; Fri, 12 Nov 2021 09:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlTH5-0005Gv-Hn
 for xen-changelog@lists.xenproject.org; Fri, 12 Nov 2021 09:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlTH5-00050o-Gw
 for xen-changelog@lists.xenproject.org; Fri, 12 Nov 2021 09:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Sc/fYHJdlQYKVvmylFajQ3HaoQVPTFcxxWrhvaO1BAE=; b=JmBi+KOetcjgpcs+W/Klxq4v7z
	LH/3MBeTOCrTaJV9lyMy9RRivJUWuTVr9NM8N5xI4oskAMsHnfefcU3bNF+e64QpkUWN+2Qgm9w6K
	pgXESb7SoJDTVpQKDpQe5v60oBya5bdt3c/pA2/DzUKC6no46M5dq7OzkSIFw+nDUOcg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: allocate_bank_memory: don't create memory banks of size zero
Message-Id: <E1mlTH5-00050o-Gw@xenbits.xenproject.org>
Date: Fri, 12 Nov 2021 09:55:11 +0000

commit d8e1ed865ac4804c2ba98fc9ef1b53bfa8357f43
Author:     Stefano Stabellini <stefano.stabellini@xilinx.com>
AuthorDate: Wed Nov 10 12:55:55 2021 -0800
Commit:     Stefano Stabellini <stefano.stabellini@xilinx.com>
CommitDate: Thu Nov 11 10:35:13 2021 -0800

    xen/arm: allocate_bank_memory: don't create memory banks of size zero
    
    allocate_bank_memory can be called with a tot_size of zero, as an
    example see the implementation of allocate_memory which can call
    allocate_bank_memory with a tot_size of zero for the second memory bank.
    
    If tot_size == 0, don't create an empty memory bank, just return
    immediately without error. Otherwise a zero-size memory bank will be
    added to the domain device tree.
    
    Note that Linux is known to be able to cope with zero-size memory banks,
    and Xen more recently gained the ability to do so as well (5a37207df520
    "xen/arm: bootfdt: Ignore empty memory bank"). However, there might be
    other non-Linux OSes that are not able to cope with empty memory banks
    as well as Linux (and now Xen). It would be more robust to avoid
    zero-size memory banks unless required.
    
    Moreover, the code to find empty address regions in make_hypervisor_node
    in Xen is not able to cope with empty memory banks today and would
    result in a Xen crash. This is only a latent bug because
    make_hypervisor_node is only called for Dom0 at present and
    allocate_memory is only called for DomU at the moment. (But if
    make_hypervisor_node was to be called for a DomU, then the Xen crash
    would become manifest.)
    
    Fixes: f2931b4233ec ("xen/arm: introduce allocate_memory")
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/arch/arm/domain_build.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index dafbc13962..19487c79da 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -395,6 +395,14 @@ static bool __init allocate_bank_memory(struct domain *d,
     struct membank *bank;
     unsigned int max_order = ~0;
 
+    /*
+     * allocate_bank_memory can be called with a tot_size of zero for
+     * the second memory bank. It is not an error and we can safely
+     * avoid creating a zero-size memory bank.
+     */
+    if ( tot_size == 0 )
+        return true;
+
     bank = &kinfo->mem.bank[kinfo->mem.nr_banks];
     bank->start = gfn_to_gaddr(sgfn);
     bank->size = tot_size;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 12 09:55:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Nov 2021 09:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.225072.388712 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mlTHH-0000ha-1Q; Fri, 12 Nov 2021 09:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 225072.388712; Fri, 12 Nov 2021 09:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mlTHG-0000hS-Uk; Fri, 12 Nov 2021 09:55:22 +0000
Received: by outflank-mailman (input) for mailman id 225072;
 Fri, 12 Nov 2021 09:55:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlTHF-0000gz-Lo
 for xen-changelog@lists.xenproject.org; Fri, 12 Nov 2021 09:55:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlTHF-0005HC-Kw
 for xen-changelog@lists.xenproject.org; Fri, 12 Nov 2021 09:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlTHF-00052A-K2
 for xen-changelog@lists.xenproject.org; Fri, 12 Nov 2021 09:55:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QzCne6PM4XXizdIgn2GrdjLIa8KIaoEkN0s2d5qltec=; b=IWxtVlFJPLJSCJVMKEEqizDbDm
	Xvljmz9z0TFdZxS5aOQcrSVXckc+YvhUD4xMEpq98gAEzxbDB8jG5xUIqxylkEACepWmWfX6FVjWR
	GmSvOOPBh7M9Fn+wMx7vssfN551HLs+kE5J4GdjZdl6bqOkWjKtBAioVUaUW5BzbkWA0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] MAINTAINERS: add Bertrand to the ARM reviewers
Message-Id: <E1mlTHF-00052A-K2@xenbits.xenproject.org>
Date: Fri, 12 Nov 2021 09:55:21 +0000

commit e2d0a42381b686451bed3e0e3ab8551f6c2d4090
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Fri Nov 5 08:44:45 2021 -0700
Commit:     Stefano Stabellini <stefano.stabellini@xilinx.com>
CommitDate: Thu Nov 11 10:35:56 2021 -0800

    MAINTAINERS: add Bertrand to the ARM reviewers
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 9be4ad653a..4956db1011 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -232,6 +232,7 @@ ARM (W/ VIRTUALISATION EXTENSIONS) ARCHITECTURE
 M:	Stefano Stabellini <sstabellini@kernel.org>
 M:	Julien Grall <julien@xen.org>
 R:	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
+R:	Bertrand Marquis <bertrand.marquis@arm.com>
 S:	Supported
 L:	xen-devel@lists.xenproject.org
 F:	docs/misc/arm/
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 12 13:00:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Nov 2021 13:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.225240.388977 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mlWA2-0005hk-Vo; Fri, 12 Nov 2021 13:00:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 225240.388977; Fri, 12 Nov 2021 13: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 1mlWA2-0005hc-R3; Fri, 12 Nov 2021 13:00:06 +0000
Received: by outflank-mailman (input) for mailman id 225240;
 Fri, 12 Nov 2021 13: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 1mlWA1-0005Vq-36
 for xen-changelog@lists.xenproject.org; Fri, 12 Nov 2021 13: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 1mlWA1-0000FJ-1T
 for xen-changelog@lists.xenproject.org; Fri, 12 Nov 2021 13:00:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlWA1-0000WP-0D
 for xen-changelog@lists.xenproject.org; Fri, 12 Nov 2021 13: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=rRqzXUiF/Y0PLrfsgTJuoaPuH9mKe4iBmKCb81gUwHc=; b=kqd4c5btHgz+V+FRv+PX2Vv9xx
	LyhOXXLFF08s3UcVyL82pcV9h0py7IZ0p4Vhu6aJRXQW58O6AI9RdLj03KH9wAeTDViBSKcvW7F59
	KHdRPEnQ7uYAAlUBcIlnNVh+bwcAcc1qYkPUPLYMedUqcH9WYys5k2EC28jEEB/JYfAo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: per-domain IOMMU bitmap needs to have dynamic size
Message-Id: <E1mlWA1-0000WP-0D@xenbits.xenproject.org>
Date: Fri, 12 Nov 2021 13:00:05 +0000

commit c06e3d81031424a8a0f725198c16ad81007be89c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 12 13:56:51 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 12 13:56:51 2021 +0100

    VT-d: per-domain IOMMU bitmap needs to have dynamic size
    
    With no upper bound (anymore) on the number of IOMMUs, a fixed-size
    64-bit map may be insufficient (systems with 40 IOMMUs have already been
    observed).
    
    Fixes: 27713fa2aa21 ("VT-d: improve save/restore of registers across S3")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/drivers/passthrough/vtd/iommu.c | 15 +++++++++++----
 xen/include/asm-x86/iommu.h         |  2 +-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 0e7e111286..7b8337017a 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -54,7 +54,7 @@ bool __read_mostly iommu_qinval = true;
 bool __read_mostly iommu_snoop = true;
 #endif
 
-static unsigned int __initdata nr_iommus;
+static unsigned int __read_mostly nr_iommus;
 
 static struct iommu_ops vtd_ops;
 static struct tasklet vtd_fault_tasklet;
@@ -645,7 +645,7 @@ static int __must_check iommu_flush_iotlb(struct domain *d, dfn_t dfn,
 
         iommu = drhd->iommu;
 
-        if ( !test_bit(iommu->index, &hd->arch.vtd.iommu_bitmap) )
+        if ( !test_bit(iommu->index, hd->arch.vtd.iommu_bitmap) )
             continue;
 
         flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
@@ -1308,6 +1308,11 @@ static int intel_iommu_domain_init(struct domain *d)
 {
     struct domain_iommu *hd = dom_iommu(d);
 
+    hd->arch.vtd.iommu_bitmap = xzalloc_array(unsigned long,
+                                              BITS_TO_LONGS(nr_iommus));
+    if ( !hd->arch.vtd.iommu_bitmap )
+        return -ENOMEM;
+
     hd->arch.vtd.agaw = width_to_agaw(DEFAULT_DOMAIN_ADDRESS_WIDTH);
 
     return 0;
@@ -1457,7 +1462,7 @@ int domain_context_mapping_one(
     if ( rc > 0 )
         rc = 0;
 
-    set_bit(iommu->index, &hd->arch.vtd.iommu_bitmap);
+    set_bit(iommu->index, hd->arch.vtd.iommu_bitmap);
 
     unmap_vtd_domain_page(context_entries);
 
@@ -1789,7 +1794,7 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
 
     if ( !found )
     {
-        clear_bit(iommu->index, &dom_iommu(domain)->arch.vtd.iommu_bitmap);
+        clear_bit(iommu->index, dom_iommu(domain)->arch.vtd.iommu_bitmap);
         cleanup_domid_map(domain, iommu);
     }
 
@@ -1819,6 +1824,8 @@ static void iommu_domain_teardown(struct domain *d)
 
     for_each_drhd_unit ( drhd )
         cleanup_domid_map(d, drhd->iommu);
+
+    XFREE(hd->arch.vtd.iommu_bitmap);
 }
 
 static int __must_check intel_iommu_map_page(struct domain *d, dfn_t dfn,
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 8aff75e4ff..de46149b40 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -58,7 +58,7 @@ struct arch_iommu
         struct {
             uint64_t pgd_maddr; /* io page directory machine address */
             unsigned int agaw; /* adjusted guest address width, 0 is level 2 30-bit */
-            uint64_t iommu_bitmap; /* bitmap of iommu(s) that the domain uses */
+            unsigned long *iommu_bitmap; /* bitmap of iommu(s) that the domain uses */
         } vtd;
         /* AMD IOMMU */
         struct {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 12 14:00:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Nov 2021 14:00:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.225260.389002 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mlX65-0003m8-RP; Fri, 12 Nov 2021 14:00:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 225260.389002; Fri, 12 Nov 2021 14:00:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mlX65-0003lz-Ni; Fri, 12 Nov 2021 14:00:05 +0000
Received: by outflank-mailman (input) for mailman id 225260;
 Fri, 12 Nov 2021 14:00:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlX64-0003hC-Qz
 for xen-changelog@lists.xenproject.org; Fri, 12 Nov 2021 14:00:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlX64-0001LN-PA
 for xen-changelog@lists.xenproject.org; Fri, 12 Nov 2021 14:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlX64-0004Rl-OD
 for xen-changelog@lists.xenproject.org; Fri, 12 Nov 2021 14:00:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bVGVuhohbljoM6N3OQ330/6RckBcGEYCcQ+pKA5LeEM=; b=zJwwdr6F6K4QuQDAnFI/Y1q8lR
	kBFSbsKq+B/NLaLeq4RHLBGO15WQ05A+6WzrsdqkZ7akD9Ezud2/3nIcB8T49uTFAqDKUrZukVJ9N
	Ci+8krat5yEt3itwqgHLVad1oSI9IXwCSioZR6SrwOR54Gla03jnTXWHm+nnAoV863Eg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cpuid: prevent shrinking migrated policies max leaves
Message-Id: <E1mlX64-0004Rl-OD@xenbits.xenproject.org>
Date: Fri, 12 Nov 2021 14:00:04 +0000

commit 81da2b544cbb003a5447c9b14d275746ad22ab37
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Nov 10 18:40:59 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Nov 12 13:57:04 2021 +0000

    x86/cpuid: prevent shrinking migrated policies max leaves
    
    CPUID policies from guest being migrated shouldn't have the maximum
    leaves shrink, as that would be a guest visible change. The hypervisor
    has no knowledge on whether a guest has been migrated or is build from
    scratch, and hence it must not blindly shrink the CPUID policy in
    recalculate_cpuid_policy. Remove the
    x86_cpuid_policy_shrink_max_leaves call from recalculate_cpuid_policy.
    Removing such call could be seen as a partial revert of 540d911c28.
    
    Instead let the toolstack shrink the policies for newly created
    guests, while keeping the previous values for guests that are migrated
    in. Note that guests migrated in without a CPUID policy won't get any
    kind of shrinking applied.
    
    Fixes: 540d911c28 ('x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents')
    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>
---
 tools/libs/guest/xg_cpuid_x86.c | 7 +++++++
 xen/arch/x86/cpuid.c            | 2 --
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 198892ebdf..3ffd5f683b 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -638,6 +638,13 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
         }
     }
 
+    /*
+     * Do not try to shrink the policy if restoring, as that could cause
+     * guest visible changes in the maximum leaf fields.
+     */
+    if ( !restore )
+        x86_cpuid_policy_shrink_max_leaves(p);
+
     rc = x86_cpuid_copy_to_buffer(p, leaves, &nr_leaves);
     if ( rc )
     {
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 2079a30ae4..8ac55f0806 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -719,8 +719,6 @@ void recalculate_cpuid_policy(struct domain *d)
 
     if ( !p->extd.page1gb )
         p->extd.raw[0x19] = EMPTY_LEAF;
-
-    x86_cpuid_policy_shrink_max_leaves(p);
 }
 
 int init_domain_cpuid_policy(struct domain *d)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 12 20:55:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 12 Nov 2021 20:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.225428.389282 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mldZi-0003hd-0M; Fri, 12 Nov 2021 20:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 225428.389282; Fri, 12 Nov 2021 20: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 1mldZh-0003hV-Tb; Fri, 12 Nov 2021 20:55:05 +0000
Received: by outflank-mailman (input) for mailman id 225428;
 Fri, 12 Nov 2021 20: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 1mldZg-0003hP-Bq
 for xen-changelog@lists.xenproject.org; Fri, 12 Nov 2021 20: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 1mldZg-0000SH-9N
 for xen-changelog@lists.xenproject.org; Fri, 12 Nov 2021 20:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mldZg-00041P-8D
 for xen-changelog@lists.xenproject.org; Fri, 12 Nov 2021 20: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=aFZEr46iTa66MNaidV2WAz0mtA8i3/yVR7N2+0W7E9A=; b=HsgI5G0MVjuNwq0NUH0rsoaY1J
	WYlR5Ue+Ql6yIIMSjvSPIbvVk/BgDh35IAHn8bFEOTinf2MnPxq6VVoo2nw5NeUk6oK+Wyq0oi2yx
	q99jYEpHv882SHDdqAW1k1VGDxXSps0IJK6/begxkPJr9EjIcisK5l9P4bSamp6ZmJO8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tests/resource: Extend to check that the grant frames are mapped correctly
Message-Id: <E1mldZg-00041P-8D@xenbits.xenproject.org>
Date: Fri, 12 Nov 2021 20:55:04 +0000

commit c7a7f14b92991e7d79735bff95f04676b9af34c6
Author:     Jane Malalane <jane.malalane@citrix.com>
AuthorDate: Fri Nov 12 14:48:21 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Nov 12 19:49:36 2021 +0000

    tests/resource: Extend to check that the grant frames are mapped correctly
    
    Previously, we checked that we could map 40 pages with nothing
    complaining. Now we're adding extra logic to check that those 40
    frames are "correct".
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jane Malalane <jane.malalane@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/tests/resource/Makefile        |  2 +
 tools/tests/resource/test-resource.c | 87 +++++++++++++++++++++++++++++++++---
 2 files changed, 83 insertions(+), 6 deletions(-)

diff --git a/tools/tests/resource/Makefile b/tools/tests/resource/Makefile
index 1c3aee4ff7..b3cd70c06d 100644
--- a/tools/tests/resource/Makefile
+++ b/tools/tests/resource/Makefile
@@ -31,10 +31,12 @@ CFLAGS += -Werror
 CFLAGS += $(CFLAGS_xeninclude)
 CFLAGS += $(CFLAGS_libxenctrl)
 CFLAGS += $(CFLAGS_libxenforeginmemory)
+CFLAGS += $(CFLAGS_libxengnttab)
 CFLAGS += $(APPEND_CFLAGS)
 
 LDFLAGS += $(LDLIBS_libxenctrl)
 LDFLAGS += $(LDLIBS_libxenforeignmemory)
+LDFLAGS += $(LDLIBS_libxengnttab)
 LDFLAGS += $(APPEND_LDFLAGS)
 
 %.o: Makefile
diff --git a/tools/tests/resource/test-resource.c b/tools/tests/resource/test-resource.c
index 1caaa60e62..988f96f7c1 100644
--- a/tools/tests/resource/test-resource.c
+++ b/tools/tests/resource/test-resource.c
@@ -6,6 +6,7 @@
 
 #include <xenctrl.h>
 #include <xenforeignmemory.h>
+#include <xengnttab.h>
 #include <xen-tools/libs.h>
 
 static unsigned int nr_failures;
@@ -17,13 +18,17 @@ static unsigned int nr_failures;
 
 static xc_interface *xch;
 static xenforeignmemory_handle *fh;
+static xengnttab_handle *gh;
 
-static void test_gnttab(uint32_t domid, unsigned int nr_frames)
+static void test_gnttab(uint32_t domid, unsigned int nr_frames,
+                        unsigned long gfn)
 {
     xenforeignmemory_resource_handle *res;
-    void *addr = NULL;
+    grant_entry_v1_t *gnttab;
     size_t size;
     int rc;
+    uint32_t refs[nr_frames], domids[nr_frames];
+    void *grants;
 
     printf("  Test grant table\n");
 
@@ -51,18 +56,56 @@ static void test_gnttab(uint32_t domid, unsigned int nr_frames)
     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);
+        (void **)&gnttab, 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));
+        return fail("    Fail: Map grant table %d - %s\n",
+                    errno, strerror(errno));
 
+    /* Put each gref at a unique offset in its frame. */
+    for ( unsigned int i = 0; i < nr_frames; i++ )
+    {
+        unsigned int gref = i * (XC_PAGE_SIZE / sizeof(*gnttab)) + i;
+
+        refs[i] = gref;
+        domids[i] = domid;
+
+        gnttab[gref].domid = 0;
+        gnttab[gref].frame = gfn;
+        gnttab[gref].flags = GTF_permit_access;
+    }
+
+    /* Map grants. */
+    grants = xengnttab_map_grant_refs(gh, nr_frames, domids, refs,
+                                      PROT_READ | PROT_WRITE);
+
+    /*
+     * Failure here indicates either that the frames were not mapped
+     * in the correct order or xenforeignmemory_map_resource() didn't
+     * give us the frames we asked for to begin with.
+     */
+    if ( grants == NULL )
+    {
+        fail("    Fail: Map grants %d - %s\n", errno, strerror(errno));
+        goto out;
+    }
+
+    /* Unmap grants. */
+    rc = xengnttab_unmap(gh, grants, nr_frames);
+
+    if ( rc )
+        fail("    Fail: Unmap grants %d - %s\n", errno, strerror(errno));
+
+    /* Unmap grant table. */
+ out:
     rc = xenforeignmemory_unmap_resource(fh, res);
     if ( rc )
-        return fail("    Fail: Unmap %d - %s\n", errno, strerror(errno));
+        return fail("    Fail: Unmap grant table %d - %s\n",
+                    errno, strerror(errno));
 }
 
 static void test_domain_configurations(void)
@@ -107,6 +150,7 @@ static void test_domain_configurations(void)
         struct test *t = &tests[i];
         uint32_t domid = 0;
         int rc;
+        xen_pfn_t ram[1] = { 0 };
 
         printf("Test %s\n", t->name);
 
@@ -123,8 +167,26 @@ static void test_domain_configurations(void)
 
         printf("  Created d%u\n", domid);
 
-        test_gnttab(domid, t->create.max_grant_frames);
+        rc = xc_domain_setmaxmem(xch, domid, -1);
+        if ( rc )
+        {
+            fail("  Failed to set max memory for domain: %d - %s\n",
+                 errno, strerror(errno));
+            goto test_done;
+        }
+
+        rc = xc_domain_populate_physmap_exact(
+            xch, domid, ARRAY_SIZE(ram), 0, 0, ram);
+        if ( rc )
+        {
+            fail("  Failed to populate physmap domain: %d - %s\n",
+                 errno, strerror(errno));
+            goto test_done;
+        }
+
+        test_gnttab(domid, t->create.max_grant_frames, ram[0]);
 
+    test_done:
         rc = xc_domain_destroy(xch, domid);
         if ( rc )
             fail("  Failed to destroy domain: %d - %s\n",
@@ -138,13 +200,26 @@ int main(int argc, char **argv)
 
     xch = xc_interface_open(NULL, NULL, 0);
     fh = xenforeignmemory_open(NULL, 0);
+    gh = xengnttab_open(NULL, 0);
 
     if ( !xch )
         err(1, "xc_interface_open");
     if ( !fh )
         err(1, "xenforeignmemory_open");
+    if ( !gh )
+        err(1, "xengnttab_open");
 
     test_domain_configurations();
 
     return !!nr_failures;
 }
+
+/*
+ * 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 Sat Nov 13 18:33:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Nov 2021 18:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.225549.389517 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mlxpm-0003ZT-CM; Sat, 13 Nov 2021 18:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 225549.389517; Sat, 13 Nov 2021 18:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mlxpm-0003ZL-9M; Sat, 13 Nov 2021 18:33:02 +0000
Received: by outflank-mailman (input) for mailman id 225549;
 Sat, 13 Nov 2021 18:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlxpl-0003ZF-M5
 for xen-changelog@lists.xenproject.org; Sat, 13 Nov 2021 18: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 1mlxpl-0000Rn-L8
 for xen-changelog@lists.xenproject.org; Sat, 13 Nov 2021 18:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlxpl-0000SG-Jy
 for xen-changelog@lists.xenproject.org; Sat, 13 Nov 2021 18:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=g9v0vZ8zxRI4g1w7AsVhDTI7+jgLjZwBqHoITm9+vqw=; b=nGNVtYIadHsmI0lrvlt3AAzDqA
	xSxGcOdxrtuy9EaPiOMWTEuYgQLFQywvI/GlaV7bwOldjQHpCbba9MoTCUp9R9+s6A88gIpx9udLt
	MS/g5p1jNNzLBQy8Hx2yx5pFGKR3URIXymhPByhHQ1M6KTcyhmvSjf+0abL43DJsQE10=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: per-domain IOMMU bitmap needs to have dynamic size
Message-Id: <E1mlxpl-0000SG-Jy@xenbits.xenproject.org>
Date: Sat, 13 Nov 2021 18:33:01 +0000

commit c06e3d81031424a8a0f725198c16ad81007be89c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 12 13:56:51 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 12 13:56:51 2021 +0100

    VT-d: per-domain IOMMU bitmap needs to have dynamic size
    
    With no upper bound (anymore) on the number of IOMMUs, a fixed-size
    64-bit map may be insufficient (systems with 40 IOMMUs have already been
    observed).
    
    Fixes: 27713fa2aa21 ("VT-d: improve save/restore of registers across S3")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/drivers/passthrough/vtd/iommu.c | 15 +++++++++++----
 xen/include/asm-x86/iommu.h         |  2 +-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 0e7e111286..7b8337017a 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -54,7 +54,7 @@ bool __read_mostly iommu_qinval = true;
 bool __read_mostly iommu_snoop = true;
 #endif
 
-static unsigned int __initdata nr_iommus;
+static unsigned int __read_mostly nr_iommus;
 
 static struct iommu_ops vtd_ops;
 static struct tasklet vtd_fault_tasklet;
@@ -645,7 +645,7 @@ static int __must_check iommu_flush_iotlb(struct domain *d, dfn_t dfn,
 
         iommu = drhd->iommu;
 
-        if ( !test_bit(iommu->index, &hd->arch.vtd.iommu_bitmap) )
+        if ( !test_bit(iommu->index, hd->arch.vtd.iommu_bitmap) )
             continue;
 
         flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
@@ -1308,6 +1308,11 @@ static int intel_iommu_domain_init(struct domain *d)
 {
     struct domain_iommu *hd = dom_iommu(d);
 
+    hd->arch.vtd.iommu_bitmap = xzalloc_array(unsigned long,
+                                              BITS_TO_LONGS(nr_iommus));
+    if ( !hd->arch.vtd.iommu_bitmap )
+        return -ENOMEM;
+
     hd->arch.vtd.agaw = width_to_agaw(DEFAULT_DOMAIN_ADDRESS_WIDTH);
 
     return 0;
@@ -1457,7 +1462,7 @@ int domain_context_mapping_one(
     if ( rc > 0 )
         rc = 0;
 
-    set_bit(iommu->index, &hd->arch.vtd.iommu_bitmap);
+    set_bit(iommu->index, hd->arch.vtd.iommu_bitmap);
 
     unmap_vtd_domain_page(context_entries);
 
@@ -1789,7 +1794,7 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
 
     if ( !found )
     {
-        clear_bit(iommu->index, &dom_iommu(domain)->arch.vtd.iommu_bitmap);
+        clear_bit(iommu->index, dom_iommu(domain)->arch.vtd.iommu_bitmap);
         cleanup_domid_map(domain, iommu);
     }
 
@@ -1819,6 +1824,8 @@ static void iommu_domain_teardown(struct domain *d)
 
     for_each_drhd_unit ( drhd )
         cleanup_domid_map(d, drhd->iommu);
+
+    XFREE(hd->arch.vtd.iommu_bitmap);
 }
 
 static int __must_check intel_iommu_map_page(struct domain *d, dfn_t dfn,
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 8aff75e4ff..de46149b40 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -58,7 +58,7 @@ struct arch_iommu
         struct {
             uint64_t pgd_maddr; /* io page directory machine address */
             unsigned int agaw; /* adjusted guest address width, 0 is level 2 30-bit */
-            uint64_t iommu_bitmap; /* bitmap of iommu(s) that the domain uses */
+            unsigned long *iommu_bitmap; /* bitmap of iommu(s) that the domain uses */
         } vtd;
         /* AMD IOMMU */
         struct {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 13 18:33:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Nov 2021 18:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.225550.389521 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mlxpw-0003bL-Dp; Sat, 13 Nov 2021 18:33:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 225550.389521; Sat, 13 Nov 2021 18:33:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mlxpw-0003bD-At; Sat, 13 Nov 2021 18:33:12 +0000
Received: by outflank-mailman (input) for mailman id 225550;
 Sat, 13 Nov 2021 18:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlxpv-0003b1-PV
 for xen-changelog@lists.xenproject.org; Sat, 13 Nov 2021 18:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlxpv-0000Rr-Oi
 for xen-changelog@lists.xenproject.org; Sat, 13 Nov 2021 18:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlxpv-0000Sz-Ne
 for xen-changelog@lists.xenproject.org; Sat, 13 Nov 2021 18:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FYO0dAOgenK9Gzeae1zkyQd3x5nwuE75inGdIgMNces=; b=6VRMGD4vrgHIFChgweIhZ+Mt0V
	SY0V88or4WzHBU07rnuR9k8k+Sk9C63WAvG19NdxnfPY0lSzzqKiEcXQr++Wiod5j2MqdeeWIZXiu
	KGz8IeAvBOGYG6056PKLENnRhuP1zHwEUtJmAy+P2QGF4NIdzRA9vZPLmBgqWUgSqTOg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/cpuid: prevent shrinking migrated policies max leaves
Message-Id: <E1mlxpv-0000Sz-Ne@xenbits.xenproject.org>
Date: Sat, 13 Nov 2021 18:33:11 +0000

commit 81da2b544cbb003a5447c9b14d275746ad22ab37
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Nov 10 18:40:59 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Nov 12 13:57:04 2021 +0000

    x86/cpuid: prevent shrinking migrated policies max leaves
    
    CPUID policies from guest being migrated shouldn't have the maximum
    leaves shrink, as that would be a guest visible change. The hypervisor
    has no knowledge on whether a guest has been migrated or is build from
    scratch, and hence it must not blindly shrink the CPUID policy in
    recalculate_cpuid_policy. Remove the
    x86_cpuid_policy_shrink_max_leaves call from recalculate_cpuid_policy.
    Removing such call could be seen as a partial revert of 540d911c28.
    
    Instead let the toolstack shrink the policies for newly created
    guests, while keeping the previous values for guests that are migrated
    in. Note that guests migrated in without a CPUID policy won't get any
    kind of shrinking applied.
    
    Fixes: 540d911c28 ('x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents')
    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>
---
 tools/libs/guest/xg_cpuid_x86.c | 7 +++++++
 xen/arch/x86/cpuid.c            | 2 --
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 198892ebdf..3ffd5f683b 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -638,6 +638,13 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
         }
     }
 
+    /*
+     * Do not try to shrink the policy if restoring, as that could cause
+     * guest visible changes in the maximum leaf fields.
+     */
+    if ( !restore )
+        x86_cpuid_policy_shrink_max_leaves(p);
+
     rc = x86_cpuid_copy_to_buffer(p, leaves, &nr_leaves);
     if ( rc )
     {
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 2079a30ae4..8ac55f0806 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -719,8 +719,6 @@ void recalculate_cpuid_policy(struct domain *d)
 
     if ( !p->extd.page1gb )
         p->extd.raw[0x19] = EMPTY_LEAF;
-
-    x86_cpuid_policy_shrink_max_leaves(p);
 }
 
 int init_domain_cpuid_policy(struct domain *d)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 13 18:33:22 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 13 Nov 2021 18:33:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.225551.389525 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mlxq6-0003fF-FJ; Sat, 13 Nov 2021 18:33:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 225551.389525; Sat, 13 Nov 2021 18:33:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mlxq6-0003f7-CO; Sat, 13 Nov 2021 18:33:22 +0000
Received: by outflank-mailman (input) for mailman id 225551;
 Sat, 13 Nov 2021 18:33:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlxq5-0003ex-Sc
 for xen-changelog@lists.xenproject.org; Sat, 13 Nov 2021 18:33:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlxq5-0000SP-Rm
 for xen-changelog@lists.xenproject.org; Sat, 13 Nov 2021 18:33:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mlxq5-0000Tk-Qo
 for xen-changelog@lists.xenproject.org; Sat, 13 Nov 2021 18:33:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4vi+jjoMcP+P/bC5rnCU1ChMItC3T9cnvIKGw33EbPk=; b=yiWtn9D0dWQeh6IxTwPDVC1O4M
	igH7t4eRkrlMItFfcRuEIp1UvsXzGnXyP2DpP5fELxZmllqghLp06KD74B5iuo6Qkf90QdGmoNtpa
	r0Eyss8Gs6Fy7nXvuADTlTWVJzuEMFJtiGQ2t3kCt86CQOC9/hF5rEZreq6ZUpmTCiVA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tests/resource: Extend to check that the grant frames are mapped correctly
Message-Id: <E1mlxq5-0000Tk-Qo@xenbits.xenproject.org>
Date: Sat, 13 Nov 2021 18:33:21 +0000

commit c7a7f14b92991e7d79735bff95f04676b9af34c6
Author:     Jane Malalane <jane.malalane@citrix.com>
AuthorDate: Fri Nov 12 14:48:21 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Nov 12 19:49:36 2021 +0000

    tests/resource: Extend to check that the grant frames are mapped correctly
    
    Previously, we checked that we could map 40 pages with nothing
    complaining. Now we're adding extra logic to check that those 40
    frames are "correct".
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jane Malalane <jane.malalane@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/tests/resource/Makefile        |  2 +
 tools/tests/resource/test-resource.c | 87 +++++++++++++++++++++++++++++++++---
 2 files changed, 83 insertions(+), 6 deletions(-)

diff --git a/tools/tests/resource/Makefile b/tools/tests/resource/Makefile
index 1c3aee4ff7..b3cd70c06d 100644
--- a/tools/tests/resource/Makefile
+++ b/tools/tests/resource/Makefile
@@ -31,10 +31,12 @@ CFLAGS += -Werror
 CFLAGS += $(CFLAGS_xeninclude)
 CFLAGS += $(CFLAGS_libxenctrl)
 CFLAGS += $(CFLAGS_libxenforeginmemory)
+CFLAGS += $(CFLAGS_libxengnttab)
 CFLAGS += $(APPEND_CFLAGS)
 
 LDFLAGS += $(LDLIBS_libxenctrl)
 LDFLAGS += $(LDLIBS_libxenforeignmemory)
+LDFLAGS += $(LDLIBS_libxengnttab)
 LDFLAGS += $(APPEND_LDFLAGS)
 
 %.o: Makefile
diff --git a/tools/tests/resource/test-resource.c b/tools/tests/resource/test-resource.c
index 1caaa60e62..988f96f7c1 100644
--- a/tools/tests/resource/test-resource.c
+++ b/tools/tests/resource/test-resource.c
@@ -6,6 +6,7 @@
 
 #include <xenctrl.h>
 #include <xenforeignmemory.h>
+#include <xengnttab.h>
 #include <xen-tools/libs.h>
 
 static unsigned int nr_failures;
@@ -17,13 +18,17 @@ static unsigned int nr_failures;
 
 static xc_interface *xch;
 static xenforeignmemory_handle *fh;
+static xengnttab_handle *gh;
 
-static void test_gnttab(uint32_t domid, unsigned int nr_frames)
+static void test_gnttab(uint32_t domid, unsigned int nr_frames,
+                        unsigned long gfn)
 {
     xenforeignmemory_resource_handle *res;
-    void *addr = NULL;
+    grant_entry_v1_t *gnttab;
     size_t size;
     int rc;
+    uint32_t refs[nr_frames], domids[nr_frames];
+    void *grants;
 
     printf("  Test grant table\n");
 
@@ -51,18 +56,56 @@ static void test_gnttab(uint32_t domid, unsigned int nr_frames)
     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);
+        (void **)&gnttab, 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));
+        return fail("    Fail: Map grant table %d - %s\n",
+                    errno, strerror(errno));
 
+    /* Put each gref at a unique offset in its frame. */
+    for ( unsigned int i = 0; i < nr_frames; i++ )
+    {
+        unsigned int gref = i * (XC_PAGE_SIZE / sizeof(*gnttab)) + i;
+
+        refs[i] = gref;
+        domids[i] = domid;
+
+        gnttab[gref].domid = 0;
+        gnttab[gref].frame = gfn;
+        gnttab[gref].flags = GTF_permit_access;
+    }
+
+    /* Map grants. */
+    grants = xengnttab_map_grant_refs(gh, nr_frames, domids, refs,
+                                      PROT_READ | PROT_WRITE);
+
+    /*
+     * Failure here indicates either that the frames were not mapped
+     * in the correct order or xenforeignmemory_map_resource() didn't
+     * give us the frames we asked for to begin with.
+     */
+    if ( grants == NULL )
+    {
+        fail("    Fail: Map grants %d - %s\n", errno, strerror(errno));
+        goto out;
+    }
+
+    /* Unmap grants. */
+    rc = xengnttab_unmap(gh, grants, nr_frames);
+
+    if ( rc )
+        fail("    Fail: Unmap grants %d - %s\n", errno, strerror(errno));
+
+    /* Unmap grant table. */
+ out:
     rc = xenforeignmemory_unmap_resource(fh, res);
     if ( rc )
-        return fail("    Fail: Unmap %d - %s\n", errno, strerror(errno));
+        return fail("    Fail: Unmap grant table %d - %s\n",
+                    errno, strerror(errno));
 }
 
 static void test_domain_configurations(void)
@@ -107,6 +150,7 @@ static void test_domain_configurations(void)
         struct test *t = &tests[i];
         uint32_t domid = 0;
         int rc;
+        xen_pfn_t ram[1] = { 0 };
 
         printf("Test %s\n", t->name);
 
@@ -123,8 +167,26 @@ static void test_domain_configurations(void)
 
         printf("  Created d%u\n", domid);
 
-        test_gnttab(domid, t->create.max_grant_frames);
+        rc = xc_domain_setmaxmem(xch, domid, -1);
+        if ( rc )
+        {
+            fail("  Failed to set max memory for domain: %d - %s\n",
+                 errno, strerror(errno));
+            goto test_done;
+        }
+
+        rc = xc_domain_populate_physmap_exact(
+            xch, domid, ARRAY_SIZE(ram), 0, 0, ram);
+        if ( rc )
+        {
+            fail("  Failed to populate physmap domain: %d - %s\n",
+                 errno, strerror(errno));
+            goto test_done;
+        }
+
+        test_gnttab(domid, t->create.max_grant_frames, ram[0]);
 
+    test_done:
         rc = xc_domain_destroy(xch, domid);
         if ( rc )
             fail("  Failed to destroy domain: %d - %s\n",
@@ -138,13 +200,26 @@ int main(int argc, char **argv)
 
     xch = xc_interface_open(NULL, NULL, 0);
     fh = xenforeignmemory_open(NULL, 0);
+    gh = xengnttab_open(NULL, 0);
 
     if ( !xch )
         err(1, "xc_interface_open");
     if ( !fh )
         err(1, "xenforeignmemory_open");
+    if ( !gh )
+        err(1, "xengnttab_open");
 
     test_domain_configurations();
 
     return !!nr_failures;
 }
+
+/*
+ * 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 Tue Nov 16 16:44:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 16 Nov 2021 16:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.226452.391367 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mn1Yz-0006JX-Ph; Tue, 16 Nov 2021 16:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 226452.391367; Tue, 16 Nov 2021 16:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mn1Yz-0006JO-Mc; Tue, 16 Nov 2021 16:44:05 +0000
Received: by outflank-mailman (input) for mailman id 226452;
 Tue, 16 Nov 2021 16: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 1mn1Yy-0006JI-JF
 for xen-changelog@lists.xenproject.org; Tue, 16 Nov 2021 16: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 1mn1Yy-0008JA-Ci
 for xen-changelog@lists.xenproject.org; Tue, 16 Nov 2021 16:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mn1Yy-0001Rw-B6
 for xen-changelog@lists.xenproject.org; Tue, 16 Nov 2021 16: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=PrsUdc6ikroRGkiYI2G6ltzD08oc2S0DXe7p2RgppkE=; b=dZXXK+fNAEHCH3Al/n+IQ6U+5m
	/jUINksdu7Ra2d+zS7ddyueoeKS9rQkKerDKiSAiMZrQztW58ZO65Tr1J4Yt3SkIQpG1QSTpRwVBg
	XfK/TqGp5chOM1WDrFxZjll1ZXY0lZF8vjq16nDzr+SkdJwxedEIOQQv6cLXuna4eWDs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] public/gnttab: relax v2 recommendation
Message-Id: <E1mn1Yy-0001Rw-B6@xenbits.xenproject.org>
Date: Tue, 16 Nov 2021 16:44:04 +0000

commit 2d72d2784eb71d8532bfbd6462d261739c9e82e4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 16 17:34:06 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 16 17:34:06 2021 +0100

    public/gnttab: relax v2 recommendation
    
    With there being a way to disable v2 support, telling new guests to use
    v2 exclusively is not a good suggestion.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/include/public/grant_table.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/include/public/grant_table.h b/xen/include/public/grant_table.h
index 4dceed20bb..7934d7b718 100644
--- a/xen/include/public/grant_table.h
+++ b/xen/include/public/grant_table.h
@@ -121,8 +121,9 @@ typedef uint32_t grant_ref_t;
  */
 
 /*
- * Version 1 of the grant table entry structure is maintained purely
- * for backwards compatibility.  New guests should use version 2.
+ * Version 1 of the grant table entry structure is maintained largely for
+ * backwards compatibility.  New guests are recommended to support using
+ * version 2 to overcome version 1 limitations, but to default to version 1.
  */
 #if __XEN_INTERFACE_VERSION__ < 0x0003020a
 #define grant_entry_v1 grant_entry
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 17 07:22:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Nov 2021 07:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.226607.391628 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnFGg-0007Dd-1Q; Wed, 17 Nov 2021 07:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 226607.391628; Wed, 17 Nov 2021 07: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 1mnFGf-0007DV-Ug; Wed, 17 Nov 2021 07:22:05 +0000
Received: by outflank-mailman (input) for mailman id 226607;
 Wed, 17 Nov 2021 07: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 1mnFGe-0007DP-Ax
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 07: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 1mnFGe-0000vH-9A
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 07:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnFGe-00056Y-7R
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 07: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=O5Y439WdFbFOav8GULo7cOpjtYSMI+duIHydB1tSoB8=; b=s2H0qgmc5m8W+rKwnGroahS4CO
	L+eianiuaYcG9HyypkOrLT2ZSvRctbwwuZtxMK5RqKqAqdI2ZtZIaXTbcVEtwjPWspGFaSwSEQ54b
	2RLJcUwCskuYsqo8dAsc+No/R7WincLUmStid5X6GAL8VJQlT+hYHqSQBbUH+YuLjiXg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] domctl: introduce a macro to set the grant table max version
Message-Id: <E1mnFGe-00056Y-7R@xenbits.xenproject.org>
Date: Wed, 17 Nov 2021 07:22:04 +0000

commit 2abeaf319c59d3446e03264e25987200eb4217ca
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Nov 17 08:12:00 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 17 08:12:00 2021 +0100

    domctl: introduce a macro to set the grant table max version
    
    Such macro just clamps the passed version to fit in the designated
    bits of the domctl field. The main purpose is to make it clearer in
    the code when max grant version is being set in the grant_opts field.
    
    Existing users that where setting the version in the grant_opts field
    are switched to use the macro.
    
    No functional change intended.
    
    Requested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/helpers/init-xenstore-domain.c | 2 +-
 tools/libs/light/libxl_create.c      | 2 +-
 tools/ocaml/libs/xc/xenctrl_stubs.c  | 3 ++-
 xen/arch/arm/domain_build.c          | 4 ++--
 xen/arch/x86/setup.c                 | 2 +-
 xen/include/public/domctl.h          | 1 +
 6 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xenstore-domain.c
index 60469161bd..b205a79ee6 100644
--- a/tools/helpers/init-xenstore-domain.c
+++ b/tools/helpers/init-xenstore-domain.c
@@ -89,7 +89,7 @@ static int build(xc_interface *xch)
          */
         .max_grant_frames = 4,
         .max_maptrack_frames = 128,
-        .grant_opts = 1,
+        .grant_opts = XEN_DOMCTL_GRANT_version(1),
     };
 
     xs_fd = open("/dev/xen/xenbus_backend", O_RDWR);
diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index b6855c7b46..dcd09d32ba 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -629,7 +629,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,
-            .grant_opts = b_info->max_grant_version,
+            .grant_opts = XEN_DOMCTL_GRANT_version(b_info->max_grant_version),
             .vmtrace_size = ROUNDUP(b_info->vmtrace_buf_kb << 10, XC_PAGE_SHIFT),
         };
 
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index eca0b8b334..5b4fe72c8d 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -199,7 +199,8 @@ CAMLprim value stub_xc_domain_create(value xch, value wanted_domid, value config
 		.max_evtchn_port = Int_val(VAL_MAX_EVTCHN_PORT),
 		.max_grant_frames = Int_val(VAL_MAX_GRANT_FRAMES),
 		.max_maptrack_frames = Int_val(VAL_MAX_MAPTRACK_FRAMES),
-		.grant_opts = Int_val(VAL_MAX_GRANT_VERSION),
+		.grant_opts =
+		    XEN_DOMCTL_GRANT_version(Int_val(VAL_MAX_GRANT_VERSION)),
 	};
 
 	domain_handle_of_uuid_string(cfg.handle, String_val(VAL_HANDLE));
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 19487c79da..d02bacbcd1 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2986,7 +2986,7 @@ void __init create_domUs(void)
             .max_evtchn_port = -1,
             .max_grant_frames = -1,
             .max_maptrack_frames = -1,
-            .grant_opts = opt_gnttab_max_version,
+            .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version),
         };
 
         if ( !dt_device_is_compatible(node, "xen,domain") )
@@ -3094,7 +3094,7 @@ void __init create_dom0(void)
         .max_evtchn_port = -1,
         .max_grant_frames = gnttab_dom0_frames(),
         .max_maptrack_frames = -1,
-        .grant_opts = opt_gnttab_max_version,
+        .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version),
     };
 
     /* The vGIC for DOM0 is exactly emulating the hardware GIC */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index ec6e686fac..da47cdea14 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -755,7 +755,7 @@ static struct domain *__init create_dom0(const module_t *image,
         .max_evtchn_port = -1,
         .max_grant_frames = -1,
         .max_maptrack_frames = -1,
-        .grant_opts = opt_gnttab_max_version,
+        .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version),
         .max_vcpus = dom0_max_vcpus(),
         .arch = {
             .misc_flags = opt_dom0_msr_relaxed ? XEN_X86_MSR_RELAXED : 0,
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 1c21d4dc75..b85e6170b0 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -99,6 +99,7 @@ struct xen_domctl_createdomain {
 
 /* Grant version, use low 4 bits. */
 #define XEN_DOMCTL_GRANT_version_mask    0xf
+#define XEN_DOMCTL_GRANT_version(v)      ((v) & XEN_DOMCTL_GRANT_version_mask)
 
     uint32_t grant_opts;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 17 07:22:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Nov 2021 07:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.226608.391632 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnFGq-0007Fl-37; Wed, 17 Nov 2021 07:22:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 226608.391632; Wed, 17 Nov 2021 07: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 1mnFGq-0007Fd-04; Wed, 17 Nov 2021 07:22:16 +0000
Received: by outflank-mailman (input) for mailman id 226608;
 Wed, 17 Nov 2021 07: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 1mnFGo-0007FV-Fd
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 07: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 1mnFGo-0000vb-Ep
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 07:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnFGo-00057h-BV
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 07: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=/cwE9JGngTY5FGcqXceHUl6BKw0wslBiVxKqMbJy8tM=; b=1aBig+OTIEUeuDBgOujOhPL0eB
	wWON73NfotdMJtcQ6O8elX2gM/YSSdMMWDeCnoNeNaTTjIoroI31geN3elhuVzEbAnSGMCUp02O7C
	5lB7j1MHBtpBiS5oZCfF3E/aHkL9wH7b7Pox2+B5PYz+fDzxGt383ANsaLHRceELtnYA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tests/resource: set grant version for created domains
Message-Id: <E1mnFGo-00057h-BV@xenbits.xenproject.org>
Date: Wed, 17 Nov 2021 07:22:14 +0000

commit 810fbc03ff51275d9603b9896c9085d645733ed8
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Nov 17 08:13:02 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 17 08:13:02 2021 +0100

    tests/resource: set grant version for created domains
    
    Set the grant table version for the created domains to use version 1,
    as that's the used by the test cases. Without setting the grant
    version the domains for the tests cannot be created.
    
    Fixes: 7379f9e10a ('gnttab: allow setting max version per-domain')
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/tests/resource/test-resource.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/tests/resource/test-resource.c b/tools/tests/resource/test-resource.c
index 988f96f7c1..0557f8a1b5 100644
--- a/tools/tests/resource/test-resource.c
+++ b/tools/tests/resource/test-resource.c
@@ -120,6 +120,7 @@ static void test_domain_configurations(void)
             .create = {
                 .max_vcpus = 2,
                 .max_grant_frames = 40,
+                .grant_opts = XEN_DOMCTL_GRANT_version(1),
             },
         },
         {
@@ -128,6 +129,7 @@ static void test_domain_configurations(void)
                 .flags = XEN_DOMCTL_CDF_hvm,
                 .max_vcpus = 2,
                 .max_grant_frames = 40,
+                .grant_opts = XEN_DOMCTL_GRANT_version(1),
                 .arch = {
                     .emulation_flags = XEN_X86_EMU_LAPIC,
                 },
@@ -140,6 +142,7 @@ static void test_domain_configurations(void)
                 .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap,
                 .max_vcpus = 2,
                 .max_grant_frames = 40,
+                .grant_opts = XEN_DOMCTL_GRANT_version(1),
             },
         },
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 17 07:22:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Nov 2021 07:22:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.226609.391635 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnFH0-0007JD-4P; Wed, 17 Nov 2021 07:22:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 226609.391635; Wed, 17 Nov 2021 07: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 1mnFH0-0007J5-1Y; Wed, 17 Nov 2021 07:22:26 +0000
Received: by outflank-mailman (input) for mailman id 226609;
 Wed, 17 Nov 2021 07: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 1mnFGy-0007Ik-Ir
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 07: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 1mnFGy-0000vv-I5
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 07:22:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnFGy-00058X-H2
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 07: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=LCvag1L9DZdBNrHjeuQXWAKe4xeahE8JiHb45+dDU1k=; b=MGeo2vqYSN/+af70nj+TuoB9YI
	e+T6tLS7o9fZ2+MaFjUnHCjw0QRXAOa0i8xRkE/Z0p1c9OGiRUAZvkX+OhODlGG7EdbQX8jv1tlIt
	vCvGAdvSt01bjd7BAySMjt8QTwUlGEIC4TfxyV9oyys3uI+AJ0i1T6DNqaO+ciaRI/WA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] test/tsx: set grant version for created domains
Message-Id: <E1mnFGy-00058X-H2@xenbits.xenproject.org>
Date: Wed, 17 Nov 2021 07:22:24 +0000

commit 306e0afbb382ec10081ab277c866e9e7c212dda5
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Nov 17 08:13:18 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 17 08:13:18 2021 +0100

    test/tsx: set grant version for created domains
    
    Set the grant table version for the created domains to use version 1,
    as such tests domains don't require the usage of the grant table at
    all. A TODO note is added to switch those dummy domains to not have a
    grant table at all when possible. Without setting the grant version
    the domains for the tests cannot be created.
    
    Fixes: 7379f9e10a ('gnttab: allow setting max version per-domain')
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reported-by: Jan Beulich <jbeulich@suse.com>
    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>
---
 tools/tests/tsx/test-tsx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/tests/tsx/test-tsx.c b/tools/tests/tsx/test-tsx.c
index fab99c135e..a3d987b6d2 100644
--- a/tools/tests/tsx/test-tsx.c
+++ b/tools/tests/tsx/test-tsx.c
@@ -444,6 +444,7 @@ static void test_guests(void)
         struct xen_domctl_createdomain c = {
             .max_vcpus = 1,
             .max_grant_frames = 1,
+            .grant_opts = XEN_DOMCTL_GRANT_version(1),
         };
 
         printf("Testing PV guest\n");
@@ -456,6 +457,7 @@ static void test_guests(void)
             .flags = XEN_DOMCTL_CDF_hvm,
             .max_vcpus = 1,
             .max_grant_frames = 1,
+            .grant_opts = XEN_DOMCTL_GRANT_version(1),
             .arch = {
                 .emulation_flags = XEN_X86_EMU_LAPIC,
             },
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 17 11:44:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Nov 2021 11:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.226790.392045 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnJME-0001Ws-9L; Wed, 17 Nov 2021 11:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 226790.392045; Wed, 17 Nov 2021 11: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 1mnJME-0001Wk-6Q; Wed, 17 Nov 2021 11:44:06 +0000
Received: by outflank-mailman (input) for mailman id 226790;
 Wed, 17 Nov 2021 11: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 1mnJMC-0001We-Ra
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 11: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 1mnJMC-0007PU-Oz
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 11:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnJMC-0003Pu-NS
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 11: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=Rp8VeVXTLPIXOuMXPsYwlMp7MnAuKiU3OFoSpI7pzuo=; b=sEQpZgCu4Xlss+q4Q5IDiWaekk
	/a6tgbM+LhQpBY3xiX8YzdFCHxfvR3zshKun2TsvHRA0B8KynoRXP+JI5jRArLVEvBmtoUyrJtn+W
	oNovMEY8cYa5NisCGPs6zydTlJKRBEkmEp48VHGmZfubGxVvc/XzfNQGNuLk45+0xr1E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG: set Xen 4.15 release date
Message-Id: <E1mnJMC-0003Pu-NS@xenbits.xenproject.org>
Date: Wed, 17 Nov 2021 11:44:04 +0000

commit 27ece0dd522278e074acc264dd95d734beb64d0f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Nov 17 12:35:26 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 17 12:35:26 2021 +0100

    CHANGELOG: set Xen 4.15 release date
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 CHANGELOG.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e5ab49e779..ad1a8c2bc2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,7 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    no longer be built per default. In order to be able to use those, configure needs to
    be called with "--enable-qemu-traditional" as parameter.
 
-## [4.15.0 UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - TBD
+## [4.15.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - 2021-04-08
 
 ### Added / support upgraded
  - ARM IOREQ servers (device emulation etc.) (Tech Preview)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 17 11:44:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Nov 2021 11:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.226791.392049 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnJMO-0001Z9-At; Wed, 17 Nov 2021 11:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 226791.392049; Wed, 17 Nov 2021 11: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 1mnJMO-0001Yz-7v; Wed, 17 Nov 2021 11:44:16 +0000
Received: by outflank-mailman (input) for mailman id 226791;
 Wed, 17 Nov 2021 11: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 1mnJMM-0001Yo-Sx
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 11: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 1mnJMM-0007Pv-SB
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 11:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnJMM-0003Qc-RF
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 11: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=/BjSgo+ovL1bj5vHoX8kBqllkrmC+B1nKSGukafqTHk=; b=s9LxWbqZtE8ow82+KcJmkOAmqp
	aaswfdJ8hIhQvzWYawBo/G+DNaChW6f5MX5pcLD1qlkjAQl7auQlin7z8HebU9TIOkka9W/bEeUeE
	xUup6Acccte7n6OhADA39zT1r+Rz23I+bHqsM55hgntlHMZwN3cys3dsfn5/DFkqivYg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/python: fix python libxc bindings to pass a max grant version
Message-Id: <E1mnJMM-0003Qc-RF@xenbits.xenproject.org>
Date: Wed, 17 Nov 2021 11:44:14 +0000

commit 1cffc48f1e1f972daeec579c62de4bb24f3152fa
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Nov 17 12:43:05 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 17 12:43:05 2021 +0100

    tools/python: fix python libxc bindings to pass a max grant version
    
    Such max version should be provided by the caller, otherwise the
    bindings will default to specifying a max version of 2, which is
    inline with the current defaults in the hypervisor.
    
    Fixes: 7379f9e10a ('gnttab: allow setting max version per-domain')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <iwj@xenproject.org>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/python/xen/lowlevel/xc/xc.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 6293d205a3..fd00861032 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -116,7 +116,7 @@ static PyObject *pyxc_domain_create(XcObject *self,
                                     PyObject *args,
                                     PyObject *kwds)
 {
-    uint32_t dom = 0, target = 0;
+    uint32_t dom = 0, target = 0, max_grant_version = 2;
     int      ret;
     size_t   i;
     PyObject *pyhandle = NULL;
@@ -132,12 +132,13 @@ static PyObject *pyxc_domain_create(XcObject *self,
     };
 
     static char *kwd_list[] = { "domid", "ssidref", "handle", "flags",
-                                "target", "max_vcpus", NULL };
+                                "target", "max_vcpus", "max_grant_version",
+                                NULL };
 
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOiii", kwd_list,
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOiiii", kwd_list,
                                       &dom, &config.ssidref, &pyhandle,
                                       &config.flags, &target,
-                                      &config.max_vcpus) )
+                                      &config.max_vcpus, &max_grant_version) )
         return NULL;
     if ( pyhandle != NULL )
     {
@@ -162,6 +163,7 @@ static PyObject *pyxc_domain_create(XcObject *self,
 #else
 #error Architecture not supported
 #endif
+    config.grant_opts = XEN_DOMCTL_GRANT_version(max_grant_version);
 
     if ( (ret = xc_domain_create(self->xc_handle, &dom, &config)) < 0 )
         return pyxc_error_to_exception(self->xc_handle);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 17 11:44:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Nov 2021 11:44:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.226792.392052 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnJMZ-0001cW-CX; Wed, 17 Nov 2021 11:44:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 226792.392052; Wed, 17 Nov 2021 11:44:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnJMZ-0001cO-9P; Wed, 17 Nov 2021 11:44:27 +0000
Received: by outflank-mailman (input) for mailman id 226792;
 Wed, 17 Nov 2021 11:44:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnJMX-0001c0-5c
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 11: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 1mnJMX-0007QI-4o
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 11:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnJMX-0003Rb-3j
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 11:44:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gPkIw68QFOTLHQWwHsGq9HYw40ZO7BAh6Sb2z38bbrQ=; b=B/bpuEr1SSG9PWXicJIFf624Cn
	06zK0EoPHMDLAKHstQwuJ3hV0eW9NlswipEfw5SDYSa3FhkxJkhoR/+pqSl4ALvXG1gRgq7WCKo1J
	QSStqisREQoFs/b3VN4IHxOSJmXPmXj2m8GVjQbnQM2SP119kIvpC9fZRTLbvp6wvNis=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] CHANGELOG: set Xen 4.15 release date
Message-Id: <E1mnJMX-0003Rb-3j@xenbits.xenproject.org>
Date: Wed, 17 Nov 2021 11:44:25 +0000

commit f90cea9c556b7e67b3527e39f9732fb4af2fc11a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Nov 17 12:38:53 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 17 12:38:53 2021 +0100

    CHANGELOG: set Xen 4.15 release date
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 CHANGELOG.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a9589aacc9..b41e2d14a1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ Notable changes to Xen will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
-## [4.15.0 UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - TBD
+## [4.15.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - 2021-04-08
 
 ### Added / support upgraded
  - ARM IOREQ servers (device emulation etc.) (Tech Preview)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Nov 17 14:00:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 17 Nov 2021 14:00:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.226870.392207 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnLTo-0004Hy-08; Wed, 17 Nov 2021 14:00:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 226870.392207; Wed, 17 Nov 2021 14: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 1mnLTn-0004Ha-SY; Wed, 17 Nov 2021 14:00:03 +0000
Received: by outflank-mailman (input) for mailman id 226870;
 Wed, 17 Nov 2021 14: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 1mnLTm-00042b-1b
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 14: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 1mnLTm-0001RJ-0i
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 14:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnLTl-0004bO-Vr
 for xen-changelog@lists.xenproject.org; Wed, 17 Nov 2021 14:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lDammJ98qonuMeatUkBKWBzGamcgjOoax518NyAdU0o=; b=oafgDiVDoNYyEfHjWqiihJCUnb
	hFkj2YSgHtbtgQq8+poh5Y5Z7cBomVuBG2VuOKa/tCKWqTL3vUg8tqRGeMNXrkakNkCtZM64NVv9R
	TCH38lJ0mLHC5z2DV6V5Z7jRNpto+gyALlP76K2L3CRN8p+5w2/rc8TttEg93ZPyGbow=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] public/gnttab: relax v2 recommendation
Message-Id: <E1mnLTl-0004bO-Vr@xenbits.xenproject.org>
Date: Wed, 17 Nov 2021 14:00:01 +0000

commit 2d72d2784eb71d8532bfbd6462d261739c9e82e4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 16 17:34:06 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 16 17:34:06 2021 +0100

    public/gnttab: relax v2 recommendation
    
    With there being a way to disable v2 support, telling new guests to use
    v2 exclusively is not a good suggestion.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/include/public/grant_table.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/include/public/grant_table.h b/xen/include/public/grant_table.h
index 4dceed20bb..7934d7b718 100644
--- a/xen/include/public/grant_table.h
+++ b/xen/include/public/grant_table.h
@@ -121,8 +121,9 @@ typedef uint32_t grant_ref_t;
  */
 
 /*
- * Version 1 of the grant table entry structure is maintained purely
- * for backwards compatibility.  New guests should use version 2.
+ * Version 1 of the grant table entry structure is maintained largely for
+ * backwards compatibility.  New guests are recommended to support using
+ * version 2 to overcome version 1 limitations, but to default to version 1.
  */
 #if __XEN_INTERFACE_VERSION__ < 0x0003020a
 #define grant_entry_v1 grant_entry
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 18 06:11:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Nov 2021 06:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227115.392723 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnadS-0000My-Vo; Thu, 18 Nov 2021 06:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227115.392723; Thu, 18 Nov 2021 06:11:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnadS-0000Mo-SN; Thu, 18 Nov 2021 06:11:02 +0000
Received: by outflank-mailman (input) for mailman id 227115;
 Thu, 18 Nov 2021 06:11:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnadR-0000Mi-H9
 for xen-changelog@lists.xenproject.org; Thu, 18 Nov 2021 06:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnadR-0004PD-Ex
 for xen-changelog@lists.xenproject.org; Thu, 18 Nov 2021 06:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnadR-00062F-Dv
 for xen-changelog@lists.xenproject.org; Thu, 18 Nov 2021 06:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lKZNaTY0pChk1aLAa25jvOOOjWP+SaimBLelY5Iyajg=; b=rwBipaYoJrrnmgfOyvzcNxRxHo
	kz9ZNJWmpx8LVUFalz41/srQ/SfvaL23cIa1A1JxmGLpYeVfArv3D8iPZQ78EVOOKbRYlqqrSNQub
	1e83QXiR6JXtxhT3d46cRxFya4bX2QX09RSwVhcg1KcN3rfSsKD4FK32O0gtMrhJYRXE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] CHANGELOG: set Xen 4.15 release date
Message-Id: <E1mnadR-00062F-Dv@xenbits.xenproject.org>
Date: Thu, 18 Nov 2021 06:11:01 +0000

commit f90cea9c556b7e67b3527e39f9732fb4af2fc11a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Nov 17 12:38:53 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 17 12:38:53 2021 +0100

    CHANGELOG: set Xen 4.15 release date
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 CHANGELOG.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a9589aacc9..b41e2d14a1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ Notable changes to Xen will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
-## [4.15.0 UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - TBD
+## [4.15.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - 2021-04-08
 
 ### Added / support upgraded
  - ARM IOREQ servers (device emulation etc.) (Tech Preview)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Thu Nov 18 09:33:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Nov 2021 09:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227254.393003 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mndmx-0007tG-Cv; Thu, 18 Nov 2021 09:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227254.393003; Thu, 18 Nov 2021 09:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mndmx-0007t8-9c; Thu, 18 Nov 2021 09:33:03 +0000
Received: by outflank-mailman (input) for mailman id 227254;
 Thu, 18 Nov 2021 09:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mndmv-0007sJ-Uq
 for xen-changelog@lists.xenproject.org; Thu, 18 Nov 2021 09:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mndmv-0008Qs-Rq
 for xen-changelog@lists.xenproject.org; Thu, 18 Nov 2021 09:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mndmv-0004NC-Qx
 for xen-changelog@lists.xenproject.org; Thu, 18 Nov 2021 09:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1yGkIRwHmOHlSFd3ffF20W/Zq1uupsfGPfrq+6OvAgs=; b=btmpwTZ1X20VgI97jGo3JY9iTj
	DUI8tvrN6JLlZWsuaYHU5Lkysi21h+dZ7Qkaz4mnpn9jf12rmFKXi340UrP8Po7QiWmZu1FtdlSES
	5RIRYjyw1zn1SLWeZ94aYeUB/BqYrbxwMbVRmcZG/goOU+4osbbYAcEsIp9Uyj/FB2N0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] domctl: introduce a macro to set the grant table max version
Message-Id: <E1mndmv-0004NC-Qx@xenbits.xenproject.org>
Date: Thu, 18 Nov 2021 09:33:01 +0000

commit 2abeaf319c59d3446e03264e25987200eb4217ca
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Nov 17 08:12:00 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 17 08:12:00 2021 +0100

    domctl: introduce a macro to set the grant table max version
    
    Such macro just clamps the passed version to fit in the designated
    bits of the domctl field. The main purpose is to make it clearer in
    the code when max grant version is being set in the grant_opts field.
    
    Existing users that where setting the version in the grant_opts field
    are switched to use the macro.
    
    No functional change intended.
    
    Requested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/helpers/init-xenstore-domain.c | 2 +-
 tools/libs/light/libxl_create.c      | 2 +-
 tools/ocaml/libs/xc/xenctrl_stubs.c  | 3 ++-
 xen/arch/arm/domain_build.c          | 4 ++--
 xen/arch/x86/setup.c                 | 2 +-
 xen/include/public/domctl.h          | 1 +
 6 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xenstore-domain.c
index 60469161bd..b205a79ee6 100644
--- a/tools/helpers/init-xenstore-domain.c
+++ b/tools/helpers/init-xenstore-domain.c
@@ -89,7 +89,7 @@ static int build(xc_interface *xch)
          */
         .max_grant_frames = 4,
         .max_maptrack_frames = 128,
-        .grant_opts = 1,
+        .grant_opts = XEN_DOMCTL_GRANT_version(1),
     };
 
     xs_fd = open("/dev/xen/xenbus_backend", O_RDWR);
diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index b6855c7b46..dcd09d32ba 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -629,7 +629,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,
-            .grant_opts = b_info->max_grant_version,
+            .grant_opts = XEN_DOMCTL_GRANT_version(b_info->max_grant_version),
             .vmtrace_size = ROUNDUP(b_info->vmtrace_buf_kb << 10, XC_PAGE_SHIFT),
         };
 
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index eca0b8b334..5b4fe72c8d 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -199,7 +199,8 @@ CAMLprim value stub_xc_domain_create(value xch, value wanted_domid, value config
 		.max_evtchn_port = Int_val(VAL_MAX_EVTCHN_PORT),
 		.max_grant_frames = Int_val(VAL_MAX_GRANT_FRAMES),
 		.max_maptrack_frames = Int_val(VAL_MAX_MAPTRACK_FRAMES),
-		.grant_opts = Int_val(VAL_MAX_GRANT_VERSION),
+		.grant_opts =
+		    XEN_DOMCTL_GRANT_version(Int_val(VAL_MAX_GRANT_VERSION)),
 	};
 
 	domain_handle_of_uuid_string(cfg.handle, String_val(VAL_HANDLE));
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 19487c79da..d02bacbcd1 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2986,7 +2986,7 @@ void __init create_domUs(void)
             .max_evtchn_port = -1,
             .max_grant_frames = -1,
             .max_maptrack_frames = -1,
-            .grant_opts = opt_gnttab_max_version,
+            .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version),
         };
 
         if ( !dt_device_is_compatible(node, "xen,domain") )
@@ -3094,7 +3094,7 @@ void __init create_dom0(void)
         .max_evtchn_port = -1,
         .max_grant_frames = gnttab_dom0_frames(),
         .max_maptrack_frames = -1,
-        .grant_opts = opt_gnttab_max_version,
+        .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version),
     };
 
     /* The vGIC for DOM0 is exactly emulating the hardware GIC */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index ec6e686fac..da47cdea14 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -755,7 +755,7 @@ static struct domain *__init create_dom0(const module_t *image,
         .max_evtchn_port = -1,
         .max_grant_frames = -1,
         .max_maptrack_frames = -1,
-        .grant_opts = opt_gnttab_max_version,
+        .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version),
         .max_vcpus = dom0_max_vcpus(),
         .arch = {
             .misc_flags = opt_dom0_msr_relaxed ? XEN_X86_MSR_RELAXED : 0,
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 1c21d4dc75..b85e6170b0 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -99,6 +99,7 @@ struct xen_domctl_createdomain {
 
 /* Grant version, use low 4 bits. */
 #define XEN_DOMCTL_GRANT_version_mask    0xf
+#define XEN_DOMCTL_GRANT_version(v)      ((v) & XEN_DOMCTL_GRANT_version_mask)
 
     uint32_t grant_opts;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 18 09:33:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Nov 2021 09:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227255.393009 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mndn7-0007zw-Ej; Thu, 18 Nov 2021 09:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227255.393009; Thu, 18 Nov 2021 09:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mndn7-0007zo-B2; Thu, 18 Nov 2021 09:33:13 +0000
Received: by outflank-mailman (input) for mailman id 227255;
 Thu, 18 Nov 2021 09:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mndn5-0007ym-Vn
 for xen-changelog@lists.xenproject.org; Thu, 18 Nov 2021 09:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mndn5-0008R6-Uz
 for xen-changelog@lists.xenproject.org; Thu, 18 Nov 2021 09:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mndn5-0004Nj-Ty
 for xen-changelog@lists.xenproject.org; Thu, 18 Nov 2021 09:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hOILg6XKRGKZP4cwc/4rJ3DzOjZoEgC4gH26WalTs6o=; b=mEP2SwyuwyFmsxpo6qc3gGzIvR
	I947f4HZj4K67uh77AgOqFs/21bKyAKFTUL8wMWK7jovIg9le3NkBgekT6FkQY28G+CL27fY3igfl
	ERsNTGwd0nvZfY3g5q2ZT/yryYpvcD6TW35BU5trL/BV2OAcNQBWR6imdXt4SgkMlN2Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tests/resource: set grant version for created domains
Message-Id: <E1mndn5-0004Nj-Ty@xenbits.xenproject.org>
Date: Thu, 18 Nov 2021 09:33:11 +0000

commit 810fbc03ff51275d9603b9896c9085d645733ed8
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Nov 17 08:13:02 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 17 08:13:02 2021 +0100

    tests/resource: set grant version for created domains
    
    Set the grant table version for the created domains to use version 1,
    as that's the used by the test cases. Without setting the grant
    version the domains for the tests cannot be created.
    
    Fixes: 7379f9e10a ('gnttab: allow setting max version per-domain')
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/tests/resource/test-resource.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/tests/resource/test-resource.c b/tools/tests/resource/test-resource.c
index 988f96f7c1..0557f8a1b5 100644
--- a/tools/tests/resource/test-resource.c
+++ b/tools/tests/resource/test-resource.c
@@ -120,6 +120,7 @@ static void test_domain_configurations(void)
             .create = {
                 .max_vcpus = 2,
                 .max_grant_frames = 40,
+                .grant_opts = XEN_DOMCTL_GRANT_version(1),
             },
         },
         {
@@ -128,6 +129,7 @@ static void test_domain_configurations(void)
                 .flags = XEN_DOMCTL_CDF_hvm,
                 .max_vcpus = 2,
                 .max_grant_frames = 40,
+                .grant_opts = XEN_DOMCTL_GRANT_version(1),
                 .arch = {
                     .emulation_flags = XEN_X86_EMU_LAPIC,
                 },
@@ -140,6 +142,7 @@ static void test_domain_configurations(void)
                 .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap,
                 .max_vcpus = 2,
                 .max_grant_frames = 40,
+                .grant_opts = XEN_DOMCTL_GRANT_version(1),
             },
         },
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Nov 18 09:33:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 18 Nov 2021 09:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227260.393011 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mndnH-0008Cn-Fd; Thu, 18 Nov 2021 09:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227260.393011; Thu, 18 Nov 2021 09:33:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mndnH-0008Cf-CS; Thu, 18 Nov 2021 09:33:23 +0000
Received: by outflank-mailman (input) for mailman id 227260;
 Thu, 18 Nov 2021 09:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mndnG-0008Ac-2i
 for xen-changelog@lists.xenproject.org; Thu, 18 Nov 2021 09:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mndnG-0008RN-1y
 for xen-changelog@lists.xenproject.org; Thu, 18 Nov 2021 09:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mndnG-0004OI-0m
 for xen-changelog@lists.xenproject.org; Thu, 18 Nov 2021 09:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=T5isVMZisl4ljHscwQM7j94wXmDQqMy8GV63z6nvdqs=; b=jPVsvCk3r9P3Fzbj4qt4IDggch
	z0/+GqRcFzETfHWfhvAbVUYmQjcOhicen4/5OmcGFENOQYygZQrOQwXFbvISbTOfUa+EPMBqyESDw
	Z1PcqsLyMRwUr2VieyNluYN+4sL738AWuxCuYNm1sWeKjY8BkMxaS/8EqvIZSuEOINyg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] test/tsx: set grant version for created domains
Message-Id: <E1mndnG-0004OI-0m@xenbits.xenproject.org>
Date: Thu, 18 Nov 2021 09:33:22 +0000

commit 306e0afbb382ec10081ab277c866e9e7c212dda5
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Nov 17 08:13:18 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 17 08:13:18 2021 +0100

    test/tsx: set grant version for created domains
    
    Set the grant table version for the created domains to use version 1,
    as such tests domains don't require the usage of the grant table at
    all. A TODO note is added to switch those dummy domains to not have a
    grant table at all when possible. Without setting the grant version
    the domains for the tests cannot be created.
    
    Fixes: 7379f9e10a ('gnttab: allow setting max version per-domain')
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reported-by: Jan Beulich <jbeulich@suse.com>
    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>
---
 tools/tests/tsx/test-tsx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/tests/tsx/test-tsx.c b/tools/tests/tsx/test-tsx.c
index fab99c135e..a3d987b6d2 100644
--- a/tools/tests/tsx/test-tsx.c
+++ b/tools/tests/tsx/test-tsx.c
@@ -444,6 +444,7 @@ static void test_guests(void)
         struct xen_domctl_createdomain c = {
             .max_vcpus = 1,
             .max_grant_frames = 1,
+            .grant_opts = XEN_DOMCTL_GRANT_version(1),
         };
 
         printf("Testing PV guest\n");
@@ -456,6 +457,7 @@ static void test_guests(void)
             .flags = XEN_DOMCTL_CDF_hvm,
             .max_vcpus = 1,
             .max_grant_frames = 1,
+            .grant_opts = XEN_DOMCTL_GRANT_version(1),
             .arch = {
                 .emulation_flags = XEN_X86_EMU_LAPIC,
             },
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 02:33:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 02:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227626.393729 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnti2-0003zH-MV; Fri, 19 Nov 2021 02:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227626.393729; Fri, 19 Nov 2021 02:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnti2-0003z9-JZ; Fri, 19 Nov 2021 02:33:02 +0000
Received: by outflank-mailman (input) for mailman id 227626;
 Fri, 19 Nov 2021 02:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnti1-0003z3-OX
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 02:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnti1-0003ks-KZ
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 02:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnti1-0002wy-Jg
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 02:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=d/wpzQkbCQb5tL8551PKTg5Ye4B7qHpb6JzNNZVjbKg=; b=qGloQi0W2Ww3wvVa7l3m8Zi4jj
	0p8ePHHEg3efHA2tldiidwWN8Tp+ftEhpHg8N9fLuUR1gWOAj4+deg7gypF26jId9kftgwIsYsQfa
	pCeae+2J59nmTrBmGTmMZB4MCTmTg6cdfzOvKVVPLO0DNdfAIQZkjdPZjVzOn8SjCdyQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG: set Xen 4.15 release date
Message-Id: <E1mnti1-0002wy-Jg@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 02:33:01 +0000

commit 27ece0dd522278e074acc264dd95d734beb64d0f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Nov 17 12:35:26 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 17 12:35:26 2021 +0100

    CHANGELOG: set Xen 4.15 release date
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 CHANGELOG.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e5ab49e779..ad1a8c2bc2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,7 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    no longer be built per default. In order to be able to use those, configure needs to
    be called with "--enable-qemu-traditional" as parameter.
 
-## [4.15.0 UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - TBD
+## [4.15.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - 2021-04-08
 
 ### Added / support upgraded
  - ARM IOREQ servers (device emulation etc.) (Tech Preview)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 02:33:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 02:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227627.393733 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mntiC-000412-Ny; Fri, 19 Nov 2021 02:33:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227627.393733; Fri, 19 Nov 2021 02:33:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mntiC-00040u-L2; Fri, 19 Nov 2021 02:33:12 +0000
Received: by outflank-mailman (input) for mailman id 227627;
 Fri, 19 Nov 2021 02:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mntiB-00040l-P0
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 02:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mntiB-0003kw-O4
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 02:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mntiB-0002xY-N3
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 02:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wptbXMOrerFIs1NLWOkYyghRIcKlc4MJ//0ZvCTree4=; b=Z6JrpvZ8yg0avXXouD0j/YeZvO
	RbynuIL66BIHHoBj/K+/EvQ3Pdf2ck/o+mGKZGg4tSfqn4qklTPn/9WMxzTvQWEeBbXEjoaMha62x
	BqfX1FG2+iMrDDPQByeOfiGZCKJUkPjSUrdRLtIRqhoixwWsxuoeEaAsmXZ8KXPjeQSU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/python: fix python libxc bindings to pass a max grant version
Message-Id: <E1mntiB-0002xY-N3@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 02:33:11 +0000

commit 1cffc48f1e1f972daeec579c62de4bb24f3152fa
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Nov 17 12:43:05 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 17 12:43:05 2021 +0100

    tools/python: fix python libxc bindings to pass a max grant version
    
    Such max version should be provided by the caller, otherwise the
    bindings will default to specifying a max version of 2, which is
    inline with the current defaults in the hypervisor.
    
    Fixes: 7379f9e10a ('gnttab: allow setting max version per-domain')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <iwj@xenproject.org>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/python/xen/lowlevel/xc/xc.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 6293d205a3..fd00861032 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -116,7 +116,7 @@ static PyObject *pyxc_domain_create(XcObject *self,
                                     PyObject *args,
                                     PyObject *kwds)
 {
-    uint32_t dom = 0, target = 0;
+    uint32_t dom = 0, target = 0, max_grant_version = 2;
     int      ret;
     size_t   i;
     PyObject *pyhandle = NULL;
@@ -132,12 +132,13 @@ static PyObject *pyxc_domain_create(XcObject *self,
     };
 
     static char *kwd_list[] = { "domid", "ssidref", "handle", "flags",
-                                "target", "max_vcpus", NULL };
+                                "target", "max_vcpus", "max_grant_version",
+                                NULL };
 
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOiii", kwd_list,
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOiiii", kwd_list,
                                       &dom, &config.ssidref, &pyhandle,
                                       &config.flags, &target,
-                                      &config.max_vcpus) )
+                                      &config.max_vcpus, &max_grant_version) )
         return NULL;
     if ( pyhandle != NULL )
     {
@@ -162,6 +163,7 @@ static PyObject *pyxc_domain_create(XcObject *self,
 #else
 #error Architecture not supported
 #endif
+    config.grant_opts = XEN_DOMCTL_GRANT_version(max_grant_version);
 
     if ( (ret = xc_domain_create(self->xc_handle, &dom, &config)) < 0 )
         return pyxc_error_to_exception(self->xc_handle);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:44:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227672.393823 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzV7-0007HR-Oe; Fri, 19 Nov 2021 08:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227672.393823; Fri, 19 Nov 2021 08:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzV7-0007HJ-Lj; Fri, 19 Nov 2021 08:44:05 +0000
Received: by outflank-mailman (input) for mailman id 227672;
 Fri, 19 Nov 2021 08: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 1mnzV6-0007HD-TK
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08: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 1mnzV6-0002T4-Lx
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzV6-00018s-L1
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08: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=ho+kA4lMYoDNHQI59JYuefiBbWyqRZjoSLuc2lCfFC4=; b=ACeJ/LNsHucCIo/H7LSsbjBWbe
	c7yUEnKW9BTNmxrNSQdpYx9WufZEY/7dz1mjahOZS4FFxvt+Z2e3muAXHrjn9TL1BaS2B77t+LVrQ
	kv86jX3IwrfgMJomAuaE9W5P9KJ0kw+S09d8UsAPG+Av4oZGsDxrD1iQ0ZKkhxwYvmwU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] build: fix dependencies in arch/x86/boot
Message-Id: <E1mnzV6-00018s-L1@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:44:04 +0000

commit 7eaf2a39c4061bdd7d1948f4848926ed5b5058b7
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Nov 19 09:26:54 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:26:54 2021 +0100

    build: fix dependencies in arch/x86/boot
    
    Temporary fix the list of headers that cmdline.c and reloc.c depends
    on, until the next time the list is out of sync again.
    
    Also, add the linker script to the list.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2f5f0a1b77161993c16c4cc243467d75e5b7633b
    master date: 2021-10-14 12:35:42 +0200
---
 xen/arch/x86/boot/Makefile   | 9 ++++++---
 xen/arch/x86/boot/build32.mk | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 9b31bfcbfb..d2eb277d42 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -2,19 +2,22 @@ obj-bin-y += head.o
 
 DEFS_H_DEPS = defs.h $(BASEDIR)/include/xen/stdbool.h
 
-CMDLINE_DEPS = $(DEFS_H_DEPS) video.h
+CMDLINE_DEPS = $(DEFS_H_DEPS) video.h \
+	       $(BASEDIR)/include/xen/kconfig.h \
+	       $(BASEDIR)/include/generated/autoconf.h
 
 RELOC_DEPS = $(DEFS_H_DEPS) \
 	     $(BASEDIR)/include/generated/autoconf.h \
 	     $(BASEDIR)/include/xen/kconfig.h \
 	     $(BASEDIR)/include/xen/multiboot.h \
 	     $(BASEDIR)/include/xen/multiboot2.h \
+	     $(BASEDIR)/include/xen/const.h \
 	     $(BASEDIR)/include/public/arch-x86/hvm/start_info.h
 
 head.o: cmdline.S reloc.S
 
-cmdline.S: cmdline.c $(CMDLINE_DEPS)
+cmdline.S: cmdline.c $(CMDLINE_DEPS) build32.lds
 	$(MAKE) -f build32.mk $@ CMDLINE_DEPS="$(CMDLINE_DEPS)"
 
-reloc.S: reloc.c $(RELOC_DEPS)
+reloc.S: reloc.c $(RELOC_DEPS) build32.lds
 	$(MAKE) -f build32.mk $@ RELOC_DEPS="$(RELOC_DEPS)"
diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
index 8cd5403926..e90680cd9f 100644
--- a/xen/arch/x86/boot/build32.mk
+++ b/xen/arch/x86/boot/build32.mk
@@ -27,7 +27,7 @@ CFLAGS := $(filter-out -flto,$(CFLAGS))
 		done
 	$(OBJCOPY) -O binary -R .got.plt $< $@
 
-%.lnk: %.o
+%.lnk: %.o build32.lds
 	$(LD) $(LDFLAGS_DIRECT) -N -T build32.lds -o $@ $<
 
 %.o: %.c
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:44:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227673.393827 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzVH-0007JC-QA; Fri, 19 Nov 2021 08:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227673.393827; Fri, 19 Nov 2021 08:44:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzVH-0007J3-NC; Fri, 19 Nov 2021 08:44:15 +0000
Received: by outflank-mailman (input) for mailman id 227673;
 Fri, 19 Nov 2021 08: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 1mnzVG-0007Iv-QB
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08: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 1mnzVG-0002TF-PL
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzVG-00019V-ON
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08: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=2BJObQEf3umuboEt7U1ZVmJC3S9wojk5Or9K1zhuJlI=; b=zcVehSdzsSUcB9Y4+O5BkB6ffo
	B3cIBAroww8hcZCtDa4apydqoICJVSTEqSEjc+fQstzaKiRW1njoUyQrtgG0CdZSX1oiKLS+1fGqQ
	rUTneLY0BWCAnF1jz8XX+FqGnkGaQLsAXSDuAoK3jy+u6sxAosDOrVKBwd1aS6CA71kU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/HVM: correct cleanup after failed viridian_vcpu_init()
Message-Id: <E1mnzVG-00019V-ON@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:44:14 +0000

commit 93f9c29a2a1ae464c808841b858352b7669bbd75
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:27:42 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:27:42 2021 +0100

    x86/HVM: correct cleanup after failed viridian_vcpu_init()
    
    This happens after nestedhvm_vcpu_initialise(), so its effects also need
    to be undone.
    
    Fixes: 40a4a9d72d16 ("viridian: add init hooks")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 66675056c6e59b8a8b651a29ef53c63e9e04f58d
    master date: 2021-10-18 14:21:17 +0200
---
 xen/arch/x86/hvm/hvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index e7bcffebc4..f336ffa393 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1580,7 +1580,7 @@ int hvm_vcpu_initialise(struct vcpu *v)
 
     rc = viridian_vcpu_init(v);
     if ( rc )
-        goto fail5;
+        goto fail6;
 
     rc = ioreq_server_add_vcpu_all(d, v);
     if ( rc != 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:44:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:44:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227674.393831 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzVR-0007MG-Rp; Fri, 19 Nov 2021 08:44:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227674.393831; Fri, 19 Nov 2021 08:44:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzVR-0007M9-Ol; Fri, 19 Nov 2021 08:44:25 +0000
Received: by outflank-mailman (input) for mailman id 227674;
 Fri, 19 Nov 2021 08:44:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzVQ-0007Lx-Tc
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:44:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzVQ-0002TZ-Sm
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:44:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzVQ-0001AG-S0
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:44:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IYnY1KbQb4vbID9y05QrTUL9H1DtUlwplPjJfuxxlk4=; b=vKBZDHrCZRcy1Sz1LrFFhPkXGr
	uP9BE/a2JfLsKsB0cO0sgj98Rleq+eHIdwz/mJw9IEhGciZvjwl3Ve3XADZSaWS5HBO2FkbNzrBJW
	bXjTw+DF/stI379PRwWjjtZcPuDJjhoBqfv0RSMfg+LANA0aVmWwf3jg6V6qRDL3749g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86emul: de-duplicate scatters to the same linear address
Message-Id: <E1mnzVQ-0001AG-S0@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:44:24 +0000

commit d23e96ede24e6e6701ee531f2e91dc7366f4c784
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:28:18 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:28:18 2021 +0100

    x86emul: de-duplicate scatters to the same linear address
    
    The SDM specifically allows for earlier writes to fully overlapping
    ranges to be dropped. If a guest did so, hvmemul_phys_mmio_access()
    would crash it if varying data was written to the same address. Detect
    overlaps early, as doing so in hvmemul_{linear,phys}_mmio_access() would
    be quite a bit more difficult. To maintain proper faulting behavior,
    instead of dropping earlier write instances of fully overlapping slots
    altogether, write the data of the final of these slots multiple times.
    (We also can't pull ahead the [single] write of the data of the last of
    the slots, clearing all involved slots' op_mask bits together, as this
    would yield incorrect results if there were intervening partially
    overlapping ones.)
    
    Note that due to cache slot use being linear address based, there's no
    similar issue with multiple writes to the same physical address (mapped
    through different linear addresses).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: a8cddbac5051020bb4a59a7f0ea27500c51063fb
    master date: 2021-10-19 10:02:39 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 7bfb91dfff..dc281971ee 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -10041,15 +10041,36 @@ x86_emulate(
 
         for ( i = 0; op_mask; ++i )
         {
-            long idx = b & 1 ? index.qw[i] : index.dw[i];
+            long idx = (b & 1 ? index.qw[i]
+                              : index.dw[i]) * (1 << state->sib_scale);
+            unsigned long offs = truncate_ea(ea.mem.off + idx);
+            unsigned int j, slot;
 
             if ( !(op_mask & (1 << i)) )
                 continue;
 
-            rc = ops->write(ea.mem.seg,
-                            truncate_ea(ea.mem.off +
-                                        idx * (1 << state->sib_scale)),
-                            (void *)mmvalp + i * op_bytes, op_bytes, ctxt);
+            /*
+             * hvmemul_linear_mmio_access() will find a cache slot based on
+             * linear address.  hvmemul_phys_mmio_access() will crash the
+             * domain if observing varying data getting written to the same
+             * cache slot.  Utilize that squashing earlier writes to fully
+             * overlapping addresses is permitted by the spec.  We can't,
+             * however, drop the writes altogether, to maintain correct
+             * faulting behavior.  Instead write the data from the last of
+             * the fully overlapping slots multiple times.
+             */
+            for ( j = (slot = i) + 1; j < n; ++j )
+            {
+                long idx2 = (b & 1 ? index.qw[j]
+                                   : index.dw[j]) * (1 << state->sib_scale);
+
+                if ( (op_mask & (1 << j)) &&
+                     truncate_ea(ea.mem.off + idx2) == offs )
+                    slot = j;
+            }
+
+            rc = ops->write(ea.mem.seg, offs,
+                            (void *)mmvalp + slot * op_bytes, op_bytes, ctxt);
             if ( rc != X86EMUL_OKAY )
             {
                 /* See comment in gather emulation. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:44:35 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:44:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227675.393835 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzVb-0007Pd-TL; Fri, 19 Nov 2021 08:44:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227675.393835; Fri, 19 Nov 2021 08:44:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzVb-0007PV-QX; Fri, 19 Nov 2021 08:44:35 +0000
Received: by outflank-mailman (input) for mailman id 227675;
 Fri, 19 Nov 2021 08: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 1mnzVb-0007PJ-0N
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08: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 1mnzVa-0002Tj-Vo
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:44:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzVa-0001An-V1
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:44:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KTI0s60pDJQtZLh42trE98jYuXbQgOceLLa7veObmGk=; b=zT4G5/thd78Ccp9DfvmpbcNAtB
	svcqRR/Gcr4pO6+Bsd1i85NK1vUgyq/AEtNAR7fSZgDc7wPuPdDnNxspNa0TutPRR0iecR9CV+C5k
	G/mMmwb7AEssURd13bGx1vy1lTaOasSbg6zxsCky9ZxCLtaA1KOCrgmjwTP3da3jq4HE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/AMD: make HT range dynamic for Fam17 and up
Message-Id: <E1mnzVa-0001An-V1@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:44:34 +0000

commit e8a444817474333d63a583d7a118945f32c4efc5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:28:50 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:28:50 2021 +0100

    x86/AMD: make HT range dynamic for Fam17 and up
    
    At the time of d838ac2539cf ("x86: don't allow Dom0 access to the HT
    address range") documentation correctly stated that the range was
    completely fixed. For Fam17 and newer, it lives at the top of physical
    address space, though.
    
    To correctly determine the top of physical address space, we need to
    account for their physical address reduction, hence the calculation of
    paddr_bits also gets adjusted.
    
    While for paddr_bits < 40 the HT range is completely hidden, there's no
    need to suppress the range insertion in that case: It'll just have no
    real meaning.
    
    Reported-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: d6e38eea2d806c53d976603717aebf6e5de30a1e
    master date: 2021-10-19 10:04:13 +0200
---
 xen/arch/x86/cpu/common.c | 7 +++++++
 xen/arch/x86/dom0_build.c | 7 +++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index e5c3caf41d..cab3befeac 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -336,16 +336,23 @@ void __init early_cpu_init(void)
 
 	eax = cpuid_eax(0x80000000);
 	if ((eax >> 16) == 0x8000 && eax >= 0x80000008) {
+		ebx = eax >= 0x8000001f ? cpuid_ebx(0x8000001f) : 0;
 		eax = cpuid_eax(0x80000008);
+
 		paddr_bits = eax & 0xff;
 		if (paddr_bits > PADDR_BITS)
 			paddr_bits = PADDR_BITS;
+
 		vaddr_bits = (eax >> 8) & 0xff;
 		if (vaddr_bits > VADDR_BITS)
 			vaddr_bits = VADDR_BITS;
+
 		hap_paddr_bits = ((eax >> 16) & 0xff) ?: paddr_bits;
 		if (hap_paddr_bits > PADDR_BITS)
 			hap_paddr_bits = PADDR_BITS;
+
+		/* Account for SME's physical address space reduction. */
+		paddr_bits -= (ebx >> 6) & 0x3f;
 	}
 
 	if (!(c->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)))
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 74b443e509..fe24e11b37 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -524,8 +524,11 @@ int __init dom0_setup_permissions(struct domain *d)
                                          MSI_ADDR_DEST_ID_MASK));
     /* HyperTransport range. */
     if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
-        rc |= iomem_deny_access(d, paddr_to_pfn(0xfdULL << 32),
-                                paddr_to_pfn((1ULL << 40) - 1));
+    {
+        mfn = paddr_to_pfn(1UL <<
+                           (boot_cpu_data.x86 < 0x17 ? 40 : paddr_bits));
+        rc |= iomem_deny_access(d, mfn - paddr_to_pfn(3UL << 32), mfn - 1);
+    }
 
     /* Remove access to E820_UNUSABLE I/O regions above 1MB. */
     for ( i = 0; i < e820.nr_map; i++ )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:44:45 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:44:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227676.393838 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzVl-0007Sf-V6; Fri, 19 Nov 2021 08:44:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227676.393838; Fri, 19 Nov 2021 08:44:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzVl-0007SX-Ry; Fri, 19 Nov 2021 08:44:45 +0000
Received: by outflank-mailman (input) for mailman id 227676;
 Fri, 19 Nov 2021 08: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 1mnzVl-0007SL-3t
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08: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 1mnzVl-0002UB-32
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:44:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzVl-0001BO-22
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08: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=2QOn72WMmu9gE/H+u0af4wxQqSCdr1Eh9hbl++tJVF4=; b=yFYGEi9nr22vsx+/nWIzj0IZ/+
	uLcoT4HlWMILMAcRwY//yTLumy5A31fyhcE4b8qO7f1CwNSG/oSUWxtdsHnn32WQp9q9MiAPaxI0S
	0Dvxf61WBv85t0XGqUg4iI2Sm74+VB916dXjXih+V5gg2HGpeX/Wxje6g1AmJ55nnxtg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/PV: make '0' debug key dump Dom0's stacks again
Message-Id: <E1mnzVl-0001BO-22@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:44:45 +0000

commit b033a41572333936b9b859280875fc73e72c3e47
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:29:12 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:29:12 2021 +0100

    x86/PV: make '0' debug key dump Dom0's stacks again
    
    The conversion to __get_guest() failed to account for the fact that for
    remote vCPU-s dumping gets done through a pointer obtained from
    map_domain_page(): __get_guest() arranges for (apparent) accesses to
    hypervisor space to cause #GP(0).
    
    Fixes: 6a1d72d3739e ('x86: split __{get,put}_user() into "guest" and "unsafe" variants')
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 4843546fef5e024d5754f722fd01a8dfb482ac7d
    master date: 2021-10-19 10:07:00 +0200
---
 xen/arch/x86/traps.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 939c91a0ca..948e422397 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -274,7 +274,9 @@ static void compat_show_guest_stack(struct vcpu *v,
     {
         if ( (((long)stack - 1) ^ ((long)(stack + 1) - 1)) & mask )
             break;
-        if ( __get_guest(addr, stack) )
+        if ( stack_page )
+            addr = *stack;
+        else if ( __get_guest(addr, stack) )
         {
             if ( i != 0 )
                 printk("\n    ");
@@ -343,7 +345,9 @@ 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_guest(addr, stack) )
+        if ( stack_page )
+            addr = *stack;
+        else if ( __get_guest(addr, stack) )
         {
             if ( i != 0 )
                 printk("\n    ");
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:44:56 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:44:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227677.393843 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzVw-0007W0-1f; Fri, 19 Nov 2021 08:44:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227677.393843; Fri, 19 Nov 2021 08:44:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzVv-0007Vs-Un; Fri, 19 Nov 2021 08:44:55 +0000
Received: by outflank-mailman (input) for mailman id 227677;
 Fri, 19 Nov 2021 08:44:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzVv-0007Vk-72
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:44:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzVv-0002UP-6D
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:44:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzVv-0001C0-5M
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:44:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vl2FNR8q3S5gHFxAEKiybHbeb2tCUpxl310Gswj7eaA=; b=6MpRn3xAlp3u7H39bhsOFRw7K/
	gs2frAW7mxPa/sgF8p0tLWZxYX2PvMNeSW11qphio88xNbTHRfBMkDl/jGKv2kNre1apEeNtbSsNS
	0Xl51tvyD+nlldocIu+KivRAGvTUfRRGPz2U82M6mw6wH0fgNQsNBYwR3VE2Y+bpPiOM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/paging: restrict physical address width reported to guests
Message-Id: <E1mnzVv-0001C0-5M@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:44:55 +0000

commit cae4b7b129390af798cd49986b72a00f88d8a54f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:29:36 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:29:36 2021 +0100

    x86/paging: restrict physical address width reported to guests
    
    Modern hardware may report more than 48 bits of physical address width.
    For paging-external guests our P2M implementation does not cope with
    larger values. Telling the guest of more available bits means misleading
    it into perhaps trying to actually put some page there (like was e.g.
    intermediately done in OVMF for the shared info page).
    
    While there also convert the PV check to a paging-external one (which in
    our current code base are synonyms of one another anyway).
    
    Fixes: 5dbd60e16a1f ("x86/shadow: Correct guest behaviour when creating PTEs above maxphysaddr")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: b7635526acffbe4ad8ad16fd92812c57742e54c2
    master date: 2021-10-19 10:08:30 +0200
---
 xen/include/asm-x86/paging.h | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index 7332a9b506..614ac797e5 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -394,11 +394,18 @@ static always_inline unsigned int paging_max_paddr_bits(const struct domain *d)
 {
     unsigned int bits = paging_mode_hap(d) ? hap_paddr_bits : paddr_bits;
 
-    if ( !IS_ENABLED(CONFIG_BIGMEM) && paging_mode_shadow(d) &&
-         !is_pv_domain(d) )
+    if ( paging_mode_external(d) )
     {
-        /* Shadowed superpages store GFNs in 32-bit page_info fields. */
-        bits = min(bits, 32U + PAGE_SHIFT);
+        if ( !IS_ENABLED(CONFIG_BIGMEM) && paging_mode_shadow(d) )
+        {
+            /* Shadowed superpages store GFNs in 32-bit page_info fields. */
+            bits = min(bits, 32U + PAGE_SHIFT);
+        }
+        else
+        {
+            /* Both p2m-ept and p2m-pt only support 4-level page tables. */
+            bits = min(bits, 48U);
+        }
     }
 
     return bits;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:45:06 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:45:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227678.393847 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzW6-0007Yf-2w; Fri, 19 Nov 2021 08:45:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227678.393847; Fri, 19 Nov 2021 08:45:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzW6-0007YX-07; Fri, 19 Nov 2021 08:45:06 +0000
Received: by outflank-mailman (input) for mailman id 227678;
 Fri, 19 Nov 2021 08:45:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzW5-0007YO-A2
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:45:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzW5-0002V2-9K
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:45:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzW5-0001Cm-8V
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:45:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JplN8tfN5hEFXevpphkZcZJ1cy9HR/EkUSkRiWzVBzc=; b=VQodrpg8pfTSUR/1LeqL+dOkE1
	/o9mDSnbQ441NgaOz+WahgUDP2PfweZHJNI8ubKxYgW4U9SHUuK4tm72Cd0wrGfVq8c6uWEFXsm5s
	dqRP/FlHjs6GnTgBT9R3GCccgBhBM88bVpyxa/pDtHkpIDzRbmC7uXH4woanKHYHstN4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] update system time immediately when VCPUOP_register_vcpu_info
Message-Id: <E1mnzW5-0001Cm-8V@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:45:05 +0000

commit 751efc5882f54f45d9c895d6745a1d95f1359dec
Author:     Dongli Zhang <dongli.zhang@oracle.com>
AuthorDate: Fri Nov 19 09:30:14 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:30:14 2021 +0100

    update system time immediately when VCPUOP_register_vcpu_info
    
    The guest may access the pv vcpu_time_info immediately after
    VCPUOP_register_vcpu_info. This is to borrow the idea of
    VCPUOP_register_vcpu_time_memory_area, where the
    force_update_vcpu_system_time() is called immediately when the new memory
    area is registered.
    
    Otherwise, we may observe clock drift at the VM side if the VM accesses
    the clocksource immediately after VCPUOP_register_vcpu_info().
    
    Reference: https://lists.xenproject.org/archives/html/xen-devel/2021-10/msg00571.html
    Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b67f09721f136cc3a9afcb6a82466d1bd27aa6c0
    master date: 2021-11-03 10:19:06 +0100
---
 xen/arch/arm/time.c        | 5 +++++
 xen/common/domain.c        | 2 ++
 xen/include/asm-arm/time.h | 2 ++
 3 files changed, 9 insertions(+)

diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
index b0021c2c69..620ac202f3 100644
--- a/xen/arch/arm/time.c
+++ b/xen/arch/arm/time.c
@@ -351,6 +351,11 @@ void update_vcpu_system_time(struct vcpu *v)
     /* XXX update shared_info->wc_* */
 }
 
+void force_update_vcpu_system_time(struct vcpu *v)
+{
+    update_vcpu_system_time(v);
+}
+
 void domain_set_time_offset(struct domain *d, int64_t time_offset_seconds)
 {
     d->time_offset.seconds = time_offset_seconds;
diff --git a/xen/common/domain.c b/xen/common/domain.c
index fe39fb9177..17cc32fde3 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1694,6 +1694,8 @@ long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg)
         rc = map_vcpu_info(v, info.mfn, info.offset);
         domain_unlock(d);
 
+        force_update_vcpu_system_time(v);
+
         break;
     }
 
diff --git a/xen/include/asm-arm/time.h b/xen/include/asm-arm/time.h
index 6b8fd839dd..4b401c1110 100644
--- a/xen/include/asm-arm/time.h
+++ b/xen/include/asm-arm/time.h
@@ -105,6 +105,8 @@ extern uint64_t ns_to_ticks(s_time_t ns);
 
 void preinit_xen_time(void);
 
+void force_update_vcpu_system_time(struct vcpu *v);
+
 #endif /* __ARM_TIME_H__ */
 /*
  * Local variables:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:45:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:45:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227679.393851 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzWG-0007bR-50; Fri, 19 Nov 2021 08:45:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227679.393851; Fri, 19 Nov 2021 08:45:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzWG-0007bJ-1b; Fri, 19 Nov 2021 08:45:16 +0000
Received: by outflank-mailman (input) for mailman id 227679;
 Fri, 19 Nov 2021 08:45: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 1mnzWF-0007b7-DC
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:45: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 1mnzWF-0002VC-CM
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:45:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzWF-0001De-Bb
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:45:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0hpQGGcsaRLo1guFUMLCeVeMTeVwjlh+C+qTPl+n8xg=; b=C9sZXnud2gCalTZmJbCajk0u/H
	TB4Okl7QKy7/zqergsI6EQGaUCCKTkLLWv4ysGPuuCPpCpMlff3CXN/DrCBhsXHWW4GBeWImHo7uw
	oetzZh/jcaWCSHOlYTDCU3SCWdK9hhRoGkd9MGQQShxV80PEnkyt7stQ8ye3uH6250zM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/shstk: Fix use of shadow stacks with XPTI active
Message-Id: <E1mnzWF-0001De-Bb@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:45:15 +0000

commit c61cd82e01d58f04384afb78069afe71d994ef14
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Nov 19 09:30:42 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:30:42 2021 +0100

    x86/shstk: Fix use of shadow stacks with XPTI active
    
    The call to setup_cpu_root_pgt(0) in smp_prepare_cpus() is too early.  It
    clones the BSP's stack while the .data mapping is still in use, causing all
    mappings to be fully read read/write (and with no guard pages either).  This
    ultimately causes #DF when trying to enter the dom0 kernel for the first time.
    
    Defer setting up BSPs XPTI pagetable until reinit_bsp_stack() after we've set
    up proper shadow stack permissions.
    
    Fixes: 60016604739b ("x86/shstk: Rework the stack layout to support shadow stacks")
    Fixes: b60ab42db2f0 ("x86/shstk: Activate Supervisor Shadow Stacks")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b2851580b1f2ff121737a37cb25a370d7692ae3b
    master date: 2021-11-03 13:08:42 +0000
---
 xen/arch/x86/setup.c   | 5 +++++
 xen/arch/x86/smpboot.c | 9 ++-------
 xen/include/xen/smp.h  | 1 +
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 68454df8ed..59955aadb9 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -664,6 +664,7 @@ static void noreturn init_done(void)
 static void __init noreturn reinit_bsp_stack(void)
 {
     unsigned long *stack = (void*)(get_stack_bottom() & ~(STACK_SIZE - 1));
+    int rc;
 
     /* Update TSS and ISTs */
     load_system_tables();
@@ -674,6 +675,10 @@ static void __init noreturn reinit_bsp_stack(void)
     stack_base[0] = stack;
     memguard_guard_stack(stack);
 
+    rc = setup_cpu_root_pgt(0);
+    if ( rc )
+        panic("Error %d setting up PV root page table\n", rc);
+
     if ( IS_ENABLED(CONFIG_XEN_SHSTK) && cpu_has_xen_shstk )
     {
         wrmsrl(MSR_PL0_SSP,
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 82c1012e89..f1dda9d305 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -805,7 +805,7 @@ static root_pgentry_t common_pgt;
 
 extern const char _stextentry[], _etextentry[];
 
-static int setup_cpu_root_pgt(unsigned int cpu)
+int setup_cpu_root_pgt(unsigned int cpu)
 {
     root_pgentry_t *rpt;
     unsigned int off;
@@ -1122,8 +1122,6 @@ static struct notifier_block cpu_smpboot_nfb = {
 
 void __init smp_prepare_cpus(void)
 {
-    int rc;
-
     register_cpu_notifier(&cpu_smpboot_nfb);
 
     mtrr_aps_sync_begin();
@@ -1137,10 +1135,7 @@ void __init smp_prepare_cpus(void)
 
     stack_base[0] = (void *)((unsigned long)stack_start & ~(STACK_SIZE - 1));
 
-    rc = setup_cpu_root_pgt(0);
-    if ( rc )
-        panic("Error %d setting up PV root page table\n", rc);
-    if ( per_cpu(root_pgt, 0) )
+    if ( opt_xpti_hwdom || opt_xpti_domu )
     {
         get_cpu_info()->pv_cr3 = 0;
 
diff --git a/xen/include/xen/smp.h b/xen/include/xen/smp.h
index d5a3644611..0a9219173f 100644
--- a/xen/include/xen/smp.h
+++ b/xen/include/xen/smp.h
@@ -70,5 +70,6 @@ int alloc_cpu_id(void);
 extern void *stack_base[NR_CPUS];
 
 void initialize_cpu_data(unsigned int cpu);
+int setup_cpu_root_pgt(unsigned int cpu);
 
 #endif /* __XEN_SMP_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:45:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:45:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227680.393855 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzWQ-0007eE-68; Fri, 19 Nov 2021 08:45:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227680.393855; Fri, 19 Nov 2021 08:45:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzWQ-0007e6-3C; Fri, 19 Nov 2021 08:45:26 +0000
Received: by outflank-mailman (input) for mailman id 227680;
 Fri, 19 Nov 2021 08:45: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 1mnzWP-0007dz-G9
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:45: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 1mnzWP-0002VN-FO
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:45:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzWP-0001ER-Ef
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:45:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nYxWMm0I1uDRu7QmMEy1EQD0UDAFinS09aFm6Niwmok=; b=YZd7jSQhavkrGmrL/W48OYf0AD
	YcsDTED/4cbuWEuwXXOxDprC4yT6J5w18SWmo+rs65c9pK5GoOwre8EFVeZRoXc4RiC9WvsnjDOXw
	qw9RoOvVgg9TfiijKtDZfl55SIqVdNKl2sOGi06GuVMJZNmq725gv63C00CtFp8tMfac=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/traps: Fix typo in do_entry_CP()
Message-Id: <E1mnzWP-0001ER-Ef@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:45:25 +0000

commit 541ae912077e894fb7d8ee73cd03355bae08387f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Nov 19 09:31:14 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:31:14 2021 +0100

    x86/traps: Fix typo in do_entry_CP()
    
    The call to debugger_trap_entry() should pass the correct vector.  The
    break-for-gdbsx logic is in practice unreachable because PV guests can't
    generate #CP, but it will interfere with anyone inserting custom debugging
    into debugger_trap_entry().
    
    Fixes: 5ad05b9c2490 ("x86/traps: Implement #CP handler and extend #PF for shadow stacks")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 512863ed238d7390f74d43f0ba298b1dfa8f4803
    master date: 2021-11-03 19:13:17 +0000
---
 xen/arch/x86/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 948e422397..10efcc6585 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2022,7 +2022,7 @@ void do_entry_CP(struct cpu_user_regs *regs)
     const char *err = "??";
     unsigned int ec = regs->error_code;
 
-    if ( debugger_trap_entry(TRAP_debug, regs) )
+    if ( debugger_trap_entry(X86_EXC_CP, regs) )
         return;
 
     /* Decode ec if possible */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:45:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:45:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227681.393859 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzWa-0007h4-7V; Fri, 19 Nov 2021 08:45:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227681.393859; Fri, 19 Nov 2021 08:45: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 1mnzWa-0007gw-4c; Fri, 19 Nov 2021 08:45:36 +0000
Received: by outflank-mailman (input) for mailman id 227681;
 Fri, 19 Nov 2021 08:45: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 1mnzWZ-0007gi-JD
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:45: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 1mnzWZ-0002VZ-IR
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:45:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzWZ-0001F7-Hf
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:45: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=t02zlGJqzazET9rEWkEPJBiO3OqA+Rx2guVV1bib90U=; b=yZpF+r+s6vcCI/qKflx62y/G7E
	04WGwNRA+GG6A6Skb6ghc0VZpdlmEAQ1VXcKu9VpgWTn+pP+pb3JsRo3W+Q8WRKDCX/KFMUP2f2P/
	3Let6Zqf4QpBsm6/FfJBJWBgW9b6wTu416i3y2NBhZiJhm/lezitFPGTUVuq6oWPAQUA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/xstate: reset cached register values on resume
Message-Id: <E1mnzWZ-0001F7-Hf@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:45:35 +0000

commit 03b2a5920fb82b700c2b1ee3e384b546873079bd
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Fri Nov 19 09:31:40 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:31:40 2021 +0100

    x86/xstate: reset cached register values on resume
    
    set_xcr0() and set_msr_xss() use cached value to avoid setting the
    register to the same value over and over. But suspend/resume implicitly
    reset the registers and since percpu areas are not deallocated on
    suspend anymore, the cache gets stale.
    Reset the cache on resume, to ensure the next write will really hit the
    hardware. Choose value 0, as it will never be a legitimate write to
    those registers - and so, will force write (and cache update).
    
    Note the cache is used io get_xcr0() and get_msr_xss() too, but:
    - set_xcr0() is called few lines below in xstate_init(), so it will
      update the cache with appropriate value
    - get_msr_xss() is not used anywhere - and thus not before any
      set_msr_xss() that will fill the cache
    
    Fixes: aca2a985a55a "xen: don't free percpu areas during suspend"
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: f7f4a523927fa4c7598e4647a16bc3e3cf8009d0
    master date: 2021-11-04 14:42:37 +0100
---
 xen/arch/x86/xstate.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 3794d9a5a5..3bcc523f80 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -608,6 +608,13 @@ void xstate_init(struct cpuinfo_x86 *c)
         return;
     }
 
+    /*
+     * Zap the cached values to make set_xcr0() and set_msr_xss() really
+     * write it.
+     */
+    this_cpu(xcr0) = 0;
+    this_cpu(xss) = ~0;
+
     cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx);
 
     BUG_ON((eax & XSTATE_FP_SSE) != XSTATE_FP_SSE);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:45:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:45:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227682.393863 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzWl-0007kB-8u; Fri, 19 Nov 2021 08:45:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227682.393863; Fri, 19 Nov 2021 08:45:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzWl-0007k4-66; Fri, 19 Nov 2021 08:45:47 +0000
Received: by outflank-mailman (input) for mailman id 227682;
 Fri, 19 Nov 2021 08:45: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 1mnzWj-0007js-MN
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:45: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 1mnzWj-0002Vw-Lf
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:45:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzWj-0001Fg-Kn
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:45: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=5gsK4xjacw5W8+HDPhpmxP7So5FjSHd5MQ4NuBA8qMA=; b=XARxa7XiY6KEA4h22w2DrJ0KsU
	KG6MogFH3927vzWkZoHBwfyx30yLlyp3xe80zso/+lQ5IZTACzY9whpbvTaIYO6WGjmkNTGt3lMVo
	8q0lSBrj1cKJ4w81OZDa9kTc+bf1LQMfTBXog/PAfadTHaxXt23/a8VT10GdjREGYE5A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/IOMMU: mark IOMMU / intremap not in use when ACPI tables are missing
Message-Id: <E1mnzWj-0001Fg-Kn@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:45:45 +0000

commit 567a8e9996440cbb37717598c1ceac7fb07803f3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:32:06 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:32:06 2021 +0100

    x86/IOMMU: mark IOMMU / intremap not in use when ACPI tables are missing
    
    x2apic_bsp_setup() gets called ahead of iommu_setup(), and since x2APIC
    mode (physical vs clustered) depends on iommu_intremap, that variable
    needs to be set to off as soon as we know we can't / won't enable
    interrupt remapping, i.e. in particular when parsing of the respective
    ACPI tables failed. Move the turning off of iommu_intremap from AMD
    specific code into acpi_iommu_init(), accompanying it by clearing of
    iommu_enable.
    
    Take the opportunity and also fully skip ACPI table parsing logic on
    VT-d when both "iommu=off" and "iommu=no-intremap" are in effect anyway,
    like was already the case for AMD.
    
    The tag below only references the commit uncovering a pre-existing
    anomaly.
    
    Fixes: d8bd82327b0f ("AMD/IOMMU: obtain IVHD type to use earlier")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 46c4061cd2bf69e8039021af615c2bdb94e50088
    master date: 2021-11-04 14:44:01 +0100
---
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  6 ------
 xen/drivers/passthrough/vtd/dmar.c          |  6 +-----
 xen/drivers/passthrough/x86/iommu.c         | 18 ++++++++++++++++++
 xen/include/asm-x86/acpi.h                  |  8 +-------
 4 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index c8e76d4077..78dc72f5f7 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -155,14 +155,8 @@ static void amd_iommu_setup_domain_device(
 
 int __init acpi_ivrs_init(void)
 {
-    if ( !iommu_enable && !iommu_intremap )
-        return 0;
-
     if ( (amd_iommu_detect_acpi() !=0) || (iommu_found() == 0) )
-    {
-        iommu_intremap = iommu_intremap_off;
         return -ENODEV;
-    }
 
     iommu_init_ops = &_iommu_init_ops;
 
diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 36d909b06d..53f33fdb0a 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -759,11 +759,7 @@ static int __init acpi_parse_dmar(struct acpi_table_header *table)
     dmar = (struct acpi_table_dmar *)table;
     dmar_flags = dmar->flags;
 
-    if ( !iommu_enable && !iommu_intremap )
-    {
-        ret = -EINVAL;
-        goto out;
-    }
+    ASSERT(iommu_enable || iommu_intremap);
 
     if ( !dmar->width )
     {
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index e83c6f2c61..fbc730a81c 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -40,6 +40,24 @@ enum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full;
 bool __read_mostly iommu_intpost;
 #endif
 
+void __init acpi_iommu_init(void)
+{
+    int ret;
+
+    if ( !iommu_enable && !iommu_intremap )
+        return;
+
+    ret = acpi_dmar_init();
+    if ( ret == -ENODEV )
+        ret = acpi_ivrs_init();
+
+    if ( ret )
+    {
+        iommu_enable = false;
+        iommu_intremap = iommu_intremap_off;
+    }
+}
+
 int __init iommu_hardware_setup(void)
 {
     struct IO_APIC_route_entry **ioapic_entries = NULL;
diff --git a/xen/include/asm-x86/acpi.h b/xen/include/asm-x86/acpi.h
index 7032f3a001..9a9cc4c240 100644
--- a/xen/include/asm-x86/acpi.h
+++ b/xen/include/asm-x86/acpi.h
@@ -141,16 +141,10 @@ extern u32 x86_acpiid_to_apicid[];
 extern u32 pmtmr_ioport;
 extern unsigned int pmtmr_width;
 
+void acpi_iommu_init(void);
 int acpi_dmar_init(void);
 int acpi_ivrs_init(void);
 
-static inline int acpi_iommu_init(void)
-{
-    int ret = acpi_dmar_init();
-
-    return ret == -ENODEV ? acpi_ivrs_init() : ret;
-}
-
 void acpi_mmcfg_init(void);
 
 /* Incremented whenever we transition through S3. Value is 1 during boot. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:45:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:45:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227683.393866 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzWv-0007mx-Ar; Fri, 19 Nov 2021 08:45:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227683.393866; Fri, 19 Nov 2021 08:45:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzWv-0007mp-7m; Fri, 19 Nov 2021 08:45:57 +0000
Received: by outflank-mailman (input) for mailman id 227683;
 Fri, 19 Nov 2021 08:45: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 1mnzWt-0007mf-PY
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:45: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 1mnzWt-0002W2-Oo
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:45:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzWt-0001GN-O1
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:45: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=cGa9D+aJ4aT/iY6lOUwAuZN8QXoodyceQ+lng1+bvYs=; b=oRkc+SPMHIDkqwRtxlorahf/y4
	zn5uifX7Kjy3FY/6yLhq/x1sHhlmUCm6IqASOLd8/qiQq83eW/lBnVpTz2jT/ZXm6lG+u6WucIKNy
	ZY15DdmqFbCsQMzGhVuRCo3y6d8MZCO80MGyMuqO6gXO4VqM0/ce0GCT226rvECTDsDA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/APIC: avoid iommu_supports_x2apic() on error path
Message-Id: <E1mnzWt-0001GN-O1@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:45:55 +0000

commit 2fb9c599d0ca5d1d44daa8bbf8692bcbe907ee14
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:32:34 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:32:34 2021 +0100

    x86/APIC: avoid iommu_supports_x2apic() on error path
    
    The value it returns may change from true to false in case
    iommu_enable_x2apic() fails and, as a side effect, clears iommu_intremap
    (as can happen at least on AMD). Latch the return value from the first
    invocation to replace the second one.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 0f50d1696b3c13cbf0b18fec817fc291d5a30a31
    master date: 2021-11-04 14:44:43 +0100
---
 xen/arch/x86/apic.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 8ab8214559..030792cabb 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -865,6 +865,7 @@ void x2apic_ap_setup(void)
 void __init x2apic_bsp_setup(void)
 {
     struct IO_APIC_route_entry **ioapic_entries = NULL;
+    bool iommu_x2apic;
     const char *orig_name;
 
     if ( !cpu_has_x2apic )
@@ -880,7 +881,8 @@ void __init x2apic_bsp_setup(void)
         printk("x2APIC: Already enabled by BIOS: Ignoring cmdline disable.\n");
     }
 
-    if ( iommu_supports_x2apic() )
+    iommu_x2apic = iommu_supports_x2apic();
+    if ( iommu_x2apic )
     {
         if ( (ioapic_entries = alloc_ioapic_entries()) == NULL )
         {
@@ -933,8 +935,11 @@ void __init x2apic_bsp_setup(void)
         printk("Switched to APIC driver %s\n", genapic.name);
 
 restore_out:
-    /* iommu_x2apic_enabled cannot be used here in the error case. */
-    if ( iommu_supports_x2apic() )
+    /*
+     * iommu_x2apic_enabled and iommu_supports_x2apic() cannot be used here
+     * in the error case.
+     */
+    if ( iommu_x2apic )
     {
         /*
          * NB: do not use raw mode when restoring entries if the iommu has
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:46:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:46:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227684.393872 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzX5-0007qL-E3; Fri, 19 Nov 2021 08:46:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227684.393872; Fri, 19 Nov 2021 08:46:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzX5-0007q9-Al; Fri, 19 Nov 2021 08:46:07 +0000
Received: by outflank-mailman (input) for mailman id 227684;
 Fri, 19 Nov 2021 08:46: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 1mnzX3-0007py-Sc
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:46: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 1mnzX3-0002WL-Rr
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:46:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzX3-0001HJ-R8
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:46: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=/uDXhzuV32T++CzcQvSR+2fwgdTVrjn0rmlgmfeKlQo=; b=1UMRG0jL7Dznvl+AvS0LAki3ck
	0icZScHCxGjTX6d6+VWoeSzS+WT/lIRYHYMpDNhOLtORrihIOOupV63u066knCsUoC1C3xtWBWwyz
	6BryBd/+V8C1lG2tFb9yLpyE5CkISX0a9JlZpGU3Vgf+p2zyY8bKGYPVlma37Etygo8I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] public/gnttab: relax v2 recommendation
Message-Id: <E1mnzX3-0001HJ-R8@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:46:05 +0000

commit 2a19ee2ba6fa2b36e4d9331f9dc40bda40f7358e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:33:03 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:33:03 2021 +0100

    public/gnttab: relax v2 recommendation
    
    With there being a way to disable v2 support, telling new guests to use
    v2 exclusively is not a good suggestion.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    master commit: 2d72d2784eb71d8532bfbd6462d261739c9e82e4
    master date: 2021-11-16 17:34:06 +0100
---
 xen/include/public/grant_table.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/include/public/grant_table.h b/xen/include/public/grant_table.h
index 84b1d26b36..61be5accee 100644
--- a/xen/include/public/grant_table.h
+++ b/xen/include/public/grant_table.h
@@ -121,8 +121,9 @@ typedef uint32_t grant_ref_t;
  */
 
 /*
- * Version 1 of the grant table entry structure is maintained purely
- * for backwards compatibility.  New guests should use version 2.
+ * Version 1 of the grant table entry structure is maintained largely for
+ * backwards compatibility.  New guests are recommended to support using
+ * version 2 to overcome version 1 limitations, but to default to version 1.
  */
 #if __XEN_INTERFACE_VERSION__ < 0x0003020a
 #define grant_entry_v1 grant_entry
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:46:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:46:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227685.393875 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzXF-0007tB-FE; Fri, 19 Nov 2021 08:46:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227685.393875; Fri, 19 Nov 2021 08:46: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 1mnzXF-0007t3-CB; Fri, 19 Nov 2021 08:46:17 +0000
Received: by outflank-mailman (input) for mailman id 227685;
 Fri, 19 Nov 2021 08:46:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzXE-0007su-GU
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:46: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 1mnzXE-0002WS-Fl
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:46:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzXE-0001Je-Et
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:46:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Wa8BPGsv50FDZ5B8ZqK9XgyQczBVk8qk0ELFAw6gtA0=; b=a972qYQ8rXNdFarRgqSux3fH8T
	ACwyECTnbahm33LzZmZE0FADrbsTds2GxdRj/eNrBEYiBK42QB4Fixxff1ibKuCUOboKtm4lzWpIc
	lvpLtknLxwoHkD196mAR2caBD2ROjt/V1Z3L4ZhTAR0qSxqvFkBPVYdb0Gt4GDUFcr3U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] build: fix dependencies in arch/x86/boot
Message-Id: <E1mnzXE-0001Je-Et@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:46:16 +0000

commit d204a149501ab11f18aa59f6b3333fd5005e15d7
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Nov 19 09:36:36 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:36:36 2021 +0100

    build: fix dependencies in arch/x86/boot
    
    Temporary fix the list of headers that cmdline.c and reloc.c depends
    on, until the next time the list is out of sync again.
    
    Also, add the linker script to the list.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2f5f0a1b77161993c16c4cc243467d75e5b7633b
    master date: 2021-10-14 12:35:42 +0200
---
 xen/arch/x86/boot/Makefile   | 9 ++++++---
 xen/arch/x86/boot/build32.mk | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 9b31bfcbfb..d2eb277d42 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -2,19 +2,22 @@ obj-bin-y += head.o
 
 DEFS_H_DEPS = defs.h $(BASEDIR)/include/xen/stdbool.h
 
-CMDLINE_DEPS = $(DEFS_H_DEPS) video.h
+CMDLINE_DEPS = $(DEFS_H_DEPS) video.h \
+	       $(BASEDIR)/include/xen/kconfig.h \
+	       $(BASEDIR)/include/generated/autoconf.h
 
 RELOC_DEPS = $(DEFS_H_DEPS) \
 	     $(BASEDIR)/include/generated/autoconf.h \
 	     $(BASEDIR)/include/xen/kconfig.h \
 	     $(BASEDIR)/include/xen/multiboot.h \
 	     $(BASEDIR)/include/xen/multiboot2.h \
+	     $(BASEDIR)/include/xen/const.h \
 	     $(BASEDIR)/include/public/arch-x86/hvm/start_info.h
 
 head.o: cmdline.S reloc.S
 
-cmdline.S: cmdline.c $(CMDLINE_DEPS)
+cmdline.S: cmdline.c $(CMDLINE_DEPS) build32.lds
 	$(MAKE) -f build32.mk $@ CMDLINE_DEPS="$(CMDLINE_DEPS)"
 
-reloc.S: reloc.c $(RELOC_DEPS)
+reloc.S: reloc.c $(RELOC_DEPS) build32.lds
 	$(MAKE) -f build32.mk $@ RELOC_DEPS="$(RELOC_DEPS)"
diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
index 8cd5403926..e90680cd9f 100644
--- a/xen/arch/x86/boot/build32.mk
+++ b/xen/arch/x86/boot/build32.mk
@@ -27,7 +27,7 @@ CFLAGS := $(filter-out -flto,$(CFLAGS))
 		done
 	$(OBJCOPY) -O binary -R .got.plt $< $@
 
-%.lnk: %.o
+%.lnk: %.o build32.lds
 	$(LD) $(LDFLAGS_DIRECT) -N -T build32.lds -o $@ $<
 
 %.o: %.c
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:46:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:46:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227686.393879 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzXP-0007vl-Go; Fri, 19 Nov 2021 08:46:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227686.393879; Fri, 19 Nov 2021 08:46: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 1mnzXP-0007vd-Dh; Fri, 19 Nov 2021 08:46:27 +0000
Received: by outflank-mailman (input) for mailman id 227686;
 Fri, 19 Nov 2021 08:46: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 1mnzXO-0007vG-Jj
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:46: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 1mnzXO-0002Wd-Iu
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:46:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzXO-0001KC-IC
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:46: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=PCCfUERU6rs/5uU0no3f0VkioOvnY4Jx2M1XOKfZDb8=; b=Y33Uz5szDUFF4zy1QWGVf2N99N
	/nfEMqQzAqnzHdvGVQJh2wrGB41H8/aJ1DgCb0fWU5er3VJUKyEPwQcOg/jyYUHwkA7PCWZkqiqky
	lSyQ1JyPRvy3PBTsWEjYGOPSFGj05WykWcRA9cZ++lOaSfjuyQxQcbTZCyPyt/1/wLWs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/HVM: correct cleanup after failed viridian_vcpu_init()
Message-Id: <E1mnzXO-0001KC-IC@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:46:26 +0000

commit f240f9c3c635222069b4e2e037c5eb7aa3687075
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:37:10 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:37:10 2021 +0100

    x86/HVM: correct cleanup after failed viridian_vcpu_init()
    
    This happens after nestedhvm_vcpu_initialise(), so its effects also need
    to be undone.
    
    Fixes: 40a4a9d72d16 ("viridian: add init hooks")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 66675056c6e59b8a8b651a29ef53c63e9e04f58d
    master date: 2021-10-18 14:21:17 +0200
---
 xen/arch/x86/hvm/hvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index ab45b0a588..5b7e494ca3 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1580,7 +1580,7 @@ int hvm_vcpu_initialise(struct vcpu *v)
 
     rc = viridian_vcpu_init(v);
     if ( rc )
-        goto fail5;
+        goto fail6;
 
     rc = hvm_all_ioreq_servers_add_vcpu(d, v);
     if ( rc != 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:46:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:46:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227687.393883 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzXZ-000808-Ie; Fri, 19 Nov 2021 08:46:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227687.393883; Fri, 19 Nov 2021 08:46: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 1mnzXZ-000800-FM; Fri, 19 Nov 2021 08:46:37 +0000
Received: by outflank-mailman (input) for mailman id 227687;
 Fri, 19 Nov 2021 08:46: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 1mnzXY-0007zo-NF
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:46: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 1mnzXY-0002YK-MM
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:46:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzXY-0001Kq-Ld
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:46: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=osNvAB4q31LTGsI5b0pDAwGbZU7MET5EUT2MtazBPII=; b=tdQPkLQ3NEV2lzN+xe7I/TDgWU
	hMbwClPcYa30q7yh07XKI/GL2N1bES3JRL33K68e+km+ReTDPdA3U1F9up2gfFFUA9TG39AZ2LXRU
	n/Pr4UU5OffW3v4vfB+LT/BIXdS82WnLWIbtQ7SAGUxqr09eRH8nJzYR9MzzpywVAt0Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86emul: de-duplicate scatters to the same linear address
Message-Id: <E1mnzXY-0001Kq-Ld@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:46:36 +0000

commit 7c957ea6125a1510baee4e01413451612c29312b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:37:37 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:37:37 2021 +0100

    x86emul: de-duplicate scatters to the same linear address
    
    The SDM specifically allows for earlier writes to fully overlapping
    ranges to be dropped. If a guest did so, hvmemul_phys_mmio_access()
    would crash it if varying data was written to the same address. Detect
    overlaps early, as doing so in hvmemul_{linear,phys}_mmio_access() would
    be quite a bit more difficult. To maintain proper faulting behavior,
    instead of dropping earlier write instances of fully overlapping slots
    altogether, write the data of the final of these slots multiple times.
    (We also can't pull ahead the [single] write of the data of the last of
    the slots, clearing all involved slots' op_mask bits together, as this
    would yield incorrect results if there were intervening partially
    overlapping ones.)
    
    Note that due to cache slot use being linear address based, there's no
    similar issue with multiple writes to the same physical address (mapped
    through different linear addresses).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: a8cddbac5051020bb4a59a7f0ea27500c51063fb
    master date: 2021-10-19 10:02:39 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index f186ae65fd..de46ec1b44 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -10024,15 +10024,36 @@ x86_emulate(
 
         for ( i = 0; op_mask; ++i )
         {
-            long idx = b & 1 ? index.qw[i] : index.dw[i];
+            long idx = (b & 1 ? index.qw[i]
+                              : index.dw[i]) * (1 << state->sib_scale);
+            unsigned long offs = truncate_ea(ea.mem.off + idx);
+            unsigned int j, slot;
 
             if ( !(op_mask & (1 << i)) )
                 continue;
 
-            rc = ops->write(ea.mem.seg,
-                            truncate_ea(ea.mem.off +
-                                        idx * (1 << state->sib_scale)),
-                            (void *)mmvalp + i * op_bytes, op_bytes, ctxt);
+            /*
+             * hvmemul_linear_mmio_access() will find a cache slot based on
+             * linear address.  hvmemul_phys_mmio_access() will crash the
+             * domain if observing varying data getting written to the same
+             * cache slot.  Utilize that squashing earlier writes to fully
+             * overlapping addresses is permitted by the spec.  We can't,
+             * however, drop the writes altogether, to maintain correct
+             * faulting behavior.  Instead write the data from the last of
+             * the fully overlapping slots multiple times.
+             */
+            for ( j = (slot = i) + 1; j < n; ++j )
+            {
+                long idx2 = (b & 1 ? index.qw[j]
+                                   : index.dw[j]) * (1 << state->sib_scale);
+
+                if ( (op_mask & (1 << j)) &&
+                     truncate_ea(ea.mem.off + idx2) == offs )
+                    slot = j;
+            }
+
+            rc = ops->write(ea.mem.seg, offs,
+                            (void *)mmvalp + slot * op_bytes, op_bytes, ctxt);
             if ( rc != X86EMUL_OKAY )
             {
                 /* See comment in gather emulation. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:46:48 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:46:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227688.393887 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzXk-000837-K2; Fri, 19 Nov 2021 08:46:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227688.393887; Fri, 19 Nov 2021 08:46: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 1mnzXk-00082z-H6; Fri, 19 Nov 2021 08:46:48 +0000
Received: by outflank-mailman (input) for mailman id 227688;
 Fri, 19 Nov 2021 08:46: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 1mnzXi-00082m-QD
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:46: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 1mnzXi-0002Yf-PU
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:46:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzXi-0001LW-Oi
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:46: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=5s2n9rczSchF9cXhI1q2g6TX/oylfdVtH0qxOT/krsE=; b=6GkOjHzeyXbEpDcHXoHq+rKzD0
	z8vie6EqGO+iWa/j08/p0Kdx9urHKBM3RgR3ScK+mpFrTDBTDqxcvHB5S3UlPDB4I9NxJZVJfYtvA
	AA2kO54Y7Jmiy4SnK/n1z+fau3pUNoXY3KjVrpG7EHcYLNO6JVwUVQYdvG/eAX0EZAAo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/AMD: make HT range dynamic for Fam17 and up
Message-Id: <E1mnzXi-0001LW-Oi@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:46:46 +0000

commit 0c3fde7b7e920fb5c20747567c249714fab57282
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:38:09 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:38:09 2021 +0100

    x86/AMD: make HT range dynamic for Fam17 and up
    
    At the time of d838ac2539cf ("x86: don't allow Dom0 access to the HT
    address range") documentation correctly stated that the range was
    completely fixed. For Fam17 and newer, it lives at the top of physical
    address space, though.
    
    To correctly determine the top of physical address space, we need to
    account for their physical address reduction, hence the calculation of
    paddr_bits also gets adjusted.
    
    While for paddr_bits < 40 the HT range is completely hidden, there's no
    need to suppress the range insertion in that case: It'll just have no
    real meaning.
    
    Reported-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: d6e38eea2d806c53d976603717aebf6e5de30a1e
    master date: 2021-10-19 10:04:13 +0200
---
 xen/arch/x86/cpu/common.c | 7 +++++++
 xen/arch/x86/dom0_build.c | 7 +++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index a684519a20..743fbb65ab 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -336,16 +336,23 @@ void __init early_cpu_init(void)
 
 	eax = cpuid_eax(0x80000000);
 	if ((eax >> 16) == 0x8000 && eax >= 0x80000008) {
+		ebx = eax >= 0x8000001f ? cpuid_ebx(0x8000001f) : 0;
 		eax = cpuid_eax(0x80000008);
+
 		paddr_bits = eax & 0xff;
 		if (paddr_bits > PADDR_BITS)
 			paddr_bits = PADDR_BITS;
+
 		vaddr_bits = (eax >> 8) & 0xff;
 		if (vaddr_bits > VADDR_BITS)
 			vaddr_bits = VADDR_BITS;
+
 		hap_paddr_bits = ((eax >> 16) & 0xff) ?: paddr_bits;
 		if (hap_paddr_bits > PADDR_BITS)
 			hap_paddr_bits = PADDR_BITS;
+
+		/* Account for SME's physical address space reduction. */
+		paddr_bits -= (ebx >> 6) & 0x3f;
 	}
 
 	if (!(c->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)))
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 0ce29e91a3..d24dd9daf6 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -521,8 +521,11 @@ int __init dom0_setup_permissions(struct domain *d)
                                          MSI_ADDR_DEST_ID_MASK));
     /* HyperTransport range. */
     if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
-        rc |= iomem_deny_access(d, paddr_to_pfn(0xfdULL << 32),
-                                paddr_to_pfn((1ULL << 40) - 1));
+    {
+        mfn = paddr_to_pfn(1UL <<
+                           (boot_cpu_data.x86 < 0x17 ? 40 : paddr_bits));
+        rc |= iomem_deny_access(d, mfn - paddr_to_pfn(3UL << 32), mfn - 1);
+    }
 
     /* Remove access to E820_UNUSABLE I/O regions above 1MB. */
     for ( i = 0; i < e820.nr_map; i++ )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:46:58 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:46:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227689.393891 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzXu-00086n-LN; Fri, 19 Nov 2021 08:46:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227689.393891; Fri, 19 Nov 2021 08:46: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 1mnzXu-00086f-IZ; Fri, 19 Nov 2021 08:46:58 +0000
Received: by outflank-mailman (input) for mailman id 227689;
 Fri, 19 Nov 2021 08:46: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 1mnzXs-00086N-TK
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:46: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 1mnzXs-0002Yo-Sa
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:46:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzXs-0001M3-Rs
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:46: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=6YCSoeGhy4+E5irm8D/FvvZ+b715tR9/FTyLGCmvJeM=; b=S04RBGceYFNA1zxUMGlEnpr+wi
	HDMlYqtbTZjLkYxQaH72SYgoHVyGo6sAkjS/j/u8GN94rnVrjfjgDw3vBxFpQw4lG0qwXSCRldp5J
	nRb0Vc/POn3dSB/JFsmn+1bVSytqFxGrVgjhLWLgdd76CBtEOWjwgYYABbqb73g8wY0c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/paging: restrict physical address width reported to guests
Message-Id: <E1mnzXs-0001M3-Rs@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:46:56 +0000

commit 81e3fd1f3cacda220e4d46bb01f9c1b554ed8401
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:38:42 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:38:42 2021 +0100

    x86/paging: restrict physical address width reported to guests
    
    Modern hardware may report more than 48 bits of physical address width.
    For paging-external guests our P2M implementation does not cope with
    larger values. Telling the guest of more available bits means misleading
    it into perhaps trying to actually put some page there (like was e.g.
    intermediately done in OVMF for the shared info page).
    
    While there also convert the PV check to a paging-external one (which in
    our current code base are synonyms of one another anyway).
    
    Fixes: 5dbd60e16a1f ("x86/shadow: Correct guest behaviour when creating PTEs above maxphysaddr")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: b7635526acffbe4ad8ad16fd92812c57742e54c2
    master date: 2021-10-19 10:08:30 +0200
---
 xen/include/asm-x86/paging.h | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index f53575f3d9..abb9a7e75c 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -391,11 +391,18 @@ static always_inline unsigned int paging_max_paddr_bits(const struct domain *d)
 {
     unsigned int bits = paging_mode_hap(d) ? hap_paddr_bits : paddr_bits;
 
-    if ( !IS_ENABLED(CONFIG_BIGMEM) && paging_mode_shadow(d) &&
-         !is_pv_domain(d) )
+    if ( paging_mode_external(d) )
     {
-        /* Shadowed superpages store GFNs in 32-bit page_info fields. */
-        bits = min(bits, 32U + PAGE_SHIFT);
+        if ( !IS_ENABLED(CONFIG_BIGMEM) && paging_mode_shadow(d) )
+        {
+            /* Shadowed superpages store GFNs in 32-bit page_info fields. */
+            bits = min(bits, 32U + PAGE_SHIFT);
+        }
+        else
+        {
+            /* Both p2m-ept and p2m-pt only support 4-level page tables. */
+            bits = min(bits, 48U);
+        }
     }
 
     return bits;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:47:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:47:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227690.393894 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzY4-00089b-N9; Fri, 19 Nov 2021 08:47:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227690.393894; Fri, 19 Nov 2021 08:47:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzY4-00089T-K3; Fri, 19 Nov 2021 08:47:08 +0000
Received: by outflank-mailman (input) for mailman id 227690;
 Fri, 19 Nov 2021 08:47:07 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzY3-00089I-02
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:47:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzY2-0002ZD-Vb
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:47:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzY2-0001Ml-V0
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:47: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=zjqLTjp+LkHIWGa7KHp+tQr82LYQN2qFzDNc5q26eEk=; b=KGyzOGeaLA2UU4lOoTC3Jg+8pX
	I5Wy6lPySTvxBSzHekKg5lIVcCmy4ikkc2JdcWA8paOmxckdAEAM/uF3yOxGFUuvfF6M8Cx1mbF4R
	OI1cKNdwLfbf1OOIc0TZxAwGyfxhUNMDJ//n8ra5qsGiUEmRn0ZHrQGBgBWZCkpUeDkw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] update system time immediately when VCPUOP_register_vcpu_info
Message-Id: <E1mnzY2-0001Ml-V0@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:47:06 +0000

commit c3f25903696412b8847619ccd5e51886106b70ad
Author:     Dongli Zhang <dongli.zhang@oracle.com>
AuthorDate: Fri Nov 19 09:39:09 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:39:09 2021 +0100

    update system time immediately when VCPUOP_register_vcpu_info
    
    The guest may access the pv vcpu_time_info immediately after
    VCPUOP_register_vcpu_info. This is to borrow the idea of
    VCPUOP_register_vcpu_time_memory_area, where the
    force_update_vcpu_system_time() is called immediately when the new memory
    area is registered.
    
    Otherwise, we may observe clock drift at the VM side if the VM accesses
    the clocksource immediately after VCPUOP_register_vcpu_info().
    
    Reference: https://lists.xenproject.org/archives/html/xen-devel/2021-10/msg00571.html
    Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b67f09721f136cc3a9afcb6a82466d1bd27aa6c0
    master date: 2021-11-03 10:19:06 +0100
---
 xen/arch/arm/time.c        | 5 +++++
 xen/common/domain.c        | 2 ++
 xen/include/asm-arm/time.h | 2 ++
 3 files changed, 9 insertions(+)

diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
index b0021c2c69..620ac202f3 100644
--- a/xen/arch/arm/time.c
+++ b/xen/arch/arm/time.c
@@ -351,6 +351,11 @@ void update_vcpu_system_time(struct vcpu *v)
     /* XXX update shared_info->wc_* */
 }
 
+void force_update_vcpu_system_time(struct vcpu *v)
+{
+    update_vcpu_system_time(v);
+}
+
 void domain_set_time_offset(struct domain *d, int64_t time_offset_seconds)
 {
     d->time_offset.seconds = time_offset_seconds;
diff --git a/xen/common/domain.c b/xen/common/domain.c
index b556696c87..b7017e1c01 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1498,6 +1498,8 @@ long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg)
         rc = map_vcpu_info(v, info.mfn, info.offset);
         domain_unlock(d);
 
+        force_update_vcpu_system_time(v);
+
         break;
     }
 
diff --git a/xen/include/asm-arm/time.h b/xen/include/asm-arm/time.h
index 1b2c13614b..9b6f5a1bbe 100644
--- a/xen/include/asm-arm/time.h
+++ b/xen/include/asm-arm/time.h
@@ -66,6 +66,8 @@ extern uint64_t ns_to_ticks(s_time_t ns);
 
 void preinit_xen_time(void);
 
+void force_update_vcpu_system_time(struct vcpu *v);
+
 #endif /* __ARM_TIME_H__ */
 /*
  * Local variables:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:47:18 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:47:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227691.393899 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzYE-0008Cq-QO; Fri, 19 Nov 2021 08:47:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227691.393899; Fri, 19 Nov 2021 08:47:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzYE-0008Ci-Na; Fri, 19 Nov 2021 08:47:18 +0000
Received: by outflank-mailman (input) for mailman id 227691;
 Fri, 19 Nov 2021 08:47:17 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzYD-0008CS-3Z
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:47:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzYD-0002ZH-2m
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:47:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzYD-0001Ni-1z
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:47:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xZucQG0u4sYr/CECO2eX0e3H8wKOFS2P20EIDqzXk98=; b=VDMwTmrZDOKP3f3PVILL3ffGhZ
	ksYp/qnn5JCS2XMr12R+vj6M3wJqjVl7UzpJ1m/J8C1b1MFP1jBgRDSpUmrm+bYDalFTf041jWO3z
	0m6/n1M/MyW9hM043AjuVtDQjg+3rOG13AqZrpuhRU8g2FTNrNpij02mSo+LCbR+ZhEQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/shstk: Fix use of shadow stacks with XPTI active
Message-Id: <E1mnzYD-0001Ni-1z@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:47:17 +0000

commit 2b8381087593c3df274baa94fadbe2b89cd28158
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Nov 19 09:39:46 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:39:46 2021 +0100

    x86/shstk: Fix use of shadow stacks with XPTI active
    
    The call to setup_cpu_root_pgt(0) in smp_prepare_cpus() is too early.  It
    clones the BSP's stack while the .data mapping is still in use, causing all
    mappings to be fully read read/write (and with no guard pages either).  This
    ultimately causes #DF when trying to enter the dom0 kernel for the first time.
    
    Defer setting up BSPs XPTI pagetable until reinit_bsp_stack() after we've set
    up proper shadow stack permissions.
    
    Fixes: 60016604739b ("x86/shstk: Rework the stack layout to support shadow stacks")
    Fixes: b60ab42db2f0 ("x86/shstk: Activate Supervisor Shadow Stacks")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b2851580b1f2ff121737a37cb25a370d7692ae3b
    master date: 2021-11-03 13:08:42 +0000
---
 xen/arch/x86/setup.c   | 5 +++++
 xen/arch/x86/smpboot.c | 9 ++-------
 xen/include/xen/smp.h  | 1 +
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 01d58e4879..14654ee4df 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -658,6 +658,7 @@ static void noinline init_done(void)
 static void __init noreturn reinit_bsp_stack(void)
 {
     unsigned long *stack = (void*)(get_stack_bottom() & ~(STACK_SIZE - 1));
+    int rc;
 
     /* Update TSS and ISTs */
     load_system_tables();
@@ -668,6 +669,10 @@ static void __init noreturn reinit_bsp_stack(void)
     stack_base[0] = stack;
     memguard_guard_stack(stack);
 
+    rc = setup_cpu_root_pgt(0);
+    if ( rc )
+        panic("Error %d setting up PV root page table\n", rc);
+
     if ( IS_ENABLED(CONFIG_XEN_SHSTK) && cpu_has_xen_shstk )
     {
         wrmsrl(MSR_PL0_SSP,
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 67e727cebd..64503df8e1 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -785,7 +785,7 @@ static root_pgentry_t common_pgt;
 
 extern const char _stextentry[], _etextentry[];
 
-static int setup_cpu_root_pgt(unsigned int cpu)
+int setup_cpu_root_pgt(unsigned int cpu)
 {
     root_pgentry_t *rpt;
     unsigned int off;
@@ -1102,8 +1102,6 @@ static struct notifier_block cpu_smpboot_nfb = {
 
 void __init smp_prepare_cpus(void)
 {
-    int rc;
-
     register_cpu_notifier(&cpu_smpboot_nfb);
 
     mtrr_aps_sync_begin();
@@ -1117,10 +1115,7 @@ void __init smp_prepare_cpus(void)
 
     stack_base[0] = (void *)((unsigned long)stack_start & ~(STACK_SIZE - 1));
 
-    rc = setup_cpu_root_pgt(0);
-    if ( rc )
-        panic("Error %d setting up PV root page table\n", rc);
-    if ( per_cpu(root_pgt, 0) )
+    if ( opt_xpti_hwdom || opt_xpti_domu )
     {
         get_cpu_info()->pv_cr3 = 0;
 
diff --git a/xen/include/xen/smp.h b/xen/include/xen/smp.h
index d5a3644611..0a9219173f 100644
--- a/xen/include/xen/smp.h
+++ b/xen/include/xen/smp.h
@@ -70,5 +70,6 @@ int alloc_cpu_id(void);
 extern void *stack_base[NR_CPUS];
 
 void initialize_cpu_data(unsigned int cpu);
+int setup_cpu_root_pgt(unsigned int cpu);
 
 #endif /* __XEN_SMP_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:47:28 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:47:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227692.393904 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzYO-0008Fc-Sg; Fri, 19 Nov 2021 08:47:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227692.393904; Fri, 19 Nov 2021 08:47: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 1mnzYO-0008FT-PC; Fri, 19 Nov 2021 08:47:28 +0000
Received: by outflank-mailman (input) for mailman id 227692;
 Fri, 19 Nov 2021 08:47:27 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzYN-0008F7-6b
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:47:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzYN-0002ZU-5r
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:47:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzYN-0001OD-57
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:47:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=x88ubY7HLZgdMHTWN0hfhlZVDDIy6AkyCZIy1YH1flQ=; b=jnoUohizVwaWGoR85BZWYupSIG
	ANUIY7QbUG0YZ38BjgJ38jlxOoRnqDvbF6HbKrJPHLWT7k1HcGYWr+1CA70zkKqNbyuF/jVz2CzMA
	RtDvnVyRgEMwUhR6CMqEwzPOdSpOGe3zsv6bmbbw188sSBCDlfjCoZGnX2C61Bs8wd+w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/traps: Fix typo in do_entry_CP()
Message-Id: <E1mnzYN-0001OD-57@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:47:27 +0000

commit 9d3bac49a54ffacd44d7fffda307b211d78b2ce0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Nov 19 09:40:19 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:40:19 2021 +0100

    x86/traps: Fix typo in do_entry_CP()
    
    The call to debugger_trap_entry() should pass the correct vector.  The
    break-for-gdbsx logic is in practice unreachable because PV guests can't
    generate #CP, but it will interfere with anyone inserting custom debugging
    into debugger_trap_entry().
    
    Fixes: 5ad05b9c2490 ("x86/traps: Implement #CP handler and extend #PF for shadow stacks")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 512863ed238d7390f74d43f0ba298b1dfa8f4803
    master date: 2021-11-03 19:13:17 +0000
---
 xen/arch/x86/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index a38f10ad28..d8dd583a4a 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1975,7 +1975,7 @@ void do_entry_CP(struct cpu_user_regs *regs)
     const char *err = "??";
     unsigned int ec = regs->error_code;
 
-    if ( debugger_trap_entry(TRAP_debug, regs) )
+    if ( debugger_trap_entry(X86_EXC_CP, regs) )
         return;
 
     /* Decode ec if possible */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:47:38 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:47:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227693.393907 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzYY-0008If-Tn; Fri, 19 Nov 2021 08:47:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227693.393907; Fri, 19 Nov 2021 08:47: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 1mnzYY-0008IX-Qs; Fri, 19 Nov 2021 08:47:38 +0000
Received: by outflank-mailman (input) for mailman id 227693;
 Fri, 19 Nov 2021 08:47:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzYX-0008IH-9b
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:47:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzYX-0002Za-8t
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:47:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzYX-0001Og-87
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:47:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vs3lqDEmxWzDnYWMBh+NjH22YeCB53Y90v9U8fWJtDY=; b=bbMgKJctfjr2RA3lmgSvPbZcMZ
	oGNnNpiIDm4eBcJfdrvTnmx8kCdAMctmLgfUxYuq13aR9guWNj2u/VOjkMowF4IgnPin9A/HfR1zO
	m5vM2+P8n2BiRkkFKoqlkWgqyVNdRvW/s0IDZlRZuNGz+csGoEEEs65e6HYhwCALy4js=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/xstate: reset cached register values on resume
Message-Id: <E1mnzYX-0001Og-87@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:47:37 +0000

commit 3d031d9e79481768abf93c1aab30116806eb604f
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Fri Nov 19 09:40:44 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:40:44 2021 +0100

    x86/xstate: reset cached register values on resume
    
    set_xcr0() and set_msr_xss() use cached value to avoid setting the
    register to the same value over and over. But suspend/resume implicitly
    reset the registers and since percpu areas are not deallocated on
    suspend anymore, the cache gets stale.
    Reset the cache on resume, to ensure the next write will really hit the
    hardware. Choose value 0, as it will never be a legitimate write to
    those registers - and so, will force write (and cache update).
    
    Note the cache is used io get_xcr0() and get_msr_xss() too, but:
    - set_xcr0() is called few lines below in xstate_init(), so it will
      update the cache with appropriate value
    - get_msr_xss() is not used anywhere - and thus not before any
      set_msr_xss() that will fill the cache
    
    Fixes: aca2a985a55a "xen: don't free percpu areas during suspend"
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: f7f4a523927fa4c7598e4647a16bc3e3cf8009d0
    master date: 2021-11-04 14:42:37 +0100
---
 xen/arch/x86/xstate.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 3794d9a5a5..3bcc523f80 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -608,6 +608,13 @@ void xstate_init(struct cpuinfo_x86 *c)
         return;
     }
 
+    /*
+     * Zap the cached values to make set_xcr0() and set_msr_xss() really
+     * write it.
+     */
+    this_cpu(xcr0) = 0;
+    this_cpu(xss) = ~0;
+
     cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx);
 
     BUG_ON((eax & XSTATE_FP_SSE) != XSTATE_FP_SSE);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:47:49 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:47:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227695.393911 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzYi-0008LX-VQ; Fri, 19 Nov 2021 08:47:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227695.393911; Fri, 19 Nov 2021 08:47: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 1mnzYi-0008LP-SR; Fri, 19 Nov 2021 08:47:48 +0000
Received: by outflank-mailman (input) for mailman id 227695;
 Fri, 19 Nov 2021 08:47: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 1mnzYh-0008LI-Ct
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:47: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 1mnzYh-0002Zx-Bw
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:47:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzYh-0001PE-BK
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:47: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=tXaJVzl2C1eVuKp6ZFwi69OjTyx3PqXPE200cDuPEiI=; b=z2EY1DWK6O8nYfxJTf3kWrq264
	I+fGtF5HVr+7YO0jbT7N0t8HC4BYANVupCq8uNsV/znZlgnyDMgsQ59CQdxMCFik9+H4QP6xvKV66
	9UcMZ8YXIrzzsjHH2fkhvI/ygs4SoWKd4sBSl8W0aGsY1dkEhH08PtEpGQabZGOSan/M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/IOMMU: mark IOMMU / intremap not in use when ACPI tables are missing
Message-Id: <E1mnzYh-0001PE-BK@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:47:47 +0000

commit cdcdc28b2ad4a53131f8843bc95fb9aa50a81191
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:41:09 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:41:09 2021 +0100

    x86/IOMMU: mark IOMMU / intremap not in use when ACPI tables are missing
    
    x2apic_bsp_setup() gets called ahead of iommu_setup(), and since x2APIC
    mode (physical vs clustered) depends on iommu_intremap, that variable
    needs to be set to off as soon as we know we can't / won't enable
    interrupt remapping, i.e. in particular when parsing of the respective
    ACPI tables failed. Move the turning off of iommu_intremap from AMD
    specific code into acpi_iommu_init(), accompanying it by clearing of
    iommu_enable.
    
    Take the opportunity and also fully skip ACPI table parsing logic on
    VT-d when both "iommu=off" and "iommu=no-intremap" are in effect anyway,
    like was already the case for AMD.
    
    The tag below only references the commit uncovering a pre-existing
    anomaly.
    
    Fixes: d8bd82327b0f ("AMD/IOMMU: obtain IVHD type to use earlier")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    
    master commit: 46c4061cd2bf69e8039021af615c2bdb94e50088
    master date: 2021-11-04 14:44:01 +0100
---
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  6 ------
 xen/drivers/passthrough/vtd/dmar.c          |  6 +-----
 xen/drivers/passthrough/x86/iommu.c         | 18 ++++++++++++++++++
 xen/include/asm-x86/acpi.h                  |  8 +-------
 4 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index 3f632e5e10..627ed79508 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -155,14 +155,8 @@ static void amd_iommu_setup_domain_device(
 
 int __init acpi_ivrs_init(void)
 {
-    if ( !iommu_enable && !iommu_intremap )
-        return 0;
-
     if ( (amd_iommu_detect_acpi() !=0) || (iommu_found() == 0) )
-    {
-        iommu_intremap = iommu_intremap_off;
         return -ENODEV;
-    }
 
     iommu_init_ops = &_iommu_init_ops;
 
diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 29cd5c5d70..06d8d7dbe6 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -760,11 +760,7 @@ static int __init acpi_parse_dmar(struct acpi_table_header *table)
     dmar = (struct acpi_table_dmar *)table;
     dmar_flags = dmar->flags;
 
-    if ( !iommu_enable && !iommu_intremap )
-    {
-        ret = -EINVAL;
-        goto out;
-    }
+    ASSERT(iommu_enable || iommu_intremap);
 
     if ( !dmar->width )
     {
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index 1d7cebcc06..2db74e5a54 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -39,6 +39,24 @@ enum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full;
 bool __read_mostly iommu_intpost;
 #endif
 
+void __init acpi_iommu_init(void)
+{
+    int ret;
+
+    if ( !iommu_enable && !iommu_intremap )
+        return;
+
+    ret = acpi_dmar_init();
+    if ( ret == -ENODEV )
+        ret = acpi_ivrs_init();
+
+    if ( ret )
+    {
+        iommu_enable = false;
+        iommu_intremap = iommu_intremap_off;
+    }
+}
+
 int __init iommu_hardware_setup(void)
 {
     struct IO_APIC_route_entry **ioapic_entries = NULL;
diff --git a/xen/include/asm-x86/acpi.h b/xen/include/asm-x86/acpi.h
index 7032f3a001..9a9cc4c240 100644
--- a/xen/include/asm-x86/acpi.h
+++ b/xen/include/asm-x86/acpi.h
@@ -141,16 +141,10 @@ extern u32 x86_acpiid_to_apicid[];
 extern u32 pmtmr_ioport;
 extern unsigned int pmtmr_width;
 
+void acpi_iommu_init(void);
 int acpi_dmar_init(void);
 int acpi_ivrs_init(void);
 
-static inline int acpi_iommu_init(void)
-{
-    int ret = acpi_dmar_init();
-
-    return ret == -ENODEV ? acpi_ivrs_init() : ret;
-}
-
 void acpi_mmcfg_init(void);
 
 /* Incremented whenever we transition through S3. Value is 1 during boot. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:47:59 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:47:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227697.393915 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzYt-0008OQ-0b; Fri, 19 Nov 2021 08:47:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227697.393915; Fri, 19 Nov 2021 08:47: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 1mnzYs-0008OI-Ty; Fri, 19 Nov 2021 08:47:58 +0000
Received: by outflank-mailman (input) for mailman id 227697;
 Fri, 19 Nov 2021 08:47: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 1mnzYr-0008O6-Fy
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:47: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 1mnzYr-0002a1-FC
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:47:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzYr-0001Rj-EQ
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:47: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=kxj2nHXY/bv8UZQqXGQai2bj17RBpLZLQTuvn3s4w9M=; b=sosTmlwqY1ouRC2eSOGeBD3Tn8
	GkgQGjnErwrw3prUpSZvwX19T/Wh7iGAPEA9Ya7rr5SERY68ZVx+nBuDCKXXhDftXK24Dkzja67A9
	IcdHrf91/wqzt40aEpb48P2WJNqFImkjXy0fc8rnh3QD7ls1qQjj02J069S4DIKPC/T0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/APIC: avoid iommu_supports_x2apic() on error path
Message-Id: <E1mnzYr-0001Rj-EQ@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:47:57 +0000

commit 006897dd720fb723cda0926aaccd12cee91fba86
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:41:41 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:41:41 2021 +0100

    x86/APIC: avoid iommu_supports_x2apic() on error path
    
    The value it returns may change from true to false in case
    iommu_enable_x2apic() fails and, as a side effect, clears iommu_intremap
    (as can happen at least on AMD). Latch the return value from the first
    invocation to replace the second one.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 0f50d1696b3c13cbf0b18fec817fc291d5a30a31
    master date: 2021-11-04 14:44:43 +0100
---
 xen/arch/x86/apic.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 4a2740ccea..789af8c4da 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -864,6 +864,7 @@ void x2apic_ap_setup(void)
 void __init x2apic_bsp_setup(void)
 {
     struct IO_APIC_route_entry **ioapic_entries = NULL;
+    bool iommu_x2apic;
     const char *orig_name;
 
     if ( !cpu_has_x2apic )
@@ -879,7 +880,8 @@ void __init x2apic_bsp_setup(void)
         printk("x2APIC: Already enabled by BIOS: Ignoring cmdline disable.\n");
     }
 
-    if ( iommu_supports_x2apic() )
+    iommu_x2apic = iommu_supports_x2apic();
+    if ( iommu_x2apic )
     {
         if ( (ioapic_entries = alloc_ioapic_entries()) == NULL )
         {
@@ -932,8 +934,11 @@ void __init x2apic_bsp_setup(void)
         printk("Switched to APIC driver %s\n", genapic.name);
 
 restore_out:
-    /* iommu_x2apic_enabled cannot be used here in the error case. */
-    if ( iommu_supports_x2apic() )
+    /*
+     * iommu_x2apic_enabled and iommu_supports_x2apic() cannot be used here
+     * in the error case.
+     */
+    if ( iommu_x2apic )
     {
         /*
          * NB: do not use raw mode when restoring entries if the iommu has
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 08:48:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 08:48:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.227699.393919 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzZ3-0008R7-26; Fri, 19 Nov 2021 08:48:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 227699.393919; Fri, 19 Nov 2021 08:48:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mnzZ2-0008Qz-VT; Fri, 19 Nov 2021 08:48:08 +0000
Received: by outflank-mailman (input) for mailman id 227699;
 Fri, 19 Nov 2021 08:48:07 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzZ1-0008Qo-Iw
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:48:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzZ1-0002aM-IE
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:48:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mnzZ1-0001SQ-HU
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 08:48:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IJrMKZI7xI7/x3fqDvFGlvZwiJ8c2M4Cua9QBEYHIrk=; b=f9Oj8Og7tLVGsnkayDqkc6QRO5
	+msFQmn+QcC3D54p5X/Tb7b+zvZ/mtxjKt3WLUnkPWCaWSlucJFQx3Fq3LNUwiNol1wBJPKH+ZLte
	NpIBNA8PGE7YbzbQjSBvq3ebvRpWMaZ6Xu4LMAPN4JmHecF2dZiSwiZaiIbvoc2wl994=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] public/gnttab: relax v2 recommendation
Message-Id: <E1mnzZ1-0001SQ-HU@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 08:48:07 +0000

commit eb59f97eea86760e98e4f6a076f751939d2b8122
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:42:10 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:42:10 2021 +0100

    public/gnttab: relax v2 recommendation
    
    With there being a way to disable v2 support, telling new guests to use
    v2 exclusively is not a good suggestion.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    master commit: 2d72d2784eb71d8532bfbd6462d261739c9e82e4
    master date: 2021-11-16 17:34:06 +0100
---
 xen/include/public/grant_table.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/include/public/grant_table.h b/xen/include/public/grant_table.h
index 84b1d26b36..61be5accee 100644
--- a/xen/include/public/grant_table.h
+++ b/xen/include/public/grant_table.h
@@ -121,8 +121,9 @@ typedef uint32_t grant_ref_t;
  */
 
 /*
- * Version 1 of the grant table entry structure is maintained purely
- * for backwards compatibility.  New guests should use version 2.
+ * Version 1 of the grant table entry structure is maintained largely for
+ * backwards compatibility.  New guests are recommended to support using
+ * version 2 to overcome version 1 limitations, but to default to version 1.
  */
 #if __XEN_INTERFACE_VERSION__ < 0x0003020a
 #define grant_entry_v1 grant_entry
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 14:22:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 14:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228045.394519 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo4mD-0002PA-P6; Fri, 19 Nov 2021 14:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228045.394519; Fri, 19 Nov 2021 14:22:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo4mD-0002P0-MB; Fri, 19 Nov 2021 14:22:05 +0000
Received: by outflank-mailman (input) for mailman id 228045;
 Fri, 19 Nov 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 1mo4mC-0002Ou-Eu
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 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 1mo4mC-0000tq-Bl
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 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 1mo4mC-0000fh-AZ
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 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=/qWyGVqXGJGY1VmYrynhaz2V6huYnZGhrF5xtzpRbFE=; b=3o7Kynb7kiSloy/GayBVVM9oPO
	64mHFcEnpuOg98n2u11Fo3IckJkaps19RDk0/mkIvctZiSEIkB+Al0H0g07FRxpMjrGjiLiCPuSvH
	clh5PCyB/7Do/xLQR4wCNgf3PN1+WO4t9HR6Q1vX9l5KqX+kYL7bSG/KM3tDuv9tjyQA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: fix reduced page table levels support when sharing tables
Message-Id: <E1mo4mC-0000fh-AZ@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 14:22:04 +0000

commit 02b46377b69feb6dd3649f037e17684af9fb7853
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 15:14:08 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 15:14:08 2021 +0100

    VT-d: fix reduced page table levels support when sharing tables
    
    domain_pgd_maddr() contains logic to adjust the root address to be put
    in the context entry in case 4-level page tables aren't supported by an
    IOMMU. This logic may not be bypassed when sharing page tables.
    
    This is CVE-2021-28710 / XSA-390.
    
    Fixes: 25ccd093425c ("iommu: remove the share_p2m operation")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/drivers/passthrough/vtd/iommu.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 7b8337017a..f9ce402f22 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -340,19 +340,21 @@ static uint64_t domain_pgd_maddr(struct domain *d, unsigned int nr_pt_levels)
     {
         pagetable_t pgt = p2m_get_pagetable(p2m_get_hostp2m(d));
 
-        return pagetable_get_paddr(pgt);
+        pgd_maddr = pagetable_get_paddr(pgt);
     }
-
-    if ( !hd->arch.vtd.pgd_maddr )
+    else
     {
-        /* Ensure we have pagetables allocated down to leaf PTE. */
-        addr_to_dma_page_maddr(d, 0, 1);
-
         if ( !hd->arch.vtd.pgd_maddr )
-            return 0;
-    }
+        {
+            /* Ensure we have pagetables allocated down to leaf PTE. */
+            addr_to_dma_page_maddr(d, 0, 1);
 
-    pgd_maddr = hd->arch.vtd.pgd_maddr;
+            if ( !hd->arch.vtd.pgd_maddr )
+                return 0;
+        }
+
+        pgd_maddr = hd->arch.vtd.pgd_maddr;
+    }
 
     /* Skip top levels of page tables for 2- and 3-level DRHDs. */
     for ( agaw = level_to_agaw(4);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 14:22:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 14:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228046.394523 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo4mO-0002RY-Qf; Fri, 19 Nov 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 228046.394523; Fri, 19 Nov 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 1mo4mO-0002RQ-Ng; Fri, 19 Nov 2021 14:22:16 +0000
Received: by outflank-mailman (input) for mailman id 228046;
 Fri, 19 Nov 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 1mo4mM-0002R0-Nb
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 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 1mo4mM-0000u1-Ml
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 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 1mo4mM-0000hQ-LU
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 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=Dq3Tp9M4r2sD8yfQdd5Nn7FPgmlzunSCoDT7nOgF2Q4=; b=aVa7ZNauTtofSqlCgfSEVeOWO7
	JcuHiPaSOAnlevrYad+Iiny2afEv0HbNwl4hKIR5tKXREJxAtvONsSfHmfGG36fKALCU9jJ7a9n7M
	rNHb32a56qwvrT8WISE2P/C65tl/aKRufwwa9b6VLij+DTabyS8hzPhZWnyQ6/DU2qUg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] VT-d: fix reduced page table levels support when sharing tables
Message-Id: <E1mo4mM-0000hQ-LU@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 14:22:14 +0000

commit 963ab606b1228788eac54c1c7ff70d04bb325733
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 15:16:17 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 15:16:17 2021 +0100

    VT-d: fix reduced page table levels support when sharing tables
    
    domain_pgd_maddr() contains logic to adjust the root address to be put
    in the context entry in case 4-level page tables aren't supported by an
    IOMMU. This logic may not be bypassed when sharing page tables.
    
    This is CVE-2021-28710 / XSA-390.
    
    Fixes: 25ccd093425c ("iommu: remove the share_p2m operation")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 02b46377b69feb6dd3649f037e17684af9fb7853
    master date: 2021-11-19 15:14:08 +0100
---
 xen/drivers/passthrough/vtd/iommu.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index fbc749436b..abe7ea5ac9 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -337,19 +337,21 @@ static uint64_t domain_pgd_maddr(struct domain *d, unsigned int nr_pt_levels)
     {
         pagetable_t pgt = p2m_get_pagetable(p2m_get_hostp2m(d));
 
-        return pagetable_get_paddr(pgt);
+        pgd_maddr = pagetable_get_paddr(pgt);
     }
-
-    if ( !hd->arch.vtd.pgd_maddr )
+    else
     {
-        /* Ensure we have pagetables allocated down to leaf PTE. */
-        addr_to_dma_page_maddr(d, 0, 1);
-
         if ( !hd->arch.vtd.pgd_maddr )
-            return 0;
-    }
+        {
+            /* Ensure we have pagetables allocated down to leaf PTE. */
+            addr_to_dma_page_maddr(d, 0, 1);
 
-    pgd_maddr = hd->arch.vtd.pgd_maddr;
+            if ( !hd->arch.vtd.pgd_maddr )
+                return 0;
+        }
+
+        pgd_maddr = hd->arch.vtd.pgd_maddr;
+    }
 
     /* Skip top levels of page tables for 2- and 3-level DRHDs. */
     for ( agaw = level_to_agaw(4);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 14:44:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 14:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228076.394582 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo57U-0007JX-TE; Fri, 19 Nov 2021 14:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228076.394582; Fri, 19 Nov 2021 14:44:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo57U-0007JP-Pw; Fri, 19 Nov 2021 14:44:04 +0000
Received: by outflank-mailman (input) for mailman id 228076;
 Fri, 19 Nov 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 1mo57U-0007JJ-6g
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 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 1mo57U-0001H9-3m
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 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 1mo57U-00021c-2f
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 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=VcY2kKOvou6jcs+9bTyJEgfQYBYO9JsxTbuRg7PsKK4=; b=32CoLHiI1TE5uu7NHT3DY0nY+G
	r4WskETVHrDG9+eUS3szVxhZ0Md9SrvDvSoARJtN2/gwDkTtbP8IPJ1jFN+pYm88k02LJCZWTC6GF
	Jrwg+GC1mknwZoQD141LXg/Q34gbaHLft2rmaT8X2ChMuLYCj644vABWRdYf0qrrUPmI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] golang/xenlight: regen generated code
Message-Id: <E1mo57U-00021c-2f@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 14:44:04 +0000

commit 24d7cc416bba1f88da4c7b2649ac32486229b97b
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Nov 19 10:29:48 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Fri Nov 19 14:33:55 2021 +0000

    golang/xenlight: regen generated code
    
    Fixes: 7379f9e10a3b ("gnttab: allow setting max version per-domain")
    Fixes: 1e6706b0d123 ("xen/arm: Introduce gpaddr_bits field to struct xen_domctl_getdomaininfo")
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Nick Rosbrook <rosbrookn@ainfosec.com>
    Acked-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/golang/xenlight/helpers.gen.go | 4 ++++
 tools/golang/xenlight/types.gen.go   | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 6e1b054310..b746ff1081 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -323,6 +323,7 @@ x.CpuTime = uint64(xc.cpu_time)
 x.VcpuMaxId = uint32(xc.vcpu_max_id)
 x.VcpuOnline = uint32(xc.vcpu_online)
 x.Cpupool = uint32(xc.cpupool)
+x.GpaddrBits = byte(xc.gpaddr_bits)
 x.DomainType = DomainType(xc.domain_type)
 
  return nil}
@@ -355,6 +356,7 @@ xc.cpu_time = C.uint64_t(x.CpuTime)
 xc.vcpu_max_id = C.uint32_t(x.VcpuMaxId)
 xc.vcpu_online = C.uint32_t(x.VcpuOnline)
 xc.cpupool = C.uint32_t(x.Cpupool)
+xc.gpaddr_bits = C.uint8_t(x.GpaddrBits)
 xc.domain_type = C.libxl_domain_type(x.DomainType)
 
  return nil
@@ -1012,6 +1014,7 @@ return fmt.Errorf("converting field VnumaNodes: %v", err) }
 }
 x.MaxGrantFrames = uint32(xc.max_grant_frames)
 x.MaxMaptrackFrames = uint32(xc.max_maptrack_frames)
+x.MaxGrantVersion = int(xc.max_grant_version)
 x.DeviceModelVersion = DeviceModelVersion(xc.device_model_version)
 if err := x.DeviceModelStubdomain.fromC(&xc.device_model_stubdomain);err != nil {
 return fmt.Errorf("converting field DeviceModelStubdomain: %v", err)
@@ -1341,6 +1344,7 @@ return fmt.Errorf("converting field VnumaNodes: %v", err)
 }
 xc.max_grant_frames = C.uint32_t(x.MaxGrantFrames)
 xc.max_maptrack_frames = C.uint32_t(x.MaxMaptrackFrames)
+xc.max_grant_version = C.int(x.MaxGrantVersion)
 xc.device_model_version = C.libxl_device_model_version(x.DeviceModelVersion)
 if err := x.DeviceModelStubdomain.toC(&xc.device_model_stubdomain); err != nil {
 return fmt.Errorf("converting field DeviceModelStubdomain: %v", err)
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index a0acfaacc3..b1e84d5258 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -316,6 +316,7 @@ CpuTime uint64
 VcpuMaxId uint32
 VcpuOnline uint32
 Cpupool uint32
+GpaddrBits byte
 DomainType DomainType
 }
 
@@ -479,6 +480,7 @@ BlkdevStart string
 VnumaNodes []VnodeInfo
 MaxGrantFrames uint32
 MaxMaptrackFrames uint32
+MaxGrantVersion int
 DeviceModelVersion DeviceModelVersion
 DeviceModelStubdomain Defbool
 StubdomainMemkb uint64
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 17:11:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 17:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228145.394699 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo7Pm-0001nL-3i; Fri, 19 Nov 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 228145.394699; Fri, 19 Nov 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 1mo7Pm-0001nC-0u; Fri, 19 Nov 2021 17:11:06 +0000
Received: by outflank-mailman (input) for mailman id 228145;
 Fri, 19 Nov 2021 17:11:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo7Pk-0001n1-MF
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 17:11:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo7Pk-0004G2-LO
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 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 1mo7Pk-00077R-K9
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 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=VChtGELtw6MseClMnRkMhetwbfEBgm+fITe1hTWY+9A=; b=eoZuD5exo+5rGpVHFNlBqsOq4y
	09D7LALMmEg/18yLQMHIVLAgWEgrsdfRhbYJEjcNrWqmpE7bZBYSP8tP7vhBZux/rkyjsr35D88zs
	Iwu42E15Q1G2LBawZPbYPMBQOTr60HX9yQRnA6QAk1HEFUi7KvUGFN/4DtxoYSWqboy8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] efi: fix alignment of function parameters in compat mode
Message-Id: <E1mo7Pk-00077R-K9@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 17:11:04 +0000

commit be12fcca8b784e456df3adedbffe657d753c5ff9
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Nov 18 09:28:06 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Fri Nov 19 17:01:24 2021 +0000

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

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


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 19:22:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 19:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228220.394863 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9SV-00055e-9t; Fri, 19 Nov 2021 19:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228220.394863; Fri, 19 Nov 2021 19: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 1mo9SV-00055V-6d; Fri, 19 Nov 2021 19:22:03 +0000
Received: by outflank-mailman (input) for mailman id 228220;
 Fri, 19 Nov 2021 19:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9ST-00054v-Kt
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9ST-0006YS-K2
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9ST-0006sN-J5
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8PmLpnf8jT8+BHE/SoBFrCi+KnWNiJ3k00mDREzamZU=; b=nECyc5+WH987N3W50H/OmevN2O
	hRA1f2MIBMfKKt+bZl6tp7i7eHLHT0p0W8fuc4ZZHjcnr3QZjoKaRo2rh3iu9MZStprYmXHX/iyzK
	EVFZAIgHJJZAEygjWnWGcXnonVABWkrILJnEaQTmDhRS/RhJ7/p0PhspX5Uvb/zkTvtQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] build: fix dependencies in arch/x86/boot
Message-Id: <E1mo9ST-0006sN-J5@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 19:22:01 +0000

commit 7eaf2a39c4061bdd7d1948f4848926ed5b5058b7
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Nov 19 09:26:54 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:26:54 2021 +0100

    build: fix dependencies in arch/x86/boot
    
    Temporary fix the list of headers that cmdline.c and reloc.c depends
    on, until the next time the list is out of sync again.
    
    Also, add the linker script to the list.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2f5f0a1b77161993c16c4cc243467d75e5b7633b
    master date: 2021-10-14 12:35:42 +0200
---
 xen/arch/x86/boot/Makefile   | 9 ++++++---
 xen/arch/x86/boot/build32.mk | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 9b31bfcbfb..d2eb277d42 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -2,19 +2,22 @@ obj-bin-y += head.o
 
 DEFS_H_DEPS = defs.h $(BASEDIR)/include/xen/stdbool.h
 
-CMDLINE_DEPS = $(DEFS_H_DEPS) video.h
+CMDLINE_DEPS = $(DEFS_H_DEPS) video.h \
+	       $(BASEDIR)/include/xen/kconfig.h \
+	       $(BASEDIR)/include/generated/autoconf.h
 
 RELOC_DEPS = $(DEFS_H_DEPS) \
 	     $(BASEDIR)/include/generated/autoconf.h \
 	     $(BASEDIR)/include/xen/kconfig.h \
 	     $(BASEDIR)/include/xen/multiboot.h \
 	     $(BASEDIR)/include/xen/multiboot2.h \
+	     $(BASEDIR)/include/xen/const.h \
 	     $(BASEDIR)/include/public/arch-x86/hvm/start_info.h
 
 head.o: cmdline.S reloc.S
 
-cmdline.S: cmdline.c $(CMDLINE_DEPS)
+cmdline.S: cmdline.c $(CMDLINE_DEPS) build32.lds
 	$(MAKE) -f build32.mk $@ CMDLINE_DEPS="$(CMDLINE_DEPS)"
 
-reloc.S: reloc.c $(RELOC_DEPS)
+reloc.S: reloc.c $(RELOC_DEPS) build32.lds
 	$(MAKE) -f build32.mk $@ RELOC_DEPS="$(RELOC_DEPS)"
diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
index 8cd5403926..e90680cd9f 100644
--- a/xen/arch/x86/boot/build32.mk
+++ b/xen/arch/x86/boot/build32.mk
@@ -27,7 +27,7 @@ CFLAGS := $(filter-out -flto,$(CFLAGS))
 		done
 	$(OBJCOPY) -O binary -R .got.plt $< $@
 
-%.lnk: %.o
+%.lnk: %.o build32.lds
 	$(LD) $(LDFLAGS_DIRECT) -N -T build32.lds -o $@ $<
 
 %.o: %.c
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 19:22:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 19:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228224.394867 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9Sf-0005ET-BF; Fri, 19 Nov 2021 19:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228224.394867; Fri, 19 Nov 2021 19: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 1mo9Sf-0005EL-8E; Fri, 19 Nov 2021 19:22:13 +0000
Received: by outflank-mailman (input) for mailman id 228224;
 Fri, 19 Nov 2021 19:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9Sd-0005Cs-Ob
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9Sd-0006YW-Nh
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9Sd-0006tJ-Mj
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Q1B/VTBSeRemgipE/MWF8blW9AJXgMbzIsdnsWm0XfA=; b=UA7RTGduQx1nyVinwxpz01pk/q
	cL4VaDGRIm8UGPOrTQvo3mA4mXFJwpvlTBKywMqxNbu/zOvR7QGP9iYzY2lfma91Eun2u7E6URZa/
	cbGlx84adJan9KJS1F9z/d1EqOa8O2Swd60BhF5+5PrJtuMpn2WM2oshSGRZ7xHCb9Mo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/HVM: correct cleanup after failed viridian_vcpu_init()
Message-Id: <E1mo9Sd-0006tJ-Mj@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 19:22:11 +0000

commit 93f9c29a2a1ae464c808841b858352b7669bbd75
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:27:42 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:27:42 2021 +0100

    x86/HVM: correct cleanup after failed viridian_vcpu_init()
    
    This happens after nestedhvm_vcpu_initialise(), so its effects also need
    to be undone.
    
    Fixes: 40a4a9d72d16 ("viridian: add init hooks")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 66675056c6e59b8a8b651a29ef53c63e9e04f58d
    master date: 2021-10-18 14:21:17 +0200
---
 xen/arch/x86/hvm/hvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index e7bcffebc4..f336ffa393 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1580,7 +1580,7 @@ int hvm_vcpu_initialise(struct vcpu *v)
 
     rc = viridian_vcpu_init(v);
     if ( rc )
-        goto fail5;
+        goto fail6;
 
     rc = ioreq_server_add_vcpu_all(d, v);
     if ( rc != 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 19:22:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 19:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228226.394870 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9Sp-0005ID-Cn; Fri, 19 Nov 2021 19:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228226.394870; Fri, 19 Nov 2021 19: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 1mo9Sp-0005I7-9g; Fri, 19 Nov 2021 19:22:23 +0000
Received: by outflank-mailman (input) for mailman id 228226;
 Fri, 19 Nov 2021 19:22:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9Sn-0005Ho-Sn
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:22:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9Sn-0006Yv-Ry
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:22:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9Sn-0006uS-Qp
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:22:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vJky8oxveRuiaIcABfbt3nbS0wAmTbSFlyb7PK6KzAY=; b=mrYc+P4KWJQZ61z6f2X99bOUYt
	QrKn81c6p9Cz2hF1h8CMzfotwV2SmIqjiNetO5/kTOfE/MJ0dPZR2PboHGT2HSyyCtZdNqby673gG
	mqXML/Co3igGrif+5ir6v/ytPxQYWkrp46BYuImQhPIiVbXKajIKzAxEAgh0xXlmlLko=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86emul: de-duplicate scatters to the same linear address
Message-Id: <E1mo9Sn-0006uS-Qp@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 19:22:21 +0000

commit d23e96ede24e6e6701ee531f2e91dc7366f4c784
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:28:18 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:28:18 2021 +0100

    x86emul: de-duplicate scatters to the same linear address
    
    The SDM specifically allows for earlier writes to fully overlapping
    ranges to be dropped. If a guest did so, hvmemul_phys_mmio_access()
    would crash it if varying data was written to the same address. Detect
    overlaps early, as doing so in hvmemul_{linear,phys}_mmio_access() would
    be quite a bit more difficult. To maintain proper faulting behavior,
    instead of dropping earlier write instances of fully overlapping slots
    altogether, write the data of the final of these slots multiple times.
    (We also can't pull ahead the [single] write of the data of the last of
    the slots, clearing all involved slots' op_mask bits together, as this
    would yield incorrect results if there were intervening partially
    overlapping ones.)
    
    Note that due to cache slot use being linear address based, there's no
    similar issue with multiple writes to the same physical address (mapped
    through different linear addresses).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: a8cddbac5051020bb4a59a7f0ea27500c51063fb
    master date: 2021-10-19 10:02:39 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 7bfb91dfff..dc281971ee 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -10041,15 +10041,36 @@ x86_emulate(
 
         for ( i = 0; op_mask; ++i )
         {
-            long idx = b & 1 ? index.qw[i] : index.dw[i];
+            long idx = (b & 1 ? index.qw[i]
+                              : index.dw[i]) * (1 << state->sib_scale);
+            unsigned long offs = truncate_ea(ea.mem.off + idx);
+            unsigned int j, slot;
 
             if ( !(op_mask & (1 << i)) )
                 continue;
 
-            rc = ops->write(ea.mem.seg,
-                            truncate_ea(ea.mem.off +
-                                        idx * (1 << state->sib_scale)),
-                            (void *)mmvalp + i * op_bytes, op_bytes, ctxt);
+            /*
+             * hvmemul_linear_mmio_access() will find a cache slot based on
+             * linear address.  hvmemul_phys_mmio_access() will crash the
+             * domain if observing varying data getting written to the same
+             * cache slot.  Utilize that squashing earlier writes to fully
+             * overlapping addresses is permitted by the spec.  We can't,
+             * however, drop the writes altogether, to maintain correct
+             * faulting behavior.  Instead write the data from the last of
+             * the fully overlapping slots multiple times.
+             */
+            for ( j = (slot = i) + 1; j < n; ++j )
+            {
+                long idx2 = (b & 1 ? index.qw[j]
+                                   : index.dw[j]) * (1 << state->sib_scale);
+
+                if ( (op_mask & (1 << j)) &&
+                     truncate_ea(ea.mem.off + idx2) == offs )
+                    slot = j;
+            }
+
+            rc = ops->write(ea.mem.seg, offs,
+                            (void *)mmvalp + slot * op_bytes, op_bytes, ctxt);
             if ( rc != X86EMUL_OKAY )
             {
                 /* See comment in gather emulation. */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 19:22:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 19:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228228.394875 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9Sz-0005MZ-Fq; Fri, 19 Nov 2021 19:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228228.394875; Fri, 19 Nov 2021 19: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 1mo9Sz-0005MR-CW; Fri, 19 Nov 2021 19:22:33 +0000
Received: by outflank-mailman (input) for mailman id 228228;
 Fri, 19 Nov 2021 19: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 1mo9Sx-0005M3-Vu
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:22:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9Sx-0006Z7-V4
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:22:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9Sx-0006vR-UH
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:22:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NPI8nmL8oHXTCK+LdpXbm5LKceirI6mCbBNuz9wENDc=; b=tUzGxnzOAhFvHuhp9eTVbJdV9T
	zPneP4KeKEQsBPi9wk6edpute4svSCHRk3KSvN8ak1RD28WJPH2f9fLPdcWpedUkHgj3lPNHvgTMC
	nBfWNWZ2/qrkXL8Ev6xtjW6hUonDxmNMERshiqxdiITyT1pipzaO2H1Wtq8pPddDqo9I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/AMD: make HT range dynamic for Fam17 and up
Message-Id: <E1mo9Sx-0006vR-UH@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 19:22:31 +0000

commit e8a444817474333d63a583d7a118945f32c4efc5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:28:50 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:28:50 2021 +0100

    x86/AMD: make HT range dynamic for Fam17 and up
    
    At the time of d838ac2539cf ("x86: don't allow Dom0 access to the HT
    address range") documentation correctly stated that the range was
    completely fixed. For Fam17 and newer, it lives at the top of physical
    address space, though.
    
    To correctly determine the top of physical address space, we need to
    account for their physical address reduction, hence the calculation of
    paddr_bits also gets adjusted.
    
    While for paddr_bits < 40 the HT range is completely hidden, there's no
    need to suppress the range insertion in that case: It'll just have no
    real meaning.
    
    Reported-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: d6e38eea2d806c53d976603717aebf6e5de30a1e
    master date: 2021-10-19 10:04:13 +0200
---
 xen/arch/x86/cpu/common.c | 7 +++++++
 xen/arch/x86/dom0_build.c | 7 +++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index e5c3caf41d..cab3befeac 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -336,16 +336,23 @@ void __init early_cpu_init(void)
 
 	eax = cpuid_eax(0x80000000);
 	if ((eax >> 16) == 0x8000 && eax >= 0x80000008) {
+		ebx = eax >= 0x8000001f ? cpuid_ebx(0x8000001f) : 0;
 		eax = cpuid_eax(0x80000008);
+
 		paddr_bits = eax & 0xff;
 		if (paddr_bits > PADDR_BITS)
 			paddr_bits = PADDR_BITS;
+
 		vaddr_bits = (eax >> 8) & 0xff;
 		if (vaddr_bits > VADDR_BITS)
 			vaddr_bits = VADDR_BITS;
+
 		hap_paddr_bits = ((eax >> 16) & 0xff) ?: paddr_bits;
 		if (hap_paddr_bits > PADDR_BITS)
 			hap_paddr_bits = PADDR_BITS;
+
+		/* Account for SME's physical address space reduction. */
+		paddr_bits -= (ebx >> 6) & 0x3f;
 	}
 
 	if (!(c->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)))
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 74b443e509..fe24e11b37 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -524,8 +524,11 @@ int __init dom0_setup_permissions(struct domain *d)
                                          MSI_ADDR_DEST_ID_MASK));
     /* HyperTransport range. */
     if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
-        rc |= iomem_deny_access(d, paddr_to_pfn(0xfdULL << 32),
-                                paddr_to_pfn((1ULL << 40) - 1));
+    {
+        mfn = paddr_to_pfn(1UL <<
+                           (boot_cpu_data.x86 < 0x17 ? 40 : paddr_bits));
+        rc |= iomem_deny_access(d, mfn - paddr_to_pfn(3UL << 32), mfn - 1);
+    }
 
     /* Remove access to E820_UNUSABLE I/O regions above 1MB. */
     for ( i = 0; i < e820.nr_map; i++ )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 19:22:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 19:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228231.394879 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9T9-0005Pg-HJ; Fri, 19 Nov 2021 19:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228231.394879; Fri, 19 Nov 2021 19:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9T9-0005PW-EC; Fri, 19 Nov 2021 19:22:43 +0000
Received: by outflank-mailman (input) for mailman id 228231;
 Fri, 19 Nov 2021 19:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9T8-0005PA-2v
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9T8-0006ZH-2D
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9T8-0006wW-1I
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19: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=A2lLCxAKOTJ8M0TDF0bDopKQ+8+agE6qw6IXYkpOrKo=; b=k9gZkE6J6ZcxEi2QzkS0F0HrUJ
	DVNNr/XaAt+VNCNzNVp+nxsfucqd0ditlp+9AVcVoGTDgDTjhR/cVRbU9jatF8/q5dbOUt8Dmo4NG
	HPU1edC07tCj2D0EAWVaztIon+OQJLHYIlgPOAljAEFQnv8EEe+fJLkGQvcPvtCceBko=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/PV: make '0' debug key dump Dom0's stacks again
Message-Id: <E1mo9T8-0006wW-1I@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 19:22:42 +0000

commit b033a41572333936b9b859280875fc73e72c3e47
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:29:12 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:29:12 2021 +0100

    x86/PV: make '0' debug key dump Dom0's stacks again
    
    The conversion to __get_guest() failed to account for the fact that for
    remote vCPU-s dumping gets done through a pointer obtained from
    map_domain_page(): __get_guest() arranges for (apparent) accesses to
    hypervisor space to cause #GP(0).
    
    Fixes: 6a1d72d3739e ('x86: split __{get,put}_user() into "guest" and "unsafe" variants')
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 4843546fef5e024d5754f722fd01a8dfb482ac7d
    master date: 2021-10-19 10:07:00 +0200
---
 xen/arch/x86/traps.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 939c91a0ca..948e422397 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -274,7 +274,9 @@ static void compat_show_guest_stack(struct vcpu *v,
     {
         if ( (((long)stack - 1) ^ ((long)(stack + 1) - 1)) & mask )
             break;
-        if ( __get_guest(addr, stack) )
+        if ( stack_page )
+            addr = *stack;
+        else if ( __get_guest(addr, stack) )
         {
             if ( i != 0 )
                 printk("\n    ");
@@ -343,7 +345,9 @@ 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_guest(addr, stack) )
+        if ( stack_page )
+            addr = *stack;
+        else if ( __get_guest(addr, stack) )
         {
             if ( i != 0 )
                 printk("\n    ");
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 19:22:53 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 19:22:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228233.394883 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9TJ-0005TA-IZ; Fri, 19 Nov 2021 19:22:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228233.394883; Fri, 19 Nov 2021 19:22:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9TJ-0005T2-Ff; Fri, 19 Nov 2021 19:22:53 +0000
Received: by outflank-mailman (input) for mailman id 228233;
 Fri, 19 Nov 2021 19:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9TI-0005SZ-6H
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9TI-0006Zk-5U
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9TI-0006xn-4d
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+EdNE8pfl4zF7SC9c8+7QcmA0ipCzL2dredGcR5OI4k=; b=DNfa7RWyNg2+A9vNywKGw4gOWo
	HjOy3NEYA8O4VT8aFob7kkkUcCyx7KuLBpD6YNkNImJUP0eT6DxCwFDBcWc/jrah+00FGVcmWwfc2
	pLERs9mhE0EMkSVZDTRMGl2XLAL/5qsKj8OIOHpORgdWbfW0qZb4xcrebUtTfQlGwAj4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/paging: restrict physical address width reported to guests
Message-Id: <E1mo9TI-0006xn-4d@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 19:22:52 +0000

commit cae4b7b129390af798cd49986b72a00f88d8a54f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:29:36 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:29:36 2021 +0100

    x86/paging: restrict physical address width reported to guests
    
    Modern hardware may report more than 48 bits of physical address width.
    For paging-external guests our P2M implementation does not cope with
    larger values. Telling the guest of more available bits means misleading
    it into perhaps trying to actually put some page there (like was e.g.
    intermediately done in OVMF for the shared info page).
    
    While there also convert the PV check to a paging-external one (which in
    our current code base are synonyms of one another anyway).
    
    Fixes: 5dbd60e16a1f ("x86/shadow: Correct guest behaviour when creating PTEs above maxphysaddr")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: b7635526acffbe4ad8ad16fd92812c57742e54c2
    master date: 2021-10-19 10:08:30 +0200
---
 xen/include/asm-x86/paging.h | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index 7332a9b506..614ac797e5 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -394,11 +394,18 @@ static always_inline unsigned int paging_max_paddr_bits(const struct domain *d)
 {
     unsigned int bits = paging_mode_hap(d) ? hap_paddr_bits : paddr_bits;
 
-    if ( !IS_ENABLED(CONFIG_BIGMEM) && paging_mode_shadow(d) &&
-         !is_pv_domain(d) )
+    if ( paging_mode_external(d) )
     {
-        /* Shadowed superpages store GFNs in 32-bit page_info fields. */
-        bits = min(bits, 32U + PAGE_SHIFT);
+        if ( !IS_ENABLED(CONFIG_BIGMEM) && paging_mode_shadow(d) )
+        {
+            /* Shadowed superpages store GFNs in 32-bit page_info fields. */
+            bits = min(bits, 32U + PAGE_SHIFT);
+        }
+        else
+        {
+            /* Both p2m-ept and p2m-pt only support 4-level page tables. */
+            bits = min(bits, 48U);
+        }
     }
 
     return bits;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 19:23:03 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 19:23:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228235.394887 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9TT-0005WP-K8; Fri, 19 Nov 2021 19:23:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228235.394887; Fri, 19 Nov 2021 19:23:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9TT-0005WF-H9; Fri, 19 Nov 2021 19:23:03 +0000
Received: by outflank-mailman (input) for mailman id 228235;
 Fri, 19 Nov 2021 19:23:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9TS-0005W3-9W
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:23:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9TS-0006aA-8c
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9TS-00070W-7z
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:23:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DPdrjSEVEzO6XgW47b0hbE1if11SJTDpT88L4VYlauk=; b=O46qpmqM5hgmpUtZtanEjF32Ya
	367C6nG1b9UtdhgUR/QdvaGB4B+qnW/iYI4HdkgyGNvNFwuOnfB2/lHDw+NI0JH0MQ90fUoT18GkU
	m2c4zwLdtfrIhJuD//qlUlo/qOj7AoDdMbij2JebL7U10ebXW6mWaQ0kxEeGe0esWrm8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] update system time immediately when VCPUOP_register_vcpu_info
Message-Id: <E1mo9TS-00070W-7z@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 19:23:02 +0000

commit 751efc5882f54f45d9c895d6745a1d95f1359dec
Author:     Dongli Zhang <dongli.zhang@oracle.com>
AuthorDate: Fri Nov 19 09:30:14 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:30:14 2021 +0100

    update system time immediately when VCPUOP_register_vcpu_info
    
    The guest may access the pv vcpu_time_info immediately after
    VCPUOP_register_vcpu_info. This is to borrow the idea of
    VCPUOP_register_vcpu_time_memory_area, where the
    force_update_vcpu_system_time() is called immediately when the new memory
    area is registered.
    
    Otherwise, we may observe clock drift at the VM side if the VM accesses
    the clocksource immediately after VCPUOP_register_vcpu_info().
    
    Reference: https://lists.xenproject.org/archives/html/xen-devel/2021-10/msg00571.html
    Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b67f09721f136cc3a9afcb6a82466d1bd27aa6c0
    master date: 2021-11-03 10:19:06 +0100
---
 xen/arch/arm/time.c        | 5 +++++
 xen/common/domain.c        | 2 ++
 xen/include/asm-arm/time.h | 2 ++
 3 files changed, 9 insertions(+)

diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
index b0021c2c69..620ac202f3 100644
--- a/xen/arch/arm/time.c
+++ b/xen/arch/arm/time.c
@@ -351,6 +351,11 @@ void update_vcpu_system_time(struct vcpu *v)
     /* XXX update shared_info->wc_* */
 }
 
+void force_update_vcpu_system_time(struct vcpu *v)
+{
+    update_vcpu_system_time(v);
+}
+
 void domain_set_time_offset(struct domain *d, int64_t time_offset_seconds)
 {
     d->time_offset.seconds = time_offset_seconds;
diff --git a/xen/common/domain.c b/xen/common/domain.c
index fe39fb9177..17cc32fde3 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1694,6 +1694,8 @@ long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg)
         rc = map_vcpu_info(v, info.mfn, info.offset);
         domain_unlock(d);
 
+        force_update_vcpu_system_time(v);
+
         break;
     }
 
diff --git a/xen/include/asm-arm/time.h b/xen/include/asm-arm/time.h
index 6b8fd839dd..4b401c1110 100644
--- a/xen/include/asm-arm/time.h
+++ b/xen/include/asm-arm/time.h
@@ -105,6 +105,8 @@ extern uint64_t ns_to_ticks(s_time_t ns);
 
 void preinit_xen_time(void);
 
+void force_update_vcpu_system_time(struct vcpu *v);
+
 #endif /* __ARM_TIME_H__ */
 /*
  * Local variables:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 19:23:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 19:23:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228237.394891 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9Td-0005Zu-Lg; Fri, 19 Nov 2021 19:23:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228237.394891; Fri, 19 Nov 2021 19:23:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9Td-0005Zm-Ih; Fri, 19 Nov 2021 19:23:13 +0000
Received: by outflank-mailman (input) for mailman id 228237;
 Fri, 19 Nov 2021 19:23:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9Tc-0005ZM-Cg
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:23:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9Tc-0006aM-By
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:23:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9Tc-00071Q-BA
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:23:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ym6g2LJShtNNzA2shFiuA9AnWw8+WkNmsvPs8vZudKc=; b=0X93dPB4JcSBRwBk1Gk+gfKQd/
	fsMMc4kgnijDFwYNQIOGUIo59Vu4bWeck1DzOl72NPZIC35BGCmzpgCu94kyDGoDvs26HLEBWSfv9
	ZE8RAlskwMn7ijBuWXeKuzmEXPS2C3y9DjqFQm0khBDDMT/jcL11U549C5OQ8mQtimoA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/shstk: Fix use of shadow stacks with XPTI active
Message-Id: <E1mo9Tc-00071Q-BA@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 19:23:12 +0000

commit c61cd82e01d58f04384afb78069afe71d994ef14
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Nov 19 09:30:42 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:30:42 2021 +0100

    x86/shstk: Fix use of shadow stacks with XPTI active
    
    The call to setup_cpu_root_pgt(0) in smp_prepare_cpus() is too early.  It
    clones the BSP's stack while the .data mapping is still in use, causing all
    mappings to be fully read read/write (and with no guard pages either).  This
    ultimately causes #DF when trying to enter the dom0 kernel for the first time.
    
    Defer setting up BSPs XPTI pagetable until reinit_bsp_stack() after we've set
    up proper shadow stack permissions.
    
    Fixes: 60016604739b ("x86/shstk: Rework the stack layout to support shadow stacks")
    Fixes: b60ab42db2f0 ("x86/shstk: Activate Supervisor Shadow Stacks")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b2851580b1f2ff121737a37cb25a370d7692ae3b
    master date: 2021-11-03 13:08:42 +0000
---
 xen/arch/x86/setup.c   | 5 +++++
 xen/arch/x86/smpboot.c | 9 ++-------
 xen/include/xen/smp.h  | 1 +
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 68454df8ed..59955aadb9 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -664,6 +664,7 @@ static void noreturn init_done(void)
 static void __init noreturn reinit_bsp_stack(void)
 {
     unsigned long *stack = (void*)(get_stack_bottom() & ~(STACK_SIZE - 1));
+    int rc;
 
     /* Update TSS and ISTs */
     load_system_tables();
@@ -674,6 +675,10 @@ static void __init noreturn reinit_bsp_stack(void)
     stack_base[0] = stack;
     memguard_guard_stack(stack);
 
+    rc = setup_cpu_root_pgt(0);
+    if ( rc )
+        panic("Error %d setting up PV root page table\n", rc);
+
     if ( IS_ENABLED(CONFIG_XEN_SHSTK) && cpu_has_xen_shstk )
     {
         wrmsrl(MSR_PL0_SSP,
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 82c1012e89..f1dda9d305 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -805,7 +805,7 @@ static root_pgentry_t common_pgt;
 
 extern const char _stextentry[], _etextentry[];
 
-static int setup_cpu_root_pgt(unsigned int cpu)
+int setup_cpu_root_pgt(unsigned int cpu)
 {
     root_pgentry_t *rpt;
     unsigned int off;
@@ -1122,8 +1122,6 @@ static struct notifier_block cpu_smpboot_nfb = {
 
 void __init smp_prepare_cpus(void)
 {
-    int rc;
-
     register_cpu_notifier(&cpu_smpboot_nfb);
 
     mtrr_aps_sync_begin();
@@ -1137,10 +1135,7 @@ void __init smp_prepare_cpus(void)
 
     stack_base[0] = (void *)((unsigned long)stack_start & ~(STACK_SIZE - 1));
 
-    rc = setup_cpu_root_pgt(0);
-    if ( rc )
-        panic("Error %d setting up PV root page table\n", rc);
-    if ( per_cpu(root_pgt, 0) )
+    if ( opt_xpti_hwdom || opt_xpti_domu )
     {
         get_cpu_info()->pv_cr3 = 0;
 
diff --git a/xen/include/xen/smp.h b/xen/include/xen/smp.h
index d5a3644611..0a9219173f 100644
--- a/xen/include/xen/smp.h
+++ b/xen/include/xen/smp.h
@@ -70,5 +70,6 @@ int alloc_cpu_id(void);
 extern void *stack_base[NR_CPUS];
 
 void initialize_cpu_data(unsigned int cpu);
+int setup_cpu_root_pgt(unsigned int cpu);
 
 #endif /* __XEN_SMP_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 19:23:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 19:23:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228239.394895 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9Tn-0005dF-NH; Fri, 19 Nov 2021 19:23:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228239.394895; Fri, 19 Nov 2021 19:23:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9Tn-0005d7-KF; Fri, 19 Nov 2021 19:23:23 +0000
Received: by outflank-mailman (input) for mailman id 228239;
 Fri, 19 Nov 2021 19:23:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9Tm-0005cp-Hx
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:23:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9Tm-0006ak-FS
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:23:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9Tm-00072L-EZ
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:23:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=agm9TQNL//VCi9VdrdceNl09MV+6m6weZn/byojscvs=; b=csLv8MGSZwiKr0OxfSCMbHYnDM
	jBIRo7Dd0DalNLpdthuhAOnBEiu0yB39v4r80XFLryd3SnSP3ZY+JbBEtkN36v9fTVxmB/KueXloj
	4++wUx7Hgji4N5DNbWOq8V0bwWB29m5RyUCWVG4Wbvfb6d2BhxNmceAjiji254ed71wo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/traps: Fix typo in do_entry_CP()
Message-Id: <E1mo9Tm-00072L-EZ@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 19:23:22 +0000

commit 541ae912077e894fb7d8ee73cd03355bae08387f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Nov 19 09:31:14 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:31:14 2021 +0100

    x86/traps: Fix typo in do_entry_CP()
    
    The call to debugger_trap_entry() should pass the correct vector.  The
    break-for-gdbsx logic is in practice unreachable because PV guests can't
    generate #CP, but it will interfere with anyone inserting custom debugging
    into debugger_trap_entry().
    
    Fixes: 5ad05b9c2490 ("x86/traps: Implement #CP handler and extend #PF for shadow stacks")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 512863ed238d7390f74d43f0ba298b1dfa8f4803
    master date: 2021-11-03 19:13:17 +0000
---
 xen/arch/x86/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 948e422397..10efcc6585 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2022,7 +2022,7 @@ void do_entry_CP(struct cpu_user_regs *regs)
     const char *err = "??";
     unsigned int ec = regs->error_code;
 
-    if ( debugger_trap_entry(TRAP_debug, regs) )
+    if ( debugger_trap_entry(X86_EXC_CP, regs) )
         return;
 
     /* Decode ec if possible */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 19:23:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 19:23:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228241.394899 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9Tx-0005gW-P0; Fri, 19 Nov 2021 19:23:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228241.394899; Fri, 19 Nov 2021 19:23:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9Tx-0005gO-Lj; Fri, 19 Nov 2021 19:23:33 +0000
Received: by outflank-mailman (input) for mailman id 228241;
 Fri, 19 Nov 2021 19:23:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9Tw-0005g4-JC
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:23:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9Tw-0006ao-IR
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:23:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9Tw-00073I-Hi
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:23:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SNzhk7RUj8WInjixnDc0dbCO0/N+FpAVNUII56j9GKI=; b=MKj+yQs9NaoD03OCV9vNgZw0Q4
	p118Z4uUVVGqhbG9RHffA2MjWreD0iEI2WLu0oeT/rLOufYS5fYjQsW2l+QS3cj+szk0cl5QsU5KX
	yhyDqbyhdiXi/egpuWaKGZ1lNaaCBAYefqXSvbGhZ+eDmNrCEJxQWyhLJrYnP8jiTJBs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/xstate: reset cached register values on resume
Message-Id: <E1mo9Tw-00073I-Hi@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 19:23:32 +0000

commit 03b2a5920fb82b700c2b1ee3e384b546873079bd
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Fri Nov 19 09:31:40 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:31:40 2021 +0100

    x86/xstate: reset cached register values on resume
    
    set_xcr0() and set_msr_xss() use cached value to avoid setting the
    register to the same value over and over. But suspend/resume implicitly
    reset the registers and since percpu areas are not deallocated on
    suspend anymore, the cache gets stale.
    Reset the cache on resume, to ensure the next write will really hit the
    hardware. Choose value 0, as it will never be a legitimate write to
    those registers - and so, will force write (and cache update).
    
    Note the cache is used io get_xcr0() and get_msr_xss() too, but:
    - set_xcr0() is called few lines below in xstate_init(), so it will
      update the cache with appropriate value
    - get_msr_xss() is not used anywhere - and thus not before any
      set_msr_xss() that will fill the cache
    
    Fixes: aca2a985a55a "xen: don't free percpu areas during suspend"
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: f7f4a523927fa4c7598e4647a16bc3e3cf8009d0
    master date: 2021-11-04 14:42:37 +0100
---
 xen/arch/x86/xstate.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 3794d9a5a5..3bcc523f80 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -608,6 +608,13 @@ void xstate_init(struct cpuinfo_x86 *c)
         return;
     }
 
+    /*
+     * Zap the cached values to make set_xcr0() and set_msr_xss() really
+     * write it.
+     */
+    this_cpu(xcr0) = 0;
+    this_cpu(xss) = ~0;
+
     cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx);
 
     BUG_ON((eax & XSTATE_FP_SSE) != XSTATE_FP_SSE);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 19:23:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 19:23:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228244.394903 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9U7-0005k9-Rx; Fri, 19 Nov 2021 19:23:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228244.394903; Fri, 19 Nov 2021 19:23: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 1mo9U7-0005k1-Os; Fri, 19 Nov 2021 19:23:43 +0000
Received: by outflank-mailman (input) for mailman id 228244;
 Fri, 19 Nov 2021 19:23: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 1mo9U6-0005jo-ML
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:23: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 1mo9U6-0006b0-LZ
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:23:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9U6-00073s-Kk
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:23: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=o2/cMtFqEESkt7vUri6QjZ+8tqagz6kbQb11mds2/Ks=; b=JCaVb88BdQqsP71nSO5p0NjE+t
	0/EuOFn0EyBJncdYnasLFl39zBfy8hs3OfFWElHOm6Wo8sxww/KC2eYCCBCMLBavkes0lZgwy02LG
	IJJyLgAxWWUfR/g/WesMZsQo0LlQccT/2rUkNLuYLUgROu1F7OaRXvbgifXvspjwo5cc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/IOMMU: mark IOMMU / intremap not in use when ACPI tables are missing
Message-Id: <E1mo9U6-00073s-Kk@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 19:23:42 +0000

commit 567a8e9996440cbb37717598c1ceac7fb07803f3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:32:06 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:32:06 2021 +0100

    x86/IOMMU: mark IOMMU / intremap not in use when ACPI tables are missing
    
    x2apic_bsp_setup() gets called ahead of iommu_setup(), and since x2APIC
    mode (physical vs clustered) depends on iommu_intremap, that variable
    needs to be set to off as soon as we know we can't / won't enable
    interrupt remapping, i.e. in particular when parsing of the respective
    ACPI tables failed. Move the turning off of iommu_intremap from AMD
    specific code into acpi_iommu_init(), accompanying it by clearing of
    iommu_enable.
    
    Take the opportunity and also fully skip ACPI table parsing logic on
    VT-d when both "iommu=off" and "iommu=no-intremap" are in effect anyway,
    like was already the case for AMD.
    
    The tag below only references the commit uncovering a pre-existing
    anomaly.
    
    Fixes: d8bd82327b0f ("AMD/IOMMU: obtain IVHD type to use earlier")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 46c4061cd2bf69e8039021af615c2bdb94e50088
    master date: 2021-11-04 14:44:01 +0100
---
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  6 ------
 xen/drivers/passthrough/vtd/dmar.c          |  6 +-----
 xen/drivers/passthrough/x86/iommu.c         | 18 ++++++++++++++++++
 xen/include/asm-x86/acpi.h                  |  8 +-------
 4 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index c8e76d4077..78dc72f5f7 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -155,14 +155,8 @@ static void amd_iommu_setup_domain_device(
 
 int __init acpi_ivrs_init(void)
 {
-    if ( !iommu_enable && !iommu_intremap )
-        return 0;
-
     if ( (amd_iommu_detect_acpi() !=0) || (iommu_found() == 0) )
-    {
-        iommu_intremap = iommu_intremap_off;
         return -ENODEV;
-    }
 
     iommu_init_ops = &_iommu_init_ops;
 
diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 36d909b06d..53f33fdb0a 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -759,11 +759,7 @@ static int __init acpi_parse_dmar(struct acpi_table_header *table)
     dmar = (struct acpi_table_dmar *)table;
     dmar_flags = dmar->flags;
 
-    if ( !iommu_enable && !iommu_intremap )
-    {
-        ret = -EINVAL;
-        goto out;
-    }
+    ASSERT(iommu_enable || iommu_intremap);
 
     if ( !dmar->width )
     {
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index e83c6f2c61..fbc730a81c 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -40,6 +40,24 @@ enum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full;
 bool __read_mostly iommu_intpost;
 #endif
 
+void __init acpi_iommu_init(void)
+{
+    int ret;
+
+    if ( !iommu_enable && !iommu_intremap )
+        return;
+
+    ret = acpi_dmar_init();
+    if ( ret == -ENODEV )
+        ret = acpi_ivrs_init();
+
+    if ( ret )
+    {
+        iommu_enable = false;
+        iommu_intremap = iommu_intremap_off;
+    }
+}
+
 int __init iommu_hardware_setup(void)
 {
     struct IO_APIC_route_entry **ioapic_entries = NULL;
diff --git a/xen/include/asm-x86/acpi.h b/xen/include/asm-x86/acpi.h
index 7032f3a001..9a9cc4c240 100644
--- a/xen/include/asm-x86/acpi.h
+++ b/xen/include/asm-x86/acpi.h
@@ -141,16 +141,10 @@ extern u32 x86_acpiid_to_apicid[];
 extern u32 pmtmr_ioport;
 extern unsigned int pmtmr_width;
 
+void acpi_iommu_init(void);
 int acpi_dmar_init(void);
 int acpi_ivrs_init(void);
 
-static inline int acpi_iommu_init(void)
-{
-    int ret = acpi_dmar_init();
-
-    return ret == -ENODEV ? acpi_ivrs_init() : ret;
-}
-
 void acpi_mmcfg_init(void);
 
 /* Incremented whenever we transition through S3. Value is 1 during boot. */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 19:23:53 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 19:23:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228246.394907 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9UH-0005nS-TF; Fri, 19 Nov 2021 19:23:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228246.394907; Fri, 19 Nov 2021 19:23: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 1mo9UH-0005nK-QP; Fri, 19 Nov 2021 19:23:53 +0000
Received: by outflank-mailman (input) for mailman id 228246;
 Fri, 19 Nov 2021 19:23: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 1mo9UG-0005n8-PN
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:23: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 1mo9UG-0006bN-OX
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:23:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9UG-00074X-Nt
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:23: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=S6F4UfgUp4u7Mui/wkGFChIAH0wOTFD1uVovvb2sCCo=; b=T9b6S2LAnmBcA1DvRfw5XGrAVk
	mM0MnYNyhZdeSQZD5M7BjgHDo0sMfjjKqHfAdMqAbXbgWHRlYfSDbUM8gHqi031VplEypTKB2ozKb
	AyPcU6HPHvHPsNHa33kkEntPSET+0jg4t4LAHtiwAF1blUrczjMgq1nmjZykpYaLCJM8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/APIC: avoid iommu_supports_x2apic() on error path
Message-Id: <E1mo9UG-00074X-Nt@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 19:23:52 +0000

commit 2fb9c599d0ca5d1d44daa8bbf8692bcbe907ee14
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:32:34 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:32:34 2021 +0100

    x86/APIC: avoid iommu_supports_x2apic() on error path
    
    The value it returns may change from true to false in case
    iommu_enable_x2apic() fails and, as a side effect, clears iommu_intremap
    (as can happen at least on AMD). Latch the return value from the first
    invocation to replace the second one.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 0f50d1696b3c13cbf0b18fec817fc291d5a30a31
    master date: 2021-11-04 14:44:43 +0100
---
 xen/arch/x86/apic.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 8ab8214559..030792cabb 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -865,6 +865,7 @@ void x2apic_ap_setup(void)
 void __init x2apic_bsp_setup(void)
 {
     struct IO_APIC_route_entry **ioapic_entries = NULL;
+    bool iommu_x2apic;
     const char *orig_name;
 
     if ( !cpu_has_x2apic )
@@ -880,7 +881,8 @@ void __init x2apic_bsp_setup(void)
         printk("x2APIC: Already enabled by BIOS: Ignoring cmdline disable.\n");
     }
 
-    if ( iommu_supports_x2apic() )
+    iommu_x2apic = iommu_supports_x2apic();
+    if ( iommu_x2apic )
     {
         if ( (ioapic_entries = alloc_ioapic_entries()) == NULL )
         {
@@ -933,8 +935,11 @@ void __init x2apic_bsp_setup(void)
         printk("Switched to APIC driver %s\n", genapic.name);
 
 restore_out:
-    /* iommu_x2apic_enabled cannot be used here in the error case. */
-    if ( iommu_supports_x2apic() )
+    /*
+     * iommu_x2apic_enabled and iommu_supports_x2apic() cannot be used here
+     * in the error case.
+     */
+    if ( iommu_x2apic )
     {
         /*
          * NB: do not use raw mode when restoring entries if the iommu has
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 19 19:24:04 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 19 Nov 2021 19:24:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228248.394912 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mo9US-0005qo-VI; Fri, 19 Nov 2021 19:24:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228248.394912; Fri, 19 Nov 2021 19:24: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 1mo9US-0005qg-S3; Fri, 19 Nov 2021 19:24:04 +0000
Received: by outflank-mailman (input) for mailman id 228248;
 Fri, 19 Nov 2021 19:24: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 1mo9UQ-0005qH-SU
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:24: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 1mo9UQ-0006bm-Ri
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:24:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mo9UQ-00075Q-Qq
 for xen-changelog@lists.xenproject.org; Fri, 19 Nov 2021 19:24: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=nlF6slXOC0715u1nPViisOEq3i9KLIOBRHZfaJ0Iksw=; b=wXNQX44q995dUgWhIyz60G84gM
	1N10nSPixG5R1CHoQjGMUJdVuxr1TbGXF0c21rDek5ON5AZx3gm2koGn2o4O3nHiRuYSIZn2vlwB2
	uobB3AwmyzuN+iiLg/UvGQLhqz0iqOE89wgpgyylD2B5f/lGB73tgdOgVBmxsZVq9qnw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] public/gnttab: relax v2 recommendation
Message-Id: <E1mo9UQ-00075Q-Qq@xenbits.xenproject.org>
Date: Fri, 19 Nov 2021 19:24:02 +0000

commit 2a19ee2ba6fa2b36e4d9331f9dc40bda40f7358e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:33:03 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:33:03 2021 +0100

    public/gnttab: relax v2 recommendation
    
    With there being a way to disable v2 support, telling new guests to use
    v2 exclusively is not a good suggestion.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    master commit: 2d72d2784eb71d8532bfbd6462d261739c9e82e4
    master date: 2021-11-16 17:34:06 +0100
---
 xen/include/public/grant_table.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/include/public/grant_table.h b/xen/include/public/grant_table.h
index 84b1d26b36..61be5accee 100644
--- a/xen/include/public/grant_table.h
+++ b/xen/include/public/grant_table.h
@@ -121,8 +121,9 @@ typedef uint32_t grant_ref_t;
  */
 
 /*
- * Version 1 of the grant table entry structure is maintained purely
- * for backwards compatibility.  New guests should use version 2.
+ * Version 1 of the grant table entry structure is maintained largely for
+ * backwards compatibility.  New guests are recommended to support using
+ * version 2 to overcome version 1 limitations, but to default to version 1.
  */
 #if __XEN_INTERFACE_VERSION__ < 0x0003020a
 #define grant_entry_v1 grant_entry
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Sat Nov 20 02:11:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Nov 2021 02:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228292.394998 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moFqJ-0007DW-En; Sat, 20 Nov 2021 02:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228292.394998; Sat, 20 Nov 2021 02: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 1moFqJ-0007DK-Bg; Sat, 20 Nov 2021 02:11:03 +0000
Received: by outflank-mailman (input) for mailman id 228292;
 Sat, 20 Nov 2021 02: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 1moFqI-0007DA-4m
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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 1moFqI-0007XH-3o
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moFqI-0006rl-2r
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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=jPZWA8KdOirHW+4hNu5PQzA9UCh9PYTpiPIFZaMTvTY=; b=PVUYa6q3Xd7YbOn9UyH5oiugAW
	glvXpNv+IgF3XHZTBo9t+hH9qwySGhj3AuPhLuOmLdPwTytfj0CTqe0y4iNDysgAmCeubRIHyOufD
	VIUePOdNfNj7ulIwfSltSc8bwHOl1y8Iy2jGROfw/8k3gp3KSSK46DYbwKyGs/xVHQ80=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] build: fix dependencies in arch/x86/boot
Message-Id: <E1moFqI-0006rl-2r@xenbits.xenproject.org>
Date: Sat, 20 Nov 2021 02:11:02 +0000

commit d204a149501ab11f18aa59f6b3333fd5005e15d7
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Nov 19 09:36:36 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:36:36 2021 +0100

    build: fix dependencies in arch/x86/boot
    
    Temporary fix the list of headers that cmdline.c and reloc.c depends
    on, until the next time the list is out of sync again.
    
    Also, add the linker script to the list.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2f5f0a1b77161993c16c4cc243467d75e5b7633b
    master date: 2021-10-14 12:35:42 +0200
---
 xen/arch/x86/boot/Makefile   | 9 ++++++---
 xen/arch/x86/boot/build32.mk | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 9b31bfcbfb..d2eb277d42 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -2,19 +2,22 @@ obj-bin-y += head.o
 
 DEFS_H_DEPS = defs.h $(BASEDIR)/include/xen/stdbool.h
 
-CMDLINE_DEPS = $(DEFS_H_DEPS) video.h
+CMDLINE_DEPS = $(DEFS_H_DEPS) video.h \
+	       $(BASEDIR)/include/xen/kconfig.h \
+	       $(BASEDIR)/include/generated/autoconf.h
 
 RELOC_DEPS = $(DEFS_H_DEPS) \
 	     $(BASEDIR)/include/generated/autoconf.h \
 	     $(BASEDIR)/include/xen/kconfig.h \
 	     $(BASEDIR)/include/xen/multiboot.h \
 	     $(BASEDIR)/include/xen/multiboot2.h \
+	     $(BASEDIR)/include/xen/const.h \
 	     $(BASEDIR)/include/public/arch-x86/hvm/start_info.h
 
 head.o: cmdline.S reloc.S
 
-cmdline.S: cmdline.c $(CMDLINE_DEPS)
+cmdline.S: cmdline.c $(CMDLINE_DEPS) build32.lds
 	$(MAKE) -f build32.mk $@ CMDLINE_DEPS="$(CMDLINE_DEPS)"
 
-reloc.S: reloc.c $(RELOC_DEPS)
+reloc.S: reloc.c $(RELOC_DEPS) build32.lds
 	$(MAKE) -f build32.mk $@ RELOC_DEPS="$(RELOC_DEPS)"
diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
index 8cd5403926..e90680cd9f 100644
--- a/xen/arch/x86/boot/build32.mk
+++ b/xen/arch/x86/boot/build32.mk
@@ -27,7 +27,7 @@ CFLAGS := $(filter-out -flto,$(CFLAGS))
 		done
 	$(OBJCOPY) -O binary -R .got.plt $< $@
 
-%.lnk: %.o
+%.lnk: %.o build32.lds
 	$(LD) $(LDFLAGS_DIRECT) -N -T build32.lds -o $@ $<
 
 %.o: %.c
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 20 02:11:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Nov 2021 02:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228293.395002 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moFqT-0007Fr-G2; Sat, 20 Nov 2021 02:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228293.395002; Sat, 20 Nov 2021 02: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 1moFqT-0007Fj-DA; Sat, 20 Nov 2021 02:11:13 +0000
Received: by outflank-mailman (input) for mailman id 228293;
 Sat, 20 Nov 2021 02: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 1moFqS-0007FV-83
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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 1moFqS-0007XO-7F
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moFqS-0006sV-6L
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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=lJcwDS3xtM1YJULXW+Z6LmrMZEhrmsXYBNIjy+ZTnWs=; b=DJDWYiSftDoG6o0dz8W/QjKQ2X
	jq1fPyEzRGFwSS6T2SalKoI2QhHeYqbSL/auOWwQwYQpf1zfHVUQWIg7I6kk91DOmvCul4Ob8JuTj
	uTJrIE3U5CxF/RTHFoXXoxXb4LSyWaBUG49qMcxhCEkcm5L1r1hNwWrQe7k4hkAhyPiw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/HVM: correct cleanup after failed viridian_vcpu_init()
Message-Id: <E1moFqS-0006sV-6L@xenbits.xenproject.org>
Date: Sat, 20 Nov 2021 02:11:12 +0000

commit f240f9c3c635222069b4e2e037c5eb7aa3687075
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:37:10 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:37:10 2021 +0100

    x86/HVM: correct cleanup after failed viridian_vcpu_init()
    
    This happens after nestedhvm_vcpu_initialise(), so its effects also need
    to be undone.
    
    Fixes: 40a4a9d72d16 ("viridian: add init hooks")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 66675056c6e59b8a8b651a29ef53c63e9e04f58d
    master date: 2021-10-18 14:21:17 +0200
---
 xen/arch/x86/hvm/hvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index ab45b0a588..5b7e494ca3 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1580,7 +1580,7 @@ int hvm_vcpu_initialise(struct vcpu *v)
 
     rc = viridian_vcpu_init(v);
     if ( rc )
-        goto fail5;
+        goto fail6;
 
     rc = hvm_all_ioreq_servers_add_vcpu(d, v);
     if ( rc != 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 20 02:11:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Nov 2021 02:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228295.395006 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moFqd-0007Jo-I6; Sat, 20 Nov 2021 02:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228295.395006; Sat, 20 Nov 2021 02: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 1moFqd-0007Jf-Ef; Sat, 20 Nov 2021 02:11:23 +0000
Received: by outflank-mailman (input) for mailman id 228295;
 Sat, 20 Nov 2021 02: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 1moFqc-0007JE-Bq
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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 1moFqc-0007Xf-B2
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moFqc-0006sy-A0
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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=Sw7KGWLeSYQ2FKj6EsLMZC4n911nLyYZQggrxFq4d0E=; b=OcUh/D4fplz6e9tcJW2+eq6Nr6
	cF/nuu8uVrubUaVbcU5e88QSU5qeNGkYDY/MClRSAbDKqHMU1738tothuWlWEB4vGDD6hP31N8zoH
	GqGgKNChl3eN7eGy2pjOcMEigeA2zNHgpz0854SAAP2TflV6cFhGZqxSaqFh25VNsHDs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86emul: de-duplicate scatters to the same linear address
Message-Id: <E1moFqc-0006sy-A0@xenbits.xenproject.org>
Date: Sat, 20 Nov 2021 02:11:22 +0000

commit 7c957ea6125a1510baee4e01413451612c29312b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:37:37 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:37:37 2021 +0100

    x86emul: de-duplicate scatters to the same linear address
    
    The SDM specifically allows for earlier writes to fully overlapping
    ranges to be dropped. If a guest did so, hvmemul_phys_mmio_access()
    would crash it if varying data was written to the same address. Detect
    overlaps early, as doing so in hvmemul_{linear,phys}_mmio_access() would
    be quite a bit more difficult. To maintain proper faulting behavior,
    instead of dropping earlier write instances of fully overlapping slots
    altogether, write the data of the final of these slots multiple times.
    (We also can't pull ahead the [single] write of the data of the last of
    the slots, clearing all involved slots' op_mask bits together, as this
    would yield incorrect results if there were intervening partially
    overlapping ones.)
    
    Note that due to cache slot use being linear address based, there's no
    similar issue with multiple writes to the same physical address (mapped
    through different linear addresses).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: a8cddbac5051020bb4a59a7f0ea27500c51063fb
    master date: 2021-10-19 10:02:39 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index f186ae65fd..de46ec1b44 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -10024,15 +10024,36 @@ x86_emulate(
 
         for ( i = 0; op_mask; ++i )
         {
-            long idx = b & 1 ? index.qw[i] : index.dw[i];
+            long idx = (b & 1 ? index.qw[i]
+                              : index.dw[i]) * (1 << state->sib_scale);
+            unsigned long offs = truncate_ea(ea.mem.off + idx);
+            unsigned int j, slot;
 
             if ( !(op_mask & (1 << i)) )
                 continue;
 
-            rc = ops->write(ea.mem.seg,
-                            truncate_ea(ea.mem.off +
-                                        idx * (1 << state->sib_scale)),
-                            (void *)mmvalp + i * op_bytes, op_bytes, ctxt);
+            /*
+             * hvmemul_linear_mmio_access() will find a cache slot based on
+             * linear address.  hvmemul_phys_mmio_access() will crash the
+             * domain if observing varying data getting written to the same
+             * cache slot.  Utilize that squashing earlier writes to fully
+             * overlapping addresses is permitted by the spec.  We can't,
+             * however, drop the writes altogether, to maintain correct
+             * faulting behavior.  Instead write the data from the last of
+             * the fully overlapping slots multiple times.
+             */
+            for ( j = (slot = i) + 1; j < n; ++j )
+            {
+                long idx2 = (b & 1 ? index.qw[j]
+                                   : index.dw[j]) * (1 << state->sib_scale);
+
+                if ( (op_mask & (1 << j)) &&
+                     truncate_ea(ea.mem.off + idx2) == offs )
+                    slot = j;
+            }
+
+            rc = ops->write(ea.mem.seg, offs,
+                            (void *)mmvalp + slot * op_bytes, op_bytes, ctxt);
             if ( rc != X86EMUL_OKAY )
             {
                 /* See comment in gather emulation. */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 20 02:11:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Nov 2021 02:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228297.395010 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moFqn-0007Mx-JI; Sat, 20 Nov 2021 02:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228297.395010; Sat, 20 Nov 2021 02:11:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moFqn-0007Mp-GD; Sat, 20 Nov 2021 02:11:33 +0000
Received: by outflank-mailman (input) for mailman id 228297;
 Sat, 20 Nov 2021 02: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 1moFqm-0007MY-FI
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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 1moFqm-0007Y6-EZ
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moFqm-0006tb-DZ
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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=Xou+2iDGY8pFNO81PYxSatf2GNhrsb+kbpV139JuBog=; b=1sPgg9nwU0hZ3C0hvnO6DveQr+
	AYnFrQql37GPbNEI4zIuqlhhCep6fe6znZqNMe2zBxbo4+ggir0enYDGp0DQm3E52F6MtqxjVx2TM
	k7oBPYnIQNu71DBcYfDeMROQRL1f3oB9Tcb1MjH/q06WA7AGpqiiDIWT08Caw8LM6Giw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/AMD: make HT range dynamic for Fam17 and up
Message-Id: <E1moFqm-0006tb-DZ@xenbits.xenproject.org>
Date: Sat, 20 Nov 2021 02:11:32 +0000

commit 0c3fde7b7e920fb5c20747567c249714fab57282
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:38:09 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:38:09 2021 +0100

    x86/AMD: make HT range dynamic for Fam17 and up
    
    At the time of d838ac2539cf ("x86: don't allow Dom0 access to the HT
    address range") documentation correctly stated that the range was
    completely fixed. For Fam17 and newer, it lives at the top of physical
    address space, though.
    
    To correctly determine the top of physical address space, we need to
    account for their physical address reduction, hence the calculation of
    paddr_bits also gets adjusted.
    
    While for paddr_bits < 40 the HT range is completely hidden, there's no
    need to suppress the range insertion in that case: It'll just have no
    real meaning.
    
    Reported-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: d6e38eea2d806c53d976603717aebf6e5de30a1e
    master date: 2021-10-19 10:04:13 +0200
---
 xen/arch/x86/cpu/common.c | 7 +++++++
 xen/arch/x86/dom0_build.c | 7 +++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index a684519a20..743fbb65ab 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -336,16 +336,23 @@ void __init early_cpu_init(void)
 
 	eax = cpuid_eax(0x80000000);
 	if ((eax >> 16) == 0x8000 && eax >= 0x80000008) {
+		ebx = eax >= 0x8000001f ? cpuid_ebx(0x8000001f) : 0;
 		eax = cpuid_eax(0x80000008);
+
 		paddr_bits = eax & 0xff;
 		if (paddr_bits > PADDR_BITS)
 			paddr_bits = PADDR_BITS;
+
 		vaddr_bits = (eax >> 8) & 0xff;
 		if (vaddr_bits > VADDR_BITS)
 			vaddr_bits = VADDR_BITS;
+
 		hap_paddr_bits = ((eax >> 16) & 0xff) ?: paddr_bits;
 		if (hap_paddr_bits > PADDR_BITS)
 			hap_paddr_bits = PADDR_BITS;
+
+		/* Account for SME's physical address space reduction. */
+		paddr_bits -= (ebx >> 6) & 0x3f;
 	}
 
 	if (!(c->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)))
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 0ce29e91a3..d24dd9daf6 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -521,8 +521,11 @@ int __init dom0_setup_permissions(struct domain *d)
                                          MSI_ADDR_DEST_ID_MASK));
     /* HyperTransport range. */
     if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
-        rc |= iomem_deny_access(d, paddr_to_pfn(0xfdULL << 32),
-                                paddr_to_pfn((1ULL << 40) - 1));
+    {
+        mfn = paddr_to_pfn(1UL <<
+                           (boot_cpu_data.x86 < 0x17 ? 40 : paddr_bits));
+        rc |= iomem_deny_access(d, mfn - paddr_to_pfn(3UL << 32), mfn - 1);
+    }
 
     /* Remove access to E820_UNUSABLE I/O regions above 1MB. */
     for ( i = 0; i < e820.nr_map; i++ )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 20 02:11:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Nov 2021 02:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228299.395014 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moFqx-0007S8-NS; Sat, 20 Nov 2021 02:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228299.395014; Sat, 20 Nov 2021 02:11:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moFqx-0007S0-KX; Sat, 20 Nov 2021 02:11:43 +0000
Received: by outflank-mailman (input) for mailman id 228299;
 Sat, 20 Nov 2021 02: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 1moFqw-0007Rn-Ic
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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 1moFqw-0007Zo-Ho
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moFqw-0006u4-Gv
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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=a04/kWodihFacwh158BMNJI3YnRWDsiv8Dm7AiXsBHw=; b=yi3kww44D2wEGmjp7YhTLRT1XS
	lKfI/yNMsQyBLXzfaNS1giCcqWUkLAyxRJLv1kp74JLX9P8bUsumLRQEDkpZgyJdGvT32eisEsTBj
	irc8kSulm6DlWs1lz5qoUQ8T7o9dC/AG3WgQRjvehtW2jxUPKMV6DOs1Q9onc7IZO4g4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/paging: restrict physical address width reported to guests
Message-Id: <E1moFqw-0006u4-Gv@xenbits.xenproject.org>
Date: Sat, 20 Nov 2021 02:11:42 +0000

commit 81e3fd1f3cacda220e4d46bb01f9c1b554ed8401
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:38:42 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:38:42 2021 +0100

    x86/paging: restrict physical address width reported to guests
    
    Modern hardware may report more than 48 bits of physical address width.
    For paging-external guests our P2M implementation does not cope with
    larger values. Telling the guest of more available bits means misleading
    it into perhaps trying to actually put some page there (like was e.g.
    intermediately done in OVMF for the shared info page).
    
    While there also convert the PV check to a paging-external one (which in
    our current code base are synonyms of one another anyway).
    
    Fixes: 5dbd60e16a1f ("x86/shadow: Correct guest behaviour when creating PTEs above maxphysaddr")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: b7635526acffbe4ad8ad16fd92812c57742e54c2
    master date: 2021-10-19 10:08:30 +0200
---
 xen/include/asm-x86/paging.h | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index f53575f3d9..abb9a7e75c 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -391,11 +391,18 @@ static always_inline unsigned int paging_max_paddr_bits(const struct domain *d)
 {
     unsigned int bits = paging_mode_hap(d) ? hap_paddr_bits : paddr_bits;
 
-    if ( !IS_ENABLED(CONFIG_BIGMEM) && paging_mode_shadow(d) &&
-         !is_pv_domain(d) )
+    if ( paging_mode_external(d) )
     {
-        /* Shadowed superpages store GFNs in 32-bit page_info fields. */
-        bits = min(bits, 32U + PAGE_SHIFT);
+        if ( !IS_ENABLED(CONFIG_BIGMEM) && paging_mode_shadow(d) )
+        {
+            /* Shadowed superpages store GFNs in 32-bit page_info fields. */
+            bits = min(bits, 32U + PAGE_SHIFT);
+        }
+        else
+        {
+            /* Both p2m-ept and p2m-pt only support 4-level page tables. */
+            bits = min(bits, 48U);
+        }
     }
 
     return bits;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 20 02:11:53 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Nov 2021 02:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228301.395018 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moFr7-0007V3-P1; Sat, 20 Nov 2021 02:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228301.395018; Sat, 20 Nov 2021 02:11:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moFr7-0007Uv-M6; Sat, 20 Nov 2021 02:11:53 +0000
Received: by outflank-mailman (input) for mailman id 228301;
 Sat, 20 Nov 2021 02: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 1moFr6-0007Uo-Lp
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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 1moFr6-0007aM-L3
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moFr6-0006ue-K4
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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=vyy9hUCh8bfU3Xh+LtgaccnavlomdMGpsk7OUpcpw90=; b=ejzsqtV1g471EPDLAgT6qwtben
	pz1OatinRgReRiEUPJUsjqy+NPjjG5duWfgxmG+uH9VGK40ANzgH7KxpZU+OlHxNbHov1cjg7ieQZ
	mk+N3SmdMwQoxs+Z/iidQcMN51zFvmmoILOr45aZriYxo2UDKwNl/gRWuuow0+rRH8XU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] update system time immediately when VCPUOP_register_vcpu_info
Message-Id: <E1moFr6-0006ue-K4@xenbits.xenproject.org>
Date: Sat, 20 Nov 2021 02:11:52 +0000

commit c3f25903696412b8847619ccd5e51886106b70ad
Author:     Dongli Zhang <dongli.zhang@oracle.com>
AuthorDate: Fri Nov 19 09:39:09 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:39:09 2021 +0100

    update system time immediately when VCPUOP_register_vcpu_info
    
    The guest may access the pv vcpu_time_info immediately after
    VCPUOP_register_vcpu_info. This is to borrow the idea of
    VCPUOP_register_vcpu_time_memory_area, where the
    force_update_vcpu_system_time() is called immediately when the new memory
    area is registered.
    
    Otherwise, we may observe clock drift at the VM side if the VM accesses
    the clocksource immediately after VCPUOP_register_vcpu_info().
    
    Reference: https://lists.xenproject.org/archives/html/xen-devel/2021-10/msg00571.html
    Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b67f09721f136cc3a9afcb6a82466d1bd27aa6c0
    master date: 2021-11-03 10:19:06 +0100
---
 xen/arch/arm/time.c        | 5 +++++
 xen/common/domain.c        | 2 ++
 xen/include/asm-arm/time.h | 2 ++
 3 files changed, 9 insertions(+)

diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
index b0021c2c69..620ac202f3 100644
--- a/xen/arch/arm/time.c
+++ b/xen/arch/arm/time.c
@@ -351,6 +351,11 @@ void update_vcpu_system_time(struct vcpu *v)
     /* XXX update shared_info->wc_* */
 }
 
+void force_update_vcpu_system_time(struct vcpu *v)
+{
+    update_vcpu_system_time(v);
+}
+
 void domain_set_time_offset(struct domain *d, int64_t time_offset_seconds)
 {
     d->time_offset.seconds = time_offset_seconds;
diff --git a/xen/common/domain.c b/xen/common/domain.c
index b556696c87..b7017e1c01 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1498,6 +1498,8 @@ long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg)
         rc = map_vcpu_info(v, info.mfn, info.offset);
         domain_unlock(d);
 
+        force_update_vcpu_system_time(v);
+
         break;
     }
 
diff --git a/xen/include/asm-arm/time.h b/xen/include/asm-arm/time.h
index 1b2c13614b..9b6f5a1bbe 100644
--- a/xen/include/asm-arm/time.h
+++ b/xen/include/asm-arm/time.h
@@ -66,6 +66,8 @@ extern uint64_t ns_to_ticks(s_time_t ns);
 
 void preinit_xen_time(void);
 
+void force_update_vcpu_system_time(struct vcpu *v);
+
 #endif /* __ARM_TIME_H__ */
 /*
  * Local variables:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 20 02:12:04 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Nov 2021 02:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228304.395021 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moFrI-0007Yg-QU; Sat, 20 Nov 2021 02:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228304.395021; Sat, 20 Nov 2021 02: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 1moFrI-0007YY-Na; Sat, 20 Nov 2021 02:12:04 +0000
Received: by outflank-mailman (input) for mailman id 228304;
 Sat, 20 Nov 2021 02:12:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moFrG-0007YJ-Ou
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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 1moFrG-0007al-O8
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moFrG-0006va-NR
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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=MagfYbXjN7H3Lar4f0FVP0l8eLIh/9QMGUalOWU6f1Y=; b=7O0mASI26pe72QQ5pclZSwjEGW
	Sw+b3JjXTYpTbDDxq2tcxtdMf5uIQ0bzP/Fo1m7D/5AM8LiyunkcouueHibpQveY17hk/NZ03bzQ/
	gqgY0yV6WtlT1iZcqa6pUMtQwKT+f60MYk8+3R2bSNuhZPzIvUpoI/QcR0zRHOZ8QB24=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/shstk: Fix use of shadow stacks with XPTI active
Message-Id: <E1moFrG-0006va-NR@xenbits.xenproject.org>
Date: Sat, 20 Nov 2021 02:12:02 +0000

commit 2b8381087593c3df274baa94fadbe2b89cd28158
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Nov 19 09:39:46 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:39:46 2021 +0100

    x86/shstk: Fix use of shadow stacks with XPTI active
    
    The call to setup_cpu_root_pgt(0) in smp_prepare_cpus() is too early.  It
    clones the BSP's stack while the .data mapping is still in use, causing all
    mappings to be fully read read/write (and with no guard pages either).  This
    ultimately causes #DF when trying to enter the dom0 kernel for the first time.
    
    Defer setting up BSPs XPTI pagetable until reinit_bsp_stack() after we've set
    up proper shadow stack permissions.
    
    Fixes: 60016604739b ("x86/shstk: Rework the stack layout to support shadow stacks")
    Fixes: b60ab42db2f0 ("x86/shstk: Activate Supervisor Shadow Stacks")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b2851580b1f2ff121737a37cb25a370d7692ae3b
    master date: 2021-11-03 13:08:42 +0000
---
 xen/arch/x86/setup.c   | 5 +++++
 xen/arch/x86/smpboot.c | 9 ++-------
 xen/include/xen/smp.h  | 1 +
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 01d58e4879..14654ee4df 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -658,6 +658,7 @@ static void noinline init_done(void)
 static void __init noreturn reinit_bsp_stack(void)
 {
     unsigned long *stack = (void*)(get_stack_bottom() & ~(STACK_SIZE - 1));
+    int rc;
 
     /* Update TSS and ISTs */
     load_system_tables();
@@ -668,6 +669,10 @@ static void __init noreturn reinit_bsp_stack(void)
     stack_base[0] = stack;
     memguard_guard_stack(stack);
 
+    rc = setup_cpu_root_pgt(0);
+    if ( rc )
+        panic("Error %d setting up PV root page table\n", rc);
+
     if ( IS_ENABLED(CONFIG_XEN_SHSTK) && cpu_has_xen_shstk )
     {
         wrmsrl(MSR_PL0_SSP,
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 67e727cebd..64503df8e1 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -785,7 +785,7 @@ static root_pgentry_t common_pgt;
 
 extern const char _stextentry[], _etextentry[];
 
-static int setup_cpu_root_pgt(unsigned int cpu)
+int setup_cpu_root_pgt(unsigned int cpu)
 {
     root_pgentry_t *rpt;
     unsigned int off;
@@ -1102,8 +1102,6 @@ static struct notifier_block cpu_smpboot_nfb = {
 
 void __init smp_prepare_cpus(void)
 {
-    int rc;
-
     register_cpu_notifier(&cpu_smpboot_nfb);
 
     mtrr_aps_sync_begin();
@@ -1117,10 +1115,7 @@ void __init smp_prepare_cpus(void)
 
     stack_base[0] = (void *)((unsigned long)stack_start & ~(STACK_SIZE - 1));
 
-    rc = setup_cpu_root_pgt(0);
-    if ( rc )
-        panic("Error %d setting up PV root page table\n", rc);
-    if ( per_cpu(root_pgt, 0) )
+    if ( opt_xpti_hwdom || opt_xpti_domu )
     {
         get_cpu_info()->pv_cr3 = 0;
 
diff --git a/xen/include/xen/smp.h b/xen/include/xen/smp.h
index d5a3644611..0a9219173f 100644
--- a/xen/include/xen/smp.h
+++ b/xen/include/xen/smp.h
@@ -70,5 +70,6 @@ int alloc_cpu_id(void);
 extern void *stack_base[NR_CPUS];
 
 void initialize_cpu_data(unsigned int cpu);
+int setup_cpu_root_pgt(unsigned int cpu);
 
 #endif /* __XEN_SMP_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 20 02:12:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Nov 2021 02:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228306.395025 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moFrS-0007bd-S2; Sat, 20 Nov 2021 02:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228306.395025; Sat, 20 Nov 2021 02: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 1moFrS-0007bV-P5; Sat, 20 Nov 2021 02:12:14 +0000
Received: by outflank-mailman (input) for mailman id 228306;
 Sat, 20 Nov 2021 02:12:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moFrQ-0007bJ-S4
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02:12:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moFrQ-0007av-RH
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moFrQ-0006w8-QZ
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02:12:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CJcznX9PiVFOULhX07pVxBrIfjSs0PrQpI7oVXXT8EM=; b=xj+jGdYovzrq4zuMEJkJLCZuOp
	QiUd+XStUmdVQ0gWfJ8EG6n87/OokeI7SLeAK1O24lLGh0ltEHbLl375TdV9dtGcW6eaYZxCKl2JP
	i4Iclm+QEMPnLPPKho5gHiPP+4xkNMYoEqzdty/DYcwDknTclY4vBoMaS5u5iiz0b67k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/traps: Fix typo in do_entry_CP()
Message-Id: <E1moFrQ-0006w8-QZ@xenbits.xenproject.org>
Date: Sat, 20 Nov 2021 02:12:12 +0000

commit 9d3bac49a54ffacd44d7fffda307b211d78b2ce0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Nov 19 09:40:19 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:40:19 2021 +0100

    x86/traps: Fix typo in do_entry_CP()
    
    The call to debugger_trap_entry() should pass the correct vector.  The
    break-for-gdbsx logic is in practice unreachable because PV guests can't
    generate #CP, but it will interfere with anyone inserting custom debugging
    into debugger_trap_entry().
    
    Fixes: 5ad05b9c2490 ("x86/traps: Implement #CP handler and extend #PF for shadow stacks")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 512863ed238d7390f74d43f0ba298b1dfa8f4803
    master date: 2021-11-03 19:13:17 +0000
---
 xen/arch/x86/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index a38f10ad28..d8dd583a4a 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1975,7 +1975,7 @@ void do_entry_CP(struct cpu_user_regs *regs)
     const char *err = "??";
     unsigned int ec = regs->error_code;
 
-    if ( debugger_trap_entry(TRAP_debug, regs) )
+    if ( debugger_trap_entry(X86_EXC_CP, regs) )
         return;
 
     /* Decode ec if possible */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 20 02:12:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Nov 2021 02:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228309.395030 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moFrc-0007el-Tj; Sat, 20 Nov 2021 02:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228309.395030; Sat, 20 Nov 2021 02: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 1moFrc-0007ec-Qe; Sat, 20 Nov 2021 02:12:24 +0000
Received: by outflank-mailman (input) for mailman id 228309;
 Sat, 20 Nov 2021 02: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 1moFra-0007eO-VD
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02:12:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moFra-0007b2-UW
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02:12:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moFra-0006we-Tb
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02:12:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0YUs/A+1ax70Uq/fvgDS8UqcWzSl4ezirPkKvGn+lrc=; b=z53baEes17hcd+5TN++P4TAbov
	KQa7A6wX24bWUlLEzXgPDWtFjpTTWFaQHN5bZADiz9eEqXYatV/qRq2GaAWpU5icKJkRY+E6taTFE
	5CnZ1zi+pbSyBr5dLN/dhXB0OnT/vjtSoTyzt6RS7YwrbGs7BeMROf/jxMIvAMbFQPCo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/xstate: reset cached register values on resume
Message-Id: <E1moFra-0006we-Tb@xenbits.xenproject.org>
Date: Sat, 20 Nov 2021 02:12:22 +0000

commit 3d031d9e79481768abf93c1aab30116806eb604f
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Fri Nov 19 09:40:44 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:40:44 2021 +0100

    x86/xstate: reset cached register values on resume
    
    set_xcr0() and set_msr_xss() use cached value to avoid setting the
    register to the same value over and over. But suspend/resume implicitly
    reset the registers and since percpu areas are not deallocated on
    suspend anymore, the cache gets stale.
    Reset the cache on resume, to ensure the next write will really hit the
    hardware. Choose value 0, as it will never be a legitimate write to
    those registers - and so, will force write (and cache update).
    
    Note the cache is used io get_xcr0() and get_msr_xss() too, but:
    - set_xcr0() is called few lines below in xstate_init(), so it will
      update the cache with appropriate value
    - get_msr_xss() is not used anywhere - and thus not before any
      set_msr_xss() that will fill the cache
    
    Fixes: aca2a985a55a "xen: don't free percpu areas during suspend"
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: f7f4a523927fa4c7598e4647a16bc3e3cf8009d0
    master date: 2021-11-04 14:42:37 +0100
---
 xen/arch/x86/xstate.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 3794d9a5a5..3bcc523f80 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -608,6 +608,13 @@ void xstate_init(struct cpuinfo_x86 *c)
         return;
     }
 
+    /*
+     * Zap the cached values to make set_xcr0() and set_msr_xss() really
+     * write it.
+     */
+    this_cpu(xcr0) = 0;
+    this_cpu(xss) = ~0;
+
     cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx);
 
     BUG_ON((eax & XSTATE_FP_SSE) != XSTATE_FP_SSE);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 20 02:12:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Nov 2021 02:12:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228311.395034 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moFrm-0007hh-Ul; Sat, 20 Nov 2021 02:12:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228311.395034; Sat, 20 Nov 2021 02: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 1moFrm-0007hZ-Rt; Sat, 20 Nov 2021 02:12:34 +0000
Received: by outflank-mailman (input) for mailman id 228311;
 Sat, 20 Nov 2021 02: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 1moFrl-0007hM-28
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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 1moFrl-0007bF-1N
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moFrl-0006xH-0a
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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=r03Ble5IqwkqFPHX06ZxSmQTzJoScEiOrI7Giz7RfgA=; b=Eu3buIlvCu/bb1Foxpm0fI/bBS
	OyOXUEB2qYPRCbF4GY/kUZeXICLfNxIUvp0WEHHO7U4PGmC7xMd8dDDiDFsNJMgKGDaVO/0HYOJWM
	orDaCrkhGDr72W1FkmmcqNCRbl64/o1NVLLaB9FOl7p2OnRXCSe+0SnPeofuY+f0cwi4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/IOMMU: mark IOMMU / intremap not in use when ACPI tables are missing
Message-Id: <E1moFrl-0006xH-0a@xenbits.xenproject.org>
Date: Sat, 20 Nov 2021 02:12:33 +0000

commit cdcdc28b2ad4a53131f8843bc95fb9aa50a81191
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:41:09 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:41:09 2021 +0100

    x86/IOMMU: mark IOMMU / intremap not in use when ACPI tables are missing
    
    x2apic_bsp_setup() gets called ahead of iommu_setup(), and since x2APIC
    mode (physical vs clustered) depends on iommu_intremap, that variable
    needs to be set to off as soon as we know we can't / won't enable
    interrupt remapping, i.e. in particular when parsing of the respective
    ACPI tables failed. Move the turning off of iommu_intremap from AMD
    specific code into acpi_iommu_init(), accompanying it by clearing of
    iommu_enable.
    
    Take the opportunity and also fully skip ACPI table parsing logic on
    VT-d when both "iommu=off" and "iommu=no-intremap" are in effect anyway,
    like was already the case for AMD.
    
    The tag below only references the commit uncovering a pre-existing
    anomaly.
    
    Fixes: d8bd82327b0f ("AMD/IOMMU: obtain IVHD type to use earlier")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    
    master commit: 46c4061cd2bf69e8039021af615c2bdb94e50088
    master date: 2021-11-04 14:44:01 +0100
---
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  6 ------
 xen/drivers/passthrough/vtd/dmar.c          |  6 +-----
 xen/drivers/passthrough/x86/iommu.c         | 18 ++++++++++++++++++
 xen/include/asm-x86/acpi.h                  |  8 +-------
 4 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index 3f632e5e10..627ed79508 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -155,14 +155,8 @@ static void amd_iommu_setup_domain_device(
 
 int __init acpi_ivrs_init(void)
 {
-    if ( !iommu_enable && !iommu_intremap )
-        return 0;
-
     if ( (amd_iommu_detect_acpi() !=0) || (iommu_found() == 0) )
-    {
-        iommu_intremap = iommu_intremap_off;
         return -ENODEV;
-    }
 
     iommu_init_ops = &_iommu_init_ops;
 
diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 29cd5c5d70..06d8d7dbe6 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -760,11 +760,7 @@ static int __init acpi_parse_dmar(struct acpi_table_header *table)
     dmar = (struct acpi_table_dmar *)table;
     dmar_flags = dmar->flags;
 
-    if ( !iommu_enable && !iommu_intremap )
-    {
-        ret = -EINVAL;
-        goto out;
-    }
+    ASSERT(iommu_enable || iommu_intremap);
 
     if ( !dmar->width )
     {
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index 1d7cebcc06..2db74e5a54 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -39,6 +39,24 @@ enum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full;
 bool __read_mostly iommu_intpost;
 #endif
 
+void __init acpi_iommu_init(void)
+{
+    int ret;
+
+    if ( !iommu_enable && !iommu_intremap )
+        return;
+
+    ret = acpi_dmar_init();
+    if ( ret == -ENODEV )
+        ret = acpi_ivrs_init();
+
+    if ( ret )
+    {
+        iommu_enable = false;
+        iommu_intremap = iommu_intremap_off;
+    }
+}
+
 int __init iommu_hardware_setup(void)
 {
     struct IO_APIC_route_entry **ioapic_entries = NULL;
diff --git a/xen/include/asm-x86/acpi.h b/xen/include/asm-x86/acpi.h
index 7032f3a001..9a9cc4c240 100644
--- a/xen/include/asm-x86/acpi.h
+++ b/xen/include/asm-x86/acpi.h
@@ -141,16 +141,10 @@ extern u32 x86_acpiid_to_apicid[];
 extern u32 pmtmr_ioport;
 extern unsigned int pmtmr_width;
 
+void acpi_iommu_init(void);
 int acpi_dmar_init(void);
 int acpi_ivrs_init(void);
 
-static inline int acpi_iommu_init(void)
-{
-    int ret = acpi_dmar_init();
-
-    return ret == -ENODEV ? acpi_ivrs_init() : ret;
-}
-
 void acpi_mmcfg_init(void);
 
 /* Incremented whenever we transition through S3. Value is 1 during boot. */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 20 02:12:45 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Nov 2021 02:12:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228313.395038 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moFrx-0007kh-0H; Sat, 20 Nov 2021 02:12:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228313.395038; Sat, 20 Nov 2021 02: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 1moFrw-0007kZ-TM; Sat, 20 Nov 2021 02:12:44 +0000
Received: by outflank-mailman (input) for mailman id 228313;
 Sat, 20 Nov 2021 02: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 1moFrv-0007kI-54
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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 1moFrv-0007bO-4J
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moFrv-0006xk-3Y
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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=SNJfR1xiq1Gi8McZaO0K+9ZIaeJJef0eiYeoDU6Iva0=; b=b2d0UxEbf5aqWZrr+jFcLyrRHs
	vteFSUGBABkdSqv8OLYBi69G9l+p5GtgEPiBixFaxTJwfPzZ3slT0O3Zfqpxyiw1YloPQAkJCXGld
	FF2oBFkis8TAiRThJmlBmRuqJYx9dM305Gj78qTCC6pzPjaId/NHawEAMRkRCodvuEsk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/APIC: avoid iommu_supports_x2apic() on error path
Message-Id: <E1moFrv-0006xk-3Y@xenbits.xenproject.org>
Date: Sat, 20 Nov 2021 02:12:43 +0000

commit 006897dd720fb723cda0926aaccd12cee91fba86
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:41:41 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:41:41 2021 +0100

    x86/APIC: avoid iommu_supports_x2apic() on error path
    
    The value it returns may change from true to false in case
    iommu_enable_x2apic() fails and, as a side effect, clears iommu_intremap
    (as can happen at least on AMD). Latch the return value from the first
    invocation to replace the second one.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 0f50d1696b3c13cbf0b18fec817fc291d5a30a31
    master date: 2021-11-04 14:44:43 +0100
---
 xen/arch/x86/apic.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 4a2740ccea..789af8c4da 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -864,6 +864,7 @@ void x2apic_ap_setup(void)
 void __init x2apic_bsp_setup(void)
 {
     struct IO_APIC_route_entry **ioapic_entries = NULL;
+    bool iommu_x2apic;
     const char *orig_name;
 
     if ( !cpu_has_x2apic )
@@ -879,7 +880,8 @@ void __init x2apic_bsp_setup(void)
         printk("x2APIC: Already enabled by BIOS: Ignoring cmdline disable.\n");
     }
 
-    if ( iommu_supports_x2apic() )
+    iommu_x2apic = iommu_supports_x2apic();
+    if ( iommu_x2apic )
     {
         if ( (ioapic_entries = alloc_ioapic_entries()) == NULL )
         {
@@ -932,8 +934,11 @@ void __init x2apic_bsp_setup(void)
         printk("Switched to APIC driver %s\n", genapic.name);
 
 restore_out:
-    /* iommu_x2apic_enabled cannot be used here in the error case. */
-    if ( iommu_supports_x2apic() )
+    /*
+     * iommu_x2apic_enabled and iommu_supports_x2apic() cannot be used here
+     * in the error case.
+     */
+    if ( iommu_x2apic )
     {
         /*
          * NB: do not use raw mode when restoring entries if the iommu has
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 20 02:12:55 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Nov 2021 02:12:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228315.395042 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moFs7-0007oN-2z; Sat, 20 Nov 2021 02:12:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228315.395042; Sat, 20 Nov 2021 02:12:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moFs7-0007oF-07; Sat, 20 Nov 2021 02:12:55 +0000
Received: by outflank-mailman (input) for mailman id 228315;
 Sat, 20 Nov 2021 02: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 1moFs5-0007nl-8E
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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 1moFs5-0007bi-7P
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moFs5-0006yG-6h
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 02: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=a5OyT7OXr4zxYvML55qHSK0aQhrE3PoIaGU+wX785xg=; b=LjyWlZXlSzv/jw4J2MX78byoax
	pOFSfyOc6l7SJY0o/5upuK8wqcTeVQrGVOKmzATDMC6iDMOAdxYYW1dy6wecTDVpE2NuR0pBrz3M4
	zRpT2oQCSKeLRLZxqAQ+ExEiZEafeRnyGVsUTAAG8faxI8wySbBIYhNxZXiPIqdG2h6E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] public/gnttab: relax v2 recommendation
Message-Id: <E1moFs5-0006yG-6h@xenbits.xenproject.org>
Date: Sat, 20 Nov 2021 02:12:53 +0000

commit eb59f97eea86760e98e4f6a076f751939d2b8122
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 09:42:10 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 09:42:10 2021 +0100

    public/gnttab: relax v2 recommendation
    
    With there being a way to disable v2 support, telling new guests to use
    v2 exclusively is not a good suggestion.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    master commit: 2d72d2784eb71d8532bfbd6462d261739c9e82e4
    master date: 2021-11-16 17:34:06 +0100
---
 xen/include/public/grant_table.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/include/public/grant_table.h b/xen/include/public/grant_table.h
index 84b1d26b36..61be5accee 100644
--- a/xen/include/public/grant_table.h
+++ b/xen/include/public/grant_table.h
@@ -121,8 +121,9 @@ typedef uint32_t grant_ref_t;
  */
 
 /*
- * Version 1 of the grant table entry structure is maintained purely
- * for backwards compatibility.  New guests should use version 2.
+ * Version 1 of the grant table entry structure is maintained largely for
+ * backwards compatibility.  New guests are recommended to support using
+ * version 2 to overcome version 1 limitations, but to default to version 1.
  */
 #if __XEN_INTERFACE_VERSION__ < 0x0003020a
 #define grant_entry_v1 grant_entry
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Nov 20 10:00:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Nov 2021 10:00:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228353.395104 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moNAA-0001NG-JQ; Sat, 20 Nov 2021 10:00:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228353.395104; Sat, 20 Nov 2021 10:00:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moNAA-0001Ms-GH; Sat, 20 Nov 2021 10:00:02 +0000
Received: by outflank-mailman (input) for mailman id 228353;
 Sat, 20 Nov 2021 10:00:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moNA9-0001AJ-Po
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 10:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moNA9-0007mU-Ek
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 10:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moNA9-0008OI-Dc
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 10:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lx0pbAdtv/lC2FMI/yPKXwXMYxTq/U82kHaiALiVF/4=; b=TEx5E8jBNpR4t+1wV9P5SHxjfK
	fh+HjpVp+KhtjPbO3FlsvUBya5ofx4OifZ5RDHX+Lw9PgPZJscWCaEU0qK0IgCog/ptjIBr5a/5V7
	di3o0KCDv4LtJfOv6sbZq0mfMca9gNWm2SkeYX1lchQugtij7XUWFkUG5ayJU0MDXSr0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: fix reduced page table levels support when sharing tables
Message-Id: <E1moNA9-0008OI-Dc@xenbits.xenproject.org>
Date: Sat, 20 Nov 2021 10:00:01 +0000

commit 02b46377b69feb6dd3649f037e17684af9fb7853
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 15:14:08 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 15:14:08 2021 +0100

    VT-d: fix reduced page table levels support when sharing tables
    
    domain_pgd_maddr() contains logic to adjust the root address to be put
    in the context entry in case 4-level page tables aren't supported by an
    IOMMU. This logic may not be bypassed when sharing page tables.
    
    This is CVE-2021-28710 / XSA-390.
    
    Fixes: 25ccd093425c ("iommu: remove the share_p2m operation")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 xen/drivers/passthrough/vtd/iommu.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 7b8337017a..f9ce402f22 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -340,19 +340,21 @@ static uint64_t domain_pgd_maddr(struct domain *d, unsigned int nr_pt_levels)
     {
         pagetable_t pgt = p2m_get_pagetable(p2m_get_hostp2m(d));
 
-        return pagetable_get_paddr(pgt);
+        pgd_maddr = pagetable_get_paddr(pgt);
     }
-
-    if ( !hd->arch.vtd.pgd_maddr )
+    else
     {
-        /* Ensure we have pagetables allocated down to leaf PTE. */
-        addr_to_dma_page_maddr(d, 0, 1);
-
         if ( !hd->arch.vtd.pgd_maddr )
-            return 0;
-    }
+        {
+            /* Ensure we have pagetables allocated down to leaf PTE. */
+            addr_to_dma_page_maddr(d, 0, 1);
 
-    pgd_maddr = hd->arch.vtd.pgd_maddr;
+            if ( !hd->arch.vtd.pgd_maddr )
+                return 0;
+        }
+
+        pgd_maddr = hd->arch.vtd.pgd_maddr;
+    }
 
     /* Skip top levels of page tables for 2- and 3-level DRHDs. */
     for ( agaw = level_to_agaw(4);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 20 10:00:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Nov 2021 10:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228354.395108 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moNAK-00020U-L2; Sat, 20 Nov 2021 10:00:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228354.395108; Sat, 20 Nov 2021 10:00:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moNAK-00020M-Hy; Sat, 20 Nov 2021 10:00:12 +0000
Received: by outflank-mailman (input) for mailman id 228354;
 Sat, 20 Nov 2021 10:00:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moNAJ-00020C-JD
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 10:00:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moNAJ-0007qe-IS
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 10:00:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moNAJ-0008Pl-HF
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 10:00:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BUdK44D0lOcNGsR0rz4OTkHX6GL1Cpa3La6xZ6mYc7Y=; b=P2Tn8tVmk/xyrRL/iH3X/+eEaZ
	aR2KgU0GvHaefsP2HTuSTEZYNWjlWpt8uT/5Q1FBBOraZ4jiBDRTyaVQUhMA5fT6yEYBb60ShYXuK
	3VfHEu5sYUJ7aLsHE8ctDqZm6kjFkn2GIDIIxqO0zXOooImheZlVeN8SGySGRSYkFS2w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] golang/xenlight: regen generated code
Message-Id: <E1moNAJ-0008Pl-HF@xenbits.xenproject.org>
Date: Sat, 20 Nov 2021 10:00:11 +0000

commit 24d7cc416bba1f88da4c7b2649ac32486229b97b
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Nov 19 10:29:48 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Fri Nov 19 14:33:55 2021 +0000

    golang/xenlight: regen generated code
    
    Fixes: 7379f9e10a3b ("gnttab: allow setting max version per-domain")
    Fixes: 1e6706b0d123 ("xen/arm: Introduce gpaddr_bits field to struct xen_domctl_getdomaininfo")
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Nick Rosbrook <rosbrookn@ainfosec.com>
    Acked-by: Ian Jackson <iwj@xenproject.org>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/golang/xenlight/helpers.gen.go | 4 ++++
 tools/golang/xenlight/types.gen.go   | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index 6e1b054310..b746ff1081 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -323,6 +323,7 @@ x.CpuTime = uint64(xc.cpu_time)
 x.VcpuMaxId = uint32(xc.vcpu_max_id)
 x.VcpuOnline = uint32(xc.vcpu_online)
 x.Cpupool = uint32(xc.cpupool)
+x.GpaddrBits = byte(xc.gpaddr_bits)
 x.DomainType = DomainType(xc.domain_type)
 
  return nil}
@@ -355,6 +356,7 @@ xc.cpu_time = C.uint64_t(x.CpuTime)
 xc.vcpu_max_id = C.uint32_t(x.VcpuMaxId)
 xc.vcpu_online = C.uint32_t(x.VcpuOnline)
 xc.cpupool = C.uint32_t(x.Cpupool)
+xc.gpaddr_bits = C.uint8_t(x.GpaddrBits)
 xc.domain_type = C.libxl_domain_type(x.DomainType)
 
  return nil
@@ -1012,6 +1014,7 @@ return fmt.Errorf("converting field VnumaNodes: %v", err) }
 }
 x.MaxGrantFrames = uint32(xc.max_grant_frames)
 x.MaxMaptrackFrames = uint32(xc.max_maptrack_frames)
+x.MaxGrantVersion = int(xc.max_grant_version)
 x.DeviceModelVersion = DeviceModelVersion(xc.device_model_version)
 if err := x.DeviceModelStubdomain.fromC(&xc.device_model_stubdomain);err != nil {
 return fmt.Errorf("converting field DeviceModelStubdomain: %v", err)
@@ -1341,6 +1344,7 @@ return fmt.Errorf("converting field VnumaNodes: %v", err)
 }
 xc.max_grant_frames = C.uint32_t(x.MaxGrantFrames)
 xc.max_maptrack_frames = C.uint32_t(x.MaxMaptrackFrames)
+xc.max_grant_version = C.int(x.MaxGrantVersion)
 xc.device_model_version = C.libxl_device_model_version(x.DeviceModelVersion)
 if err := x.DeviceModelStubdomain.toC(&xc.device_model_stubdomain); err != nil {
 return fmt.Errorf("converting field DeviceModelStubdomain: %v", err)
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index a0acfaacc3..b1e84d5258 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -316,6 +316,7 @@ CpuTime uint64
 VcpuMaxId uint32
 VcpuOnline uint32
 Cpupool uint32
+GpaddrBits byte
 DomainType DomainType
 }
 
@@ -479,6 +480,7 @@ BlkdevStart string
 VnumaNodes []VnodeInfo
 MaxGrantFrames uint32
 MaxMaptrackFrames uint32
+MaxGrantVersion int
 DeviceModelVersion DeviceModelVersion
 DeviceModelStubdomain Defbool
 StubdomainMemkb uint64
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 20 12:44:06 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 20 Nov 2021 12:44:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228383.395140 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moPis-0000bf-EA; Sat, 20 Nov 2021 12:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228383.395140; Sat, 20 Nov 2021 12:44:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moPis-0000bX-BO; Sat, 20 Nov 2021 12:44:02 +0000
Received: by outflank-mailman (input) for mailman id 228383;
 Sat, 20 Nov 2021 12:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moPir-0000bR-Tw
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 12: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 1moPir-00023v-T7
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 12:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moPir-0001lZ-S4
 for xen-changelog@lists.xenproject.org; Sat, 20 Nov 2021 12: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=Iac2COptNC2NiGqVAvuIMZi+tN3Fed1CcChdbtVxnxA=; b=jJKHUcTqhx9p/lRgPd2chW4BsJ
	2UofLh5hhgalHIIDid3zmdrCfz1SsaAIQ0YhGnrHPnjDKsEUBNeZhbVY/1D74cDloUBlntlI38he5
	q3gX/EW+5bGaD620i+oKABaqgfe92/JV8/ZduFJQdiSmPWHZHy7aDRFsuAWfNnqA0fcE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] VT-d: fix reduced page table levels support when sharing tables
Message-Id: <E1moPir-0001lZ-S4@xenbits.xenproject.org>
Date: Sat, 20 Nov 2021 12:44:01 +0000

commit 963ab606b1228788eac54c1c7ff70d04bb325733
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 19 15:16:17 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Nov 19 15:16:17 2021 +0100

    VT-d: fix reduced page table levels support when sharing tables
    
    domain_pgd_maddr() contains logic to adjust the root address to be put
    in the context entry in case 4-level page tables aren't supported by an
    IOMMU. This logic may not be bypassed when sharing page tables.
    
    This is CVE-2021-28710 / XSA-390.
    
    Fixes: 25ccd093425c ("iommu: remove the share_p2m operation")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 02b46377b69feb6dd3649f037e17684af9fb7853
    master date: 2021-11-19 15:14:08 +0100
---
 xen/drivers/passthrough/vtd/iommu.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index fbc749436b..abe7ea5ac9 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -337,19 +337,21 @@ static uint64_t domain_pgd_maddr(struct domain *d, unsigned int nr_pt_levels)
     {
         pagetable_t pgt = p2m_get_pagetable(p2m_get_hostp2m(d));
 
-        return pagetable_get_paddr(pgt);
+        pgd_maddr = pagetable_get_paddr(pgt);
     }
-
-    if ( !hd->arch.vtd.pgd_maddr )
+    else
     {
-        /* Ensure we have pagetables allocated down to leaf PTE. */
-        addr_to_dma_page_maddr(d, 0, 1);
-
         if ( !hd->arch.vtd.pgd_maddr )
-            return 0;
-    }
+        {
+            /* Ensure we have pagetables allocated down to leaf PTE. */
+            addr_to_dma_page_maddr(d, 0, 1);
 
-    pgd_maddr = hd->arch.vtd.pgd_maddr;
+            if ( !hd->arch.vtd.pgd_maddr )
+                return 0;
+        }
+
+        pgd_maddr = hd->arch.vtd.pgd_maddr;
+    }
 
     /* Skip top levels of page tables for 2- and 3-level DRHDs. */
     for ( agaw = level_to_agaw(4);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Sun Nov 21 09:11:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 21 Nov 2021 09:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.228520.395481 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moisI-0007Uw-Nt; Sun, 21 Nov 2021 09:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 228520.395481; Sun, 21 Nov 2021 09:11:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1moisI-0007Uo-L5; Sun, 21 Nov 2021 09:11:02 +0000
Received: by outflank-mailman (input) for mailman id 228520;
 Sun, 21 Nov 2021 09: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 1moisH-0007Ui-Vn
 for xen-changelog@lists.xenproject.org; Sun, 21 Nov 2021 09:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moisH-0000ze-Ut
 for xen-changelog@lists.xenproject.org; Sun, 21 Nov 2021 09:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1moisH-0000Hd-Tr
 for xen-changelog@lists.xenproject.org; Sun, 21 Nov 2021 09:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jQ1BODB5ZjglIKDUazc4lo9rTUkhLln4JZwHp+cObxM=; b=3L2eefLFWKLuqi85XjSqDs9gK4
	D/MOiKmdZUYyesKYN8J0fbnmoG+YXcuG+5Y0AE96weJNAxlAET+qGOUf9o68WSBNkHt2KW7yL+7ru
	sYKjqFk+9VNt6yNLT/M+gIFZCi70+Z4aceWiGXPiL/zmt4FQMRxPSawmVkj6B8bH+DUI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] efi: fix alignment of function parameters in compat mode
Message-Id: <E1moisH-0000Hd-Tr@xenbits.xenproject.org>
Date: Sun, 21 Nov 2021 09:11:01 +0000

commit be12fcca8b784e456df3adedbffe657d753c5ff9
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Thu Nov 18 09:28:06 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Fri Nov 19 17:01:24 2021 +0000

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

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


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:22:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229518.396902 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpUoI-00045y-Mk; Tue, 23 Nov 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 229518.396902; Tue, 23 Nov 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 1mpUoI-00045q-Jj; Tue, 23 Nov 2021 12:22:06 +0000
Received: by outflank-mailman (input) for mailman id 229518;
 Tue, 23 Nov 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 1mpUoH-00045c-6W
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpUoH-0002lf-3v
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpUoH-0006t7-32
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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=C/Ebt6XqfmpCSdAEWv1UidGpDlE6QnnPOHuNh9Ue/mk=; b=UOHJamVM9J+M6JLRWOoif4IJfC
	R06+4c7jp/oJt7+4ixa3aoIjJSzOGAERipyDMJ2zfAh4kqnyDR6kekrUo3neW6XqSxXNEN2aw9moy
	fBIgFDc1z7IJsWws74CjWPQWdJaXYE1CocopV+4VV1o16qkMEZo/DsRACGlQYLiAV5lY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/page_alloc: Harden assign_pages()
Message-Id: <E1mpUoH-0006t7-32@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:22:05 +0000

commit 143501861d48e1bfef495849fd68584baac05849
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Nov 22 11:11:05 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 22 11:11:05 2021 +0000

    xen/page_alloc: Harden assign_pages()
    
    domain_tot_pages() and d->max_pages are 32-bit values. While the order
    should always be quite small, it would still be possible to overflow
    if domain_tot_pages() is near to (2^32 - 1).
    
    As this code may be called by a guest via XENMEM_increase_reservation
    and XENMEM_populate_physmap, we want to make sure the guest is not going
    to be able to allocate more than it is allowed.
    
    Rework the allocation check to avoid any possible overflow. While the
    check domain_tot_pages() < d->max_pages should technically not be
    necessary, it is probably best to have it to catch any possible
    inconsistencies in the future.
    
    This is CVE-2021-28706 / part of XSA-385.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/common/grant_table.c |  7 ++++---
 xen/common/page_alloc.c  | 33 +++++++++++++++++++++++++++------
 2 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 8b322b51c0..012a74455b 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -2341,7 +2341,8 @@ gnttab_transfer(
          * pages when it is dying.
          */
         if ( unlikely(e->is_dying) ||
-             unlikely(domain_tot_pages(e) >= e->max_pages) )
+             unlikely(domain_tot_pages(e) >= e->max_pages) ||
+             unlikely(!(e->tot_pages + 1)) )
         {
             spin_unlock(&e->page_alloc_lock);
 
@@ -2350,8 +2351,8 @@ gnttab_transfer(
                          e->domain_id);
             else
                 gdprintk(XENLOG_INFO,
-                         "Transferee d%d has no headroom (tot %u, max %u)\n",
-                         e->domain_id, domain_tot_pages(e), e->max_pages);
+                         "Transferee %pd has no headroom (tot %u, max %u, ex %u)\n",
+                         e, domain_tot_pages(e), e->max_pages, e->extra_pages);
 
             gop.status = GNTST_general_error;
             goto unlock_and_copyback;
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 5801358b4b..d0baaa2ecd 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2310,20 +2310,41 @@ int assign_pages(
     }
     else if ( !(memflags & MEMF_no_refcount) )
     {
-        unsigned int tot_pages = domain_tot_pages(d) + nr;
+        unsigned int tot_pages = domain_tot_pages(d);
 
         if ( unlikely(tot_pages > d->max_pages) )
         {
-            gprintk(XENLOG_INFO, "Over-allocation for domain %u: "
-                    "%u > %u\n", d->domain_id, tot_pages, d->max_pages);
+            gprintk(XENLOG_INFO, "Inconsistent allocation for %pd: %u > %u\n",
+                    d, tot_pages, d->max_pages);
+            rc = -EPERM;
+            goto out;
+        }
+
+        if ( unlikely(nr > d->max_pages - tot_pages) )
+        {
+            gprintk(XENLOG_INFO, "Over-allocation for %pd: %Lu > %u\n",
+                    d, tot_pages + 0ull + nr, d->max_pages);
             rc = -E2BIG;
             goto out;
         }
     }
 
-    if ( !(memflags & MEMF_no_refcount) &&
-         unlikely(domain_adjust_tot_pages(d, nr) == nr) )
-        get_knownalive_domain(d);
+    if ( !(memflags & MEMF_no_refcount) )
+    {
+        if ( unlikely(d->tot_pages + nr < nr) )
+        {
+            gprintk(XENLOG_INFO,
+                    "Excess allocation for %pd: %Lu (%u extra)\n",
+                    d, d->tot_pages + 0ull + nr, d->extra_pages);
+            if ( pg[0].count_info & PGC_extra )
+                d->extra_pages -= nr;
+            rc = -E2BIG;
+            goto out;
+        }
+
+        if ( unlikely(domain_adjust_tot_pages(d, nr) == nr) )
+            get_knownalive_domain(d);
+    }
 
     for ( i = 0; i < nr; i++ )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:22:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229519.396906 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpUoS-00048T-Of; Tue, 23 Nov 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 229519.396906; Tue, 23 Nov 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 1mpUoS-00048L-LL; Tue, 23 Nov 2021 12:22:16 +0000
Received: by outflank-mailman (input) for mailman id 229519;
 Tue, 23 Nov 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 1mpUoR-000484-8L
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpUoR-0002lq-7M
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpUoR-0006u8-6N
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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=kD+P9WgkPD7ImN8iyMFxs41SCTRUk5PCLd5gHiAeaAc=; b=q2BtCcGVGJZR9D4tulooAvOFLt
	Q65rhLV/jbsiTg1F6GggTZ38dfSAk77p4ltjE95/g6BTbe+HvuihCwGYI5+Q43bYLCgAsqEqMJIX3
	HKpLpxWdosTJZCMsu6/Zh6b3fX9eG/cuol1JFC+GTPWYbtWYE07W8YCDPXDfds9HmxzY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/PoD: deal with misaligned GFNs
Message-Id: <E1mpUoR-0006u8-6N@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:22:15 +0000

commit 182c737b9ba540ebceb1433f3940fbed6eac4ea9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Nov 22 11:11:44 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 22 12:27:30 2021 +0000

    x86/PoD: deal with misaligned GFNs
    
    Users of XENMEM_decrease_reservation and XENMEM_populate_physmap aren't
    required to pass in order-aligned GFN values. (While I consider this
    bogus, I don't think we can fix this there, as that might break existing
    code, e.g Linux'es swiotlb, which - while affecting PV only - until
    recently had been enforcing only page alignment on the original
    allocation.) Only non-PoD code paths (guest_physmap_{add,remove}_page(),
    p2m_set_entry()) look to be dealing with this properly (in part by being
    implemented inefficiently, handling every 4k page separately).
    
    Introduce wrappers taking care of splitting the incoming request into
    aligned chunks, without putting much effort in trying to determine the
    largest possible chunk at every iteration.
    
    Also "handle" p2m_set_entry() failure for non-order-0 requests by
    crashing the domain in one more place. Alongside putting a log message
    there, also add one to the other similar path.
    
    Note regarding locking: This is left in the actual worker functions on
    the assumption that callers aren't guaranteed atomicity wrt acting on
    multiple pages at a time. For mis-aligned GFNs gfn_lock() wouldn't have
    locked the correct GFN range anyway, if it didn't simply resolve to
    p2m_lock(), and for well-behaved callers there continues to be only a
    single iteration, i.e. behavior is unchanged for them. (FTAOD pulling
    out just pod_lock() into p2m_pod_decrease_reservation() would result in
    a lock order violation.)
    
    This is CVE-2021-28704 and CVE-2021-28707 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m-pod.c | 75 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 63 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index d0134755e5..20e6327b75 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -504,7 +504,7 @@ static void pod_unlock_and_flush(struct p2m_domain *p2m)
 }
 
 /*
- * This function is needed for two reasons:
+ * This pair of functions is needed for two reasons:
  * + To properly handle clearing of PoD entries
  * + To "steal back" memory being freed for the PoD cache, rather than
  *   releasing it.
@@ -512,8 +512,8 @@ static void pod_unlock_and_flush(struct p2m_domain *p2m)
  * Once both of these functions have been completed, we can return and
  * allow decrease_reservation() to handle everything else.
  */
-unsigned long
-p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+static unsigned long
+decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
 {
     unsigned long ret = 0, i, n;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -561,8 +561,10 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
          * All PoD: Mark the whole region invalid and tell caller
          * we're done.
          */
-        if ( p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
-                           p2m->default_access) )
+        int rc = p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
+                               p2m->default_access);
+
+        if ( rc )
         {
             /*
              * If this fails, we can't tell how much of the range was changed.
@@ -570,7 +572,12 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
              * impossible.
              */
             if ( order != 0 )
+            {
+                printk(XENLOG_G_ERR
+                       "%pd: marking GFN %#lx (order %u) as non-PoD failed: %d\n",
+                       d, gfn_x(gfn), order, rc);
                 domain_crash(d);
+            }
             goto out_unlock;
         }
         ret = 1UL << order;
@@ -679,6 +686,22 @@ out_unlock:
     return ret;
 }
 
+unsigned long
+p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+{
+    unsigned long left = 1UL << order, ret = 0;
+    unsigned int chunk_order = find_first_set_bit(gfn_x(gfn) | left);
+
+    do {
+        ret += decrease_reservation(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn = gfn_add(gfn, 1UL << chunk_order);
+    } while ( left );
+
+    return ret;
+}
+
 void p2m_pod_dump_data(struct domain *d)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -1289,19 +1312,15 @@ remap_and_retry:
     return true;
 }
 
-
-int
-guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
-                                      unsigned int order)
+static int
+mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
+                        unsigned int order)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     gfn_t gfn = _gfn(gfn_l);
     unsigned long i, n, pod_count = 0;
     int rc = 0;
 
-    if ( !paging_mode_translate(d) )
-        return -EINVAL;
-
     gfn_lock(p2m, gfn, order);
 
     P2M_DEBUG("mark pod gfn=%#lx\n", gfn_l);
@@ -1341,6 +1360,17 @@ guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
 
         ioreq_request_mapcache_invalidate(d);
     }
+    else if ( order )
+    {
+        /*
+         * If this failed, we can't tell how much of the range was changed.
+         * Best to crash the domain.
+         */
+        printk(XENLOG_G_ERR
+               "%pd: marking GFN %#lx (order %u) as PoD failed: %d\n",
+               d, gfn_l, order, rc);
+        domain_crash(d);
+    }
 
 out:
     gfn_unlock(p2m, gfn, order);
@@ -1348,6 +1378,27 @@ out:
     return rc;
 }
 
+int
+guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
+                                      unsigned int order)
+{
+    unsigned long left = 1UL << order;
+    unsigned int chunk_order = find_first_set_bit(gfn | left);
+    int rc;
+
+    if ( !paging_mode_translate(d) )
+        return -EINVAL;
+
+    do {
+        rc = mark_populate_on_demand(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn += 1UL << chunk_order;
+    } while ( !rc && left );
+
+    return rc;
+}
+
 void p2m_pod_init(struct p2m_domain *p2m)
 {
     unsigned int i;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:22:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:22:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229522.396910 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpUoc-0004CE-Pp; Tue, 23 Nov 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 229522.396910; Tue, 23 Nov 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 1mpUoc-0004C6-Mr; Tue, 23 Nov 2021 12:22:26 +0000
Received: by outflank-mailman (input) for mailman id 229522;
 Tue, 23 Nov 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 1mpUob-0004Bn-BM
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpUob-0002m3-AX
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpUob-0006v9-9i
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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=fGpFxEAu81IB5W19Sfsj07uYv1Hy2kJMtzxPjXggAqQ=; b=S5ensFXZo3lLL2mITbQTU9uuml
	X6BN/tVsbkKY4BmXfNaw1zkUS7VmuyQ65c77ZWYV0wqYfqYdobd4EfAq0yc7U1AQXKWX3c/zJSPXD
	J/PrvOV5Nnvz2cO/XmcF7PQGmGdxjLTx3FYxQOsjScWIDFiEVE/GZk/h5LsH20XEct7g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
Message-Id: <E1mpUob-0006v9-9i@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:22:25 +0000

commit 8ec13f68e0b026863d23e7f44f252d06478bc809
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Nov 22 11:11:44 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 22 12:27:30 2021 +0000

    x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
    
    p2m_pod_decrease_reservation() may pass pages to the function which
    aren't 4k, 2M, or 1G. Handle all intermediate orders as well, to avoid
    hitting the BUG() at the switch() statement's "default" case.
    
    This is CVE-2021-28708 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m-pod.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index 20e6327b75..d8d1a0ce7e 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -113,15 +113,13 @@ p2m_pod_cache_add(struct p2m_domain *p2m,
     /* Then add to the appropriate populate-on-demand list. */
     switch ( order )
     {
-    case PAGE_ORDER_1G:
-        for ( i = 0; i < (1UL << PAGE_ORDER_1G); i += 1UL << PAGE_ORDER_2M )
+    case PAGE_ORDER_2M ... PAGE_ORDER_1G:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_2M )
             page_list_add_tail(page + i, &p2m->pod.super);
         break;
-    case PAGE_ORDER_2M:
-        page_list_add_tail(page, &p2m->pod.super);
-        break;
-    case PAGE_ORDER_4K:
-        page_list_add_tail(page, &p2m->pod.single);
+    case PAGE_ORDER_4K ... PAGE_ORDER_2M - 1:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_4K )
+            page_list_add_tail(page + i, &p2m->pod.single);
         break;
     default:
         BUG();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:22:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:22:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229525.396914 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpUom-0004FY-RE; Tue, 23 Nov 2021 12:22:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229525.396914; Tue, 23 Nov 2021 12: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 1mpUom-0004FQ-ON; Tue, 23 Nov 2021 12:22:36 +0000
Received: by outflank-mailman (input) for mailman id 229525;
 Tue, 23 Nov 2021 12: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 1mpUol-0004FJ-EY
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12: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 1mpUol-0002mF-Di
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:22:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpUol-0006w5-Co
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12: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=/JQj8BoBBw0zLJPpXknFcOZH2zkUMWXat++MmgdB5wc=; b=30e+bzy8h+5KkZsrm2p3sIvhUw
	qq3VqQHsMRRVgyzLwIXuONwRRM2B76ruEEqAleFrhbBSbA34Hlggc2qBgB/bVwySQTui4k3cACJrA
	QIey/ety3Run7aeArSCyBrkkQ4twhZv8Seg95zzhfKQ04UcwQt7co88DHFsNWFNZIlCo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/P2M: deal with partial success of p2m_set_entry()
Message-Id: <E1mpUol-0006w5-Co@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:22:35 +0000

commit 74a11c43fd7e074b1f77631b446dd2115eacb9e8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Nov 22 11:12:32 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 22 12:27:30 2021 +0000

    x86/P2M: deal with partial success of p2m_set_entry()
    
    M2P and PoD stats need to remain in sync with P2M; if an update succeeds
    only partially, respective adjustments need to be made. If updates get
    made before the call, they may also need undoing upon complete failure
    (i.e. including the single-page case).
    
    Log-dirty state would better also be kept in sync.
    
    Note that the change to set_typed_p2m_entry() may not be strictly
    necessary (due to the order restriction enforced near the top of the
    function), but is being kept here to be on the safe side.
    
    This is CVE-2021-28705 and CVE-2021-28709 / XSA-389.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c | 116 ++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 102 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 2bd4d37286..def1695cf0 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -794,6 +794,7 @@ p2m_remove_page(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
     unsigned long i;
     p2m_type_t t;
     p2m_access_t a;
+    int rc;
 
     ASSERT(gfn_locked_by_me(p2m, gfn));
     P2M_DEBUG("removing gfn=%#lx mfn=%#lx\n", gfn_x(gfn), mfn_x(mfn));
@@ -825,8 +826,27 @@ 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);
+    rc = p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
+                       p2m->default_access);
+    if ( likely(!rc) || !mfn_valid(mfn) )
+        return rc;
+
+    /*
+     * The operation may have partially succeeded. For the failed part we need
+     * to undo the M2P update and, out of precaution, mark the pages dirty
+     * again.
+     */
+    for ( i = 0; i < (1UL << page_order); ++i )
+    {
+        p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0, NULL, NULL);
+        if ( !p2m_is_hole(t) && !p2m_is_special(t) && !p2m_is_shared(t) )
+        {
+            set_gpfn_from_mfn(mfn_x(mfn) + i, gfn_x(gfn) + i);
+            paging_mark_pfn_dirty(p2m->domain, _pfn(gfn_x(gfn) + i));
+        }
+    }
+
+    return rc;
 }
 
 int
@@ -1022,13 +1042,8 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
 
     /* Now, actually do the two-way mapping */
     rc = p2m_set_entry(p2m, gfn, mfn, page_order, t, p2m->default_access);
-    if ( rc == 0 )
+    if ( likely(!rc) )
     {
-        pod_lock(p2m);
-        p2m->pod.entry_count -= pod_count;
-        BUG_ON(p2m->pod.entry_count < 0);
-        pod_unlock(p2m);
-
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -1036,6 +1051,42 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                                   gfn_x(gfn_add(gfn, i)));
         }
     }
+    else
+    {
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update M2P and dirty state, while for the failed part we
+         * may need to adjust PoD stats as well as undo the earlier M2P update.
+         */
+        for ( i = 0; i < (1UL << page_order); ++i )
+        {
+            omfn = p2m->get_entry(p2m, gfn_add(gfn, i), &ot, &a, 0, NULL, NULL);
+            if ( p2m_is_pod(ot) )
+            {
+                BUG_ON(!pod_count);
+                --pod_count;
+            }
+            else if ( mfn_eq(omfn, mfn_add(mfn, i)) && ot == t &&
+                      a == p2m->default_access && !p2m_is_grant(t) )
+            {
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+                paging_mark_pfn_dirty(d, _pfn(gfn_x(gfn) + i));
+            }
+            else if ( p2m_is_ram(ot) && !p2m_is_paged(ot) )
+            {
+                ASSERT(mfn_valid(omfn));
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+            }
+        }
+    }
+
+    if ( pod_count )
+    {
+        pod_lock(p2m);
+        p2m->pod.entry_count -= pod_count;
+        BUG_ON(p2m->pod.entry_count < 0);
+        pod_unlock(p2m);
+    }
 
 out:
     p2m_unlock(p2m);
@@ -1325,6 +1376,49 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
             return 0;
         }
     }
+
+    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
+    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
+    if ( unlikely(rc) )
+    {
+        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
+                 gfn_l, order, rc, mfn_x(mfn));
+
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update PoD stats, M2P, and dirty state.
+         */
+        if ( order != PAGE_ORDER_4K )
+        {
+            unsigned long i;
+
+            for ( i = 0; i < (1UL << order); ++i )
+            {
+                p2m_type_t t;
+                mfn_t cmfn = p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0,
+                                            NULL, NULL);
+
+                if ( !mfn_eq(cmfn, mfn_add(mfn, i)) || t != gfn_p2mt ||
+                     a != access )
+                    continue;
+
+                if ( p2m_is_ram(ot) )
+                {
+                    ASSERT(mfn_valid(mfn_add(omfn, i)));
+                    set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
+
+                    ioreq_request_mapcache_invalidate(d);
+                }
+                else if ( p2m_is_pod(ot) )
+                {
+                    pod_lock(p2m);
+                    BUG_ON(!p2m->pod.entry_count);
+                    --p2m->pod.entry_count;
+                    pod_unlock(p2m);
+                }
+            }
+        }
+    }
     else if ( p2m_is_ram(ot) )
     {
         unsigned long i;
@@ -1337,12 +1431,6 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
 
         ioreq_request_mapcache_invalidate(d);
     }
-
-    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
-    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
-    if ( rc )
-        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
-                 gfn_l, order, rc, mfn_x(mfn));
     else if ( p2m_is_pod(ot) )
     {
         pod_lock(p2m);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:33:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229530.396918 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpUyw-0005EA-K4; Tue, 23 Nov 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 229530.396918; Tue, 23 Nov 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 1mpUyw-0005E1-Gd; Tue, 23 Nov 2021 12:33:06 +0000
Received: by outflank-mailman (input) for mailman id 229530;
 Tue, 23 Nov 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 1mpUyu-0005Dv-Tm
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpUyu-0002wc-Pc
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpUyu-0007nn-OP
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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=ZLMqKJwi7aaAvP2S2Hd+GNNep1Ed6QnUtYJd1TewTyI=; b=dkGFJwhstGiR5Be7cCKVBKZf1V
	A1Hf9USa0r5cRiRNz8TPbrEJn4OxsMG0utIu70jPAWackxyPViYT236kzYbFp7pAoW8/L3VYFWzLE
	5LFmVNl+9taXNxcpanUHRVbEBpADMKfdu2mYiCPHdGnRx/mlEsLB46YSsGvE2xvYETmE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] xen/page_alloc: Harden assign_pages()
Message-Id: <E1mpUyu-0007nn-OP@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:33:04 +0000

commit d02631a21530918501f7e11320667dde7829cbb5
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Nov 23 13:25:50 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:25:50 2021 +0100

    xen/page_alloc: Harden assign_pages()
    
    domain_tot_pages() and d->max_pages are 32-bit values. While the order
    should always be quite small, it would still be possible to overflow
    if domain_tot_pages() is near to (2^32 - 1).
    
    As this code may be called by a guest via XENMEM_increase_reservation
    and XENMEM_populate_physmap, we want to make sure the guest is not going
    to be able to allocate more than it is allowed.
    
    Rework the allocation check to avoid any possible overflow. While the
    check domain_tot_pages() < d->max_pages should technically not be
    necessary, it is probably best to have it to catch any possible
    inconsistencies in the future.
    
    This is CVE-2021-28706 / part of XSA-385.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 143501861d48e1bfef495849fd68584baac05849
    master date: 2021-11-22 11:11:05 +0000
---
 xen/common/grant_table.c |  7 ++++---
 xen/common/page_alloc.c  | 35 +++++++++++++++++++++++++++++------
 2 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 6f50e9de51..e2fcb07e27 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -2336,7 +2336,8 @@ gnttab_transfer(
          * pages when it is dying.
          */
         if ( unlikely(e->is_dying) ||
-             unlikely(domain_tot_pages(e) >= e->max_pages) )
+             unlikely(domain_tot_pages(e) >= e->max_pages) ||
+             unlikely(!(e->tot_pages + 1)) )
         {
             spin_unlock(&e->page_alloc_lock);
 
@@ -2345,8 +2346,8 @@ gnttab_transfer(
                          e->domain_id);
             else
                 gdprintk(XENLOG_INFO,
-                         "Transferee d%d has no headroom (tot %u, max %u)\n",
-                         e->domain_id, domain_tot_pages(e), e->max_pages);
+                         "Transferee %pd has no headroom (tot %u, max %u, ex %u)\n",
+                         e, domain_tot_pages(e), e->max_pages, e->extra_pages);
 
             gop.status = GNTST_general_error;
             goto unlock_and_copyback;
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 1744e6faa5..91cde4b775 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2298,20 +2298,43 @@ int assign_pages(
     }
     else if ( !(memflags & MEMF_no_refcount) )
     {
-        unsigned int tot_pages = domain_tot_pages(d) + (1 << order);
+        unsigned int tot_pages = domain_tot_pages(d), nr = 1u << order;
 
         if ( unlikely(tot_pages > d->max_pages) )
         {
-            gprintk(XENLOG_INFO, "Over-allocation for domain %u: "
-                    "%u > %u\n", d->domain_id, tot_pages, d->max_pages);
+            gprintk(XENLOG_INFO, "Inconsistent allocation for %pd: %u > %u\n",
+                    d, tot_pages, d->max_pages);
+            rc = -EPERM;
+            goto out;
+        }
+
+        if ( unlikely(nr > d->max_pages - tot_pages) )
+        {
+            gprintk(XENLOG_INFO, "Over-allocation for %pd: %Lu > %u\n",
+                    d, tot_pages + 0ull + nr, d->max_pages);
             rc = -E2BIG;
             goto out;
         }
     }
 
-    if ( !(memflags & MEMF_no_refcount) &&
-         unlikely(domain_adjust_tot_pages(d, 1 << order) == (1 << order)) )
-        get_knownalive_domain(d);
+    if ( !(memflags & MEMF_no_refcount) )
+    {
+        unsigned int nr = 1u << order;
+
+        if ( unlikely(d->tot_pages + nr < nr) )
+        {
+            gprintk(XENLOG_INFO,
+                    "Excess allocation for %pd: %Lu (%u extra)\n",
+                    d, d->tot_pages + 0ull + nr, d->extra_pages);
+            if ( pg[0].count_info & PGC_extra )
+                d->extra_pages -= nr;
+            rc = -E2BIG;
+            goto out;
+        }
+
+        if ( unlikely(domain_adjust_tot_pages(d, nr) == nr) )
+            get_knownalive_domain(d);
+    }
 
     for ( i = 0; i < (1 << order); i++ )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:33:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:33:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229531.396921 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpUz6-0005Gb-NI; Tue, 23 Nov 2021 12:33:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229531.396921; Tue, 23 Nov 2021 12:33:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpUz6-0005GT-KB; Tue, 23 Nov 2021 12:33:16 +0000
Received: by outflank-mailman (input) for mailman id 229531;
 Tue, 23 Nov 2021 12:33:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpUz4-0005GH-Td
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12: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 1mpUz4-0002wn-Sj
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:33:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpUz4-0007p3-Ro
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12: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=+sIKHjTyDZXaqF+9M+L9NdMjiQ8cdk/F/VMPfQfz++0=; b=liludeOdV9xV7m/cy7klDcFxYG
	vGTsAwq6rOWzcxEABdHrYlx6mZLpprFefLXGBY0aA6CP499XE2ZT7JBaUatKWutQP5NaqDAY5kGHC
	kXHrhgw8MHbmhHlzXqk1T9Yhr8y/DtyaoNfWKU7TD6o6kQQwpyzoJvH2LpEGSMBezwPQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/PoD: deal with misaligned GFNs
Message-Id: <E1mpUz4-0007p3-Ro@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:33:14 +0000

commit 1da54becd5de7e55b2b66665bedc2f30964dbd33
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:26:12 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:26:12 2021 +0100

    x86/PoD: deal with misaligned GFNs
    
    Users of XENMEM_decrease_reservation and XENMEM_populate_physmap aren't
    required to pass in order-aligned GFN values. (While I consider this
    bogus, I don't think we can fix this there, as that might break existing
    code, e.g Linux'es swiotlb, which - while affecting PV only - until
    recently had been enforcing only page alignment on the original
    allocation.) Only non-PoD code paths (guest_physmap_{add,remove}_page(),
    p2m_set_entry()) look to be dealing with this properly (in part by being
    implemented inefficiently, handling every 4k page separately).
    
    Introduce wrappers taking care of splitting the incoming request into
    aligned chunks, without putting much effort in trying to determine the
    largest possible chunk at every iteration.
    
    Also "handle" p2m_set_entry() failure for non-order-0 requests by
    crashing the domain in one more place. Alongside putting a log message
    there, also add one to the other similar path.
    
    Note regarding locking: This is left in the actual worker functions on
    the assumption that callers aren't guaranteed atomicity wrt acting on
    multiple pages at a time. For mis-aligned GFNs gfn_lock() wouldn't have
    locked the correct GFN range anyway, if it didn't simply resolve to
    p2m_lock(), and for well-behaved callers there continues to be only a
    single iteration, i.e. behavior is unchanged for them. (FTAOD pulling
    out just pod_lock() into p2m_pod_decrease_reservation() would result in
    a lock order violation.)
    
    This is CVE-2021-28704 and CVE-2021-28707 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 182c737b9ba540ebceb1433f3940fbed6eac4ea9
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m-pod.c | 75 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 63 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index 8abc57265c..2c3f4c0206 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -496,7 +496,7 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn);
 
 
 /*
- * This function is needed for two reasons:
+ * This pair of functions is needed for two reasons:
  * + To properly handle clearing of PoD entries
  * + To "steal back" memory being freed for the PoD cache, rather than
  *   releasing it.
@@ -504,8 +504,8 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn);
  * Once both of these functions have been completed, we can return and
  * allow decrease_reservation() to handle everything else.
  */
-unsigned long
-p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+static unsigned long
+decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
 {
     unsigned long ret = 0, i, n;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -552,8 +552,10 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
          * All PoD: Mark the whole region invalid and tell caller
          * we're done.
          */
-        if ( p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
-                           p2m->default_access) )
+        int rc = p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
+                               p2m->default_access);
+
+        if ( rc )
         {
             /*
              * If this fails, we can't tell how much of the range was changed.
@@ -561,7 +563,12 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
              * impossible.
              */
             if ( order != 0 )
+            {
+                printk(XENLOG_G_ERR
+                       "%pd: marking GFN %#lx (order %u) as non-PoD failed: %d\n",
+                       d, gfn_x(gfn), order, rc);
                 domain_crash(d);
+            }
             goto out_unlock;
         }
         ret = 1UL << order;
@@ -670,6 +677,22 @@ out_unlock:
     return ret;
 }
 
+unsigned long
+p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+{
+    unsigned long left = 1UL << order, ret = 0;
+    unsigned int chunk_order = find_first_set_bit(gfn_x(gfn) | left);
+
+    do {
+        ret += decrease_reservation(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn = gfn_add(gfn, 1UL << chunk_order);
+    } while ( left );
+
+    return ret;
+}
+
 void p2m_pod_dump_data(struct domain *d)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -1273,19 +1296,15 @@ remap_and_retry:
     return true;
 }
 
-
-int
-guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
-                                      unsigned int order)
+static int
+mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
+                        unsigned int order)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     gfn_t gfn = _gfn(gfn_l);
     unsigned long i, n, pod_count = 0;
     int rc = 0;
 
-    if ( !paging_mode_translate(d) )
-        return -EINVAL;
-
     gfn_lock(p2m, gfn, order);
 
     P2M_DEBUG("mark pod gfn=%#lx\n", gfn_l);
@@ -1325,6 +1344,17 @@ guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
 
         ioreq_request_mapcache_invalidate(d);
     }
+    else if ( order )
+    {
+        /*
+         * If this failed, we can't tell how much of the range was changed.
+         * Best to crash the domain.
+         */
+        printk(XENLOG_G_ERR
+               "%pd: marking GFN %#lx (order %u) as PoD failed: %d\n",
+               d, gfn_l, order, rc);
+        domain_crash(d);
+    }
 
 out:
     gfn_unlock(p2m, gfn, order);
@@ -1332,6 +1362,27 @@ out:
     return rc;
 }
 
+int
+guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
+                                      unsigned int order)
+{
+    unsigned long left = 1UL << order;
+    unsigned int chunk_order = find_first_set_bit(gfn | left);
+    int rc;
+
+    if ( !paging_mode_translate(d) )
+        return -EINVAL;
+
+    do {
+        rc = mark_populate_on_demand(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn += 1UL << chunk_order;
+    } while ( !rc && left );
+
+    return rc;
+}
+
 void p2m_pod_init(struct p2m_domain *p2m)
 {
     unsigned int i;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:33:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:33:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229533.396925 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpUzG-0005Jy-Ol; Tue, 23 Nov 2021 12:33:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229533.396925; Tue, 23 Nov 2021 12: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 1mpUzG-0005Jq-Lo; Tue, 23 Nov 2021 12:33:26 +0000
Received: by outflank-mailman (input) for mailman id 229533;
 Tue, 23 Nov 2021 12:33:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpUzF-0005JY-0w
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:33:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpUzF-0002wy-05
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpUzE-0007pu-VL
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:33:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vhcYu6uV93K3p3BbTmFpQrf1b/Geklk9g5lduprbS08=; b=sG31cC27/rKdihUx9Eg+0T2z1+
	7pdMkhFYhQ5MJKWfPpTw6tDmWpwS1hIPPCOCPZaM3YO8khm+F6+NAQ8aY+Ld+RiNAGVc7HLAsXmre
	yggXAQQdrgDDz27bfFN3bbaicGGVXtcTtna10tquppOWH84irJa5gs8rDR2rB18UCj7k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
Message-Id: <E1mpUzE-0007pu-VL@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:33:24 +0000

commit 4429ca0b29f481a2abfcc81990c5ac1f96276cb2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:26:22 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:26:22 2021 +0100

    x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
    
    p2m_pod_decrease_reservation() may pass pages to the function which
    aren't 4k, 2M, or 1G. Handle all intermediate orders as well, to avoid
    hitting the BUG() at the switch() statement's "default" case.
    
    This is CVE-2021-28708 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 8ec13f68e0b026863d23e7f44f252d06478bc809
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m-pod.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index 2c3f4c0206..efc9b4bb55 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -112,15 +112,13 @@ p2m_pod_cache_add(struct p2m_domain *p2m,
     /* Then add to the appropriate populate-on-demand list. */
     switch ( order )
     {
-    case PAGE_ORDER_1G:
-        for ( i = 0; i < (1UL << PAGE_ORDER_1G); i += 1UL << PAGE_ORDER_2M )
+    case PAGE_ORDER_2M ... PAGE_ORDER_1G:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_2M )
             page_list_add_tail(page + i, &p2m->pod.super);
         break;
-    case PAGE_ORDER_2M:
-        page_list_add_tail(page, &p2m->pod.super);
-        break;
-    case PAGE_ORDER_4K:
-        page_list_add_tail(page, &p2m->pod.single);
+    case PAGE_ORDER_4K ... PAGE_ORDER_2M - 1:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_4K )
+            page_list_add_tail(page + i, &p2m->pod.single);
         break;
     default:
         BUG();
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:33:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:33:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229535.396930 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpUzQ-0005N4-QU; Tue, 23 Nov 2021 12:33:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229535.396930; Tue, 23 Nov 2021 12: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 1mpUzQ-0005Mu-NK; Tue, 23 Nov 2021 12:33:36 +0000
Received: by outflank-mailman (input) for mailman id 229535;
 Tue, 23 Nov 2021 12: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 1mpUzP-0005MU-4U
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12: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 1mpUzP-0002xD-3e
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:33:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpUzP-0007qw-2e
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12: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=bHeR05wyqaW1MhRz2fcWNESbWdKdj0fadXSqsaq5vlQ=; b=NjJLYCSU+cOohfaaJFNogc61Yi
	A4p2mjzePkt8WVTZ/X20CdgCrr7EfAEJuCQbq6LJIZhbRyCe3nDZfu0DaFJxsY4OK8dYbG4e16Lud
	XiBj+1QW64lFjMZ0Q1DiKKm3owW5LF/kYee11o4MGkxJiQeEv5/fWvUCMRLRs9A/U22k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/P2M: deal with partial success of p2m_set_entry()
Message-Id: <E1mpUzP-0007qw-2e@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:33:35 +0000

commit 544e547a63175ac6ef7cc29c4f5bda88da024f69
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:26:29 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:26:29 2021 +0100

    x86/P2M: deal with partial success of p2m_set_entry()
    
    M2P and PoD stats need to remain in sync with P2M; if an update succeeds
    only partially, respective adjustments need to be made. If updates get
    made before the call, they may also need undoing upon complete failure
    (i.e. including the single-page case).
    
    Log-dirty state would better also be kept in sync.
    
    Note that the change to set_typed_p2m_entry() may not be strictly
    necessary (due to the order restriction enforced near the top of the
    function), but is being kept here to be on the safe side.
    
    This is CVE-2021-28705 and CVE-2021-28709 / XSA-389.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 74a11c43fd7e074b1f77631b446dd2115eacb9e8
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m.c | 118 ++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 104 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 9936142917..b96244e422 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -784,6 +784,7 @@ p2m_remove_page(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
     unsigned long i;
     p2m_type_t t;
     p2m_access_t a;
+    int rc;
 
     /* IOMMU for PV guests is handled in get_page_type() and put_page(). */
     if ( !paging_mode_translate(p2m->domain) )
@@ -819,8 +820,27 @@ 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);
+    rc = p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
+                       p2m->default_access);
+    if ( likely(!rc) || !mfn_valid(mfn) )
+        return rc;
+
+    /*
+     * The operation may have partially succeeded. For the failed part we need
+     * to undo the M2P update and, out of precaution, mark the pages dirty
+     * again.
+     */
+    for ( i = 0; i < (1UL << page_order); ++i )
+    {
+        p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0, NULL, NULL);
+        if ( !p2m_is_hole(t) && !p2m_is_special(t) && !p2m_is_shared(t) )
+        {
+            set_gpfn_from_mfn(mfn_x(mfn) + i, gfn_x(gfn) + i);
+            paging_mark_pfn_dirty(p2m->domain, _pfn(gfn_x(gfn) + i));
+        }
+    }
+
+    return rc;
 }
 
 int
@@ -1009,13 +1029,8 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
 
     /* Now, actually do the two-way mapping */
     rc = p2m_set_entry(p2m, gfn, mfn, page_order, t, p2m->default_access);
-    if ( rc == 0 )
+    if ( likely(!rc) )
     {
-        pod_lock(p2m);
-        p2m->pod.entry_count -= pod_count;
-        BUG_ON(p2m->pod.entry_count < 0);
-        pod_unlock(p2m);
-
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -1023,6 +1038,42 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                                   gfn_x(gfn_add(gfn, i)));
         }
     }
+    else
+    {
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update M2P and dirty state, while for the failed part we
+         * may need to adjust PoD stats as well as undo the earlier M2P update.
+         */
+        for ( i = 0; i < (1UL << page_order); ++i )
+        {
+            omfn = p2m->get_entry(p2m, gfn_add(gfn, i), &ot, &a, 0, NULL, NULL);
+            if ( p2m_is_pod(ot) )
+            {
+                BUG_ON(!pod_count);
+                --pod_count;
+            }
+            else if ( mfn_eq(omfn, mfn_add(mfn, i)) && ot == t &&
+                      a == p2m->default_access && !p2m_is_grant(t) )
+            {
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+                paging_mark_pfn_dirty(d, _pfn(gfn_x(gfn) + i));
+            }
+            else if ( p2m_is_ram(ot) && !p2m_is_paged(ot) )
+            {
+                ASSERT(mfn_valid(omfn));
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+            }
+        }
+    }
+
+    if ( pod_count )
+    {
+        pod_lock(p2m);
+        p2m->pod.entry_count -= pod_count;
+        BUG_ON(p2m->pod.entry_count < 0);
+        pod_unlock(p2m);
+    }
 
 out:
     p2m_unlock(p2m);
@@ -1314,6 +1365,51 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
             return 0;
         }
     }
+
+    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
+    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
+    if ( unlikely(rc) )
+    {
+        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
+                 gfn_l, order, rc, mfn_x(mfn));
+
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update PoD stats, M2P, and dirty state.
+         */
+        if ( order != PAGE_ORDER_4K )
+        {
+            unsigned long i;
+
+            for ( i = 0; i < (1UL << order); ++i )
+            {
+                p2m_type_t t;
+                mfn_t cmfn = p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0,
+                                            NULL, NULL);
+
+                if ( !mfn_eq(cmfn, mfn_add(mfn, i)) || t != gfn_p2mt ||
+                     a != access )
+                    continue;
+
+                if ( p2m_is_ram(ot) )
+                {
+                    ASSERT(mfn_valid(mfn_add(omfn, i)));
+                    set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
+
+                    ioreq_request_mapcache_invalidate(d);
+                }
+#ifdef CONFIG_HVM
+                else if ( p2m_is_pod(ot) )
+                {
+                    pod_lock(p2m);
+                    BUG_ON(!p2m->pod.entry_count);
+                    --p2m->pod.entry_count;
+                    pod_unlock(p2m);
+                }
+#endif
+            }
+        }
+    }
     else if ( p2m_is_ram(ot) )
     {
         unsigned long i;
@@ -1326,12 +1422,6 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
 
         ioreq_request_mapcache_invalidate(d);
     }
-
-    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
-    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
-    if ( rc )
-        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
-                 gfn_l, order, rc, mfn_x(mfn));
 #ifdef CONFIG_HVM
     else if ( p2m_is_pod(ot) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:33:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:33:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229537.396934 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpUza-0005Pp-Rl; Tue, 23 Nov 2021 12:33:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229537.396934; Tue, 23 Nov 2021 12: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 1mpUza-0005Ph-Op; Tue, 23 Nov 2021 12:33:46 +0000
Received: by outflank-mailman (input) for mailman id 229537;
 Tue, 23 Nov 2021 12:33:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpUzZ-0005PZ-JI
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:33:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpUzZ-0002xd-IU
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:33:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpUzZ-0007sL-Hk
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12: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=c3UL8QLhLQfv/GhElfqxchdBwrvuPiK3qKwF93bPtdc=; b=kMq7bEnuCCBjZ3YmJuLXlwo5xg
	/FXaKVb1aBLskZq2yyNc8zRZ5j2Lo1Idkh00v8gmkjS9R/wJHLZEsytiwo2DSjxY4phIwlo381k5S
	0plr0PY0/eJGGAXT7jciFBtVe85q5cAbGVGwHIU3slsCOO2Vq2A0SEU5TQHlqpZtEulY=;
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: Harden assign_pages()
Message-Id: <E1mpUzZ-0007sL-Hk@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:33:45 +0000

commit 497bd4aadf0c1a3fa2876352e25999c5803c512d
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Nov 23 13:29:09 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:29:09 2021 +0100

    xen/page_alloc: Harden assign_pages()
    
    domain_tot_pages() and d->max_pages are 32-bit values. While the order
    should always be quite small, it would still be possible to overflow
    if domain_tot_pages() is near to (2^32 - 1).
    
    As this code may be called by a guest via XENMEM_increase_reservation
    and XENMEM_populate_physmap, we want to make sure the guest is not going
    to be able to allocate more than it is allowed.
    
    Rework the allocation check to avoid any possible overflow. While the
    check domain_tot_pages() < d->max_pages should technically not be
    necessary, it is probably best to have it to catch any possible
    inconsistencies in the future.
    
    This is CVE-2021-28706 / part of XSA-385.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 143501861d48e1bfef495849fd68584baac05849
    master date: 2021-11-22 11:11:05 +0000
---
 xen/common/grant_table.c |  7 ++++---
 xen/common/page_alloc.c  | 35 +++++++++++++++++++++++++++++------
 2 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index f8486c3de7..90781e236e 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -2319,7 +2319,8 @@ gnttab_transfer(
          * pages when it is dying.
          */
         if ( unlikely(e->is_dying) ||
-             unlikely(domain_tot_pages(e) >= e->max_pages) )
+             unlikely(domain_tot_pages(e) >= e->max_pages) ||
+             unlikely(!(e->tot_pages + 1)) )
         {
             spin_unlock(&e->page_alloc_lock);
 
@@ -2328,8 +2329,8 @@ gnttab_transfer(
                          e->domain_id);
             else
                 gdprintk(XENLOG_INFO,
-                         "Transferee d%d has no headroom (tot %u, max %u)\n",
-                         e->domain_id, domain_tot_pages(e), e->max_pages);
+                         "Transferee %pd has no headroom (tot %u, max %u, ex %u)\n",
+                         e, domain_tot_pages(e), e->max_pages, e->extra_pages);
 
             gop.status = GNTST_general_error;
             goto unlock_and_copyback;
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 8859fa4fd1..4ec1b37ac9 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2298,20 +2298,43 @@ int assign_pages(
     }
     else if ( !(memflags & MEMF_no_refcount) )
     {
-        unsigned int tot_pages = domain_tot_pages(d) + (1 << order);
+        unsigned int tot_pages = domain_tot_pages(d), nr = 1u << order;
 
         if ( unlikely(tot_pages > d->max_pages) )
         {
-            gprintk(XENLOG_INFO, "Over-allocation for domain %u: "
-                    "%u > %u\n", d->domain_id, tot_pages, d->max_pages);
+            gprintk(XENLOG_INFO, "Inconsistent allocation for %pd: %u > %u\n",
+                    d, tot_pages, d->max_pages);
+            rc = -EPERM;
+            goto out;
+        }
+
+        if ( unlikely(nr > d->max_pages - tot_pages) )
+        {
+            gprintk(XENLOG_INFO, "Over-allocation for %pd: %Lu > %u\n",
+                    d, tot_pages + 0ull + nr, d->max_pages);
             rc = -E2BIG;
             goto out;
         }
     }
 
-    if ( !(memflags & MEMF_no_refcount) &&
-         unlikely(domain_adjust_tot_pages(d, 1 << order) == (1 << order)) )
-        get_knownalive_domain(d);
+    if ( !(memflags & MEMF_no_refcount) )
+    {
+        unsigned int nr = 1u << order;
+
+        if ( unlikely(d->tot_pages + nr < nr) )
+        {
+            gprintk(XENLOG_INFO,
+                    "Excess allocation for %pd: %Lu (%u extra)\n",
+                    d, d->tot_pages + 0ull + nr, d->extra_pages);
+            if ( pg[0].count_info & PGC_extra )
+                d->extra_pages -= nr;
+            rc = -E2BIG;
+            goto out;
+        }
+
+        if ( unlikely(domain_adjust_tot_pages(d, nr) == nr) )
+            get_knownalive_domain(d);
+    }
 
     for ( i = 0; i < (1 << order); i++ )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:33:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:33:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229539.396938 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpUzl-0005TC-Ta; Tue, 23 Nov 2021 12:33:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229539.396938; Tue, 23 Nov 2021 12:33:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpUzl-0005T4-QN; Tue, 23 Nov 2021 12:33:57 +0000
Received: by outflank-mailman (input) for mailman id 229539;
 Tue, 23 Nov 2021 12:33: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 1mpUzj-0005Sh-MM
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:33: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 1mpUzj-0002xo-Lf
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:33:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpUzj-0007tc-Kh
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:33:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=L+JSSqaqhIWrIXGtqp3lJNnEihmTA28X8+t3VR1wr54=; b=suyVjGf6ir5OAkGRExQW+z4AGX
	WoTExLohyXcMYlhyaFmOkWXIJYNMe1mC4Yk/DmHJ8WrSY7zInKs8fJR1Son9frBuwTv3mZrUlcKHj
	KyUBlKdxTdyM/y907zhPPMhYdW0roY3IX5vNBcho1FTOFPZ9iVIimvf7TZB8t5toEm4M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/PoD: deal with misaligned GFNs
Message-Id: <E1mpUzj-0007tc-Kh@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:33:55 +0000

commit 7f654ea88ee6100f5948f383a38254be8c28a255
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:29:41 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:29:41 2021 +0100

    x86/PoD: deal with misaligned GFNs
    
    Users of XENMEM_decrease_reservation and XENMEM_populate_physmap aren't
    required to pass in order-aligned GFN values. (While I consider this
    bogus, I don't think we can fix this there, as that might break existing
    code, e.g Linux'es swiotlb, which - while affecting PV only - until
    recently had been enforcing only page alignment on the original
    allocation.) Only non-PoD code paths (guest_physmap_{add,remove}_page(),
    p2m_set_entry()) look to be dealing with this properly (in part by being
    implemented inefficiently, handling every 4k page separately).
    
    Introduce wrappers taking care of splitting the incoming request into
    aligned chunks, without putting much effort in trying to determine the
    largest possible chunk at every iteration.
    
    Also "handle" p2m_set_entry() failure for non-order-0 requests by
    crashing the domain in one more place. Alongside putting a log message
    there, also add one to the other similar path.
    
    Note regarding locking: This is left in the actual worker functions on
    the assumption that callers aren't guaranteed atomicity wrt acting on
    multiple pages at a time. For mis-aligned GFNs gfn_lock() wouldn't have
    locked the correct GFN range anyway, if it didn't simply resolve to
    p2m_lock(), and for well-behaved callers there continues to be only a
    single iteration, i.e. behavior is unchanged for them. (FTAOD pulling
    out just pod_lock() into p2m_pod_decrease_reservation() would result in
    a lock order violation.)
    
    This is CVE-2021-28704 and CVE-2021-28707 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 182c737b9ba540ebceb1433f3940fbed6eac4ea9
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m-pod.c | 75 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 63 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index b64f561fa7..fd5bad31f0 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -495,7 +495,7 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn);
 
 
 /*
- * This function is needed for two reasons:
+ * This pair of functions is needed for two reasons:
  * + To properly handle clearing of PoD entries
  * + To "steal back" memory being freed for the PoD cache, rather than
  *   releasing it.
@@ -503,8 +503,8 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn);
  * Once both of these functions have been completed, we can return and
  * allow decrease_reservation() to handle everything else.
  */
-unsigned long
-p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+static unsigned long
+decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
 {
     unsigned long ret = 0, i, n;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -551,8 +551,10 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
          * All PoD: Mark the whole region invalid and tell caller
          * we're done.
          */
-        if ( p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
-                           p2m->default_access) )
+        int rc = p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
+                               p2m->default_access);
+
+        if ( rc )
         {
             /*
              * If this fails, we can't tell how much of the range was changed.
@@ -560,7 +562,12 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
              * impossible.
              */
             if ( order != 0 )
+            {
+                printk(XENLOG_G_ERR
+                       "%pd: marking GFN %#lx (order %u) as non-PoD failed: %d\n",
+                       d, gfn_x(gfn), order, rc);
                 domain_crash(d);
+            }
             goto out_unlock;
         }
         ret = 1UL << order;
@@ -667,6 +674,22 @@ out_unlock:
     return ret;
 }
 
+unsigned long
+p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+{
+    unsigned long left = 1UL << order, ret = 0;
+    unsigned int chunk_order = find_first_set_bit(gfn_x(gfn) | left);
+
+    do {
+        ret += decrease_reservation(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn = gfn_add(gfn, 1UL << chunk_order);
+    } while ( left );
+
+    return ret;
+}
+
 void p2m_pod_dump_data(struct domain *d)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -1266,19 +1289,15 @@ remap_and_retry:
     return true;
 }
 
-
-int
-guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
-                                      unsigned int order)
+static int
+mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
+                        unsigned int order)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     gfn_t gfn = _gfn(gfn_l);
     unsigned long i, n, pod_count = 0;
     int rc = 0;
 
-    if ( !paging_mode_translate(d) )
-        return -EINVAL;
-
     gfn_lock(p2m, gfn, order);
 
     P2M_DEBUG("mark pod gfn=%#lx\n", gfn_l);
@@ -1316,6 +1335,17 @@ guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
         BUG_ON(p2m->pod.entry_count < 0);
         pod_unlock(p2m);
     }
+    else if ( order )
+    {
+        /*
+         * If this failed, we can't tell how much of the range was changed.
+         * Best to crash the domain.
+         */
+        printk(XENLOG_G_ERR
+               "%pd: marking GFN %#lx (order %u) as PoD failed: %d\n",
+               d, gfn_l, order, rc);
+        domain_crash(d);
+    }
 
 out:
     gfn_unlock(p2m, gfn, order);
@@ -1323,6 +1353,27 @@ out:
     return rc;
 }
 
+int
+guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
+                                      unsigned int order)
+{
+    unsigned long left = 1UL << order;
+    unsigned int chunk_order = find_first_set_bit(gfn | left);
+    int rc;
+
+    if ( !paging_mode_translate(d) )
+        return -EINVAL;
+
+    do {
+        rc = mark_populate_on_demand(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn += 1UL << chunk_order;
+    } while ( !rc && left );
+
+    return rc;
+}
+
 void p2m_pod_init(struct p2m_domain *p2m)
 {
     unsigned int i;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:34:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:34:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229542.396941 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpUzu-0005WK-WB; Tue, 23 Nov 2021 12:34:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229542.396941; Tue, 23 Nov 2021 12:34:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpUzu-0005WC-T9; Tue, 23 Nov 2021 12:34:06 +0000
Received: by outflank-mailman (input) for mailman id 229542;
 Tue, 23 Nov 2021 12:34: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 1mpUzt-0005Vs-Pc
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:34: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 1mpUzt-0002y8-On
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:34:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpUzt-0007uW-Nu
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:34: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=GRyoCNJYgXpyyqt/aWDmPnneoLFyb1P/U+UgwS6u6pw=; b=7F5pFQphNeAZ21HUSfWp4nfiL7
	f6upZZ/K3sqGj1FsZ384m5roym9ELP5CL0cBvU0Oc3S/dy0nw9dMRg/5v9gw4Zuc9kurd2iLbQbR5
	IjRsF6yWAJwg+LEZpYSyTC2xmTv/y/q6l4u6pPyGzF2vgA732n19+p48mlTZv+dzS500=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
Message-Id: <E1mpUzt-0007uW-Nu@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:34:05 +0000

commit 3ae94651cf0b08f86f1aba012f6bdd42c449c68b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:29:54 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:29:54 2021 +0100

    x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
    
    p2m_pod_decrease_reservation() may pass pages to the function which
    aren't 4k, 2M, or 1G. Handle all intermediate orders as well, to avoid
    hitting the BUG() at the switch() statement's "default" case.
    
    This is CVE-2021-28708 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 8ec13f68e0b026863d23e7f44f252d06478bc809
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m-pod.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index fd5bad31f0..d947595132 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -111,15 +111,13 @@ p2m_pod_cache_add(struct p2m_domain *p2m,
     /* Then add to the appropriate populate-on-demand list. */
     switch ( order )
     {
-    case PAGE_ORDER_1G:
-        for ( i = 0; i < (1UL << PAGE_ORDER_1G); i += 1UL << PAGE_ORDER_2M )
+    case PAGE_ORDER_2M ... PAGE_ORDER_1G:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_2M )
             page_list_add_tail(page + i, &p2m->pod.super);
         break;
-    case PAGE_ORDER_2M:
-        page_list_add_tail(page, &p2m->pod.super);
-        break;
-    case PAGE_ORDER_4K:
-        page_list_add_tail(page, &p2m->pod.single);
+    case PAGE_ORDER_4K ... PAGE_ORDER_2M - 1:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_4K )
+            page_list_add_tail(page + i, &p2m->pod.single);
         break;
     default:
         BUG();
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:34:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:34:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229545.396946 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpV05-0005ZQ-1C; Tue, 23 Nov 2021 12:34:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229545.396946; Tue, 23 Nov 2021 12:34:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpV04-0005ZI-Ub; Tue, 23 Nov 2021 12:34:16 +0000
Received: by outflank-mailman (input) for mailman id 229545;
 Tue, 23 Nov 2021 12:34: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 1mpV03-0005ZA-Sq
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:34: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 1mpV03-0002yQ-S3
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:34:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpV03-0007vR-RF
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:34:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oNZC5B4TMZ9SQaNUoTl/kkVjVenlRMqaf4Q1wZ6NAh0=; b=qELYLkPqMnsPf0STEPVfBpwANH
	hnwGCW5O1hrj3ozrI6WSpHYuF0y0UtQ+5rAxxfb/fwyccgY37Ou02j6RlsaRsAvLTEg0B5iaG/NoF
	VYX0NVEbREF8TXbXpU6u70AYxXRViyGMy9AbC8jZpDroRtQ8fJ26QIjdfZQnhyehAx6A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/P2M: deal with partial success of p2m_set_entry()
Message-Id: <E1mpV03-0007vR-RF@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:34:15 +0000

commit 9de3671772d5019dab2ba7be7ad1032ad3c9e0f2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:30:09 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:30:09 2021 +0100

    x86/P2M: deal with partial success of p2m_set_entry()
    
    M2P and PoD stats need to remain in sync with P2M; if an update succeeds
    only partially, respective adjustments need to be made. If updates get
    made before the call, they may also need undoing upon complete failure
    (i.e. including the single-page case).
    
    Log-dirty state would better also be kept in sync.
    
    Note that the change to set_typed_p2m_entry() may not be strictly
    necessary (due to the order restriction enforced near the top of the
    function), but is being kept here to be on the safe side.
    
    This is CVE-2021-28705 and CVE-2021-28709 / XSA-389.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 74a11c43fd7e074b1f77631b446dd2115eacb9e8
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m.c | 116 ++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 102 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 165efed3f2..ee0f2f6a09 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -780,6 +780,7 @@ p2m_remove_page(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
     unsigned long i;
     p2m_type_t t;
     p2m_access_t a;
+    int rc;
 
     /* IOMMU for PV guests is handled in get_page_type() and put_page(). */
     if ( !paging_mode_translate(p2m->domain) )
@@ -813,8 +814,27 @@ p2m_remove_page(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
         }
     }
 
-    return p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
-                         p2m->default_access);
+    rc = p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
+                       p2m->default_access);
+    if ( likely(!rc) || !mfn_valid(mfn) )
+        return rc;
+
+    /*
+     * The operation may have partially succeeded. For the failed part we need
+     * to undo the M2P update and, out of precaution, mark the pages dirty
+     * again.
+     */
+    for ( i = 0; i < (1UL << page_order); ++i )
+    {
+        p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0, NULL, NULL);
+        if ( !p2m_is_hole(t) && !p2m_is_special(t) && !p2m_is_shared(t) )
+        {
+            set_gpfn_from_mfn(mfn_x(mfn) + i, gfn_x(gfn) + i);
+            paging_mark_pfn_dirty(p2m->domain, _pfn(gfn_x(gfn) + i));
+        }
+    }
+
+    return rc;
 }
 
 int
@@ -1003,13 +1023,8 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
 
     /* Now, actually do the two-way mapping */
     rc = p2m_set_entry(p2m, gfn, mfn, page_order, t, p2m->default_access);
-    if ( rc == 0 )
+    if ( likely(!rc) )
     {
-        pod_lock(p2m);
-        p2m->pod.entry_count -= pod_count;
-        BUG_ON(p2m->pod.entry_count < 0);
-        pod_unlock(p2m);
-
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -1017,6 +1032,42 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                                   gfn_x(gfn_add(gfn, i)));
         }
     }
+    else
+    {
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update M2P and dirty state, while for the failed part we
+         * may need to adjust PoD stats as well as undo the earlier M2P update.
+         */
+        for ( i = 0; i < (1UL << page_order); ++i )
+        {
+            omfn = p2m->get_entry(p2m, gfn_add(gfn, i), &ot, &a, 0, NULL, NULL);
+            if ( p2m_is_pod(ot) )
+            {
+                BUG_ON(!pod_count);
+                --pod_count;
+            }
+            else if ( mfn_eq(omfn, mfn_add(mfn, i)) && ot == t &&
+                      a == p2m->default_access && !p2m_is_grant(t) )
+            {
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+                paging_mark_pfn_dirty(d, _pfn(gfn_x(gfn) + i));
+            }
+            else if ( p2m_is_ram(ot) && !p2m_is_paged(ot) )
+            {
+                ASSERT(mfn_valid(omfn));
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+            }
+        }
+    }
+
+    if ( pod_count )
+    {
+        pod_lock(p2m);
+        p2m->pod.entry_count -= pod_count;
+        BUG_ON(p2m->pod.entry_count < 0);
+        pod_unlock(p2m);
+    }
 
 out:
     p2m_unlock(p2m);
@@ -1308,6 +1359,49 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
             return 0;
         }
     }
+
+    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
+    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
+    if ( unlikely(rc) )
+    {
+        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
+                 gfn_l, order, rc, mfn_x(mfn));
+
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update PoD stats, M2P, and dirty state.
+         */
+        if ( order != PAGE_ORDER_4K )
+        {
+            unsigned long i;
+
+            for ( i = 0; i < (1UL << order); ++i )
+            {
+                p2m_type_t t;
+                mfn_t cmfn = p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0,
+                                            NULL, NULL);
+
+                if ( !mfn_eq(cmfn, mfn_add(mfn, i)) || t != gfn_p2mt ||
+                     a != access )
+                    continue;
+
+                if ( p2m_is_ram(ot) )
+                {
+                    ASSERT(mfn_valid(mfn_add(omfn, i)));
+                    set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
+                }
+#ifdef CONFIG_HVM
+                else if ( p2m_is_pod(ot) )
+                {
+                    pod_lock(p2m);
+                    BUG_ON(!p2m->pod.entry_count);
+                    --p2m->pod.entry_count;
+                    pod_unlock(p2m);
+                }
+#endif
+            }
+        }
+    }
     else if ( p2m_is_ram(ot) )
     {
         unsigned long i;
@@ -1318,12 +1412,6 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
             set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
         }
     }
-
-    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
-    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
-    if ( rc )
-        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
-                 gfn_l, order, rc, mfn_x(mfn));
 #ifdef CONFIG_HVM
     else if ( p2m_is_pod(ot) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:34:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:34:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229546.396950 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpV0F-0005c8-2s; Tue, 23 Nov 2021 12:34:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229546.396950; Tue, 23 Nov 2021 12:34:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpV0E-0005c0-W6; Tue, 23 Nov 2021 12:34:26 +0000
Received: by outflank-mailman (input) for mailman id 229546;
 Tue, 23 Nov 2021 12:34:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpV0E-0005br-AZ
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:34:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpV0E-0002yX-9n
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:34:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpV0E-0007xB-99
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:34:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2zUtdTVON5/ayytJLWfI77gUP2KBTLuajOequZbxwn4=; b=pbsdB1mA/nNXvKN7Krzhyjcgwv
	GuT/RW9D70Cf7hByJdEC7f0gG5pWcU+OxkgEk7X6m3Fw3IsrH81xCda0o/ouRez8ZX9Yfw0PJvGst
	hUlTNTov1ObFe+e21oM/SmaFvLxCSKp46uQ5KfF53JDW2kuXj56twyvVO14X7kAuROYs=;
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: Harden assign_pages()
Message-Id: <E1mpV0E-0007xB-99@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:34:26 +0000

commit 0b28069aa7c26288376040e6ee9ca145245db39e
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Nov 23 13:32:26 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:32:26 2021 +0100

    xen/page_alloc: Harden assign_pages()
    
    domain_tot_pages() and d->max_pages are 32-bit values. While the order
    should always be quite small, it would still be possible to overflow
    if domain_tot_pages() is near to (2^32 - 1).
    
    As this code may be called by a guest via XENMEM_increase_reservation
    and XENMEM_populate_physmap, we want to make sure the guest is not going
    to be able to allocate more than it is allowed.
    
    Rework the allocation check to avoid any possible overflow. While the
    check domain_tot_pages() < d->max_pages should technically not be
    necessary, it is probably best to have it to catch any possible
    inconsistencies in the future.
    
    This is CVE-2021-28706 / part of XSA-385.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 143501861d48e1bfef495849fd68584baac05849
    master date: 2021-11-22 11:11:05 +0000
---
 xen/common/grant_table.c |  7 ++++---
 xen/common/page_alloc.c  | 19 ++++++++++++++-----
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index d2853a664a..7b775a8c35 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -2286,7 +2286,8 @@ gnttab_transfer(
          * pages when it is dying.
          */
         if ( unlikely(e->is_dying) ||
-             unlikely(e->tot_pages >= e->max_pages) )
+             unlikely(e->tot_pages >= e->max_pages) ||
+             unlikely(!(e->tot_pages + 1)) )
         {
             spin_unlock(&e->page_alloc_lock);
 
@@ -2295,8 +2296,8 @@ gnttab_transfer(
                          e->domain_id);
             else
                 gdprintk(XENLOG_INFO,
-                         "Transferee d%d has no headroom (tot %u, max %u)\n",
-                         e->domain_id, e->tot_pages, e->max_pages);
+                         "Transferee %pd has no headroom (tot %u, max %u)\n",
+                         e, e->tot_pages, e->max_pages);
 
             gop.status = GNTST_general_error;
             goto unlock_and_copyback;
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 1563188f4f..0976bf6489 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2276,16 +2276,25 @@ int assign_pages(
 
     if ( !(memflags & MEMF_no_refcount) )
     {
-        if ( unlikely((d->tot_pages + (1 << order)) > d->max_pages) )
+        unsigned int nr = 1u << order;
+
+        if ( unlikely(d->tot_pages > d->max_pages) )
+        {
+            gprintk(XENLOG_INFO, "Inconsistent allocation for %pd: %u > %u\n",
+                    d, d->tot_pages, d->max_pages);
+            rc = -EPERM;
+            goto out;
+        }
+
+        if ( unlikely(nr > d->max_pages - d->tot_pages) )
         {
-            gprintk(XENLOG_INFO, "Over-allocation for domain %u: "
-                    "%u > %u\n", d->domain_id,
-                    d->tot_pages + (1 << order), d->max_pages);
+            gprintk(XENLOG_INFO, "Over-allocation for %pd: %Lu > %u\n",
+                    d, d->tot_pages + 0ull + nr, d->max_pages);
             rc = -E2BIG;
             goto out;
         }
 
-        if ( unlikely(domain_adjust_tot_pages(d, 1 << order) == (1 << order)) )
+        if ( unlikely(domain_adjust_tot_pages(d, nr) == nr) )
             get_knownalive_domain(d);
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:34:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:34:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229548.396954 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpV0P-0005f3-4B; Tue, 23 Nov 2021 12:34:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229548.396954; Tue, 23 Nov 2021 12:34:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpV0P-0005ev-1F; Tue, 23 Nov 2021 12:34:37 +0000
Received: by outflank-mailman (input) for mailman id 229548;
 Tue, 23 Nov 2021 12:34:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpV0O-0005ej-DS
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:34:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpV0O-0002yb-Ci
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:34:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpV0O-0007yA-C3
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:34:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vbvprbHJD+Y8ELAPBFUxV122nvF4IyNjfLFLYEZ4WcE=; b=V4+EasfqhGJzoEMHiI+/M+G2MR
	ku+DjJMnl7d9mrX6CqTbZ5XjsTu/Nx26nvA9Dlvv/Lk/QQsEC6ioHJAafHF7Z9stwWYHBNsfUGW2U
	co8pPVOc51JHi42f8gcQysPgk28buywPnlKQUYYtB/dyBWRh0Om5X3l+IlR3NyxS7bhQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] x86/PoD: deal with misaligned GFNs
Message-Id: <E1mpV0O-0007yA-C3@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:34:36 +0000

commit d94d006ed36084914c2931641b724ae262e3fb80
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:32:54 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:32:54 2021 +0100

    x86/PoD: deal with misaligned GFNs
    
    Users of XENMEM_decrease_reservation and XENMEM_populate_physmap aren't
    required to pass in order-aligned GFN values. (While I consider this
    bogus, I don't think we can fix this there, as that might break existing
    code, e.g Linux'es swiotlb, which - while affecting PV only - until
    recently had been enforcing only page alignment on the original
    allocation.) Only non-PoD code paths (guest_physmap_{add,remove}_page(),
    p2m_set_entry()) look to be dealing with this properly (in part by being
    implemented inefficiently, handling every 4k page separately).
    
    Introduce wrappers taking care of splitting the incoming request into
    aligned chunks, without putting much effort in trying to determine the
    largest possible chunk at every iteration.
    
    Also "handle" p2m_set_entry() failure for non-order-0 requests by
    crashing the domain in one more place. Alongside putting a log message
    there, also add one to the other similar path.
    
    Note regarding locking: This is left in the actual worker functions on
    the assumption that callers aren't guaranteed atomicity wrt acting on
    multiple pages at a time. For mis-aligned GFNs gfn_lock() wouldn't have
    locked the correct GFN range anyway, if it didn't simply resolve to
    p2m_lock(), and for well-behaved callers there continues to be only a
    single iteration, i.e. behavior is unchanged for them. (FTAOD pulling
    out just pod_lock() into p2m_pod_decrease_reservation() would result in
    a lock order violation.)
    
    This is CVE-2021-28704 and CVE-2021-28707 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 182c737b9ba540ebceb1433f3940fbed6eac4ea9
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m-pod.c | 75 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 63 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index 007cdd87d0..c14801f5ff 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -495,7 +495,7 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn);
 
 
 /*
- * This function is needed for two reasons:
+ * This pair of functions is needed for two reasons:
  * + To properly handle clearing of PoD entries
  * + To "steal back" memory being freed for the PoD cache, rather than
  *   releasing it.
@@ -503,8 +503,8 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn);
  * Once both of these functions have been completed, we can return and
  * allow decrease_reservation() to handle everything else.
  */
-unsigned long
-p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+static unsigned long
+decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
 {
     unsigned long ret = 0, i, n;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -557,8 +557,10 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
          * All PoD: Mark the whole region invalid and tell caller
          * we're done.
          */
-        if ( p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
-                           p2m->default_access) )
+        int rc = p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
+                               p2m->default_access);
+
+        if ( rc )
         {
             /*
              * If this fails, we can't tell how much of the range was changed.
@@ -566,7 +568,12 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
              * impossible.
              */
             if ( order != 0 )
+            {
+                printk(XENLOG_G_ERR
+                       "%pd: marking GFN %#lx (order %u) as non-PoD failed: %d\n",
+                       d, gfn_x(gfn), order, rc);
                 domain_crash(d);
+            }
             goto out_unlock;
         }
         ret = 1UL << order;
@@ -674,6 +681,22 @@ out_unlock:
     return ret;
 }
 
+unsigned long
+p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+{
+    unsigned long left = 1UL << order, ret = 0;
+    unsigned int chunk_order = find_first_set_bit(gfn_x(gfn) | left);
+
+    do {
+        ret += decrease_reservation(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn = gfn_add(gfn, 1UL << chunk_order);
+    } while ( left );
+
+    return ret;
+}
+
 void p2m_pod_dump_data(struct domain *d)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -1269,19 +1292,15 @@ remap_and_retry:
     return true;
 }
 
-
-int
-guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
-                                      unsigned int order)
+static int
+mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
+                        unsigned int order)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     gfn_t gfn = _gfn(gfn_l);
     unsigned long i, n, pod_count = 0;
     int rc = 0;
 
-    if ( !paging_mode_translate(d) )
-        return -EINVAL;
-
     gfn_lock(p2m, gfn, order);
 
     P2M_DEBUG("mark pod gfn=%#lx\n", gfn_l);
@@ -1319,6 +1338,17 @@ guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
         BUG_ON(p2m->pod.entry_count < 0);
         pod_unlock(p2m);
     }
+    else if ( order )
+    {
+        /*
+         * If this failed, we can't tell how much of the range was changed.
+         * Best to crash the domain.
+         */
+        printk(XENLOG_G_ERR
+               "%pd: marking GFN %#lx (order %u) as PoD failed: %d\n",
+               d, gfn_l, order, rc);
+        domain_crash(d);
+    }
 
 out:
     gfn_unlock(p2m, gfn, order);
@@ -1326,6 +1356,27 @@ out:
     return rc;
 }
 
+int
+guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
+                                      unsigned int order)
+{
+    unsigned long left = 1UL << order;
+    unsigned int chunk_order = find_first_set_bit(gfn | left);
+    int rc;
+
+    if ( !paging_mode_translate(d) )
+        return -EINVAL;
+
+    do {
+        rc = mark_populate_on_demand(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn += 1UL << chunk_order;
+    } while ( !rc && left );
+
+    return rc;
+}
+
 void p2m_pod_init(struct p2m_domain *p2m)
 {
     unsigned int i;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:34:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:34:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229550.396958 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpV0Z-0005i4-5w; Tue, 23 Nov 2021 12:34:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229550.396958; Tue, 23 Nov 2021 12:34:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpV0Z-0005hu-2j; Tue, 23 Nov 2021 12:34:47 +0000
Received: by outflank-mailman (input) for mailman id 229550;
 Tue, 23 Nov 2021 12:34:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpV0Y-0005hl-GL
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:34:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpV0Y-0002yz-Fb
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:34:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpV0Y-0007zf-Eq
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:34:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=spctE9TraSzuF75EiUd4tenq5anI9E01eFxM+iv96qM=; b=IU55ciHzp7B9f47PpNiNUz57go
	1H4f7AVZ+o5P6llxSY0Ad1eJjo3h3XS+jfpC3TiN1YVHXG3WQnVgkgHlgfHqXVtxCprpUNPeYZxMh
	Lp2FCQTtH2gh/9aCWv6I3Mqu0kdosnMJTKkCilQeZNsTjtL3VSsyAYAOnysgudPaH840=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
Message-Id: <E1mpV0Y-0007zf-Eq@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:34:46 +0000

commit d3cfb4b3a680d3e2ddd36f18201d48441f36aea0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:33:14 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:33:14 2021 +0100

    x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
    
    p2m_pod_decrease_reservation() may pass pages to the function which
    aren't 4k, 2M, or 1G. Handle all intermediate orders as well, to avoid
    hitting the BUG() at the switch() statement's "default" case.
    
    This is CVE-2021-28708 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 8ec13f68e0b026863d23e7f44f252d06478bc809
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m-pod.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index c14801f5ff..c981200087 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -111,15 +111,13 @@ p2m_pod_cache_add(struct p2m_domain *p2m,
     /* Then add to the appropriate populate-on-demand list. */
     switch ( order )
     {
-    case PAGE_ORDER_1G:
-        for ( i = 0; i < (1UL << PAGE_ORDER_1G); i += 1UL << PAGE_ORDER_2M )
+    case PAGE_ORDER_2M ... PAGE_ORDER_1G:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_2M )
             page_list_add_tail(page + i, &p2m->pod.super);
         break;
-    case PAGE_ORDER_2M:
-        page_list_add_tail(page, &p2m->pod.super);
-        break;
-    case PAGE_ORDER_4K:
-        page_list_add_tail(page, &p2m->pod.single);
+    case PAGE_ORDER_4K ... PAGE_ORDER_2M - 1:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_4K )
+            page_list_add_tail(page + i, &p2m->pod.single);
         break;
     default:
         BUG();
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:34:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:34:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229552.396961 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpV0j-0005le-8q; Tue, 23 Nov 2021 12:34:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229552.396961; Tue, 23 Nov 2021 12:34:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpV0j-0005lV-5l; Tue, 23 Nov 2021 12:34:57 +0000
Received: by outflank-mailman (input) for mailman id 229552;
 Tue, 23 Nov 2021 12:34:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpV0i-0005lJ-JI
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:34:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpV0i-0002zE-IY
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:34:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpV0i-00080c-Hs
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 12:34:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0jd/pByO3aI1ypk9b4SsD9gp6WdZwdXkaYmZb3SdQK8=; b=QyIA81U0sT9GOEikYgmQ/zAU1k
	RbgUpsyR0SwOaqfx+2gMTM8pWJNU3TcbA8t71mFJknuewrnfr8CEWFFB7idGHaoka9LZHjJY9ZKBe
	eo180cHnOJ48cADw40qjpPwsqJ+dhr8Z4EkA4Hndad+drTlZPDeZTHQ7Ejwj/FBQJ7zU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] x86/P2M: deal with partial success of p2m_set_entry()
Message-Id: <E1mpV0i-00080c-Hs@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:34:56 +0000

commit d3c2319ea1657f31ae3899713afc23789b771c10
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:33:33 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:33:33 2021 +0100

    x86/P2M: deal with partial success of p2m_set_entry()
    
    M2P and PoD stats need to remain in sync with P2M; if an update succeeds
    only partially, respective adjustments need to be made. If updates get
    made before the call, they may also need undoing upon complete failure
    (i.e. including the single-page case).
    
    Log-dirty state would better also be kept in sync.
    
    Note that the change to set_typed_p2m_entry() may not be strictly
    necessary (due to the order restriction enforced near the top of the
    function), but is being kept here to be on the safe side.
    
    This is CVE-2021-28705 and CVE-2021-28709 / XSA-389.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 74a11c43fd7e074b1f77631b446dd2115eacb9e8
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m.c | 116 ++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 102 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index a68b4fe526..a6bfda010a 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -781,6 +781,7 @@ p2m_remove_page(struct p2m_domain *p2m, unsigned long gfn_l, unsigned long mfn,
     gfn_t gfn = _gfn(gfn_l);
     p2m_type_t t;
     p2m_access_t a;
+    int rc;
 
     /* IOMMU for PV guests is handled in get_page_type() and put_page(). */
     if ( !paging_mode_translate(p2m->domain) )
@@ -812,8 +813,27 @@ p2m_remove_page(struct p2m_domain *p2m, unsigned long gfn_l, unsigned long mfn,
                 set_gpfn_from_mfn(mfn+i, INVALID_M2P_ENTRY);
         }
     }
-    return p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
-                         p2m->default_access);
+    rc = p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
+                       p2m->default_access);
+    if ( likely(!rc) || !mfn_valid(_mfn(mfn)) )
+        return rc;
+
+    /*
+     * The operation may have partially succeeded. For the failed part we need
+     * to undo the M2P update and, out of precaution, mark the pages dirty
+     * again.
+     */
+    for ( i = 0; i < (1UL << page_order); ++i )
+    {
+        p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0, NULL, NULL);
+        if ( !p2m_is_hole(t) && !p2m_is_special(t) && !p2m_is_shared(t) )
+        {
+            set_gpfn_from_mfn(mfn + i, gfn_l + i);
+            paging_mark_pfn_dirty(p2m->domain, _pfn(gfn_l + i));
+        }
+    }
+
+    return rc;
 }
 
 int
@@ -1002,13 +1022,8 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
 
     /* Now, actually do the two-way mapping */
     rc = p2m_set_entry(p2m, gfn, mfn, page_order, t, p2m->default_access);
-    if ( rc == 0 )
+    if ( likely(!rc) )
     {
-        pod_lock(p2m);
-        p2m->pod.entry_count -= pod_count;
-        BUG_ON(p2m->pod.entry_count < 0);
-        pod_unlock(p2m);
-
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -1016,6 +1031,42 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                                   gfn_x(gfn_add(gfn, i)));
         }
     }
+    else
+    {
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update M2P and dirty state, while for the failed part we
+         * may need to adjust PoD stats as well as undo the earlier M2P update.
+         */
+        for ( i = 0; i < (1UL << page_order); ++i )
+        {
+            omfn = p2m->get_entry(p2m, gfn_add(gfn, i), &ot, &a, 0, NULL, NULL);
+            if ( p2m_is_pod(ot) )
+            {
+                BUG_ON(!pod_count);
+                --pod_count;
+            }
+            else if ( mfn_eq(omfn, mfn_add(mfn, i)) && ot == t &&
+                      a == p2m->default_access && !p2m_is_grant(t) )
+            {
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+                paging_mark_pfn_dirty(d, _pfn(gfn_x(gfn) + i));
+            }
+            else if ( p2m_is_ram(ot) && !p2m_is_paged(ot) )
+            {
+                ASSERT(mfn_valid(omfn));
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+            }
+        }
+    }
+
+    if ( pod_count )
+    {
+        pod_lock(p2m);
+        p2m->pod.entry_count -= pod_count;
+        BUG_ON(p2m->pod.entry_count < 0);
+        pod_unlock(p2m);
+    }
 
  out:
     p2m_unlock(p2m);
@@ -1307,6 +1358,49 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
             return 0;
         }
     }
+
+    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
+    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
+    if ( unlikely(rc) )
+    {
+        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
+                 gfn_l, order, rc, mfn_x(mfn));
+
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update PoD stats, M2P, and dirty state.
+         */
+        if ( order != PAGE_ORDER_4K )
+        {
+            unsigned long i;
+
+            for ( i = 0; i < (1UL << order); ++i )
+            {
+                p2m_type_t t;
+                mfn_t cmfn = p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0,
+                                            NULL, NULL);
+
+                if ( !mfn_eq(cmfn, mfn_add(mfn, i)) || t != gfn_p2mt ||
+                     a != access )
+                    continue;
+
+                if ( p2m_is_ram(ot) )
+                {
+                    ASSERT(mfn_valid(mfn_add(omfn, i)));
+                    set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
+                }
+#ifdef CONFIG_HVM
+                else if ( p2m_is_pod(ot) )
+                {
+                    pod_lock(p2m);
+                    BUG_ON(!p2m->pod.entry_count);
+                    --p2m->pod.entry_count;
+                    pod_unlock(p2m);
+                }
+#endif
+            }
+        }
+    }
     else if ( p2m_is_ram(ot) )
     {
         unsigned long i;
@@ -1317,12 +1411,6 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
             set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
         }
     }
-
-    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
-    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
-    if ( rc )
-        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
-                 gfn_l, order, rc, mfn_x(mfn));
 #ifdef CONFIG_HVM
     else if ( p2m_is_pod(ot) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:44:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229559.396965 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpV9Z-0006iw-U9; Tue, 23 Nov 2021 12:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229559.396965; Tue, 23 Nov 2021 12:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpV9Z-0006ip-RO; Tue, 23 Nov 2021 12:44:05 +0000
Received: by outflank-mailman (input) for mailman id 229559;
 Tue, 23 Nov 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 1mpV9Y-0006ij-TP
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpV9Y-00039M-Qq
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpV9Y-0000Ls-Px
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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=ZahwfRzINq4RVTqNuOD6JBvg/aQsY92w9ybdlu3GMY0=; b=YayMip2kP6cUzJK83ZqW6PoscO
	loHXJ0gytD7HVgODuxhGiLL9z2lDGDj1bnWjVHSVl/c0tCR8SzXgo0jOHTjceYdeS7ybIzafcAExH
	9zA7EQByCVDGUPcGsGn9HP2AE9XG90s32DPzujPMu8wygln4tuydGNzAkMcXx4bs7b9A=;
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: Harden assign_pages()
Message-Id: <E1mpV9Y-0000Ls-Px@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:44:04 +0000

commit 8e657cfe0aec6c2bf548cae98a97d2485304d4c6
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Nov 23 13:35:03 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:35:03 2021 +0100

    xen/page_alloc: Harden assign_pages()
    
    domain_tot_pages() and d->max_pages are 32-bit values. While the order
    should always be quite small, it would still be possible to overflow
    if domain_tot_pages() is near to (2^32 - 1).
    
    As this code may be called by a guest via XENMEM_increase_reservation
    and XENMEM_populate_physmap, we want to make sure the guest is not going
    to be able to allocate more than it is allowed.
    
    Rework the allocation check to avoid any possible overflow. While the
    check domain_tot_pages() < d->max_pages should technically not be
    necessary, it is probably best to have it to catch any possible
    inconsistencies in the future.
    
    This is CVE-2021-28706 / part of XSA-385.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 143501861d48e1bfef495849fd68584baac05849
    master date: 2021-11-22 11:11:05 +0000
---
 xen/common/grant_table.c |  7 ++++---
 xen/common/page_alloc.c  | 19 ++++++++++++++-----
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 2bc00f30a3..ee5748e74e 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -2239,7 +2239,8 @@ gnttab_transfer(
          * pages when it is dying.
          */
         if ( unlikely(e->is_dying) ||
-             unlikely(e->tot_pages >= e->max_pages) )
+             unlikely(e->tot_pages >= e->max_pages) ||
+             unlikely(!(e->tot_pages + 1)) )
         {
             spin_unlock(&e->page_alloc_lock);
 
@@ -2248,8 +2249,8 @@ gnttab_transfer(
                          e->domain_id);
             else
                 gdprintk(XENLOG_INFO,
-                         "Transferee d%d has no headroom (tot %u, max %u)\n",
-                         e->domain_id, e->tot_pages, e->max_pages);
+                         "Transferee %pd has no headroom (tot %u, max %u)\n",
+                         e, e->tot_pages, e->max_pages);
 
             gop.status = GNTST_general_error;
             goto unlock_and_copyback;
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 1dee9a05d4..3ab90aca32 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2278,17 +2278,26 @@ int assign_pages(
 
     if ( !(memflags & MEMF_no_refcount) )
     {
-        if ( unlikely((d->tot_pages + (1 << order)) > d->max_pages) )
+        unsigned int nr = 1u << order;
+
+        if ( unlikely(d->tot_pages > d->max_pages) )
+        {
+            gprintk(XENLOG_INFO, "Inconsistent allocation for %pd: %u > %u\n",
+                    d, d->tot_pages, d->max_pages);
+            rc = -EPERM;
+            goto out;
+        }
+
+        if ( unlikely(nr > d->max_pages - d->tot_pages) )
         {
             if ( !tmem_enabled() || order != 0 || d->tot_pages != d->max_pages )
-                gprintk(XENLOG_INFO, "Over-allocation for domain %u: "
-                        "%u > %u\n", d->domain_id,
-                        d->tot_pages + (1 << order), d->max_pages);
+                gprintk(XENLOG_INFO, "Over-allocation for %pd: %Lu > %u\n",
+                        d, d->tot_pages + 0ull + nr, d->max_pages);
             rc = -E2BIG;
             goto out;
         }
 
-        if ( unlikely(domain_adjust_tot_pages(d, 1 << order) == (1 << order)) )
+        if ( unlikely(domain_adjust_tot_pages(d, nr) == nr) )
             get_knownalive_domain(d);
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:44:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229564.396970 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpV9j-0006lD-W4; Tue, 23 Nov 2021 12:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229564.396970; Tue, 23 Nov 2021 12:44:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpV9j-0006l4-Sw; Tue, 23 Nov 2021 12:44:15 +0000
Received: by outflank-mailman (input) for mailman id 229564;
 Tue, 23 Nov 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 1mpV9i-0006ku-VF
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpV9i-00039e-UL
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpV9i-0000Mg-TF
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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=rWTbOR5t35JfouKeXzvgl3QVFLdlC0G/4MZ8+qQ3Ts4=; b=YlCyYHAr9JK/Pdaej7DcSPZiSL
	ikEwrZBdygiUGIH0R6+LZIgQ2nmm/NB/Y0K57JedcPLXs7YzBUx0jU/pl3/y3Wyma1mRHeSDDQWLH
	9XG+VEJwDTswCvxxT7GEvqGKoc/T8wxuxRhI2uHBOYsqH2JRZoxkPdjOtdNH0dP1gqqs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] x86/PoD: deal with misaligned GFNs
Message-Id: <E1mpV9i-0000Mg-TF@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:44:14 +0000

commit 398f7aec5dab6ad0853a8b069b48ae304e059fa4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:35:36 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:35:36 2021 +0100

    x86/PoD: deal with misaligned GFNs
    
    Users of XENMEM_decrease_reservation and XENMEM_populate_physmap aren't
    required to pass in order-aligned GFN values. (While I consider this
    bogus, I don't think we can fix this there, as that might break existing
    code, e.g Linux'es swiotlb, which - while affecting PV only - until
    recently had been enforcing only page alignment on the original
    allocation.) Only non-PoD code paths (guest_physmap_{add,remove}_page(),
    p2m_set_entry()) look to be dealing with this properly (in part by being
    implemented inefficiently, handling every 4k page separately).
    
    Introduce wrappers taking care of splitting the incoming request into
    aligned chunks, without putting much effort in trying to determine the
    largest possible chunk at every iteration.
    
    Also "handle" p2m_set_entry() failure for non-order-0 requests by
    crashing the domain in one more place. Alongside putting a log message
    there, also add one to the other similar path.
    
    Note regarding locking: This is left in the actual worker functions on
    the assumption that callers aren't guaranteed atomicity wrt acting on
    multiple pages at a time. For mis-aligned GFNs gfn_lock() wouldn't have
    locked the correct GFN range anyway, if it didn't simply resolve to
    p2m_lock(), and for well-behaved callers there continues to be only a
    single iteration, i.e. behavior is unchanged for them. (FTAOD pulling
    out just pod_lock() into p2m_pod_decrease_reservation() would result in
    a lock order violation.)
    
    This is CVE-2021-28704 and CVE-2021-28707 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 182c737b9ba540ebceb1433f3940fbed6eac4ea9
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m-pod.c | 75 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 63 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index f4e5a35578..6e3d474b80 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -497,7 +497,7 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn);
 
 
 /*
- * This function is needed for two reasons:
+ * This pair of functions is needed for two reasons:
  * + To properly handle clearing of PoD entries
  * + To "steal back" memory being freed for the PoD cache, rather than
  *   releasing it.
@@ -505,8 +505,8 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn);
  * Once both of these functions have been completed, we can return and
  * allow decrease_reservation() to handle everything else.
  */
-unsigned long
-p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+static unsigned long
+decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
 {
     unsigned long ret = 0, i, n;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -559,8 +559,10 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
          * All PoD: Mark the whole region invalid and tell caller
          * we're done.
          */
-        if ( p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
-                           p2m->default_access) )
+        int rc = p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
+                               p2m->default_access);
+
+        if ( rc )
         {
             /*
              * If this fails, we can't tell how much of the range was changed.
@@ -568,7 +570,12 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
              * impossible.
              */
             if ( order != 0 )
+            {
+                printk(XENLOG_G_ERR
+                       "%pd: marking GFN %#lx (order %u) as non-PoD failed: %d\n",
+                       d, gfn_x(gfn), order, rc);
                 domain_crash(d);
+            }
             goto out_unlock;
         }
         ret = 1UL << order;
@@ -676,6 +683,22 @@ out_unlock:
     return ret;
 }
 
+unsigned long
+p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+{
+    unsigned long left = 1UL << order, ret = 0;
+    unsigned int chunk_order = find_first_set_bit(gfn_x(gfn) | left);
+
+    do {
+        ret += decrease_reservation(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn = gfn_add(gfn, 1UL << chunk_order);
+    } while ( left );
+
+    return ret;
+}
+
 void p2m_pod_dump_data(struct domain *d)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -1271,19 +1294,15 @@ remap_and_retry:
     return true;
 }
 
-
-int
-guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
-                                      unsigned int order)
+static int
+mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
+                        unsigned int order)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     gfn_t gfn = _gfn(gfn_l);
     unsigned long i, n, pod_count = 0;
     int rc = 0;
 
-    if ( !paging_mode_translate(d) )
-        return -EINVAL;
-
     gfn_lock(p2m, gfn, order);
 
     P2M_DEBUG("mark pod gfn=%#lx\n", gfn_l);
@@ -1321,6 +1340,17 @@ guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
         BUG_ON(p2m->pod.entry_count < 0);
         pod_unlock(p2m);
     }
+    else if ( order )
+    {
+        /*
+         * If this failed, we can't tell how much of the range was changed.
+         * Best to crash the domain.
+         */
+        printk(XENLOG_G_ERR
+               "%pd: marking GFN %#lx (order %u) as PoD failed: %d\n",
+               d, gfn_l, order, rc);
+        domain_crash(d);
+    }
 
 out:
     gfn_unlock(p2m, gfn, order);
@@ -1328,6 +1358,27 @@ out:
     return rc;
 }
 
+int
+guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
+                                      unsigned int order)
+{
+    unsigned long left = 1UL << order;
+    unsigned int chunk_order = find_first_set_bit(gfn | left);
+    int rc;
+
+    if ( !paging_mode_translate(d) )
+        return -EINVAL;
+
+    do {
+        rc = mark_populate_on_demand(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn += 1UL << chunk_order;
+    } while ( !rc && left );
+
+    return rc;
+}
+
 void p2m_pod_init(struct p2m_domain *p2m)
 {
     unsigned int i;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:44:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:44:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229565.396974 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpV9u-0006oG-18; Tue, 23 Nov 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 229565.396974; Tue, 23 Nov 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 1mpV9t-0006o8-UT; Tue, 23 Nov 2021 12:44:25 +0000
Received: by outflank-mailman (input) for mailman id 229565;
 Tue, 23 Nov 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 1mpV9t-0006nq-24
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpV9t-00039r-1C
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpV9t-0000NF-0E
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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=z7NtalYSmSG2xBfikWtPohcbKa2QZWjDmcSSJx3zBqM=; b=nY7Yo+5jXbL/DbMNQEoH27gdGv
	Zb3zWlxTTswnq1omC32l+YVVo97qMXVnLnQYpoQM6HPwt3Gek/vfw4KezUD9Jr95hZgVvyb4lE0H0
	xxKDXU7R5uuJ6LddWqymh9WAjze0f5vEhrJ/NlwtKkAMXG3DyAN0+qlJPAqBkw3Xq5VU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
Message-Id: <E1mpV9t-0000NF-0E@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:44:25 +0000

commit 1a2e8d6cccddf984fce09b7b8b1139d81cea421e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:35:55 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:35:55 2021 +0100

    x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
    
    p2m_pod_decrease_reservation() may pass pages to the function which
    aren't 4k, 2M, or 1G. Handle all intermediate orders as well, to avoid
    hitting the BUG() at the switch() statement's "default" case.
    
    This is CVE-2021-28708 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 8ec13f68e0b026863d23e7f44f252d06478bc809
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m-pod.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index 6e3d474b80..f075ad692f 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -111,15 +111,13 @@ p2m_pod_cache_add(struct p2m_domain *p2m,
     /* Then add to the appropriate populate-on-demand list. */
     switch ( order )
     {
-    case PAGE_ORDER_1G:
-        for ( i = 0; i < (1UL << PAGE_ORDER_1G); i += 1UL << PAGE_ORDER_2M )
+    case PAGE_ORDER_2M ... PAGE_ORDER_1G:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_2M )
             page_list_add_tail(page + i, &p2m->pod.super);
         break;
-    case PAGE_ORDER_2M:
-        page_list_add_tail(page, &p2m->pod.super);
-        break;
-    case PAGE_ORDER_4K:
-        page_list_add_tail(page, &p2m->pod.single);
+    case PAGE_ORDER_4K ... PAGE_ORDER_2M - 1:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_4K )
+            page_list_add_tail(page + i, &p2m->pod.single);
         break;
     default:
         BUG();
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 12:44:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 12:44:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229568.396977 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpVA4-0006rW-2n; Tue, 23 Nov 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 229568.396977; Tue, 23 Nov 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 1mpVA3-0006rO-W2; Tue, 23 Nov 2021 12:44:35 +0000
Received: by outflank-mailman (input) for mailman id 229568;
 Tue, 23 Nov 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 1mpVA3-0006rD-54
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpVA3-0003A1-4F
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpVA3-0000O0-3T
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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=CsDXiT0BOazzfhUzdHkV5V/8+iJTNZou7J6QRUWq4kE=; b=yMQSsQouJBH5FZ25vs7K5OvOnx
	5qDb482P5AkFuANL65wEMSguCDXknlCvuej5rvYt0LXsFKmzW4Z8xK+YqoG176kTWXuNcJ3Aj9EXO
	OUdb4CVxM0n1ieeM4LUhg0O/0DGZRZgghABsAuETYuzv6pPIHRMd4kmXT+v3t61Xn6nQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.12] x86/P2M: deal with partial success of p2m_set_entry()
Message-Id: <E1mpVA3-0000O0-3T@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 12:44:35 +0000

commit 1442eb9ac448ca43c58bd65dbd82dca0c412c143
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:36:28 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:36:28 2021 +0100

    x86/P2M: deal with partial success of p2m_set_entry()
    
    M2P and PoD stats need to remain in sync with P2M; if an update succeeds
    only partially, respective adjustments need to be made. If updates get
    made before the call, they may also need undoing upon complete failure
    (i.e. including the single-page case).
    
    Log-dirty state would better also be kept in sync.
    
    Note that the change to set_typed_p2m_entry() may not be strictly
    necessary (due to the order restriction enforced near the top of the
    function), but is being kept here to be on the safe side.
    
    This is CVE-2021-28705 and CVE-2021-28709 / XSA-389.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 74a11c43fd7e074b1f77631b446dd2115eacb9e8
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m.c | 120 +++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 104 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index f3fdc79ff4..266b6a0416 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -780,6 +780,7 @@ p2m_remove_page(struct p2m_domain *p2m, unsigned long gfn_l, unsigned long mfn,
     gfn_t gfn = _gfn(gfn_l);
     p2m_type_t t;
     p2m_access_t a;
+    int rc;
 
     /* IOMMU for PV guests is handled in get_page_type() and put_page(). */
     if ( !paging_mode_translate(p2m->domain) )
@@ -811,8 +812,27 @@ p2m_remove_page(struct p2m_domain *p2m, unsigned long gfn_l, unsigned long mfn,
                 set_gpfn_from_mfn(mfn+i, INVALID_M2P_ENTRY);
         }
     }
-    return p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
-                         p2m->default_access);
+    rc = p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
+                       p2m->default_access);
+    if ( likely(!rc) || !mfn_valid(_mfn(mfn)) )
+        return rc;
+
+    /*
+     * The operation may have partially succeeded. For the failed part we need
+     * to undo the M2P update and, out of precaution, mark the pages dirty
+     * again.
+     */
+    for ( i = 0; i < (1UL << page_order); ++i )
+    {
+        p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0, NULL, NULL);
+        if ( !p2m_is_hole(t) && !p2m_is_special(t) && !p2m_is_shared(t) )
+        {
+            set_gpfn_from_mfn(mfn + i, gfn_l + i);
+            paging_mark_pfn_dirty(p2m->domain, _pfn(gfn_l + i));
+        }
+    }
+
+    return rc;
 }
 
 int
@@ -980,15 +1000,8 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
 
     /* Now, actually do the two-way mapping */
     rc = p2m_set_entry(p2m, gfn, mfn, page_order, t, p2m->default_access);
-    if ( rc == 0 )
+    if ( likely(!rc) )
     {
-#ifdef CONFIG_HVM
-        pod_lock(p2m);
-        p2m->pod.entry_count -= pod_count;
-        BUG_ON(p2m->pod.entry_count < 0);
-        pod_unlock(p2m);
-#endif
-
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -996,6 +1009,44 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                                   gfn_x(gfn_add(gfn, i)));
         }
     }
+    else
+    {
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update M2P and dirty state, while for the failed part we
+         * may need to adjust PoD stats as well as undo the earlier M2P update.
+         */
+        for ( i = 0; i < (1UL << page_order); ++i )
+        {
+            omfn = p2m->get_entry(p2m, gfn_add(gfn, i), &ot, &a, 0, NULL, NULL);
+            if ( p2m_is_pod(ot) )
+            {
+                BUG_ON(!pod_count);
+                --pod_count;
+            }
+            else if ( mfn_eq(omfn, mfn_add(mfn, i)) && ot == t &&
+                      a == p2m->default_access && !p2m_is_grant(t) )
+            {
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+                paging_mark_pfn_dirty(d, _pfn(gfn_x(gfn) + i));
+            }
+            else if ( p2m_is_ram(ot) && !p2m_is_paged(ot) )
+            {
+                ASSERT(mfn_valid(omfn));
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+            }
+        }
+    }
+
+#ifdef CONFIG_HVM
+    if ( pod_count )
+    {
+        pod_lock(p2m);
+        p2m->pod.entry_count -= pod_count;
+        BUG_ON(p2m->pod.entry_count < 0);
+        pod_unlock(p2m);
+    }
+#endif
 
  out:
     p2m_unlock(p2m);
@@ -1278,6 +1329,49 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
         domain_crash(d);
         return -EPERM;
     }
+
+    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
+    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
+    if ( unlikely(rc) )
+    {
+        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
+                 gfn_l, order, rc, mfn_x(mfn));
+
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update PoD stats, M2P, and dirty state.
+         */
+        if ( order != PAGE_ORDER_4K )
+        {
+            unsigned long i;
+
+            for ( i = 0; i < (1UL << order); ++i )
+            {
+                p2m_type_t t;
+                mfn_t cmfn = p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0,
+                                            NULL, NULL);
+
+                if ( !mfn_eq(cmfn, mfn_add(mfn, i)) || t != gfn_p2mt ||
+                     a != access )
+                    continue;
+
+                if ( p2m_is_ram(ot) )
+                {
+                    ASSERT(mfn_valid(mfn_add(omfn, i)));
+                    set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
+                }
+#ifdef CONFIG_HVM
+                else if ( p2m_is_pod(ot) )
+                {
+                    pod_lock(p2m);
+                    BUG_ON(!p2m->pod.entry_count);
+                    --p2m->pod.entry_count;
+                    pod_unlock(p2m);
+                }
+#endif
+            }
+        }
+    }
     else if ( p2m_is_ram(ot) )
     {
         unsigned long i;
@@ -1288,12 +1382,6 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
             set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
         }
     }
-
-    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
-    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
-    if ( rc )
-        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
-                 gfn_l, order, rc, mfn_x(mfn));
 #ifdef CONFIG_HVM
     else if ( p2m_is_pod(ot) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 16:55:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 16:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229804.397337 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpZ4T-0006qJ-4G; Tue, 23 Nov 2021 16:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229804.397337; Tue, 23 Nov 2021 16: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 1mpZ4T-0006qB-1O; Tue, 23 Nov 2021 16:55:05 +0000
Received: by outflank-mailman (input) for mailman id 229804;
 Tue, 23 Nov 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 1mpZ4S-0006q5-9x
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpZ4S-000854-97
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpZ4S-0003Vb-8O
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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=uqp16XS8LSO68XxuDTIRN+Ph7WHBUxh0G/arGqaqTgs=; b=0DlyHWT3ma0unb6E7oif8FiDZk
	ZhzD7vIDL5Si+uA8YLV4nbL/a/51yiZAkShOSdyKkVBeuvvUZMIOh8I4FtvcXtCTaxCfiL6F0fJ8p
	umBSsEG3So0QngZPE88vti+zTM7H/uTbKSuLro1zAha8lRnBWdsnaIwQC3UQqby+e9l4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] Config.mk: switch to named tags (for stable branch)
Message-Id: <E1mpZ4S-0003Vb-8O@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 16:55:04 +0000

commit c6fbb058f6edf00bc09ec503de246df7c985cc18
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 23 16:39:47 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 23 16:43:49 2021 +0000

    Config.mk: switch to named tags (for stable branch)
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 Config.mk | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/Config.mk b/Config.mk
index 6be010c7ce..b32a185efc 100644
--- a/Config.mk
+++ b/Config.mk
@@ -239,17 +239,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
-QEMU_UPSTREAM_REVISION ?= b6e539830bf45e2d7a6bd86ddfdf003088b173b0
-MINIOS_UPSTREAM_REVISION ?= 9f09744aa3e5982a083ecf8e9cd2123f477081f9
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.16.0-rc4
+MINIOS_UPSTREAM_REVISION ?= xen-4.16.0-rc4
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= 3d273dd05e51e5a1ffba3d98c7437ee84e8f8764
-# Wed Jul 15 10:01:40 2020 +0100
-# qemu-trad: remove Xen path dependencies
+QEMU_TRADITIONAL_REVISION ?= xen-4.16.0-rc4
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 16:55:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 16:55:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229805.397340 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpZ4d-0006sU-5d; Tue, 23 Nov 2021 16:55:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229805.397340; Tue, 23 Nov 2021 16:55:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpZ4d-0006sM-2q; Tue, 23 Nov 2021 16:55:15 +0000
Received: by outflank-mailman (input) for mailman id 229805;
 Tue, 23 Nov 2021 16: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 1mpZ4c-0006sC-D0
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 16: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 1mpZ4c-00085G-CH
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 16:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpZ4c-0003Xo-BL
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 16: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=5gS62hFJkyu0J9ojpLm0r/yE8rS7hGWb3OLwTzySsqM=; b=Vdpr9cfnC1rgsgNlFz8k8Qg7E6
	WRNlmOf2GJs0+ji7PZANVyrflqD6P8Fek69dImsAUbLhQHjgziGjDFWg5f+zrl8MMmiNMrZXe9C41
	rwYreUaAi2ccDwMfjUEKcJFBmHuL++gOsbSAlahvG26DAmEOnhkmAANEDYb0YZdXmp6k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] SUPPORT.md: Set Release Notes link
Message-Id: <E1mpZ4c-0003Xo-BL@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 16:55:14 +0000

commit 4d9eed06124701c23d62713edc095e4f8841ae05
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 23 16:41:30 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 23 16:43:49 2021 +0000

    SUPPORT.md: Set Release Notes link
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 SUPPORT.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 3a34933c89..b1367e2b22 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -9,13 +9,13 @@ for the definitions of the support status levels etc.
 
 # Release Support
 
-    Xen-Version: unstable
+    Xen-Version: 4.16
     Initial-Release: n/a
     Supported-Until: TBD
     Security-Support-Until: Unreleased - not yet security-supported
 
 Release Notes
-: <a href="https://wiki.xenproject.org/wiki/Xen_Project_X.YY_Release_Notes">RN</a>
+: <a href="https://wiki.xenproject.org/wiki/Xen_Project_4.16_Release_Notes">RN</a>
 
 # Feature Support
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 16:55:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 16:55:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229807.397345 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpZ4n-0006vl-7A; Tue, 23 Nov 2021 16:55:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229807.397345; Tue, 23 Nov 2021 16:55:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpZ4n-0006vd-4I; Tue, 23 Nov 2021 16:55:25 +0000
Received: by outflank-mailman (input) for mailman id 229807;
 Tue, 23 Nov 2021 16:55:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpZ4m-0006vV-G6
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 16:55:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpZ4m-00085Q-FO
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 16:55:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpZ4m-0003jy-EX
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 16:55:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sANH22jkKEF9Z+BUrB1Geqnp3BH6IP6mKOnlf414SZM=; b=JveLaI3l8sE4kiZFIYYQDKLXeC
	0T+cLm5GwBTbzNBqEA87oCy4cCe6ALgDLBUeEx7buN3xWBwVv7N9Riets/+A9bcWcnQ+C097C4NJH
	FjSHGd9vw1ZwSYhNmBHi8Fun6nGcBWyuOuFL6PyRGWaTLXRLQRjuGTQXIE/I+x4blgyA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] Turn off debug by default
Message-Id: <E1mpZ4m-0003jy-EX@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 16:55:24 +0000

commit 59505f48fabed2e6fa5ad992edaabeb4a1441599
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 23 16:43:31 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 23 16:43:49 2021 +0000

    Turn off debug by default
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 tools/Rules.mk    | 2 +-
 xen/Kconfig.debug | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index b022da3336..051a5d3555 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -25,7 +25,7 @@ CFLAGS_xeninclude = -I$(XEN_INCLUDE)
 XENSTORE_XENSTORED ?= y
 
 # A debug build of tools?
-debug ?= y
+debug ?= n
 debug_symbols ?= $(debug)
 
 XEN_GOCODE_URL    = golang.xenproject.org
diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
index fad3050d4f..4419030235 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -3,7 +3,7 @@ menu "Debugging Options"
 
 config DEBUG
 	bool "Developer Checks"
-	default y
+	default n
 	---help---
 	  If you say Y here this will enable developer checks such as asserts
 	  and extra printks. This option is intended for development purposes
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 17:11:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 17:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229834.397394 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpZJx-0002iz-GH; Tue, 23 Nov 2021 17:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229834.397394; Tue, 23 Nov 2021 17: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 1mpZJx-0002ir-D8; Tue, 23 Nov 2021 17:11:05 +0000
Received: by outflank-mailman (input) for mailman id 229834;
 Tue, 23 Nov 2021 17:11:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpZJw-0002il-HZ
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 17:11:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpZJw-0008Q0-EF
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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 1mpZJw-0005WB-DH
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 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=vKHgWXbOnDwKObqOyvOkKsUV7FCLw7BuQw1dGVzoKws=; b=v9Wkxi4y92JF+zpxBwlvIuPleq
	yarcMkxi1YT/uduQus7f/x/PObfw9QANGJpWk2QRbfE7wnzypwB9eO3gsH1yioIAXtpGd3rS+iZ4A
	UZJJ5mMYNuusoCs5n7AhtBeqfjWh7saVUZEhIfzHeRzUUWd1r9OR98S3Xv2Ohlf6f4xI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Revert "Config.mk: pin QEMU_UPSTREAM_REVISION (prep for Xen 4.16 RC1)"
Message-Id: <E1mpZJw-0005WB-DH@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 17:11:04 +0000

commit 4fe6e73a8cc8f3fa93a7c6a52a9a03b24e51ea18
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 23 16:51:47 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 23 16:51:47 2021 +0000

    Revert "Config.mk: pin QEMU_UPSTREAM_REVISION (prep for Xen 4.16 RC1)"
    
    This branch is unstable again now.
    
    This reverts commit c9ce6afbf2d7772f47fc572bb7fc9555724927ed.
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 6be010c7ce..6587c7d626 100644
--- a/Config.mk
+++ b/Config.mk
@@ -239,7 +239,7 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
-QEMU_UPSTREAM_REVISION ?= b6e539830bf45e2d7a6bd86ddfdf003088b173b0
+QEMU_UPSTREAM_REVISION ?= master
 MINIOS_UPSTREAM_REVISION ?= 9f09744aa3e5982a083ecf8e9cd2123f477081f9
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 17:11:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 17:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229835.397397 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpZK7-0002kk-HV; Tue, 23 Nov 2021 17:11:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229835.397397; Tue, 23 Nov 2021 17:11:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpZK7-0002kc-Ec; Tue, 23 Nov 2021 17:11:15 +0000
Received: by outflank-mailman (input) for mailman id 229835;
 Tue, 23 Nov 2021 17:11:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpZK6-0002kU-IK
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 17:11:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpZK6-0008Q8-HQ
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 17:11:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpZK6-0005Wm-GT
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 17:11:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Gpk6HZQwiozPUtAgQKknhqKeIb54kzGJRirktTcyxrc=; b=VuI/mXeZMsd11eJX8EXsZxnPzs
	E5qX6Uj/XXgsSakBlDg2e4cxOd+ArjKPlFvqvFt+DhPBFI46Rasq/hat9Wp9D77fDVTrxkAIGxfit
	Q4N3fFRAAv2c8d1m/48TlabKYKpBJAEJmeFzkgSDANUooVOizeLmhNplVVA1hXI3MaUQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Set version to 4.17; 4.16 has branched
Message-Id: <E1mpZK6-0005Wm-GT@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 17:11:14 +0000

commit 8579d208ab78486717d396cb297f06526fe6b492
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 23 16:54:08 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 23 16:54:18 2021 +0000

    Set version to 4.17; 4.16 has branched
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 README       | 10 +++++-----
 xen/Makefile |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/README b/README
index a626e56436..562b808080 100644
--- a/README
+++ b/README
@@ -1,9 +1,9 @@
 ############################################################
-__  __            _  _    _  __
-\ \/ /___ _ __   | || |  / |/ /_        _ __ ___
- \  // _ \ '_ \  | || |_ | | '_ \ _____| '__/ __|
- /  \  __/ | | | |__   _|| | (_) |_____| | | (__
-/_/\_\___|_| |_|    |_|(_)_|\___/      |_|  \___|
+__  __                                _        _     _
+\ \/ /___ _ __        _   _ _ __  ___| |_ __ _| |__ | | ___
+ \  // _ \ '_ \ _____| | | | '_ \/ __| __/ _` | '_ \| |/ _ \
+ /  \  __/ | | |_____| |_| | | | \__ \ || (_| | |_) | |  __/
+/_/\_\___|_| |_|      \__,_|_| |_|___/\__\__,_|_.__/|_|\___|
 
 ############################################################
 
diff --git a/xen/Makefile b/xen/Makefile
index 2fc83f266b..1fd48af7ae 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -1,8 +1,8 @@
 # This is the correct place to edit the build version.
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
-export XEN_SUBVERSION    = 16
-export XEN_EXTRAVERSION ?= -rc$(XEN_VENDORVERSION)
+export XEN_SUBVERSION    = 17
+export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 23 17:11:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 23 Nov 2021 17:11:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.229836.397402 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpZKH-0002nV-JS; Tue, 23 Nov 2021 17:11:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 229836.397402; Tue, 23 Nov 2021 17:11:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mpZKH-0002nN-G8; Tue, 23 Nov 2021 17:11:25 +0000
Received: by outflank-mailman (input) for mailman id 229836;
 Tue, 23 Nov 2021 17:11:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpZKG-0002n8-Ly
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 17:11:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpZKG-0008QS-L6
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 17:11:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mpZKG-0005Xn-KP
 for xen-changelog@lists.xenproject.org; Tue, 23 Nov 2021 17:11:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=j1+m8muxvChQvbD0D1I/hMHLy4e7nFTBo+UMqfbdBoE=; b=Y0mq6VksdCruKKu+VefBWCSk1g
	eXtysaFw9eTuWTkHyWxIzT9gTqBBDQAW8bRdTC3XtFKMVwfWsoUkYpvf3fxEtENTgeDiS+clIlY5b
	QlZj7cyL1FQ6TccXfWkTMNU8dzeOtLYMtVwicmBSt39R8xLNhKGMZ5vV22XHWiJ/NKuc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Set version to 4.17: rerun autogen.sh
Message-Id: <E1mpZKG-0005Xn-KP@xenbits.xenproject.org>
Date: Tue, 23 Nov 2021 17:11:24 +0000

commit a5706b80f42e028c5153fc50734a1e86a99ff9d2
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 23 16:55:32 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 23 16:55:32 2021 +0000

    Set version to 4.17: rerun autogen.sh
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 configure         | 18 +++++++++---------
 docs/configure    | 18 +++++++++---------
 stubdom/configure | 18 +++++++++---------
 tools/configure   | 18 +++++++++---------
 4 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/configure b/configure
index 62f6c2d47a..502273b263 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Xen Hypervisor 4.16.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor 4.17.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.16'
-PACKAGE_STRING='Xen Hypervisor 4.16'
+PACKAGE_VERSION='4.17'
+PACKAGE_STRING='Xen Hypervisor 4.17'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1236,7 +1236,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor 4.16 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor 4.17 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1302,7 +1302,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor 4.16:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor 4.17:";;
    esac
   cat <<\_ACEOF
 
@@ -1403,7 +1403,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor configure 4.16
+Xen Hypervisor configure 4.17
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1420,7 +1420,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor $as_me 4.16, which was
+It was created by Xen Hypervisor $as_me 4.17, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2868,7 +2868,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor $as_me 4.16, which was
+This file was extended by Xen Hypervisor $as_me 4.17, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -2922,7 +2922,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor config.status 4.16
+Xen Hypervisor config.status 4.17
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/docs/configure b/docs/configure
index 569bd4c2ff..f93d086e9a 100755
--- a/docs/configure
+++ b/docs/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Xen Hypervisor Documentation 4.16.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor Documentation 4.17.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Documentation'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.16'
-PACKAGE_STRING='Xen Hypervisor Documentation 4.16'
+PACKAGE_VERSION='4.17'
+PACKAGE_STRING='Xen Hypervisor Documentation 4.17'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1224,7 +1224,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor Documentation 4.16 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Documentation 4.17 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1286,7 +1286,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Documentation 4.16:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Documentation 4.17:";;
    esac
   cat <<\_ACEOF
 
@@ -1387,7 +1387,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Documentation configure 4.16
+Xen Hypervisor Documentation configure 4.17
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1404,7 +1404,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor Documentation $as_me 4.16, which was
+It was created by Xen Hypervisor Documentation $as_me 4.17, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2821,7 +2821,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor Documentation $as_me 4.16, which was
+This file was extended by Xen Hypervisor Documentation $as_me 4.17, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -2875,7 +2875,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor Documentation config.status 4.16
+Xen Hypervisor Documentation config.status 4.17
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/stubdom/configure b/stubdom/configure
index 07b709f998..5b265b5369 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Xen Hypervisor Stub Domains 4.16.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor Stub Domains 4.17.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Stub Domains'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.16'
-PACKAGE_STRING='Xen Hypervisor Stub Domains 4.16'
+PACKAGE_VERSION='4.17'
+PACKAGE_STRING='Xen Hypervisor Stub Domains 4.17'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1265,7 +1265,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor Stub Domains 4.16 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Stub Domains 4.17 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1331,7 +1331,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Stub Domains 4.16:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Stub Domains 4.17:";;
    esac
   cat <<\_ACEOF
 
@@ -1444,7 +1444,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Stub Domains configure 4.16
+Xen Hypervisor Stub Domains configure 4.17
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1499,7 +1499,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor Stub Domains $as_me 4.16, which was
+It was created by Xen Hypervisor Stub Domains $as_me 4.17, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -4283,7 +4283,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor Stub Domains $as_me 4.16, which was
+This file was extended by Xen Hypervisor Stub Domains $as_me 4.17, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -4337,7 +4337,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor Stub Domains config.status 4.16
+Xen Hypervisor Stub Domains config.status 4.17
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/tools/configure b/tools/configure
index 40f970b14b..21e3a83795 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Xen Hypervisor Tools 4.16.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor Tools 4.17.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Tools'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.16'
-PACKAGE_STRING='Xen Hypervisor Tools 4.16'
+PACKAGE_VERSION='4.17'
+PACKAGE_STRING='Xen Hypervisor Tools 4.17'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1415,7 +1415,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor Tools 4.16 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Tools 4.17 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1481,7 +1481,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Tools 4.16:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Tools 4.17:";;
    esac
   cat <<\_ACEOF
 
@@ -1689,7 +1689,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Tools configure 4.16
+Xen Hypervisor Tools configure 4.17
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2104,7 +2104,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor Tools $as_me 4.16, which was
+It was created by Xen Hypervisor Tools $as_me 4.17, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -10685,7 +10685,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor Tools $as_me 4.16, which was
+This file was extended by Xen Hypervisor Tools $as_me 4.17, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -10748,7 +10748,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor Tools config.status 4.16
+Xen Hypervisor Tools config.status 4.17
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 24 10:22:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Nov 2021 10:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.230282.398102 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppPi-00060q-8v; Wed, 24 Nov 2021 10:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 230282.398102; Wed, 24 Nov 2021 10: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 1mppPi-00060i-60; Wed, 24 Nov 2021 10:22:06 +0000
Received: by outflank-mailman (input) for mailman id 230282;
 Wed, 24 Nov 2021 10:22:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppPg-00060M-Rz
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppPg-0004Ii-Pi
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppPg-0003Oz-OZ
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10: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=W39gfaygmWZDMZ7hFwWiS79my68Ng1bQnsEKb3R3w/M=; b=3Amt+SBfxrPywDY2PU7M+G8KPx
	uLCDYznYJjdQ+OBEZ4esiLpeAzk9DBv1FcYmoeQ6JsWTa56syN+4YIXlCcBbU0QCW7ZPABdY2kjdm
	3OSzyyYiOBC3D0NJ6Eefy9fOh8o49gNsv68AlV5OpJfRX9qVQHL8v6WwZDWznflDWKRU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/PV: drop "vcpu" local variable from show_guest_stack()
Message-Id: <E1mppPg-0003Oz-OZ@xenbits.xenproject.org>
Date: Wed, 24 Nov 2021 10:22:04 +0000

commit 95d1511fe0a3e603e2604574da65d2eb8c541baf
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:01:05 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:01:05 2021 +0100

    x86/PV: drop "vcpu" local variable from show_guest_stack()
    
    It's not really needed and has been misleading me more than once to try
    and spot its "actual" use(s). It should really have been dropped when
    the 32-bit specific logic was purged from here.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/traps.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index d483aa91f2..84c9d9686a 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -327,16 +327,13 @@ static void show_guest_stack(struct vcpu *v, const struct cpu_user_regs *regs)
 
     if ( v != current )
     {
-        struct vcpu *vcpu;
-
         if ( !guest_kernel_mode(v, regs) )
         {
             printk("User mode stack\n");
             return;
         }
 
-        vcpu = maddr_get_owner(read_cr3()) == v->domain ? v : NULL;
-        if ( !vcpu )
+        if ( maddr_get_owner(read_cr3()) != v->domain )
         {
             stack_page = stack = do_page_walk(v, (unsigned long)stack);
             if ( (unsigned long)stack < PAGE_SIZE )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 24 10:22:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Nov 2021 10:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.230283.398106 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppPs-00062v-AO; Wed, 24 Nov 2021 10:22:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 230283.398106; Wed, 24 Nov 2021 10: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 1mppPs-00062n-7R; Wed, 24 Nov 2021 10:22:16 +0000
Received: by outflank-mailman (input) for mailman id 230283;
 Wed, 24 Nov 2021 10:22:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppPq-00062a-Tl
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:22:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppPq-0004Im-Sz
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppPq-0003Q0-Rt
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3qatRYgEo8RVbsq1YMo93mbbjtLmAIWkgKaqOYgqtGs=; b=oznVEe34j0VWO9OY57hEUn20Dp
	YI15bQFkQMRk43dFki/6I6/rZrHTu7NMomwAd71OrNjHsfja53HttC3/y7iTzjQ9g9//9MhtftDS1
	aFa1A0ZVmtYvLLsc2J4Xjkod/5vNhzHUYJZOzJzcFzSyTKpTw/IWI3kJfQyZ7FxPBkwY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: modify hvm_memory_op() prototype
Message-Id: <E1mppPq-0003Q0-Rt@xenbits.xenproject.org>
Date: Wed, 24 Nov 2021 10:22:14 +0000

commit 5168b6ee9139dbebe5771482664b329c8644e2df
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Nov 24 11:02:24 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:02:24 2021 +0100

    x86: modify hvm_memory_op() prototype
    
    hvm_memory_op() should take an unsigned long as cmd, like
    do_memory_op().
    
    As hvm_memory_op() is basically just calling do_memory_op() (or
    compat_memory_op()) passing through the parameters the cmd parameter
    should have no smaller size than that of the called functions.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hypercall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index 122abf80de..63bed52e40 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -31,7 +31,7 @@
 #include <public/hvm/hvm_op.h>
 #include <public/hvm/params.h>
 
-static long hvm_memory_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
+static long hvm_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
     long rc;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 24 10:22:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Nov 2021 10:22:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.230285.398110 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppQ2-00065n-Bx; Wed, 24 Nov 2021 10:22:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 230285.398110; Wed, 24 Nov 2021 10: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 1mppQ2-00065e-8u; Wed, 24 Nov 2021 10:22:26 +0000
Received: by outflank-mailman (input) for mailman id 230285;
 Wed, 24 Nov 2021 10: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 1mppQ1-00065U-0s
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10: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 1mppQ1-0004Iu-05
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:22:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppQ0-0003Qx-VF
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:22:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CxRC8ld0C9M37KVblaSoN/Irq2FQUGS7G3AIRP2IBM0=; b=tmZ076rreACALSoZ5c2xyW4HaP
	L1o1vqL+W/YIt17V0bRSItP3WgAGtiFil9FJvVlbLQFMdQdcF4IDIR9DJUkqiFZwgMVaXr1vGG18n
	wtcJ+p2ynjSGZUDQcsBIJNqQo833kvWNHW6vUY9U2K9ztoLOQ/ErTBZRsy53wZoQ2R6E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] add .gitignore entries for *.[is] below xen
Message-Id: <E1mppQ0-0003Qx-VF@xenbits.xenproject.org>
Date: Wed, 24 Nov 2021 10:22:24 +0000

commit e1e1da600b8ab4264f242fc735702f5425165923
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Nov 24 11:03:09 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:03:09 2021 +0100

    add .gitignore entries for *.[is] below xen
    
    Instead of listing each single file with .s or .i suffixes in
    .gitignore use pattern based entries. Restrict those to the xen
    directory as we have e.g. tools/libs/stat/bindings/swig/xenstat.i in
    our tree.
    
    Below xen the pattern based entries are fine, as we have pattern rules
    for creating *.s and *.i files in xen/Rules.mk.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 .gitignore | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 8ebb51b6c5..9513506dd9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -301,12 +301,13 @@ tools/xentrace/xentrace_setsize
 tools/xentrace/tbctl
 tools/xentrace/xenctx
 tools/xentrace/xentrace
+xen/**/*.i
+xen/**/*.s
 xen/.banner
 xen/.config
 xen/.config.old
 xen/.xen.elf32
 xen/System.map
-xen/arch/x86/asm-macros.i
 xen/arch/x86/boot/mkelf32
 xen/arch/x86/boot/cmdline.S
 xen/arch/x86/boot/reloc.S
@@ -322,7 +323,6 @@ xen/arch/*/efi/ebmalloc.c
 xen/arch/*/efi/efi.h
 xen/arch/*/efi/pe.c
 xen/arch/*/efi/runtime.c
-xen/asm-offsets.s
 xen/common/config_data.S
 xen/common/config.gz
 xen/include/headers*.chk
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 24 10:22:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Nov 2021 10:22:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.230289.398114 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppQC-00068r-Ei; Wed, 24 Nov 2021 10:22:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 230289.398114; Wed, 24 Nov 2021 10:22:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppQC-00068j-BX; Wed, 24 Nov 2021 10:22:36 +0000
Received: by outflank-mailman (input) for mailman id 230289;
 Wed, 24 Nov 2021 10: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 1mppQB-00068X-4D
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10: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 1mppQB-0004J4-3V
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:22:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppQB-0003S3-2T
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10: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=udyfEkSU1yzl+2+WfopAaKm/Q03ce2wDr4QlTTUS0Fs=; b=OpPprAURha8kMDjoXhkKaDh7wX
	8wYoFCvSgH6uEjOGzIDYR+Z5ucw+ta5WS7hbepR8wba8trYOkEpv5sRn8gCHnyY+uJu5usTA0YUJ2
	2wLGR7wxN+xAWoaWsgzxNGzvJjxzTISwIBwo2ISenbtCbrZntbuLF2jTNwZ/AVElR8v0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: prune super-page related capability macros
Message-Id: <E1mppQB-0003S3-2T@xenbits.xenproject.org>
Date: Wed, 24 Nov 2021 10:22:35 +0000

commit 0e74f62d038697d9f26052fb33bdd8325fcc4785
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:03:52 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:03:52 2021 +0100

    VT-d: prune super-page related capability macros
    
    cap_super_page_val() and cap_super_offset() are unused (apart from the
    latter using the former). I don't see how cap_super_offset() can be
    useful in its current shape: cap_super_page_val()'s result is not an
    lvalue and hence can't have its address taken. Plus a user would have
    to check the capability register field is non-zero, for
    find_first_bit() (or find_first_set_bit(), if suitably corrected) to be
    valid in the first place. Yet as per the spec when the field is non-zero
    the low bit would always be set, so the result would be independent of
    the actual value the field holds.
    
    Further zap cap_sps_512gb() and cap_sps_1tb(). While earlier versions
    of the spec had things spelled out that way, the current version marks
    the two bits as reserved. And "48-bit offset to page frame" wasn't in
    line with 1Tb pages anyway - clearly 256Tb pages would have been meant
    here.
    
    Finally properly parenthesize parameter uses in the remaining two
    macros.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.h | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h
index ee28ecac6d..b993f0cf08 100644
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -68,13 +68,8 @@
 #define cap_num_fault_regs(c)  ((((c) >> 40) & 0xff) + 1)
 #define cap_pgsel_inv(c)       (((c) >> 39) & 1)
 
-#define cap_super_page_val(c)  (((c) >> 34) & 0xf)
-#define cap_super_offset(c)    (((find_first_bit(&cap_super_page_val(c), 4)) \
-                                 * OFFSET_STRIDE) + 21)
-#define cap_sps_2mb(c)         ((c >> 34) & 1)
-#define cap_sps_1gb(c)         ((c >> 35) & 1)
-#define cap_sps_512gb(c)       ((c >> 36) & 1)
-#define cap_sps_1tb(c)         ((c >> 37) & 1)
+#define cap_sps_2mb(c)         (((c) >> 34) & 1)
+#define cap_sps_1gb(c)         (((c) >> 35) & 1)
 
 #define cap_fault_reg_offset(c)    ((((c) >> 24) & 0x3ff) * 16)
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 24 10:22:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Nov 2021 10:22:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.230291.398118 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppQM-0006BW-G6; Wed, 24 Nov 2021 10:22:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 230291.398118; Wed, 24 Nov 2021 10: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 1mppQM-0006BO-D1; Wed, 24 Nov 2021 10:22:46 +0000
Received: by outflank-mailman (input) for mailman id 230291;
 Wed, 24 Nov 2021 10: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 1mppQL-0006B9-7S
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10: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 1mppQL-0004J8-6e
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:22:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppQL-0003T1-5m
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10: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=5Z6TQ/ufOWF2o+kdlmKqDKyeoeV8R9Gz0AmaT2je7NU=; b=SGqG232qIFsTwxTr5KxY9L37a8
	71sIbJxTWHH/dJq8G9YGIYJeOwVkUfAcR39ur14iExrdzlzsWfHbcffaApeAuRHjfqwy0jk+J9+BH
	avVCjl4cM+RDktS2a8J687mU9XW9Qzl//gOBxCcWBptlbG8FR30+yCX1GkXcj4riz3rM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: don't needlessly engage the untrusted-MSI workaround
Message-Id: <E1mppQL-0003T1-5m@xenbits.xenproject.org>
Date: Wed, 24 Nov 2021 10:22:45 +0000

commit d5c39d5f8da6a39d98fa4b5e5d7b7528dcf34e7c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:04:32 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:04:32 2021 +0100

    VT-d: don't needlessly engage the untrusted-MSI workaround
    
    The quarantine domain doesn't count as a DomU, as it won't itself
    trigger any bad behavior. The workaround only needs enabling when an
    actual DomU is about to gain control of a device. This then also means
    enabling of the workaround can be deferred until immediately ahead of
    the call to domain_context_mapping(). While there also stop open-coding
    is_hardware_domain().
    
    Fixes: 319f9a0ba94c ("passthrough: quarantine PCI devices")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index f9ce402f22..5de9a73f56 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2403,14 +2403,6 @@ static int reassign_device_ownership(
 {
     int ret;
 
-    /*
-     * Devices assigned to untrusted domains (here assumed to be any domU)
-     * can attempt to send arbitrary LAPIC/MSI messages. We are unprotected
-     * by the root complex unless interrupt remapping is enabled.
-     */
-    if ( (target != hardware_domain) && !iommu_intremap )
-        untrusted_msi = true;
-
     /*
      * If the device belongs to the hardware domain, and it has RMRR, don't
      * remove it from the hardware domain, because BIOS may use RMRR at
@@ -2455,6 +2447,15 @@ static int reassign_device_ownership(
     if ( !has_arch_pdevs(target) )
         vmx_pi_hooks_assign(target);
 
+    /*
+     * Devices assigned to untrusted domains (here assumed to be any domU)
+     * can attempt to send arbitrary LAPIC/MSI messages. We are unprotected
+     * by the root complex unless interrupt remapping is enabled.
+     */
+    if ( !iommu_intremap && !is_hardware_domain(target) &&
+         !is_system_domain(target) )
+        untrusted_msi = true;
+
     ret = domain_context_mapping(target, devfn, pdev);
     if ( ret )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 24 10:22:56 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Nov 2021 10:22:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.230293.398122 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppQW-0006EO-Ha; Wed, 24 Nov 2021 10:22:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 230293.398122; Wed, 24 Nov 2021 10:22:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppQW-0006EG-EY; Wed, 24 Nov 2021 10:22:56 +0000
Received: by outflank-mailman (input) for mailman id 230293;
 Wed, 24 Nov 2021 10:22:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppQV-0006E8-AY
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:22:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppQV-0004JE-9l
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:22:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppQV-0003UE-8r
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:22:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1Ua7rXFwPccEI6bHkIoRcv7AHrZ1BCSOpO1nMw38hU0=; b=1uj56OkT1kt4wjzD9rmwOM5IvD
	zY4iTrQPxKCtJqgvoIJKsb7/1WU+Hd5euiB5N3ZEKvXXf2R8YQh6ZxPlFCbqjCZLwIQ7c4tjU/YOz
	dmqtm/Bi6Asae5Mehjc89gzpjY2b3apYH10T7FG7XAALdMvf862mEfLERdxEg866DP9w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: properly reserve DID 0 for caching mode IOMMUs
Message-Id: <E1mppQV-0003UE-8r@xenbits.xenproject.org>
Date: Wed, 24 Nov 2021 10:22:55 +0000

commit b111a41acd383c42c35707dbb1849d366ca43cce
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:05:36 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:05:36 2021 +0100

    VT-d: properly reserve DID 0 for caching mode IOMMUs
    
    Merely setting bit 0 in the bitmap is insufficient, as then Dom0 will
    still have DID 0 allocated to it, because of the zero-filling of
    domid_map[]. Set slot 0 to DOMID_INVALID to keep DID 0 from getting
    used.
    
    Fixes: b9c20c78789f ("VT-d: per-iommu domain-id")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 5de9a73f56..643db07cf0 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1259,16 +1259,19 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
     if ( !iommu->domid_bitmap )
         return -ENOMEM;
 
+    iommu->domid_map = xzalloc_array(u16, nr_dom);
+    if ( !iommu->domid_map )
+        return -ENOMEM;
+
     /*
-     * if Caching mode is set, then invalid translations are tagged with
-     * domain id 0, Hence reserve bit 0 for it
+     * If Caching mode is set, then invalid translations are tagged with
+     * domain id 0. Hence reserve bit/slot 0.
      */
     if ( cap_caching_mode(iommu->cap) )
+    {
+        iommu->domid_map[0] = DOMID_INVALID;
         __set_bit(0, iommu->domid_bitmap);
-
-    iommu->domid_map = xzalloc_array(u16, nr_dom);
-    if ( !iommu->domid_map )
-        return -ENOMEM;
+    }
 
     return 0;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 24 10:23:06 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Nov 2021 10:23:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.230295.398125 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppQg-0006HP-J2; Wed, 24 Nov 2021 10:23:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 230295.398125; Wed, 24 Nov 2021 10:23:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppQg-0006HH-G1; Wed, 24 Nov 2021 10:23:06 +0000
Received: by outflank-mailman (input) for mailman id 230295;
 Wed, 24 Nov 2021 10:23:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppQf-0006Go-Dj
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:23:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppQf-0004Js-D1
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:23:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppQf-0003Wx-C6
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:23:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jtr6DK9ucLW46AGDEfg4Rc/DFmeyNX+9SwOaPmF2F7Y=; b=NSigVX/EiEVOacbK2QSMXXSVIH
	nZ/AOLkjY605Q6+ClUBz4/zzJIcbb2NFOxbvtFTjHjKAgdTZ3yzspQfZeBvseieDMSMVSKWNpmvJo
	ZQEx5fINoX/wgd4g/JNjp18TCX47Atz/XPcsw98VC5uT02H2s3dUQFl2K7/VIRats1Hs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: split domid map cleanup check into a function
Message-Id: <E1mppQf-0003Wx-C6@xenbits.xenproject.org>
Date: Wed, 24 Nov 2021 10:23:05 +0000

commit 9fdc10abe9457e4c9879a266f82372cb08e88ffb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:06:20 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:06:20 2021 +0100

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

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


From xen-changelog-bounces@lists.xenproject.org Wed Nov 24 10:23:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Nov 2021 10:23:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.230297.398131 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppQq-0006Ka-M8; Wed, 24 Nov 2021 10:23:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 230297.398131; Wed, 24 Nov 2021 10:23:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppQq-0006KS-Hj; Wed, 24 Nov 2021 10:23:16 +0000
Received: by outflank-mailman (input) for mailman id 230297;
 Wed, 24 Nov 2021 10:23:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppQp-0006KG-H0
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:23:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppQp-0004KJ-GJ
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:23:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppQp-0003Y5-FP
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:23:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=j/y5JQPY4I3KyTZeAekDZfvPpTZkCBj1hYBlk/u4svI=; b=Kf3L8SeVfs1wqMSktcCZom/wJp
	msgxvti9TSLVkgJw5n8SrTUqNpOzGMpoVt2Vi3EEBA4gDvSb3UCfkqBxlpsj1uYVb5+RGWmk9QGsm
	1AxfcpIbKeTYGXbbfNdCJY0ZIy9aADzLtlQ9kSGiR/Dilhj2ATLEYefvlRWCW4riXv8M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: don't leak domid mapping on error path
Message-Id: <E1mppQp-0003Y5-FP@xenbits.xenproject.org>
Date: Wed, 24 Nov 2021 10:23:15 +0000

commit e6252a51faf42c892eb5fc71f8a2617580832196
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:07:11 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:07:11 2021 +0100

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

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


From xen-changelog-bounces@lists.xenproject.org Wed Nov 24 10:23:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Nov 2021 10:23:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.230299.398134 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppR0-0006Nr-Nn; Wed, 24 Nov 2021 10:23:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 230299.398134; Wed, 24 Nov 2021 10:23:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppR0-0006Ni-Ki; Wed, 24 Nov 2021 10:23:26 +0000
Received: by outflank-mailman (input) for mailman id 230299;
 Wed, 24 Nov 2021 10:23:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppQz-0006NJ-K2
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:23:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppQz-0004KQ-JK
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:23:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppQz-0003Yt-IV
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:23:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PH9qVVmQOLB8X72e4/Vc5exq2b44E2qEVPs7s25NaC0=; b=hADy5Y2bFt6my2Jd48e+/rFMuA
	py3VEYaiVlOhFMcT4ITs4zou/Ea2UJ0BfJ/lF4IpTrsyE7aPstfuSvy1xULs+7F3XkVixBfv6vjnL
	+zJ2eVcv2tTimewjioNNsPt1HNZdaw6uFhMTJPnIQJNmI1ttielaGolDvlEr0u4eKLWM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] MAINTAINERS: declare REMUS support orphaned
Message-Id: <E1mppQz-0003Yt-IV@xenbits.xenproject.org>
Date: Wed, 24 Nov 2021 10:23:25 +0000

commit 49857c5e4fe19e61fc7d1a457e541fe67ac55c8d
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Nov 24 11:07:52 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:07:52 2021 +0100

    MAINTAINERS: declare REMUS support orphaned
    
    The designated maintainer email address for the remus entry is
    bouncing, so remove it and declare the entry as orphaned as there's no
    other maintainer.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Ian Jackson <iwj@xenproject.org>
---
 MAINTAINERS | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4956db1011..f67f70aed3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -470,8 +470,7 @@ S:	Supported
 T:	git https://xenbits.xenproject.org/git-http/qemu-xen.git
 
 REMUS
-M:	Shriram Rajagopalan <rshriram@cs.ubc.ca>
-S:	Maintained
+S:	Orphan
 F:	docs/README.remus
 F:	tools/libs/light/libxl_remus_*
 F:	tools/libs/light/libxl_netbuffer.c
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 24 10:23:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Nov 2021 10:23:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.230301.398138 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppRA-0006Qm-P8; Wed, 24 Nov 2021 10:23:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 230301.398138; Wed, 24 Nov 2021 10:23: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 1mppRA-0006Qe-M9; Wed, 24 Nov 2021 10:23:36 +0000
Received: by outflank-mailman (input) for mailman id 230301;
 Wed, 24 Nov 2021 10:23: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 1mppR9-0006QN-NJ
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:23: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 1mppR9-0004KU-MW
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:23:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppR9-0003ZL-La
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:23: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=Nbv6bJSu1F6kG9YVkSSt2MnZIpdsU5pRPMVmYLqj6O8=; b=EyneSeKVsJ8kGxN4CKmoVPiUAb
	PewwO73x76vJh5PkvK3aD8AyEZsIU3jTwQhEuyCiA3VSOw+uHByYIGVTZuKAvJjNPtyEzqb/diYVm
	DZQi1U3cwBwBe0TYnDyVLdJJS9hNIO6KfEIrMqk3F7idtLvaERz73GDC2Bin2ix3HuI8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/Viridian: fix error code use
Message-Id: <E1mppR9-0003ZL-La@xenbits.xenproject.org>
Date: Wed, 24 Nov 2021 10:23:35 +0000

commit 857fee77845be0c5c35fd51bac64455369d32a6f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:09:56 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:09:56 2021 +0100

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

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


From xen-changelog-bounces@lists.xenproject.org Wed Nov 24 10:23:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Nov 2021 10:23:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.230303.398142 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppRL-0006Tv-Qb; Wed, 24 Nov 2021 10:23:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 230303.398142; Wed, 24 Nov 2021 10:23: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 1mppRL-0006Tn-Nh; Wed, 24 Nov 2021 10:23:47 +0000
Received: by outflank-mailman (input) for mailman id 230303;
 Wed, 24 Nov 2021 10:23: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 1mppRJ-0006TX-QI
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:23: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 1mppRJ-0004KY-PZ
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:23:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppRJ-0003aF-Oq
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:23: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=+6oBSCjwZ6roMPDkNSTMXDxSZI9aHNnQsk/gXA5vQT4=; b=m0Ze7MtBGboZXSdNvXmSm9lDR2
	hb+i8dxlW1jkxIgcmiOMbmFw/DifcWLFIXeEM0ZMSPWY4f/9wr9V5d8ftL8XF/wBZGHaGvOLBIPMB
	ecjqq7g1KaU2hxv5sUAl/Ynl/5WSdVKfZMP8Amq5+N4EcS6VWip2Vpe/kG4WacYEQ3JI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/Viridian: drop dead variable updates
Message-Id: <E1mppRJ-0003aF-Oq@xenbits.xenproject.org>
Date: Wed, 24 Nov 2021 10:23:45 +0000

commit 8c6ea4a78485047ea78f9c07d457a56f5227a08b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:10:36 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:10:36 2021 +0100

    x86/Viridian: drop dead variable updates
    
    Both hvcall_flush_ex() and hvcall_ipi_ex() update "size" without
    subsequently using the value; future compilers may warn about such.
    Alongside dropping the updates, shrink the variables' scopes to
    demonstrate that there are no outer scope uses.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/viridian/viridian.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 7d1cfc530b..efdd60b205 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -776,7 +776,6 @@ static int hvcall_flush_ex(const union hypercall_input *input,
     {
         union hypercall_vpset *vpset = &this_cpu(hypercall_vpset);
         struct hv_vpset *set = &vpset->set;
-        size_t size;
         int rc;
 
         *set = input_params.set;
@@ -784,8 +783,7 @@ static int hvcall_flush_ex(const union hypercall_input *input,
         {
             unsigned long offset = offsetof(typeof(input_params),
                                             set.bank_contents);
-
-            size = sizeof(*set->bank_contents) * hv_vpset_nr_banks(set);
+            size_t size = sizeof(*set->bank_contents) * hv_vpset_nr_banks(set);
 
             if ( offsetof(typeof(*vpset), set.bank_contents[0]) + size >
                  sizeof(*vpset) )
@@ -798,11 +796,7 @@ static int hvcall_flush_ex(const union hypercall_input *input,
                                           input_params_gpa + offset,
                                           size) != HVMTRANS_okay)
                 return -EINVAL;
-
-            size += sizeof(*set);
         }
-        else
-            size = sizeof(*set);
 
         rc = hv_vpset_to_vpmask(set, vpmask);
         if ( rc )
@@ -903,7 +897,6 @@ static int hvcall_ipi_ex(const union hypercall_input *input,
     } input_params;
     union hypercall_vpset *vpset = &this_cpu(hypercall_vpset);
     struct hv_vpset *set = &vpset->set;
-    size_t size;
     int rc;
 
     /* These hypercalls should never use the fast-call convention. */
@@ -929,8 +922,7 @@ static int hvcall_ipi_ex(const union hypercall_input *input,
     {
         unsigned long offset = offsetof(typeof(input_params),
                                         set.bank_contents);
-
-        size = sizeof(*set->bank_contents) * hv_vpset_nr_banks(set);
+        size_t size = sizeof(*set->bank_contents) * hv_vpset_nr_banks(set);
 
         if ( offsetof(typeof(*vpset), set.bank_contents[0]) + size >
              sizeof(*vpset) )
@@ -943,11 +935,7 @@ static int hvcall_ipi_ex(const union hypercall_input *input,
                                       input_params_gpa + offset,
                                       size) != HVMTRANS_okay)
             return -EINVAL;
-
-        size += sizeof(*set);
     }
-    else
-        size = sizeof(*set);
 
     rc = hv_vpset_to_vpmask(set, vpmask);
     if ( rc )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 24 10:23:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Nov 2021 10:23:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.230305.398146 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppRV-0006Wr-SU; Wed, 24 Nov 2021 10:23:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 230305.398146; Wed, 24 Nov 2021 10:23: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 1mppRV-0006Wh-PF; Wed, 24 Nov 2021 10:23:57 +0000
Received: by outflank-mailman (input) for mailman id 230305;
 Wed, 24 Nov 2021 10:23: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 1mppRT-0006WH-T8
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:23: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 1mppRT-0004Ks-SR
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:23:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppRT-0003at-Ro
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:23: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=NuRsCca42vOe2Bi9Bn13ix78DCRtOLRH8M0ZhcT8Nxw=; b=AVKzoRsZAWnimG2sZB49ItYy7k
	0E/l/R0JEOEen9lineLOHBeAit/w5WdLHnCKRCEbsSuWPNjoBGrD8wpdaZ+40J+JKhVLnBbu34e7h
	bKBch3UiMnSkePOl1QVL3oFXab1o/qc5xRZ4D/IqjsyIlnCS74521dihKlXZF+BgP9ns=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: prune SAGAW recognition
Message-Id: <E1mppRT-0003at-Ro@xenbits.xenproject.org>
Date: Wed, 24 Nov 2021 10:23:55 +0000

commit 859d11b2791292c1b997242ac3ea5a38dc34c80e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:11:24 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:11:24 2021 +0100

    VT-d: prune SAGAW recognition
    
    Bit 0 of SAGAW in the capability register has become reserved at or
    before spec version 2.2. Treat it as such. Replace the effective open-
    coding of find_first_set_bit(). Adjust local variable types.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 42cf8774e7..dab8590e25 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -401,7 +401,7 @@ static uint64_t domain_pgd_maddr(struct domain *d, unsigned int nr_pt_levels)
         pgd_maddr = hd->arch.vtd.pgd_maddr;
     }
 
-    /* Skip top levels of page tables for 2- and 3-level DRHDs. */
+    /* Skip top level(s) of page tables for less-than-maximum level DRHDs. */
     for ( agaw = level_to_agaw(4);
           agaw != level_to_agaw(nr_pt_levels);
           agaw-- )
@@ -1228,8 +1228,7 @@ static int __init iommu_set_interrupt(struct acpi_drhd_unit *drhd)
 int __init iommu_alloc(struct acpi_drhd_unit *drhd)
 {
     struct vtd_iommu *iommu;
-    unsigned long sagaw, nr_dom;
-    int agaw;
+    unsigned int sagaw, agaw = 0, nr_dom;
 
     iommu = xzalloc(struct vtd_iommu);
     if ( iommu == NULL )
@@ -1282,14 +1281,13 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
         return -ENODEV;
     }
 
-    /* Calculate number of pagetable levels: between 2 and 4. */
+    /* Calculate number of pagetable levels: 3 or 4. */
     sagaw = cap_sagaw(iommu->cap);
-    for ( agaw = level_to_agaw(4); agaw >= 0; agaw-- )
-        if ( test_bit(agaw, &sagaw) )
-            break;
-    if ( agaw < 0 )
+    if ( sagaw & 6 )
+        agaw = find_first_set_bit(sagaw & 6);
+    if ( !agaw )
     {
-        printk(XENLOG_ERR VTDPREFIX "IOMMU: unsupported sagaw %lx\n", sagaw);
+        printk(XENLOG_ERR VTDPREFIX "IOMMU: unsupported sagaw %x\n", sagaw);
         print_iommu_regs(drhd);
         return -ENODEV;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 24 10:24:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Nov 2021 10:24:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.230307.398150 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppRf-0006Zu-Tm; Wed, 24 Nov 2021 10:24:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 230307.398150; Wed, 24 Nov 2021 10:24: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 1mppRf-0006Zn-Qp; Wed, 24 Nov 2021 10:24:07 +0000
Received: by outflank-mailman (input) for mailman id 230307;
 Wed, 24 Nov 2021 10:24: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 1mppRe-0006ZT-0p
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:24: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 1mppRd-0004L9-VU
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:24:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppRd-0003bq-Un
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:24: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=YjpAt5VYGbL0rmNuSJS1Xu8khIqvWVzJeiQo1EZ0jws=; b=YuA4Vt/99wYPYel1zyw4l4Lx7C
	/DVOYFIQSxh/4Jh8oYDNFyN/9RzAX9lfD6vCS5TqPu3w2UNdRE0Q9yTOlm9/K3ax6ksC9m/AzRdOW
	hgnDhkBnis+8GY76n8QAFmtZVEnlhXf3fXzATOZMM/TpkBWKodfa0jKq3gavc+ioCjvg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: correct off-by-1 in fault register range check
Message-Id: <E1mppRd-0003bq-Un@xenbits.xenproject.org>
Date: Wed, 24 Nov 2021 10:24:05 +0000

commit 08826a044ebfefc429aaecb861dc31051f2bb288
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:12:03 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:12:03 2021 +0100

    VT-d: correct off-by-1 in fault register range check
    
    All our present implementation requires is that the range fully fits
    in a single page. No need to exclude the case of the last register
    extending right to the end of that page.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index dab8590e25..c1bf48cbcb 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1273,7 +1273,7 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
     quirk_iommu_caps(iommu);
 
     if ( cap_fault_reg_offset(iommu->cap) +
-         cap_num_fault_regs(iommu->cap) * PRIMARY_FAULT_REG_LEN >= PAGE_SIZE ||
+         cap_num_fault_regs(iommu->cap) * PRIMARY_FAULT_REG_LEN > PAGE_SIZE ||
          ecap_iotlb_offset(iommu->ecap) >= PAGE_SIZE )
     {
         printk(XENLOG_ERR VTDPREFIX "IOMMU: unsupported\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Nov 24 10:24:18 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 24 Nov 2021 10:24:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.230309.398155 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mppRp-0006dE-Vt; Wed, 24 Nov 2021 10:24:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 230309.398155; Wed, 24 Nov 2021 10:24: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 1mppRp-0006d6-Sa; Wed, 24 Nov 2021 10:24:17 +0000
Received: by outflank-mailman (input) for mailman id 230309;
 Wed, 24 Nov 2021 10:24: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 1mppRo-0006ci-3F
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:24: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 1mppRo-0004LK-2X
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:24:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mppRo-0003cb-1g
 for xen-changelog@lists.xenproject.org; Wed, 24 Nov 2021 10:24: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=ey0BQYodMKEajGxvGbO6mXbloBwrYwNToNXoIvwz58k=; b=CzWioVuBQdISeAMRRGqaBk+kCo
	yh86xfZIv6x/eI6WJVOoL9NKTifHYjem1IVXKnwqeUp1nA9kjc0bmIy3jiqfwmeDvRhb0n2AijniV
	QdOHRvngGLJKRkt3sW00ehB34/mqfnH5lTmJItl3qRN32UFEHh0AJ8HbbsYXFdOoP5mk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: conditionalize IOTLB register offset check
Message-Id: <E1mppRo-0003cb-1g@xenbits.xenproject.org>
Date: Wed, 24 Nov 2021 10:24:16 +0000

commit 5449ba84e99849ee2339fd79f9717e10113d702d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:12:44 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:12:44 2021 +0100

    VT-d: conditionalize IOTLB register offset check
    
    As of commit 6773b1a7584a ("VT-d: Don't assume register-based
    invalidation is always supported") we don't (try to) use register based
    invalidation anymore when that's not supported by hardware. Hence
    there's also no point in the respective check, avoiding pointless IOMMU
    initialization failure. After all the spec (version 3.3 at the time of
    writing) doesn't say what the respective Extended Capability Register
    field would contain in such a case.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index c1bf48cbcb..b33697e36b 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1274,7 +1274,8 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
 
     if ( cap_fault_reg_offset(iommu->cap) +
          cap_num_fault_regs(iommu->cap) * PRIMARY_FAULT_REG_LEN > PAGE_SIZE ||
-         ecap_iotlb_offset(iommu->ecap) >= PAGE_SIZE )
+         (has_register_based_invalidation(iommu) &&
+          ecap_iotlb_offset(iommu->ecap) >= PAGE_SIZE) )
     {
         printk(XENLOG_ERR VTDPREFIX "IOMMU: unsupported\n");
         print_iommu_regs(drhd);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Nov 25 11:11:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Nov 2021 11:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.230980.399318 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqCeg-0005HD-1j; Thu, 25 Nov 2021 11:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 230980.399318; Thu, 25 Nov 2021 11: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 1mqCef-0005H5-Us; Thu, 25 Nov 2021 11:11:05 +0000
Received: by outflank-mailman (input) for mailman id 230980;
 Thu, 25 Nov 2021 11: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 1mqCee-0005Gt-7N
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 11: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 1mqCee-0000ao-6Y
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 11:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqCee-0003J5-5X
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 11: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=pbQKz7K15vv3Ubj72bobA0voQ01c4bPtKslvxIdYzes=; b=jVFNXqt9R0sowElOpXrRvAS5bN
	t9iYESgF6ajOwk8K/e/Pxw4b53OyjW9AL/lmDX9jpHrWTk9ZcCbu46p/mjzhBEj21P9azcRrTCFRg
	Cus8KQOYgjJJ2RXIfVozs1E8Hh7N0IQDI/RzVZzRrLT0+a8hBOjn0Vv3VyH/KChPvPck=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] Revert "x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents"
Message-Id: <E1mqCee-0003J5-5X@xenbits.xenproject.org>
Date: Thu, 25 Nov 2021 11:11:04 +0000

commit c4b41ee2b44ab89cfca75facbe6702376098fc56
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 24 21:11:52 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Thu Nov 25 11:06:12 2021 +0000

    Revert "x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents"
    
    OSSTest has identified a 3rd regression caused by this change.  Migration
    between Xen 4.15 and 4.16 on the nocera pair of machines (AMD Opteron 4133)
    fails with:
    
      xc: error: Failed to set CPUID policy: leaf 00000000, subleaf ffffffff, msr ffffffff (22 = Invalid argument): Internal error
      xc: error: Restore failed (22 = Invalid argument): Internal error
    
    which is a safety check to prevent resuming the guest when the CPUID data has
    been truncated.  The problem is caused by shrinking of the max policies, which
    is an ABI that needs handling compatibly between different versions of Xen.
    
    Furthermore, shrinking of the default policies also breaks things in some
    cases, because certain cpuid= settings in a VM config file which used to have
    an effect will now be silently discarded.
    
    This reverts commit 540d911c2813c3d8f4cdbb3f5672119e5e768a3d, as well as the
    partial fix attempt in 81da2b544cbb003a5447c9b14d275746ad22ab37 (which added
    one new case where cpuid= settings might not apply correctly) and restores the
    same behaviour as Xen 4.15.
    
    Fixes: 540d911c2813 ("x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents")
    Fixes: 81da2b544cbb ("x86/cpuid: prevent shrinking migrated policies max leaves")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release_Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/guest/xg_cpuid_x86.c          |   7 ---
 tools/tests/cpu-policy/test-cpu-policy.c | 101 -------------------------------
 xen/arch/x86/cpuid.c                     |  10 ---
 xen/include/xen/lib/x86/cpuid.h          |   7 ---
 xen/lib/x86/cpuid.c                      |  39 ------------
 5 files changed, 164 deletions(-)

diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 3ffd5f683b..198892ebdf 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -638,13 +638,6 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
         }
     }
 
-    /*
-     * Do not try to shrink the policy if restoring, as that could cause
-     * guest visible changes in the maximum leaf fields.
-     */
-    if ( !restore )
-        x86_cpuid_policy_shrink_max_leaves(p);
-
     rc = x86_cpuid_copy_to_buffer(p, leaves, &nr_leaves);
     if ( rc )
     {
diff --git a/tools/tests/cpu-policy/test-cpu-policy.c b/tools/tests/cpu-policy/test-cpu-policy.c
index 75973298df..ed450a0997 100644
--- a/tools/tests/cpu-policy/test-cpu-policy.c
+++ b/tools/tests/cpu-policy/test-cpu-policy.c
@@ -8,13 +8,10 @@
 #include <err.h>
 
 #include <xen-tools/libs.h>
-#include <xen/asm/x86-defns.h>
 #include <xen/asm/x86-vendors.h>
 #include <xen/lib/x86/cpu-policy.h>
 #include <xen/domctl.h>
 
-#define XSTATE_FP_SSE  (X86_XCR0_FP | X86_XCR0_SSE)
-
 static unsigned int nr_failures;
 #define fail(fmt, ...)                          \
 ({                                              \
@@ -573,103 +570,6 @@ static void test_cpuid_out_of_range_clearing(void)
     }
 }
 
-static void test_cpuid_maximum_leaf_shrinking(void)
-{
-    static const struct test {
-        const char *name;
-        struct cpuid_policy p;
-    } tests[] = {
-        {
-            .name = "basic",
-            .p = {
-                /* Very basic information only. */
-                .basic.max_leaf = 1,
-                .basic.raw_fms = 0xc2,
-            },
-        },
-        {
-            .name = "cache",
-            .p = {
-                /* Cache subleaves present. */
-                .basic.max_leaf = 4,
-                .cache.subleaf[0].type = 1,
-            },
-        },
-        {
-            .name = "feat#0",
-            .p = {
-                /* Subleaf 0 only with some valid bit. */
-                .basic.max_leaf = 7,
-                .feat.max_subleaf = 0,
-                .feat.fsgsbase = 1,
-            },
-        },
-        {
-            .name = "feat#1",
-            .p = {
-                /* Subleaf 1 only with some valid bit. */
-                .basic.max_leaf = 7,
-                .feat.max_subleaf = 1,
-                .feat.avx_vnni = 1,
-            },
-        },
-        {
-            .name = "topo",
-            .p = {
-                /* Topology subleaves present. */
-                .basic.max_leaf = 0xb,
-                .topo.subleaf[0].type = 1,
-            },
-        },
-        {
-            .name = "xstate",
-            .p = {
-                /* First subleaf always valid (and then non-zero). */
-                .basic.max_leaf = 0xd,
-                .xstate.xcr0_low = XSTATE_FP_SSE,
-            },
-        },
-        {
-            .name = "extd",
-            .p = {
-                /* Commonly available information only. */
-                .extd.max_leaf = 0x80000008,
-                .extd.maxphysaddr = 0x28,
-                .extd.maxlinaddr = 0x30,
-            },
-        },
-    };
-
-    printf("Testing CPUID maximum leaf shrinking:\n");
-
-    for ( size_t i = 0; i < ARRAY_SIZE(tests); ++i )
-    {
-        const struct test *t = &tests[i];
-        struct cpuid_policy *p = memdup(&t->p);
-
-        p->basic.max_leaf = ARRAY_SIZE(p->basic.raw) - 1;
-        p->feat.max_subleaf = ARRAY_SIZE(p->feat.raw) - 1;
-        p->extd.max_leaf = 0x80000000 | (ARRAY_SIZE(p->extd.raw) - 1);
-
-        x86_cpuid_policy_shrink_max_leaves(p);
-
-        /* Check the the resulting max (sub)leaf values against expecations. */
-        if ( p->basic.max_leaf != t->p.basic.max_leaf )
-             fail("  Test %s basic fail - expected %#x, got %#x\n",
-                  t->name, t->p.basic.max_leaf, p->basic.max_leaf);
-
-        if ( p->extd.max_leaf != t->p.extd.max_leaf )
-             fail("  Test %s extd fail - expected %#x, got %#x\n",
-                  t->name, t->p.extd.max_leaf, p->extd.max_leaf);
-
-        if ( p->feat.max_subleaf != t->p.feat.max_subleaf )
-             fail("  Test %s feat fail - expected %#x, got %#x\n",
-                  t->name, t->p.feat.max_subleaf, p->feat.max_subleaf);
-
-        free(p);
-    }
-}
-
 static void test_is_compatible_success(void)
 {
     static struct test {
@@ -785,7 +685,6 @@ int main(int argc, char **argv)
     test_cpuid_serialise_success();
     test_cpuid_deserialise_failure();
     test_cpuid_out_of_range_clearing();
-    test_cpuid_maximum_leaf_shrinking();
 
     test_msr_serialise_success();
     test_msr_deserialise_failure();
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 8ac55f0806..151944f657 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -353,8 +353,6 @@ static void __init calculate_host_policy(void)
         p->extd.raw[0xa].d |= ((1u << SVM_FEATURE_VMCBCLEAN) |
                                (1u << SVM_FEATURE_TSCRATEMSR));
     }
-
-    x86_cpuid_policy_shrink_max_leaves(p);
 }
 
 static void __init guest_common_default_feature_adjustments(uint32_t *fs)
@@ -434,8 +432,6 @@ static void __init calculate_pv_max_policy(void)
     recalculate_xstate(p);
 
     p->extd.raw[0xa] = EMPTY_LEAF; /* No SVM for PV guests. */
-
-    x86_cpuid_policy_shrink_max_leaves(p);
 }
 
 static void __init calculate_pv_def_policy(void)
@@ -456,8 +452,6 @@ static void __init calculate_pv_def_policy(void)
     sanitise_featureset(pv_featureset);
     cpuid_featureset_to_policy(pv_featureset, p);
     recalculate_xstate(p);
-
-    x86_cpuid_policy_shrink_max_leaves(p);
 }
 
 static void __init calculate_hvm_max_policy(void)
@@ -523,8 +517,6 @@ static void __init calculate_hvm_max_policy(void)
     sanitise_featureset(hvm_featureset);
     cpuid_featureset_to_policy(hvm_featureset, p);
     recalculate_xstate(p);
-
-    x86_cpuid_policy_shrink_max_leaves(p);
 }
 
 static void __init calculate_hvm_def_policy(void)
@@ -549,8 +541,6 @@ static void __init calculate_hvm_def_policy(void)
     sanitise_featureset(hvm_featureset);
     cpuid_featureset_to_policy(hvm_featureset, p);
     recalculate_xstate(p);
-
-    x86_cpuid_policy_shrink_max_leaves(p);
 }
 
 void __init init_guest_cpuid(void)
diff --git a/xen/include/xen/lib/x86/cpuid.h b/xen/include/xen/lib/x86/cpuid.h
index 2300faf03e..a4d254ea96 100644
--- a/xen/include/xen/lib/x86/cpuid.h
+++ b/xen/include/xen/lib/x86/cpuid.h
@@ -386,13 +386,6 @@ void x86_cpuid_policy_fill_native(struct cpuid_policy *p);
  */
 void x86_cpuid_policy_clear_out_of_range_leaves(struct cpuid_policy *p);
 
-/**
- * Shrink max leaf/subleaf values such that the last respective valid entry
- * isn't all blank.  While permitted by the spec, such extraneous leaves may
- * provide undue "hints" to guests.
- */
-void x86_cpuid_policy_shrink_max_leaves(struct cpuid_policy *p);
-
 #ifdef __XEN__
 #include <public/arch-x86/xen.h>
 typedef XEN_GUEST_HANDLE_64(xen_cpuid_leaf_t) cpuid_leaf_buffer_t;
diff --git a/xen/lib/x86/cpuid.c b/xen/lib/x86/cpuid.c
index 1409c254c8..8eb88314f5 100644
--- a/xen/lib/x86/cpuid.c
+++ b/xen/lib/x86/cpuid.c
@@ -236,45 +236,6 @@ void x86_cpuid_policy_clear_out_of_range_leaves(struct cpuid_policy *p)
                 ARRAY_SIZE(p->extd.raw) - 1);
 }
 
-void x86_cpuid_policy_shrink_max_leaves(struct cpuid_policy *p)
-{
-    unsigned int i;
-
-    p->basic.raw[0x4] = p->cache.raw[0];
-
-    for ( i = p->feat.max_subleaf; i; --i )
-        if ( p->feat.raw[i].a | p->feat.raw[i].b |
-             p->feat.raw[i].c | p->feat.raw[i].d )
-            break;
-    p->feat.max_subleaf = i;
-    p->basic.raw[0x7] = p->feat.raw[i];
-
-    p->basic.raw[0xb] = p->topo.raw[0];
-
-    /*
-     * Due to the way xstate gets handled in the hypervisor (see
-     * recalculate_xstate()) there is (for now at least) no need to fiddle
-     * with the xstate subleaves (IOW we assume they're already in consistent
-     * shape, for coming from either hardware or recalculate_xstate()).
-     */
-    p->basic.raw[0xd] = p->xstate.raw[0];
-
-    for ( i = p->basic.max_leaf; i; --i )
-        if ( p->basic.raw[i].a | p->basic.raw[i].b |
-             p->basic.raw[i].c | p->basic.raw[i].d )
-            break;
-    p->basic.max_leaf = i;
-
-    for ( i = p->extd.max_leaf & 0xffff; i; --i )
-        if ( p->extd.raw[i].a | p->extd.raw[i].b |
-             p->extd.raw[i].c | p->extd.raw[i].d )
-            break;
-    if ( i | p->extd.raw[0].b | p->extd.raw[0].c | p->extd.raw[0].d )
-        p->extd.max_leaf = 0x80000000 | i;
-    else
-        p->extd.max_leaf = 0;
-}
-
 const uint32_t *x86_cpuid_lookup_deep_deps(uint32_t feature)
 {
     static const uint32_t deep_features[] = INIT_DEEP_FEATURES;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Nov 25 15:44:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Nov 2021 15:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.231604.400860 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqGuo-0003ku-UT; Thu, 25 Nov 2021 15:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 231604.400860; Thu, 25 Nov 2021 15:44:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqGuo-0003kk-Qx; Thu, 25 Nov 2021 15:44:02 +0000
Received: by outflank-mailman (input) for mailman id 231604;
 Thu, 25 Nov 2021 15:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqGuo-0003kc-BL
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 15: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 1mqGuo-0005v5-AT
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 15:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqGuo-0007VE-9P
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 15: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=romW/i259N2Qnlba4N34CalQdA5yiLkKQ/2MWyk5TTc=; b=4/k3ZrjEYOz6j3mWWBccJyou6b
	+N4tWt+ipfhsW+1fm0CZx0W2kG75lyhPOSMxIoO0G2nhVZ8Kbc1/b+J5cFFyaLQS9acWhiQC+v4yX
	0aMovgKicwCU4dF+NfY0jw4s22K2jNFtNrFLdTXq0rxtka525tFDGyx0POWHFtlKPoZM=;
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: Harden assign_pages()
Message-Id: <E1mqGuo-0007VE-9P@xenbits.xenproject.org>
Date: Thu, 25 Nov 2021 15:44:02 +0000

commit 0b28069aa7c26288376040e6ee9ca145245db39e
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Nov 23 13:32:26 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:32:26 2021 +0100

    xen/page_alloc: Harden assign_pages()
    
    domain_tot_pages() and d->max_pages are 32-bit values. While the order
    should always be quite small, it would still be possible to overflow
    if domain_tot_pages() is near to (2^32 - 1).
    
    As this code may be called by a guest via XENMEM_increase_reservation
    and XENMEM_populate_physmap, we want to make sure the guest is not going
    to be able to allocate more than it is allowed.
    
    Rework the allocation check to avoid any possible overflow. While the
    check domain_tot_pages() < d->max_pages should technically not be
    necessary, it is probably best to have it to catch any possible
    inconsistencies in the future.
    
    This is CVE-2021-28706 / part of XSA-385.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 143501861d48e1bfef495849fd68584baac05849
    master date: 2021-11-22 11:11:05 +0000
---
 xen/common/grant_table.c |  7 ++++---
 xen/common/page_alloc.c  | 19 ++++++++++++++-----
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index d2853a664a..7b775a8c35 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -2286,7 +2286,8 @@ gnttab_transfer(
          * pages when it is dying.
          */
         if ( unlikely(e->is_dying) ||
-             unlikely(e->tot_pages >= e->max_pages) )
+             unlikely(e->tot_pages >= e->max_pages) ||
+             unlikely(!(e->tot_pages + 1)) )
         {
             spin_unlock(&e->page_alloc_lock);
 
@@ -2295,8 +2296,8 @@ gnttab_transfer(
                          e->domain_id);
             else
                 gdprintk(XENLOG_INFO,
-                         "Transferee d%d has no headroom (tot %u, max %u)\n",
-                         e->domain_id, e->tot_pages, e->max_pages);
+                         "Transferee %pd has no headroom (tot %u, max %u)\n",
+                         e, e->tot_pages, e->max_pages);
 
             gop.status = GNTST_general_error;
             goto unlock_and_copyback;
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 1563188f4f..0976bf6489 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2276,16 +2276,25 @@ int assign_pages(
 
     if ( !(memflags & MEMF_no_refcount) )
     {
-        if ( unlikely((d->tot_pages + (1 << order)) > d->max_pages) )
+        unsigned int nr = 1u << order;
+
+        if ( unlikely(d->tot_pages > d->max_pages) )
+        {
+            gprintk(XENLOG_INFO, "Inconsistent allocation for %pd: %u > %u\n",
+                    d, d->tot_pages, d->max_pages);
+            rc = -EPERM;
+            goto out;
+        }
+
+        if ( unlikely(nr > d->max_pages - d->tot_pages) )
         {
-            gprintk(XENLOG_INFO, "Over-allocation for domain %u: "
-                    "%u > %u\n", d->domain_id,
-                    d->tot_pages + (1 << order), d->max_pages);
+            gprintk(XENLOG_INFO, "Over-allocation for %pd: %Lu > %u\n",
+                    d, d->tot_pages + 0ull + nr, d->max_pages);
             rc = -E2BIG;
             goto out;
         }
 
-        if ( unlikely(domain_adjust_tot_pages(d, 1 << order) == (1 << order)) )
+        if ( unlikely(domain_adjust_tot_pages(d, nr) == nr) )
             get_knownalive_domain(d);
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Nov 25 15:44:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Nov 2021 15:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.231605.400863 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqGuy-0003mq-VS; Thu, 25 Nov 2021 15:44:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 231605.400863; Thu, 25 Nov 2021 15:44:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqGuy-0003mi-ST; Thu, 25 Nov 2021 15:44:12 +0000
Received: by outflank-mailman (input) for mailman id 231605;
 Thu, 25 Nov 2021 15: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 1mqGuy-0003ma-EY
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 15: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 1mqGuy-0005vA-Dn
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 15:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqGuy-0007Vu-Cj
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 15: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=9PVKcanikV3oiQxVsbEbynypbtreTFxbCkUYzpW1RmQ=; b=3dKo9lbJAOoZj+yFdpOfl3dhfp
	8PoHel48LStQJMKOoFZGRUSWqhi/FUDF4WMARzPUprhA7OTAiIckKZuXLCCwrhT9j8hbP3c1ProtH
	oK+xs+cxBjnQKUGVS+hvw2gFTPcMFQn4XYxZ9RI5ci8j28jE2pIeCquXKcfdnXwrKGhk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] x86/PoD: deal with misaligned GFNs
Message-Id: <E1mqGuy-0007Vu-Cj@xenbits.xenproject.org>
Date: Thu, 25 Nov 2021 15:44:12 +0000

commit d94d006ed36084914c2931641b724ae262e3fb80
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:32:54 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:32:54 2021 +0100

    x86/PoD: deal with misaligned GFNs
    
    Users of XENMEM_decrease_reservation and XENMEM_populate_physmap aren't
    required to pass in order-aligned GFN values. (While I consider this
    bogus, I don't think we can fix this there, as that might break existing
    code, e.g Linux'es swiotlb, which - while affecting PV only - until
    recently had been enforcing only page alignment on the original
    allocation.) Only non-PoD code paths (guest_physmap_{add,remove}_page(),
    p2m_set_entry()) look to be dealing with this properly (in part by being
    implemented inefficiently, handling every 4k page separately).
    
    Introduce wrappers taking care of splitting the incoming request into
    aligned chunks, without putting much effort in trying to determine the
    largest possible chunk at every iteration.
    
    Also "handle" p2m_set_entry() failure for non-order-0 requests by
    crashing the domain in one more place. Alongside putting a log message
    there, also add one to the other similar path.
    
    Note regarding locking: This is left in the actual worker functions on
    the assumption that callers aren't guaranteed atomicity wrt acting on
    multiple pages at a time. For mis-aligned GFNs gfn_lock() wouldn't have
    locked the correct GFN range anyway, if it didn't simply resolve to
    p2m_lock(), and for well-behaved callers there continues to be only a
    single iteration, i.e. behavior is unchanged for them. (FTAOD pulling
    out just pod_lock() into p2m_pod_decrease_reservation() would result in
    a lock order violation.)
    
    This is CVE-2021-28704 and CVE-2021-28707 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 182c737b9ba540ebceb1433f3940fbed6eac4ea9
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m-pod.c | 75 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 63 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index 007cdd87d0..c14801f5ff 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -495,7 +495,7 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn);
 
 
 /*
- * This function is needed for two reasons:
+ * This pair of functions is needed for two reasons:
  * + To properly handle clearing of PoD entries
  * + To "steal back" memory being freed for the PoD cache, rather than
  *   releasing it.
@@ -503,8 +503,8 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn);
  * Once both of these functions have been completed, we can return and
  * allow decrease_reservation() to handle everything else.
  */
-unsigned long
-p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+static unsigned long
+decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
 {
     unsigned long ret = 0, i, n;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -557,8 +557,10 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
          * All PoD: Mark the whole region invalid and tell caller
          * we're done.
          */
-        if ( p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
-                           p2m->default_access) )
+        int rc = p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
+                               p2m->default_access);
+
+        if ( rc )
         {
             /*
              * If this fails, we can't tell how much of the range was changed.
@@ -566,7 +568,12 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
              * impossible.
              */
             if ( order != 0 )
+            {
+                printk(XENLOG_G_ERR
+                       "%pd: marking GFN %#lx (order %u) as non-PoD failed: %d\n",
+                       d, gfn_x(gfn), order, rc);
                 domain_crash(d);
+            }
             goto out_unlock;
         }
         ret = 1UL << order;
@@ -674,6 +681,22 @@ out_unlock:
     return ret;
 }
 
+unsigned long
+p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+{
+    unsigned long left = 1UL << order, ret = 0;
+    unsigned int chunk_order = find_first_set_bit(gfn_x(gfn) | left);
+
+    do {
+        ret += decrease_reservation(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn = gfn_add(gfn, 1UL << chunk_order);
+    } while ( left );
+
+    return ret;
+}
+
 void p2m_pod_dump_data(struct domain *d)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -1269,19 +1292,15 @@ remap_and_retry:
     return true;
 }
 
-
-int
-guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
-                                      unsigned int order)
+static int
+mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
+                        unsigned int order)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     gfn_t gfn = _gfn(gfn_l);
     unsigned long i, n, pod_count = 0;
     int rc = 0;
 
-    if ( !paging_mode_translate(d) )
-        return -EINVAL;
-
     gfn_lock(p2m, gfn, order);
 
     P2M_DEBUG("mark pod gfn=%#lx\n", gfn_l);
@@ -1319,6 +1338,17 @@ guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
         BUG_ON(p2m->pod.entry_count < 0);
         pod_unlock(p2m);
     }
+    else if ( order )
+    {
+        /*
+         * If this failed, we can't tell how much of the range was changed.
+         * Best to crash the domain.
+         */
+        printk(XENLOG_G_ERR
+               "%pd: marking GFN %#lx (order %u) as PoD failed: %d\n",
+               d, gfn_l, order, rc);
+        domain_crash(d);
+    }
 
 out:
     gfn_unlock(p2m, gfn, order);
@@ -1326,6 +1356,27 @@ out:
     return rc;
 }
 
+int
+guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
+                                      unsigned int order)
+{
+    unsigned long left = 1UL << order;
+    unsigned int chunk_order = find_first_set_bit(gfn | left);
+    int rc;
+
+    if ( !paging_mode_translate(d) )
+        return -EINVAL;
+
+    do {
+        rc = mark_populate_on_demand(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn += 1UL << chunk_order;
+    } while ( !rc && left );
+
+    return rc;
+}
+
 void p2m_pod_init(struct p2m_domain *p2m)
 {
     unsigned int i;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Nov 25 15:44:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Nov 2021 15:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.231606.400866 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqGvA-0003qT-0d; Thu, 25 Nov 2021 15:44:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 231606.400866; Thu, 25 Nov 2021 15: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 1mqGv9-0003qL-U0; Thu, 25 Nov 2021 15:44:23 +0000
Received: by outflank-mailman (input) for mailman id 231606;
 Thu, 25 Nov 2021 15: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 1mqGv8-0003q9-Hr
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 15: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 1mqGv8-0005vl-H5
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 15:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqGv8-0007Wm-G6
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 15: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=wN1c/bn+nJnrYAPzsRoPsbRt86L0S2PuOPtbdYUaLXg=; b=m61d2++SN5pCcCXzObfZq5DyQd
	hgwMBWUq/a3nmkGy7bVNu1VvoMxX0vmYEATW1hnYa7o30cKGxUsYnFZ/7AAfFYRwmbvBud3WYcCQ8
	1w0zINdoq4Gx/JiyUPhbHn/LUrzgGzkNnuVpZBI2fzqh3i160LpzSdsKmc/6AzUpZ1M0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
Message-Id: <E1mqGv8-0007Wm-G6@xenbits.xenproject.org>
Date: Thu, 25 Nov 2021 15:44:22 +0000

commit d3cfb4b3a680d3e2ddd36f18201d48441f36aea0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:33:14 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:33:14 2021 +0100

    x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
    
    p2m_pod_decrease_reservation() may pass pages to the function which
    aren't 4k, 2M, or 1G. Handle all intermediate orders as well, to avoid
    hitting the BUG() at the switch() statement's "default" case.
    
    This is CVE-2021-28708 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 8ec13f68e0b026863d23e7f44f252d06478bc809
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m-pod.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index c14801f5ff..c981200087 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -111,15 +111,13 @@ p2m_pod_cache_add(struct p2m_domain *p2m,
     /* Then add to the appropriate populate-on-demand list. */
     switch ( order )
     {
-    case PAGE_ORDER_1G:
-        for ( i = 0; i < (1UL << PAGE_ORDER_1G); i += 1UL << PAGE_ORDER_2M )
+    case PAGE_ORDER_2M ... PAGE_ORDER_1G:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_2M )
             page_list_add_tail(page + i, &p2m->pod.super);
         break;
-    case PAGE_ORDER_2M:
-        page_list_add_tail(page, &p2m->pod.super);
-        break;
-    case PAGE_ORDER_4K:
-        page_list_add_tail(page, &p2m->pod.single);
+    case PAGE_ORDER_4K ... PAGE_ORDER_2M - 1:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_4K )
+            page_list_add_tail(page + i, &p2m->pod.single);
         break;
     default:
         BUG();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Nov 25 15:44:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Nov 2021 15:44:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.231607.400871 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqGvK-0003tN-2B; Thu, 25 Nov 2021 15:44:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 231607.400871; Thu, 25 Nov 2021 15:44:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqGvJ-0003tF-VS; Thu, 25 Nov 2021 15:44:33 +0000
Received: by outflank-mailman (input) for mailman id 231607;
 Thu, 25 Nov 2021 15: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 1mqGvI-0003t2-L9
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 15: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 1mqGvI-0005vz-KM
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 15:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqGvI-0007Xk-JT
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 15: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=4a6GQ3ZDwfObn9QeKTGNqnly0rtnbTfXLZK/Yxw4hT0=; b=p3L4kyjMORZ8hb0DyM2DZ1nPWR
	QaBnYuW4rsw8Y/UqmDcvoPwsonGF60dzJgKgTd+Lp2bIwJP4Mmp8RpmtRRQhxJqVcPG5AaLfNAivp
	Wtf8ouwPbkAA6/qg2zCo2HLAIkjZQA9tVS2N0TPGkvhlnLVGC11dnIHmDyoI2bbsJ6ig=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] x86/P2M: deal with partial success of p2m_set_entry()
Message-Id: <E1mqGvI-0007Xk-JT@xenbits.xenproject.org>
Date: Thu, 25 Nov 2021 15:44:32 +0000

commit d3c2319ea1657f31ae3899713afc23789b771c10
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:33:33 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:33:33 2021 +0100

    x86/P2M: deal with partial success of p2m_set_entry()
    
    M2P and PoD stats need to remain in sync with P2M; if an update succeeds
    only partially, respective adjustments need to be made. If updates get
    made before the call, they may also need undoing upon complete failure
    (i.e. including the single-page case).
    
    Log-dirty state would better also be kept in sync.
    
    Note that the change to set_typed_p2m_entry() may not be strictly
    necessary (due to the order restriction enforced near the top of the
    function), but is being kept here to be on the safe side.
    
    This is CVE-2021-28705 and CVE-2021-28709 / XSA-389.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 74a11c43fd7e074b1f77631b446dd2115eacb9e8
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m.c | 116 ++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 102 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index a68b4fe526..a6bfda010a 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -781,6 +781,7 @@ p2m_remove_page(struct p2m_domain *p2m, unsigned long gfn_l, unsigned long mfn,
     gfn_t gfn = _gfn(gfn_l);
     p2m_type_t t;
     p2m_access_t a;
+    int rc;
 
     /* IOMMU for PV guests is handled in get_page_type() and put_page(). */
     if ( !paging_mode_translate(p2m->domain) )
@@ -812,8 +813,27 @@ p2m_remove_page(struct p2m_domain *p2m, unsigned long gfn_l, unsigned long mfn,
                 set_gpfn_from_mfn(mfn+i, INVALID_M2P_ENTRY);
         }
     }
-    return p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
-                         p2m->default_access);
+    rc = p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
+                       p2m->default_access);
+    if ( likely(!rc) || !mfn_valid(_mfn(mfn)) )
+        return rc;
+
+    /*
+     * The operation may have partially succeeded. For the failed part we need
+     * to undo the M2P update and, out of precaution, mark the pages dirty
+     * again.
+     */
+    for ( i = 0; i < (1UL << page_order); ++i )
+    {
+        p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0, NULL, NULL);
+        if ( !p2m_is_hole(t) && !p2m_is_special(t) && !p2m_is_shared(t) )
+        {
+            set_gpfn_from_mfn(mfn + i, gfn_l + i);
+            paging_mark_pfn_dirty(p2m->domain, _pfn(gfn_l + i));
+        }
+    }
+
+    return rc;
 }
 
 int
@@ -1002,13 +1022,8 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
 
     /* Now, actually do the two-way mapping */
     rc = p2m_set_entry(p2m, gfn, mfn, page_order, t, p2m->default_access);
-    if ( rc == 0 )
+    if ( likely(!rc) )
     {
-        pod_lock(p2m);
-        p2m->pod.entry_count -= pod_count;
-        BUG_ON(p2m->pod.entry_count < 0);
-        pod_unlock(p2m);
-
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -1016,6 +1031,42 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                                   gfn_x(gfn_add(gfn, i)));
         }
     }
+    else
+    {
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update M2P and dirty state, while for the failed part we
+         * may need to adjust PoD stats as well as undo the earlier M2P update.
+         */
+        for ( i = 0; i < (1UL << page_order); ++i )
+        {
+            omfn = p2m->get_entry(p2m, gfn_add(gfn, i), &ot, &a, 0, NULL, NULL);
+            if ( p2m_is_pod(ot) )
+            {
+                BUG_ON(!pod_count);
+                --pod_count;
+            }
+            else if ( mfn_eq(omfn, mfn_add(mfn, i)) && ot == t &&
+                      a == p2m->default_access && !p2m_is_grant(t) )
+            {
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+                paging_mark_pfn_dirty(d, _pfn(gfn_x(gfn) + i));
+            }
+            else if ( p2m_is_ram(ot) && !p2m_is_paged(ot) )
+            {
+                ASSERT(mfn_valid(omfn));
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+            }
+        }
+    }
+
+    if ( pod_count )
+    {
+        pod_lock(p2m);
+        p2m->pod.entry_count -= pod_count;
+        BUG_ON(p2m->pod.entry_count < 0);
+        pod_unlock(p2m);
+    }
 
  out:
     p2m_unlock(p2m);
@@ -1307,6 +1358,49 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
             return 0;
         }
     }
+
+    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
+    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
+    if ( unlikely(rc) )
+    {
+        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
+                 gfn_l, order, rc, mfn_x(mfn));
+
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update PoD stats, M2P, and dirty state.
+         */
+        if ( order != PAGE_ORDER_4K )
+        {
+            unsigned long i;
+
+            for ( i = 0; i < (1UL << order); ++i )
+            {
+                p2m_type_t t;
+                mfn_t cmfn = p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0,
+                                            NULL, NULL);
+
+                if ( !mfn_eq(cmfn, mfn_add(mfn, i)) || t != gfn_p2mt ||
+                     a != access )
+                    continue;
+
+                if ( p2m_is_ram(ot) )
+                {
+                    ASSERT(mfn_valid(mfn_add(omfn, i)));
+                    set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
+                }
+#ifdef CONFIG_HVM
+                else if ( p2m_is_pod(ot) )
+                {
+                    pod_lock(p2m);
+                    BUG_ON(!p2m->pod.entry_count);
+                    --p2m->pod.entry_count;
+                    pod_unlock(p2m);
+                }
+#endif
+            }
+        }
+    }
     else if ( p2m_is_ram(ot) )
     {
         unsigned long i;
@@ -1317,12 +1411,6 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
             set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
         }
     }
-
-    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
-    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
-    if ( rc )
-        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
-                 gfn_l, order, rc, mfn_x(mfn));
 #ifdef CONFIG_HVM
     else if ( p2m_is_pod(ot) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Thu Nov 25 17:44:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Nov 2021 17:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.231765.401242 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqIn0-0004zf-52; Thu, 25 Nov 2021 17:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 231765.401242; Thu, 25 Nov 2021 17: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 1mqIn0-0004zV-0N; Thu, 25 Nov 2021 17:44:06 +0000
Received: by outflank-mailman (input) for mailman id 231765;
 Thu, 25 Nov 2021 17: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 1mqImz-0004zP-7L
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 17: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 1mqImz-00006P-3F
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 17:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqImz-00052d-26
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 17: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=SPLrxlYOOb9a9hY8/kyCKBepU0iWowrxTvrhe6DcRE0=; b=vHJsEhxxw8ue0mStpgXL1icQIo
	bV/6lkf630xNHGRQUuN3bjpjM+LiZHcfn9qt5MDciR3Me5rzIuPsy8REFIpn7s8R+Vg6QWHb5+VNP
	nhnfTiJPHzGfxDXNFbzsVsT9I9sp49Tw2UQZfXdogl1GGu54ddLFFesOxaTuE2HulZdo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Revert "x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents"
Message-Id: <E1mqImz-00052d-26@xenbits.xenproject.org>
Date: Thu, 25 Nov 2021 17:44:05 +0000

commit 0e6c87b93e1d35fedf9cebd65395c2f79b4af11a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 24 19:06:02 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Nov 25 17:14:18 2021 +0000

    Revert "x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents"
    
    OSSTest has identified a 3rd regression caused by this change.  Migration
    between Xen 4.15 and 4.16 on the nocera pair of machines (AMD Opteron 4133)
    fails with:
    
      xc: error: Failed to set CPUID policy: leaf 00000000, subleaf ffffffff, msr ffffffff (22 = Invalid argument): Internal error
      xc: error: Restore failed (22 = Invalid argument): Internal error
    
    which is a safety check to prevent resuming the guest when the CPUID data has
    been truncated.  The problem is caused by shrinking of the max policies, which
    is an ABI that needs handling compatibly between different versions of Xen.
    
    Furthermore, shrinking of the default policies also breaks things in some
    cases, because certain cpuid= settings in a VM config file which used to work
    will now be refused.  Also external toolstacks that attempt to set the CPUID
    policy from a featureset might now see some filled leaves not reachable due to
    the shrinking done to the default domain policy before applying the
    featureset.
    
    This reverts commit 540d911c2813c3d8f4cdbb3f5672119e5e768a3d, as well as the
    partial fix attempt in 81da2b544cbb003a5447c9b14d275746ad22ab37 (which added
    one new case where cpuid= settings might not apply correctly) and restores the
    same behaviour as Xen 4.15.
    
    Fixes: 540d911c2813 ("x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents")
    Fixes: 81da2b544cbb ("x86/cpuid: prevent shrinking migrated policies max leaves")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/libs/guest/xg_cpuid_x86.c          |   7 ---
 tools/tests/cpu-policy/test-cpu-policy.c | 101 -------------------------------
 xen/arch/x86/cpuid.c                     |  10 ---
 xen/include/xen/lib/x86/cpuid.h          |   7 ---
 xen/lib/x86/cpuid.c                      |  39 ------------
 5 files changed, 164 deletions(-)

diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 3ffd5f683b..198892ebdf 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -638,13 +638,6 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
         }
     }
 
-    /*
-     * Do not try to shrink the policy if restoring, as that could cause
-     * guest visible changes in the maximum leaf fields.
-     */
-    if ( !restore )
-        x86_cpuid_policy_shrink_max_leaves(p);
-
     rc = x86_cpuid_copy_to_buffer(p, leaves, &nr_leaves);
     if ( rc )
     {
diff --git a/tools/tests/cpu-policy/test-cpu-policy.c b/tools/tests/cpu-policy/test-cpu-policy.c
index 75973298df..ed450a0997 100644
--- a/tools/tests/cpu-policy/test-cpu-policy.c
+++ b/tools/tests/cpu-policy/test-cpu-policy.c
@@ -8,13 +8,10 @@
 #include <err.h>
 
 #include <xen-tools/libs.h>
-#include <xen/asm/x86-defns.h>
 #include <xen/asm/x86-vendors.h>
 #include <xen/lib/x86/cpu-policy.h>
 #include <xen/domctl.h>
 
-#define XSTATE_FP_SSE  (X86_XCR0_FP | X86_XCR0_SSE)
-
 static unsigned int nr_failures;
 #define fail(fmt, ...)                          \
 ({                                              \
@@ -573,103 +570,6 @@ static void test_cpuid_out_of_range_clearing(void)
     }
 }
 
-static void test_cpuid_maximum_leaf_shrinking(void)
-{
-    static const struct test {
-        const char *name;
-        struct cpuid_policy p;
-    } tests[] = {
-        {
-            .name = "basic",
-            .p = {
-                /* Very basic information only. */
-                .basic.max_leaf = 1,
-                .basic.raw_fms = 0xc2,
-            },
-        },
-        {
-            .name = "cache",
-            .p = {
-                /* Cache subleaves present. */
-                .basic.max_leaf = 4,
-                .cache.subleaf[0].type = 1,
-            },
-        },
-        {
-            .name = "feat#0",
-            .p = {
-                /* Subleaf 0 only with some valid bit. */
-                .basic.max_leaf = 7,
-                .feat.max_subleaf = 0,
-                .feat.fsgsbase = 1,
-            },
-        },
-        {
-            .name = "feat#1",
-            .p = {
-                /* Subleaf 1 only with some valid bit. */
-                .basic.max_leaf = 7,
-                .feat.max_subleaf = 1,
-                .feat.avx_vnni = 1,
-            },
-        },
-        {
-            .name = "topo",
-            .p = {
-                /* Topology subleaves present. */
-                .basic.max_leaf = 0xb,
-                .topo.subleaf[0].type = 1,
-            },
-        },
-        {
-            .name = "xstate",
-            .p = {
-                /* First subleaf always valid (and then non-zero). */
-                .basic.max_leaf = 0xd,
-                .xstate.xcr0_low = XSTATE_FP_SSE,
-            },
-        },
-        {
-            .name = "extd",
-            .p = {
-                /* Commonly available information only. */
-                .extd.max_leaf = 0x80000008,
-                .extd.maxphysaddr = 0x28,
-                .extd.maxlinaddr = 0x30,
-            },
-        },
-    };
-
-    printf("Testing CPUID maximum leaf shrinking:\n");
-
-    for ( size_t i = 0; i < ARRAY_SIZE(tests); ++i )
-    {
-        const struct test *t = &tests[i];
-        struct cpuid_policy *p = memdup(&t->p);
-
-        p->basic.max_leaf = ARRAY_SIZE(p->basic.raw) - 1;
-        p->feat.max_subleaf = ARRAY_SIZE(p->feat.raw) - 1;
-        p->extd.max_leaf = 0x80000000 | (ARRAY_SIZE(p->extd.raw) - 1);
-
-        x86_cpuid_policy_shrink_max_leaves(p);
-
-        /* Check the the resulting max (sub)leaf values against expecations. */
-        if ( p->basic.max_leaf != t->p.basic.max_leaf )
-             fail("  Test %s basic fail - expected %#x, got %#x\n",
-                  t->name, t->p.basic.max_leaf, p->basic.max_leaf);
-
-        if ( p->extd.max_leaf != t->p.extd.max_leaf )
-             fail("  Test %s extd fail - expected %#x, got %#x\n",
-                  t->name, t->p.extd.max_leaf, p->extd.max_leaf);
-
-        if ( p->feat.max_subleaf != t->p.feat.max_subleaf )
-             fail("  Test %s feat fail - expected %#x, got %#x\n",
-                  t->name, t->p.feat.max_subleaf, p->feat.max_subleaf);
-
-        free(p);
-    }
-}
-
 static void test_is_compatible_success(void)
 {
     static struct test {
@@ -785,7 +685,6 @@ int main(int argc, char **argv)
     test_cpuid_serialise_success();
     test_cpuid_deserialise_failure();
     test_cpuid_out_of_range_clearing();
-    test_cpuid_maximum_leaf_shrinking();
 
     test_msr_serialise_success();
     test_msr_deserialise_failure();
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 8ac55f0806..151944f657 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -353,8 +353,6 @@ static void __init calculate_host_policy(void)
         p->extd.raw[0xa].d |= ((1u << SVM_FEATURE_VMCBCLEAN) |
                                (1u << SVM_FEATURE_TSCRATEMSR));
     }
-
-    x86_cpuid_policy_shrink_max_leaves(p);
 }
 
 static void __init guest_common_default_feature_adjustments(uint32_t *fs)
@@ -434,8 +432,6 @@ static void __init calculate_pv_max_policy(void)
     recalculate_xstate(p);
 
     p->extd.raw[0xa] = EMPTY_LEAF; /* No SVM for PV guests. */
-
-    x86_cpuid_policy_shrink_max_leaves(p);
 }
 
 static void __init calculate_pv_def_policy(void)
@@ -456,8 +452,6 @@ static void __init calculate_pv_def_policy(void)
     sanitise_featureset(pv_featureset);
     cpuid_featureset_to_policy(pv_featureset, p);
     recalculate_xstate(p);
-
-    x86_cpuid_policy_shrink_max_leaves(p);
 }
 
 static void __init calculate_hvm_max_policy(void)
@@ -523,8 +517,6 @@ static void __init calculate_hvm_max_policy(void)
     sanitise_featureset(hvm_featureset);
     cpuid_featureset_to_policy(hvm_featureset, p);
     recalculate_xstate(p);
-
-    x86_cpuid_policy_shrink_max_leaves(p);
 }
 
 static void __init calculate_hvm_def_policy(void)
@@ -549,8 +541,6 @@ static void __init calculate_hvm_def_policy(void)
     sanitise_featureset(hvm_featureset);
     cpuid_featureset_to_policy(hvm_featureset, p);
     recalculate_xstate(p);
-
-    x86_cpuid_policy_shrink_max_leaves(p);
 }
 
 void __init init_guest_cpuid(void)
diff --git a/xen/include/xen/lib/x86/cpuid.h b/xen/include/xen/lib/x86/cpuid.h
index 2300faf03e..a4d254ea96 100644
--- a/xen/include/xen/lib/x86/cpuid.h
+++ b/xen/include/xen/lib/x86/cpuid.h
@@ -386,13 +386,6 @@ void x86_cpuid_policy_fill_native(struct cpuid_policy *p);
  */
 void x86_cpuid_policy_clear_out_of_range_leaves(struct cpuid_policy *p);
 
-/**
- * Shrink max leaf/subleaf values such that the last respective valid entry
- * isn't all blank.  While permitted by the spec, such extraneous leaves may
- * provide undue "hints" to guests.
- */
-void x86_cpuid_policy_shrink_max_leaves(struct cpuid_policy *p);
-
 #ifdef __XEN__
 #include <public/arch-x86/xen.h>
 typedef XEN_GUEST_HANDLE_64(xen_cpuid_leaf_t) cpuid_leaf_buffer_t;
diff --git a/xen/lib/x86/cpuid.c b/xen/lib/x86/cpuid.c
index 1409c254c8..8eb88314f5 100644
--- a/xen/lib/x86/cpuid.c
+++ b/xen/lib/x86/cpuid.c
@@ -236,45 +236,6 @@ void x86_cpuid_policy_clear_out_of_range_leaves(struct cpuid_policy *p)
                 ARRAY_SIZE(p->extd.raw) - 1);
 }
 
-void x86_cpuid_policy_shrink_max_leaves(struct cpuid_policy *p)
-{
-    unsigned int i;
-
-    p->basic.raw[0x4] = p->cache.raw[0];
-
-    for ( i = p->feat.max_subleaf; i; --i )
-        if ( p->feat.raw[i].a | p->feat.raw[i].b |
-             p->feat.raw[i].c | p->feat.raw[i].d )
-            break;
-    p->feat.max_subleaf = i;
-    p->basic.raw[0x7] = p->feat.raw[i];
-
-    p->basic.raw[0xb] = p->topo.raw[0];
-
-    /*
-     * Due to the way xstate gets handled in the hypervisor (see
-     * recalculate_xstate()) there is (for now at least) no need to fiddle
-     * with the xstate subleaves (IOW we assume they're already in consistent
-     * shape, for coming from either hardware or recalculate_xstate()).
-     */
-    p->basic.raw[0xd] = p->xstate.raw[0];
-
-    for ( i = p->basic.max_leaf; i; --i )
-        if ( p->basic.raw[i].a | p->basic.raw[i].b |
-             p->basic.raw[i].c | p->basic.raw[i].d )
-            break;
-    p->basic.max_leaf = i;
-
-    for ( i = p->extd.max_leaf & 0xffff; i; --i )
-        if ( p->extd.raw[i].a | p->extd.raw[i].b |
-             p->extd.raw[i].c | p->extd.raw[i].d )
-            break;
-    if ( i | p->extd.raw[0].b | p->extd.raw[0].c | p->extd.raw[0].d )
-        p->extd.max_leaf = 0x80000000 | i;
-    else
-        p->extd.max_leaf = 0;
-}
-
 const uint32_t *x86_cpuid_lookup_deep_deps(uint32_t feature)
 {
     static const uint32_t deep_features[] = INIT_DEEP_FEATURES;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Nov 25 18:55:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Nov 2021 18:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.231828.401393 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqJte-0003su-Lf; Thu, 25 Nov 2021 18:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 231828.401393; Thu, 25 Nov 2021 18:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqJte-0003sm-Ii; Thu, 25 Nov 2021 18:55:02 +0000
Received: by outflank-mailman (input) for mailman id 231828;
 Thu, 25 Nov 2021 18:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqJtd-0003sg-HP
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 18: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 1mqJtd-0001Mv-GT
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 18:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqJtd-0002LK-FK
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 18: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=SeNB17AnYw+KbehyN+bGCE+QjJrZVdD7DpzJZGjE3Cg=; b=i2EMzBq1yzTBeosluWKhzaZwod
	/D2r6R6Ykuq8Xtv+DXLfPFKKvQBv5LR+sGWe0N5hdHaJuaDQjO86ZKYQNKPflBKho/YcCCQvpyDaR
	+uhIH8QjOWiihd7ncl+PcIHVhPLvQQLWaAIawYx8KBBzwxD6UAp1RezUK7weWk8ilH0g=;
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: Harden assign_pages()
Message-Id: <E1mqJtd-0002LK-FK@xenbits.xenproject.org>
Date: Thu, 25 Nov 2021 18:55:01 +0000

commit 497bd4aadf0c1a3fa2876352e25999c5803c512d
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Nov 23 13:29:09 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:29:09 2021 +0100

    xen/page_alloc: Harden assign_pages()
    
    domain_tot_pages() and d->max_pages are 32-bit values. While the order
    should always be quite small, it would still be possible to overflow
    if domain_tot_pages() is near to (2^32 - 1).
    
    As this code may be called by a guest via XENMEM_increase_reservation
    and XENMEM_populate_physmap, we want to make sure the guest is not going
    to be able to allocate more than it is allowed.
    
    Rework the allocation check to avoid any possible overflow. While the
    check domain_tot_pages() < d->max_pages should technically not be
    necessary, it is probably best to have it to catch any possible
    inconsistencies in the future.
    
    This is CVE-2021-28706 / part of XSA-385.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 143501861d48e1bfef495849fd68584baac05849
    master date: 2021-11-22 11:11:05 +0000
---
 xen/common/grant_table.c |  7 ++++---
 xen/common/page_alloc.c  | 35 +++++++++++++++++++++++++++++------
 2 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index f8486c3de7..90781e236e 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -2319,7 +2319,8 @@ gnttab_transfer(
          * pages when it is dying.
          */
         if ( unlikely(e->is_dying) ||
-             unlikely(domain_tot_pages(e) >= e->max_pages) )
+             unlikely(domain_tot_pages(e) >= e->max_pages) ||
+             unlikely(!(e->tot_pages + 1)) )
         {
             spin_unlock(&e->page_alloc_lock);
 
@@ -2328,8 +2329,8 @@ gnttab_transfer(
                          e->domain_id);
             else
                 gdprintk(XENLOG_INFO,
-                         "Transferee d%d has no headroom (tot %u, max %u)\n",
-                         e->domain_id, domain_tot_pages(e), e->max_pages);
+                         "Transferee %pd has no headroom (tot %u, max %u, ex %u)\n",
+                         e, domain_tot_pages(e), e->max_pages, e->extra_pages);
 
             gop.status = GNTST_general_error;
             goto unlock_and_copyback;
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 8859fa4fd1..4ec1b37ac9 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2298,20 +2298,43 @@ int assign_pages(
     }
     else if ( !(memflags & MEMF_no_refcount) )
     {
-        unsigned int tot_pages = domain_tot_pages(d) + (1 << order);
+        unsigned int tot_pages = domain_tot_pages(d), nr = 1u << order;
 
         if ( unlikely(tot_pages > d->max_pages) )
         {
-            gprintk(XENLOG_INFO, "Over-allocation for domain %u: "
-                    "%u > %u\n", d->domain_id, tot_pages, d->max_pages);
+            gprintk(XENLOG_INFO, "Inconsistent allocation for %pd: %u > %u\n",
+                    d, tot_pages, d->max_pages);
+            rc = -EPERM;
+            goto out;
+        }
+
+        if ( unlikely(nr > d->max_pages - tot_pages) )
+        {
+            gprintk(XENLOG_INFO, "Over-allocation for %pd: %Lu > %u\n",
+                    d, tot_pages + 0ull + nr, d->max_pages);
             rc = -E2BIG;
             goto out;
         }
     }
 
-    if ( !(memflags & MEMF_no_refcount) &&
-         unlikely(domain_adjust_tot_pages(d, 1 << order) == (1 << order)) )
-        get_knownalive_domain(d);
+    if ( !(memflags & MEMF_no_refcount) )
+    {
+        unsigned int nr = 1u << order;
+
+        if ( unlikely(d->tot_pages + nr < nr) )
+        {
+            gprintk(XENLOG_INFO,
+                    "Excess allocation for %pd: %Lu (%u extra)\n",
+                    d, d->tot_pages + 0ull + nr, d->extra_pages);
+            if ( pg[0].count_info & PGC_extra )
+                d->extra_pages -= nr;
+            rc = -E2BIG;
+            goto out;
+        }
+
+        if ( unlikely(domain_adjust_tot_pages(d, nr) == nr) )
+            get_knownalive_domain(d);
+    }
 
     for ( i = 0; i < (1 << order); i++ )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Nov 25 18:55:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Nov 2021 18:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.231829.401397 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqJto-0003uh-N8; Thu, 25 Nov 2021 18:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 231829.401397; Thu, 25 Nov 2021 18:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqJto-0003uZ-KC; Thu, 25 Nov 2021 18:55:12 +0000
Received: by outflank-mailman (input) for mailman id 231829;
 Thu, 25 Nov 2021 18:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqJtn-0003uT-KY
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 18:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqJtn-0001ND-Jc
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 18:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqJtn-0002MM-Im
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 18:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=e1ZO+wTBEf8o9R61M/JLo9NlviKSsXnAiZAXxNM+fqc=; b=ns4FEsmwcIzOojYFTE6HZinr4W
	hOKx5OC0Bylh9pz73zilvXH7UMJa4Ljgqn+czjg1ShAwVbkE6usUESfUB0CZiM4NSocmHRuoL3OVq
	9s1OsQF1puQ+8u6esSCGNoVaIY5RdESwD4kC+zxTzFYSbj/WT54BaCx+0ZPk0as70HIY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/PoD: deal with misaligned GFNs
Message-Id: <E1mqJtn-0002MM-Im@xenbits.xenproject.org>
Date: Thu, 25 Nov 2021 18:55:11 +0000

commit 7f654ea88ee6100f5948f383a38254be8c28a255
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:29:41 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:29:41 2021 +0100

    x86/PoD: deal with misaligned GFNs
    
    Users of XENMEM_decrease_reservation and XENMEM_populate_physmap aren't
    required to pass in order-aligned GFN values. (While I consider this
    bogus, I don't think we can fix this there, as that might break existing
    code, e.g Linux'es swiotlb, which - while affecting PV only - until
    recently had been enforcing only page alignment on the original
    allocation.) Only non-PoD code paths (guest_physmap_{add,remove}_page(),
    p2m_set_entry()) look to be dealing with this properly (in part by being
    implemented inefficiently, handling every 4k page separately).
    
    Introduce wrappers taking care of splitting the incoming request into
    aligned chunks, without putting much effort in trying to determine the
    largest possible chunk at every iteration.
    
    Also "handle" p2m_set_entry() failure for non-order-0 requests by
    crashing the domain in one more place. Alongside putting a log message
    there, also add one to the other similar path.
    
    Note regarding locking: This is left in the actual worker functions on
    the assumption that callers aren't guaranteed atomicity wrt acting on
    multiple pages at a time. For mis-aligned GFNs gfn_lock() wouldn't have
    locked the correct GFN range anyway, if it didn't simply resolve to
    p2m_lock(), and for well-behaved callers there continues to be only a
    single iteration, i.e. behavior is unchanged for them. (FTAOD pulling
    out just pod_lock() into p2m_pod_decrease_reservation() would result in
    a lock order violation.)
    
    This is CVE-2021-28704 and CVE-2021-28707 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 182c737b9ba540ebceb1433f3940fbed6eac4ea9
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m-pod.c | 75 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 63 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index b64f561fa7..fd5bad31f0 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -495,7 +495,7 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn);
 
 
 /*
- * This function is needed for two reasons:
+ * This pair of functions is needed for two reasons:
  * + To properly handle clearing of PoD entries
  * + To "steal back" memory being freed for the PoD cache, rather than
  *   releasing it.
@@ -503,8 +503,8 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn);
  * Once both of these functions have been completed, we can return and
  * allow decrease_reservation() to handle everything else.
  */
-unsigned long
-p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+static unsigned long
+decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
 {
     unsigned long ret = 0, i, n;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -551,8 +551,10 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
          * All PoD: Mark the whole region invalid and tell caller
          * we're done.
          */
-        if ( p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
-                           p2m->default_access) )
+        int rc = p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
+                               p2m->default_access);
+
+        if ( rc )
         {
             /*
              * If this fails, we can't tell how much of the range was changed.
@@ -560,7 +562,12 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
              * impossible.
              */
             if ( order != 0 )
+            {
+                printk(XENLOG_G_ERR
+                       "%pd: marking GFN %#lx (order %u) as non-PoD failed: %d\n",
+                       d, gfn_x(gfn), order, rc);
                 domain_crash(d);
+            }
             goto out_unlock;
         }
         ret = 1UL << order;
@@ -667,6 +674,22 @@ out_unlock:
     return ret;
 }
 
+unsigned long
+p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+{
+    unsigned long left = 1UL << order, ret = 0;
+    unsigned int chunk_order = find_first_set_bit(gfn_x(gfn) | left);
+
+    do {
+        ret += decrease_reservation(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn = gfn_add(gfn, 1UL << chunk_order);
+    } while ( left );
+
+    return ret;
+}
+
 void p2m_pod_dump_data(struct domain *d)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -1266,19 +1289,15 @@ remap_and_retry:
     return true;
 }
 
-
-int
-guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
-                                      unsigned int order)
+static int
+mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
+                        unsigned int order)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     gfn_t gfn = _gfn(gfn_l);
     unsigned long i, n, pod_count = 0;
     int rc = 0;
 
-    if ( !paging_mode_translate(d) )
-        return -EINVAL;
-
     gfn_lock(p2m, gfn, order);
 
     P2M_DEBUG("mark pod gfn=%#lx\n", gfn_l);
@@ -1316,6 +1335,17 @@ guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
         BUG_ON(p2m->pod.entry_count < 0);
         pod_unlock(p2m);
     }
+    else if ( order )
+    {
+        /*
+         * If this failed, we can't tell how much of the range was changed.
+         * Best to crash the domain.
+         */
+        printk(XENLOG_G_ERR
+               "%pd: marking GFN %#lx (order %u) as PoD failed: %d\n",
+               d, gfn_l, order, rc);
+        domain_crash(d);
+    }
 
 out:
     gfn_unlock(p2m, gfn, order);
@@ -1323,6 +1353,27 @@ out:
     return rc;
 }
 
+int
+guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
+                                      unsigned int order)
+{
+    unsigned long left = 1UL << order;
+    unsigned int chunk_order = find_first_set_bit(gfn | left);
+    int rc;
+
+    if ( !paging_mode_translate(d) )
+        return -EINVAL;
+
+    do {
+        rc = mark_populate_on_demand(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn += 1UL << chunk_order;
+    } while ( !rc && left );
+
+    return rc;
+}
+
 void p2m_pod_init(struct p2m_domain *p2m)
 {
     unsigned int i;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Nov 25 18:55:22 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Nov 2021 18:55:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.231830.401401 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqJty-0003xS-Ow; Thu, 25 Nov 2021 18:55:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 231830.401401; Thu, 25 Nov 2021 18:55:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqJty-0003xK-Li; Thu, 25 Nov 2021 18:55:22 +0000
Received: by outflank-mailman (input) for mailman id 231830;
 Thu, 25 Nov 2021 18:55:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqJtx-0003wz-NP
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 18:55:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqJtx-0001Nm-Md
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 18:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqJtx-0002NC-Lm
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 18:55:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7RX9h64Ipgl48Aw/zhEBqYKrMnZywgeIfUw9EW3/who=; b=ZgcP0DvHQDYC4JlvQWu4dMLOIQ
	/6Q5V4CXznbWSDA/SQ+y6urwaTHEjW+9RghGJRzd2B3zb6VZ9YI+7yPUmXPZS31PlbEXjL1Mcg3X3
	knHw7ZYucK4L+LkzHOVZbeoIfGIY0ZLXBsoLXNehS6N0l49UQCQMeq6XQhzyI1mYVUIo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
Message-Id: <E1mqJtx-0002NC-Lm@xenbits.xenproject.org>
Date: Thu, 25 Nov 2021 18:55:21 +0000

commit 3ae94651cf0b08f86f1aba012f6bdd42c449c68b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:29:54 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:29:54 2021 +0100

    x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
    
    p2m_pod_decrease_reservation() may pass pages to the function which
    aren't 4k, 2M, or 1G. Handle all intermediate orders as well, to avoid
    hitting the BUG() at the switch() statement's "default" case.
    
    This is CVE-2021-28708 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 8ec13f68e0b026863d23e7f44f252d06478bc809
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m-pod.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index fd5bad31f0..d947595132 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -111,15 +111,13 @@ p2m_pod_cache_add(struct p2m_domain *p2m,
     /* Then add to the appropriate populate-on-demand list. */
     switch ( order )
     {
-    case PAGE_ORDER_1G:
-        for ( i = 0; i < (1UL << PAGE_ORDER_1G); i += 1UL << PAGE_ORDER_2M )
+    case PAGE_ORDER_2M ... PAGE_ORDER_1G:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_2M )
             page_list_add_tail(page + i, &p2m->pod.super);
         break;
-    case PAGE_ORDER_2M:
-        page_list_add_tail(page, &p2m->pod.super);
-        break;
-    case PAGE_ORDER_4K:
-        page_list_add_tail(page, &p2m->pod.single);
+    case PAGE_ORDER_4K ... PAGE_ORDER_2M - 1:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_4K )
+            page_list_add_tail(page + i, &p2m->pod.single);
         break;
     default:
         BUG();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Nov 25 18:55:32 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Nov 2021 18:55:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.231831.401406 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqJu8-00041Y-Qb; Thu, 25 Nov 2021 18:55:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 231831.401406; Thu, 25 Nov 2021 18:55:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqJu8-00041Q-NG; Thu, 25 Nov 2021 18:55:32 +0000
Received: by outflank-mailman (input) for mailman id 231831;
 Thu, 25 Nov 2021 18:55:31 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqJu7-00041B-R8
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 18:55:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqJu7-0001Nz-QK
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 18:55:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqJu7-0002Nt-Oq
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 18:55:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=N8rHuWWKGVcRcGP0PPw9ufrGk4XT4drVgTFapI8BBgU=; b=cN4HwHMcHlkBbOx2oF72ohysHs
	LEdI3UsXnU3sh+JS8v3NtlHqx9Y+JOg/EseQ+iX+mcAPIhM7rPPw1N1+syeOXi8fbRlhaDZxb2Vp5
	dx/c6uxJcWyAe0FnN8LHpt0zJkJyOoKH4zDDwEU054VcrCGx56Y4DTuOe2deh/bdhnRM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/P2M: deal with partial success of p2m_set_entry()
Message-Id: <E1mqJu7-0002Nt-Oq@xenbits.xenproject.org>
Date: Thu, 25 Nov 2021 18:55:31 +0000

commit 9de3671772d5019dab2ba7be7ad1032ad3c9e0f2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:30:09 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:30:09 2021 +0100

    x86/P2M: deal with partial success of p2m_set_entry()
    
    M2P and PoD stats need to remain in sync with P2M; if an update succeeds
    only partially, respective adjustments need to be made. If updates get
    made before the call, they may also need undoing upon complete failure
    (i.e. including the single-page case).
    
    Log-dirty state would better also be kept in sync.
    
    Note that the change to set_typed_p2m_entry() may not be strictly
    necessary (due to the order restriction enforced near the top of the
    function), but is being kept here to be on the safe side.
    
    This is CVE-2021-28705 and CVE-2021-28709 / XSA-389.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 74a11c43fd7e074b1f77631b446dd2115eacb9e8
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m.c | 116 ++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 102 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 165efed3f2..ee0f2f6a09 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -780,6 +780,7 @@ p2m_remove_page(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
     unsigned long i;
     p2m_type_t t;
     p2m_access_t a;
+    int rc;
 
     /* IOMMU for PV guests is handled in get_page_type() and put_page(). */
     if ( !paging_mode_translate(p2m->domain) )
@@ -813,8 +814,27 @@ p2m_remove_page(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
         }
     }
 
-    return p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
-                         p2m->default_access);
+    rc = p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
+                       p2m->default_access);
+    if ( likely(!rc) || !mfn_valid(mfn) )
+        return rc;
+
+    /*
+     * The operation may have partially succeeded. For the failed part we need
+     * to undo the M2P update and, out of precaution, mark the pages dirty
+     * again.
+     */
+    for ( i = 0; i < (1UL << page_order); ++i )
+    {
+        p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0, NULL, NULL);
+        if ( !p2m_is_hole(t) && !p2m_is_special(t) && !p2m_is_shared(t) )
+        {
+            set_gpfn_from_mfn(mfn_x(mfn) + i, gfn_x(gfn) + i);
+            paging_mark_pfn_dirty(p2m->domain, _pfn(gfn_x(gfn) + i));
+        }
+    }
+
+    return rc;
 }
 
 int
@@ -1003,13 +1023,8 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
 
     /* Now, actually do the two-way mapping */
     rc = p2m_set_entry(p2m, gfn, mfn, page_order, t, p2m->default_access);
-    if ( rc == 0 )
+    if ( likely(!rc) )
     {
-        pod_lock(p2m);
-        p2m->pod.entry_count -= pod_count;
-        BUG_ON(p2m->pod.entry_count < 0);
-        pod_unlock(p2m);
-
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -1017,6 +1032,42 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                                   gfn_x(gfn_add(gfn, i)));
         }
     }
+    else
+    {
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update M2P and dirty state, while for the failed part we
+         * may need to adjust PoD stats as well as undo the earlier M2P update.
+         */
+        for ( i = 0; i < (1UL << page_order); ++i )
+        {
+            omfn = p2m->get_entry(p2m, gfn_add(gfn, i), &ot, &a, 0, NULL, NULL);
+            if ( p2m_is_pod(ot) )
+            {
+                BUG_ON(!pod_count);
+                --pod_count;
+            }
+            else if ( mfn_eq(omfn, mfn_add(mfn, i)) && ot == t &&
+                      a == p2m->default_access && !p2m_is_grant(t) )
+            {
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+                paging_mark_pfn_dirty(d, _pfn(gfn_x(gfn) + i));
+            }
+            else if ( p2m_is_ram(ot) && !p2m_is_paged(ot) )
+            {
+                ASSERT(mfn_valid(omfn));
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+            }
+        }
+    }
+
+    if ( pod_count )
+    {
+        pod_lock(p2m);
+        p2m->pod.entry_count -= pod_count;
+        BUG_ON(p2m->pod.entry_count < 0);
+        pod_unlock(p2m);
+    }
 
 out:
     p2m_unlock(p2m);
@@ -1308,6 +1359,49 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
             return 0;
         }
     }
+
+    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
+    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
+    if ( unlikely(rc) )
+    {
+        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
+                 gfn_l, order, rc, mfn_x(mfn));
+
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update PoD stats, M2P, and dirty state.
+         */
+        if ( order != PAGE_ORDER_4K )
+        {
+            unsigned long i;
+
+            for ( i = 0; i < (1UL << order); ++i )
+            {
+                p2m_type_t t;
+                mfn_t cmfn = p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0,
+                                            NULL, NULL);
+
+                if ( !mfn_eq(cmfn, mfn_add(mfn, i)) || t != gfn_p2mt ||
+                     a != access )
+                    continue;
+
+                if ( p2m_is_ram(ot) )
+                {
+                    ASSERT(mfn_valid(mfn_add(omfn, i)));
+                    set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
+                }
+#ifdef CONFIG_HVM
+                else if ( p2m_is_pod(ot) )
+                {
+                    pod_lock(p2m);
+                    BUG_ON(!p2m->pod.entry_count);
+                    --p2m->pod.entry_count;
+                    pod_unlock(p2m);
+                }
+#endif
+            }
+        }
+    }
     else if ( p2m_is_ram(ot) )
     {
         unsigned long i;
@@ -1318,12 +1412,6 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
             set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
         }
     }
-
-    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
-    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
-    if ( rc )
-        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
-                 gfn_l, order, rc, mfn_x(mfn));
 #ifdef CONFIG_HVM
     else if ( p2m_is_pod(ot) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Nov 25 22:44:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Nov 2021 22:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.232062.402023 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqNTG-0003Ky-Qp; Thu, 25 Nov 2021 22:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 232062.402023; Thu, 25 Nov 2021 22:44:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqNTG-0003Kq-Nt; Thu, 25 Nov 2021 22:44:02 +0000
Received: by outflank-mailman (input) for mailman id 232062;
 Thu, 25 Nov 2021 22: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 1mqNTG-0003Kk-Br
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 22: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 1mqNTG-0005h4-Az
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 22:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqNTG-00044Q-A0
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 22: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=3dQxIAWZcAR7pFgV8GTBH7Kx6tRFwRLnHjkrU/CQEIU=; b=5Brno6l2vvEYKsdtDijS+X81Kq
	pZI/YSu5RmEnRlmrRfcB1OXYbkpfzytcEdrSJlwBnE+2aT7+WU2sIBI4KiLYr2/8Qbedd8QlUTp3T
	GM8mraJHHt67mxvcFWwCS6vT9qB/6U6O8QqEqxjKDGMsod9+N4Z9ZAigYhGhEFHwLAII=;
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: Harden assign_pages()
Message-Id: <E1mqNTG-00044Q-A0@xenbits.xenproject.org>
Date: Thu, 25 Nov 2021 22:44:02 +0000

commit 8e657cfe0aec6c2bf548cae98a97d2485304d4c6
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Nov 23 13:35:03 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:35:03 2021 +0100

    xen/page_alloc: Harden assign_pages()
    
    domain_tot_pages() and d->max_pages are 32-bit values. While the order
    should always be quite small, it would still be possible to overflow
    if domain_tot_pages() is near to (2^32 - 1).
    
    As this code may be called by a guest via XENMEM_increase_reservation
    and XENMEM_populate_physmap, we want to make sure the guest is not going
    to be able to allocate more than it is allowed.
    
    Rework the allocation check to avoid any possible overflow. While the
    check domain_tot_pages() < d->max_pages should technically not be
    necessary, it is probably best to have it to catch any possible
    inconsistencies in the future.
    
    This is CVE-2021-28706 / part of XSA-385.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 143501861d48e1bfef495849fd68584baac05849
    master date: 2021-11-22 11:11:05 +0000
---
 xen/common/grant_table.c |  7 ++++---
 xen/common/page_alloc.c  | 19 ++++++++++++++-----
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 2bc00f30a3..ee5748e74e 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -2239,7 +2239,8 @@ gnttab_transfer(
          * pages when it is dying.
          */
         if ( unlikely(e->is_dying) ||
-             unlikely(e->tot_pages >= e->max_pages) )
+             unlikely(e->tot_pages >= e->max_pages) ||
+             unlikely(!(e->tot_pages + 1)) )
         {
             spin_unlock(&e->page_alloc_lock);
 
@@ -2248,8 +2249,8 @@ gnttab_transfer(
                          e->domain_id);
             else
                 gdprintk(XENLOG_INFO,
-                         "Transferee d%d has no headroom (tot %u, max %u)\n",
-                         e->domain_id, e->tot_pages, e->max_pages);
+                         "Transferee %pd has no headroom (tot %u, max %u)\n",
+                         e, e->tot_pages, e->max_pages);
 
             gop.status = GNTST_general_error;
             goto unlock_and_copyback;
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 1dee9a05d4..3ab90aca32 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2278,17 +2278,26 @@ int assign_pages(
 
     if ( !(memflags & MEMF_no_refcount) )
     {
-        if ( unlikely((d->tot_pages + (1 << order)) > d->max_pages) )
+        unsigned int nr = 1u << order;
+
+        if ( unlikely(d->tot_pages > d->max_pages) )
+        {
+            gprintk(XENLOG_INFO, "Inconsistent allocation for %pd: %u > %u\n",
+                    d, d->tot_pages, d->max_pages);
+            rc = -EPERM;
+            goto out;
+        }
+
+        if ( unlikely(nr > d->max_pages - d->tot_pages) )
         {
             if ( !tmem_enabled() || order != 0 || d->tot_pages != d->max_pages )
-                gprintk(XENLOG_INFO, "Over-allocation for domain %u: "
-                        "%u > %u\n", d->domain_id,
-                        d->tot_pages + (1 << order), d->max_pages);
+                gprintk(XENLOG_INFO, "Over-allocation for %pd: %Lu > %u\n",
+                        d, d->tot_pages + 0ull + nr, d->max_pages);
             rc = -E2BIG;
             goto out;
         }
 
-        if ( unlikely(domain_adjust_tot_pages(d, 1 << order) == (1 << order)) )
+        if ( unlikely(domain_adjust_tot_pages(d, nr) == nr) )
             get_knownalive_domain(d);
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Thu Nov 25 22:44:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Nov 2021 22:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.232063.402027 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqNTR-0003Nc-Tv; Thu, 25 Nov 2021 22:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 232063.402027; Thu, 25 Nov 2021 22:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqNTR-0003NS-Qw; Thu, 25 Nov 2021 22:44:13 +0000
Received: by outflank-mailman (input) for mailman id 232063;
 Thu, 25 Nov 2021 22:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqNTQ-0003ND-FH
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 22: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 1mqNTQ-0005h9-ET
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 22:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqNTQ-00045D-DQ
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 22: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=JVO2SyCCVHlGGU8kaRGrnZne20EOD/DKzQGqrbFYUTk=; b=I9U+v/Xl6GqMRaq8QRRT8ZyCjY
	D/eJZxE0SLOzaAxQ+/XtWNyaq8iPhm+JB8Ohh3no4OCNgJytXAU/wH++XyZ6+K+91SR50GE3SJdoP
	mam0GMZs0m9nB2rJmDdapcJW/QCm/Q0Ss1xmv+hN6VbPqRV2BX0WHvafE1MgAzeBhhRU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] x86/PoD: deal with misaligned GFNs
Message-Id: <E1mqNTQ-00045D-DQ@xenbits.xenproject.org>
Date: Thu, 25 Nov 2021 22:44:12 +0000

commit 398f7aec5dab6ad0853a8b069b48ae304e059fa4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:35:36 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:35:36 2021 +0100

    x86/PoD: deal with misaligned GFNs
    
    Users of XENMEM_decrease_reservation and XENMEM_populate_physmap aren't
    required to pass in order-aligned GFN values. (While I consider this
    bogus, I don't think we can fix this there, as that might break existing
    code, e.g Linux'es swiotlb, which - while affecting PV only - until
    recently had been enforcing only page alignment on the original
    allocation.) Only non-PoD code paths (guest_physmap_{add,remove}_page(),
    p2m_set_entry()) look to be dealing with this properly (in part by being
    implemented inefficiently, handling every 4k page separately).
    
    Introduce wrappers taking care of splitting the incoming request into
    aligned chunks, without putting much effort in trying to determine the
    largest possible chunk at every iteration.
    
    Also "handle" p2m_set_entry() failure for non-order-0 requests by
    crashing the domain in one more place. Alongside putting a log message
    there, also add one to the other similar path.
    
    Note regarding locking: This is left in the actual worker functions on
    the assumption that callers aren't guaranteed atomicity wrt acting on
    multiple pages at a time. For mis-aligned GFNs gfn_lock() wouldn't have
    locked the correct GFN range anyway, if it didn't simply resolve to
    p2m_lock(), and for well-behaved callers there continues to be only a
    single iteration, i.e. behavior is unchanged for them. (FTAOD pulling
    out just pod_lock() into p2m_pod_decrease_reservation() would result in
    a lock order violation.)
    
    This is CVE-2021-28704 and CVE-2021-28707 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 182c737b9ba540ebceb1433f3940fbed6eac4ea9
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m-pod.c | 75 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 63 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index f4e5a35578..6e3d474b80 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -497,7 +497,7 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn);
 
 
 /*
- * This function is needed for two reasons:
+ * This pair of functions is needed for two reasons:
  * + To properly handle clearing of PoD entries
  * + To "steal back" memory being freed for the PoD cache, rather than
  *   releasing it.
@@ -505,8 +505,8 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn);
  * Once both of these functions have been completed, we can return and
  * allow decrease_reservation() to handle everything else.
  */
-unsigned long
-p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+static unsigned long
+decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
 {
     unsigned long ret = 0, i, n;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -559,8 +559,10 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
          * All PoD: Mark the whole region invalid and tell caller
          * we're done.
          */
-        if ( p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
-                           p2m->default_access) )
+        int rc = p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
+                               p2m->default_access);
+
+        if ( rc )
         {
             /*
              * If this fails, we can't tell how much of the range was changed.
@@ -568,7 +570,12 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
              * impossible.
              */
             if ( order != 0 )
+            {
+                printk(XENLOG_G_ERR
+                       "%pd: marking GFN %#lx (order %u) as non-PoD failed: %d\n",
+                       d, gfn_x(gfn), order, rc);
                 domain_crash(d);
+            }
             goto out_unlock;
         }
         ret = 1UL << order;
@@ -676,6 +683,22 @@ out_unlock:
     return ret;
 }
 
+unsigned long
+p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+{
+    unsigned long left = 1UL << order, ret = 0;
+    unsigned int chunk_order = find_first_set_bit(gfn_x(gfn) | left);
+
+    do {
+        ret += decrease_reservation(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn = gfn_add(gfn, 1UL << chunk_order);
+    } while ( left );
+
+    return ret;
+}
+
 void p2m_pod_dump_data(struct domain *d)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -1271,19 +1294,15 @@ remap_and_retry:
     return true;
 }
 
-
-int
-guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
-                                      unsigned int order)
+static int
+mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
+                        unsigned int order)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     gfn_t gfn = _gfn(gfn_l);
     unsigned long i, n, pod_count = 0;
     int rc = 0;
 
-    if ( !paging_mode_translate(d) )
-        return -EINVAL;
-
     gfn_lock(p2m, gfn, order);
 
     P2M_DEBUG("mark pod gfn=%#lx\n", gfn_l);
@@ -1321,6 +1340,17 @@ guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
         BUG_ON(p2m->pod.entry_count < 0);
         pod_unlock(p2m);
     }
+    else if ( order )
+    {
+        /*
+         * If this failed, we can't tell how much of the range was changed.
+         * Best to crash the domain.
+         */
+        printk(XENLOG_G_ERR
+               "%pd: marking GFN %#lx (order %u) as PoD failed: %d\n",
+               d, gfn_l, order, rc);
+        domain_crash(d);
+    }
 
 out:
     gfn_unlock(p2m, gfn, order);
@@ -1328,6 +1358,27 @@ out:
     return rc;
 }
 
+int
+guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
+                                      unsigned int order)
+{
+    unsigned long left = 1UL << order;
+    unsigned int chunk_order = find_first_set_bit(gfn | left);
+    int rc;
+
+    if ( !paging_mode_translate(d) )
+        return -EINVAL;
+
+    do {
+        rc = mark_populate_on_demand(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn += 1UL << chunk_order;
+    } while ( !rc && left );
+
+    return rc;
+}
+
 void p2m_pod_init(struct p2m_domain *p2m)
 {
     unsigned int i;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Thu Nov 25 22:44:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Nov 2021 22:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.232064.402031 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqNTb-0003Qx-VP; Thu, 25 Nov 2021 22:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 232064.402031; Thu, 25 Nov 2021 22: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 1mqNTb-0003Qp-SU; Thu, 25 Nov 2021 22:44:23 +0000
Received: by outflank-mailman (input) for mailman id 232064;
 Thu, 25 Nov 2021 22: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 1mqNTa-0003QT-IP
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 22: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 1mqNTa-0005hg-Hf
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 22:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqNTa-00045x-Gf
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 22: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=kZEzNCqnKJOPer3PaOfFqhfoAIeAdFPlc2EbFjmDkKg=; b=Z3zAU6zsRWaRPuY76zVD7Q78Kl
	W1Xus6hXGdTJTN/fp62LiZjJAAwOUW8eYC7+XtLbtfwTx/rNYQfpoxJ7chcBikM3bbEYa8p/xE6Z3
	MN8alUmkR6Mz55mHYxw+h5aaak8GEnep5daZE0CtentxqsEkQKRng0heOx2Ts0o4ATO0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
Message-Id: <E1mqNTa-00045x-Gf@xenbits.xenproject.org>
Date: Thu, 25 Nov 2021 22:44:22 +0000

commit 1a2e8d6cccddf984fce09b7b8b1139d81cea421e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:35:55 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:35:55 2021 +0100

    x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
    
    p2m_pod_decrease_reservation() may pass pages to the function which
    aren't 4k, 2M, or 1G. Handle all intermediate orders as well, to avoid
    hitting the BUG() at the switch() statement's "default" case.
    
    This is CVE-2021-28708 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 8ec13f68e0b026863d23e7f44f252d06478bc809
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m-pod.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index 6e3d474b80..f075ad692f 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -111,15 +111,13 @@ p2m_pod_cache_add(struct p2m_domain *p2m,
     /* Then add to the appropriate populate-on-demand list. */
     switch ( order )
     {
-    case PAGE_ORDER_1G:
-        for ( i = 0; i < (1UL << PAGE_ORDER_1G); i += 1UL << PAGE_ORDER_2M )
+    case PAGE_ORDER_2M ... PAGE_ORDER_1G:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_2M )
             page_list_add_tail(page + i, &p2m->pod.super);
         break;
-    case PAGE_ORDER_2M:
-        page_list_add_tail(page, &p2m->pod.super);
-        break;
-    case PAGE_ORDER_4K:
-        page_list_add_tail(page, &p2m->pod.single);
+    case PAGE_ORDER_4K ... PAGE_ORDER_2M - 1:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_4K )
+            page_list_add_tail(page + i, &p2m->pod.single);
         break;
     default:
         BUG();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Thu Nov 25 22:44:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 25 Nov 2021 22:44:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.232065.402035 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqNTm-0003Tq-10; Thu, 25 Nov 2021 22:44:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 232065.402035; Thu, 25 Nov 2021 22: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 1mqNTl-0003Ti-U0; Thu, 25 Nov 2021 22:44:33 +0000
Received: by outflank-mailman (input) for mailman id 232065;
 Thu, 25 Nov 2021 22: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 1mqNTk-0003TT-LZ
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 22: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 1mqNTk-0005hr-Ku
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 22:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqNTk-00046d-Jq
 for xen-changelog@lists.xenproject.org; Thu, 25 Nov 2021 22: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=+EQhhoxYxsD6x8CxukHgdoO3t+p9tldK6Ei9SrMe1Cg=; b=Mp4eMrV0AsiO7aCpTUwiJPW3ZP
	x78U28VOoVw+3F718RF4zGUcGr4bahMALBfpmbQYudzr4kne6jMQo6QOGEiWmT7ls9rrZzE+rTnc+
	Vd2oirD7CYdHQ8gIJYjKHIdO6lI+xz1TJjmRqhhVnvQfqVK1hL6mKWhbq9cIcQB6DpLM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.12] x86/P2M: deal with partial success of p2m_set_entry()
Message-Id: <E1mqNTk-00046d-Jq@xenbits.xenproject.org>
Date: Thu, 25 Nov 2021 22:44:32 +0000

commit 1442eb9ac448ca43c58bd65dbd82dca0c412c143
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:36:28 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:36:28 2021 +0100

    x86/P2M: deal with partial success of p2m_set_entry()
    
    M2P and PoD stats need to remain in sync with P2M; if an update succeeds
    only partially, respective adjustments need to be made. If updates get
    made before the call, they may also need undoing upon complete failure
    (i.e. including the single-page case).
    
    Log-dirty state would better also be kept in sync.
    
    Note that the change to set_typed_p2m_entry() may not be strictly
    necessary (due to the order restriction enforced near the top of the
    function), but is being kept here to be on the safe side.
    
    This is CVE-2021-28705 and CVE-2021-28709 / XSA-389.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 74a11c43fd7e074b1f77631b446dd2115eacb9e8
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m.c | 120 +++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 104 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index f3fdc79ff4..266b6a0416 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -780,6 +780,7 @@ p2m_remove_page(struct p2m_domain *p2m, unsigned long gfn_l, unsigned long mfn,
     gfn_t gfn = _gfn(gfn_l);
     p2m_type_t t;
     p2m_access_t a;
+    int rc;
 
     /* IOMMU for PV guests is handled in get_page_type() and put_page(). */
     if ( !paging_mode_translate(p2m->domain) )
@@ -811,8 +812,27 @@ p2m_remove_page(struct p2m_domain *p2m, unsigned long gfn_l, unsigned long mfn,
                 set_gpfn_from_mfn(mfn+i, INVALID_M2P_ENTRY);
         }
     }
-    return p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
-                         p2m->default_access);
+    rc = p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
+                       p2m->default_access);
+    if ( likely(!rc) || !mfn_valid(_mfn(mfn)) )
+        return rc;
+
+    /*
+     * The operation may have partially succeeded. For the failed part we need
+     * to undo the M2P update and, out of precaution, mark the pages dirty
+     * again.
+     */
+    for ( i = 0; i < (1UL << page_order); ++i )
+    {
+        p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0, NULL, NULL);
+        if ( !p2m_is_hole(t) && !p2m_is_special(t) && !p2m_is_shared(t) )
+        {
+            set_gpfn_from_mfn(mfn + i, gfn_l + i);
+            paging_mark_pfn_dirty(p2m->domain, _pfn(gfn_l + i));
+        }
+    }
+
+    return rc;
 }
 
 int
@@ -980,15 +1000,8 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
 
     /* Now, actually do the two-way mapping */
     rc = p2m_set_entry(p2m, gfn, mfn, page_order, t, p2m->default_access);
-    if ( rc == 0 )
+    if ( likely(!rc) )
     {
-#ifdef CONFIG_HVM
-        pod_lock(p2m);
-        p2m->pod.entry_count -= pod_count;
-        BUG_ON(p2m->pod.entry_count < 0);
-        pod_unlock(p2m);
-#endif
-
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -996,6 +1009,44 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                                   gfn_x(gfn_add(gfn, i)));
         }
     }
+    else
+    {
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update M2P and dirty state, while for the failed part we
+         * may need to adjust PoD stats as well as undo the earlier M2P update.
+         */
+        for ( i = 0; i < (1UL << page_order); ++i )
+        {
+            omfn = p2m->get_entry(p2m, gfn_add(gfn, i), &ot, &a, 0, NULL, NULL);
+            if ( p2m_is_pod(ot) )
+            {
+                BUG_ON(!pod_count);
+                --pod_count;
+            }
+            else if ( mfn_eq(omfn, mfn_add(mfn, i)) && ot == t &&
+                      a == p2m->default_access && !p2m_is_grant(t) )
+            {
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+                paging_mark_pfn_dirty(d, _pfn(gfn_x(gfn) + i));
+            }
+            else if ( p2m_is_ram(ot) && !p2m_is_paged(ot) )
+            {
+                ASSERT(mfn_valid(omfn));
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+            }
+        }
+    }
+
+#ifdef CONFIG_HVM
+    if ( pod_count )
+    {
+        pod_lock(p2m);
+        p2m->pod.entry_count -= pod_count;
+        BUG_ON(p2m->pod.entry_count < 0);
+        pod_unlock(p2m);
+    }
+#endif
 
  out:
     p2m_unlock(p2m);
@@ -1278,6 +1329,49 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
         domain_crash(d);
         return -EPERM;
     }
+
+    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
+    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
+    if ( unlikely(rc) )
+    {
+        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
+                 gfn_l, order, rc, mfn_x(mfn));
+
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update PoD stats, M2P, and dirty state.
+         */
+        if ( order != PAGE_ORDER_4K )
+        {
+            unsigned long i;
+
+            for ( i = 0; i < (1UL << order); ++i )
+            {
+                p2m_type_t t;
+                mfn_t cmfn = p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0,
+                                            NULL, NULL);
+
+                if ( !mfn_eq(cmfn, mfn_add(mfn, i)) || t != gfn_p2mt ||
+                     a != access )
+                    continue;
+
+                if ( p2m_is_ram(ot) )
+                {
+                    ASSERT(mfn_valid(mfn_add(omfn, i)));
+                    set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
+                }
+#ifdef CONFIG_HVM
+                else if ( p2m_is_pod(ot) )
+                {
+                    pod_lock(p2m);
+                    BUG_ON(!p2m->pod.entry_count);
+                    --p2m->pod.entry_count;
+                    pod_unlock(p2m);
+                }
+#endif
+            }
+        }
+    }
     else if ( p2m_is_ram(ot) )
     {
         unsigned long i;
@@ -1288,12 +1382,6 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
             set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
         }
     }
-
-    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
-    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
-    if ( rc )
-        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
-                 gfn_l, order, rc, mfn_x(mfn));
 #ifdef CONFIG_HVM
     else if ( p2m_is_pod(ot) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Fri Nov 26 10:55:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Nov 2021 10:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.232530.403188 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqYsr-000438-NL; Fri, 26 Nov 2021 10:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 232530.403188; Fri, 26 Nov 2021 10: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 1mqYsr-000430-KI; Fri, 26 Nov 2021 10:55:13 +0000
Received: by outflank-mailman (input) for mailman id 232530;
 Fri, 26 Nov 2021 10:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYsq-00042s-Mv
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYsq-0004sG-MF
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYsq-0001Ot-L8
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10: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=g01u9ZgNYJuf0+RtsZT5hGgmxra1LiGFOZr69TiHAV0=; b=fQIqTQnnksQIqGY7FRuS86N1Oj
	/k+2qdAPrfRyla3O/JxTM1ISDx5SXn0qzJlg60XxZIV18Ntzpfts1OEa0o3IY83MF02iOlT2BZJjw
	tjdKG7ZpA8lqNAU9ep+gaS4TzW7vcBW1k3iMALDa90Ud1lFNR7V7i+dde55YiAx/U9I4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/PoD: deal with misaligned GFNs
Message-Id: <E1mqYsq-0001Ot-L8@xenbits.xenproject.org>
Date: Fri, 26 Nov 2021 10:55:12 +0000

commit 182c737b9ba540ebceb1433f3940fbed6eac4ea9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Nov 22 11:11:44 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 22 12:27:30 2021 +0000

    x86/PoD: deal with misaligned GFNs
    
    Users of XENMEM_decrease_reservation and XENMEM_populate_physmap aren't
    required to pass in order-aligned GFN values. (While I consider this
    bogus, I don't think we can fix this there, as that might break existing
    code, e.g Linux'es swiotlb, which - while affecting PV only - until
    recently had been enforcing only page alignment on the original
    allocation.) Only non-PoD code paths (guest_physmap_{add,remove}_page(),
    p2m_set_entry()) look to be dealing with this properly (in part by being
    implemented inefficiently, handling every 4k page separately).
    
    Introduce wrappers taking care of splitting the incoming request into
    aligned chunks, without putting much effort in trying to determine the
    largest possible chunk at every iteration.
    
    Also "handle" p2m_set_entry() failure for non-order-0 requests by
    crashing the domain in one more place. Alongside putting a log message
    there, also add one to the other similar path.
    
    Note regarding locking: This is left in the actual worker functions on
    the assumption that callers aren't guaranteed atomicity wrt acting on
    multiple pages at a time. For mis-aligned GFNs gfn_lock() wouldn't have
    locked the correct GFN range anyway, if it didn't simply resolve to
    p2m_lock(), and for well-behaved callers there continues to be only a
    single iteration, i.e. behavior is unchanged for them. (FTAOD pulling
    out just pod_lock() into p2m_pod_decrease_reservation() would result in
    a lock order violation.)
    
    This is CVE-2021-28704 and CVE-2021-28707 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m-pod.c | 75 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 63 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index d0134755e5..20e6327b75 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -504,7 +504,7 @@ static void pod_unlock_and_flush(struct p2m_domain *p2m)
 }
 
 /*
- * This function is needed for two reasons:
+ * This pair of functions is needed for two reasons:
  * + To properly handle clearing of PoD entries
  * + To "steal back" memory being freed for the PoD cache, rather than
  *   releasing it.
@@ -512,8 +512,8 @@ static void pod_unlock_and_flush(struct p2m_domain *p2m)
  * Once both of these functions have been completed, we can return and
  * allow decrease_reservation() to handle everything else.
  */
-unsigned long
-p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+static unsigned long
+decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
 {
     unsigned long ret = 0, i, n;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -561,8 +561,10 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
          * All PoD: Mark the whole region invalid and tell caller
          * we're done.
          */
-        if ( p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
-                           p2m->default_access) )
+        int rc = p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
+                               p2m->default_access);
+
+        if ( rc )
         {
             /*
              * If this fails, we can't tell how much of the range was changed.
@@ -570,7 +572,12 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
              * impossible.
              */
             if ( order != 0 )
+            {
+                printk(XENLOG_G_ERR
+                       "%pd: marking GFN %#lx (order %u) as non-PoD failed: %d\n",
+                       d, gfn_x(gfn), order, rc);
                 domain_crash(d);
+            }
             goto out_unlock;
         }
         ret = 1UL << order;
@@ -679,6 +686,22 @@ out_unlock:
     return ret;
 }
 
+unsigned long
+p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+{
+    unsigned long left = 1UL << order, ret = 0;
+    unsigned int chunk_order = find_first_set_bit(gfn_x(gfn) | left);
+
+    do {
+        ret += decrease_reservation(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn = gfn_add(gfn, 1UL << chunk_order);
+    } while ( left );
+
+    return ret;
+}
+
 void p2m_pod_dump_data(struct domain *d)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -1289,19 +1312,15 @@ remap_and_retry:
     return true;
 }
 
-
-int
-guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
-                                      unsigned int order)
+static int
+mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
+                        unsigned int order)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     gfn_t gfn = _gfn(gfn_l);
     unsigned long i, n, pod_count = 0;
     int rc = 0;
 
-    if ( !paging_mode_translate(d) )
-        return -EINVAL;
-
     gfn_lock(p2m, gfn, order);
 
     P2M_DEBUG("mark pod gfn=%#lx\n", gfn_l);
@@ -1341,6 +1360,17 @@ guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
 
         ioreq_request_mapcache_invalidate(d);
     }
+    else if ( order )
+    {
+        /*
+         * If this failed, we can't tell how much of the range was changed.
+         * Best to crash the domain.
+         */
+        printk(XENLOG_G_ERR
+               "%pd: marking GFN %#lx (order %u) as PoD failed: %d\n",
+               d, gfn_l, order, rc);
+        domain_crash(d);
+    }
 
 out:
     gfn_unlock(p2m, gfn, order);
@@ -1348,6 +1378,27 @@ out:
     return rc;
 }
 
+int
+guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
+                                      unsigned int order)
+{
+    unsigned long left = 1UL << order;
+    unsigned int chunk_order = find_first_set_bit(gfn | left);
+    int rc;
+
+    if ( !paging_mode_translate(d) )
+        return -EINVAL;
+
+    do {
+        rc = mark_populate_on_demand(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn += 1UL << chunk_order;
+    } while ( !rc && left );
+
+    return rc;
+}
+
 void p2m_pod_init(struct p2m_domain *p2m)
 {
     unsigned int i;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Nov 26 10:55:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Nov 2021 10:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.232529.403185 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqYsh-00041B-Lo; Fri, 26 Nov 2021 10:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 232529.403185; Fri, 26 Nov 2021 10: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 1mqYsh-000413-Im; Fri, 26 Nov 2021 10:55:03 +0000
Received: by outflank-mailman (input) for mailman id 232529;
 Fri, 26 Nov 2021 10:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYsg-00040x-Je
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYsg-0004sC-Ip
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYsg-0001OI-Ho
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10: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=2zCK2kaQA6fyGDDQG+5yB3HdqDzWcqBQbQ0YbD4Bh3c=; b=coYuYVwKaqpFBmMF3pqIqIp+NZ
	67SCpUPXvFHwJfaCCTVa0I9A15hyJqoptB4dCIHX+D+lZz9nVwhMWAztmQbDXYqRD8WL2XGWUlrUf
	vspGgWcHTr+uZ5ETBs29GqJqIG+44UCq9dJgZRsFH/R3Uyu0xarmmZJaTiOqY9qc1ye0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] xen/page_alloc: Harden assign_pages()
Message-Id: <E1mqYsg-0001OI-Ho@xenbits.xenproject.org>
Date: Fri, 26 Nov 2021 10:55:02 +0000

commit 143501861d48e1bfef495849fd68584baac05849
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Nov 22 11:11:05 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 22 11:11:05 2021 +0000

    xen/page_alloc: Harden assign_pages()
    
    domain_tot_pages() and d->max_pages are 32-bit values. While the order
    should always be quite small, it would still be possible to overflow
    if domain_tot_pages() is near to (2^32 - 1).
    
    As this code may be called by a guest via XENMEM_increase_reservation
    and XENMEM_populate_physmap, we want to make sure the guest is not going
    to be able to allocate more than it is allowed.
    
    Rework the allocation check to avoid any possible overflow. While the
    check domain_tot_pages() < d->max_pages should technically not be
    necessary, it is probably best to have it to catch any possible
    inconsistencies in the future.
    
    This is CVE-2021-28706 / part of XSA-385.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/common/grant_table.c |  7 ++++---
 xen/common/page_alloc.c  | 33 +++++++++++++++++++++++++++------
 2 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 8b322b51c0..012a74455b 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -2341,7 +2341,8 @@ gnttab_transfer(
          * pages when it is dying.
          */
         if ( unlikely(e->is_dying) ||
-             unlikely(domain_tot_pages(e) >= e->max_pages) )
+             unlikely(domain_tot_pages(e) >= e->max_pages) ||
+             unlikely(!(e->tot_pages + 1)) )
         {
             spin_unlock(&e->page_alloc_lock);
 
@@ -2350,8 +2351,8 @@ gnttab_transfer(
                          e->domain_id);
             else
                 gdprintk(XENLOG_INFO,
-                         "Transferee d%d has no headroom (tot %u, max %u)\n",
-                         e->domain_id, domain_tot_pages(e), e->max_pages);
+                         "Transferee %pd has no headroom (tot %u, max %u, ex %u)\n",
+                         e, domain_tot_pages(e), e->max_pages, e->extra_pages);
 
             gop.status = GNTST_general_error;
             goto unlock_and_copyback;
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 5801358b4b..d0baaa2ecd 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2310,20 +2310,41 @@ int assign_pages(
     }
     else if ( !(memflags & MEMF_no_refcount) )
     {
-        unsigned int tot_pages = domain_tot_pages(d) + nr;
+        unsigned int tot_pages = domain_tot_pages(d);
 
         if ( unlikely(tot_pages > d->max_pages) )
         {
-            gprintk(XENLOG_INFO, "Over-allocation for domain %u: "
-                    "%u > %u\n", d->domain_id, tot_pages, d->max_pages);
+            gprintk(XENLOG_INFO, "Inconsistent allocation for %pd: %u > %u\n",
+                    d, tot_pages, d->max_pages);
+            rc = -EPERM;
+            goto out;
+        }
+
+        if ( unlikely(nr > d->max_pages - tot_pages) )
+        {
+            gprintk(XENLOG_INFO, "Over-allocation for %pd: %Lu > %u\n",
+                    d, tot_pages + 0ull + nr, d->max_pages);
             rc = -E2BIG;
             goto out;
         }
     }
 
-    if ( !(memflags & MEMF_no_refcount) &&
-         unlikely(domain_adjust_tot_pages(d, nr) == nr) )
-        get_knownalive_domain(d);
+    if ( !(memflags & MEMF_no_refcount) )
+    {
+        if ( unlikely(d->tot_pages + nr < nr) )
+        {
+            gprintk(XENLOG_INFO,
+                    "Excess allocation for %pd: %Lu (%u extra)\n",
+                    d, d->tot_pages + 0ull + nr, d->extra_pages);
+            if ( pg[0].count_info & PGC_extra )
+                d->extra_pages -= nr;
+            rc = -E2BIG;
+            goto out;
+        }
+
+        if ( unlikely(domain_adjust_tot_pages(d, nr) == nr) )
+            get_knownalive_domain(d);
+    }
 
     for ( i = 0; i < nr; i++ )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Nov 26 10:55:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Nov 2021 10:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.232531.403193 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqYt1-00047p-Qs; Fri, 26 Nov 2021 10:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 232531.403193; Fri, 26 Nov 2021 10:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqYt1-00047h-Nl; Fri, 26 Nov 2021 10:55:23 +0000
Received: by outflank-mailman (input) for mailman id 232531;
 Fri, 26 Nov 2021 10:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYt0-00047U-QT
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYt0-0004sY-Pf
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYt0-0001Pa-OZ
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ufuqKBa9Vp2q9NozdaIMBNBb+RP2XC7t9lIjgoA3CDI=; b=Ir4ngMu+iQ6ySJMFIbz7pbCqKc
	5cvsijsLKfeUj0Uro7yfW9T0mxlGYFS+qxDzpFBupmHFX5UfmDME0G/ePcgDBf12RPDCWei5Qb5bf
	wEqUBdxfxckJ1MjbahOHIKpbFCW/WSr0KDgWMX58uvOWqY9hv3kxsLvURIE8ruptE5AE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
Message-Id: <E1mqYt0-0001Pa-OZ@xenbits.xenproject.org>
Date: Fri, 26 Nov 2021 10:55:22 +0000

commit 8ec13f68e0b026863d23e7f44f252d06478bc809
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Nov 22 11:11:44 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 22 12:27:30 2021 +0000

    x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
    
    p2m_pod_decrease_reservation() may pass pages to the function which
    aren't 4k, 2M, or 1G. Handle all intermediate orders as well, to avoid
    hitting the BUG() at the switch() statement's "default" case.
    
    This is CVE-2021-28708 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m-pod.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index 20e6327b75..d8d1a0ce7e 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -113,15 +113,13 @@ p2m_pod_cache_add(struct p2m_domain *p2m,
     /* Then add to the appropriate populate-on-demand list. */
     switch ( order )
     {
-    case PAGE_ORDER_1G:
-        for ( i = 0; i < (1UL << PAGE_ORDER_1G); i += 1UL << PAGE_ORDER_2M )
+    case PAGE_ORDER_2M ... PAGE_ORDER_1G:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_2M )
             page_list_add_tail(page + i, &p2m->pod.super);
         break;
-    case PAGE_ORDER_2M:
-        page_list_add_tail(page, &p2m->pod.super);
-        break;
-    case PAGE_ORDER_4K:
-        page_list_add_tail(page, &p2m->pod.single);
+    case PAGE_ORDER_4K ... PAGE_ORDER_2M - 1:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_4K )
+            page_list_add_tail(page + i, &p2m->pod.single);
         break;
     default:
         BUG();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Nov 26 10:55:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Nov 2021 10:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.232532.403197 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqYtC-0004Ai-ST; Fri, 26 Nov 2021 10:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 232532.403197; Fri, 26 Nov 2021 10:55:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqYtC-0004Aa-PK; Fri, 26 Nov 2021 10:55:34 +0000
Received: by outflank-mailman (input) for mailman id 232532;
 Fri, 26 Nov 2021 10:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYtA-0004AO-Tf
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYtA-0004t4-Sv
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYtA-0001QL-Ry
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1OIzePNzF7Vfiw+O+gW5StrfH0Uwud/GO6grhpfBbZ0=; b=PyJ7gYKOKDGCDmrx5UJiei6n36
	N1UTQB5J5bEJuX7PWO4ohzkyXm4Mx9VpQQtBytrrkVdD2jMeC8Wqts9P07xWHR3DLWIqOZUqSFRLu
	pehUSLs6IGLr2UvEWJH3Sk9exc/o/4uUHrCs1Qx26IzZCDj0fvXVVidv0Z1fidH5MVEY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/P2M: deal with partial success of p2m_set_entry()
Message-Id: <E1mqYtA-0001QL-Ry@xenbits.xenproject.org>
Date: Fri, 26 Nov 2021 10:55:32 +0000

commit 74a11c43fd7e074b1f77631b446dd2115eacb9e8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Nov 22 11:12:32 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 22 12:27:30 2021 +0000

    x86/P2M: deal with partial success of p2m_set_entry()
    
    M2P and PoD stats need to remain in sync with P2M; if an update succeeds
    only partially, respective adjustments need to be made. If updates get
    made before the call, they may also need undoing upon complete failure
    (i.e. including the single-page case).
    
    Log-dirty state would better also be kept in sync.
    
    Note that the change to set_typed_p2m_entry() may not be strictly
    necessary (due to the order restriction enforced near the top of the
    function), but is being kept here to be on the safe side.
    
    This is CVE-2021-28705 and CVE-2021-28709 / XSA-389.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c | 116 ++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 102 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 2bd4d37286..def1695cf0 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -794,6 +794,7 @@ p2m_remove_page(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
     unsigned long i;
     p2m_type_t t;
     p2m_access_t a;
+    int rc;
 
     ASSERT(gfn_locked_by_me(p2m, gfn));
     P2M_DEBUG("removing gfn=%#lx mfn=%#lx\n", gfn_x(gfn), mfn_x(mfn));
@@ -825,8 +826,27 @@ 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);
+    rc = p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
+                       p2m->default_access);
+    if ( likely(!rc) || !mfn_valid(mfn) )
+        return rc;
+
+    /*
+     * The operation may have partially succeeded. For the failed part we need
+     * to undo the M2P update and, out of precaution, mark the pages dirty
+     * again.
+     */
+    for ( i = 0; i < (1UL << page_order); ++i )
+    {
+        p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0, NULL, NULL);
+        if ( !p2m_is_hole(t) && !p2m_is_special(t) && !p2m_is_shared(t) )
+        {
+            set_gpfn_from_mfn(mfn_x(mfn) + i, gfn_x(gfn) + i);
+            paging_mark_pfn_dirty(p2m->domain, _pfn(gfn_x(gfn) + i));
+        }
+    }
+
+    return rc;
 }
 
 int
@@ -1022,13 +1042,8 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
 
     /* Now, actually do the two-way mapping */
     rc = p2m_set_entry(p2m, gfn, mfn, page_order, t, p2m->default_access);
-    if ( rc == 0 )
+    if ( likely(!rc) )
     {
-        pod_lock(p2m);
-        p2m->pod.entry_count -= pod_count;
-        BUG_ON(p2m->pod.entry_count < 0);
-        pod_unlock(p2m);
-
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -1036,6 +1051,42 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                                   gfn_x(gfn_add(gfn, i)));
         }
     }
+    else
+    {
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update M2P and dirty state, while for the failed part we
+         * may need to adjust PoD stats as well as undo the earlier M2P update.
+         */
+        for ( i = 0; i < (1UL << page_order); ++i )
+        {
+            omfn = p2m->get_entry(p2m, gfn_add(gfn, i), &ot, &a, 0, NULL, NULL);
+            if ( p2m_is_pod(ot) )
+            {
+                BUG_ON(!pod_count);
+                --pod_count;
+            }
+            else if ( mfn_eq(omfn, mfn_add(mfn, i)) && ot == t &&
+                      a == p2m->default_access && !p2m_is_grant(t) )
+            {
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+                paging_mark_pfn_dirty(d, _pfn(gfn_x(gfn) + i));
+            }
+            else if ( p2m_is_ram(ot) && !p2m_is_paged(ot) )
+            {
+                ASSERT(mfn_valid(omfn));
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+            }
+        }
+    }
+
+    if ( pod_count )
+    {
+        pod_lock(p2m);
+        p2m->pod.entry_count -= pod_count;
+        BUG_ON(p2m->pod.entry_count < 0);
+        pod_unlock(p2m);
+    }
 
 out:
     p2m_unlock(p2m);
@@ -1325,6 +1376,49 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
             return 0;
         }
     }
+
+    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
+    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
+    if ( unlikely(rc) )
+    {
+        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
+                 gfn_l, order, rc, mfn_x(mfn));
+
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update PoD stats, M2P, and dirty state.
+         */
+        if ( order != PAGE_ORDER_4K )
+        {
+            unsigned long i;
+
+            for ( i = 0; i < (1UL << order); ++i )
+            {
+                p2m_type_t t;
+                mfn_t cmfn = p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0,
+                                            NULL, NULL);
+
+                if ( !mfn_eq(cmfn, mfn_add(mfn, i)) || t != gfn_p2mt ||
+                     a != access )
+                    continue;
+
+                if ( p2m_is_ram(ot) )
+                {
+                    ASSERT(mfn_valid(mfn_add(omfn, i)));
+                    set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
+
+                    ioreq_request_mapcache_invalidate(d);
+                }
+                else if ( p2m_is_pod(ot) )
+                {
+                    pod_lock(p2m);
+                    BUG_ON(!p2m->pod.entry_count);
+                    --p2m->pod.entry_count;
+                    pod_unlock(p2m);
+                }
+            }
+        }
+    }
     else if ( p2m_is_ram(ot) )
     {
         unsigned long i;
@@ -1337,12 +1431,6 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
 
         ioreq_request_mapcache_invalidate(d);
     }
-
-    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
-    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
-    if ( rc )
-        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
-                 gfn_l, order, rc, mfn_x(mfn));
     else if ( p2m_is_pod(ot) )
     {
         pod_lock(p2m);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Nov 26 10:55:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Nov 2021 10:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.232533.403201 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqYtM-0004DX-Ti; Fri, 26 Nov 2021 10:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 232533.403201; Fri, 26 Nov 2021 10:55:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqYtM-0004DP-Qx; Fri, 26 Nov 2021 10:55:44 +0000
Received: by outflank-mailman (input) for mailman id 232533;
 Fri, 26 Nov 2021 10:55:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYtL-0004D4-0P
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:55:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYtK-0004tE-Vy
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYtK-0001Qs-V3
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=L5nu0MIkCehurVs2Z47MYcaPc/g1eQ69FRw7xH8c/c4=; b=EPdDw44P29vuK4lFAQrczGZC0Q
	hv/H/z9ocGgBVYdtebgCx8CxDGcrxcP+ctU0OVpQiDtuwLce6sYPh+QLnbQDpvk0Jwxyp7j8g/q8I
	lWyhNX1VGfLSeSsuHilqXGLoIWv5PpuB5kUZdcafPxes81LElCoot9vZ+mwiu9hAH+zs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] Config.mk: switch to named tags (for stable branch)
Message-Id: <E1mqYtK-0001Qs-V3@xenbits.xenproject.org>
Date: Fri, 26 Nov 2021 10:55:42 +0000

commit c6fbb058f6edf00bc09ec503de246df7c985cc18
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 23 16:39:47 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 23 16:43:49 2021 +0000

    Config.mk: switch to named tags (for stable branch)
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 Config.mk | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/Config.mk b/Config.mk
index 6be010c7ce..b32a185efc 100644
--- a/Config.mk
+++ b/Config.mk
@@ -239,17 +239,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
-QEMU_UPSTREAM_REVISION ?= b6e539830bf45e2d7a6bd86ddfdf003088b173b0
-MINIOS_UPSTREAM_REVISION ?= 9f09744aa3e5982a083ecf8e9cd2123f477081f9
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.16.0-rc4
+MINIOS_UPSTREAM_REVISION ?= xen-4.16.0-rc4
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= 3d273dd05e51e5a1ffba3d98c7437ee84e8f8764
-# Wed Jul 15 10:01:40 2020 +0100
-# qemu-trad: remove Xen path dependencies
+QEMU_TRADITIONAL_REVISION ?= xen-4.16.0-rc4
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Nov 26 10:55:55 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Nov 2021 10:55:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.232534.403205 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqYtW-0004GJ-VO; Fri, 26 Nov 2021 10:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 232534.403205; Fri, 26 Nov 2021 10:55:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqYtW-0004GB-SQ; Fri, 26 Nov 2021 10:55:54 +0000
Received: by outflank-mailman (input) for mailman id 232534;
 Fri, 26 Nov 2021 10:55:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYtV-0004Fz-3U
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:55:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYtV-0004tO-2p
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:55:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYtV-0001RS-1x
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:55:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jS+Ajk2EoZ5V2zCmDEMrdBcD/sdfNc5tJZ0N+iC+aBg=; b=ChnB4K9TNifdHJ/b86CTumHan1
	waGWYi8JZPtz+O6jsrvyXGqFa986W5JqEnAE5hh/HHlIvW9PH+v15l+Zwh152WrGoZGUURPfew01o
	iTkhZ1Ld7QY4t4YOnx+UPURnuliRGqh8SbBqDtng2Pg9RgU1W2zIZw6IssPRf2uesyRQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] SUPPORT.md: Set Release Notes link
Message-Id: <E1mqYtV-0001RS-1x@xenbits.xenproject.org>
Date: Fri, 26 Nov 2021 10:55:53 +0000

commit 4d9eed06124701c23d62713edc095e4f8841ae05
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 23 16:41:30 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 23 16:43:49 2021 +0000

    SUPPORT.md: Set Release Notes link
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 SUPPORT.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 3a34933c89..b1367e2b22 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -9,13 +9,13 @@ for the definitions of the support status levels etc.
 
 # Release Support
 
-    Xen-Version: unstable
+    Xen-Version: 4.16
     Initial-Release: n/a
     Supported-Until: TBD
     Security-Support-Until: Unreleased - not yet security-supported
 
 Release Notes
-: <a href="https://wiki.xenproject.org/wiki/Xen_Project_X.YY_Release_Notes">RN</a>
+: <a href="https://wiki.xenproject.org/wiki/Xen_Project_4.16_Release_Notes">RN</a>
 
 # Feature Support
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Nov 26 10:56:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Nov 2021 10:56:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.232535.403208 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqYth-0004Ip-0k; Fri, 26 Nov 2021 10:56:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 232535.403208; Fri, 26 Nov 2021 10:56:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqYtg-0004Ig-Tv; Fri, 26 Nov 2021 10:56:04 +0000
Received: by outflank-mailman (input) for mailman id 232535;
 Fri, 26 Nov 2021 10:56:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYtf-0004II-6k
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:56:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYtf-0004tl-60
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:56:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYtf-0001SH-4z
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:56:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7rSEEG8h08WhujiRu7ZMB72+fzBgusbe1ybPSXcqCJs=; b=a7OumV2ck3Bj8+Zw33sX0yYmn3
	w7iLsi4xG7hjRN2XiejDaThjc1dgzV9hs+wkjVopG2Iqo3dkOCQu7xbjMYTqjdHFFhq0knRDkKDx9
	WTuwFbnYaEanSv+a3HRr+NlsC7kFxdqh1abO+8sWS8vBo6zX1g8gNY7/Ji4UZvs4mR64=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] Turn off debug by default
Message-Id: <E1mqYtf-0001SH-4z@xenbits.xenproject.org>
Date: Fri, 26 Nov 2021 10:56:03 +0000

commit 59505f48fabed2e6fa5ad992edaabeb4a1441599
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 23 16:43:31 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 23 16:43:49 2021 +0000

    Turn off debug by default
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 tools/Rules.mk    | 2 +-
 xen/Kconfig.debug | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index b022da3336..051a5d3555 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -25,7 +25,7 @@ CFLAGS_xeninclude = -I$(XEN_INCLUDE)
 XENSTORE_XENSTORED ?= y
 
 # A debug build of tools?
-debug ?= y
+debug ?= n
 debug_symbols ?= $(debug)
 
 XEN_GOCODE_URL    = golang.xenproject.org
diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
index fad3050d4f..4419030235 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -3,7 +3,7 @@ menu "Debugging Options"
 
 config DEBUG
 	bool "Developer Checks"
-	default y
+	default n
 	---help---
 	  If you say Y here this will enable developer checks such as asserts
 	  and extra printks. This option is intended for development purposes
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Nov 26 10:56:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Nov 2021 10:56:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.232536.403213 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqYtr-0004Lw-2z; Fri, 26 Nov 2021 10:56:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 232536.403213; Fri, 26 Nov 2021 10:56:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqYtq-0004Lp-VM; Fri, 26 Nov 2021 10:56:14 +0000
Received: by outflank-mailman (input) for mailman id 232536;
 Fri, 26 Nov 2021 10:56:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYtp-0004LO-AJ
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:56:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYtp-0004tv-9T
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:56:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqYtp-0001T2-8Z
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 10:56:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6x5b9Dm5deBmQsIcbrwWgRG12K2VeSnROsOs0vx0DJI=; b=1RqMjaQZJsKgI6lbxFLfwNIDCR
	1SDbbjQxGxyqT/FTMbcp6ctfQ00SPKlOxgaG5xUhlwssvkgqfZMxxodL5ox/YqJRzm31cJySDS9Pi
	cdlX5ccHdiMX/06ENt0Z5g4gCUDQUrZXfecTlmDF5goe0rdGOodwcLxBHLVOchsj3Q+I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] Revert "x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents"
Message-Id: <E1mqYtp-0001T2-8Z@xenbits.xenproject.org>
Date: Fri, 26 Nov 2021 10:56:13 +0000

commit c4b41ee2b44ab89cfca75facbe6702376098fc56
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 24 21:11:52 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Thu Nov 25 11:06:12 2021 +0000

    Revert "x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents"
    
    OSSTest has identified a 3rd regression caused by this change.  Migration
    between Xen 4.15 and 4.16 on the nocera pair of machines (AMD Opteron 4133)
    fails with:
    
      xc: error: Failed to set CPUID policy: leaf 00000000, subleaf ffffffff, msr ffffffff (22 = Invalid argument): Internal error
      xc: error: Restore failed (22 = Invalid argument): Internal error
    
    which is a safety check to prevent resuming the guest when the CPUID data has
    been truncated.  The problem is caused by shrinking of the max policies, which
    is an ABI that needs handling compatibly between different versions of Xen.
    
    Furthermore, shrinking of the default policies also breaks things in some
    cases, because certain cpuid= settings in a VM config file which used to have
    an effect will now be silently discarded.
    
    This reverts commit 540d911c2813c3d8f4cdbb3f5672119e5e768a3d, as well as the
    partial fix attempt in 81da2b544cbb003a5447c9b14d275746ad22ab37 (which added
    one new case where cpuid= settings might not apply correctly) and restores the
    same behaviour as Xen 4.15.
    
    Fixes: 540d911c2813 ("x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents")
    Fixes: 81da2b544cbb ("x86/cpuid: prevent shrinking migrated policies max leaves")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release_Acked-by: Ian Jackson <iwj@xenproject.org>
---
 tools/libs/guest/xg_cpuid_x86.c          |   7 ---
 tools/tests/cpu-policy/test-cpu-policy.c | 101 -------------------------------
 xen/arch/x86/cpuid.c                     |  10 ---
 xen/include/xen/lib/x86/cpuid.h          |   7 ---
 xen/lib/x86/cpuid.c                      |  39 ------------
 5 files changed, 164 deletions(-)

diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 3ffd5f683b..198892ebdf 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -638,13 +638,6 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
         }
     }
 
-    /*
-     * Do not try to shrink the policy if restoring, as that could cause
-     * guest visible changes in the maximum leaf fields.
-     */
-    if ( !restore )
-        x86_cpuid_policy_shrink_max_leaves(p);
-
     rc = x86_cpuid_copy_to_buffer(p, leaves, &nr_leaves);
     if ( rc )
     {
diff --git a/tools/tests/cpu-policy/test-cpu-policy.c b/tools/tests/cpu-policy/test-cpu-policy.c
index 75973298df..ed450a0997 100644
--- a/tools/tests/cpu-policy/test-cpu-policy.c
+++ b/tools/tests/cpu-policy/test-cpu-policy.c
@@ -8,13 +8,10 @@
 #include <err.h>
 
 #include <xen-tools/libs.h>
-#include <xen/asm/x86-defns.h>
 #include <xen/asm/x86-vendors.h>
 #include <xen/lib/x86/cpu-policy.h>
 #include <xen/domctl.h>
 
-#define XSTATE_FP_SSE  (X86_XCR0_FP | X86_XCR0_SSE)
-
 static unsigned int nr_failures;
 #define fail(fmt, ...)                          \
 ({                                              \
@@ -573,103 +570,6 @@ static void test_cpuid_out_of_range_clearing(void)
     }
 }
 
-static void test_cpuid_maximum_leaf_shrinking(void)
-{
-    static const struct test {
-        const char *name;
-        struct cpuid_policy p;
-    } tests[] = {
-        {
-            .name = "basic",
-            .p = {
-                /* Very basic information only. */
-                .basic.max_leaf = 1,
-                .basic.raw_fms = 0xc2,
-            },
-        },
-        {
-            .name = "cache",
-            .p = {
-                /* Cache subleaves present. */
-                .basic.max_leaf = 4,
-                .cache.subleaf[0].type = 1,
-            },
-        },
-        {
-            .name = "feat#0",
-            .p = {
-                /* Subleaf 0 only with some valid bit. */
-                .basic.max_leaf = 7,
-                .feat.max_subleaf = 0,
-                .feat.fsgsbase = 1,
-            },
-        },
-        {
-            .name = "feat#1",
-            .p = {
-                /* Subleaf 1 only with some valid bit. */
-                .basic.max_leaf = 7,
-                .feat.max_subleaf = 1,
-                .feat.avx_vnni = 1,
-            },
-        },
-        {
-            .name = "topo",
-            .p = {
-                /* Topology subleaves present. */
-                .basic.max_leaf = 0xb,
-                .topo.subleaf[0].type = 1,
-            },
-        },
-        {
-            .name = "xstate",
-            .p = {
-                /* First subleaf always valid (and then non-zero). */
-                .basic.max_leaf = 0xd,
-                .xstate.xcr0_low = XSTATE_FP_SSE,
-            },
-        },
-        {
-            .name = "extd",
-            .p = {
-                /* Commonly available information only. */
-                .extd.max_leaf = 0x80000008,
-                .extd.maxphysaddr = 0x28,
-                .extd.maxlinaddr = 0x30,
-            },
-        },
-    };
-
-    printf("Testing CPUID maximum leaf shrinking:\n");
-
-    for ( size_t i = 0; i < ARRAY_SIZE(tests); ++i )
-    {
-        const struct test *t = &tests[i];
-        struct cpuid_policy *p = memdup(&t->p);
-
-        p->basic.max_leaf = ARRAY_SIZE(p->basic.raw) - 1;
-        p->feat.max_subleaf = ARRAY_SIZE(p->feat.raw) - 1;
-        p->extd.max_leaf = 0x80000000 | (ARRAY_SIZE(p->extd.raw) - 1);
-
-        x86_cpuid_policy_shrink_max_leaves(p);
-
-        /* Check the the resulting max (sub)leaf values against expecations. */
-        if ( p->basic.max_leaf != t->p.basic.max_leaf )
-             fail("  Test %s basic fail - expected %#x, got %#x\n",
-                  t->name, t->p.basic.max_leaf, p->basic.max_leaf);
-
-        if ( p->extd.max_leaf != t->p.extd.max_leaf )
-             fail("  Test %s extd fail - expected %#x, got %#x\n",
-                  t->name, t->p.extd.max_leaf, p->extd.max_leaf);
-
-        if ( p->feat.max_subleaf != t->p.feat.max_subleaf )
-             fail("  Test %s feat fail - expected %#x, got %#x\n",
-                  t->name, t->p.feat.max_subleaf, p->feat.max_subleaf);
-
-        free(p);
-    }
-}
-
 static void test_is_compatible_success(void)
 {
     static struct test {
@@ -785,7 +685,6 @@ int main(int argc, char **argv)
     test_cpuid_serialise_success();
     test_cpuid_deserialise_failure();
     test_cpuid_out_of_range_clearing();
-    test_cpuid_maximum_leaf_shrinking();
 
     test_msr_serialise_success();
     test_msr_deserialise_failure();
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 8ac55f0806..151944f657 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -353,8 +353,6 @@ static void __init calculate_host_policy(void)
         p->extd.raw[0xa].d |= ((1u << SVM_FEATURE_VMCBCLEAN) |
                                (1u << SVM_FEATURE_TSCRATEMSR));
     }
-
-    x86_cpuid_policy_shrink_max_leaves(p);
 }
 
 static void __init guest_common_default_feature_adjustments(uint32_t *fs)
@@ -434,8 +432,6 @@ static void __init calculate_pv_max_policy(void)
     recalculate_xstate(p);
 
     p->extd.raw[0xa] = EMPTY_LEAF; /* No SVM for PV guests. */
-
-    x86_cpuid_policy_shrink_max_leaves(p);
 }
 
 static void __init calculate_pv_def_policy(void)
@@ -456,8 +452,6 @@ static void __init calculate_pv_def_policy(void)
     sanitise_featureset(pv_featureset);
     cpuid_featureset_to_policy(pv_featureset, p);
     recalculate_xstate(p);
-
-    x86_cpuid_policy_shrink_max_leaves(p);
 }
 
 static void __init calculate_hvm_max_policy(void)
@@ -523,8 +517,6 @@ static void __init calculate_hvm_max_policy(void)
     sanitise_featureset(hvm_featureset);
     cpuid_featureset_to_policy(hvm_featureset, p);
     recalculate_xstate(p);
-
-    x86_cpuid_policy_shrink_max_leaves(p);
 }
 
 static void __init calculate_hvm_def_policy(void)
@@ -549,8 +541,6 @@ static void __init calculate_hvm_def_policy(void)
     sanitise_featureset(hvm_featureset);
     cpuid_featureset_to_policy(hvm_featureset, p);
     recalculate_xstate(p);
-
-    x86_cpuid_policy_shrink_max_leaves(p);
 }
 
 void __init init_guest_cpuid(void)
diff --git a/xen/include/xen/lib/x86/cpuid.h b/xen/include/xen/lib/x86/cpuid.h
index 2300faf03e..a4d254ea96 100644
--- a/xen/include/xen/lib/x86/cpuid.h
+++ b/xen/include/xen/lib/x86/cpuid.h
@@ -386,13 +386,6 @@ void x86_cpuid_policy_fill_native(struct cpuid_policy *p);
  */
 void x86_cpuid_policy_clear_out_of_range_leaves(struct cpuid_policy *p);
 
-/**
- * Shrink max leaf/subleaf values such that the last respective valid entry
- * isn't all blank.  While permitted by the spec, such extraneous leaves may
- * provide undue "hints" to guests.
- */
-void x86_cpuid_policy_shrink_max_leaves(struct cpuid_policy *p);
-
 #ifdef __XEN__
 #include <public/arch-x86/xen.h>
 typedef XEN_GUEST_HANDLE_64(xen_cpuid_leaf_t) cpuid_leaf_buffer_t;
diff --git a/xen/lib/x86/cpuid.c b/xen/lib/x86/cpuid.c
index 1409c254c8..8eb88314f5 100644
--- a/xen/lib/x86/cpuid.c
+++ b/xen/lib/x86/cpuid.c
@@ -236,45 +236,6 @@ void x86_cpuid_policy_clear_out_of_range_leaves(struct cpuid_policy *p)
                 ARRAY_SIZE(p->extd.raw) - 1);
 }
 
-void x86_cpuid_policy_shrink_max_leaves(struct cpuid_policy *p)
-{
-    unsigned int i;
-
-    p->basic.raw[0x4] = p->cache.raw[0];
-
-    for ( i = p->feat.max_subleaf; i; --i )
-        if ( p->feat.raw[i].a | p->feat.raw[i].b |
-             p->feat.raw[i].c | p->feat.raw[i].d )
-            break;
-    p->feat.max_subleaf = i;
-    p->basic.raw[0x7] = p->feat.raw[i];
-
-    p->basic.raw[0xb] = p->topo.raw[0];
-
-    /*
-     * Due to the way xstate gets handled in the hypervisor (see
-     * recalculate_xstate()) there is (for now at least) no need to fiddle
-     * with the xstate subleaves (IOW we assume they're already in consistent
-     * shape, for coming from either hardware or recalculate_xstate()).
-     */
-    p->basic.raw[0xd] = p->xstate.raw[0];
-
-    for ( i = p->basic.max_leaf; i; --i )
-        if ( p->basic.raw[i].a | p->basic.raw[i].b |
-             p->basic.raw[i].c | p->basic.raw[i].d )
-            break;
-    p->basic.max_leaf = i;
-
-    for ( i = p->extd.max_leaf & 0xffff; i; --i )
-        if ( p->extd.raw[i].a | p->extd.raw[i].b |
-             p->extd.raw[i].c | p->extd.raw[i].d )
-            break;
-    if ( i | p->extd.raw[0].b | p->extd.raw[0].c | p->extd.raw[0].d )
-        p->extd.max_leaf = 0x80000000 | i;
-    else
-        p->extd.max_leaf = 0;
-}
-
 const uint32_t *x86_cpuid_lookup_deep_deps(uint32_t feature)
 {
     static const uint32_t deep_features[] = INIT_DEEP_FEATURES;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Nov 26 22:33:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Nov 2021 22:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.233542.405227 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqjmB-0008Hw-6R; Fri, 26 Nov 2021 22:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 233542.405227; Fri, 26 Nov 2021 22:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqjmB-0008Ho-3X; Fri, 26 Nov 2021 22:33:03 +0000
Received: by outflank-mailman (input) for mailman id 233542;
 Fri, 26 Nov 2021 22: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 1mqjmA-0008Hi-7f
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 22: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 1mqjmA-0001YT-6l
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 22:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqjmA-0001wc-5k
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 22: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=z6UBxx3UByYSczZlZHyXY2F1fLOUUVri7L3vTk6oLFU=; b=SO5MIhP3KHYzxrqZBNjhCuau01
	z/k9QcmeCC9dVfxszsmjk4BGW24B74atzfNLJNcFOeoQKgMzqZuEnPpN6aYjgvgtFzXC15a90xMLE
	7GfrItMqwb79N6Plb4Sj8EwWeMtvBtlNqcXoIJSSNrIQIfz5uiU8HRtjbWPlHkwc58eg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] xen/page_alloc: Harden assign_pages()
Message-Id: <E1mqjmA-0001wc-5k@xenbits.xenproject.org>
Date: Fri, 26 Nov 2021 22:33:02 +0000

commit d02631a21530918501f7e11320667dde7829cbb5
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Nov 23 13:25:50 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:25:50 2021 +0100

    xen/page_alloc: Harden assign_pages()
    
    domain_tot_pages() and d->max_pages are 32-bit values. While the order
    should always be quite small, it would still be possible to overflow
    if domain_tot_pages() is near to (2^32 - 1).
    
    As this code may be called by a guest via XENMEM_increase_reservation
    and XENMEM_populate_physmap, we want to make sure the guest is not going
    to be able to allocate more than it is allowed.
    
    Rework the allocation check to avoid any possible overflow. While the
    check domain_tot_pages() < d->max_pages should technically not be
    necessary, it is probably best to have it to catch any possible
    inconsistencies in the future.
    
    This is CVE-2021-28706 / part of XSA-385.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 143501861d48e1bfef495849fd68584baac05849
    master date: 2021-11-22 11:11:05 +0000
---
 xen/common/grant_table.c |  7 ++++---
 xen/common/page_alloc.c  | 35 +++++++++++++++++++++++++++++------
 2 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 6f50e9de51..e2fcb07e27 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -2336,7 +2336,8 @@ gnttab_transfer(
          * pages when it is dying.
          */
         if ( unlikely(e->is_dying) ||
-             unlikely(domain_tot_pages(e) >= e->max_pages) )
+             unlikely(domain_tot_pages(e) >= e->max_pages) ||
+             unlikely(!(e->tot_pages + 1)) )
         {
             spin_unlock(&e->page_alloc_lock);
 
@@ -2345,8 +2346,8 @@ gnttab_transfer(
                          e->domain_id);
             else
                 gdprintk(XENLOG_INFO,
-                         "Transferee d%d has no headroom (tot %u, max %u)\n",
-                         e->domain_id, domain_tot_pages(e), e->max_pages);
+                         "Transferee %pd has no headroom (tot %u, max %u, ex %u)\n",
+                         e, domain_tot_pages(e), e->max_pages, e->extra_pages);
 
             gop.status = GNTST_general_error;
             goto unlock_and_copyback;
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 1744e6faa5..91cde4b775 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2298,20 +2298,43 @@ int assign_pages(
     }
     else if ( !(memflags & MEMF_no_refcount) )
     {
-        unsigned int tot_pages = domain_tot_pages(d) + (1 << order);
+        unsigned int tot_pages = domain_tot_pages(d), nr = 1u << order;
 
         if ( unlikely(tot_pages > d->max_pages) )
         {
-            gprintk(XENLOG_INFO, "Over-allocation for domain %u: "
-                    "%u > %u\n", d->domain_id, tot_pages, d->max_pages);
+            gprintk(XENLOG_INFO, "Inconsistent allocation for %pd: %u > %u\n",
+                    d, tot_pages, d->max_pages);
+            rc = -EPERM;
+            goto out;
+        }
+
+        if ( unlikely(nr > d->max_pages - tot_pages) )
+        {
+            gprintk(XENLOG_INFO, "Over-allocation for %pd: %Lu > %u\n",
+                    d, tot_pages + 0ull + nr, d->max_pages);
             rc = -E2BIG;
             goto out;
         }
     }
 
-    if ( !(memflags & MEMF_no_refcount) &&
-         unlikely(domain_adjust_tot_pages(d, 1 << order) == (1 << order)) )
-        get_knownalive_domain(d);
+    if ( !(memflags & MEMF_no_refcount) )
+    {
+        unsigned int nr = 1u << order;
+
+        if ( unlikely(d->tot_pages + nr < nr) )
+        {
+            gprintk(XENLOG_INFO,
+                    "Excess allocation for %pd: %Lu (%u extra)\n",
+                    d, d->tot_pages + 0ull + nr, d->extra_pages);
+            if ( pg[0].count_info & PGC_extra )
+                d->extra_pages -= nr;
+            rc = -E2BIG;
+            goto out;
+        }
+
+        if ( unlikely(domain_adjust_tot_pages(d, nr) == nr) )
+            get_knownalive_domain(d);
+    }
 
     for ( i = 0; i < (1 << order); i++ )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 26 22:33:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Nov 2021 22:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.233543.405232 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqjmL-0008K6-7r; Fri, 26 Nov 2021 22:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 233543.405232; Fri, 26 Nov 2021 22: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 1mqjmL-0008Jy-50; Fri, 26 Nov 2021 22:33:13 +0000
Received: by outflank-mailman (input) for mailman id 233543;
 Fri, 26 Nov 2021 22: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 1mqjmK-0008Jo-Aa
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 22: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 1mqjmK-0001YX-9p
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 22:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqjmK-0001xO-91
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 22: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=WkCwPCQdMYaUtWwo5BfV0d86JmCBASicEZLqPrmJeEQ=; b=AMgL33aJxxRt80K4MNtPqi9MWF
	dzCQ0cZtx3ZApWqAhU3JJ9AoOPzErqOPkKzmTsFhHMr0Fx0jwSQN9VnaFFl0NQEd5KJ6+zkKX53VN
	GwNYG+oXlbSF5jBOG4sDHLTSNoOH4WWzrMfPepiJY7Nhnr8GXehv/F2oEqME4lYYEP1U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/PoD: deal with misaligned GFNs
Message-Id: <E1mqjmK-0001xO-91@xenbits.xenproject.org>
Date: Fri, 26 Nov 2021 22:33:12 +0000

commit 1da54becd5de7e55b2b66665bedc2f30964dbd33
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:26:12 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:26:12 2021 +0100

    x86/PoD: deal with misaligned GFNs
    
    Users of XENMEM_decrease_reservation and XENMEM_populate_physmap aren't
    required to pass in order-aligned GFN values. (While I consider this
    bogus, I don't think we can fix this there, as that might break existing
    code, e.g Linux'es swiotlb, which - while affecting PV only - until
    recently had been enforcing only page alignment on the original
    allocation.) Only non-PoD code paths (guest_physmap_{add,remove}_page(),
    p2m_set_entry()) look to be dealing with this properly (in part by being
    implemented inefficiently, handling every 4k page separately).
    
    Introduce wrappers taking care of splitting the incoming request into
    aligned chunks, without putting much effort in trying to determine the
    largest possible chunk at every iteration.
    
    Also "handle" p2m_set_entry() failure for non-order-0 requests by
    crashing the domain in one more place. Alongside putting a log message
    there, also add one to the other similar path.
    
    Note regarding locking: This is left in the actual worker functions on
    the assumption that callers aren't guaranteed atomicity wrt acting on
    multiple pages at a time. For mis-aligned GFNs gfn_lock() wouldn't have
    locked the correct GFN range anyway, if it didn't simply resolve to
    p2m_lock(), and for well-behaved callers there continues to be only a
    single iteration, i.e. behavior is unchanged for them. (FTAOD pulling
    out just pod_lock() into p2m_pod_decrease_reservation() would result in
    a lock order violation.)
    
    This is CVE-2021-28704 and CVE-2021-28707 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 182c737b9ba540ebceb1433f3940fbed6eac4ea9
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m-pod.c | 75 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 63 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index 8abc57265c..2c3f4c0206 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -496,7 +496,7 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn);
 
 
 /*
- * This function is needed for two reasons:
+ * This pair of functions is needed for two reasons:
  * + To properly handle clearing of PoD entries
  * + To "steal back" memory being freed for the PoD cache, rather than
  *   releasing it.
@@ -504,8 +504,8 @@ p2m_pod_zero_check_superpage(struct p2m_domain *p2m, gfn_t gfn);
  * Once both of these functions have been completed, we can return and
  * allow decrease_reservation() to handle everything else.
  */
-unsigned long
-p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+static unsigned long
+decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
 {
     unsigned long ret = 0, i, n;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -552,8 +552,10 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
          * All PoD: Mark the whole region invalid and tell caller
          * we're done.
          */
-        if ( p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
-                           p2m->default_access) )
+        int rc = p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
+                               p2m->default_access);
+
+        if ( rc )
         {
             /*
              * If this fails, we can't tell how much of the range was changed.
@@ -561,7 +563,12 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
              * impossible.
              */
             if ( order != 0 )
+            {
+                printk(XENLOG_G_ERR
+                       "%pd: marking GFN %#lx (order %u) as non-PoD failed: %d\n",
+                       d, gfn_x(gfn), order, rc);
                 domain_crash(d);
+            }
             goto out_unlock;
         }
         ret = 1UL << order;
@@ -670,6 +677,22 @@ out_unlock:
     return ret;
 }
 
+unsigned long
+p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+{
+    unsigned long left = 1UL << order, ret = 0;
+    unsigned int chunk_order = find_first_set_bit(gfn_x(gfn) | left);
+
+    do {
+        ret += decrease_reservation(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn = gfn_add(gfn, 1UL << chunk_order);
+    } while ( left );
+
+    return ret;
+}
+
 void p2m_pod_dump_data(struct domain *d)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -1273,19 +1296,15 @@ remap_and_retry:
     return true;
 }
 
-
-int
-guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
-                                      unsigned int order)
+static int
+mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
+                        unsigned int order)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     gfn_t gfn = _gfn(gfn_l);
     unsigned long i, n, pod_count = 0;
     int rc = 0;
 
-    if ( !paging_mode_translate(d) )
-        return -EINVAL;
-
     gfn_lock(p2m, gfn, order);
 
     P2M_DEBUG("mark pod gfn=%#lx\n", gfn_l);
@@ -1325,6 +1344,17 @@ guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
 
         ioreq_request_mapcache_invalidate(d);
     }
+    else if ( order )
+    {
+        /*
+         * If this failed, we can't tell how much of the range was changed.
+         * Best to crash the domain.
+         */
+        printk(XENLOG_G_ERR
+               "%pd: marking GFN %#lx (order %u) as PoD failed: %d\n",
+               d, gfn_l, order, rc);
+        domain_crash(d);
+    }
 
 out:
     gfn_unlock(p2m, gfn, order);
@@ -1332,6 +1362,27 @@ out:
     return rc;
 }
 
+int
+guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
+                                      unsigned int order)
+{
+    unsigned long left = 1UL << order;
+    unsigned int chunk_order = find_first_set_bit(gfn | left);
+    int rc;
+
+    if ( !paging_mode_translate(d) )
+        return -EINVAL;
+
+    do {
+        rc = mark_populate_on_demand(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn += 1UL << chunk_order;
+    } while ( !rc && left );
+
+    return rc;
+}
+
 void p2m_pod_init(struct p2m_domain *p2m)
 {
     unsigned int i;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 26 22:33:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Nov 2021 22:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.233544.405236 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqjmV-0008N0-9K; Fri, 26 Nov 2021 22:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 233544.405236; Fri, 26 Nov 2021 22: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 1mqjmV-0008Ms-6S; Fri, 26 Nov 2021 22:33:23 +0000
Received: by outflank-mailman (input) for mailman id 233544;
 Fri, 26 Nov 2021 22: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 1mqjmU-0008Mk-Dm
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 22: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 1mqjmU-0001ZD-D0
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 22:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqjmU-0001xy-C4
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 22: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=WEvoPv5DFLqDpJO2G6r5V28uwbu+1YU8F5c49JSjErc=; b=jHTBZHqrCIVRWCUZlrNCaxasvU
	ZlPVTtDWQO2yx7Ao63p8/CErBkhlKVWrm78kxLh8alHCRT7izep1UBTYFDwmI9Bd0dh9f/ha8nL/S
	MibPL4poBIeNxM9Pw8XgByZJjuIf4NFJs2fgOGyQ9WJVr2p/4NTu7frU4nxrHcctdwhg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
Message-Id: <E1mqjmU-0001xy-C4@xenbits.xenproject.org>
Date: Fri, 26 Nov 2021 22:33:22 +0000

commit 4429ca0b29f481a2abfcc81990c5ac1f96276cb2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:26:22 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:26:22 2021 +0100

    x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
    
    p2m_pod_decrease_reservation() may pass pages to the function which
    aren't 4k, 2M, or 1G. Handle all intermediate orders as well, to avoid
    hitting the BUG() at the switch() statement's "default" case.
    
    This is CVE-2021-28708 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 8ec13f68e0b026863d23e7f44f252d06478bc809
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m-pod.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index 2c3f4c0206..efc9b4bb55 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -112,15 +112,13 @@ p2m_pod_cache_add(struct p2m_domain *p2m,
     /* Then add to the appropriate populate-on-demand list. */
     switch ( order )
     {
-    case PAGE_ORDER_1G:
-        for ( i = 0; i < (1UL << PAGE_ORDER_1G); i += 1UL << PAGE_ORDER_2M )
+    case PAGE_ORDER_2M ... PAGE_ORDER_1G:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_2M )
             page_list_add_tail(page + i, &p2m->pod.super);
         break;
-    case PAGE_ORDER_2M:
-        page_list_add_tail(page, &p2m->pod.super);
-        break;
-    case PAGE_ORDER_4K:
-        page_list_add_tail(page, &p2m->pod.single);
+    case PAGE_ORDER_4K ... PAGE_ORDER_2M - 1:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_4K )
+            page_list_add_tail(page + i, &p2m->pod.single);
         break;
     default:
         BUG();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Fri Nov 26 22:33:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 26 Nov 2021 22:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.233545.405240 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mqjmf-0008Qk-B0; Fri, 26 Nov 2021 22:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 233545.405240; Fri, 26 Nov 2021 22: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 1mqjmf-0008Qc-7v; Fri, 26 Nov 2021 22:33:33 +0000
Received: by outflank-mailman (input) for mailman id 233545;
 Fri, 26 Nov 2021 22:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqjme-0008QM-H7
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 22:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqjme-0001ZR-GK
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 22:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mqjme-0001ys-FP
 for xen-changelog@lists.xenproject.org; Fri, 26 Nov 2021 22:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VMs+Q7o+txUh1F8eJaAiI2EPEsJDxiVonVnmf/TwyRQ=; b=G/cz61QLQ3fPQwxUPEcNWBz5IT
	uQmNts8hhkvvedtmVDnL7NZ+3aC0bmIoCGHk4RFJmTZwhpaBNbL7ocQ6r10IN7Ma8hjs36fiwscXc
	I9UVfSzF3M84V5yxeSgIScq+/DKZ09YsrmyH03Ngvp4uC098ZQtVXrFhCtrrzVcqOD2Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/P2M: deal with partial success of p2m_set_entry()
Message-Id: <E1mqjme-0001ys-FP@xenbits.xenproject.org>
Date: Fri, 26 Nov 2021 22:33:32 +0000

commit 544e547a63175ac6ef7cc29c4f5bda88da024f69
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Nov 23 13:26:29 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Nov 23 13:26:29 2021 +0100

    x86/P2M: deal with partial success of p2m_set_entry()
    
    M2P and PoD stats need to remain in sync with P2M; if an update succeeds
    only partially, respective adjustments need to be made. If updates get
    made before the call, they may also need undoing upon complete failure
    (i.e. including the single-page case).
    
    Log-dirty state would better also be kept in sync.
    
    Note that the change to set_typed_p2m_entry() may not be strictly
    necessary (due to the order restriction enforced near the top of the
    function), but is being kept here to be on the safe side.
    
    This is CVE-2021-28705 and CVE-2021-28709 / XSA-389.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 74a11c43fd7e074b1f77631b446dd2115eacb9e8
    master date: 2021-11-22 12:27:30 +0000
---
 xen/arch/x86/mm/p2m.c | 118 ++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 104 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 9936142917..b96244e422 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -784,6 +784,7 @@ p2m_remove_page(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
     unsigned long i;
     p2m_type_t t;
     p2m_access_t a;
+    int rc;
 
     /* IOMMU for PV guests is handled in get_page_type() and put_page(). */
     if ( !paging_mode_translate(p2m->domain) )
@@ -819,8 +820,27 @@ 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);
+    rc = p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
+                       p2m->default_access);
+    if ( likely(!rc) || !mfn_valid(mfn) )
+        return rc;
+
+    /*
+     * The operation may have partially succeeded. For the failed part we need
+     * to undo the M2P update and, out of precaution, mark the pages dirty
+     * again.
+     */
+    for ( i = 0; i < (1UL << page_order); ++i )
+    {
+        p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0, NULL, NULL);
+        if ( !p2m_is_hole(t) && !p2m_is_special(t) && !p2m_is_shared(t) )
+        {
+            set_gpfn_from_mfn(mfn_x(mfn) + i, gfn_x(gfn) + i);
+            paging_mark_pfn_dirty(p2m->domain, _pfn(gfn_x(gfn) + i));
+        }
+    }
+
+    return rc;
 }
 
 int
@@ -1009,13 +1029,8 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
 
     /* Now, actually do the two-way mapping */
     rc = p2m_set_entry(p2m, gfn, mfn, page_order, t, p2m->default_access);
-    if ( rc == 0 )
+    if ( likely(!rc) )
     {
-        pod_lock(p2m);
-        p2m->pod.entry_count -= pod_count;
-        BUG_ON(p2m->pod.entry_count < 0);
-        pod_unlock(p2m);
-
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -1023,6 +1038,42 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                                   gfn_x(gfn_add(gfn, i)));
         }
     }
+    else
+    {
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update M2P and dirty state, while for the failed part we
+         * may need to adjust PoD stats as well as undo the earlier M2P update.
+         */
+        for ( i = 0; i < (1UL << page_order); ++i )
+        {
+            omfn = p2m->get_entry(p2m, gfn_add(gfn, i), &ot, &a, 0, NULL, NULL);
+            if ( p2m_is_pod(ot) )
+            {
+                BUG_ON(!pod_count);
+                --pod_count;
+            }
+            else if ( mfn_eq(omfn, mfn_add(mfn, i)) && ot == t &&
+                      a == p2m->default_access && !p2m_is_grant(t) )
+            {
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+                paging_mark_pfn_dirty(d, _pfn(gfn_x(gfn) + i));
+            }
+            else if ( p2m_is_ram(ot) && !p2m_is_paged(ot) )
+            {
+                ASSERT(mfn_valid(omfn));
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+            }
+        }
+    }
+
+    if ( pod_count )
+    {
+        pod_lock(p2m);
+        p2m->pod.entry_count -= pod_count;
+        BUG_ON(p2m->pod.entry_count < 0);
+        pod_unlock(p2m);
+    }
 
 out:
     p2m_unlock(p2m);
@@ -1314,6 +1365,51 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
             return 0;
         }
     }
+
+    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
+    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
+    if ( unlikely(rc) )
+    {
+        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
+                 gfn_l, order, rc, mfn_x(mfn));
+
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update PoD stats, M2P, and dirty state.
+         */
+        if ( order != PAGE_ORDER_4K )
+        {
+            unsigned long i;
+
+            for ( i = 0; i < (1UL << order); ++i )
+            {
+                p2m_type_t t;
+                mfn_t cmfn = p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0,
+                                            NULL, NULL);
+
+                if ( !mfn_eq(cmfn, mfn_add(mfn, i)) || t != gfn_p2mt ||
+                     a != access )
+                    continue;
+
+                if ( p2m_is_ram(ot) )
+                {
+                    ASSERT(mfn_valid(mfn_add(omfn, i)));
+                    set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
+
+                    ioreq_request_mapcache_invalidate(d);
+                }
+#ifdef CONFIG_HVM
+                else if ( p2m_is_pod(ot) )
+                {
+                    pod_lock(p2m);
+                    BUG_ON(!p2m->pod.entry_count);
+                    --p2m->pod.entry_count;
+                    pod_unlock(p2m);
+                }
+#endif
+            }
+        }
+    }
     else if ( p2m_is_ram(ot) )
     {
         unsigned long i;
@@ -1326,12 +1422,6 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
 
         ioreq_request_mapcache_invalidate(d);
     }
-
-    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
-    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
-    if ( rc )
-        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
-                 gfn_l, order, rc, mfn_x(mfn));
 #ifdef CONFIG_HVM
     else if ( p2m_is_pod(ot) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:11:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.233981.406074 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0I3-0002bC-SW; Sat, 27 Nov 2021 16:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 233981.406074; Sat, 27 Nov 2021 16: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 1mr0I3-0002b3-PD; Sat, 27 Nov 2021 16:11:03 +0000
Received: by outflank-mailman (input) for mailman id 233981;
 Sat, 27 Nov 2021 16: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 1mr0I2-0002ax-03
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16: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 1mr0I1-00070M-PU
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0I1-00020N-Nt
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IpVcInuldx/VNjbwfReCJGCRZMuzhmEhFyo+cfMVY/Y=; b=0lOdsYjVZMP8ZCo5OP81irqqMB
	PdSIzdxi93Wvn+OOzj5RYWQW9lcMqgU2w1S6gTTUx+v0GuZ6oMcJoQJLlUz1MX0emnpg4Jf5Nd4I5
	YA3dY/bQTXEV49Nes5mdTwYTUTYzz+1xQH3ZZtcvLAFDA6xAVEkPtd+AvrVxuOZ+8/34=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/page_alloc: Harden assign_pages()
Message-Id: <E1mr0I1-00020N-Nt@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:11:01 +0000

commit 143501861d48e1bfef495849fd68584baac05849
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Nov 22 11:11:05 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 22 11:11:05 2021 +0000

    xen/page_alloc: Harden assign_pages()
    
    domain_tot_pages() and d->max_pages are 32-bit values. While the order
    should always be quite small, it would still be possible to overflow
    if domain_tot_pages() is near to (2^32 - 1).
    
    As this code may be called by a guest via XENMEM_increase_reservation
    and XENMEM_populate_physmap, we want to make sure the guest is not going
    to be able to allocate more than it is allowed.
    
    Rework the allocation check to avoid any possible overflow. While the
    check domain_tot_pages() < d->max_pages should technically not be
    necessary, it is probably best to have it to catch any possible
    inconsistencies in the future.
    
    This is CVE-2021-28706 / part of XSA-385.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/common/grant_table.c |  7 ++++---
 xen/common/page_alloc.c  | 33 +++++++++++++++++++++++++++------
 2 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 8b322b51c0..012a74455b 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -2341,7 +2341,8 @@ gnttab_transfer(
          * pages when it is dying.
          */
         if ( unlikely(e->is_dying) ||
-             unlikely(domain_tot_pages(e) >= e->max_pages) )
+             unlikely(domain_tot_pages(e) >= e->max_pages) ||
+             unlikely(!(e->tot_pages + 1)) )
         {
             spin_unlock(&e->page_alloc_lock);
 
@@ -2350,8 +2351,8 @@ gnttab_transfer(
                          e->domain_id);
             else
                 gdprintk(XENLOG_INFO,
-                         "Transferee d%d has no headroom (tot %u, max %u)\n",
-                         e->domain_id, domain_tot_pages(e), e->max_pages);
+                         "Transferee %pd has no headroom (tot %u, max %u, ex %u)\n",
+                         e, domain_tot_pages(e), e->max_pages, e->extra_pages);
 
             gop.status = GNTST_general_error;
             goto unlock_and_copyback;
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 5801358b4b..d0baaa2ecd 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2310,20 +2310,41 @@ int assign_pages(
     }
     else if ( !(memflags & MEMF_no_refcount) )
     {
-        unsigned int tot_pages = domain_tot_pages(d) + nr;
+        unsigned int tot_pages = domain_tot_pages(d);
 
         if ( unlikely(tot_pages > d->max_pages) )
         {
-            gprintk(XENLOG_INFO, "Over-allocation for domain %u: "
-                    "%u > %u\n", d->domain_id, tot_pages, d->max_pages);
+            gprintk(XENLOG_INFO, "Inconsistent allocation for %pd: %u > %u\n",
+                    d, tot_pages, d->max_pages);
+            rc = -EPERM;
+            goto out;
+        }
+
+        if ( unlikely(nr > d->max_pages - tot_pages) )
+        {
+            gprintk(XENLOG_INFO, "Over-allocation for %pd: %Lu > %u\n",
+                    d, tot_pages + 0ull + nr, d->max_pages);
             rc = -E2BIG;
             goto out;
         }
     }
 
-    if ( !(memflags & MEMF_no_refcount) &&
-         unlikely(domain_adjust_tot_pages(d, nr) == nr) )
-        get_knownalive_domain(d);
+    if ( !(memflags & MEMF_no_refcount) )
+    {
+        if ( unlikely(d->tot_pages + nr < nr) )
+        {
+            gprintk(XENLOG_INFO,
+                    "Excess allocation for %pd: %Lu (%u extra)\n",
+                    d, d->tot_pages + 0ull + nr, d->extra_pages);
+            if ( pg[0].count_info & PGC_extra )
+                d->extra_pages -= nr;
+            rc = -E2BIG;
+            goto out;
+        }
+
+        if ( unlikely(domain_adjust_tot_pages(d, nr) == nr) )
+            get_knownalive_domain(d);
+    }
 
     for ( i = 0; i < nr; i++ )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:11:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.233982.406078 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0ID-0002cw-Tv; Sat, 27 Nov 2021 16:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 233982.406078; Sat, 27 Nov 2021 16: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 1mr0ID-0002cm-Qj; Sat, 27 Nov 2021 16:11:13 +0000
Received: by outflank-mailman (input) for mailman id 233982;
 Sat, 27 Nov 2021 16:11:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0IB-0002cO-Tx
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:11:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0IB-00070d-T1
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0IB-00021D-Rz
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pa45HmlqBGv/kA0UQjUKfOZFYTNr2nm59j18N+ZDGx4=; b=ve54pKtI3KLteUlt0O0VwhCtER
	zzfdiFK+aVOZGRdzdurgkcD1+vYaqC6AW7YssCKuPTlqI/f+N7CwReh2uCMGPsMwQllJGOyJKAmnl
	OLytUATF4Bq43dxtX1iFR7KQE1+z/HceYMF97F3YhOWkkSHfAkxmWsN6L+kWHpeSIU1M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/PoD: deal with misaligned GFNs
Message-Id: <E1mr0IB-00021D-Rz@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:11:11 +0000

commit 182c737b9ba540ebceb1433f3940fbed6eac4ea9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Nov 22 11:11:44 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 22 12:27:30 2021 +0000

    x86/PoD: deal with misaligned GFNs
    
    Users of XENMEM_decrease_reservation and XENMEM_populate_physmap aren't
    required to pass in order-aligned GFN values. (While I consider this
    bogus, I don't think we can fix this there, as that might break existing
    code, e.g Linux'es swiotlb, which - while affecting PV only - until
    recently had been enforcing only page alignment on the original
    allocation.) Only non-PoD code paths (guest_physmap_{add,remove}_page(),
    p2m_set_entry()) look to be dealing with this properly (in part by being
    implemented inefficiently, handling every 4k page separately).
    
    Introduce wrappers taking care of splitting the incoming request into
    aligned chunks, without putting much effort in trying to determine the
    largest possible chunk at every iteration.
    
    Also "handle" p2m_set_entry() failure for non-order-0 requests by
    crashing the domain in one more place. Alongside putting a log message
    there, also add one to the other similar path.
    
    Note regarding locking: This is left in the actual worker functions on
    the assumption that callers aren't guaranteed atomicity wrt acting on
    multiple pages at a time. For mis-aligned GFNs gfn_lock() wouldn't have
    locked the correct GFN range anyway, if it didn't simply resolve to
    p2m_lock(), and for well-behaved callers there continues to be only a
    single iteration, i.e. behavior is unchanged for them. (FTAOD pulling
    out just pod_lock() into p2m_pod_decrease_reservation() would result in
    a lock order violation.)
    
    This is CVE-2021-28704 and CVE-2021-28707 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m-pod.c | 75 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 63 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index d0134755e5..20e6327b75 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -504,7 +504,7 @@ static void pod_unlock_and_flush(struct p2m_domain *p2m)
 }
 
 /*
- * This function is needed for two reasons:
+ * This pair of functions is needed for two reasons:
  * + To properly handle clearing of PoD entries
  * + To "steal back" memory being freed for the PoD cache, rather than
  *   releasing it.
@@ -512,8 +512,8 @@ static void pod_unlock_and_flush(struct p2m_domain *p2m)
  * Once both of these functions have been completed, we can return and
  * allow decrease_reservation() to handle everything else.
  */
-unsigned long
-p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+static unsigned long
+decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
 {
     unsigned long ret = 0, i, n;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -561,8 +561,10 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
          * All PoD: Mark the whole region invalid and tell caller
          * we're done.
          */
-        if ( p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
-                           p2m->default_access) )
+        int rc = p2m_set_entry(p2m, gfn, INVALID_MFN, order, p2m_invalid,
+                               p2m->default_access);
+
+        if ( rc )
         {
             /*
              * If this fails, we can't tell how much of the range was changed.
@@ -570,7 +572,12 @@ p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
              * impossible.
              */
             if ( order != 0 )
+            {
+                printk(XENLOG_G_ERR
+                       "%pd: marking GFN %#lx (order %u) as non-PoD failed: %d\n",
+                       d, gfn_x(gfn), order, rc);
                 domain_crash(d);
+            }
             goto out_unlock;
         }
         ret = 1UL << order;
@@ -679,6 +686,22 @@ out_unlock:
     return ret;
 }
 
+unsigned long
+p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
+{
+    unsigned long left = 1UL << order, ret = 0;
+    unsigned int chunk_order = find_first_set_bit(gfn_x(gfn) | left);
+
+    do {
+        ret += decrease_reservation(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn = gfn_add(gfn, 1UL << chunk_order);
+    } while ( left );
+
+    return ret;
+}
+
 void p2m_pod_dump_data(struct domain *d)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -1289,19 +1312,15 @@ remap_and_retry:
     return true;
 }
 
-
-int
-guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
-                                      unsigned int order)
+static int
+mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
+                        unsigned int order)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     gfn_t gfn = _gfn(gfn_l);
     unsigned long i, n, pod_count = 0;
     int rc = 0;
 
-    if ( !paging_mode_translate(d) )
-        return -EINVAL;
-
     gfn_lock(p2m, gfn, order);
 
     P2M_DEBUG("mark pod gfn=%#lx\n", gfn_l);
@@ -1341,6 +1360,17 @@ guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
 
         ioreq_request_mapcache_invalidate(d);
     }
+    else if ( order )
+    {
+        /*
+         * If this failed, we can't tell how much of the range was changed.
+         * Best to crash the domain.
+         */
+        printk(XENLOG_G_ERR
+               "%pd: marking GFN %#lx (order %u) as PoD failed: %d\n",
+               d, gfn_l, order, rc);
+        domain_crash(d);
+    }
 
 out:
     gfn_unlock(p2m, gfn, order);
@@ -1348,6 +1378,27 @@ out:
     return rc;
 }
 
+int
+guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
+                                      unsigned int order)
+{
+    unsigned long left = 1UL << order;
+    unsigned int chunk_order = find_first_set_bit(gfn | left);
+    int rc;
+
+    if ( !paging_mode_translate(d) )
+        return -EINVAL;
+
+    do {
+        rc = mark_populate_on_demand(d, gfn, chunk_order);
+
+        left -= 1UL << chunk_order;
+        gfn += 1UL << chunk_order;
+    } while ( !rc && left );
+
+    return rc;
+}
+
 void p2m_pod_init(struct p2m_domain *p2m)
 {
     unsigned int i;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:11:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.233983.406082 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0IN-0002fo-V5; Sat, 27 Nov 2021 16:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 233983.406082; Sat, 27 Nov 2021 16: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 1mr0IN-0002fh-S5; Sat, 27 Nov 2021 16:11:23 +0000
Received: by outflank-mailman (input) for mailman id 233983;
 Sat, 27 Nov 2021 16: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 1mr0IM-0002fM-0g
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16: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 1mr0IL-00070x-W6
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:11:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0IL-00021m-VB
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:11:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YDLF5c9MVLstY7Uu2AV6KRs8U3jPQ/Ou8ACLCIwBKeY=; b=DsyD26GFVrf9G29yBNjaUoYiox
	P0P/mZV948H7x4mDPF6OJzRFx3k8zVsaKroZQLsPiYDhietnJhLBqJLVyHlrvKNaTcXMM63zwWZ2A
	F9nvUhmvHOn9en1GryX7J0IMxcH/BZx1rqXf7eFvTtfUaS0APX8ruNe0IEG2XdOoTKBw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
Message-Id: <E1mr0IL-00021m-VB@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:11:21 +0000

commit 8ec13f68e0b026863d23e7f44f252d06478bc809
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Nov 22 11:11:44 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 22 12:27:30 2021 +0000

    x86/PoD: handle intermediate page orders in p2m_pod_cache_add()
    
    p2m_pod_decrease_reservation() may pass pages to the function which
    aren't 4k, 2M, or 1G. Handle all intermediate orders as well, to avoid
    hitting the BUG() at the switch() statement's "default" case.
    
    This is CVE-2021-28708 / part of XSA-388.
    
    Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m-pod.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index 20e6327b75..d8d1a0ce7e 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -113,15 +113,13 @@ p2m_pod_cache_add(struct p2m_domain *p2m,
     /* Then add to the appropriate populate-on-demand list. */
     switch ( order )
     {
-    case PAGE_ORDER_1G:
-        for ( i = 0; i < (1UL << PAGE_ORDER_1G); i += 1UL << PAGE_ORDER_2M )
+    case PAGE_ORDER_2M ... PAGE_ORDER_1G:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_2M )
             page_list_add_tail(page + i, &p2m->pod.super);
         break;
-    case PAGE_ORDER_2M:
-        page_list_add_tail(page, &p2m->pod.super);
-        break;
-    case PAGE_ORDER_4K:
-        page_list_add_tail(page, &p2m->pod.single);
+    case PAGE_ORDER_4K ... PAGE_ORDER_2M - 1:
+        for ( i = 0; i < (1UL << order); i += 1UL << PAGE_ORDER_4K )
+            page_list_add_tail(page + i, &p2m->pod.single);
         break;
     default:
         BUG();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:11:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.233984.406086 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0IY-0002ig-0i; Sat, 27 Nov 2021 16:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 233984.406086; Sat, 27 Nov 2021 16:11:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0IX-0002iY-Tl; Sat, 27 Nov 2021 16:11:33 +0000
Received: by outflank-mailman (input) for mailman id 233984;
 Sat, 27 Nov 2021 16: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 1mr0IW-0002iF-4H
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16: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 1mr0IW-00071D-3E
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0IW-00022T-2I
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16: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=pNhspmNkYQNWEgQbBriVz8r/BBX8s3LVAW189qMRDM8=; b=iWQL2tySnStAa7WViPuLw+YnNF
	W3o0NSQqRkPRrt5I1oGcYGb739xmaT5fsJKYvcTnnby2daXjxpjGCx2PSVlkX/s2MMGeVVYyTQJTN
	jdCiPwIcaGGoXZl2j/52X7L0IUqSuJEbSavuDq6JhVq7YOTIqdMCqG79UR+gLDiDt89s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/P2M: deal with partial success of p2m_set_entry()
Message-Id: <E1mr0IW-00022T-2I@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:11:32 +0000

commit 74a11c43fd7e074b1f77631b446dd2115eacb9e8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Nov 22 11:12:32 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Nov 22 12:27:30 2021 +0000

    x86/P2M: deal with partial success of p2m_set_entry()
    
    M2P and PoD stats need to remain in sync with P2M; if an update succeeds
    only partially, respective adjustments need to be made. If updates get
    made before the call, they may also need undoing upon complete failure
    (i.e. including the single-page case).
    
    Log-dirty state would better also be kept in sync.
    
    Note that the change to set_typed_p2m_entry() may not be strictly
    necessary (due to the order restriction enforced near the top of the
    function), but is being kept here to be on the safe side.
    
    This is CVE-2021-28705 and CVE-2021-28709 / XSA-389.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c | 116 ++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 102 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 2bd4d37286..def1695cf0 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -794,6 +794,7 @@ p2m_remove_page(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
     unsigned long i;
     p2m_type_t t;
     p2m_access_t a;
+    int rc;
 
     ASSERT(gfn_locked_by_me(p2m, gfn));
     P2M_DEBUG("removing gfn=%#lx mfn=%#lx\n", gfn_x(gfn), mfn_x(mfn));
@@ -825,8 +826,27 @@ 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);
+    rc = p2m_set_entry(p2m, gfn, INVALID_MFN, page_order, p2m_invalid,
+                       p2m->default_access);
+    if ( likely(!rc) || !mfn_valid(mfn) )
+        return rc;
+
+    /*
+     * The operation may have partially succeeded. For the failed part we need
+     * to undo the M2P update and, out of precaution, mark the pages dirty
+     * again.
+     */
+    for ( i = 0; i < (1UL << page_order); ++i )
+    {
+        p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0, NULL, NULL);
+        if ( !p2m_is_hole(t) && !p2m_is_special(t) && !p2m_is_shared(t) )
+        {
+            set_gpfn_from_mfn(mfn_x(mfn) + i, gfn_x(gfn) + i);
+            paging_mark_pfn_dirty(p2m->domain, _pfn(gfn_x(gfn) + i));
+        }
+    }
+
+    return rc;
 }
 
 int
@@ -1022,13 +1042,8 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
 
     /* Now, actually do the two-way mapping */
     rc = p2m_set_entry(p2m, gfn, mfn, page_order, t, p2m->default_access);
-    if ( rc == 0 )
+    if ( likely(!rc) )
     {
-        pod_lock(p2m);
-        p2m->pod.entry_count -= pod_count;
-        BUG_ON(p2m->pod.entry_count < 0);
-        pod_unlock(p2m);
-
         if ( !p2m_is_grant(t) )
         {
             for ( i = 0; i < (1UL << page_order); i++ )
@@ -1036,6 +1051,42 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                                   gfn_x(gfn_add(gfn, i)));
         }
     }
+    else
+    {
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update M2P and dirty state, while for the failed part we
+         * may need to adjust PoD stats as well as undo the earlier M2P update.
+         */
+        for ( i = 0; i < (1UL << page_order); ++i )
+        {
+            omfn = p2m->get_entry(p2m, gfn_add(gfn, i), &ot, &a, 0, NULL, NULL);
+            if ( p2m_is_pod(ot) )
+            {
+                BUG_ON(!pod_count);
+                --pod_count;
+            }
+            else if ( mfn_eq(omfn, mfn_add(mfn, i)) && ot == t &&
+                      a == p2m->default_access && !p2m_is_grant(t) )
+            {
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+                paging_mark_pfn_dirty(d, _pfn(gfn_x(gfn) + i));
+            }
+            else if ( p2m_is_ram(ot) && !p2m_is_paged(ot) )
+            {
+                ASSERT(mfn_valid(omfn));
+                set_gpfn_from_mfn(mfn_x(omfn), gfn_x(gfn) + i);
+            }
+        }
+    }
+
+    if ( pod_count )
+    {
+        pod_lock(p2m);
+        p2m->pod.entry_count -= pod_count;
+        BUG_ON(p2m->pod.entry_count < 0);
+        pod_unlock(p2m);
+    }
 
 out:
     p2m_unlock(p2m);
@@ -1325,6 +1376,49 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
             return 0;
         }
     }
+
+    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
+    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
+    if ( unlikely(rc) )
+    {
+        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
+                 gfn_l, order, rc, mfn_x(mfn));
+
+        /*
+         * The operation may have partially succeeded. For the successful part
+         * we need to update PoD stats, M2P, and dirty state.
+         */
+        if ( order != PAGE_ORDER_4K )
+        {
+            unsigned long i;
+
+            for ( i = 0; i < (1UL << order); ++i )
+            {
+                p2m_type_t t;
+                mfn_t cmfn = p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0,
+                                            NULL, NULL);
+
+                if ( !mfn_eq(cmfn, mfn_add(mfn, i)) || t != gfn_p2mt ||
+                     a != access )
+                    continue;
+
+                if ( p2m_is_ram(ot) )
+                {
+                    ASSERT(mfn_valid(mfn_add(omfn, i)));
+                    set_gpfn_from_mfn(mfn_x(omfn) + i, INVALID_M2P_ENTRY);
+
+                    ioreq_request_mapcache_invalidate(d);
+                }
+                else if ( p2m_is_pod(ot) )
+                {
+                    pod_lock(p2m);
+                    BUG_ON(!p2m->pod.entry_count);
+                    --p2m->pod.entry_count;
+                    pod_unlock(p2m);
+                }
+            }
+        }
+    }
     else if ( p2m_is_ram(ot) )
     {
         unsigned long i;
@@ -1337,12 +1431,6 @@ static int set_typed_p2m_entry(struct domain *d, unsigned long gfn_l,
 
         ioreq_request_mapcache_invalidate(d);
     }
-
-    P2M_DEBUG("set %d %lx %lx\n", gfn_p2mt, gfn_l, mfn_x(mfn));
-    rc = p2m_set_entry(p2m, gfn, mfn, order, gfn_p2mt, access);
-    if ( rc )
-        gdprintk(XENLOG_ERR, "p2m_set_entry: %#lx:%u -> %d (0x%"PRI_mfn")\n",
-                 gfn_l, order, rc, mfn_x(mfn));
     else if ( p2m_is_pod(ot) )
     {
         pod_lock(p2m);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:11:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.233985.406089 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0Ii-0002lx-2C; Sat, 27 Nov 2021 16:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 233985.406089; Sat, 27 Nov 2021 16: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 1mr0Ih-0002lp-VG; Sat, 27 Nov 2021 16:11:43 +0000
Received: by outflank-mailman (input) for mailman id 233985;
 Sat, 27 Nov 2021 16: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 1mr0Ig-0002lZ-7V
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16: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 1mr0Ig-00071N-6k
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0Ig-000238-5p
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16: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=yjfP6UbPNmAqIWR3sqg1AaFpmOqBuWGgQk5AdgJexU8=; b=XxFbOmdMxL7NhNnT0FJdyw4LW8
	/P44fWrMxeL/oDuUPoowj8mvJ52/rE/mApOiGbZtakJpF9ynewVv4pvB/58mLKeUvYbOnv2438E4T
	XroZ0XiEv7mmlaGYfINRgaKWOqTl6EJ5h2CBKiJFh8otuJtOuU0rKHYsues8usIWyV7o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Revert "Config.mk: pin QEMU_UPSTREAM_REVISION (prep for Xen 4.16 RC1)"
Message-Id: <E1mr0Ig-000238-5p@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:11:42 +0000

commit 4fe6e73a8cc8f3fa93a7c6a52a9a03b24e51ea18
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 23 16:51:47 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 23 16:51:47 2021 +0000

    Revert "Config.mk: pin QEMU_UPSTREAM_REVISION (prep for Xen 4.16 RC1)"
    
    This branch is unstable again now.
    
    This reverts commit c9ce6afbf2d7772f47fc572bb7fc9555724927ed.
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 6be010c7ce..6587c7d626 100644
--- a/Config.mk
+++ b/Config.mk
@@ -239,7 +239,7 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
-QEMU_UPSTREAM_REVISION ?= b6e539830bf45e2d7a6bd86ddfdf003088b173b0
+QEMU_UPSTREAM_REVISION ?= master
 MINIOS_UPSTREAM_REVISION ?= 9f09744aa3e5982a083ecf8e9cd2123f477081f9
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:11:53 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.233986.406094 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0Ir-0002p5-4n; Sat, 27 Nov 2021 16:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 233986.406094; Sat, 27 Nov 2021 16:11:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0Ir-0002ox-1y; Sat, 27 Nov 2021 16:11:53 +0000
Received: by outflank-mailman (input) for mailman id 233986;
 Sat, 27 Nov 2021 16: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 1mr0Iq-0002oc-Ag
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16: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 1mr0Iq-00071q-9p
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0Iq-00023n-8z
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16: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=1/Fn7XrseHYkbDhAUz+0xc0CKKZouey/BYnIRSVlADU=; b=6ZPrA4dlgI5UY1UHiMSMb+Mo6Q
	WHXBZ3HWIspaDgoLjnQW1JwCMQpQubqXADsTGZ/mb+SOCSQXnU6Ba7swlCW0LAS0uWf0ifGx6FyY+
	77O/W6NRU423f1Fu/NIfLAK8Arz8dGpBckdU1fscjHLVcE8xArMiGUMM4Tp300n/OkIU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Set version to 4.17; 4.16 has branched
Message-Id: <E1mr0Iq-00023n-8z@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:11:52 +0000

commit 8579d208ab78486717d396cb297f06526fe6b492
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 23 16:54:08 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 23 16:54:18 2021 +0000

    Set version to 4.17; 4.16 has branched
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 README       | 10 +++++-----
 xen/Makefile |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/README b/README
index a626e56436..562b808080 100644
--- a/README
+++ b/README
@@ -1,9 +1,9 @@
 ############################################################
-__  __            _  _    _  __
-\ \/ /___ _ __   | || |  / |/ /_        _ __ ___
- \  // _ \ '_ \  | || |_ | | '_ \ _____| '__/ __|
- /  \  __/ | | | |__   _|| | (_) |_____| | | (__
-/_/\_\___|_| |_|    |_|(_)_|\___/      |_|  \___|
+__  __                                _        _     _
+\ \/ /___ _ __        _   _ _ __  ___| |_ __ _| |__ | | ___
+ \  // _ \ '_ \ _____| | | | '_ \/ __| __/ _` | '_ \| |/ _ \
+ /  \  __/ | | |_____| |_| | | | \__ \ || (_| | |_) | |  __/
+/_/\_\___|_| |_|      \__,_|_| |_|___/\__\__,_|_.__/|_|\___|
 
 ############################################################
 
diff --git a/xen/Makefile b/xen/Makefile
index 2fc83f266b..1fd48af7ae 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -1,8 +1,8 @@
 # This is the correct place to edit the build version.
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
-export XEN_SUBVERSION    = 16
-export XEN_EXTRAVERSION ?= -rc$(XEN_VENDORVERSION)
+export XEN_SUBVERSION    = 17
+export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:12:03 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:12:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.233987.406098 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0J1-0002sJ-6W; Sat, 27 Nov 2021 16:12:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 233987.406098; Sat, 27 Nov 2021 16:12:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0J1-0002sB-3Q; Sat, 27 Nov 2021 16:12:03 +0000
Received: by outflank-mailman (input) for mailman id 233987;
 Sat, 27 Nov 2021 16:12:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0J0-0002s3-Eh
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16: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 1mr0J0-00072F-Dq
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0J0-00024X-Cu
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16: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=GsF/G+vjXL6L4TdFYQ5/I9EZqt0CfIofuNKm/R/r1f0=; b=PiMenZvLA4j6iVxy8dTyt+S0c8
	durPIYr59E8kFzxnsRrXXSnrczqlY6LNASJoIgvybnDqVdyzPw1339rYTG0bttv20Sf51tQio3n9m
	dOuU7odY0yskE/b0XauaAywDfho5OGXfI54mAaj88TjayYjRnf1rAaQLkWeInU30eaa4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Set version to 4.17: rerun autogen.sh
Message-Id: <E1mr0J0-00024X-Cu@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:12:02 +0000

commit a5706b80f42e028c5153fc50734a1e86a99ff9d2
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 23 16:55:32 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 23 16:55:32 2021 +0000

    Set version to 4.17: rerun autogen.sh
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 configure         | 18 +++++++++---------
 docs/configure    | 18 +++++++++---------
 stubdom/configure | 18 +++++++++---------
 tools/configure   | 18 +++++++++---------
 4 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/configure b/configure
index 62f6c2d47a..502273b263 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Xen Hypervisor 4.16.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor 4.17.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.16'
-PACKAGE_STRING='Xen Hypervisor 4.16'
+PACKAGE_VERSION='4.17'
+PACKAGE_STRING='Xen Hypervisor 4.17'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1236,7 +1236,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor 4.16 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor 4.17 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1302,7 +1302,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor 4.16:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor 4.17:";;
    esac
   cat <<\_ACEOF
 
@@ -1403,7 +1403,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor configure 4.16
+Xen Hypervisor configure 4.17
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1420,7 +1420,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor $as_me 4.16, which was
+It was created by Xen Hypervisor $as_me 4.17, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2868,7 +2868,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor $as_me 4.16, which was
+This file was extended by Xen Hypervisor $as_me 4.17, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -2922,7 +2922,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor config.status 4.16
+Xen Hypervisor config.status 4.17
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/docs/configure b/docs/configure
index 569bd4c2ff..f93d086e9a 100755
--- a/docs/configure
+++ b/docs/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Xen Hypervisor Documentation 4.16.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor Documentation 4.17.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Documentation'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.16'
-PACKAGE_STRING='Xen Hypervisor Documentation 4.16'
+PACKAGE_VERSION='4.17'
+PACKAGE_STRING='Xen Hypervisor Documentation 4.17'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1224,7 +1224,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor Documentation 4.16 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Documentation 4.17 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1286,7 +1286,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Documentation 4.16:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Documentation 4.17:";;
    esac
   cat <<\_ACEOF
 
@@ -1387,7 +1387,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Documentation configure 4.16
+Xen Hypervisor Documentation configure 4.17
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1404,7 +1404,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor Documentation $as_me 4.16, which was
+It was created by Xen Hypervisor Documentation $as_me 4.17, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2821,7 +2821,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor Documentation $as_me 4.16, which was
+This file was extended by Xen Hypervisor Documentation $as_me 4.17, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -2875,7 +2875,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor Documentation config.status 4.16
+Xen Hypervisor Documentation config.status 4.17
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/stubdom/configure b/stubdom/configure
index 07b709f998..5b265b5369 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Xen Hypervisor Stub Domains 4.16.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor Stub Domains 4.17.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Stub Domains'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.16'
-PACKAGE_STRING='Xen Hypervisor Stub Domains 4.16'
+PACKAGE_VERSION='4.17'
+PACKAGE_STRING='Xen Hypervisor Stub Domains 4.17'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1265,7 +1265,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor Stub Domains 4.16 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Stub Domains 4.17 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1331,7 +1331,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Stub Domains 4.16:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Stub Domains 4.17:";;
    esac
   cat <<\_ACEOF
 
@@ -1444,7 +1444,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Stub Domains configure 4.16
+Xen Hypervisor Stub Domains configure 4.17
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1499,7 +1499,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor Stub Domains $as_me 4.16, which was
+It was created by Xen Hypervisor Stub Domains $as_me 4.17, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -4283,7 +4283,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor Stub Domains $as_me 4.16, which was
+This file was extended by Xen Hypervisor Stub Domains $as_me 4.17, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -4337,7 +4337,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor Stub Domains config.status 4.16
+Xen Hypervisor Stub Domains config.status 4.17
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/tools/configure b/tools/configure
index 40f970b14b..21e3a83795 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Xen Hypervisor Tools 4.16.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor Tools 4.17.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Tools'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.16'
-PACKAGE_STRING='Xen Hypervisor Tools 4.16'
+PACKAGE_VERSION='4.17'
+PACKAGE_STRING='Xen Hypervisor Tools 4.17'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1415,7 +1415,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor Tools 4.16 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Tools 4.17 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1481,7 +1481,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Tools 4.16:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Tools 4.17:";;
    esac
   cat <<\_ACEOF
 
@@ -1689,7 +1689,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Tools configure 4.16
+Xen Hypervisor Tools configure 4.17
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2104,7 +2104,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor Tools $as_me 4.16, which was
+It was created by Xen Hypervisor Tools $as_me 4.17, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -10685,7 +10685,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor Tools $as_me 4.16, which was
+This file was extended by Xen Hypervisor Tools $as_me 4.17, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -10748,7 +10748,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor Tools config.status 4.16
+Xen Hypervisor Tools config.status 4.17
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:12:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:12:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.233988.406102 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0JB-0002ur-8I; Sat, 27 Nov 2021 16:12:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 233988.406102; Sat, 27 Nov 2021 16: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 1mr0JB-0002ui-5C; Sat, 27 Nov 2021 16:12:13 +0000
Received: by outflank-mailman (input) for mailman id 233988;
 Sat, 27 Nov 2021 16:12:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0JA-0002uW-Ht
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:12:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0JA-00072U-H5
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0JA-000259-GJ
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:12:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3PShPDHY8G6k/YCJ6viS3sdTXM5JEqzFTGe+n+Z6X8g=; b=iEjvE4Enu1dmCo8A3tsj6cxdUX
	Je5aelXuFuOwobdrWY4VSaqkr7p8sqAOHgMLncgIIsCHSjcm0QjY2yYZWd5XJv0+ET5widPoO/wB6
	SWhSxXqIzljj+5+Gi+L7pgy/G3qyxg5eg0NChuzv7Lu0t0+6Fn98OxysJtF8u62hTwQo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/PV: drop "vcpu" local variable from show_guest_stack()
Message-Id: <E1mr0JA-000259-GJ@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:12:12 +0000

commit 95d1511fe0a3e603e2604574da65d2eb8c541baf
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:01:05 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:01:05 2021 +0100

    x86/PV: drop "vcpu" local variable from show_guest_stack()
    
    It's not really needed and has been misleading me more than once to try
    and spot its "actual" use(s). It should really have been dropped when
    the 32-bit specific logic was purged from here.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/traps.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index d483aa91f2..84c9d9686a 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -327,16 +327,13 @@ static void show_guest_stack(struct vcpu *v, const struct cpu_user_regs *regs)
 
     if ( v != current )
     {
-        struct vcpu *vcpu;
-
         if ( !guest_kernel_mode(v, regs) )
         {
             printk("User mode stack\n");
             return;
         }
 
-        vcpu = maddr_get_owner(read_cr3()) == v->domain ? v : NULL;
-        if ( !vcpu )
+        if ( maddr_get_owner(read_cr3()) != v->domain )
         {
             stack_page = stack = do_page_walk(v, (unsigned long)stack);
             if ( (unsigned long)stack < PAGE_SIZE )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:12:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:12:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.233989.406106 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0JL-0002xe-9p; Sat, 27 Nov 2021 16:12:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 233989.406106; Sat, 27 Nov 2021 16: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 1mr0JL-0002xW-6f; Sat, 27 Nov 2021 16:12:23 +0000
Received: by outflank-mailman (input) for mailman id 233989;
 Sat, 27 Nov 2021 16:12:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0JK-0002xN-Ko
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:12:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0JK-00074G-K6
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:12:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0JK-000262-JQ
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:12:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=znR7CPaiEGPDmJZArojNwFPgP8mqxnTMbQz++8zDZoE=; b=ci/bvlgBO52wfTKSMsV7M3o4I0
	OUO+Owr8sJH6dM5X1A0BAGbB+fpEgOP52dUYSdIy764EfSQ5YdDmi4Zc8l0qecS2MohcS1v0OenHK
	cLw3S0tGKTJ2N8JaEf8bn2z2IslzvqB2vy07Fa9XsacS0CjlJu3uNn6zoK4oT+SWrSn8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: modify hvm_memory_op() prototype
Message-Id: <E1mr0JK-000262-JQ@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:12:22 +0000

commit 5168b6ee9139dbebe5771482664b329c8644e2df
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Nov 24 11:02:24 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:02:24 2021 +0100

    x86: modify hvm_memory_op() prototype
    
    hvm_memory_op() should take an unsigned long as cmd, like
    do_memory_op().
    
    As hvm_memory_op() is basically just calling do_memory_op() (or
    compat_memory_op()) passing through the parameters the cmd parameter
    should have no smaller size than that of the called functions.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hypercall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index 122abf80de..63bed52e40 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -31,7 +31,7 @@
 #include <public/hvm/hvm_op.h>
 #include <public/hvm/params.h>
 
-static long hvm_memory_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
+static long hvm_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
     long rc;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:12:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:12:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.233990.406110 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0JV-00030X-B3; Sat, 27 Nov 2021 16:12:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 233990.406110; Sat, 27 Nov 2021 16: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 1mr0JV-00030P-8D; Sat, 27 Nov 2021 16:12:33 +0000
Received: by outflank-mailman (input) for mailman id 233990;
 Sat, 27 Nov 2021 16:12:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0JU-00030H-Nr
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:12:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0JU-00074L-N7
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:12:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0JU-00026i-MR
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:12:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tJCU3QdHLTqEJqquV9z1neVW7ZnPeLu0MQ1bZyJfpjk=; b=qWsjOeP88NCBsXQ0MnhjQrgtWY
	vmRXNgYWvVFLpsAkWemeNcblHwC7SUBtwumhouIrpEL3EFD9Ikrv54aMYd3lZZoZ1iqEtDUQBr0FM
	2INONTCc/se7CLI+Mvr9uct6fffaaugR48t0rrS2qJCNzhSv/9c/v2r/GYb71mueAVlc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] add .gitignore entries for *.[is] below xen
Message-Id: <E1mr0JU-00026i-MR@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:12:32 +0000

commit e1e1da600b8ab4264f242fc735702f5425165923
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Nov 24 11:03:09 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:03:09 2021 +0100

    add .gitignore entries for *.[is] below xen
    
    Instead of listing each single file with .s or .i suffixes in
    .gitignore use pattern based entries. Restrict those to the xen
    directory as we have e.g. tools/libs/stat/bindings/swig/xenstat.i in
    our tree.
    
    Below xen the pattern based entries are fine, as we have pattern rules
    for creating *.s and *.i files in xen/Rules.mk.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 .gitignore | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 8ebb51b6c5..9513506dd9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -301,12 +301,13 @@ tools/xentrace/xentrace_setsize
 tools/xentrace/tbctl
 tools/xentrace/xenctx
 tools/xentrace/xentrace
+xen/**/*.i
+xen/**/*.s
 xen/.banner
 xen/.config
 xen/.config.old
 xen/.xen.elf32
 xen/System.map
-xen/arch/x86/asm-macros.i
 xen/arch/x86/boot/mkelf32
 xen/arch/x86/boot/cmdline.S
 xen/arch/x86/boot/reloc.S
@@ -322,7 +323,6 @@ xen/arch/*/efi/ebmalloc.c
 xen/arch/*/efi/efi.h
 xen/arch/*/efi/pe.c
 xen/arch/*/efi/runtime.c
-xen/asm-offsets.s
 xen/common/config_data.S
 xen/common/config.gz
 xen/include/headers*.chk
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:12:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:12:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.233993.406128 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0Jf-0003JZ-LQ; Sat, 27 Nov 2021 16:12:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 233993.406128; Sat, 27 Nov 2021 16: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 1mr0Jf-0003JN-IQ; Sat, 27 Nov 2021 16:12:43 +0000
Received: by outflank-mailman (input) for mailman id 233993;
 Sat, 27 Nov 2021 16:12:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0Je-0003J7-Qv
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:12:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0Je-00074b-Q6
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:12:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0Je-00027X-PJ
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:12:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wAiJhpHqvTIyXWpoR2lLy2CIuA9oM/g3khnwmGjA70Q=; b=CZKuDAG7OstNDJ2Uyqy0/FXQsy
	FmQ3e1CtJRfgpbpnYUSwFFjbxvJ5thzx3j05xTvRo6S3yb1pCyWNKDpmA42h9hfQrXguw8ywdC/Yj
	oLwDfXTNzFzr5dZasIgPl//1WPd31aLGLYgPE+BUqDmgWEf0DVnqUQUCnzZQFZi71UrE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: prune super-page related capability macros
Message-Id: <E1mr0Je-00027X-PJ@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:12:42 +0000

commit 0e74f62d038697d9f26052fb33bdd8325fcc4785
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:03:52 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:03:52 2021 +0100

    VT-d: prune super-page related capability macros
    
    cap_super_page_val() and cap_super_offset() are unused (apart from the
    latter using the former). I don't see how cap_super_offset() can be
    useful in its current shape: cap_super_page_val()'s result is not an
    lvalue and hence can't have its address taken. Plus a user would have
    to check the capability register field is non-zero, for
    find_first_bit() (or find_first_set_bit(), if suitably corrected) to be
    valid in the first place. Yet as per the spec when the field is non-zero
    the low bit would always be set, so the result would be independent of
    the actual value the field holds.
    
    Further zap cap_sps_512gb() and cap_sps_1tb(). While earlier versions
    of the spec had things spelled out that way, the current version marks
    the two bits as reserved. And "48-bit offset to page frame" wasn't in
    line with 1Tb pages anyway - clearly 256Tb pages would have been meant
    here.
    
    Finally properly parenthesize parameter uses in the remaining two
    macros.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.h | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h
index ee28ecac6d..b993f0cf08 100644
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -68,13 +68,8 @@
 #define cap_num_fault_regs(c)  ((((c) >> 40) & 0xff) + 1)
 #define cap_pgsel_inv(c)       (((c) >> 39) & 1)
 
-#define cap_super_page_val(c)  (((c) >> 34) & 0xf)
-#define cap_super_offset(c)    (((find_first_bit(&cap_super_page_val(c), 4)) \
-                                 * OFFSET_STRIDE) + 21)
-#define cap_sps_2mb(c)         ((c >> 34) & 1)
-#define cap_sps_1gb(c)         ((c >> 35) & 1)
-#define cap_sps_512gb(c)       ((c >> 36) & 1)
-#define cap_sps_1tb(c)         ((c >> 37) & 1)
+#define cap_sps_2mb(c)         (((c) >> 34) & 1)
+#define cap_sps_1gb(c)         (((c) >> 35) & 1)
 
 #define cap_fault_reg_offset(c)    ((((c) >> 24) & 0x3ff) * 16)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:12:53 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:12:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.233994.406133 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0Jp-0003QB-OP; Sat, 27 Nov 2021 16:12:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 233994.406133; Sat, 27 Nov 2021 16:12: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 1mr0Jp-0003Pw-L6; Sat, 27 Nov 2021 16:12:53 +0000
Received: by outflank-mailman (input) for mailman id 233994;
 Sat, 27 Nov 2021 16:12: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 1mr0Jo-0003Pb-Tt
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:12: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 1mr0Jo-00074w-T6
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:12:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0Jo-00029x-SN
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:12: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=N2RPC0ZCc72mJRWePOQrew6Vd3FRf9tHNTJ7Z0offvA=; b=Yxe6fcuwHujJ+m2I+Siv5rtzc+
	9eA8lcxyJzhxWjv/2ipPisl3br/9n8PMee44607o0A4wu6Q2Fb8Htk9oJwIAPlXVMWvUeqYKEWYIj
	x0uu00gp1sawuc02n05ZWyhCLSzy+NfR7VwgEge4GQ95wKULOyM2CqBiFa66024H5N6s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: don't needlessly engage the untrusted-MSI workaround
Message-Id: <E1mr0Jo-00029x-SN@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:12:52 +0000

commit d5c39d5f8da6a39d98fa4b5e5d7b7528dcf34e7c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:04:32 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:04:32 2021 +0100

    VT-d: don't needlessly engage the untrusted-MSI workaround
    
    The quarantine domain doesn't count as a DomU, as it won't itself
    trigger any bad behavior. The workaround only needs enabling when an
    actual DomU is about to gain control of a device. This then also means
    enabling of the workaround can be deferred until immediately ahead of
    the call to domain_context_mapping(). While there also stop open-coding
    is_hardware_domain().
    
    Fixes: 319f9a0ba94c ("passthrough: quarantine PCI devices")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index f9ce402f22..5de9a73f56 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2403,14 +2403,6 @@ static int reassign_device_ownership(
 {
     int ret;
 
-    /*
-     * Devices assigned to untrusted domains (here assumed to be any domU)
-     * can attempt to send arbitrary LAPIC/MSI messages. We are unprotected
-     * by the root complex unless interrupt remapping is enabled.
-     */
-    if ( (target != hardware_domain) && !iommu_intremap )
-        untrusted_msi = true;
-
     /*
      * If the device belongs to the hardware domain, and it has RMRR, don't
      * remove it from the hardware domain, because BIOS may use RMRR at
@@ -2455,6 +2447,15 @@ static int reassign_device_ownership(
     if ( !has_arch_pdevs(target) )
         vmx_pi_hooks_assign(target);
 
+    /*
+     * Devices assigned to untrusted domains (here assumed to be any domU)
+     * can attempt to send arbitrary LAPIC/MSI messages. We are unprotected
+     * by the root complex unless interrupt remapping is enabled.
+     */
+    if ( !iommu_intremap && !is_hardware_domain(target) &&
+         !is_system_domain(target) )
+        untrusted_msi = true;
+
     ret = domain_context_mapping(target, devfn, pdev);
     if ( ret )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:13:03 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:13:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.233995.406136 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0Jz-0003bQ-Pv; Sat, 27 Nov 2021 16:13:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 233995.406136; Sat, 27 Nov 2021 16:13: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 1mr0Jz-0003b8-Mm; Sat, 27 Nov 2021 16:13:03 +0000
Received: by outflank-mailman (input) for mailman id 233995;
 Sat, 27 Nov 2021 16: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 1mr0Jz-0003az-12
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16: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 1mr0Jz-00075D-0J
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:13:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0Jy-0002Ak-Vi
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:13: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=u8R/buz+q9WFibC+hpfAI6Oqh1OQLVJNlERNAXMsgLE=; b=wSN9uSdR5zqThF8mm70SLoN+8g
	gWPOzh1gZOPblqhl71Flbxy2FyXyj2sIJbvWKhBUwG0oKPfg61IVM2glvit7GzDb0WZ1PzHr7XGvT
	Fh4UMg4TuKN8+P4I5mZgUsElRwmDMnfF1v8B8TXnVfu1nLajd18au2Alb/tatnqcD/+w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: properly reserve DID 0 for caching mode IOMMUs
Message-Id: <E1mr0Jy-0002Ak-Vi@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:13:02 +0000

commit b111a41acd383c42c35707dbb1849d366ca43cce
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:05:36 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:05:36 2021 +0100

    VT-d: properly reserve DID 0 for caching mode IOMMUs
    
    Merely setting bit 0 in the bitmap is insufficient, as then Dom0 will
    still have DID 0 allocated to it, because of the zero-filling of
    domid_map[]. Set slot 0 to DOMID_INVALID to keep DID 0 from getting
    used.
    
    Fixes: b9c20c78789f ("VT-d: per-iommu domain-id")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 5de9a73f56..643db07cf0 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1259,16 +1259,19 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
     if ( !iommu->domid_bitmap )
         return -ENOMEM;
 
+    iommu->domid_map = xzalloc_array(u16, nr_dom);
+    if ( !iommu->domid_map )
+        return -ENOMEM;
+
     /*
-     * if Caching mode is set, then invalid translations are tagged with
-     * domain id 0, Hence reserve bit 0 for it
+     * If Caching mode is set, then invalid translations are tagged with
+     * domain id 0. Hence reserve bit/slot 0.
      */
     if ( cap_caching_mode(iommu->cap) )
+    {
+        iommu->domid_map[0] = DOMID_INVALID;
         __set_bit(0, iommu->domid_bitmap);
-
-    iommu->domid_map = xzalloc_array(u16, nr_dom);
-    if ( !iommu->domid_map )
-        return -ENOMEM;
+    }
 
     return 0;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:13:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:13:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.233999.406140 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0KA-0003gR-Rb; Sat, 27 Nov 2021 16:13:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 233999.406140; Sat, 27 Nov 2021 16:13:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0KA-0003gJ-Oa; Sat, 27 Nov 2021 16:13:14 +0000
Received: by outflank-mailman (input) for mailman id 233999;
 Sat, 27 Nov 2021 16: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 1mr0K9-0003fu-4N
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16: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 1mr0K9-00075H-3d
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:13:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0K9-0002BV-2h
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16: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=rcdWKJgUQwmofqfpgKESZ3RRbRmAE0I76zqLo2z0tj4=; b=eb1B0tgcaazMBoy2Uew98J8Ozy
	kw5m8seI5YzB4TXomeKRfDZxRXFNKSWXqrATtVmhabqyTsDWOJVqRlXHyBJPQGmxlcqeStgqNbOSn
	NMw3+EFrwqqjqB5B4PhgXmgebv9cwANl6VLJCWSczXIFHGGWl68qlq8Y3/PdL3k4Lpw8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: split domid map cleanup check into a function
Message-Id: <E1mr0K9-0002BV-2h@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:13:13 +0000

commit 9fdc10abe9457e4c9879a266f82372cb08e88ffb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:06:20 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:06:20 2021 +0100

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

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


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:13:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:13:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234000.406144 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0KK-0003m3-T6; Sat, 27 Nov 2021 16:13:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234000.406144; Sat, 27 Nov 2021 16:13:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0KK-0003lv-Q8; Sat, 27 Nov 2021 16:13:24 +0000
Received: by outflank-mailman (input) for mailman id 234000;
 Sat, 27 Nov 2021 16: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 1mr0KJ-0003lb-7b
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16: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 1mr0KJ-00075M-6v
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:13:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0KJ-0002CB-63
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16: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=4KEsi2Fbp/L0316SxZ+mMA69cvg4NMGlmO5+8FeJBLI=; b=T5Iyh/F4kNIPrBJXoLGVbk1Bou
	JkVwUMFYXMgVA65V1p4fKZAOfco38H2HmObBRrgH02+ZfzDJdOLF346IwTJF+6Tw59igFi+lUhrrn
	4ckRWYp4i3Ea8ZbIDkpQXk8qxOti+FcVB/z6jqfDuY7Xr5g2q9mG7H+zkrJFKwZrxpLI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: don't leak domid mapping on error path
Message-Id: <E1mr0KJ-0002CB-63@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:13:23 +0000

commit e6252a51faf42c892eb5fc71f8a2617580832196
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:07:11 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:07:11 2021 +0100

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

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


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:13:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:13:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234001.406147 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0KU-0003qW-Ul; Sat, 27 Nov 2021 16:13:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234001.406147; Sat, 27 Nov 2021 16:13:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0KU-0003qO-Ro; Sat, 27 Nov 2021 16:13:34 +0000
Received: by outflank-mailman (input) for mailman id 234001;
 Sat, 27 Nov 2021 16:13:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0KT-0003q6-AY
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16: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 1mr0KT-00075X-9o
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:13:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0KT-0002Cq-9D
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16: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=3If/9gmL5FAszB078aCPJcVhVfyxhfzwNriDrjF1FWU=; b=0BFth96Kj2yWDc3gxBU0MzSjpM
	2c/ingIZ4VMLT2ozCKA5JF89EY5OfYeQi5fUxLYO7BkcvXsgwNIqDTwkx7UqUHMRAYBnePncY8QAr
	9uagSyPKTu1KXAOr8EznzFRHMI4LA00fee18qeh71KGpo+F3jHfJjB16JIpmcM0EjeMo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] MAINTAINERS: declare REMUS support orphaned
Message-Id: <E1mr0KT-0002Cq-9D@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:13:33 +0000

commit 49857c5e4fe19e61fc7d1a457e541fe67ac55c8d
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Nov 24 11:07:52 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:07:52 2021 +0100

    MAINTAINERS: declare REMUS support orphaned
    
    The designated maintainer email address for the remus entry is
    bouncing, so remove it and declare the entry as orphaned as there's no
    other maintainer.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Ian Jackson <iwj@xenproject.org>
---
 MAINTAINERS | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4956db1011..f67f70aed3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -470,8 +470,7 @@ S:	Supported
 T:	git https://xenbits.xenproject.org/git-http/qemu-xen.git
 
 REMUS
-M:	Shriram Rajagopalan <rshriram@cs.ubc.ca>
-S:	Maintained
+S:	Orphan
 F:	docs/README.remus
 F:	tools/libs/light/libxl_remus_*
 F:	tools/libs/light/libxl_netbuffer.c
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:13:45 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:13:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234002.406152 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0Ke-0003tS-WE; Sat, 27 Nov 2021 16:13:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234002.406152; Sat, 27 Nov 2021 16:13:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0Ke-0003tK-TK; Sat, 27 Nov 2021 16:13:44 +0000
Received: by outflank-mailman (input) for mailman id 234002;
 Sat, 27 Nov 2021 16:13:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0Kd-0003t7-Dp
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:13:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0Kd-00075f-D8
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:13:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0Kd-0002De-CJ
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16: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=dERSXQzDt0mRf1WJ7MHSmd2W3VA12qYvovQmY9XNGrA=; b=izZsSXQvxo1Je+wY1up6ewwzhP
	wopYBEqNG3UYPcwMfpNCsaX1VPOUWEA+X9DOm4cOT9oQ28GUG2e5G3hTaNcLJW9HU8RR0o6CMpERP
	z6qS6bSr82CstT9/vBVtGNCSgIlp9SzCUV8XCUYtXe2HfcDZb4sfMGMcCRd1xKrHZ5JI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/Viridian: fix error code use
Message-Id: <E1mr0Kd-0002De-CJ@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:13:43 +0000

commit 857fee77845be0c5c35fd51bac64455369d32a6f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:09:56 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:09:56 2021 +0100

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

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


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:13:55 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:13:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234003.406155 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0Kp-0003wP-1X; Sat, 27 Nov 2021 16:13:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234003.406155; Sat, 27 Nov 2021 16: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 1mr0Ko-0003wH-Uu; Sat, 27 Nov 2021 16:13:54 +0000
Received: by outflank-mailman (input) for mailman id 234003;
 Sat, 27 Nov 2021 16:13: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 1mr0Kn-0003w3-H0
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:13: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 1mr0Kn-000768-GI
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:13:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0Kn-0002ES-FV
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:13:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MzlOUDDy7JIHWU/kl1PeF8K72/X7tP/CkZq9WN9wIN0=; b=G549O0Q6tGwOd/Aj+KWcvwYhAT
	9hHccxgPr5+DmQ/I23+jN0f1LhyVJAR7DV/Nw7DjHegekCJChHNdX75Du2Da8vQRKALX6Hxu1HEWY
	fd2Z/Jr7z9OXrhrnrJucwk84FxXX1TEguwzAqZ3twGPMGkSQbsxEMt3o2exn/AFnetLg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/Viridian: drop dead variable updates
Message-Id: <E1mr0Kn-0002ES-FV@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:13:53 +0000

commit 8c6ea4a78485047ea78f9c07d457a56f5227a08b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:10:36 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:10:36 2021 +0100

    x86/Viridian: drop dead variable updates
    
    Both hvcall_flush_ex() and hvcall_ipi_ex() update "size" without
    subsequently using the value; future compilers may warn about such.
    Alongside dropping the updates, shrink the variables' scopes to
    demonstrate that there are no outer scope uses.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/viridian/viridian.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 7d1cfc530b..efdd60b205 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -776,7 +776,6 @@ static int hvcall_flush_ex(const union hypercall_input *input,
     {
         union hypercall_vpset *vpset = &this_cpu(hypercall_vpset);
         struct hv_vpset *set = &vpset->set;
-        size_t size;
         int rc;
 
         *set = input_params.set;
@@ -784,8 +783,7 @@ static int hvcall_flush_ex(const union hypercall_input *input,
         {
             unsigned long offset = offsetof(typeof(input_params),
                                             set.bank_contents);
-
-            size = sizeof(*set->bank_contents) * hv_vpset_nr_banks(set);
+            size_t size = sizeof(*set->bank_contents) * hv_vpset_nr_banks(set);
 
             if ( offsetof(typeof(*vpset), set.bank_contents[0]) + size >
                  sizeof(*vpset) )
@@ -798,11 +796,7 @@ static int hvcall_flush_ex(const union hypercall_input *input,
                                           input_params_gpa + offset,
                                           size) != HVMTRANS_okay)
                 return -EINVAL;
-
-            size += sizeof(*set);
         }
-        else
-            size = sizeof(*set);
 
         rc = hv_vpset_to_vpmask(set, vpmask);
         if ( rc )
@@ -903,7 +897,6 @@ static int hvcall_ipi_ex(const union hypercall_input *input,
     } input_params;
     union hypercall_vpset *vpset = &this_cpu(hypercall_vpset);
     struct hv_vpset *set = &vpset->set;
-    size_t size;
     int rc;
 
     /* These hypercalls should never use the fast-call convention. */
@@ -929,8 +922,7 @@ static int hvcall_ipi_ex(const union hypercall_input *input,
     {
         unsigned long offset = offsetof(typeof(input_params),
                                         set.bank_contents);
-
-        size = sizeof(*set->bank_contents) * hv_vpset_nr_banks(set);
+        size_t size = sizeof(*set->bank_contents) * hv_vpset_nr_banks(set);
 
         if ( offsetof(typeof(*vpset), set.bank_contents[0]) + size >
              sizeof(*vpset) )
@@ -943,11 +935,7 @@ static int hvcall_ipi_ex(const union hypercall_input *input,
                                       input_params_gpa + offset,
                                       size) != HVMTRANS_okay)
             return -EINVAL;
-
-        size += sizeof(*set);
     }
-    else
-        size = sizeof(*set);
 
     rc = hv_vpset_to_vpmask(set, vpmask);
     if ( rc )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:14:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:14:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234004.406160 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0Kz-00040J-4C; Sat, 27 Nov 2021 16:14:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234004.406160; Sat, 27 Nov 2021 16: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 1mr0Kz-00040B-1I; Sat, 27 Nov 2021 16:14:05 +0000
Received: by outflank-mailman (input) for mailman id 234004;
 Sat, 27 Nov 2021 16:14: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 1mr0Kx-0003zj-KP
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:14: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 1mr0Kx-00076V-Jc
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:14:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0Kx-0002FQ-Ik
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:14: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=R9Ix9m8TWgJxcFdNxuQEEuATiD5o+tWGsAFfrM7LYlw=; b=451MKdPeJdOWGLDAjfwZ23aEqq
	v0P6Q0SXKZmCNXtCqeV+SZSKnwuQmk6HYzc+SJG5/8NbVpiKBiqzjubKVwrxEObV/bvBD7SRFvfct
	/HOvXZp9kCvUaL+WdgoFgt5ST7gv2NPlKJ9pD7F3oHtDsxYz2iHTKvIfwItPUaWM9wR4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: prune SAGAW recognition
Message-Id: <E1mr0Kx-0002FQ-Ik@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:14:03 +0000

commit 859d11b2791292c1b997242ac3ea5a38dc34c80e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:11:24 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:11:24 2021 +0100

    VT-d: prune SAGAW recognition
    
    Bit 0 of SAGAW in the capability register has become reserved at or
    before spec version 2.2. Treat it as such. Replace the effective open-
    coding of find_first_set_bit(). Adjust local variable types.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 42cf8774e7..dab8590e25 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -401,7 +401,7 @@ static uint64_t domain_pgd_maddr(struct domain *d, unsigned int nr_pt_levels)
         pgd_maddr = hd->arch.vtd.pgd_maddr;
     }
 
-    /* Skip top levels of page tables for 2- and 3-level DRHDs. */
+    /* Skip top level(s) of page tables for less-than-maximum level DRHDs. */
     for ( agaw = level_to_agaw(4);
           agaw != level_to_agaw(nr_pt_levels);
           agaw-- )
@@ -1228,8 +1228,7 @@ static int __init iommu_set_interrupt(struct acpi_drhd_unit *drhd)
 int __init iommu_alloc(struct acpi_drhd_unit *drhd)
 {
     struct vtd_iommu *iommu;
-    unsigned long sagaw, nr_dom;
-    int agaw;
+    unsigned int sagaw, agaw = 0, nr_dom;
 
     iommu = xzalloc(struct vtd_iommu);
     if ( iommu == NULL )
@@ -1282,14 +1281,13 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
         return -ENODEV;
     }
 
-    /* Calculate number of pagetable levels: between 2 and 4. */
+    /* Calculate number of pagetable levels: 3 or 4. */
     sagaw = cap_sagaw(iommu->cap);
-    for ( agaw = level_to_agaw(4); agaw >= 0; agaw-- )
-        if ( test_bit(agaw, &sagaw) )
-            break;
-    if ( agaw < 0 )
+    if ( sagaw & 6 )
+        agaw = find_first_set_bit(sagaw & 6);
+    if ( !agaw )
     {
-        printk(XENLOG_ERR VTDPREFIX "IOMMU: unsupported sagaw %lx\n", sagaw);
+        printk(XENLOG_ERR VTDPREFIX "IOMMU: unsupported sagaw %x\n", sagaw);
         print_iommu_regs(drhd);
         return -ENODEV;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:14:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:14:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234006.406164 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0L9-00043E-5m; Sat, 27 Nov 2021 16:14:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234006.406164; Sat, 27 Nov 2021 16: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 1mr0L9-000436-2o; Sat, 27 Nov 2021 16:14:15 +0000
Received: by outflank-mailman (input) for mailman id 234006;
 Sat, 27 Nov 2021 16:14: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 1mr0L7-00042n-NR
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:14: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 1mr0L7-00076g-Mf
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:14:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0L7-0002GA-M0
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:14: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=dHg4tmwmmt2qLqkyJilAYTIERbAQVWefRhBlp9bwh1I=; b=USryGouZudGvnBr4iwpHdsIVrc
	JVc+2yXFD7FH5s14o4EAnAmKouXAq1r9j1hGg7At77QyhYAxFJ4DLwvNG8XQQXSI8BhQEZu2BEvfn
	Ukv0uAD5fu8DUcxqqRAyvFnkjfvoGpRfDiRDBrBmJOLPfYVUPGywvwKwXtmcCmgm6ybc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: correct off-by-1 in fault register range check
Message-Id: <E1mr0L7-0002GA-M0@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:14:13 +0000

commit 08826a044ebfefc429aaecb861dc31051f2bb288
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:12:03 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:12:03 2021 +0100

    VT-d: correct off-by-1 in fault register range check
    
    All our present implementation requires is that the range fully fits
    in a single page. No need to exclude the case of the last register
    extending right to the end of that page.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index dab8590e25..c1bf48cbcb 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1273,7 +1273,7 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
     quirk_iommu_caps(iommu);
 
     if ( cap_fault_reg_offset(iommu->cap) +
-         cap_num_fault_regs(iommu->cap) * PRIMARY_FAULT_REG_LEN >= PAGE_SIZE ||
+         cap_num_fault_regs(iommu->cap) * PRIMARY_FAULT_REG_LEN > PAGE_SIZE ||
          ecap_iotlb_offset(iommu->ecap) >= PAGE_SIZE )
     {
         printk(XENLOG_ERR VTDPREFIX "IOMMU: unsupported\n");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Nov 27 16:14:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 27 Nov 2021 16:14:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234007.406168 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mr0LJ-00046Y-7O; Sat, 27 Nov 2021 16:14:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234007.406168; Sat, 27 Nov 2021 16: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 1mr0LJ-00046P-4H; Sat, 27 Nov 2021 16:14:25 +0000
Received: by outflank-mailman (input) for mailman id 234007;
 Sat, 27 Nov 2021 16:14: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 1mr0LH-00045w-R4
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:14: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 1mr0LH-00076u-QM
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:14:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mr0LH-0002H6-P3
 for xen-changelog@lists.xenproject.org; Sat, 27 Nov 2021 16:14: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=vt14WXHh/D/mngmmNef/XO87RpYzA4+h53+0kteXxh0=; b=AIR8FSyGvD09bToTd/aO1UatI8
	V2PQrtIwVb/uqj5AQsmSccDAgaC9FKP9A/47aYFG74iTprsooNjX1qqfMKV6zC3ZX+a7WBwW8qzhc
	yiItm8gu3lHSR1Hc42IqhJ+sqvsOEgoWRKHywdg7JHuwobSI/FN1XXwbxHyor8dYk10k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: conditionalize IOTLB register offset check
Message-Id: <E1mr0LH-0002H6-P3@xenbits.xenproject.org>
Date: Sat, 27 Nov 2021 16:14:23 +0000

commit 5449ba84e99849ee2339fd79f9717e10113d702d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Nov 24 11:12:44 2021 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Nov 24 11:12:44 2021 +0100

    VT-d: conditionalize IOTLB register offset check
    
    As of commit 6773b1a7584a ("VT-d: Don't assume register-based
    invalidation is always supported") we don't (try to) use register based
    invalidation anymore when that's not supported by hardware. Hence
    there's also no point in the respective check, avoiding pointless IOMMU
    initialization failure. After all the spec (version 3.3 at the time of
    writing) doesn't say what the respective Extended Capability Register
    field would contain in such a case.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index c1bf48cbcb..b33697e36b 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1274,7 +1274,8 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
 
     if ( cap_fault_reg_offset(iommu->cap) +
          cap_num_fault_regs(iommu->cap) * PRIMARY_FAULT_REG_LEN > PAGE_SIZE ||
-         ecap_iotlb_offset(iommu->ecap) >= PAGE_SIZE )
+         (has_register_based_invalidation(iommu) &&
+          ecap_iotlb_offset(iommu->ecap) >= PAGE_SIZE) )
     {
         printk(XENLOG_ERR VTDPREFIX "IOMMU: unsupported\n");
         print_iommu_regs(drhd);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:55:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234542.406981 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh7a-0004ky-If; Mon, 29 Nov 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 234542.406981; Mon, 29 Nov 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 1mrh7a-0004kp-FU; Mon, 29 Nov 2021 13:55:06 +0000
Received: by outflank-mailman (input) for mailman id 234542;
 Mon, 29 Nov 2021 13: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 1mrh7Y-0004kj-Qe
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 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 1mrh7Y-0001nR-KK
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 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 1mrh7Y-0002bN-JG
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 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=ddJaJEP76VEs+OC0c2KlZvyxnbTJ4bHGNYHbEWVHgwk=; b=HqmYL84op7ogiOTMzMGlCY08g+
	GdOsoD5Xcs4QhS/gh/Rua1AO6vr+i48/YM+suDAzPNHtrzDYfoZUH3QkZusqqMN72TfC9bbW8yYBf
	shWhK4qO7DtPjH5vcINCbAN5L2B2PWaemai1y1+xNRJeAI5NpitJNIavSo40ZJATU00Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/altcall: allow compound types to be passed
Message-Id: <E1mrh7Y-0002bN-JG@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:55:04 +0000

commit 5c7c78d0be86e3ce0f96f0000f9462e1cafbdb6e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Nov 4 17:04:05 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    x86/altcall: allow compound types to be passed
    
    Replace the conditional operator in ALT_CALL_ARG(), which was intended
    to limit usable types to scalar ones, by a size check. Some restriction
    here is necessary to make sure we don't violate the ABI's calling
    conventions, but limiting to scalar types was both too restrictive
    (disallowing e.g. guest handles) and too permissive (allowing e.g.
    __int128_t).
    
    Note that there was some anomaly with that conditional operator anyway:
    Something - I don't recall what - made it impossible to omit the middle
    operand.
    
    Code-generation-wise this has the effect of removing certain zero- or
    sign-extending in some altcall invocations. This ought to be fine as the
    ABI doesn't require sub-sizeof(int) values to be extended, except when
    passed through an ellipsis. No functions subject to altcall patching has
    a variable number of arguments, though.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    
    Unfortunately this triggers -Werror=sizeof-array-argument on some versions of
    GCC, so alter xsm_{alloc,free}_security_evtchns() to use a pointer rather than
    array parameter.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/include/asm-x86/alternative.h | 4 ++--
 xen/include/xsm/xsm.h             | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h
index 8e78cc91c3..8bc59b02af 100644
--- a/xen/include/asm-x86/alternative.h
+++ b/xen/include/asm-x86/alternative.h
@@ -168,8 +168,8 @@ extern void alternative_branches(void);
 #define ALT_CALL_arg6 "r9"
 
 #define ALT_CALL_ARG(arg, n) \
-    register typeof((arg) ? (arg) : 0) a ## n ## _ \
-    asm ( ALT_CALL_arg ## n ) = (arg)
+    register typeof(arg) a ## n ## _ asm ( ALT_CALL_arg ## n ) = \
+        ({ BUILD_BUG_ON(sizeof(arg) > sizeof(void *)); (arg); })
 #define ALT_CALL_NO_ARG(n) \
     register unsigned long a ## n ## _ asm ( ALT_CALL_arg ## n )
 
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index c101e653f6..0b360e1a35 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -332,13 +332,13 @@ static inline void xsm_free_security_domain(struct domain *d)
 }
 
 static inline int xsm_alloc_security_evtchns(
-    struct evtchn chn[], unsigned int nr)
+    struct evtchn *chn, unsigned int nr)
 {
     return alternative_call(xsm_ops.alloc_security_evtchns, chn, nr);
 }
 
 static inline void xsm_free_security_evtchns(
-    struct evtchn chn[], unsigned int nr)
+    struct evtchn *chn, unsigned int nr)
 {
     alternative_vcall(xsm_ops.free_security_evtchns, chn, nr);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:55:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234543.406985 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh7k-0004mu-Jr; Mon, 29 Nov 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 234543.406985; Mon, 29 Nov 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 1mrh7k-0004mm-Gt; Mon, 29 Nov 2021 13:55:16 +0000
Received: by outflank-mailman (input) for mailman id 234543;
 Mon, 29 Nov 2021 13: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 1mrh7i-0004mX-Oc
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13: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 1mrh7i-0001nV-Nj
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 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 1mrh7i-0002c8-Mp
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 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=vbsGRbE8q1HTPLSK8imWdbdqdXfAeoj75uw1JWqGods=; b=i1K99GzIyYwYMgxQrFW+QtxIRu
	rWeceY2WZuCY9NZlMbKhrx3rFCDbGkK2qlFUJNIRdgM9nbvwAD8GmTEPU4WMpNuU8mk2kJYC2Qe5x
	a5ZOhJosSCkiCs7phGMV4Lu7+jYLh3KaF5aO1/vU5Jf/6EulVhCV7kwJIZlDU6ToM7DQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/xsm: Complete altcall conversion of xsm interface
Message-Id: <E1mrh7i-0002c8-Mp@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:55:14 +0000

commit d868feb95a8a0cfa643427f10a6a540da8061ab5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Nov 4 19:36:16 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    xen/xsm: Complete altcall conversion of xsm interface
    
    With alternative_call() capable of handling compound types, the three
    remaining hooks can be optimised at boot time too.
    
    Fixes: 164a0b9653f4 ("xsm: refactor xsm_ops handling")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/include/xsm/xsm.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 0b360e1a35..82458066f6 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -579,13 +579,13 @@ static inline int xsm_hypfs_op(xsm_default_t def)
 
 static inline long xsm_do_xsm_op(XEN_GUEST_HANDLE_PARAM(void) op)
 {
-    return xsm_ops.do_xsm_op(op);
+    return alternative_call(xsm_ops.do_xsm_op, op);
 }
 
 #ifdef CONFIG_COMPAT
 static inline int xsm_do_compat_op(XEN_GUEST_HANDLE_PARAM(void) op)
 {
-    return xsm_ops.do_compat_op(op);
+    return alternative_call(xsm_ops.do_compat_op, op);
 }
 #endif
 
@@ -698,7 +698,7 @@ static inline int xsm_mmuext_op(
 static inline int xsm_update_va_mapping(
     xsm_default_t def, struct domain *d, struct domain *f, l1_pgentry_t pte)
 {
-    return xsm_ops.update_va_mapping(d, f, pte);
+    return alternative_call(xsm_ops.update_va_mapping, d, f, pte);
 }
 
 static inline int xsm_priv_mapping(
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:55:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:55:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234544.406989 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh7t-0004ps-LL; Mon, 29 Nov 2021 13:55:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234544.406989; Mon, 29 Nov 2021 13:55:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh7t-0004pk-IO; Mon, 29 Nov 2021 13:55:25 +0000
Received: by outflank-mailman (input) for mailman id 234544;
 Mon, 29 Nov 2021 13:55:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh7s-0004pc-Rt
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:55:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh7s-0001o2-RB
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:55:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh7s-0002dR-QF
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:55:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JdslPYzq+6HjUEMEF9zP++6wCN5ltm5n74PWMSYeq3E=; b=gh81mwB9lomllX6YyKeMdsmH/6
	1EHIPzZd6FyXTKR6+5ycf60eTiS/hoA7yQkPGzl0dbeSRfrwjA6u/zsRkRZ7cNzmdFUTKZyNmyTxW
	64XKiT4p8fynXSz9TKpkyI6mUDWMWD5QBQRg64UXJHG5tc6D9vTNowOaJdenaGPpuQXQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/xsm: Drop xsm_hvm_control() hook
Message-Id: <E1mrh7s-0002dR-QF@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:55:24 +0000

commit 28959fe44235babe31be40f09eccd139a247d858
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Oct 29 22:43:50 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    xen/xsm: Drop xsm_hvm_control() hook
    
    The final caller was dropped by c/s 58cbc034dc62 "dm_op: convert
    HVMOP_inject_trap and HVMOP_inject_msi"
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/include/xsm/dummy.h | 7 -------
 xen/include/xsm/xsm.h   | 7 -------
 xen/xsm/dummy.c         | 1 -
 xen/xsm/flask/hooks.c   | 1 -
 4 files changed, 16 deletions(-)

diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 3b1b378b58..b024119896 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -580,13 +580,6 @@ static XSM_INLINE int xsm_hvm_param(
     return xsm_default_action(action, current->domain, d);
 }
 
-static XSM_INLINE int xsm_hvm_control(
-    XSM_DEFAULT_ARG struct domain *d, unsigned long op)
-{
-    XSM_ASSERT_ACTION(XSM_DM_PRIV);
-    return xsm_default_action(action, current->domain, d);
-}
-
 static XSM_INLINE int xsm_hvm_param_altp2mhvm(XSM_DEFAULT_ARG struct domain *d)
 {
     XSM_ASSERT_ACTION(XSM_PRIV);
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 82458066f6..c5bd421349 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -138,7 +138,6 @@ struct xsm_ops {
 #endif
 
     int (*hvm_param)(struct domain *d, unsigned long op);
-    int (*hvm_control)(struct domain *d, unsigned long op);
     int (*hvm_param_altp2mhvm)(struct domain *d);
     int (*hvm_altp2mhvm_op)(struct domain *d, uint64_t mode, uint32_t op);
     int (*get_vnumainfo)(struct domain *d);
@@ -595,12 +594,6 @@ static inline int xsm_hvm_param(
     return alternative_call(xsm_ops.hvm_param, d, op);
 }
 
-static inline int xsm_hvm_control(
-    xsm_default_t def, struct domain *d, unsigned long op)
-{
-    return alternative_call(xsm_ops.hvm_control, d, op);
-}
-
 static inline int xsm_hvm_param_altp2mhvm(xsm_default_t def, struct domain *d)
 {
     return alternative_call(xsm_ops.hvm_param_altp2mhvm, d);
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index d8c935328e..041f59fdf4 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -103,7 +103,6 @@ void __init xsm_fixup_ops (struct xsm_ops *ops)
     set_to_dummy_if_null(ops, page_offline);
     set_to_dummy_if_null(ops, hypfs_op);
     set_to_dummy_if_null(ops, hvm_param);
-    set_to_dummy_if_null(ops, hvm_control);
     set_to_dummy_if_null(ops, hvm_param_altp2mhvm);
     set_to_dummy_if_null(ops, hvm_altp2mhvm_op);
 
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index ea9a12bd71..3b29f7fde3 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1816,7 +1816,6 @@ static const struct xsm_ops __initconstrel flask_ops = {
     .page_offline = flask_page_offline,
     .hypfs_op = flask_hypfs_op,
     .hvm_param = flask_hvm_param,
-    .hvm_control = flask_hvm_param,
     .hvm_param_altp2mhvm = flask_hvm_param_altp2mhvm,
     .hvm_altp2mhvm_op = flask_hvm_altp2mhvm_op,
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:55:35 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:55:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234545.406993 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh83-0004tM-N7; Mon, 29 Nov 2021 13:55:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234545.406993; Mon, 29 Nov 2021 13:55:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh83-0004tD-Jx; Mon, 29 Nov 2021 13:55:35 +0000
Received: by outflank-mailman (input) for mailman id 234545;
 Mon, 29 Nov 2021 13:55:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh82-0004t5-VC
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:55:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh82-0001oG-UI
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:55:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh82-0002eR-TM
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:55:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=H8e9ahmRfbEKTuwuDW6AJuDfiPG3PDPEM/ZO2A8DD1s=; b=ujxOaG/eDvB5H5V3eO+GVA3iH5
	BJsGc5FUauU2P3sNj8POpDytiGT0HbWXARnwpeGkvJnK8cIByqfsuhP3qMI/9PN0SgpBTZHpOcMhJ
	NY4C5c6RIVuSsHGODm4wR3mwvR4Vp+x3viXzqnRQ/85GM42l/2PhJ76/SmCqfd60u4BY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/xsm: Improve fallback handling in xsm_fixup_ops()
Message-Id: <E1mrh82-0002eR-TM@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:55:34 +0000

commit ee3407bb05dae8fa2bbd6476e36bd96d352fd19e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Nov 4 03:12:49 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    xen/xsm: Improve fallback handling in xsm_fixup_ops()
    
    The current xsm_fixup_ops() is just shy of a full page when compiled, and very
    fragile to NULL function pointer errors.
    
    Address both of these issues with a minor piece of structure (ab)use.
    Introduce dummy_ops, and fix up the provided xsm_ops pointer by treating both
    as an array of unsigned longs.
    
    The compiled size improvement speaks for itself:
    
      $ ../scripts/bloat-o-meter xen-syms-before xen-syms-after
      add/remove: 1/0 grow/shrink: 0/1 up/down: 712/-3897 (-3185)
      Function                                     old     new   delta
      dummy_ops                                      -     712    +712
      xsm_fixup_ops                               3987      90   -3897
    
    and there is an additional safety check that will make it obvious during
    development if there is an issue with the fallback handling.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/include/xsm/xsm.h |   9 ++
 xen/xsm/dummy.c       | 254 +++++++++++++++++++++++++++-----------------------
 2 files changed, 147 insertions(+), 116 deletions(-)

diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index c5bd421349..5aa4dd588d 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -42,6 +42,15 @@ enum xsm_default {
 };
 typedef enum xsm_default xsm_default_t;
 
+/*
+ * !!! WARNING !!!
+ *
+ * For simplicity, xsm_fixup_ops() expects that this structure is made
+ * exclusively of function pointers to non-init functions.  Think carefully
+ * before deviating from the pattern.
+ *
+ * !!! WARNING !!!
+ */
 struct xsm_ops {
     void (*security_domaininfo)(struct domain *d,
                                 struct xen_domctl_getdomaininfo *info);
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index 041f59fdf4..4d29a9aa5b 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -13,145 +13,167 @@
 #define XSM_NO_WRAPPERS
 #include <xsm/dummy.h>
 
-#define set_to_dummy_if_null(ops, function)                            \
-    do {                                                               \
-        if ( !ops->function )                                          \
-            ops->function = xsm_##function;                            \
-    } while (0)
-
-void __init xsm_fixup_ops (struct xsm_ops *ops)
-{
-    set_to_dummy_if_null(ops, security_domaininfo);
-    set_to_dummy_if_null(ops, domain_create);
-    set_to_dummy_if_null(ops, getdomaininfo);
-    set_to_dummy_if_null(ops, domctl_scheduler_op);
-    set_to_dummy_if_null(ops, sysctl_scheduler_op);
-    set_to_dummy_if_null(ops, set_target);
-    set_to_dummy_if_null(ops, domctl);
-    set_to_dummy_if_null(ops, sysctl);
-    set_to_dummy_if_null(ops, readconsole);
-
-    set_to_dummy_if_null(ops, evtchn_unbound);
-    set_to_dummy_if_null(ops, evtchn_interdomain);
-    set_to_dummy_if_null(ops, evtchn_close_post);
-    set_to_dummy_if_null(ops, evtchn_send);
-    set_to_dummy_if_null(ops, evtchn_status);
-    set_to_dummy_if_null(ops, evtchn_reset);
-
-    set_to_dummy_if_null(ops, grant_mapref);
-    set_to_dummy_if_null(ops, grant_unmapref);
-    set_to_dummy_if_null(ops, grant_setup);
-    set_to_dummy_if_null(ops, grant_transfer);
-    set_to_dummy_if_null(ops, grant_copy);
-    set_to_dummy_if_null(ops, grant_query_size);
-
-    set_to_dummy_if_null(ops, alloc_security_domain);
-    set_to_dummy_if_null(ops, free_security_domain);
-    set_to_dummy_if_null(ops, alloc_security_evtchns);
-    set_to_dummy_if_null(ops, free_security_evtchns);
-    set_to_dummy_if_null(ops, show_security_evtchn);
-    set_to_dummy_if_null(ops, init_hardware_domain);
-
-    set_to_dummy_if_null(ops, get_pod_target);
-    set_to_dummy_if_null(ops, set_pod_target);
-
-    set_to_dummy_if_null(ops, memory_exchange);
-    set_to_dummy_if_null(ops, memory_adjust_reservation);
-    set_to_dummy_if_null(ops, memory_stat_reservation);
-    set_to_dummy_if_null(ops, memory_pin_page);
-    set_to_dummy_if_null(ops, claim_pages);
-
-    set_to_dummy_if_null(ops, console_io);
-
-    set_to_dummy_if_null(ops, profile);
-
-    set_to_dummy_if_null(ops, kexec);
-    set_to_dummy_if_null(ops, schedop_shutdown);
-
-    set_to_dummy_if_null(ops, show_irq_sid);
-    set_to_dummy_if_null(ops, map_domain_pirq);
-    set_to_dummy_if_null(ops, map_domain_irq);
-    set_to_dummy_if_null(ops, unmap_domain_pirq);
-    set_to_dummy_if_null(ops, unmap_domain_irq);
-    set_to_dummy_if_null(ops, bind_pt_irq);
-    set_to_dummy_if_null(ops, unbind_pt_irq);
-    set_to_dummy_if_null(ops, irq_permission);
-    set_to_dummy_if_null(ops, iomem_permission);
-    set_to_dummy_if_null(ops, iomem_mapping);
-    set_to_dummy_if_null(ops, pci_config_permission);
-    set_to_dummy_if_null(ops, get_vnumainfo);
+static const struct xsm_ops __initconstrel dummy_ops = {
+    .security_domaininfo           = xsm_security_domaininfo,
+    .domain_create                 = xsm_domain_create,
+    .getdomaininfo                 = xsm_getdomaininfo,
+    .domctl_scheduler_op           = xsm_domctl_scheduler_op,
+    .sysctl_scheduler_op           = xsm_sysctl_scheduler_op,
+    .set_target                    = xsm_set_target,
+    .domctl                        = xsm_domctl,
+    .sysctl                        = xsm_sysctl,
+    .readconsole                   = xsm_readconsole,
+
+    .evtchn_unbound                = xsm_evtchn_unbound,
+    .evtchn_interdomain            = xsm_evtchn_interdomain,
+    .evtchn_close_post             = xsm_evtchn_close_post,
+    .evtchn_send                   = xsm_evtchn_send,
+    .evtchn_status                 = xsm_evtchn_status,
+    .evtchn_reset                  = xsm_evtchn_reset,
+
+    .grant_mapref                  = xsm_grant_mapref,
+    .grant_unmapref                = xsm_grant_unmapref,
+    .grant_setup                   = xsm_grant_setup,
+    .grant_transfer                = xsm_grant_transfer,
+    .grant_copy                    = xsm_grant_copy,
+    .grant_query_size              = xsm_grant_query_size,
+
+    .alloc_security_domain         = xsm_alloc_security_domain,
+    .free_security_domain          = xsm_free_security_domain,
+    .alloc_security_evtchns        = xsm_alloc_security_evtchns,
+    .free_security_evtchns         = xsm_free_security_evtchns,
+    .show_security_evtchn          = xsm_show_security_evtchn,
+    .init_hardware_domain          = xsm_init_hardware_domain,
+
+    .get_pod_target                = xsm_get_pod_target,
+    .set_pod_target                = xsm_set_pod_target,
+
+    .memory_exchange               = xsm_memory_exchange,
+    .memory_adjust_reservation     = xsm_memory_adjust_reservation,
+    .memory_stat_reservation       = xsm_memory_stat_reservation,
+    .memory_pin_page               = xsm_memory_pin_page,
+    .claim_pages                   = xsm_claim_pages,
+
+    .console_io                    = xsm_console_io,
+
+    .profile                       = xsm_profile,
+
+    .kexec                         = xsm_kexec,
+    .schedop_shutdown              = xsm_schedop_shutdown,
+
+    .show_irq_sid                  = xsm_show_irq_sid,
+    .map_domain_pirq               = xsm_map_domain_pirq,
+    .map_domain_irq                = xsm_map_domain_irq,
+    .unmap_domain_pirq             = xsm_unmap_domain_pirq,
+    .unmap_domain_irq              = xsm_unmap_domain_irq,
+    .bind_pt_irq                   = xsm_bind_pt_irq,
+    .unbind_pt_irq                 = xsm_unbind_pt_irq,
+    .irq_permission                = xsm_irq_permission,
+    .iomem_permission              = xsm_iomem_permission,
+    .iomem_mapping                 = xsm_iomem_mapping,
+    .pci_config_permission         = xsm_pci_config_permission,
+    .get_vnumainfo                 = xsm_get_vnumainfo,
 
 #if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_PCI)
-    set_to_dummy_if_null(ops, get_device_group);
-    set_to_dummy_if_null(ops, assign_device);
-    set_to_dummy_if_null(ops, deassign_device);
+    .get_device_group              = xsm_get_device_group,
+    .assign_device                 = xsm_assign_device,
+    .deassign_device               = xsm_deassign_device,
 #endif
 
 #if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE)
-    set_to_dummy_if_null(ops, assign_dtdevice);
-    set_to_dummy_if_null(ops, deassign_dtdevice);
+    .assign_dtdevice               = xsm_assign_dtdevice,
+    .deassign_dtdevice             = xsm_deassign_dtdevice,
 #endif
 
-    set_to_dummy_if_null(ops, resource_plug_core);
-    set_to_dummy_if_null(ops, resource_unplug_core);
-    set_to_dummy_if_null(ops, resource_plug_pci);
-    set_to_dummy_if_null(ops, resource_unplug_pci);
-    set_to_dummy_if_null(ops, resource_setup_pci);
-    set_to_dummy_if_null(ops, resource_setup_gsi);
-    set_to_dummy_if_null(ops, resource_setup_misc);
-
-    set_to_dummy_if_null(ops, page_offline);
-    set_to_dummy_if_null(ops, hypfs_op);
-    set_to_dummy_if_null(ops, hvm_param);
-    set_to_dummy_if_null(ops, hvm_param_altp2mhvm);
-    set_to_dummy_if_null(ops, hvm_altp2mhvm_op);
-
-    set_to_dummy_if_null(ops, do_xsm_op);
+    .resource_plug_core            = xsm_resource_plug_core,
+    .resource_unplug_core          = xsm_resource_unplug_core,
+    .resource_plug_pci             = xsm_resource_plug_pci,
+    .resource_unplug_pci           = xsm_resource_unplug_pci,
+    .resource_setup_pci            = xsm_resource_setup_pci,
+    .resource_setup_gsi            = xsm_resource_setup_gsi,
+    .resource_setup_misc           = xsm_resource_setup_misc,
+
+    .page_offline                  = xsm_page_offline,
+    .hypfs_op                      = xsm_hypfs_op,
+    .hvm_param                     = xsm_hvm_param,
+    .hvm_param_altp2mhvm           = xsm_hvm_param_altp2mhvm,
+    .hvm_altp2mhvm_op              = xsm_hvm_altp2mhvm_op,
+
+    .do_xsm_op                     = xsm_do_xsm_op,
 #ifdef CONFIG_COMPAT
-    set_to_dummy_if_null(ops, do_compat_op);
+    .do_compat_op                  = xsm_do_compat_op,
 #endif
 
-    set_to_dummy_if_null(ops, add_to_physmap);
-    set_to_dummy_if_null(ops, remove_from_physmap);
-    set_to_dummy_if_null(ops, map_gmfn_foreign);
+    .add_to_physmap                = xsm_add_to_physmap,
+    .remove_from_physmap           = xsm_remove_from_physmap,
+    .map_gmfn_foreign              = xsm_map_gmfn_foreign,
 
-    set_to_dummy_if_null(ops, vm_event_control);
+    .vm_event_control              = xsm_vm_event_control,
 
 #ifdef CONFIG_MEM_ACCESS
-    set_to_dummy_if_null(ops, mem_access);
+    .mem_access                    = xsm_mem_access,
 #endif
 
 #ifdef CONFIG_MEM_PAGING
-    set_to_dummy_if_null(ops, mem_paging);
+    .mem_paging                    = xsm_mem_paging,
 #endif
 
 #ifdef CONFIG_MEM_SHARING
-    set_to_dummy_if_null(ops, mem_sharing);
+    .mem_sharing                   = xsm_mem_sharing,
 #endif
 
-    set_to_dummy_if_null(ops, platform_op);
+    .platform_op                   = xsm_platform_op,
 #ifdef CONFIG_X86
-    set_to_dummy_if_null(ops, do_mca);
-    set_to_dummy_if_null(ops, shadow_control);
-    set_to_dummy_if_null(ops, mem_sharing_op);
-    set_to_dummy_if_null(ops, apic);
-    set_to_dummy_if_null(ops, machine_memory_map);
-    set_to_dummy_if_null(ops, domain_memory_map);
-    set_to_dummy_if_null(ops, mmu_update);
-    set_to_dummy_if_null(ops, mmuext_op);
-    set_to_dummy_if_null(ops, update_va_mapping);
-    set_to_dummy_if_null(ops, priv_mapping);
-    set_to_dummy_if_null(ops, ioport_permission);
-    set_to_dummy_if_null(ops, ioport_mapping);
-    set_to_dummy_if_null(ops, pmu_op);
+    .do_mca                        = xsm_do_mca,
+    .shadow_control                = xsm_shadow_control,
+    .mem_sharing_op                = xsm_mem_sharing_op,
+    .apic                          = xsm_apic,
+    .machine_memory_map            = xsm_machine_memory_map,
+    .domain_memory_map             = xsm_domain_memory_map,
+    .mmu_update                    = xsm_mmu_update,
+    .mmuext_op                     = xsm_mmuext_op,
+    .update_va_mapping             = xsm_update_va_mapping,
+    .priv_mapping                  = xsm_priv_mapping,
+    .ioport_permission             = xsm_ioport_permission,
+    .ioport_mapping                = xsm_ioport_mapping,
+    .pmu_op                        = xsm_pmu_op,
 #endif
-    set_to_dummy_if_null(ops, dm_op);
-    set_to_dummy_if_null(ops, xen_version);
-    set_to_dummy_if_null(ops, domain_resource_map);
+    .dm_op                         = xsm_dm_op,
+    .xen_version                   = xsm_xen_version,
+    .domain_resource_map           = xsm_domain_resource_map,
 #ifdef CONFIG_ARGO
-    set_to_dummy_if_null(ops, argo_enable);
-    set_to_dummy_if_null(ops, argo_register_single_source);
-    set_to_dummy_if_null(ops, argo_register_any_source);
-    set_to_dummy_if_null(ops, argo_send);
+    .argo_enable                   = xsm_argo_enable,
+    .argo_register_single_source   = xsm_argo_register_single_source,
+    .argo_register_any_source      = xsm_argo_register_any_source,
+    .argo_send                     = xsm_argo_send,
 #endif
+};
+
+void __init xsm_fixup_ops(struct xsm_ops *ops)
+{
+    /*
+     * We make some simplifying assumptions about struct xsm_ops; that it is
+     * made exclusively of function pointers to non-init text.
+     *
+     * This allows us to walk over struct xsm_ops as if it were an array of
+     * unsigned longs.
+     */
+    unsigned long *dst = _p(ops);
+    const unsigned long *src = _p(&dummy_ops);
+
+    for ( ; dst < (unsigned long *)(ops + 1); src++, dst++ )
+    {
+        /*
+         * If you encounter this BUG(), then you've most likely added a new
+         * XSM hook but failed to provide the default implementation in
+         * dummy_ops.
+         *
+         * If not, then perhaps a function pointer to an init function, or
+         * something which isn't a function pointer at all.
+         */
+        BUG_ON(!is_kernel_text(*src));
+
+        if ( !*dst )
+            *dst = *src;
+    }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:55:45 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:55:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234546.406996 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh8D-0004wX-Q0; Mon, 29 Nov 2021 13:55:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234546.406996; Mon, 29 Nov 2021 13:55:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh8D-0004wR-N3; Mon, 29 Nov 2021 13:55:45 +0000
Received: by outflank-mailman (input) for mailman id 234546;
 Mon, 29 Nov 2021 13:55:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh8D-0004wF-27
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:55:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh8D-0001oQ-1L
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:55:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh8D-0002fK-0K
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:55:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kZYBsvO+ecBGGHqP0bvq11VU07zXkXX+NJgihG4zl8k=; b=E3IVSlVyexczjZBCCnjcXG1sN0
	DGNojnc0EQxioFWY2vrvZiur8E5G4W1i95VUcLOx+UElO/QcWF4ZB0uftrKoz7OzpjArbol5iQj6d
	ygxGtIzJH0H1Fc46JGe93Dwl9r2JOO0MKQMLyKbOasDumEPVmobCJSOCs8Ub0T7j9vLs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cpufreq: Clean up powernow registration
Message-Id: <E1mrh8D-0002fK-0K@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:55:45 +0000

commit eed4f94ddbf15e70da93a075a878c304f0a079cb
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Nov 12 15:13:36 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    x86/cpufreq: Clean up powernow registration
    
    powernow_register_driver() is currently written with a K&R type definition;
    I'm surprised that compilers don't object to a mismatch with its declaration,
    which is written in an ANSI-C compatible way.
    
    Furthermore, its sole caller is cpufreq_driver_init() which is a pre-smp
    initcall.  There are no other online CPUs, and even if there were, checking
    the BSP's CPUID data $N times is pointless.  Simplify registration to only
    look at the BSP.
    
    While at it, drop obviously unused includes.  Also rewrite the expression in
    cpufreq_driver_init() for clarity.
    
    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>
---
 xen/arch/x86/acpi/cpufreq/cpufreq.c  | 21 ++++++++++++++-------
 xen/arch/x86/acpi/cpufreq/powernow.c | 27 ++++-----------------------
 2 files changed, 18 insertions(+), 30 deletions(-)

diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c
index f1f3c6923f..df9747e0b6 100644
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c
@@ -640,13 +640,20 @@ static int __init cpufreq_driver_init(void)
 {
     int ret = 0;
 
-    if ((cpufreq_controller == FREQCTL_xen) &&
-        (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL))
-        ret = cpufreq_register_driver(&acpi_cpufreq_driver);
-    else if ((cpufreq_controller == FREQCTL_xen) &&
-        (boot_cpu_data.x86_vendor &
-         (X86_VENDOR_AMD | X86_VENDOR_HYGON)))
-        ret = powernow_register_driver();
+    if ( cpufreq_controller == FREQCTL_xen )
+    {
+        switch ( boot_cpu_data.x86_vendor )
+        {
+        case X86_VENDOR_INTEL:
+            ret = cpufreq_register_driver(&acpi_cpufreq_driver);
+            break;
+
+        case X86_VENDOR_AMD:
+        case X86_VENDOR_HYGON:
+            ret = powernow_register_driver();
+            break;
+        }
+    }
 
     return ret;
 }
diff --git a/xen/arch/x86/acpi/cpufreq/powernow.c b/xen/arch/x86/acpi/cpufreq/powernow.c
index f620bebc7e..dfd96b9216 100644
--- a/xen/arch/x86/acpi/cpufreq/powernow.c
+++ b/xen/arch/x86/acpi/cpufreq/powernow.c
@@ -24,13 +24,9 @@
 #include <xen/types.h>
 #include <xen/errno.h>
 #include <xen/init.h>
-#include <xen/delay.h>
 #include <xen/cpumask.h>
-#include <xen/timer.h>
 #include <xen/xmalloc.h>
-#include <asm/bug.h>
 #include <asm/msr.h>
-#include <asm/io.h>
 #include <asm/processor.h>
 #include <asm/cpufeature.h>
 #include <acpi/acpi.h>
@@ -353,25 +349,10 @@ static const struct cpufreq_driver __initconstrel powernow_cpufreq_driver = {
     .update = powernow_cpufreq_update
 };
 
-unsigned int __init powernow_register_driver()
+unsigned int __init powernow_register_driver(void)
 {
-    unsigned int i, ret = 0;
-
-    for_each_online_cpu(i) {
-        struct cpuinfo_x86 *c = &cpu_data[i];
-        if (!(c->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)))
-            ret = -ENODEV;
-        else
-        {
-            u32 eax, ebx, ecx, edx;
-            cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx, &ecx, &edx);
-            if ((edx & USE_HW_PSTATE) != USE_HW_PSTATE)
-                ret = -ENODEV;
-        }
-        if (ret)
-            return ret;
-    }
+    if ( !(cpuid_edx(CPUID_FREQ_VOLT_CAPABILITIES) & USE_HW_PSTATE) )
+        return -ENODEV;
 
-    ret = cpufreq_register_driver(&powernow_cpufreq_driver);
-    return ret;
+    return cpufreq_register_driver(&powernow_cpufreq_driver);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:55:55 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:55:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234547.407001 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh8N-0004zJ-RR; Mon, 29 Nov 2021 13:55:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234547.407001; Mon, 29 Nov 2021 13:55: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 1mrh8N-0004zB-OZ; Mon, 29 Nov 2021 13:55:55 +0000
Received: by outflank-mailman (input) for mailman id 234547;
 Mon, 29 Nov 2021 13:55:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh8N-0004z1-5P
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:55:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh8N-0001oa-4g
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:55:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh8N-0002gr-3j
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:55:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IBWcxGHWqs9kY4jdEUk1bO//7RS0xbo8nlZ3hi/cooI=; b=fEqm4w+dvWAdaP4KKCw87iv+EZ
	UILJ2zMR+67XYU271NJdR5r+kJ1ae7q2qP7CSWWTOlVwPLNGQs5NJoQ37Qs8WGSCd7NtRcGpLsTf6
	Qn6WMN5huu5Li3PBdCStZzVbz9NMcqYbdxwx8PvTe6ZtzVPsgmN0mUNirGqRdUZyb9W4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cpufreq: Rework APERF/MPERF handling
Message-Id: <E1mrh8N-0002gr-3j@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:55:55 +0000

commit 4dd16c44152f57f2f96d32e9a06fb7e259cde31b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Nov 12 16:28:24 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    x86/cpufreq: Rework APERF/MPERF handling
    
    Currently, each feature_detect() (called on CPU add) hook for both cpufreq
    drivers duplicates cpu_has_aperfmperf in a per-cpu datastructure, and edits
    cpufreq_driver.getavg to point at get_measured_perf().
    
    As all parts of this are vendor-neutral, drop the function pointer and
    duplicated boolean, and call get_measured_perf() directly.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/cpufreq/cpufreq.c  | 8 +-------
 xen/arch/x86/acpi/cpufreq/powernow.c | 6 ------
 xen/drivers/cpufreq/utility.c        | 9 +++------
 xen/include/acpi/cpufreq/cpufreq.h   | 2 --
 4 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c
index df9747e0b6..029c9398c4 100644
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c
@@ -275,7 +275,7 @@ unsigned int get_measured_perf(unsigned int cpu, unsigned int flag)
         return 0;
 
     policy = per_cpu(cpufreq_cpu_policy, cpu);
-    if (!policy || !policy->aperf_mperf)
+    if ( !policy || !cpu_has_aperfmperf )
         return 0;
 
     switch (flag)
@@ -345,12 +345,6 @@ static void feature_detect(void *info)
     struct cpufreq_policy *policy = info;
     unsigned int eax;
 
-    if ( cpu_has_aperfmperf )
-    {
-        policy->aperf_mperf = 1;
-        cpufreq_driver.getavg = get_measured_perf;
-    }
-
     eax = cpuid_eax(6);
     if (eax & 0x2) {
         policy->turbo = CPUFREQ_TURBO_ENABLED;
diff --git a/xen/arch/x86/acpi/cpufreq/powernow.c b/xen/arch/x86/acpi/cpufreq/powernow.c
index dfd96b9216..97a883e7a7 100644
--- a/xen/arch/x86/acpi/cpufreq/powernow.c
+++ b/xen/arch/x86/acpi/cpufreq/powernow.c
@@ -205,12 +205,6 @@ static void feature_detect(void *info)
     struct cpufreq_policy *policy = info;
     unsigned int edx;
 
-    if ( cpu_has_aperfmperf )
-    {
-        policy->aperf_mperf = 1;
-        cpufreq_driver.getavg = get_measured_perf;
-    }
-
     edx = cpuid_edx(CPUID_FREQ_VOLT_CAPABILITIES);
     if ((edx & CPB_CAPABLE) == CPB_CAPABLE) {
         policy->turbo = CPUFREQ_TURBO_ENABLED;
diff --git a/xen/drivers/cpufreq/utility.c b/xen/drivers/cpufreq/utility.c
index b93895d4dd..9eb7ecedcd 100644
--- a/xen/drivers/cpufreq/utility.c
+++ b/xen/drivers/cpufreq/utility.c
@@ -381,12 +381,9 @@ int cpufreq_driver_getavg(unsigned int cpu, unsigned int flag)
     if (!cpu_online(cpu) || !(policy = per_cpu(cpufreq_cpu_policy, cpu)))
         return 0;
 
-    if (cpufreq_driver.getavg)
-    {
-        freq_avg = cpufreq_driver.getavg(cpu, flag);
-        if (freq_avg > 0)
-            return freq_avg;
-    }
+    freq_avg = get_measured_perf(cpu, flag);
+    if ( freq_avg > 0 )
+        return freq_avg;
 
     return policy->cur;
 }
diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h
index e88b20bfed..4958d3f7d3 100644
--- a/xen/include/acpi/cpufreq/cpufreq.h
+++ b/xen/include/acpi/cpufreq/cpufreq.h
@@ -72,7 +72,6 @@ struct cpufreq_policy {
     s8                  turbo;  /* tristate flag: 0 for unsupported
                                  * -1 for disable, 1 for enabled
                                  * See CPUFREQ_TURBO_* below for defines */
-    bool_t              aperf_mperf; /* CPU has APERF/MPERF MSRs */
 };
 DECLARE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_policy);
 
@@ -162,7 +161,6 @@ struct cpufreq_driver {
                      unsigned int target_freq,
                      unsigned int relation);
     unsigned int    (*get)(unsigned int cpu);
-    unsigned int    (*getavg)(unsigned int cpu, unsigned int flag);
     int    (*exit)(struct cpufreq_policy *policy);
 };
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:56:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:56:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234548.407005 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh8X-00051z-TY; Mon, 29 Nov 2021 13:56:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234548.407005; Mon, 29 Nov 2021 13:56: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 1mrh8X-00051r-QD; Mon, 29 Nov 2021 13:56:05 +0000
Received: by outflank-mailman (input) for mailman id 234548;
 Mon, 29 Nov 2021 13:56:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh8X-00051b-9a
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:56:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh8X-0001ox-8n
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:56:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh8X-0002ij-7n
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:56:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=irMCczrlnxxeGAa+9yeL5S1JsAbF89yRCdkDKY8/WsA=; b=4zo12+Zvm3PYDJQTJZwqNhiECW
	KrBqttHJnVSq/WYCMYwkAHHRRRwmQS1M6J/HVPQ3yJkrVjNwBUesDZxIFYAz1y5uLSkB4LavuhaEc
	rqYYbwTPfYZ+wucc7ih9fKENyyg8SswrdNlScAm9JOZm3RHiGvRjwmg+zE5UB4uBmwRQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cpufreq: Drop opencoded CPUID handling from powernow
Message-Id: <E1mrh8X-0002ij-7n@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:56:05 +0000

commit 5d9974916bca25ce2d00b888f54b89e9eabdcc92
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Nov 12 16:00:13 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    x86/cpufreq: Drop opencoded CPUID handling from powernow
    
    Xen already collects CPUID.0x80000007.edx by default, meaning that we can
    refer to per-cpu data directly.  This also avoids the need IPI the onlining
    CPU to identify whether Core Performance Boost is available.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/misc/xen-cpuid.c                      |  3 ++-
 xen/arch/x86/acpi/cpufreq/powernow.c        | 26 ++++----------------------
 xen/include/asm-x86/cpufeature.h            |  1 +
 xen/include/public/arch-x86/cpufeatureset.h |  2 ++
 4 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 37989e4a12..9b59fec263 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -139,7 +139,8 @@ static const char *const str_7c0[32] =
 
 static const char *const str_e7d[32] =
 {
-    [ 8] = "itsc",
+    /* 6 */                    [ 7] = "hw-pstate",
+    [ 8] = "itsc",             [ 9] = "cpb",
     [10] = "efro",
 };
 
diff --git a/xen/arch/x86/acpi/cpufreq/powernow.c b/xen/arch/x86/acpi/cpufreq/powernow.c
index 97a883e7a7..da8fc40b9a 100644
--- a/xen/arch/x86/acpi/cpufreq/powernow.c
+++ b/xen/arch/x86/acpi/cpufreq/powernow.c
@@ -32,9 +32,6 @@
 #include <acpi/acpi.h>
 #include <acpi/cpufreq/cpufreq.h>
 
-#define CPUID_FREQ_VOLT_CAPABILITIES    0x80000007
-#define CPB_CAPABLE             0x00000200
-#define USE_HW_PSTATE           0x00000080
 #define HW_PSTATE_MASK          0x00000007
 #define HW_PSTATE_VALID_MASK    0x80000000
 #define HW_PSTATE_MAX_MASK      0x000000f0
@@ -200,21 +197,6 @@ static int powernow_cpufreq_verify(struct cpufreq_policy *policy)
     return cpufreq_frequency_table_verify(policy, data->freq_table);
 }
 
-static void feature_detect(void *info)
-{
-    struct cpufreq_policy *policy = info;
-    unsigned int edx;
-
-    edx = cpuid_edx(CPUID_FREQ_VOLT_CAPABILITIES);
-    if ((edx & CPB_CAPABLE) == CPB_CAPABLE) {
-        policy->turbo = CPUFREQ_TURBO_ENABLED;
-        if (cpufreq_verbose)
-            printk(XENLOG_INFO
-                   "CPU%u: Core Boost/Turbo detected and enabled\n",
-                   smp_processor_id());
-    }
-}
-
 static int powernow_cpufreq_cpu_init(struct cpufreq_policy *policy)
 {
     unsigned int i;
@@ -300,9 +282,9 @@ static int powernow_cpufreq_cpu_init(struct cpufreq_policy *policy)
     if (result)
         goto err_freqfree;
 
-    if (c->cpuid_level >= 6)
-        on_selected_cpus(cpumask_of(cpu), feature_detect, policy, 1);
-      
+    if ( cpu_has(c, X86_FEATURE_CPB) )
+        policy->turbo = CPUFREQ_TURBO_ENABLED;
+
     /*
      * the first call to ->target() should result in us actually
      * writing something to the appropriate registers.
@@ -345,7 +327,7 @@ static const struct cpufreq_driver __initconstrel powernow_cpufreq_driver = {
 
 unsigned int __init powernow_register_driver(void)
 {
-    if ( !(cpuid_edx(CPUID_FREQ_VOLT_CAPABILITIES) & USE_HW_PSTATE) )
+    if ( !cpu_has_hw_pstate )
         return -ENODEV;
 
     return cpufreq_register_driver(&powernow_cpufreq_driver);
diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h
index ba0fe7c0aa..4754940e23 100644
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -122,6 +122,7 @@
 #define cpu_has_enqcmd          boot_cpu_has(X86_FEATURE_ENQCMD)
 
 /* CPUID level 0x80000007.edx */
+#define cpu_has_hw_pstate       boot_cpu_has(X86_FEATURE_HW_PSTATE)
 #define cpu_has_itsc            boot_cpu_has(X86_FEATURE_ITSC)
 
 /* CPUID level 0x80000008.ebx */
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index f11d5439ae..d6260c801a 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -247,7 +247,9 @@ XEN_CPUFEATURE(MOVDIR64B,     6*32+28) /*a  MOVDIR64B instruction */
 XEN_CPUFEATURE(ENQCMD,        6*32+29) /*   ENQCMD{,S} instructions */
 
 /* AMD-defined CPU features, CPUID level 0x80000007.edx, word 7 */
+XEN_CPUFEATURE(HW_PSTATE,     7*32+ 7) /*   Hardware Pstates */
 XEN_CPUFEATURE(ITSC,          7*32+ 8) /*a  Invariant TSC */
+XEN_CPUFEATURE(CPB,           7*32+ 9) /*   Core Performance Boost (Turbo) */
 XEN_CPUFEATURE(EFRO,          7*32+10) /*   APERF/MPERF Read Only interface */
 
 /* AMD-defined CPU features, CPUID level 0x80000008.ebx, word 8 */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:56:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:56:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234549.407010 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh8h-00054l-VA; Mon, 29 Nov 2021 13:56:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234549.407010; Mon, 29 Nov 2021 13:56:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh8h-00054Z-Rt; Mon, 29 Nov 2021 13:56:15 +0000
Received: by outflank-mailman (input) for mailman id 234549;
 Mon, 29 Nov 2021 13:56:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh8h-00054R-DC
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:56:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh8h-0001pQ-CQ
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:56:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh8h-0002jg-Bb
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:56:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NapFir50y+jG6T0vTeV1r1ItWLopgKecSj2BciBc2z8=; b=B40cd7CcBKCL9ONdR5IYatg8np
	6dJNZnbL1xD4PK/+2yPblCL7Q8AuP4ZddU5FC4lDwBMy2H5B1kQ7ve3eRruWdUmb/OTclF79G4PRr
	nEEDKXyUuL2EdBWMNKp8OJdccsYMxkTu132oeq9kkRi0e44cxD3VDoJNAsk0tynpXsyQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/APIC: drop clustered_apic_check() hook
Message-Id: <E1mrh8h-0002jg-Bb@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:56:15 +0000

commit 56829b6ff98515ffdc478edc74cd5bcd437301aa
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 5 13:34:12 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    x86/APIC: drop clustered_apic_check() hook
    
    The hook functions have been empty forever (x2APIC) or issuing merely a
    printk() for a long time (xAPIC). Since that printk() is (a) generally
    useful (i.e. also in the x2APIC case) and (b) would better only be
    issued once the final APIC driver to use was determined, move (and
    generalize) it into connect_bsp_APIC().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/acpi/boot.c                     |  2 --
 xen/arch/x86/apic.c                          |  6 ++++++
 xen/arch/x86/genapic/delivery.c              | 10 ----------
 xen/arch/x86/genapic/x2apic.c                |  6 ------
 xen/arch/x86/mpparse.c                       |  1 -
 xen/include/asm-x86/genapic.h                |  5 -----
 xen/include/asm-x86/mach-generic/mach_apic.h |  1 -
 7 files changed, 6 insertions(+), 25 deletions(-)

diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c
index 5e38b4b17c..79c6a3e1f8 100644
--- a/xen/arch/x86/acpi/boot.c
+++ b/xen/arch/x86/acpi/boot.c
@@ -674,9 +674,7 @@ static void __init acpi_process_madt(void)
 			error = acpi_parse_madt_ioapic_entries();
 			if (!error) {
 				acpi_ioapic = true;
-
 				smp_found_config = true;
-				clustered_apic_check();
 			}
 		}
 		if (error == -EINVAL) {
diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 030792cabb..55c103aaff 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -243,6 +243,12 @@ void __init connect_bsp_APIC(void)
         outb(0x70, 0x22);
         outb(0x01, 0x23);
     }
+
+    printk("Enabling APIC mode:  %s.  Using %d I/O APICs\n",
+           !INT_DEST_MODE ? "Physical"
+                          : init_apic_ldr == init_apic_ldr_flat ? "Flat"
+                                                                : "Clustered",
+           nr_ioapics);
     enable_apic_mode();
 }
 
diff --git a/xen/arch/x86/genapic/delivery.c b/xen/arch/x86/genapic/delivery.c
index 36ef033e65..548c33f282 100644
--- a/xen/arch/x86/genapic/delivery.c
+++ b/xen/arch/x86/genapic/delivery.c
@@ -19,11 +19,6 @@ void init_apic_ldr_flat(void)
 	apic_write(APIC_LDR, val);
 }
 
-void __init clustered_apic_check_flat(void)
-{
-	printk("Enabling APIC mode:  Flat.  Using %d I/O APICs\n", nr_ioapics);
-}
-
 const cpumask_t *vector_allocation_cpumask_flat(int cpu)
 {
 	return &cpu_online_map;
@@ -43,11 +38,6 @@ void init_apic_ldr_phys(void)
 	/* We only deliver in phys mode - no setup needed. */
 }
 
-void __init clustered_apic_check_phys(void)
-{
-	printk("Enabling APIC mode:  Phys.  Using %d I/O APICs\n", nr_ioapics);
-}
-
 const cpumask_t *vector_allocation_cpumask_phys(int cpu)
 {
 	return cpumask_of(cpu);
diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index 628b441da5..425f1ff460 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -75,10 +75,6 @@ static void init_apic_ldr_x2apic_cluster(void)
     cpumask_set_cpu(this_cpu, per_cpu(cluster_cpus, this_cpu));
 }
 
-static void __init clustered_apic_check_x2apic(void)
-{
-}
-
 static const cpumask_t *vector_allocation_cpumask_x2apic_cluster(int cpu)
 {
     return per_cpu(cluster_cpus, cpu);
@@ -175,7 +171,6 @@ static const struct genapic __initconstrel apic_x2apic_phys = {
     .int_delivery_mode = dest_Fixed,
     .int_dest_mode = 0 /* physical delivery */,
     .init_apic_ldr = init_apic_ldr_phys,
-    .clustered_apic_check = clustered_apic_check_x2apic,
     .vector_allocation_cpumask = vector_allocation_cpumask_phys,
     .cpu_mask_to_apicid = cpu_mask_to_apicid_phys,
     .send_IPI_mask = send_IPI_mask_x2apic_phys,
@@ -187,7 +182,6 @@ static const struct genapic __initconstrel apic_x2apic_cluster = {
     .int_delivery_mode = dest_LowestPrio,
     .int_dest_mode = 1 /* logical delivery */,
     .init_apic_ldr = init_apic_ldr_x2apic_cluster,
-    .clustered_apic_check = clustered_apic_check_x2apic,
     .vector_allocation_cpumask = vector_allocation_cpumask_x2apic_cluster,
     .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic_cluster,
     .send_IPI_mask = send_IPI_mask_x2apic_cluster,
diff --git a/xen/arch/x86/mpparse.c b/xen/arch/x86/mpparse.c
index dff02b142b..3df8c65f67 100644
--- a/xen/arch/x86/mpparse.c
+++ b/xen/arch/x86/mpparse.c
@@ -410,7 +410,6 @@ static int __init smp_read_mpc(struct mp_config_table *mpc)
 			}
 		}
 	}
-	clustered_apic_check();
 	if (!num_processors)
 		printk(KERN_ERR "SMP mptable: no processors registered!\n");
 	return num_processors;
diff --git a/xen/include/asm-x86/genapic.h b/xen/include/asm-x86/genapic.h
index 5aa35ceb5f..dd7dfe96a3 100644
--- a/xen/include/asm-x86/genapic.h
+++ b/xen/include/asm-x86/genapic.h
@@ -32,7 +32,6 @@ struct genapic {
 	int int_delivery_mode;
 	int int_dest_mode;
 	void (*init_apic_ldr)(void);
-	void (*clustered_apic_check)(void);
 	const cpumask_t *(*vector_allocation_cpumask)(int cpu);
 	unsigned int (*cpu_mask_to_apicid)(const cpumask_t *cpumask);
 	void (*send_IPI_mask)(const cpumask_t *mask, int vector);
@@ -54,7 +53,6 @@ extern const struct genapic apic_bigsmp;
 void send_IPI_self_legacy(uint8_t vector);
 
 void init_apic_ldr_flat(void);
-void clustered_apic_check_flat(void);
 unsigned int cpu_mask_to_apicid_flat(const cpumask_t *cpumask);
 void send_IPI_mask_flat(const cpumask_t *mask, int vector);
 const cpumask_t *vector_allocation_cpumask_flat(int cpu);
@@ -62,14 +60,12 @@ const cpumask_t *vector_allocation_cpumask_flat(int cpu);
 	.int_delivery_mode = dest_LowestPrio, \
 	.int_dest_mode = 1 /* logical delivery */, \
 	.init_apic_ldr = init_apic_ldr_flat, \
-	.clustered_apic_check = clustered_apic_check_flat, \
 	.vector_allocation_cpumask = vector_allocation_cpumask_flat, \
 	.cpu_mask_to_apicid = cpu_mask_to_apicid_flat, \
 	.send_IPI_mask = send_IPI_mask_flat, \
 	.send_IPI_self = send_IPI_self_legacy
 
 void init_apic_ldr_phys(void);
-void clustered_apic_check_phys(void);
 unsigned int cpu_mask_to_apicid_phys(const cpumask_t *cpumask);
 void send_IPI_mask_phys(const cpumask_t *mask, int vector);
 const cpumask_t *vector_allocation_cpumask_phys(int cpu);
@@ -77,7 +73,6 @@ const cpumask_t *vector_allocation_cpumask_phys(int cpu);
 	.int_delivery_mode = dest_Fixed, \
 	.int_dest_mode = 0 /* physical delivery */, \
 	.init_apic_ldr = init_apic_ldr_phys, \
-	.clustered_apic_check = clustered_apic_check_phys, \
 	.vector_allocation_cpumask = vector_allocation_cpumask_phys, \
 	.cpu_mask_to_apicid = cpu_mask_to_apicid_phys, \
 	.send_IPI_mask = send_IPI_mask_phys, \
diff --git a/xen/include/asm-x86/mach-generic/mach_apic.h b/xen/include/asm-x86/mach-generic/mach_apic.h
index 75f1e766b0..b6f6361c60 100644
--- a/xen/include/asm-x86/mach-generic/mach_apic.h
+++ b/xen/include/asm-x86/mach-generic/mach_apic.h
@@ -14,7 +14,6 @@
 #define INT_DEST_MODE (genapic.int_dest_mode)
 #define TARGET_CPUS ((const typeof(cpu_online_map) *)&cpu_online_map)
 #define init_apic_ldr (genapic.init_apic_ldr)
-#define clustered_apic_check (genapic.clustered_apic_check)
 #define cpu_mask_to_apicid(mask) ({ \
 	/* \
 	 * There are a number of places where the address of a local variable \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:56:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:56:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234551.407013 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh8s-00057l-0E; Mon, 29 Nov 2021 13:56:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234551.407013; Mon, 29 Nov 2021 13:56:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh8r-00057e-TL; Mon, 29 Nov 2021 13:56:25 +0000
Received: by outflank-mailman (input) for mailman id 234551;
 Mon, 29 Nov 2021 13:56:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh8r-00057W-Gg
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:56:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh8r-0001pU-Fx
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:56:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh8r-0002kV-F4
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:56:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=N1wuJzBr/ibvMiWPxKxhg+LExicYL+pEq7YxTTY+n2I=; b=0wH3slf2uGgKd9Az1G53wJLfki
	TptEHxmwBWA+MAZjRUlhcpxSYWjoEn61bXPZoWwMSgEQ8DFbDCf5uxZhAimDKEbVfdmjq829IYA4E
	clDbBd/OVLNmJ7kvGF3Ja2/hX62G6MDUNN2hYmnxkO16PA0nOZ9CB58nCBgkQSyP2kSg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/APIC: drop {acpi_madt,mps}_oem_check() hooks
Message-Id: <E1mrh8r-0002kV-F4@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:56:25 +0000

commit 501f70b16a09983b6f8a1fb65757f26ec239a017
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 5 13:34:37 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    x86/APIC: drop {acpi_madt,mps}_oem_check() hooks
    
    The hook functions have been empty for a very long time, if not
    (according to git history) forever. Ditch them alongside the then empty
    mach_mpparse.h instances and the then unused APICFUNC() macro.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/acpi/boot.c                        |  3 ---
 xen/arch/x86/genapic/bigsmp.c                   |  1 -
 xen/arch/x86/genapic/default.c                  |  1 -
 xen/arch/x86/genapic/probe.c                    | 36 -------------------------
 xen/arch/x86/genapic/x2apic.c                   |  1 -
 xen/arch/x86/mpparse.c                          |  3 ---
 xen/arch/x86/x86_64/acpi_mmcfg.c                |  1 -
 xen/include/asm-x86/genapic.h                   | 13 +--------
 xen/include/asm-x86/mach-default/mach_mpparse.h | 17 ------------
 xen/include/asm-x86/mach-generic/mach_mpparse.h |  7 -----
 10 files changed, 1 insertion(+), 82 deletions(-)

diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c
index 79c6a3e1f8..b101ef0961 100644
--- a/xen/arch/x86/acpi/boot.c
+++ b/xen/arch/x86/acpi/boot.c
@@ -39,7 +39,6 @@
 #include <asm/processor.h>
 #include <asm/hpet.h> /* for hpet_address */
 #include <mach_apic.h>
-#include <mach_mpparse.h>
 
 #define PREFIX			"ACPI: "
 
@@ -75,8 +74,6 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)
 		       madt->address);
 	}
 
-	acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id);
-
 	return 0;
 }
 
diff --git a/xen/arch/x86/genapic/bigsmp.c b/xen/arch/x86/genapic/bigsmp.c
index 6808d61d9c..b9d976e8ab 100644
--- a/xen/arch/x86/genapic/bigsmp.c
+++ b/xen/arch/x86/genapic/bigsmp.c
@@ -8,7 +8,6 @@
 #include <xen/smp.h>
 #include <xen/init.h>
 #include <xen/dmi.h>
-#include <asm/mach-default/mach_mpparse.h>
 #include <asm/io_apic.h>
 
 static __init int force_bigsmp(const struct dmi_system_id *d)
diff --git a/xen/arch/x86/genapic/default.c b/xen/arch/x86/genapic/default.c
index 53ebf20a3f..bfd068cdc6 100644
--- a/xen/arch/x86/genapic/default.c
+++ b/xen/arch/x86/genapic/default.c
@@ -12,7 +12,6 @@
 #include <xen/smp.h>
 #include <xen/init.h>
 #include <asm/io_apic.h>
-#include <asm/mach-default/mach_mpparse.h>
 
 /* should be called last. */
 static __init int probe_default(void)
diff --git a/xen/arch/x86/genapic/probe.c b/xen/arch/x86/genapic/probe.c
index d4d7a554a0..b963dc5ec0 100644
--- a/xen/arch/x86/genapic/probe.c
+++ b/xen/arch/x86/genapic/probe.c
@@ -78,39 +78,3 @@ void __init generic_apic_probe(void)
 
 	printk(KERN_INFO "Using APIC driver %s\n", genapic.name);
 } 
-
-/* These functions can switch the APIC even after the initial ->probe() */
-
-int __init mps_oem_check(struct mp_config_table *mpc, char *oem, char *productid)
-{ 
-	int i;
-	for (i = 0; apic_probe[i]; ++i) { 
-		if (apic_probe[i]->mps_oem_check(mpc,oem,productid)) { 
-			if (!cmdline_apic &&
-			     genapic.name != apic_probe[i]->name) {
-				genapic = *apic_probe[i];
-				printk(KERN_INFO "Switched to APIC driver `%s'.\n", 
-				       genapic.name);
-			}
-			return 1;
-		} 
-	} 
-	return 0;
-} 
-
-int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
-{
-	int i;
-	for (i = 0; apic_probe[i]; ++i) { 
-		if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) { 
-			if (!cmdline_apic &&
-			     genapic.name != apic_probe[i]->name) {
-				genapic = *apic_probe[i];
-				printk(KERN_INFO "Switched to APIC driver `%s'.\n", 
-				       genapic.name);
-			}
-			return 1;
-		} 
-	} 
-	return 0;	
-}
diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index 425f1ff460..9064a0ca46 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -27,7 +27,6 @@
 #include <asm/msr.h>
 #include <asm/processor.h>
 #include <xen/smp.h>
-#include <asm/mach-default/mach_mpparse.h>
 
 static DEFINE_PER_CPU_READ_MOSTLY(u32, cpu_2_logical_apicid);
 static DEFINE_PER_CPU_READ_MOSTLY(cpumask_t *, cluster_cpus);
diff --git a/xen/arch/x86/mpparse.c b/xen/arch/x86/mpparse.c
index 3df8c65f67..42b5ac7871 100644
--- a/xen/arch/x86/mpparse.c
+++ b/xen/arch/x86/mpparse.c
@@ -30,7 +30,6 @@
 #include <asm/setup.h>
 
 #include <mach_apic.h>
-#include <mach_mpparse.h>
 #include <bios_ebda.h>
 
 /* Have we found an MP table */
@@ -326,8 +325,6 @@ static int __init smp_read_mpc(struct mp_config_table *mpc)
 	str[12]=0;
 	printk("Product ID: %s ",str);
 
-	mps_oem_check(mpc, oem, str);
-
 	printk("APIC at: %#x\n", mpc->mpc_lapic);
 
 	/* 
diff --git a/xen/arch/x86/x86_64/acpi_mmcfg.c b/xen/arch/x86/x86_64/acpi_mmcfg.c
index 650140eec5..0db8f57abb 100644
--- a/xen/arch/x86/x86_64/acpi_mmcfg.c
+++ b/xen/arch/x86/x86_64/acpi_mmcfg.c
@@ -38,7 +38,6 @@
 #include <asm/mpspec.h>
 #include <asm/processor.h>
 #include <mach_apic.h>
-#include <mach_mpparse.h>
 
 #include "mmconfig.h"
 
diff --git a/xen/include/asm-x86/genapic.h b/xen/include/asm-x86/genapic.h
index dd7dfe96a3..51a65d3e0f 100644
--- a/xen/include/asm-x86/genapic.h
+++ b/xen/include/asm-x86/genapic.h
@@ -21,13 +21,6 @@ struct genapic {
 	const char *name;
 	int (*probe)(void);
 
-	/* When one of the next two hooks returns 1 the genapic
-	   is switched to this. Essentially they are additional probe 
-	   functions. */
-	int (*mps_oem_check)(struct mp_config_table *mpc, char *oem, 
-			      char *productid);
-	int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id);
-
 	/* Interrupt delivery parameters ('physical' vs. 'logical flat'). */
 	int int_delivery_mode;
 	int int_dest_mode;
@@ -38,13 +31,9 @@ struct genapic {
     void (*send_IPI_self)(uint8_t vector);
 };
 
-#define APICFUNC(x) .x = x
-
 #define APIC_INIT(aname, aprobe) \
 	.name = aname, \
-	.probe = aprobe, \
-	APICFUNC(mps_oem_check), \
-	APICFUNC(acpi_madt_oem_check)
+	.probe = aprobe
 
 extern struct genapic genapic;
 extern const struct genapic apic_default;
diff --git a/xen/include/asm-x86/mach-default/mach_mpparse.h b/xen/include/asm-x86/mach-default/mach_mpparse.h
deleted file mode 100644
index 6194b77429..0000000000
--- a/xen/include/asm-x86/mach-default/mach_mpparse.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef __ASM_MACH_MPPARSE_H
-#define __ASM_MACH_MPPARSE_H
-
-static inline int __init mps_oem_check(struct mp_config_table *mpc, char *oem,
-				       char *productid)
-{
-	return 0;
-}
-
-/* Hook from generic ACPI tables.c */
-static inline int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
-{
-	return 0;
-}
-
-
-#endif /* __ASM_MACH_MPPARSE_H */
diff --git a/xen/include/asm-x86/mach-generic/mach_mpparse.h b/xen/include/asm-x86/mach-generic/mach_mpparse.h
deleted file mode 100644
index 92f0974027..0000000000
--- a/xen/include/asm-x86/mach-generic/mach_mpparse.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _MACH_MPPARSE_H
-#define _MACH_MPPARSE_H 1
-
-int mps_oem_check(struct mp_config_table *mpc, char *oem, char *productid);
-int acpi_madt_oem_check(char *oem_id, char *oem_table_id);
-
-#endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:56:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:56:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234553.407028 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh93-0005SU-DO; Mon, 29 Nov 2021 13:56:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234553.407028; Mon, 29 Nov 2021 13:56: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 1mrh93-0005SL-AB; Mon, 29 Nov 2021 13:56:37 +0000
Received: by outflank-mailman (input) for mailman id 234553;
 Mon, 29 Nov 2021 13:56:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh91-0005RY-K6
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:56:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh91-0001pm-JJ
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:56:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh91-0002lT-IB
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:56:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=90RQDtGR1lziL5JrCjC12TsF1FAFNezKZfU0z8jnrbQ=; b=4KHcA1PBAPdWgTU4WTX7CY0r/0
	UdacVygG0TliSKZihbCeR5b0FLtpG2eRNSAh9BvD6xCD1i5Kw5zNzH6lZave1nNn09qB82XlzuMgn
	zor4ODpKxE4e8ON8mIyOpfO1TXTjlyBkdzeSy/IOTpff6ABNHihoGjbYYIkki1tJPrB4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/APIC: drop probe_default()
Message-Id: <E1mrh91-0002lT-IB@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:56:35 +0000

commit 0ee901ce4b439ef5a44bf6ac7471e75a20dffbbe
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 5 13:34:57 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    x86/APIC: drop probe_default()
    
    The function does nothing but return success. Simply treat absence of a
    probe hook to mean just this. This then eliminates the (purely
    theoretical at this point) risk of trying to call through
    apic_x2apic_{cluster,phys}'s respective NULL pointers.
    
    While doing this also eliminate generic_apic_probe()'s "changed"
    variable: apic_probe[]'s default entry will now be used unconditionally
    in yet more obvious a way, such that separately setting genapic from
    apic_default is (hopefully) no longer justified. Yet that was the main
    purpose of the variable.
    
    To help prove that apic_default's probe() hook doesn't get used
    elsewhere, further make apic_probe[] static at this occasion.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/genapic/default.c |  7 +------
 xen/arch/x86/genapic/probe.c   | 16 +++++++---------
 2 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/genapic/default.c b/xen/arch/x86/genapic/default.c
index bfd068cdc6..2c63c1f917 100644
--- a/xen/arch/x86/genapic/default.c
+++ b/xen/arch/x86/genapic/default.c
@@ -14,12 +14,7 @@
 #include <asm/io_apic.h>
 
 /* should be called last. */
-static __init int probe_default(void)
-{ 
-	return 1;
-} 
-
 const struct genapic __initconstrel apic_default = {
-	APIC_INIT("default", probe_default),
+	APIC_INIT("default", NULL),
 	GENAPIC_FLAT
 };
diff --git a/xen/arch/x86/genapic/probe.c b/xen/arch/x86/genapic/probe.c
index b963dc5ec0..1ee6cd73cd 100644
--- a/xen/arch/x86/genapic/probe.c
+++ b/xen/arch/x86/genapic/probe.c
@@ -18,7 +18,7 @@
 
 struct genapic __read_mostly genapic;
 
-const struct genapic *const __initconstrel apic_probe[] = {
+static const struct genapic *const __initconstrel apic_probe[] = {
 	&apic_bigsmp, 
 	&apic_default,	/* must be last */
 	NULL,
@@ -59,22 +59,20 @@ custom_param("apic", genapic_apic_force);
 
 void __init generic_apic_probe(void) 
 { 
-	bool changed;
 	int i;
 
 	record_boot_APIC_mode();
 
 	check_x2apic_preenabled();
-	cmdline_apic = changed = !!genapic.name;
 
-	for (i = 0; !changed && apic_probe[i]; i++) { 
-		if (apic_probe[i]->probe()) {
-			changed = 1;
+	cmdline_apic = genapic.name;
+
+	for (i = 0; !genapic.name && apic_probe[i]; i++) {
+		if (!apic_probe[i]->probe || apic_probe[i]->probe())
 			genapic = *apic_probe[i];
-		} 
 	}
-	if (!changed) 
-		genapic = apic_default;
+
+	BUG_ON(!genapic.name);
 
 	printk(KERN_INFO "Using APIC driver %s\n", genapic.name);
 } 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:56:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:56:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234554.407031 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh9D-0005Zp-FM; Mon, 29 Nov 2021 13:56:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234554.407031; Mon, 29 Nov 2021 13:56:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh9D-0005Zf-Be; Mon, 29 Nov 2021 13:56:47 +0000
Received: by outflank-mailman (input) for mailman id 234554;
 Mon, 29 Nov 2021 13:56:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh9B-0005YX-N2
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:56:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh9B-0001q0-M9
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:56:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh9B-0002mN-LT
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:56:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4NBGva31M0zeW6XVaZYxRnnSBSkeo/i+/Pf6fw4BFpw=; b=FTm60oL6oFj4IGrmWLbjIDHaEr
	1GMMKpEfL8DEvmbi9OxIaVSblO/MiFMv7X8mrb/kqsWRqPh8FtbJiA49r6PxE2dcnQgcYiDUSsSAJ
	scaa+0VZUmcqSgDyyRjzUReY1n8CtgKEtlmSTb6fDC4DygOkjZ+Ev8+G0cueViUUluTw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/APIC: rename cmdline_apic
Message-Id: <E1mrh9B-0002mN-LT@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:56:45 +0000

commit b8a13f487a0f3168e9caeaff20bb978772cee0e7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 5 13:35:21 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    x86/APIC: rename cmdline_apic
    
    The name hasn't been appropriate for a long time: It covers not only
    command line overrides, but also x2APIC pre-enabled state.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/genapic/probe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/genapic/probe.c b/xen/arch/x86/genapic/probe.c
index 1ee6cd73cd..66bc5ce072 100644
--- a/xen/arch/x86/genapic/probe.c
+++ b/xen/arch/x86/genapic/probe.c
@@ -24,7 +24,7 @@ static const struct genapic *const __initconstrel apic_probe[] = {
 	NULL,
 };
 
-static bool_t __initdata cmdline_apic;
+static bool __initdata forced_apic;
 
 void __init generic_bigsmp_probe(void)
 {
@@ -35,7 +35,7 @@ void __init generic_bigsmp_probe(void)
 	 * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support
 	 */
 
-	if (!cmdline_apic && genapic.name == apic_default.name)
+	if (!forced_apic && genapic.name == apic_default.name)
 		if (apic_bigsmp.probe()) {
 			genapic = apic_bigsmp;
 			printk(KERN_INFO "Overriding APIC driver with %s\n",
@@ -65,7 +65,7 @@ void __init generic_apic_probe(void)
 
 	check_x2apic_preenabled();
 
-	cmdline_apic = genapic.name;
+	forced_apic = genapic.name;
 
 	for (i = 0; !genapic.name && apic_probe[i]; i++) {
 		if (!apic_probe[i]->probe || apic_probe[i]->probe())
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:56:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:56:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234557.407036 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh9N-0005jY-GJ; Mon, 29 Nov 2021 13:56:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234557.407036; Mon, 29 Nov 2021 13:56:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh9N-0005jP-DE; Mon, 29 Nov 2021 13:56:57 +0000
Received: by outflank-mailman (input) for mailman id 234557;
 Mon, 29 Nov 2021 13:56: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 1mrh9L-0005h4-Q9
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:56: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 1mrh9L-0001q6-PR
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:56:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh9L-0002nM-Oh
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:56: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=MC9R4M0jutDXZQFURbR/163NtQodwVz3ZSnPjPt0LZM=; b=rGaD2ra+h0zKpWTzetHTHd3dnc
	YfBGhc359H+0ACIKX9hpK8x6XvWpGvFVXU+Rj/96lnj2Dew+7H1i8VGlAELkDRyKgZM+MUQoP0rlK
	kvOrmrmigrZw9l4Uf+vpZEHw8A6RijrqMQ0NygK1DnRADchHK3z8nCIVnaB3gW/bf7AI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/ACPI: drop dead interpreter-related code
Message-Id: <E1mrh9L-0002nM-Oh@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:56:55 +0000

commit 6de7e460c376ce583b6b0eb4f5bb73b004d1388b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Nov 5 13:35:46 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    x86/ACPI: drop dead interpreter-related code
    
    CONFIG_ACPI_INTERPRETER does not get defined anywhere, the enclosed code
    wouldn't build, and the default-to-phys logic works differently anyway
    (see genapic/bigsmp.c:probe_bigsmp()).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/acpi/boot.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c
index b101ef0961..24702d041c 100644
--- a/xen/arch/x86/acpi/boot.c
+++ b/xen/arch/x86/acpi/boot.c
@@ -477,16 +477,6 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
 	const struct acpi_table_fadt *fadt =
 		container_of(table, const struct acpi_table_fadt, header);
 
-#ifdef	CONFIG_ACPI_INTERPRETER
-	/* initialize sci_int early for INT_SRC_OVR MADT parsing */
-	acpi_fadt.sci_int = fadt->sci_int;
-
-	/* initialize rev and apic_phys_dest_mode for x86_64 genapic */
-	acpi_fadt.revision = fadt->revision;
-	acpi_fadt.force_apic_physical_destination_mode =
-	    fadt->force_apic_physical_destination_mode;
-#endif
-
 	/* detect the location of the ACPI PM Timer */
 	if (fadt->header.revision >= FADT2_REVISION_ID &&
 	    fadt->xpm_timer_block.space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:57:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:57:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234559.407039 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh9X-0005sX-HV; Mon, 29 Nov 2021 13:57:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234559.407039; Mon, 29 Nov 2021 13:57:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh9X-0005sR-Ed; Mon, 29 Nov 2021 13:57:07 +0000
Received: by outflank-mailman (input) for mailman id 234559;
 Mon, 29 Nov 2021 13:57: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 1mrh9V-0005qv-TU
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:57: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 1mrh9V-0001qT-Sl
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:57:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh9V-0002oP-S1
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:57: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=1ba6+RAMzTrE9WkFd5dYwZokhXEETSUHY5Dt58xkMmo=; b=IO4p/aybuW26TKfDDjmkTHTQUf
	1YkUtGV72/yCkCQNu86d/aun7VEax1S4j+dr1sImj5HMGfWAVhVtq7QN/bLZi3nBbdT+6HxWI4Q7u
	EVZhUiu3s4vAe7uwGjvGRjZImlrkHBydA36yjV1nUm/faClRXh1kdMQRcb+xt78YAMVI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/smp: Support NULL IPI function pointers
Message-Id: <E1mrh9V-0002oP-S1@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:57:05 +0000

commit 06c30ad7662f0c9fc8bc1c356f8aeaa63fb731ec
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 17 16:16:23 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    xen/smp: Support NULL IPI function pointers
    
    There are several cases where the act of interrupting a remote processor has
    the required side effect.  Explicitly allow NULL function pointers so the
    calling code doesn't have to provide a stub implementation.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/hap/hap.c | 11 +----------
 xen/arch/x86/mm/p2m-ept.c | 11 ++---------
 xen/common/smp.c          |  6 +++++-
 3 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index 73575deb0d..5b269ef8b3 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -696,15 +696,6 @@ static void hap_update_cr3(struct vcpu *v, int do_locking, bool noflush)
     hvm_update_guest_cr3(v, noflush);
 }
 
-/*
- * Dummy function to use with on_selected_cpus in order to trigger a vmexit on
- * selected pCPUs. When the VM resumes execution it will get a new ASID/VPID
- * and thus a clean TLB.
- */
-static void dummy_flush(void *data)
-{
-}
-
 static bool flush_tlb(bool (*flush_vcpu)(void *ctxt, struct vcpu *v),
                       void *ctxt)
 {
@@ -737,7 +728,7 @@ static bool flush_tlb(bool (*flush_vcpu)(void *ctxt, struct vcpu *v),
      * not currently running will already be flushed when scheduled because of
      * the ASID tickle done in the loop above.
      */
-    on_selected_cpus(mask, dummy_flush, NULL, 0);
+    on_selected_cpus(mask, NULL, NULL, 0);
 
     return true;
 }
diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index b2d57a3ee8..1459f66c00 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -1236,14 +1236,6 @@ static void ept_memory_type_changed(struct p2m_domain *p2m)
         ept_sync_domain(p2m);
 }
 
-static void __ept_sync_domain(void *info)
-{
-    /*
-     * The invalidation will be done before VMENTER (see
-     * vmx_vmenter_helper()).
-     */
-}
-
 static void ept_sync_domain_prepare(struct p2m_domain *p2m)
 {
     struct domain *d = p2m->domain;
@@ -1269,7 +1261,8 @@ static void ept_sync_domain_prepare(struct p2m_domain *p2m)
 
 static void ept_sync_domain_mask(struct p2m_domain *p2m, const cpumask_t *mask)
 {
-    on_selected_cpus(mask, __ept_sync_domain, p2m, 1);
+    /* Invalidation will be done in vmx_vmenter_helper(). */
+    on_selected_cpus(mask, NULL, NULL, 1);
 }
 
 void ept_sync_domain(struct p2m_domain *p2m)
diff --git a/xen/common/smp.c b/xen/common/smp.c
index 79f4ebd145..781bcf2c24 100644
--- a/xen/common/smp.c
+++ b/xen/common/smp.c
@@ -87,7 +87,11 @@ void smp_call_function_interrupt(void)
 
     irq_enter();
 
-    if ( call_data.wait )
+    if ( unlikely(!func) )
+    {
+        cpumask_clear_cpu(cpu, &call_data.selected);
+    }
+    else if ( call_data.wait )
     {
         (*func)(info);
         smp_mb();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:57:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:57:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234560.407044 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh9h-0005w0-JB; Mon, 29 Nov 2021 13:57:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234560.407044; Mon, 29 Nov 2021 13:57:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh9h-0005vs-G4; Mon, 29 Nov 2021 13:57:17 +0000
Received: by outflank-mailman (input) for mailman id 234560;
 Mon, 29 Nov 2021 13:57:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh9g-0005vO-0N
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:57:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh9f-0001qr-Vv
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:57:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh9f-0002pS-V6
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:57: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=Ihrg9RCE/4l145/jcR8E3TCJ60AyYSfm9mIEIu6CcXs=; b=vr0+BBR9LxrUlPFuNYkP/uDzFN
	SzxSz4rgyU8+twjjVP1C3HSWfBOTS+1Tns+ezm3S0t9k4V62gvRxdELN9ziKPtCqitb7A5otezqaA
	8vUNLMO+2xzTBan2dOIxgCqQIy8zVDaegD9VeRMVhpkfMUnnHDAlgsTh+vHncjF20E2M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/wait: Remove indirect jump
Message-Id: <E1mrh9f-0002pS-V6@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:57:15 +0000

commit f03567bd7e8efc0f667a67905862e6047babdb7a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Oct 22 16:07:07 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    xen/wait: Remove indirect jump
    
    There is no need for this to be an indirect jump at all.  Execution always
    returns to a specific location, so use a direct jump instead.
    
    Use a named label for the jump.  As both 1 and 2 have disappeared as labels,
    rename 3 to skip to better describe its purpose.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/wait.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/xen/common/wait.c b/xen/common/wait.c
index 24716e7676..9276d76464 100644
--- a/xen/common/wait.c
+++ b/xen/common/wait.c
@@ -144,18 +144,16 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
         "push %%r8;  push %%r9;  push %%r10; push %%r11;"
         "push %%r12; push %%r13; push %%r14; push %%r15;"
 
-        "call 1f;"
-        "1: addq $2f-1b,(%%rsp);"
         "sub %%esp,%%ecx;"
         "cmp %3,%%ecx;"
-        "ja 3f;"
+        "ja .L_skip;"
         "mov %%rsp,%%rsi;"
 
         /* check_wakeup_from_wait() longjmp()'s to this point. */
-        "2: rep movsb;"
+        ".L_wq_resume: rep movsb;"
         "mov %%rsp,%%rsi;"
-        "3: pop %%rax;"
 
+        ".L_skip:"
         "pop %%r15; pop %%r14; pop %%r13; pop %%r12;"
         "pop %%r11; pop %%r10; pop %%r9;  pop %%r8;"
         "pop %%rbp; pop %%rdx; pop %%rbx; pop %%rax"
@@ -204,15 +202,14 @@ void check_wakeup_from_wait(void)
     }
 
     /*
-     * Hand-rolled longjmp().  Returns to the pointer on the top of
-     * wqv->stack, and lands on a `rep movs` instruction.  All other GPRs are
-     * restored from the stack, so are available for use here.
+     * Hand-rolled longjmp().  Returns to __prepare_to_wait(), and lands on a
+     * `rep movs` instruction.  All other GPRs are restored from the stack, so
+     * are available for use here.
      */
     asm volatile (
-        "mov %1,%%"__OP"sp; INDIRECT_JMP %[ip]"
+        "mov %1,%%"__OP"sp; jmp .L_wq_resume;"
         : : "S" (wqv->stack), "D" (wqv->esp),
-          "c" ((char *)get_cpu_info() - (char *)wqv->esp),
-          [ip] "r" (*(unsigned long *)wqv->stack)
+          "c" ((char *)get_cpu_info() - (char *)wqv->esp)
         : "memory" );
     unreachable();
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:57:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:57:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234562.407048 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh9r-0005zG-Kb; Mon, 29 Nov 2021 13:57:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234562.407048; Mon, 29 Nov 2021 13:57:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrh9r-0005z7-Hd; Mon, 29 Nov 2021 13:57:27 +0000
Received: by outflank-mailman (input) for mailman id 234562;
 Mon, 29 Nov 2021 13:57:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh9q-0005yi-41
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:57:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh9q-0001sd-3B
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:57:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrh9q-0002qf-2B
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:57:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oCB7DDW8LqqbI9AyS/V9/MCEDZlxmPSWluWxd0iycc8=; b=sHT1RNqQ1KdE/bVwysMcA/k+X5
	jZwL0MwNHYY92fhJw1JAFCyWiDUSZCumzajVs1LjJ4yTY78pqWLX1yFPoDBnn6GzLmseSMcx3RkN4
	uaVSyvIQXFATfBhVygkEfokNPuiG/xFHspyanlY0gcj6yMTjiG2FGRx4kq6/P/HoCmV4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/IO-APIC: Drop function pointers from __ioapic_{read,write}_entry()
Message-Id: <E1mrh9q-0002qf-2B@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:57:26 +0000

commit 245a320ce22752562c2143d0fb406aeb2e334dfb
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sun Oct 31 00:03:56 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    x86/IO-APIC: Drop function pointers from __ioapic_{read,write}_entry()
    
    Function pointers are expensive, and the raw parameter is a constant at the
    root of all call trees, meaning that it predicts very well with local branch
    history.
    
    Furthermore, the knock-on effects are quite impressive.
    
      $ ../scripts/bloat-o-meter xen-syms-before xen-syms-after
      add/remove: 0/4 grow/shrink: 3/9 up/down: 459/-823 (-364)
      Function                                     old     new   delta
      __ioapic_write_entry                          73     286    +213
      __ioapic_read_entry                           75     276    +201
      save_IO_APIC_setup                           182     227     +45
      eoi_IO_APIC_irq                              241     229     -12
      disable_IO_APIC                              296     280     -16
      mask_IO_APIC_setup                           272     240     -32
      __io_apic_write                               46       -     -46
      __io_apic_read                                46       -     -46
      io_apic_set_pci_routing                      985     930     -55
      __io_apic_eoi.part                           223     161     -62
      io_apic_write                                 69       -     -69
      io_apic_read                                  69       -     -69
      restore_IO_APIC_setup                        325     253     -72
      ioapic_guest_write                          1413    1333     -80
      clear_IO_APIC_pin                            447     343    -104
      setup_IO_APIC                               5148    4988    -160
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/io_apic.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index c3ad9efac8..1c49a0fe14 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -235,11 +235,19 @@ union entry_union {
 struct IO_APIC_route_entry __ioapic_read_entry(
     unsigned int apic, unsigned int pin, bool raw)
 {
-    unsigned int (*read)(unsigned int, unsigned int)
-        = raw ? __io_apic_read : io_apic_read;
     union entry_union eu;
-    eu.w1 = (*read)(apic, 0x10 + 2 * pin);
-    eu.w2 = (*read)(apic, 0x11 + 2 * pin);
+
+    if ( raw )
+    {
+        eu.w1 = __io_apic_read(apic, 0x10 + 2 * pin);
+        eu.w2 = __io_apic_read(apic, 0x11 + 2 * pin);
+    }
+    else
+    {
+        eu.w1 = io_apic_read(apic, 0x10 + 2 * pin);
+        eu.w2 = io_apic_read(apic, 0x11 + 2 * pin);
+    }
+
     return eu.entry;
 }
 
@@ -259,12 +267,18 @@ void __ioapic_write_entry(
     unsigned int apic, unsigned int pin, bool raw,
     struct IO_APIC_route_entry e)
 {
-    void (*write)(unsigned int, unsigned int, unsigned int)
-        = raw ? __io_apic_write : io_apic_write;
     union entry_union eu = { .entry = e };
 
-    (*write)(apic, 0x11 + 2*pin, eu.w2);
-    (*write)(apic, 0x10 + 2*pin, eu.w1);
+    if ( raw )
+    {
+        __io_apic_write(apic, 0x11 + 2 * pin, eu.w2);
+        __io_apic_write(apic, 0x10 + 2 * pin, eu.w1);
+    }
+    else
+    {
+        io_apic_write(apic, 0x11 + 2 * pin, eu.w2);
+        io_apic_write(apic, 0x10 + 2 * pin, eu.w1);
+    }
 }
 
 static void ioapic_write_entry(
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:57:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:57:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234563.407052 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrhA1-00062K-MW; Mon, 29 Nov 2021 13:57:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234563.407052; Mon, 29 Nov 2021 13:57:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrhA1-00062C-J8; Mon, 29 Nov 2021 13:57:37 +0000
Received: by outflank-mailman (input) for mailman id 234563;
 Mon, 29 Nov 2021 13:57:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrhA0-00061w-7l
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:57:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrhA0-0001si-70
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:57:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrhA0-0002s0-68
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:57:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mF0JcLc2F2FhalURsQFVn4MYO9PgYPKTjUOBq9jTOwI=; b=qCp2fZZEpUkPlXWIkhg5qeyrdJ
	wXIY7l1Cn93rOENsRU7Qij8Hem4afz8LJYxZFdf4i9ZHLAKTWu5htgyTASaB7Un/Uz67aEL3aNgD4
	F58/e86nXB2UzROb76IR6yLZQg2qnDkXr8pYRxjMYxy9vUFyDtGIRRMS4/qqAFZPOvmI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hvm: Remove callback from paging->flush_tlb() hook
Message-Id: <E1mrhA0-0002s0-68@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:57:36 +0000

commit 11d9e114b53045e5f2009a26dad1d0d0f7df441e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 17 17:45:21 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    x86/hvm: Remove callback from paging->flush_tlb() hook
    
    TLB flushing is a hotpath, and function pointer calls are
    expensive (especially under retpoline) for what amounts to an identity
    transform on the data.  Just pass the vcpu_bitmap bitmap directly.
    
    As we use NULL for all rather than none, introduce a flush_vcpu() helper to
    avoid the risk of logical errors from opencoding the expression.  This also
    means the viridian callers can avoid writing an all-ones bitmap for the
    flushing logic to consume.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/hvm.c               |  7 +------
 xen/arch/x86/hvm/viridian/viridian.c | 34 +++++++++++-----------------------
 xen/arch/x86/mm/hap/hap.c            | 11 ++++++++---
 xen/arch/x86/mm/shadow/common.c      | 18 +++++++++++-------
 xen/arch/x86/mm/shadow/private.h     |  3 +--
 xen/include/asm-x86/paging.h         | 11 ++++-------
 6 files changed, 36 insertions(+), 48 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index eee365711d..31e9474db0 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4047,17 +4047,12 @@ static void hvm_s3_resume(struct domain *d)
     }
 }
 
-static bool always_flush(void *ctxt, struct vcpu *v)
-{
-    return true;
-}
-
 static int hvmop_flush_tlb_all(void)
 {
     if ( !is_hvm_domain(current->domain) )
         return -EINVAL;
 
-    return paging_flush_tlb(always_flush, NULL) ? 0 : -ERESTART;
+    return paging_flush_tlb(NULL) ? 0 : -ERESTART;
 }
 
 static int hvmop_set_evtchn_upcall_vector(
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index efdd60b205..9e1363207f 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -574,13 +574,6 @@ static void vpmask_fill(struct hypercall_vpmask *vpmask)
     bitmap_fill(vpmask->mask, HVM_MAX_VCPUS);
 }
 
-static bool vpmask_test(const struct hypercall_vpmask *vpmask,
-                        unsigned int vp)
-{
-    ASSERT(vp < HVM_MAX_VCPUS);
-    return test_bit(vp, vpmask->mask);
-}
-
 static unsigned int vpmask_first(const struct hypercall_vpmask *vpmask)
 {
     return find_first_bit(vpmask->mask, HVM_MAX_VCPUS);
@@ -669,17 +662,6 @@ static int hv_vpset_to_vpmask(const struct hv_vpset *set,
 #undef NR_VPS_PER_BANK
 }
 
-/*
- * Windows should not issue the hypercalls requiring this callback in the
- * case where vcpu_id would exceed the size of the mask.
- */
-static bool need_flush(void *ctxt, struct vcpu *v)
-{
-    struct hypercall_vpmask *vpmask = ctxt;
-
-    return vpmask_test(vpmask, v->vcpu_id);
-}
-
 union hypercall_input {
     uint64_t raw;
     struct {
@@ -714,6 +696,7 @@ static int hvcall_flush(const union hypercall_input *input,
         uint64_t flags;
         uint64_t vcpu_mask;
     } input_params;
+    unsigned long *vcpu_bitmap;
 
     /* These hypercalls should never use the fast-call convention. */
     if ( input->fast )
@@ -730,18 +713,19 @@ static int hvcall_flush(const union hypercall_input *input,
      * so err on the safe side.
      */
     if ( input_params.flags & HV_FLUSH_ALL_PROCESSORS )
-        vpmask_fill(vpmask);
+        vcpu_bitmap = NULL;
     else
     {
         vpmask_empty(vpmask);
         vpmask_set(vpmask, 0, input_params.vcpu_mask);
+        vcpu_bitmap = vpmask->mask;
     }
 
     /*
      * A false return means that another vcpu is currently trying
      * a similar operation, so back off.
      */
-    if ( !paging_flush_tlb(need_flush, vpmask) )
+    if ( !paging_flush_tlb(vcpu_bitmap) )
         return -ERESTART;
 
     output->rep_complete = input->rep_count;
@@ -760,6 +744,7 @@ static int hvcall_flush_ex(const union hypercall_input *input,
         uint64_t flags;
         struct hv_vpset set;
     } input_params;
+    unsigned long *vcpu_bitmap;
 
     /* These hypercalls should never use the fast-call convention. */
     if ( input->fast )
@@ -770,8 +755,9 @@ static int hvcall_flush_ex(const union hypercall_input *input,
                                   sizeof(input_params)) != HVMTRANS_okay )
         return -EINVAL;
 
-    if ( input_params.flags & HV_FLUSH_ALL_PROCESSORS )
-        vpmask_fill(vpmask);
+    if ( input_params.flags & HV_FLUSH_ALL_PROCESSORS ||
+         input_params.set.format == HV_GENERIC_SET_ALL )
+        vcpu_bitmap = NULL;
     else
     {
         union hypercall_vpset *vpset = &this_cpu(hypercall_vpset);
@@ -801,13 +787,15 @@ static int hvcall_flush_ex(const union hypercall_input *input,
         rc = hv_vpset_to_vpmask(set, vpmask);
         if ( rc )
             return rc;
+
+        vcpu_bitmap = vpmask->mask;
     }
 
     /*
      * A false return means that another vcpu is currently trying
      * a similar operation, so back off.
      */
-    if ( !paging_flush_tlb(need_flush, vpmask) )
+    if ( !paging_flush_tlb(vcpu_bitmap) )
         return -ERESTART;
 
     output->rep_complete = input->rep_count;
diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index 5b269ef8b3..de4b13565a 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -696,8 +696,13 @@ static void hap_update_cr3(struct vcpu *v, int do_locking, bool noflush)
     hvm_update_guest_cr3(v, noflush);
 }
 
-static bool flush_tlb(bool (*flush_vcpu)(void *ctxt, struct vcpu *v),
-                      void *ctxt)
+static bool flush_vcpu(const struct vcpu *v, const unsigned long *vcpu_bitmap)
+{
+    return !vcpu_bitmap || test_bit(v->vcpu_id, vcpu_bitmap);
+}
+
+/* Flush TLB of selected vCPUs.  NULL for all. */
+static bool flush_tlb(const unsigned long *vcpu_bitmap)
 {
     static DEFINE_PER_CPU(cpumask_t, flush_cpumask);
     cpumask_t *mask = &this_cpu(flush_cpumask);
@@ -712,7 +717,7 @@ static bool flush_tlb(bool (*flush_vcpu)(void *ctxt, struct vcpu *v),
     {
         unsigned int cpu;
 
-        if ( !flush_vcpu(ctxt, v) )
+        if ( !flush_vcpu(v, vcpu_bitmap) )
             continue;
 
         hvm_asid_flush_vcpu(v);
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 8c1b041f71..de09ef5cae 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3069,9 +3069,13 @@ static void sh_clean_dirty_bitmap(struct domain *d)
 }
 
 
-/* Fluhs TLB of selected vCPUs. */
-bool shadow_flush_tlb(bool (*flush_vcpu)(void *ctxt, struct vcpu *v),
-                      void *ctxt)
+static bool flush_vcpu(const struct vcpu *v, const unsigned long *vcpu_bitmap)
+{
+    return !vcpu_bitmap || test_bit(v->vcpu_id, vcpu_bitmap);
+}
+
+/* Flush TLB of selected vCPUs.  NULL for all. */
+bool shadow_flush_tlb(const unsigned long *vcpu_bitmap)
 {
     static DEFINE_PER_CPU(cpumask_t, flush_cpumask);
     cpumask_t *mask = &this_cpu(flush_cpumask);
@@ -3084,12 +3088,12 @@ bool shadow_flush_tlb(bool (*flush_vcpu)(void *ctxt, struct vcpu *v),
 
     /* Pause all other vcpus. */
     for_each_vcpu ( d, v )
-        if ( v != current && flush_vcpu(ctxt, v) )
+        if ( v != current && flush_vcpu(v, vcpu_bitmap) )
             vcpu_pause_nosync(v);
 
     /* Now that all VCPUs are signalled to deschedule, we wait... */
     for_each_vcpu ( d, v )
-        if ( v != current && flush_vcpu(ctxt, v) )
+        if ( v != current && flush_vcpu(v, vcpu_bitmap) )
             while ( !vcpu_runnable(v) && v->is_running )
                 cpu_relax();
 
@@ -3103,7 +3107,7 @@ bool shadow_flush_tlb(bool (*flush_vcpu)(void *ctxt, struct vcpu *v),
     {
         unsigned int cpu;
 
-        if ( !flush_vcpu(ctxt, v) )
+        if ( !flush_vcpu(v, vcpu_bitmap) )
             continue;
 
         paging_update_cr3(v, false);
@@ -3118,7 +3122,7 @@ bool shadow_flush_tlb(bool (*flush_vcpu)(void *ctxt, struct vcpu *v),
 
     /* Done. */
     for_each_vcpu ( d, v )
-        if ( v != current && flush_vcpu(ctxt, v) )
+        if ( v != current && flush_vcpu(v, vcpu_bitmap) )
             vcpu_unpause(v);
 
     return true;
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 35efb1b984..e4db8d3254 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -922,8 +922,7 @@ static inline int sh_check_page_has_no_refs(struct page_info *page)
 }
 
 /* Flush the TLB of the selected vCPUs. */
-bool shadow_flush_tlb(bool (*flush_vcpu)(void *ctxt, struct vcpu *v),
-                      void *ctxt);
+bool shadow_flush_tlb(const unsigned long *vcpu_bitmap);
 
 #endif /* _XEN_SHADOW_PRIVATE_H */
 
diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index 996c2cd038..308f1115dd 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -141,9 +141,7 @@ struct paging_mode {
     void          (*update_cr3            )(struct vcpu *v, int do_locking,
                                             bool noflush);
     void          (*update_paging_modes   )(struct vcpu *v);
-    bool          (*flush_tlb             )(bool (*flush_vcpu)(void *ctxt,
-                                                               struct vcpu *v),
-                                            void *ctxt);
+    bool          (*flush_tlb             )(const unsigned long *vcpu_bitmap);
 
     unsigned int guest_levels;
 
@@ -417,11 +415,10 @@ static always_inline unsigned int paging_max_paddr_bits(const struct domain *d)
     return bits;
 }
 
-static inline bool paging_flush_tlb(bool (*flush_vcpu)(void *ctxt,
-                                                       struct vcpu *v),
-                                    void *ctxt)
+/* Flush selected vCPUs TLBs.  NULL for all. */
+static inline bool paging_flush_tlb(const unsigned long *vcpu_bitmap)
 {
-    return paging_get_hostmode(current)->flush_tlb(flush_vcpu, ctxt);
+    return paging_get_hostmode(current)->flush_tlb(vcpu_bitmap);
 }
 
 #endif /* XEN_PAGING_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:57:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:57:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234564.407056 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrhAB-000661-Ox; Mon, 29 Nov 2021 13:57:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234564.407056; Mon, 29 Nov 2021 13:57:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrhAB-00065t-Lu; Mon, 29 Nov 2021 13:57:47 +0000
Received: by outflank-mailman (input) for mailman id 234564;
 Mon, 29 Nov 2021 13:57:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrhAA-00065b-Al
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:57:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrhAA-0001sp-A5
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:57:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrhAA-0002uG-9I
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:57:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=O4ec6+2GRuo+bLbXDhejCqBQIdh+wTNCzkd7ooxrg1U=; b=XBMmV4f9/8h8zKnnYKHgoqQCtA
	i/LtydC+9Rfq03Sv+7YoSrBgGSq3+klXsxFV5bObo+TEdIM/HLfNp60c4UavjnIEE85pHZoXXLUzy
	9pHjeKbuNr/JlSH5tpARN5KnD37wEQnJsjcwe7G5p4FVbsMHHZrDK2GHijsztvJGDs6w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/dom0: Fix command line parsing issues with dom0_nodes=
Message-Id: <E1mrhAA-0002uG-9I@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:57:46 +0000

commit 8969d58404ceddf9994574253965dc46c4308da3
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Nov 19 13:16:12 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    x86/dom0: Fix command line parsing issues with dom0_nodes=
    
    This is a simple comma separated list, so use the normal form.
    
     * Don't cease processing subsequent elements on an error
     * Do report -EINVAL for things like `dom0_nodes=4foo`
     * Don't opencode the cmdline_strcmp() helper
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/dom0_build.c | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index fe24e11b37..5a7441ed5b 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -169,30 +169,37 @@ bool __initdata dom0_affinity_relaxed;
 
 static int __init parse_dom0_nodes(const char *s)
 {
+    const char *ss;
+    int rc = 0;
+
     do {
+        ss = strchr(s, ',');
+        if ( !ss )
+            ss = strchr(s, '\0');
+
         if ( isdigit(*s) )
         {
+            const char *endp;
+
             if ( dom0_nr_pxms >= ARRAY_SIZE(dom0_pxms) )
-                return -E2BIG;
-            dom0_pxms[dom0_nr_pxms] = simple_strtoul(s, &s, 0);
-            if ( !*s || *s == ',' )
-                ++dom0_nr_pxms;
+                rc = -E2BIG;
+            else if ( (dom0_pxms[dom0_nr_pxms] = simple_strtoul(s, &endp, 0),
+                       endp != ss) )
+                rc = -EINVAL;
+            else
+                dom0_nr_pxms++;
         }
-        else if ( !strncmp(s, "relaxed", 7) && (!s[7] || s[7] == ',') )
-        {
+        else if ( !cmdline_strcmp(s, "relaxed") )
             dom0_affinity_relaxed = true;
-            s += 7;
-        }
-        else if ( !strncmp(s, "strict", 6) && (!s[6] || s[6] == ',') )
-        {
+        else if ( !cmdline_strcmp(s, "strict") )
             dom0_affinity_relaxed = false;
-            s += 6;
-        }
         else
-            return -EINVAL;
-    } while ( *s++ == ',' );
+            rc = -EINVAL;
 
-    return s[-1] ? -EINVAL : 0;
+        s = ss + 1;
+    } while ( *ss );
+
+    return rc;
 }
 custom_param("dom0_nodes", parse_dom0_nodes);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:57:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:57:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234566.407060 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrhAL-0006B7-QE; Mon, 29 Nov 2021 13:57:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234566.407060; Mon, 29 Nov 2021 13:57:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrhAL-0006Az-NO; Mon, 29 Nov 2021 13:57:57 +0000
Received: by outflank-mailman (input) for mailman id 234566;
 Mon, 29 Nov 2021 13:57:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrhAK-0006Aa-Dy
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:57:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrhAK-0001t1-DD
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:57:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrhAK-0002vB-CM
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:57:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UpgVbXl4sZSV9wG5GQyVQCBNY9nElT845I9OPhbX/t0=; b=Fddpa8fPJkEOEV2FsSnnRGqMJn
	3fsxkIJtiuvjJwj/fI9oUbfoxjeW4KJ1B9Fgk68tV6/a3yQi4jNnYelUhcOb1pxLPHeww+8Ngtr9g
	r4pfQbGlbSW11LQTRfdC6s8NrulWdbvEdwHjQp5JpDvO5DrUXhRy+sH/6w/cDrkGsqAs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Collect PERFC_exceptions stats for IST vectors too
Message-Id: <E1mrhAK-0002vB-CM@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:57:56 +0000

commit d9f60a924c03761081b99145a51bc85ee54efcdc
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Oct 8 10:47:07 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    x86/traps: Collect PERFC_exceptions stats for IST vectors too
    
    This causes NMIs, #DB and #MC to be counted, rather than being reported as 0.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/entry.S | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index d5998acf88..3caa565476 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -1005,6 +1005,13 @@ handle_ist_exception:
 #endif
         movq  %rsp,%rdi
         movzbl UREGS_entry_vector(%rsp),%eax
+
+#ifdef CONFIG_PERF_COUNTERS
+        lea   per_cpu__perfcounters(%rip), %rcx
+        add   STACK_CPUINFO_FIELD(per_cpu_offset)(%r14), %rcx
+        incl  ASM_PERFC_exceptions * 4(%rcx, %rax, 4)
+#endif
+
         leaq  exception_table(%rip),%rdx
         mov   (%rdx, %rax, 8), %rdx
         INDIRECT_CALL %rdx
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:58:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:58:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234567.407063 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrhAV-0006EB-S0; Mon, 29 Nov 2021 13:58:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234567.407063; Mon, 29 Nov 2021 13:58:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrhAV-0006E3-Or; Mon, 29 Nov 2021 13:58:07 +0000
Received: by outflank-mailman (input) for mailman id 234567;
 Mon, 29 Nov 2021 13:58:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrhAU-0006Dn-H9
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:58:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrhAU-0001tR-GP
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:58:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrhAU-0002wB-Fi
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:58:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=F1zPSFgAffoWA3nmzB7pOn7FfmhHFVEJfX2ke5l61fs=; b=UCzaTTns3/ZEKzo1UKoHOqzya0
	BrC+gczmF2Lj07a9KiG0nXW0zpxd/0kBzNcgQvjNXO2bZaDgHAc2uGIn59mnqPn36ULhuYbQdmPHi
	rap7cqFjiE0oOA80hjurX1LL31wEGlF5/ik5+uV46me3/lq+WKdyoc/Y7fvZqX7bjWOY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Drop dummy_nmi_callback()
Message-Id: <E1mrhAU-0002wB-Fi@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:58:06 +0000

commit 04c48ccd75963891e377c5f27dd7411dde1a4286
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Oct 8 13:11:21 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    x86/traps: Drop dummy_nmi_callback()
    
    The unconditional nmi_callback() call in do_nmi() calls dummy_nmi_callback()
    in all cases other than for a few specific and rare tasks (alternative
    patching, microcode loading, etc).
    
    Indirect calls are expensive under retpoline, so rearrange the logic to use
    NULL as the default, and skip the call entirely in the common case.
    
    While rearranging the code, fold the exit paths.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/traps.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 84c9d9686a..3bc4cd5e1e 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1869,29 +1869,23 @@ static void unknown_nmi_error(const struct cpu_user_regs *regs,
     }
 }
 
-static int dummy_nmi_callback(const struct cpu_user_regs *regs, int cpu)
-{
-    return 0;
-}
-
-static nmi_callback_t *nmi_callback = dummy_nmi_callback;
+static nmi_callback_t *__read_mostly nmi_callback;
 
 DEFINE_PER_CPU(unsigned int, nmi_count);
 
 void do_nmi(const struct cpu_user_regs *regs)
 {
     unsigned int cpu = smp_processor_id();
+    nmi_callback_t *callback;
     unsigned char reason = 0;
     bool handle_unknown = false;
 
     this_cpu(nmi_count)++;
     nmi_enter();
 
-    if ( nmi_callback(regs, cpu) )
-    {
-        nmi_exit();
-        return;
-    }
+    callback = ACCESS_ONCE(nmi_callback);
+    if ( unlikely(callback) && callback(regs, cpu) )
+        goto out;
 
     /*
      * Accessing port 0x61 may trap to SMM which has been actually
@@ -1918,6 +1912,7 @@ void do_nmi(const struct cpu_user_regs *regs)
             unknown_nmi_error(regs, reason);
     }
 
+ out:
     nmi_exit();
 }
 
@@ -1932,7 +1927,7 @@ nmi_callback_t *set_nmi_callback(nmi_callback_t *callback)
 
 void unset_nmi_callback(void)
 {
-    nmi_callback = dummy_nmi_callback;
+    nmi_callback = NULL;
 }
 
 bool nmi_check_continuation(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Nov 29 13:58:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 29 Nov 2021 13:58:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.234568.407069 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrhAf-0006H6-Tp; Mon, 29 Nov 2021 13:58:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 234568.407069; Mon, 29 Nov 2021 13:58:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1mrhAf-0006Gu-QO; Mon, 29 Nov 2021 13:58:17 +0000
Received: by outflank-mailman (input) for mailman id 234568;
 Mon, 29 Nov 2021 13:58:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrhAe-0006Gd-Ks
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:58:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrhAe-0001tu-KB
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:58:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1mrhAe-0002wt-JM
 for xen-changelog@lists.xenproject.org; Mon, 29 Nov 2021 13:58:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=miK2Mzsr/vDzLL/uM2dZiu9ecm+BzG02uKB1AezDq1k=; b=fdn/M/AiElgTxhvLlRdvSz7iVo
	V0gRTa600eZjXDrbJ0z9bJuByHhOm7UhW5+Ux+oj/cKeR8+281P5wa+CGFcHeChqhYh9m+M+OCXsh
	E+VL5PSVAK9xn/IVPkCNYL9q00FyvnkSoe4rIIdAVDfwuH4ohkfhbCGeXHSOVel2kmb0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/crash: Drop manual hooking of exception_table[]
Message-Id: <E1mrhAe-0002wt-JM@xenbits.xenproject.org>
Date: Mon, 29 Nov 2021 13:58:16 +0000

commit e7f147bf4ac725492962a501da72f5ab6be682db
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 7 14:02:10 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Nov 29 13:53:05 2021 +0000

    x86/crash: Drop manual hooking of exception_table[]
    
    NMI hooking in the crash path has undergone several revisions since its
    introduction.  What we have now is not sufficiently different from the regular
    nmi_callback() mechanism to warrant special casing.
    
    Use set_nmi_callback() directly, and do away with patching a read-only data
    structure via a read-write alias.  This also means that the
    vmx_vmexit_handler() can and should call do_nmi() directly, rather than
    indirecting through the exception table to pick up the crash path hook.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/crash.c       | 15 ++-------------
 xen/arch/x86/hvm/vmx/vmx.c |  2 +-
 xen/arch/x86/traps.c       |  5 +++++
 3 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index 0611b4fb9b..f6264946a6 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -36,10 +36,8 @@ static unsigned int crashing_cpu;
 static DEFINE_PER_CPU_READ_MOSTLY(bool, crash_save_done);
 
 /* This becomes the NMI handler for non-crashing CPUs, when Xen is crashing. */
-static void noreturn do_nmi_crash(const struct cpu_user_regs *regs)
+static int noreturn do_nmi_crash(const struct cpu_user_regs *regs, int cpu)
 {
-    unsigned int cpu = smp_processor_id();
-
     stac();
 
     /* nmi_shootdown_cpus() should ensure that this assertion is correct. */
@@ -136,16 +134,7 @@ static void nmi_shootdown_cpus(void)
                     SYS_DESC_irq_gate, 0, &trap_nop);
     set_ist(&idt_tables[cpu][TRAP_machine_check], IST_NONE);
 
-    /*
-     * Ideally would be:
-     *   exception_table[TRAP_nmi] = &do_nmi_crash;
-     *
-     * but the exception_table is read only.  Access it via its directmap
-     * mappings.
-     */
-    write_atomic((unsigned long *)__va(__pa(&exception_table[TRAP_nmi])),
-                 (unsigned long)&do_nmi_crash);
-
+    set_nmi_callback(do_nmi_crash);
     smp_send_nmi_allbutself();
 
     msecs = 1000; /* Wait at most a second for the other cpus to stop */
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index d403e2d806..37c31c08b9 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3887,7 +3887,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
              ((intr_info & INTR_INFO_INTR_TYPE_MASK) ==
               MASK_INSR(X86_EVENTTYPE_NMI, INTR_INFO_INTR_TYPE_MASK)) )
         {
-            exception_table[TRAP_nmi](regs);
+            do_nmi(regs);
             enable_nmis();
         }
         break;
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 3bc4cd5e1e..6d7d88c3c4 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1883,6 +1883,11 @@ void do_nmi(const struct cpu_user_regs *regs)
     this_cpu(nmi_count)++;
     nmi_enter();
 
+    /*
+     * Think carefully before putting any logic before this point.
+     * nmi_callback() might be the crash quiesce...
+     */
+
     callback = ACCESS_ONCE(nmi_callback);
     if ( unlikely(callback) && callback(regs, cpu) )
         goto out;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Nov 30 11:55:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Nov 2021 11:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.235069.407877 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ms1iz-0003P8-Fg; Tue, 30 Nov 2021 11:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 235069.407877; Tue, 30 Nov 2021 11: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 1ms1iz-0003P1-CS; Tue, 30 Nov 2021 11:55:05 +0000
Received: by outflank-mailman (input) for mailman id 235069;
 Tue, 30 Nov 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 1ms1iy-0003Ov-GL
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 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 1ms1iy-00039v-D6
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 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 1ms1iy-0005o7-C8
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 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=7J3A9SB5j0yYtU6JqDgCheseyYsYiklnPByBhDEzgbk=; b=7OMQc2Tm78WslzqMKeDtZH3TgN
	BAASATpbKwczkgNJf8df+4o6mV1kb/gXT2KpCGB1CG9PUMSg5dlnRzv43Q6miwFezRiQpp0B9uZs6
	pTzFdqKfiEWXT6JheRpL9WgdCi3jxvTaytWQOxyCx5ptijtYpxh/TugQAGGHm9mY+vgM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] CHANGELOG: add missing entries for work during the 4.16 release cycle
Message-Id: <E1ms1iy-0005o7-C8@xenbits.xenproject.org>
Date: Tue, 30 Nov 2021 11:55:04 +0000

commit e2544a28beacd854f295095d102a8773743ac917
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Nov 24 12:24:03 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 30 11:42:00 2021 +0000

    CHANGELOG: add missing entries for work during the 4.16 release cycle
    
    Document some of the relevant changes during the 4.16 release cycle.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 CHANGELOG.md | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ad1a8c2bc2..1fe52da7db 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,31 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - qemu-traditional based device models (both, qemu-traditional and ioemu-stubdom) will
    no longer be built per default. In order to be able to use those, configure needs to
    be called with "--enable-qemu-traditional" as parameter.
+ - Fixes for credit2 scheduler stability in corner case conditions.
+ - Ongoing improvements in the hypervisor build system.
+ - vtpmmgr miscellaneous fixes in preparation for TPM 2.0 support.
+ - 32bit PV guests only supported in shim mode.
+ - Improved PVH dom0 debug key handling.
+ - Fix booting on some Intel systems without a PIT (i8254).
+ - Cleanup of the xenstore library interface.
+ - Fix truncation of return value from xencall2 by introducing a new helper
+   that returns a long instead.
+ - Fix system register accesses on Arm to use the proper 32/64bit access size.
+ - Various fixes for Arm OP-TEE mediator.
+ - Switch to domheap for Xen page tables.
+
+### Added
+ - 32bit Arm builds to the gitlab-ci automated tests.
+ - x86 full system tests to the gitlab-ci automated tests.
+ - Arm limited vPMU support for guests.
+ - Static physical memory allocation for dom0less on arm64.
+ - dom0less EFI support on arm64.
+ - GICD_ICPENDR register handling in vGIC emulation to support Zephyr OS.
+ - CPU feature leveling on arm64 platform with heterogeneous cores.
+ - Report unpopulated memory regions safe to use for external mappings, Arm and
+   device tree only.
+ - Support of generic DT IOMMU bindings for Arm SMMU v2.
+ - Limit grant table version on a per-domain basis.
 
 ## [4.15.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - 2021-04-08
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Nov 30 11:55:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Nov 2021 11:55:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.235070.407881 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ms1j9-0003R5-HJ; Tue, 30 Nov 2021 11:55:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 235070.407881; Tue, 30 Nov 2021 11:55:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ms1j9-0003Qv-EB; Tue, 30 Nov 2021 11:55:15 +0000
Received: by outflank-mailman (input) for mailman id 235070;
 Tue, 30 Nov 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 1ms1j8-0003Qp-HE
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 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 1ms1j8-00039z-GJ
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 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 1ms1j8-0005ok-FP
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 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=4c0CNLQaQOSy4fYFdaaOK2nosm+Te5yOunVwXp0iO2g=; b=omV8wuXJMsDVXhYToMUzs4PQWM
	y/a0buGac2WPg0MUisvmqL5c9h6PGpNCDUUjgUT+VRypFJ0XOwIZYms/Ehc3bCh94DqdgoSEmOkFV
	sblD/Fo2MDYFCDqFql9GlL2HvBqBt1ARX4UIg4So+M46CMzN3j3r9SUgtWIZLp+L/62g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] Config.mk: Bump tags to 4.16.0 final
Message-Id: <E1ms1j8-0005ok-FP@xenbits.xenproject.org>
Date: Tue, 30 Nov 2021 11:55:14 +0000

commit c9b5e2fb623a454a642d6f0d989ba9021a459739
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 30 11:32:36 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 30 11:42:00 2021 +0000

    Config.mk: Bump tags to 4.16.0 final
    
    No actual change to the code since RC4.
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 Config.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Config.mk b/Config.mk
index b32a185efc..8f9bc05f8c 100644
--- a/Config.mk
+++ b/Config.mk
@@ -239,15 +239,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.16.0-rc4
-MINIOS_UPSTREAM_REVISION ?= xen-4.16.0-rc4
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.16.0
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.16.0
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= xen-4.16.0-rc4
+QEMU_TRADITIONAL_REVISION ?= xen-4.16.0
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Nov 30 11:55:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Nov 2021 11:55:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.235071.407885 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ms1jJ-0003VE-Ii; Tue, 30 Nov 2021 11:55:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 235071.407885; Tue, 30 Nov 2021 11:55:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ms1jJ-0003V5-Fh; Tue, 30 Nov 2021 11:55:25 +0000
Received: by outflank-mailman (input) for mailman id 235071;
 Tue, 30 Nov 2021 11:55:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms1jI-0003Uu-KM
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 11:55:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms1jI-0003AH-JZ
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 11:55:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms1jI-0005pJ-IX
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 11:55:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+6k7+g/WHmmEV80kje8rZn5Nu7nQXZfiR8Mnx0dOOpk=; b=x7uTWzL8SOjbDUxJyGKF2GkPOW
	p5EVuH/8eFbjWILAQMUbSMHdbpxzV7jdthKOsEGU2TGAE3aTc7vwY4aGFkhhIuMzuuUtmlpv7ALVi
	+4CMCATo3Vg3p125w5/b208LUwgh2lr3PYbD0at76wkdPOSywuPdUimdFBuPx7lkoKWo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] SUPPORT.md: Define support lifetime
Message-Id: <E1ms1jI-0005pJ-IX@xenbits.xenproject.org>
Date: Tue, 30 Nov 2021 11:55:24 +0000

commit 01912f6c5f51ac1fd5e59248027021ad9f5a24d2
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 30 11:14:00 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 30 11:42:00 2021 +0000

    SUPPORT.md: Define support lifetime
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index b1367e2b22..85726102ea 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -10,9 +10,9 @@ for the definitions of the support status levels etc.
 # Release Support
 
     Xen-Version: 4.16
-    Initial-Release: n/a
-    Supported-Until: TBD
-    Security-Support-Until: Unreleased - not yet security-supported
+    Initial-Release: 2021-12-02
+    Supported-Until: 2023-06-02
+    Security-Support-Until: 2024-12-02
 
 Release Notes
 : <a href="https://wiki.xenproject.org/wiki/Xen_Project_4.16_Release_Notes">RN</a>
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Nov 30 11:55:35 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Nov 2021 11:55:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.235072.407889 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ms1jT-0003Y3-K8; Tue, 30 Nov 2021 11:55:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 235072.407889; Tue, 30 Nov 2021 11:55:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ms1jT-0003Xv-H8; Tue, 30 Nov 2021 11:55:35 +0000
Received: by outflank-mailman (input) for mailman id 235072;
 Tue, 30 Nov 2021 11:55:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms1jS-0003Xp-NY
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 11:55:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms1jS-0003Ak-Mq
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 11:55:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms1jS-0005pv-Ln
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 11:55:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ax21E6NvQljPQjaJJ+dccLNaiGMhLxVs3oSX6VdDna0=; b=kubBixaMQlnfEmchHyEEA+f8Xy
	IKmSZHx/nAN0T3ABq/cFfmC+V4elsqr6QOAK1gTifO9njX3lnLOLRR02IRLvuGw+jtSc5pD3PCkfb
	6DH8FZNgPjIfv3ZiweWAdtTylT1cnu/4uLTyrwR9nQ4wOsDNCP6IHMoQZF77M5XIPAfk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] README: make heading say 4.16
Message-Id: <E1ms1jS-0005pv-Ln@xenbits.xenproject.org>
Date: Tue, 30 Nov 2021 11:55:34 +0000

commit 47378e26637b5440cb8d9367f125ca812e8e22ed
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 30 11:38:20 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 30 11:42:00 2021 +0000

    README: make heading say 4.16
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 README | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/README b/README
index a626e56436..189c749bb0 100644
--- a/README
+++ b/README
@@ -1,9 +1,9 @@
 ############################################################
 __  __            _  _    _  __
-\ \/ /___ _ __   | || |  / |/ /_        _ __ ___
- \  // _ \ '_ \  | || |_ | | '_ \ _____| '__/ __|
- /  \  __/ | | | |__   _|| | (_) |_____| | | (__
-/_/\_\___|_| |_|    |_|(_)_|\___/      |_|  \___|
+\ \/ /___ _ __   | || |  / |/ /_
+ \  // _ \ '_ \  | || |_ | | '_ \
+ /  \  __/ | | | |__   _|| | (_) |
+/_/\_\___|_| |_|    |_|(_)_|\___/
 
 ############################################################
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Nov 30 11:55:45 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Nov 2021 11:55:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.235073.407895 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ms1jd-0003ba-Nh; Tue, 30 Nov 2021 11:55:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 235073.407895; Tue, 30 Nov 2021 11:55:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ms1jd-0003bQ-Jt; Tue, 30 Nov 2021 11:55:45 +0000
Received: by outflank-mailman (input) for mailman id 235073;
 Tue, 30 Nov 2021 11:55:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms1jc-0003bC-Qh
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 11:55:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms1jc-0003Au-Pw
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 11:55:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms1jc-0005qv-P0
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 11:55:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6ZP7yPk87yALhn8fqLOxO2UHNePqOI5qBzHd3xBHF0c=; b=gVIIVs4rvf6JNhWo877y/e8vdw
	flS4Bf9s4YMxGy3UtebWSy15PAhiki0Fjm1BAgIZk49bdFrNdPGt4ML/OlV7V61F8hbkF8K8HRNZA
	oOM7OLmMGazwHcClMOyh5CuAcV4b60hmmv3kpq6haZ1M5AfTdSPUQZgB/EhpP0Bxe4FQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] CHANGELOG.md: Set 4.16 version and date
Message-Id: <E1ms1jc-0005qv-P0@xenbits.xenproject.org>
Date: Tue, 30 Nov 2021 11:55:44 +0000

commit 36aa64095d0419d52d2466405ac13b9858463f48
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 30 11:40:21 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 30 11:42:00 2021 +0000

    CHANGELOG.md: Set 4.16 version and date
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 CHANGELOG.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1fe52da7db..731db3590e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ Notable changes to Xen will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
-## [unstable UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
+## [4.16.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=staging) - 2021-12-02
 
 ### Removed
  - XENSTORED_ROOTDIR environment variable from configuartion files and
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Nov 30 11:55:55 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Nov 2021 11:55:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.235074.407897 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ms1jn-0003eI-OG; Tue, 30 Nov 2021 11:55:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 235074.407897; Tue, 30 Nov 2021 11:55: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 1ms1jn-0003eA-LS; Tue, 30 Nov 2021 11:55:55 +0000
Received: by outflank-mailman (input) for mailman id 235074;
 Tue, 30 Nov 2021 11:55: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 1ms1jm-0003dx-Tl
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 11:55: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 1ms1jm-0003B4-Sy
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 11:55:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms1jm-0005rs-S4
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 11:55:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; 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/mLQuDnv5J6MScN6qN0jXI6fVT/2LjtwIKqr0JkRBQ=; b=w7Yh/jWeJkwg0vNnaYQuSy69EE
	CFdr9UyD7bx5PJXcJR7pChXK2tHXepX4PMqopS8S0av/Hx+ejjPLYNjfAf68iSEkvyaeR6uFBai9f
	qqle83pfu5A5SxxDEru1uUW9HXBUJhZYsMLFBjVfCVcbTYHQ4YPqzMlxbkLaqlaJrhWQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] xen/Makefile: Set 4.16 version
Message-Id: <E1ms1jm-0005rs-S4@xenbits.xenproject.org>
Date: Tue, 30 Nov 2021 11:55:54 +0000

commit b0b4661fa3cba995e433b94ea569c90f65a3e5fc
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 30 11:42:42 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 30 11:42:42 2021 +0000

    xen/Makefile: Set 4.16 version
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 2fc83f266b..dfb0efcc26 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 16
-export XEN_EXTRAVERSION ?= -rc$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .0$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Nov 30 19:44:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Nov 2021 19:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.235481.408478 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ms92p-0004sn-4l; Tue, 30 Nov 2021 19:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 235481.408478; Tue, 30 Nov 2021 19: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 1ms92p-0004sf-1o; Tue, 30 Nov 2021 19:44:03 +0000
Received: by outflank-mailman (input) for mailman id 235481;
 Tue, 30 Nov 2021 19:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms92n-0004sZ-R6
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 19: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 1ms92n-0003MD-Nx
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 19:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms92n-0001rA-Ms
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 19: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=kYayxAbqTSmul9d6BYkpqtax2mhtljKN0N7oBxPM/Xs=; b=2GKrKOwBAQBaIe1kApw0lFQH21
	RVEramBuPdAGHoPG5X/o+BRsY6ATC8It73HkbylgHPCipZ+LeNA5OVVnCBRKoG+1CedbV4scBFGq9
	2+94G/BbPbKT2FRl5OXUrcpRiLxuq7CdEyyMfxFeMzjkxsxhfTxcy9UGFTt7Y7Z7De10=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] CHANGELOG: add missing entries for work during the 4.16 release cycle
Message-Id: <E1ms92n-0001rA-Ms@xenbits.xenproject.org>
Date: Tue, 30 Nov 2021 19:44:01 +0000

commit e2544a28beacd854f295095d102a8773743ac917
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Nov 24 12:24:03 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 30 11:42:00 2021 +0000

    CHANGELOG: add missing entries for work during the 4.16 release cycle
    
    Document some of the relevant changes during the 4.16 release cycle.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-Acked-by: Ian Jackson <iwj@xenproject.org>
---
 CHANGELOG.md | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ad1a8c2bc2..1fe52da7db 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,31 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - qemu-traditional based device models (both, qemu-traditional and ioemu-stubdom) will
    no longer be built per default. In order to be able to use those, configure needs to
    be called with "--enable-qemu-traditional" as parameter.
+ - Fixes for credit2 scheduler stability in corner case conditions.
+ - Ongoing improvements in the hypervisor build system.
+ - vtpmmgr miscellaneous fixes in preparation for TPM 2.0 support.
+ - 32bit PV guests only supported in shim mode.
+ - Improved PVH dom0 debug key handling.
+ - Fix booting on some Intel systems without a PIT (i8254).
+ - Cleanup of the xenstore library interface.
+ - Fix truncation of return value from xencall2 by introducing a new helper
+   that returns a long instead.
+ - Fix system register accesses on Arm to use the proper 32/64bit access size.
+ - Various fixes for Arm OP-TEE mediator.
+ - Switch to domheap for Xen page tables.
+
+### Added
+ - 32bit Arm builds to the gitlab-ci automated tests.
+ - x86 full system tests to the gitlab-ci automated tests.
+ - Arm limited vPMU support for guests.
+ - Static physical memory allocation for dom0less on arm64.
+ - dom0less EFI support on arm64.
+ - GICD_ICPENDR register handling in vGIC emulation to support Zephyr OS.
+ - CPU feature leveling on arm64 platform with heterogeneous cores.
+ - Report unpopulated memory regions safe to use for external mappings, Arm and
+   device tree only.
+ - Support of generic DT IOMMU bindings for Arm SMMU v2.
+ - Limit grant table version on a per-domain basis.
 
 ## [4.15.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.15.0) - 2021-04-08
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Nov 30 19:44:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Nov 2021 19:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.235482.408482 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ms92z-0004ua-6I; Tue, 30 Nov 2021 19:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 235482.408482; Tue, 30 Nov 2021 19: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 1ms92z-0004uS-3L; Tue, 30 Nov 2021 19:44:13 +0000
Received: by outflank-mailman (input) for mailman id 235482;
 Tue, 30 Nov 2021 19:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms92x-0004uG-SQ
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 19:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms92x-0003MI-RZ
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 19:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms92x-0001sK-QU
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 19: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=9A8sswyXsm9g6KOUEYZ6EW0LAzD25VPd5YqDqbVTqUw=; b=3UaMnPsdIys1BpvVc67wq1ayBK
	w6OusiLcRWjTSlMfedy+dbXqZP+zM9dJ8Q1/KVOjbHIhSavjHT/qZkOFOxyu2R/wjXCrmC1VRHgkE
	PbAuM9Bzgh6/Yg7nDdUA1IEHrY68d54cHL65e5LCWSAC2g8rj8Q5kEybeTzcXhTD2Jbo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] Config.mk: Bump tags to 4.16.0 final
Message-Id: <E1ms92x-0001sK-QU@xenbits.xenproject.org>
Date: Tue, 30 Nov 2021 19:44:11 +0000

commit c9b5e2fb623a454a642d6f0d989ba9021a459739
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 30 11:32:36 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 30 11:42:00 2021 +0000

    Config.mk: Bump tags to 4.16.0 final
    
    No actual change to the code since RC4.
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 Config.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Config.mk b/Config.mk
index b32a185efc..8f9bc05f8c 100644
--- a/Config.mk
+++ b/Config.mk
@@ -239,15 +239,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.16.0-rc4
-MINIOS_UPSTREAM_REVISION ?= xen-4.16.0-rc4
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.16.0
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.16.0
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= xen-4.16.0-rc4
+QEMU_TRADITIONAL_REVISION ?= xen-4.16.0
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Nov 30 19:44:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Nov 2021 19:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.235483.408486 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ms939-0004wx-7r; Tue, 30 Nov 2021 19:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 235483.408486; Tue, 30 Nov 2021 19: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 1ms939-0004wq-4q; Tue, 30 Nov 2021 19:44:23 +0000
Received: by outflank-mailman (input) for mailman id 235483;
 Tue, 30 Nov 2021 19: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 1ms937-0004wh-W3
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 19:44:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms937-0003Ma-VI
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 19:44:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms937-0001t4-Ti
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 19:44:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Bz8NKC30yf2WDpHq09QmWxRqPwobbnrF9VNejgztd/Y=; b=Ay5yQHOy2p/HtERvtGSIDJJfvA
	iBL7ughxu1ugOpzgtRSmyV5U3xn+CBdgtX0OSKCnU/6ocd7IviynTvUigWMcDSZv8mmOsQGcGp/Be
	FJ6WcX4mbG8vm6sYsH4hfFdK+yqXkuxcmrZiGLTYRIPXh7tRCiQsYY5THJ/pklEV8PgM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] SUPPORT.md: Define support lifetime
Message-Id: <E1ms937-0001t4-Ti@xenbits.xenproject.org>
Date: Tue, 30 Nov 2021 19:44:21 +0000

commit 01912f6c5f51ac1fd5e59248027021ad9f5a24d2
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 30 11:14:00 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 30 11:42:00 2021 +0000

    SUPPORT.md: Define support lifetime
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index b1367e2b22..85726102ea 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -10,9 +10,9 @@ for the definitions of the support status levels etc.
 # Release Support
 
     Xen-Version: 4.16
-    Initial-Release: n/a
-    Supported-Until: TBD
-    Security-Support-Until: Unreleased - not yet security-supported
+    Initial-Release: 2021-12-02
+    Supported-Until: 2023-06-02
+    Security-Support-Until: 2024-12-02
 
 Release Notes
 : <a href="https://wiki.xenproject.org/wiki/Xen_Project_4.16_Release_Notes">RN</a>
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Nov 30 19:44:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Nov 2021 19:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.235484.408489 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ms93J-00050H-9a; Tue, 30 Nov 2021 19:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 235484.408489; Tue, 30 Nov 2021 19: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 1ms93J-00050B-6Y; Tue, 30 Nov 2021 19:44:33 +0000
Received: by outflank-mailman (input) for mailman id 235484;
 Tue, 30 Nov 2021 19: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 1ms93I-000501-2n
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 19: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 1ms93I-0003Mk-24
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 19:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms93I-0001tm-19
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 19: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=M0igJmdmHcKytoT4fOimq4CKwb7v7MjCWhF9TMkaGqY=; b=BqIrTXeGnKmXvhiSd9rq3Uk1cY
	hpZgH0W+0WOjjqh52RQ5TUX6yEDJ4ht72PZy/tETyiy1GLSKp/sWdRKxJ2JamHo/k2LO1eDOkZbwt
	abehMN29nNGvOG1RVIdYh26Mw+juEHsDy4mSquHRIOrG7z1RMMBc/+jCN7ktZ1bL8bmw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] README: make heading say 4.16
Message-Id: <E1ms93I-0001tm-19@xenbits.xenproject.org>
Date: Tue, 30 Nov 2021 19:44:32 +0000

commit 47378e26637b5440cb8d9367f125ca812e8e22ed
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 30 11:38:20 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 30 11:42:00 2021 +0000

    README: make heading say 4.16
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 README | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/README b/README
index a626e56436..189c749bb0 100644
--- a/README
+++ b/README
@@ -1,9 +1,9 @@
 ############################################################
 __  __            _  _    _  __
-\ \/ /___ _ __   | || |  / |/ /_        _ __ ___
- \  // _ \ '_ \  | || |_ | | '_ \ _____| '__/ __|
- /  \  __/ | | | |__   _|| | (_) |_____| | | (__
-/_/\_\___|_| |_|    |_|(_)_|\___/      |_|  \___|
+\ \/ /___ _ __   | || |  / |/ /_
+ \  // _ \ '_ \  | || |_ | | '_ \
+ /  \  __/ | | | |__   _|| | (_) |
+/_/\_\___|_| |_|    |_|(_)_|\___/
 
 ############################################################
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Nov 30 19:44:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Nov 2021 19:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.235485.408494 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ms93T-00053W-B1; Tue, 30 Nov 2021 19:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 235485.408494; Tue, 30 Nov 2021 19: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 1ms93T-00053O-7z; Tue, 30 Nov 2021 19:44:43 +0000
Received: by outflank-mailman (input) for mailman id 235485;
 Tue, 30 Nov 2021 19: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 1ms93S-000539-5v
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 19: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 1ms93S-0003NF-5C
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 19:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms93S-0001uV-4F
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 19: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=CcCbSicyvnFURpA5nWDMEySJZPcyofeCMSpdlWW/vsk=; b=K98/TwcndwIE7xX80nQvEsukN2
	LuGiR1E8ttmDpWoMwHbz/vnn/IPIZyAh/JvS43w/wZFuTO8lY524rYzp/zbznD3bJmA/4eeeKTp/4
	qmDx3In21qIpw9TXsNNyRSqi6yoX7CvnGJ/3UHCSlOA6Q9Ao5xkHWQIOBFhV2AJ3Ot3I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] CHANGELOG.md: Set 4.16 version and date
Message-Id: <E1ms93S-0001uV-4F@xenbits.xenproject.org>
Date: Tue, 30 Nov 2021 19:44:42 +0000

commit 36aa64095d0419d52d2466405ac13b9858463f48
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 30 11:40:21 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 30 11:42:00 2021 +0000

    CHANGELOG.md: Set 4.16 version and date
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 CHANGELOG.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1fe52da7db..731db3590e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ Notable changes to Xen will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
-## [unstable UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
+## [4.16.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=staging) - 2021-12-02
 
 ### Removed
  - XENSTORED_ROOTDIR environment variable from configuartion files and
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Nov 30 19:44:53 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 30 Nov 2021 19:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.235486.408499 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1ms93d-00056a-Cr; Tue, 30 Nov 2021 19:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 235486.408499; Tue, 30 Nov 2021 19: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 1ms93d-00056S-9U; Tue, 30 Nov 2021 19:44:53 +0000
Received: by outflank-mailman (input) for mailman id 235486;
 Tue, 30 Nov 2021 19: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 1ms93c-00056B-95
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 19: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 1ms93c-0003NQ-8I
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 19:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1ms93c-0001vA-7W
 for xen-changelog@lists.xenproject.org; Tue, 30 Nov 2021 19: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=aopDbDARbhgfl3YRvRnHbpTludVl/RLMXFNuzqeOpCY=; b=OB5W4oFaNPhUwoFITldxedZjfP
	jMMtCGg9Ec130aMIAFPNDtzTbZGPWgPoSqjq9FQyaOjrUCfzZM1pGr5+7J3ZU7mKWN8JPLsSWzNFt
	HzymqTzuMEHGpX9mkxpI7Io4OOtjq38JXxEBssG+qXAFI/m+6cqkESElVrtGPuZmqz94=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] xen/Makefile: Set 4.16 version
Message-Id: <E1ms93c-0001vA-7W@xenbits.xenproject.org>
Date: Tue, 30 Nov 2021 19:44:52 +0000

commit b0b4661fa3cba995e433b94ea569c90f65a3e5fc
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Nov 30 11:42:42 2021 +0000
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Nov 30 11:42:42 2021 +0000

    xen/Makefile: Set 4.16 version
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 2fc83f266b..dfb0efcc26 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 16
-export XEN_EXTRAVERSION ?= -rc$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .0$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


