From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 10:44:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 10:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104361.199557 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lRuo2-0005ts-Db; Thu, 01 Apr 2021 10:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104361.199557; Thu, 01 Apr 2021 10:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lRuo2-0005tk-Ac; Thu, 01 Apr 2021 10:44:06 +0000
Received: by outflank-mailman (input) for mailman id 104361;
 Thu, 01 Apr 2021 10:44:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRuo0-0005tf-Sd
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRuo0-0003no-RF
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRuo0-0001kw-P3
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9ABRWHSkzS2mMQmIp9RofHKRB9qtgXc4Vo4enBE/9OI=; b=gMUpyTYuSPBq0wsEMiy1NEY9O/
	XywpBHe4LvXnPUoh7jlGaXXWdK65BwYmE5bMo6d1q82ETPCgUXLPTAWAn1TRGo6KpeyHMiWCnx7mG
	KLxS0VVEG4VQwb4oeLMZgYqr4cKnABlUdpmlXLtt4w+CzYg/6ynFHHoLQMvt6I+nFUKM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Intel Processor Trace Support: Add CHANGELOG.md and SUPPORT.md entries
Message-Id: <E1lRuo0-0001kw-P3@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 10:44:04 +0000

commit 837d03b4ecac7b988be2dd76d32ee4222bea1df9
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Tue Mar 23 13:55:57 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Thu Apr 1 11:31:11 2021 +0100

    Intel Processor Trace Support: Add CHANGELOG.md and SUPPORT.md entries
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 SUPPORT.md   | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ffbf71fcb9..4582d1fea0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Renesas IPMMU-VMSA (Supported, not security supported; was Tech Preview)
  - ARM SMMUv3 (Tech Preview)
  - Switched MSR accesses to deny by default policy.
+ - Intel Processor Trace support (Tech Preview)
 
 ### Removed / support downgraded
 
diff --git a/SUPPORT.md b/SUPPORT.md
index 3ef072681b..d0b8afe41c 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -247,6 +247,13 @@ Export hypervisor coverage data suitable for analysis by gcov or lcov.
 
     Status: Supported, Not security supported
 
+### Processor trace support
+
+Support for using Intel Processor Trace technology to trace guests
+from dom0.
+
+    Status, x86: Tech Preview
+
 ## Memory Management
 
 ### Dynamic memory control
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 10:44:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 10:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104362.199561 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lRuoC-0005uZ-FS; Thu, 01 Apr 2021 10:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104362.199561; Thu, 01 Apr 2021 10:44:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lRuoC-0005uP-C8; Thu, 01 Apr 2021 10:44:16 +0000
Received: by outflank-mailman (input) for mailman id 104362;
 Thu, 01 Apr 2021 10:44:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRuoA-0005uG-W8
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10:44:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRuoA-0003oA-Uv
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRuoA-0001mB-Te
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10:44:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TRfuqJTXc3yZKDMmaF652U+9kXE6WEld/4/5cmK1aRU=; b=4S9mqwHyrlPkuRZMnPxb1G5hmq
	dtt7uL+4KCjtUdZakQtPo64o/AFIGQWIvweU3erSZp2vwbsyCDM1pb0efmuOrX4nrPIogqCfNXDU/
	Kfe2rzYF6X6NwrUytRqaLmhS8hJz6p1hyGrJ689X7d9ejsefvJeZvXpvSgCS5YeBjZSw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: Add named PCI devices
Message-Id: <E1lRuoA-0001mB-Te@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 10:44:14 +0000

commit 40ce418faa56670a468c250e4a28f953ddd14d86
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Tue Mar 23 16:52:25 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Thu Apr 1 11:31:41 2021 +0100

    CHANGELOG.md: Add named PCI devices
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4582d1fea0..c3354fc14f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - ARM SMMUv3 (Tech Preview)
  - Switched MSR accesses to deny by default policy.
  - Intel Processor Trace support (Tech Preview)
+ - Named PCI devices for xl/libxl
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 10:44:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 10:44:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104363.199565 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lRuoM-0005xG-Ht; Thu, 01 Apr 2021 10:44:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104363.199565; Thu, 01 Apr 2021 10: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 1lRuoM-0005x6-El; Thu, 01 Apr 2021 10:44:26 +0000
Received: by outflank-mailman (input) for mailman id 104363;
 Thu, 01 Apr 2021 10:44:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRuoL-0005wF-2o
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10:44:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRuoL-0003oL-21
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRuoL-0001mo-0n
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10:44:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=h6KgiSljcKQ2tBGWYgSgozwJVFwMpZVgSuoQGlEjGxo=; b=TyCzWEaTQbYRPGb8q5ZF/CdIIm
	wE45UPDfKetMr2Zo4tZLdb22GaikxN1GV5NrBDEqWrjP4fX3thhlXQOp8S9jxuKzVIh8a4qAQUXk1
	ZkZNrc6Et1kIuxVzZP0JZbSrThDgVr2ysyQW9O/BhNsbECXD6XodZRzTja4D5FFvgSTw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: Add dom0/domU zstd compression support
Message-Id: <E1lRuoL-0001mo-0n@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 10:44:25 +0000

commit 8b60b8d1f2346ab52b2d7ecf864ff59318098b25
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Tue Mar 23 16:58:42 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Thu Apr 1 11:31:44 2021 +0100

    CHANGELOG.md: Add dom0/domU zstd compression support
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index c3354fc14f..4e6e071ed5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Switched MSR accesses to deny by default policy.
  - Intel Processor Trace support (Tech Preview)
  - Named PCI devices for xl/libxl
+ - Support for zstd-compressed dom0 (x86) and domU kernels
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 10:44:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 10:44:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104364.199569 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lRuoW-0005yi-JB; Thu, 01 Apr 2021 10:44:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104364.199569; Thu, 01 Apr 2021 10: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 1lRuoW-0005ya-GA; Thu, 01 Apr 2021 10:44:36 +0000
Received: by outflank-mailman (input) for mailman id 104364;
 Thu, 01 Apr 2021 10:44:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRuoV-0005yO-6k
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10:44:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRuoV-0003oV-5u
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRuoV-0001nj-4B
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10:44:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NQ0iVEyWQZqGLKT3l3r2vul/ZfWBY5yW9X6rdGziF4s=; b=aLlKeH3Vi7I1AzJefsysXB0nhf
	ORSOTWcHHw20SexlvqJ50Jl0LeylF6AzrfLFc9Pol+KOWomQlTm5yeh+VFH/3sT2qv+0jk7wzqyBz
	ms3uxwsM6jZYbCbmu5kVuQGnKC5lnPONSHHnKGdiAdUlxudc2cVjhLnY3GmZq0DqS1tE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: NetBSD lib/gnttab support
Message-Id: <E1lRuoV-0001nj-4B@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 10:44:35 +0000

commit f17acb5ef6d6957ae6d92028636a091acb88677d
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Tue Mar 23 17:06:20 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Thu Apr 1 11:31:45 2021 +0100

    CHANGELOG.md: NetBSD lib/gnttab support
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4e6e071ed5..ccb1b449b1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Intel Processor Trace support (Tech Preview)
  - Named PCI devices for xl/libxl
  - Support for zstd-compressed dom0 (x86) and domU kernels
+ - Library improvements from NetBSD ports upstreamed
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 10:44:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 10:44:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104365.199573 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lRuog-00060R-Kh; Thu, 01 Apr 2021 10:44:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104365.199573; Thu, 01 Apr 2021 10:44:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lRuog-00060J-Hj; Thu, 01 Apr 2021 10:44:46 +0000
Received: by outflank-mailman (input) for mailman id 104365;
 Thu, 01 Apr 2021 10:44:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRuof-000608-AV
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10:44:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRuof-0003od-8u
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10:44:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRuof-0001oO-88
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10:44:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=P6H71pSglbfXpV7vPo1rVfPPp/R85Q+HwUY0v3yyaSE=; b=L8pHST6poIIqQLmbj8JZN3pKGc
	2irtH+4GBDbymbEB0WYcvO2oiJ2Ax/qVO+MgsMYO5BVbQ8Uy8vUFszTzdP1YrlLkGVB1dUiZglqaq
	0nqyTn+tnF6Fox8UCcXQEc50fWw+lX3od9VWzfr/4u8nk+YlsY1Bz8FjWHkAXAabQOTs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: Add entries for CI loop
Message-Id: <E1lRuof-0001oO-88@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 10:44:45 +0000

commit c58fbc38d208f2046e077833fe2b071ff479d7e6
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Wed Mar 24 16:20:28 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Thu Apr 1 11:31:46 2021 +0100

    CHANGELOG.md: Add entries for CI loop
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ccb1b449b1..529e00dc3f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Named PCI devices for xl/libxl
  - Support for zstd-compressed dom0 (x86) and domU kernels
  - Library improvements from NetBSD ports upstreamed
+ - CI loop: Add Alpine Linux, Ubuntu Focal targets; drop CentOS 6
+ - CI loop: Add qemu-based dom0 / domU test for ARM
+ - CI loop: Add dom0less aarch64 smoke test
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 10:44:56 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 10:44:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104366.199578 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lRuoq-00061t-Mb; Thu, 01 Apr 2021 10:44:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104366.199578; Thu, 01 Apr 2021 10: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 1lRuoq-00061j-JE; Thu, 01 Apr 2021 10:44:56 +0000
Received: by outflank-mailman (input) for mailman id 104366;
 Thu, 01 Apr 2021 10: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 1lRuop-00061T-DF
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10: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 1lRuop-0003ol-CX
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10:44:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRuop-0001pC-BJ
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10: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=DLac+KAdQKsxGZ7NrxP9N1adfC2h7tJeoCTtduZ7XAI=; b=aWsCmKioW9nDGSZ5/dFdru/2Xs
	O37EJB6Wp/P0cb9nEYH7jNQBq3bWUKWWGx6jgnAw5TOhXiWGg50r+q24NmJH7mCGf7S4hs20+/9ia
	g3Hah9HA3cyU54Pu3Nlv8mP9nRwF+I6SVB6xCk4tGjjKLhrQTE2Rub3TXJrbRIpk/c1g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: Add entries for emulation
Message-Id: <E1lRuop-0001pC-BJ@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 10:44:55 +0000

commit 8b39f21574b049c89b20815ed738d9c725faf3a4
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Wed Mar 24 13:24:45 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Thu Apr 1 11:31:47 2021 +0100

    CHANGELOG.md: Add entries for emulation
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 529e00dc3f..21cf6df4a2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - CI loop: Add Alpine Linux, Ubuntu Focal targets; drop CentOS 6
  - CI loop: Add qemu-based dom0 / domU test for ARM
  - CI loop: Add dom0less aarch64 smoke test
+ - x86: Allow domains to use AVX-VNNI instructions
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 10:45:06 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 10:45:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104367.199581 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lRup0-00063R-OA; Thu, 01 Apr 2021 10:45:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104367.199581; Thu, 01 Apr 2021 10: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 1lRup0-00063H-Kl; Thu, 01 Apr 2021 10:45:06 +0000
Received: by outflank-mailman (input) for mailman id 104367;
 Thu, 01 Apr 2021 10: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 1lRuoz-000638-Ga
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10: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 1lRuoz-0003pL-Fw
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10:45:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRuoz-0001qV-Eg
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 10: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=jh2Kcyopa3IXQabiGRU3jxSbgvA4l2ALBaAqtkYNLG8=; b=xIjcgjDrOYjKoImvkrFJVQNZ1t
	bHNeS5TXq5wO8A2J1zMxGRdGp4Ov4ba7ul+NB6SN9FrA9+bXF1mwIrRTAb7sm+2enssLMnRIsn5vM
	oV4mLZDJSvbkbps+kD70WXCfsxXP3C9VMMQF1zT+iE+P6TRvl04P5Wpg1PCqbXLSH9Ug=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: Make PV shim smaller by factoring out HVM-specific shadow code
Message-Id: <E1lRuoz-0001qV-Eg@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 10:45:05 +0000

commit b0976d5c0441378b6348f5bfedbf431055bd0147
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Wed Mar 24 17:24:31 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Thu Apr 1 11:31:47 2021 +0100

    CHANGELOG.md: Make PV shim smaller by factoring out HVM-specific shadow code
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 21cf6df4a2..8964bacf73 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - CI loop: Add qemu-based dom0 / domU test for ARM
  - CI loop: Add dom0less aarch64 smoke test
  - x86: Allow domains to use AVX-VNNI instructions
+ - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 14:55:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 14:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104582.200193 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lRyix-0007q9-DF; Thu, 01 Apr 2021 14:55:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104582.200193; Thu, 01 Apr 2021 14:55:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lRyix-0007q1-AF; Thu, 01 Apr 2021 14:55:07 +0000
Received: by outflank-mailman (input) for mailman id 104582;
 Thu, 01 Apr 2021 14:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRyiv-0007pv-PO
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 14:55:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRyiv-000890-Oa
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 14:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRyiv-0003Zz-NE
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 14:55:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XbpfRIMAOHdM0Gk0VO39l5RZxhYyUpu1doZcrHqV2aM=; b=KHVqctAenjQiZjF5LcdurOdpxS
	9TJrqRHb6Av3INYk8hhAaS+o355vSFrIpOqSEvFycWHvwH+dmOjEvRk0KIQk1u04eaQd0MezNcUUU
	3ddCtpj+gdwqOwx1K6DJAtkIlxT1aTGz8ghuvaynqiOuz80WlrP28fINJCPYzWXxjcZ0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vioapic: top word redir entry writes don't trigger interrupts
Message-Id: <E1lRyiv-0003Zz-NE@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 14:55:05 +0000

commit 6f59dc12962be61ef84774d0630bdb7c1050851f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Apr 1 16:41:48 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 1 16:41:48 2021 +0200

    x86/vioapic: top word redir entry writes don't trigger interrupts
    
    Top word writes just update the destination of the interrupt, but
    since there's no change on the masking or the triggering mode no
    guest interrupt injection can result of such write. Add an assert to
    that effect.
    
    Requested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vioapic.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index 804bc77279..e3ee747b7d 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -262,6 +262,8 @@ static void vioapic_write_redirent(
               !ent.fields.remote_irr &&
               hvm_irq->gsi_assert_count[gsi] )
     {
+        /* A top word write should never trigger an interrupt injection. */
+        ASSERT(!top_word);
         pent->fields.remote_irr = 1;
         vioapic_deliver(vioapic, idx);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 14:55:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 14:55:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104583.200197 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lRyj7-0007rd-Eh; Thu, 01 Apr 2021 14:55:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104583.200197; Thu, 01 Apr 2021 14:55:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lRyj7-0007rV-Bp; Thu, 01 Apr 2021 14:55:17 +0000
Received: by outflank-mailman (input) for mailman id 104583;
 Thu, 01 Apr 2021 14:55:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRyj6-0007rM-0Q
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 14:55:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRyj5-000898-U1
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 14:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRyj5-0003as-RD
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 14:55:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+KV5612Iq1OI6vi1JcxgavGmWgHFH89MHhZBRpAQ7n0=; b=em7hNzU8rsIS99dcTL499xLpGm
	16vGr/XsOe8wgBt20mwR5h6QWRAFIziNgQQH0WXXeM9YVIa8qF99ZXGkFVsXHnUGDVsv731ZX3D/U
	p9sRYgndaYpY9TagUhKTTKcIz+4FMSpoqiTZCOA9RxyPpt2Rg7F6AbZ0eQNZmzFc6jPQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vioapic: issue EOI to dpci when switching pin to edge trigger mode
Message-Id: <E1lRyj5-0003as-RD@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 14:55:15 +0000

commit 0dc28066e9f0339ad8f4aea233cc5912139c5f79
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Apr 1 16:42:54 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 1 16:42:54 2021 +0200

    x86/vioapic: issue EOI to dpci when switching pin to edge trigger mode
    
    When an IO-APIC pin is switched from level to edge trigger mode the
    IRR bit is cleared, so it can be used as a way to EOI an interrupt at
    the IO-APIC level.
    
    Such EOI however does not get forwarded to the dpci code like it's
    done for the local APIC initiated EOI. This change adds the code in
    order to notify dpci of such EOI, so that dpci and the interrupt
    controller are in sync.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vioapic.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index e3ee747b7d..87370dd417 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -219,6 +219,7 @@ static void vioapic_write_redirent(
     struct domain *d = vioapic_domain(vioapic);
     struct hvm_irq *hvm_irq = hvm_domain_irq(d);
     union vioapic_redir_entry *pent, ent;
+    bool prev_level;
     int unmasked = 0;
     unsigned int gsi;
 
@@ -234,6 +235,7 @@ static void vioapic_write_redirent(
 
     pent = &vioapic->redirtbl[idx];
     ent  = *pent;
+    prev_level = ent.fields.trig_mode == VIOAPIC_LEVEL_TRIG;
 
     if ( top_word )
     {
@@ -270,6 +272,21 @@ static void vioapic_write_redirent(
 
     spin_unlock(&d->arch.hvm.irq_lock);
 
+    if ( ent.fields.trig_mode == VIOAPIC_EDGE_TRIG &&
+         ent.fields.remote_irr && is_iommu_enabled(d) )
+    {
+            /*
+             * Since IRR has been cleared and further interrupts can be
+             * injected also attempt to deassert any virtual line of passed
+             * through devices using this pin. Switching a pin from level to
+             * edge trigger mode can be used as a way to EOI an interrupt at
+             * the IO-APIC level.
+             */
+            ASSERT(prev_level);
+            ASSERT(!top_word);
+            hvm_dpci_eoi(d, gsi);
+    }
+
     if ( is_hardware_domain(d) && unmasked )
     {
         /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 14:55:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 14:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104585.200213 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lRyjG-0007v0-Oc; Thu, 01 Apr 2021 14:55:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104585.200213; Thu, 01 Apr 2021 14: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 1lRyjG-0007uq-Lf; Thu, 01 Apr 2021 14:55:26 +0000
Received: by outflank-mailman (input) for mailman id 104585;
 Thu, 01 Apr 2021 14:55:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRyjG-0007uX-2o
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 14:55:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRyjG-00089i-22
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 14:55:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRyjG-0003bn-0H
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 14:55:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3l5/gLF39QwWTNbCFlRJukqxdLDx46msV1DbQ8bG0ro=; b=QZ2kY9auyVlv6vvMGgNLx0ogJr
	/CYDjJjMZ9LHFaE98vPVo9DIphjbmxeBQunurHuezIRBxuDbzMk1Kni704j2ofbsRFgUI4iB95mrG
	C4rDIbFYiTabxvRzKJqX6bYYx0uspC5dFVGx2FoPhuQKFJN85VPbQYHwVIDnKMSx5Xio=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/ucode: log blob date also for AMD
Message-Id: <E1lRyjG-0003bn-0H@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 14:55:26 +0000

commit f36179726847a08418a0b4f9c319b24ecb60fe3a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 1 16:43:50 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 1 16:43:50 2021 +0200

    x86/ucode: log blob date also for AMD
    
    Like Intel, AMD also records the date in their blobs. The field was
    merely misnamed as "data_code" so far; this was perhaps meant to be
    "date_code". Split it into individual fields, just like we did for Intel
    some time ago, and extend the message logged after a successful update.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu/microcode/amd.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 809ba4967c..fe92e594f1 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -33,7 +33,9 @@ struct equiv_cpu_entry {
 };
 
 struct microcode_patch {
-    uint32_t data_code;
+    uint16_t year;
+    uint8_t  day;
+    uint8_t  month;
     uint32_t patch_id;
     uint8_t  mc_patch_data_id[2];
     uint8_t  mc_patch_data_len;
@@ -251,8 +253,9 @@ static int apply_microcode(const struct microcode_patch *patch)
         return -EIO;
     }
 
-    printk(XENLOG_WARNING "microcode: CPU%u updated from revision %#x to %#x\n",
-           cpu, old_rev, rev);
+    printk(XENLOG_WARNING
+           "microcode: CPU%u updated from revision %#x to %#x, date = %04x-%02x-%02x\n",
+           cpu, old_rev, rev, patch->year, patch->month, patch->day);
 
     return 0;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 14:55:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 14:55:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104586.200217 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lRyjQ-0007yM-QX; Thu, 01 Apr 2021 14:55:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104586.200217; Thu, 01 Apr 2021 14:55:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lRyjQ-0007yE-NX; Thu, 01 Apr 2021 14:55:36 +0000
Received: by outflank-mailman (input) for mailman id 104586;
 Thu, 01 Apr 2021 14:55:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRyjQ-0007xz-6b
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 14:55:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRyjQ-00089t-5l
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 14:55:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lRyjQ-0003cZ-4k
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 14:55:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FbFwdODrVWXTmL1CdZbiskVl++Lh3rjMqAPZWIk0SXE=; b=RoXHARFwVghuQ/dthWmtSBaHcK
	0GwWYWAqkCXaGGZvMnM3k/+JhD4TCBgB7/2go/2sgl0huVsl3CrQtjFYl6ToZVEsH/qG2uaCdtnSN
	1PBwMa3wN3H0ldOCTp9TKERfs+m+Hgzw3XQpTlO37ux1XYO7KNTBzdPzREPZvb2RZXxA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/EFI: drop stale section special casing when generating base relocs
Message-Id: <E1lRyjQ-0003cZ-4k@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 14:55:36 +0000

commit 5c3c410bd2ea8d2cc520e8e8f83ad143c9c5cff7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 1 16:44:24 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 1 16:44:24 2021 +0200

    x86/EFI: drop stale section special casing when generating base relocs
    
    As of commit a6066af5b142 ("xen/init: Annotate all command line
    parameter infrastructure as const") .init.setup has been part of .init.
    As of commit 544ad7f5caf5 ("xen/init: Move initcall infrastructure into
    .init.data") .initcall* have been part of .init. Hence neither can be
    encountered as a stand-alone section in the final binaries anymore.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/efi/mkreloc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/x86/efi/mkreloc.c b/xen/arch/x86/efi/mkreloc.c
index 83a0afa00b..9efeaee7c5 100644
--- a/xen/arch/x86/efi/mkreloc.c
+++ b/xen/arch/x86/efi/mkreloc.c
@@ -346,9 +346,7 @@ int main(int argc, char *argv[])
          * Don't generate relocations for sections that definitely
          * aren't used by the boot loader code.
          */
-        if ( memcmp(sec1[i].name, ".initcal", sizeof(sec1[i].name)) == 0 ||
-             memcmp(sec1[i].name, ".init.se", sizeof(sec1[i].name)) == 0 ||
-             memcmp(sec1[i].name, ".buildid", sizeof(sec1[i].name)) == 0 ||
+        if ( memcmp(sec1[i].name, ".buildid", sizeof(sec1[i].name)) == 0 ||
              memcmp(sec1[i].name, ".lockpro", sizeof(sec1[i].name)) == 0 )
             continue;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 16:22:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 16:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104637.200389 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lS059-0000tL-23; Thu, 01 Apr 2021 16:22:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104637.200389; Thu, 01 Apr 2021 16:22: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 1lS058-0000tD-VB; Thu, 01 Apr 2021 16:22:06 +0000
Received: by outflank-mailman (input) for mailman id 104637;
 Thu, 01 Apr 2021 16: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 1lS057-0000t8-J9
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16: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 1lS057-0001hl-ER
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lS057-0001de-CR
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16: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=A5FrWXV6WsaJDrHK/wXe9qQiJDi/VZIK1S/7+GyFeZc=; b=UwadqDyY4rxp9/Ese319TZKWsh
	1YLrwOFrIAYbyYE74ebvYzAPD9wFnDXspJ2z2zbbjrT2Yg053JQqRcIyDeD6B58lciCraB4WPNjHC
	ER9srqfkGh1OikRHNDu6zG9Ht4Mt06Z+GYIknGUC/PsehW54QGKF8332D249fpJktFhQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: mm: flush_page_to_ram() only need to clean to PoC
Message-Id: <E1lS057-0001de-CR@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 16:22:05 +0000

commit 9617d5f9c19d1d157629e1e436791509526e0ce5
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sat Feb 20 17:54:13 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xen/arm: mm: flush_page_to_ram() only need to clean to PoC
    
    At the moment, flush_page_to_ram() is both cleaning and invalidate to
    PoC the page.
    
    The goal of flush_page_to_ram() is to prevent corruption when the guest
    has disabled the cache (the cache line may be dirty) and the guest to
    read previous content.
    
    Per this definition, the invalidating the line is not necessary. So
    invalidating the cache is unnecessary. In fact, it may be counter-
    productive as the line may be (speculatively) accessed a bit after.
    So this will incurr an expensive access to the memory.
    
    More generally, we should avoid interferring too much with cache.
    Therefore, flush_page_to_ram() is updated to only clean to PoC the page.
    
    The performance impact of this change will depend on your
    workload/processor.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 59f8a3f15f..2f11d214e1 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -529,7 +529,7 @@ void flush_page_to_ram(unsigned long mfn, bool sync_icache)
 {
     void *v = map_domain_page(_mfn(mfn));
 
-    clean_and_invalidate_dcache_va_range(v, PAGE_SIZE);
+    clean_dcache_va_range(v, PAGE_SIZE);
     unmap_domain_page(v);
 
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 16:22:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 16:22:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104638.200393 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lS05J-0000uZ-3e; Thu, 01 Apr 2021 16:22:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104638.200393; Thu, 01 Apr 2021 16:22: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 1lS05J-0000uQ-0Z; Thu, 01 Apr 2021 16:22:17 +0000
Received: by outflank-mailman (input) for mailman id 104638;
 Thu, 01 Apr 2021 16: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 1lS05H-0000uH-Oy
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16: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 1lS05H-0001hs-Nk
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lS05H-0001eK-Gh
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16: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=H4tR1u643uWYnfB9IYjkVDgdx2odoeJjMHUlwBCtkZU=; b=s6OntTHdF9rBvGwqCjE/fzKPvv
	8V8F8hnQUpYQuR9LDoevUFlT7ptNEK5k8zN/1IsEYhBepJUyiD3rnrcSfrzwmY6G4S3XBlnU/cVu6
	6TylP4a9glHHzgKV/S6I87JAQBVviBK8XJPXK5F3jQnYeC0vJNCIaRuUvg8DLjPS1z4Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xenstore_client: handle memory on error
Message-Id: <E1lS05H-0001eK-Gh@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 16:22:15 +0000

commit 00948dcd6a5412695b42c6d5045b0d3075b14114
Author:     Norbert Manthey <nmanthey@amazon.de>
AuthorDate: Fri Feb 26 15:41:38 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xenstore_client: handle memory on error
    
    In case a command fails, also free the memory. As this is for the CLI
    client, currently the leaked memory is freed right after receiving the
    error, as the application terminates next.
    
    Similarly, if the allocation fails, do not use the NULL pointer
    afterwards, but instead error out.
    
    This bug was discovered and resolved using Coverity Static Analysis
    Security Testing (SAST) by Synopsys, Inc.
    
    Signed-off-by: Norbert Manthey <nmanthey@amazon.de>
    Reviewed-by: Thomas Friebel <friebelt@amazon.de>
    Reviewed-by: Julien Grall <jgrall@amazon.co.uk>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/xenstore/xenstore_client.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c
index 8015bfe5be..ddbafc5175 100644
--- a/tools/xenstore/xenstore_client.c
+++ b/tools/xenstore/xenstore_client.c
@@ -382,11 +382,14 @@ perform(enum mode mode, int optind, int argc, char **argv, struct xs_handle *xsh
                 /* Copy path, because we can't modify argv because we will need it
                    again if xs_transaction_end gives us EAGAIN. */
                 char *p = malloc(strlen(path) + 1);
+                if (!p)
+                    return 1;
                 strcpy(p, path);
                 path = p;
 
             again:
                 if (do_rm(path, xsh, xth)) {
+                    free(path);
                     return 1;
                 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 16:22:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 16:22:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104639.200396 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lS05T-0000vw-55; Thu, 01 Apr 2021 16:22:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104639.200396; Thu, 01 Apr 2021 16:22: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 1lS05T-0000vo-27; Thu, 01 Apr 2021 16:22:27 +0000
Received: by outflank-mailman (input) for mailman id 104639;
 Thu, 01 Apr 2021 16: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 1lS05R-0000ve-S0
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16: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 1lS05R-0001iO-Qj
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:22:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lS05R-0001es-Q0
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16: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=dwcSzuBEvm8plnfP63CgOR7g5XDYKZheaMulU3t71ns=; b=s42yIzBF1Av0BnOWGQvi6vbrNX
	SYxnSPOUkiGwNRO+ceO048OuL2RpSoRYiTBs2OPXxeKhs7dBLZ8bsBh8MQi4R/WEJnOReVycJfQsO
	HWr32Ru/XUhCxN7rbhseqCZNYhIeWBMZDeAQDGz/aark51+krx0hmg0Dh4+Ot3Z49X3I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xenstore: handle daemon creation errors
Message-Id: <E1lS05R-0001es-Q0@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 16:22:25 +0000

commit 60f0ba136d5a4c88377e28e5eb40606a7f9f6785
Author:     Norbert Manthey <nmanthey@amazon.de>
AuthorDate: Fri Feb 26 15:41:39 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xenstore: handle daemon creation errors
    
    In rare cases, the path to the daemon socket cannot be created as it is
    longer than PATH_MAX. Instead of failing with a NULL pointer dereference,
    terminate the application with an error message.
    
    This bug was discovered and resolved using Coverity Static Analysis
    Security Testing (SAST) by Synopsys, Inc.
    
    Signed-off-by: Norbert Manthey <nmanthey@amazon.de>
    Reviewed-by: Thomas Friebel <friebelt@amazon.de>
    Reviewed-by: Julien Grall <jgrall@amazon.co.uk>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/xenstore/xenstored_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 8033c1e0eb..d54a6042a9 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2005,6 +2005,9 @@ static void init_sockets(void)
 	struct sockaddr_un addr;
 	const char *soc_str = xs_daemon_socket();
 
+	if (!soc_str)
+		barf_perror("Failed to obtain xs domain socket");
+
 	/* Create sockets for them to listen to. */
 	atexit(destroy_fds);
 	sock = socket(PF_UNIX, SOCK_STREAM, 0);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 16:22:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 16:22:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104640.200401 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lS05d-0000xE-7H; Thu, 01 Apr 2021 16:22:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104640.200401; Thu, 01 Apr 2021 16:22: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 1lS05d-0000x6-3b; Thu, 01 Apr 2021 16:22:37 +0000
Received: by outflank-mailman (input) for mailman id 104640;
 Thu, 01 Apr 2021 16:22: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 1lS05c-0000x0-0H
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:22: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 1lS05b-0001iW-Ur
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:22:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lS05b-0001fO-T3
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16: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=uXJTxNNLgFOa0HTuOvKfNYeZL3ekuSWDxlVfQViQ+kw=; b=7LZseGW5onP0y+cwtOxaH5aOJk
	3PdCJ202b01O5d4jiiS8ZZmdyDhAL3gWtYKwhbouDDPGbUH0s97dkF2CNfq/T5WAu2xn4DHpt6nAJ
	TbOLDX/rQZZCbiT+L5SkLaC/0Tq89wpAJcytY+eTTS4AzeccXIRQRIS2M8n7Hnfr8JsQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Use register_t type of cpuinfo entries
Message-Id: <E1lS05b-0001fO-T3@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 16:22:35 +0000

commit e650311d4ebfd5bdff1f689b237f790ac05e1cab
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Mon Mar 15 10:38:30 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xen/arm: Use register_t type of cpuinfo entries
    
    All cpu identification registers that we store in the cpuinfo structure
    are 64bit on arm64 and 32bit on arm32 so storing the values in 32bit on
    arm64 is removing the higher bits which might contain information in the
    future.
    
    This patch is changing the types in cpuinfo to register_t (which is
    32bit on arm32 and 64bit on arm64) and adding the necessary paddings
    inside the unions.
    For consistency uint64_t entries are also changed to register_t on 64bit
    systems.
    
    It is also fixing all prints using directly the bits values from cpuinfo
    to use PRIregister and adapt the printed value to print all bits
    available on the architecture.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/setup.c             | 17 +++++++++--------
 xen/arch/arm/smpboot.c           |  5 +++--
 xen/include/asm-arm/cpufeature.h | 34 +++++++++++++++++++++++-----------
 3 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 2532ec9739..9ba2f267f6 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -116,8 +116,8 @@ static void __init processor_id(void)
         printk("Huh, cpu architecture %x, expected 0xf (defined by cpuid)\n",
                c->midr.architecture);
 
-    printk("Processor: %08"PRIx32": \"%s\", variant: 0x%x, part 0x%03x, rev 0x%x\n",
-           c->midr.bits, implementer,
+    printk("Processor: %"PRIregister": \"%s\", variant: 0x%x, part 0x%03x,"
+           "rev 0x%x\n", c->midr.bits, implementer,
            c->midr.variant, c->midr.part_number, c->midr.revision);
 
 #if defined(CONFIG_ARM_64)
@@ -163,7 +163,7 @@ static void __init processor_id(void)
     if ( cpu_has_aarch32 )
     {
         printk("32-bit Execution:\n");
-        printk("  Processor Features: %08"PRIx32":%08"PRIx32"\n",
+        printk("  Processor Features: %"PRIregister":%"PRIregister"\n",
                boot_cpu_data.pfr32.bits[0], boot_cpu_data.pfr32.bits[1]);
         printk("    Instruction Sets:%s%s%s%s%s%s\n",
                cpu_has_aarch32 ? " AArch32" : "",
@@ -176,15 +176,16 @@ static void __init processor_id(void)
                cpu_has_gentimer ? " GenericTimer" : "",
                cpu_has_security ? " Security" : "");
 
-        printk("  Debug Features: %08"PRIx32"\n",
+        printk("  Debug Features: %"PRIregister"\n",
                boot_cpu_data.dbg32.bits[0]);
-        printk("  Auxiliary Features: %08"PRIx32"\n",
+        printk("  Auxiliary Features: %"PRIregister"\n",
                boot_cpu_data.aux32.bits[0]);
-        printk("  Memory Model Features: "
-               "%08"PRIx32" %08"PRIx32" %08"PRIx32" %08"PRIx32"\n",
+        printk("  Memory Model Features: %"PRIregister" %"PRIregister"\n"
+               "                         %"PRIregister" %"PRIregister"\n",
                boot_cpu_data.mm32.bits[0], boot_cpu_data.mm32.bits[1],
                boot_cpu_data.mm32.bits[2], boot_cpu_data.mm32.bits[3]);
-        printk(" ISA Features: %08x %08x %08x %08x %08x %08x\n",
+        printk("  ISA Features: %"PRIregister" %"PRIregister" %"PRIregister"\n"
+               "                %"PRIregister" %"PRIregister" %"PRIregister"\n",
                boot_cpu_data.isa32.bits[0], boot_cpu_data.isa32.bits[1],
                boot_cpu_data.isa32.bits[2], boot_cpu_data.isa32.bits[3],
                boot_cpu_data.isa32.bits[4], boot_cpu_data.isa32.bits[5]);
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index cae2179126..a1ee3146ef 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -321,8 +321,9 @@ void start_secondary(void)
     if ( !opt_hmp_unsafe &&
          current_cpu_data.midr.bits != boot_cpu_data.midr.bits )
     {
-        printk(XENLOG_ERR "CPU%u MIDR (0x%x) does not match boot CPU MIDR (0x%x),\n"
-               "disable cpu (see big.LITTLE.txt under docs/).\n",
+        printk(XENLOG_ERR
+               "CPU%u MIDR (0x%"PRIregister") does not match boot CPU MIDR (0x%"PRIregister"),\n"
+               XENLOG_ERR "disable cpu (see big.LITTLE.txt under docs/).\n",
                smp_processor_id(), current_cpu_data.midr.bits,
                boot_cpu_data.midr.bits);
         stop_cpu();
diff --git a/xen/include/asm-arm/cpufeature.h b/xen/include/asm-arm/cpufeature.h
index 9ea3970c70..ba48db3eac 100644
--- a/xen/include/asm-arm/cpufeature.h
+++ b/xen/include/asm-arm/cpufeature.h
@@ -118,13 +118,16 @@ int enable_nonboot_cpu_caps(const struct arm_cpu_capabilities *caps);
  */
 struct cpuinfo_arm {
     union {
-        uint32_t bits;
+        register_t bits;
         struct {
             unsigned long revision:4;
             unsigned long part_number:12;
             unsigned long architecture:4;
             unsigned long variant:4;
             unsigned long implementer:8;
+#ifdef CONFIG_ARM_64
+            unsigned long _res0:32;
+#endif
         };
     } midr;
     union {
@@ -148,7 +151,7 @@ struct cpuinfo_arm {
 #ifdef CONFIG_ARM_64
     /* 64-bit CPUID registers. */
     union {
-        uint64_t bits[2];
+        register_t bits[2];
         struct {
             /* PFR0 */
             unsigned long el0:4;
@@ -179,15 +182,15 @@ struct cpuinfo_arm {
     } pfr64;
 
     struct {
-        uint64_t bits[2];
+        register_t bits[2];
     } dbg64;
 
     struct {
-        uint64_t bits[2];
+        register_t bits[2];
     } aux64;
 
     union {
-        uint64_t bits[3];
+        register_t bits[3];
         struct {
             unsigned long pa_range:4;
             unsigned long asid_bits:4;
@@ -213,7 +216,7 @@ struct cpuinfo_arm {
     } mm64;
 
     union {
-        uint64_t bits[2];
+        register_t bits[2];
         struct {
             /* ISAR0 */
             unsigned long __res0:4;
@@ -263,7 +266,7 @@ struct cpuinfo_arm {
      * when running in 32-bit mode.
      */
     union {
-        uint32_t bits[3];
+        register_t bits[3];
         struct {
             /* PFR0 */
             unsigned long arm:4;
@@ -274,6 +277,9 @@ struct cpuinfo_arm {
             unsigned long amu:4;
             unsigned long dit:4;
             unsigned long ras:4;
+#ifdef CONFIG_ARM_64
+            unsigned long __res0:32;
+#endif
 
             /* PFR1 */
             unsigned long progmodel:4;
@@ -284,29 +290,35 @@ struct cpuinfo_arm {
             unsigned long sec_frac:4;
             unsigned long virt_frac:4;
             unsigned long gic:4;
+#ifdef CONFIG_ARM_64
+            unsigned long __res1:32;
+#endif
 
             /* PFR2 */
             unsigned long csv3:4;
             unsigned long ssbs:4;
             unsigned long ras_frac:4;
             unsigned long __res2:20;
+#ifdef CONFIG_ARM_64
+            unsigned long __res3:32;
+#endif
         };
     } pfr32;
 
     struct {
-        uint32_t bits[2];
+        register_t bits[2];
     } dbg32;
 
     struct {
-        uint32_t bits[1];
+        register_t bits[1];
     } aux32;
 
     struct {
-        uint32_t bits[6];
+        register_t bits[6];
     } mm32;
 
     struct {
-        uint32_t bits[7];
+        register_t bits[7];
     } isa32;
 
     struct {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 16:22:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 16:22:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104641.200405 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lS05n-0000yg-9q; Thu, 01 Apr 2021 16:22:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104641.200405; Thu, 01 Apr 2021 16:22: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 1lS05n-0000yX-6i; Thu, 01 Apr 2021 16:22:47 +0000
Received: by outflank-mailman (input) for mailman id 104641;
 Thu, 01 Apr 2021 16:22: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 1lS05m-0000yO-2z
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:22: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 1lS05m-0001ic-1k
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:22:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lS05m-0001g2-0r
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:22: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=YtaXIfnJFrIoZ66yX7LLc99FbBv5eiDItm+etQtO8bQ=; b=Aug/eCp0pHJAysbotPWex3ylnc
	82rz2B3+EuDWPzyOLMau/VRfXx3/nOhE/u3NdwgEi/TyM/2hMnYdC9wpAevYF3XoXCQBtKZQXQXi7
	nMc09TZg6fpzmJRJKhfY994SeUllNv1cGc6oQrVMqQ5heeBSk3/AMd6zHOf946xoaAx0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: introduce XENFEAT_direct_mapped and XENFEAT_not_direct_mapped
Message-Id: <E1lS05m-0001g2-0r@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 16:22:46 +0000

commit d66bf122c0ab79063a607d6cf68edf5e91d17d5e
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Fri Mar 12 15:16:32 2021 -0800
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xen: introduce XENFEAT_direct_mapped and XENFEAT_not_direct_mapped
    
    Introduce two feature flags to tell the domain whether it is
    direct-mapped or not. It allows the guest kernel to make informed
    decisions on things such as swiotlb-xen enablement.
    
    The introduction of both flags (XENFEAT_direct_mapped and
    XENFEAT_not_direct_mapped) allows the guest kernel to avoid any
    guesswork if one of the two is present, or fallback to the current
    checks if neither of them is present.
    
    XENFEAT_direct_mapped is always set for not auto-translated guests.
    
    For auto-translated guests, only Dom0 on ARM is direct-mapped. Also,
    see is_domain_direct_mapped() which refers to auto-translated guests:
    xen/include/asm-arm/domain.h:is_domain_direct_mapped
    xen/include/asm-x86/domain.h:is_domain_direct_mapped
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    
    CC: jbeulich@suse.com
    CC: andrew.cooper3@citrix.com
    CC: julien@xen.org
---
 xen/common/kernel.c           |  4 ++++
 xen/include/public/features.h | 14 ++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 7a345ae45e..d77756a81e 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -560,6 +560,10 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
                              (1U << XENFEAT_hvm_callback_vector) |
                              (has_pirq(d) ? (1U << XENFEAT_hvm_pirqs) : 0);
 #endif
+            if ( !paging_mode_translate(d) || is_domain_direct_mapped(d) )
+                fi.submap |= (1U << XENFEAT_direct_mapped);
+            else
+                fi.submap |= (1U << XENFEAT_not_direct_mapped);
             break;
         default:
             return -EINVAL;
diff --git a/xen/include/public/features.h b/xen/include/public/features.h
index 1613b2aab8..9ee2f760ef 100644
--- a/xen/include/public/features.h
+++ b/xen/include/public/features.h
@@ -114,6 +114,20 @@
  */
 #define XENFEAT_linux_rsdp_unrestricted   15
 
+/*
+ * A direct-mapped (or 1:1 mapped) domain is a domain for which its
+ * local pages have gfn == mfn. If a domain is direct-mapped,
+ * XENFEAT_direct_mapped is set; otherwise XENFEAT_not_direct_mapped
+ * is set.
+ *
+ * If neither flag is set (e.g. older Xen releases) the assumptions are:
+ * - not auto_translated domains (x86 only) are always direct-mapped
+ * - on x86, auto_translated domains are not direct-mapped
+ * - on ARM, Dom0 is direct-mapped, DomUs are not
+ */
+#define XENFEAT_not_direct_mapped         16
+#define XENFEAT_direct_mapped             17
+
 #define XENFEAT_NR_SUBMAPS 1
 
 #endif /* __XEN_PUBLIC_FEATURES_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 16:22:58 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 16:22:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104642.200408 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lS05y-000100-B3; Thu, 01 Apr 2021 16:22:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104642.200408; Thu, 01 Apr 2021 16:22: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 1lS05y-0000zs-8E; Thu, 01 Apr 2021 16:22:58 +0000
Received: by outflank-mailman (input) for mailman id 104642;
 Thu, 01 Apr 2021 16:22: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 1lS05w-0000zi-6v
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:22: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 1lS05w-0001kL-4q
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:22:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lS05w-0001gh-4A
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:22: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=NzPu1x6eXzkgRk1LB/7e+h3ROKqlJtQPDFdqQDQoZ80=; b=SUJG+actptGpL2gphO5dJ3cKqA
	DqYin3Kv44NT3cx5RQjqG9jAU+0i0/dIKjfR3tpD4/19GAIY/jaaQOy3pq5wtm6kg6nO6+vCd0saf
	eREA+SFyurBgNkdpX23ZCqfLOFw5Cija+ExJYMGU5LiwcTTNheIc++eH3HrZ7xjNvzH4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm: Add Kconfig entry to select CONFIG_DTB_FILE
Message-Id: <E1lS05w-0001gh-4A@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 16:22:56 +0000

commit 831f01021f99d2d08909b5c054dd87de30c4f5e1
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Mon Mar 22 09:17:15 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    arm: Add Kconfig entry to select CONFIG_DTB_FILE
    
    Currently in order to link existing DTB into Xen image
    we need to either specify option CONFIG_DTB_FILE on the
    command line or manually add it into .config.
    Add Kconfig entry: CONFIG_DTB_FILE
    to be able to provide the path to DTB we want to embed
    into Xen image. If no path provided - the dtb will not
    be embedded.
    
    Remove the line: AFLAGS-y += -DCONFIG_DTB_FILE=\"$(CONFIG_DTB_FILE)\"
    as it is not needed since Kconfig will define it in a header
    with all the other config options.
    
    Move definition of _sdtb into dtb.S to prevent defining it
    if there is no reference to it or if someone protects
    _sdtb with #ifdef rather than with .ifnes. If the latter,
    we will get a compiler error.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/Makefile     |  5 ++---
 xen/arch/arm/arm32/head.S |  4 ++--
 xen/arch/arm/arm64/head.S |  4 ++--
 xen/arch/arm/dtb.S        |  1 +
 xen/arch/arm/xen.lds.S    |  3 ---
 xen/common/Kconfig        | 10 ++++++++++
 6 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 16e6523e2c..46e6a95fec 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -68,9 +68,8 @@ extra-y += $(TARGET_SUBARCH)/head.o
 
 #obj-bin-y += ....o
 
-ifdef CONFIG_DTB_FILE
+ifneq ($(CONFIG_DTB_FILE),"")
 obj-y += dtb.o
-AFLAGS-y += -DCONFIG_DTB_FILE=\"$(CONFIG_DTB_FILE)\"
 endif
 
 ALL_OBJS := $(TARGET_SUBARCH)/head.o $(ALL_OBJS)
@@ -137,7 +136,7 @@ asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
 xen.lds: xen.lds.S
 	$(CPP) -P $(a_flags) -MQ $@ -o $@ $<
 
-dtb.o: $(CONFIG_DTB_FILE)
+dtb.o: $(patsubst "%",%,$(CONFIG_DTB_FILE))
 
 .PHONY: clean
 clean::
diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index c404fa973e..50f019ed98 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -156,10 +156,10 @@ past_zImage:
         sub   r10, r9, r0            /* r10 := phys-offset */
 
         /* Using the DTB in the .dtb section? */
-#ifdef CONFIG_DTB_FILE
+.ifnes CONFIG_DTB_FILE,""
         ldr   r8, =_sdtb
         add   r8, r10                /* r8 := paddr(DTB) */
-#endif
+.endif
 
         /* Initialize the UART if earlyprintk has been enabled. */
 #ifdef CONFIG_EARLY_PRINTK
diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index 5d44667bd8..f38a8dfca7 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -296,9 +296,9 @@ real_start_efi:
         sub   x20, x19, x0           /* x20 := phys-offset */
 
         /* Using the DTB in the .dtb section? */
-#ifdef CONFIG_DTB_FILE
+.ifnes CONFIG_DTB_FILE,""
         load_paddr x21, _sdtb
-#endif
+.endif
 
         /* Initialize the UART if earlyprintk has been enabled. */
 #ifdef CONFIG_EARLY_PRINTK
diff --git a/xen/arch/arm/dtb.S b/xen/arch/arm/dtb.S
index c703aef12b..c39f3a095c 100644
--- a/xen/arch/arm/dtb.S
+++ b/xen/arch/arm/dtb.S
@@ -1,2 +1,3 @@
         .section .dtb,#alloc
+        GLOBAL(_sdtb)
         .incbin CONFIG_DTB_FILE
diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index 004b182acb..fc1d39a886 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -220,11 +220,8 @@ SECTIONS
   } :text
   _end = . ;
 
-#ifdef CONFIG_DTB_FILE
   /* Section for the device tree blob (if any). */
-  _sdtb = .;
   .dtb : { *(.dtb) } :text
-#endif
 
   /* Sections to be discarded */
   /DISCARD/ : {
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index eb953d171e..a1755cd380 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -400,6 +400,16 @@ config DOM0_MEM
 
 	  Leave empty if you are not sure what to specify.
 
+config DTB_FILE
+	string "Absolute path to device tree blob"
+	depends on HAS_DEVICE_TREE
+	help
+	  When using a bootloader that has no device tree support or when there
+	  is no bootloader at all, use this option to specify the absolute path
+	  to a device tree that will be linked directly inside Xen binary.
+
+	  This is an optional config. Leave empty if not needed.
+
 config TRACEBUFFER
 	bool "Enable tracing infrastructure" if EXPERT
 	default y
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 16:23:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 16:23:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104643.200413 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lS068-00011A-Ck; Thu, 01 Apr 2021 16:23:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104643.200413; Thu, 01 Apr 2021 16:23:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lS068-000112-9k; Thu, 01 Apr 2021 16:23:08 +0000
Received: by outflank-mailman (input) for mailman id 104643;
 Thu, 01 Apr 2021 16:23: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 1lS066-00010p-8s
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:23: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 1lS066-0001ko-80
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:23:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lS066-0001hX-78
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:23: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=6gzh2O20MfYuVxuCJyfkpcC3SQzXGF/f6M1tQkzVauw=; b=EB4225ARLIdbyhBK7yjfUOOCeE
	oVIuNwbVAm7WDMvRM24idlbiBFgMnlqKPFpTdcwp+yv0kHOq7mUbmOiMaUyGqKkVpd5fdSN4gbEj0
	nDQmkfdk5ggCg/fwb9OxsXVl2jENqtVfqkNhTo53WAxPj8fkaUbQKlEw8UFZ8BV+O/90=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: smmuv1: Handle stream IDs more dynamically
Message-Id: <E1lS066-0001hX-78@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 16:23:06 +0000

commit e889809bbdf2f0eb91105d7f7d4f36c9d5497acc
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Mon Mar 22 16:11:35 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xen/arm: smmuv1: Handle stream IDs more dynamically
    
    Backport commit 21174240e4f4439bb8ed6c116cdbdc03eba2126e
    "iommu/arm-smmu: Handle stream IDs more dynamically" from the Linux
    ernel.
    
    This patch is the preparatory work to fix the stream match conflict
    when two devices have the same stream-id.
    
    Original commit message:
        iommu/arm-smmu: Handle stream IDs more dynamically
    
        Rather than assuming fixed worst-case values for stream IDs and SMR
        masks, keep track of whatever implemented bits the hardware actually
        reports. This also obviates the slightly questionable validation of SMR
        fields in isolation - rather than aborting the whole SMMU probe for a
        hardware configuration which is still architecturally valid, we can
        simply refuse masters later if they try to claim an unrepresentable ID
        or mask (which almost certainly implies a DT error anyway).
    
        Acked-by: Will Deacon <will.deacon@arm.com>
        Tested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
        Signed-off-by: Robin Murphy <robin.murphy@arm.com>
        Signed-off-by: Will Deacon <will.deacon@arm.com>
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/smmu.c | 43 +++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 21 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index 3e8aa37866..adfab8ee84 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -440,9 +440,7 @@ static struct iommu_group *iommu_group_get(struct device *dev)
 #define ARM_SMMU_GR0_SMR(n)		(0x800 + ((n) << 2))
 #define SMR_VALID			(1U << 31)
 #define SMR_MASK_SHIFT			16
-#define SMR_MASK_MASK			0x7fff
 #define SMR_ID_SHIFT			0
-#define SMR_ID_MASK			0x7fff
 
 #define ARM_SMMU_GR0_S2CR(n)		(0xc00 + ((n) << 2))
 #define S2CR_CBNDX_SHIFT		0
@@ -632,6 +630,8 @@ struct arm_smmu_device {
 	atomic_t			irptndx;
 
 	u32				num_mapping_groups;
+	u16				streamid_mask;
+	u16				smr_mask_mask;
 	DECLARE_BITMAP(smr_map, ARM_SMMU_MAX_SMRS);
 
 	unsigned long			s1_input_size;
@@ -2140,39 +2140,40 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu)
 		dev_notice(smmu->dev, "\tcoherent table walk\n");
 	}
 
+	/* Max. number of entries we have for stream matching/indexing */
+	size = 1 << ((id >> ID0_NUMSIDB_SHIFT) & ID0_NUMSIDB_MASK);
+	smmu->streamid_mask = size - 1;
 	if (id & ID0_SMS) {
-		u32 smr, sid, mask;
+		u32 smr;
 
 		smmu->features |= ARM_SMMU_FEAT_STREAM_MATCH;
-		smmu->num_mapping_groups = (id >> ID0_NUMSMRG_SHIFT) &
-					   ID0_NUMSMRG_MASK;
-		if (smmu->num_mapping_groups == 0) {
+		size = (id >> ID0_NUMSMRG_SHIFT) & ID0_NUMSMRG_MASK;
+		if (size == 0) {
 			dev_err(smmu->dev,
 				"stream-matching supported, but no SMRs present!\n");
 			return -ENODEV;
 		}
 
-		smr = SMR_MASK_MASK << SMR_MASK_SHIFT;
-		smr |= (SMR_ID_MASK << SMR_ID_SHIFT);
+		/*
+		 * SMR.ID bits may not be preserved if the corresponding MASK
+		 * bits are set, so check each one separately. We can reject
+		 * masters later if they try to claim IDs outside these masks.
+		 */
+		smr = smmu->streamid_mask << SMR_ID_SHIFT;
 		writel_relaxed(smr, gr0_base + ARM_SMMU_GR0_SMR(0));
 		smr = readl_relaxed(gr0_base + ARM_SMMU_GR0_SMR(0));
+		smmu->streamid_mask = smr >> SMR_ID_SHIFT;
 
-		mask = (smr >> SMR_MASK_SHIFT) & SMR_MASK_MASK;
-		sid = (smr >> SMR_ID_SHIFT) & SMR_ID_MASK;
-		if ((mask & sid) != sid) {
-			dev_err(smmu->dev,
-				"SMR mask bits (0x%x) insufficient for ID field (0x%x)\n",
-				mask, sid);
-			return -ENODEV;
-		}
+		smr = smmu->streamid_mask << SMR_MASK_SHIFT;
+		writel_relaxed(smr, gr0_base + ARM_SMMU_GR0_SMR(0));
+		smr = readl_relaxed(gr0_base + ARM_SMMU_GR0_SMR(0));
+		smmu->smr_mask_mask = smr >> SMR_MASK_SHIFT;
 
 		dev_notice(smmu->dev,
-			   "\tstream matching with %u register groups, mask 0x%x\n",
-			   smmu->num_mapping_groups, mask);
-	} else {
-		smmu->num_mapping_groups = (id >> ID0_NUMSIDB_SHIFT) &
-					   ID0_NUMSIDB_MASK;
+			   "\tstream matching with %lu register groups, mask 0x%x",
+			   size, smmu->smr_mask_mask);
 	}
+	smmu->num_mapping_groups = size;
 
 	/* ID1 */
 	id = readl_relaxed(gr0_base + ARM_SMMU_GR0_ID1);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 16:23:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 16:23:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104644.200417 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lS06H-00012b-ED; Thu, 01 Apr 2021 16:23:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104644.200417; Thu, 01 Apr 2021 16:23: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 1lS06H-00012T-BD; Thu, 01 Apr 2021 16:23:17 +0000
Received: by outflank-mailman (input) for mailman id 104644;
 Thu, 01 Apr 2021 16:23: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 1lS06G-00012N-CE
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:23: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 1lS06G-0001kw-BQ
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:23:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lS06G-0001iJ-Ad
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:23: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=EL6F44AqZeQ+c7+AZl7xWrXKR+lKnciQ0eHUAtqL4Es=; b=Pzv1w9AfhPslRLOafAazSJbIqT
	C4iLehyyhpn8/I+8R7SngtBIaDhNFidmRV2pCdP4wFzdFF84eZScuXOUpb3jvYPdglFIKj2k9HMOt
	ruQhTOXqVnHmQpl7AcvGIlu7wzg4TNBwtRJ0QyWkCjwfuwdIP4DhhmmuPyaaQ+Z2OWMM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: smmuv1: Consolidate stream map entry state
Message-Id: <E1lS06G-0001iJ-Ad@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 16:23:16 +0000

commit 5e08586afbb90b2e2d56c175c07db77a4afa873c
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Mon Mar 22 16:11:36 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xen/arm: smmuv1: Consolidate stream map entry state
    
    Backport commit 1f3d5ca43019bff1105838712d55be087d93c0da
    "iommu/arm-smmu: Consolidate stream map entry state" from the Linux
    kernel.
    
    This patch is the preparatory work to fix the stream match conflict
    when two devices have the same stream-id.
    
    Original commit message:
        iommu/arm-smmu: Consolidate stream map entry state
    
        In order to consider SMR masking, we really want to be able to validate
        ID/mask pairs against existing SMR contents to prevent stream match
        conflicts, which at best would cause transactions to fault unexpectedly,
        and at worst lead to silent unpredictable behaviour. With our SMMU
        instance data holding only an allocator bitmap, and the SMR values
        themselves scattered across master configs hanging off devices which we
        may have no way of finding, there's essentially no way short of digging
        everything back out of the hardware. Similarly, the thought of power
        management ops to support suspend/resume faces the exact same problem.
    
        By massaging the software state into a closer shape to the underlying
        hardware, everything comes together quite nicely; the allocator and the
        high-level view of the data become a single centralised state which we
        can easily keep track of, and to which any updates can be validated in
        full before being synchronised to the hardware itself.
    
        Signed-off-by: Robin Murphy <robin.murphy@arm.com>
        Signed-off-by: Will Deacon <will.deacon@arm.com>
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/smmu.c | 138 +++++++++++++++++++++----------------
 1 file changed, 79 insertions(+), 59 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index adfab8ee84..c41e94f836 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -308,9 +308,6 @@ static struct iommu_group *iommu_group_get(struct device *dev)
 /* Maximum number of context banks per SMMU */
 #define ARM_SMMU_MAX_CBS		128
 
-/* Maximum number of mapping groups per SMMU */
-#define ARM_SMMU_MAX_SMRS		128
-
 /* SMMU global address space */
 #define ARM_SMMU_GR0(smmu)		((smmu)->base)
 #define ARM_SMMU_GR1(smmu)		((smmu)->base + (1 << (smmu)->pgshift))
@@ -589,16 +586,17 @@ enum arm_smmu_arch_version {
 };
 
 struct arm_smmu_smr {
-	u8				idx;
 	u16				mask;
 	u16				id;
+	bool				valid;
 };
 
 struct arm_smmu_master_cfg {
 	int				num_streamids;
 	u16				streamids[MAX_MASTER_STREAMIDS];
-	struct arm_smmu_smr		*smrs;
+	s16				smendx[MAX_MASTER_STREAMIDS];
 };
+#define INVALID_SMENDX			-1
 
 struct arm_smmu_master {
 	struct device_node		*of_node;
@@ -632,7 +630,7 @@ struct arm_smmu_device {
 	u32				num_mapping_groups;
 	u16				streamid_mask;
 	u16				smr_mask_mask;
-	DECLARE_BITMAP(smr_map, ARM_SMMU_MAX_SMRS);
+	struct arm_smmu_smr		*smrs;
 
 	unsigned long			s1_input_size;
 	unsigned long			s1_output_size;
@@ -818,6 +816,7 @@ static int register_smmu_master(struct arm_smmu_device *smmu,
 			return -ERANGE;
 		}
 		master->cfg.streamids[i] = streamid;
+		master->cfg.smendx[i] = INVALID_SMENDX;
 	}
 	return insert_smmu_master(smmu, master);
 }
@@ -1384,79 +1383,91 @@ static void arm_smmu_domain_destroy(struct iommu_domain *domain)
 	kfree(smmu_domain);
 }
 
-static int arm_smmu_master_configure_smrs(struct arm_smmu_device *smmu,
-					  struct arm_smmu_master_cfg *cfg)
+static int arm_smmu_alloc_smr(struct arm_smmu_device *smmu)
 {
 	int i;
-	struct arm_smmu_smr *smrs;
-	void __iomem *gr0_base = ARM_SMMU_GR0(smmu);
 
-	if (!(smmu->features & ARM_SMMU_FEAT_STREAM_MATCH))
-		return 0;
+	for (i = 0; i < smmu->num_mapping_groups; i++)
+		if (!cmpxchg(&smmu->smrs[i].valid, false, true))
+			return i;
 
-	if (cfg->smrs)
-		return -EEXIST;
+	return INVALID_SMENDX;
+}
 
-	smrs = kmalloc_array(cfg->num_streamids, sizeof(*smrs), GFP_KERNEL);
-	if (!smrs) {
-		dev_err(smmu->dev, "failed to allocate %d SMRs\n",
-			cfg->num_streamids);
-		return -ENOMEM;
-	}
+static void arm_smmu_free_smr(struct arm_smmu_device *smmu, int idx)
+{
+	writel_relaxed(~SMR_VALID, ARM_SMMU_GR0(smmu) + ARM_SMMU_GR0_SMR(idx));
+	write_atomic(&smmu->smrs[idx].valid, false);
+}
+
+static void arm_smmu_write_smr(struct arm_smmu_device *smmu, int idx)
+{
+	struct arm_smmu_smr *smr = smmu->smrs + idx;
+	u32 reg = (smr->id & smmu->streamid_mask) << SMR_ID_SHIFT |
+		  (smr->mask & smmu->smr_mask_mask) << SMR_MASK_SHIFT;
+
+	if (smr->valid)
+		reg |= SMR_VALID;
+	writel_relaxed(reg, ARM_SMMU_GR0(smmu) + ARM_SMMU_GR0_SMR(idx));
+}
+
+static int arm_smmu_master_alloc_smes(struct arm_smmu_device *smmu,
+				      struct arm_smmu_master_cfg *cfg)
+{
+	struct arm_smmu_smr *smrs = smmu->smrs;
+	int i, idx;
 
 	/* Allocate the SMRs on the SMMU */
 	for (i = 0; i < cfg->num_streamids; ++i) {
-		int idx = __arm_smmu_alloc_bitmap(smmu->smr_map, 0,
-						  smmu->num_mapping_groups);
+		if (cfg->smendx[i] != INVALID_SMENDX)
+			return -EEXIST;
+
+		/* ...except on stream indexing hardware, of course */
+		if (!smrs) {
+			cfg->smendx[i] = cfg->streamids[i];
+			continue;
+		}
+
+		idx = arm_smmu_alloc_smr(smmu);
 		if (IS_ERR_VALUE(idx)) {
 			dev_err(smmu->dev, "failed to allocate free SMR\n");
 			goto err_free_smrs;
 		}
+		cfg->smendx[i] = idx;
 
-		smrs[i] = (struct arm_smmu_smr) {
-			.idx	= idx,
-			.mask	= 0, /* We don't currently share SMRs */
-			.id	= cfg->streamids[i],
-		};
+		smrs[idx].id = cfg->streamids[i];
+		smrs[idx].mask = 0; /* We don't currently share SMRs */
 	}
 
+	if (!smrs)
+		return 0;
+
 	/* It worked! Now, poke the actual hardware */
-	for (i = 0; i < cfg->num_streamids; ++i) {
-		u32 reg = SMR_VALID | smrs[i].id << SMR_ID_SHIFT |
-			  smrs[i].mask << SMR_MASK_SHIFT;
-		writel_relaxed(reg, gr0_base + ARM_SMMU_GR0_SMR(smrs[i].idx));
-	}
+	for (i = 0; i < cfg->num_streamids; ++i)
+		arm_smmu_write_smr(smmu, cfg->smendx[i]);
 
-	cfg->smrs = smrs;
 	return 0;
 
 err_free_smrs:
-	while (--i >= 0)
-		__arm_smmu_free_bitmap(smmu->smr_map, smrs[i].idx);
-	kfree(smrs);
+	while (i--) {
+		arm_smmu_free_smr(smmu, cfg->smendx[i]);
+		cfg->smendx[i] = INVALID_SMENDX;
+	}
 	return -ENOSPC;
 }
 
-static void arm_smmu_master_free_smrs(struct arm_smmu_device *smmu,
+static void arm_smmu_master_free_smes(struct arm_smmu_device *smmu,
 				      struct arm_smmu_master_cfg *cfg)
 {
 	int i;
-	void __iomem *gr0_base = ARM_SMMU_GR0(smmu);
-	struct arm_smmu_smr *smrs = cfg->smrs;
-
-	if (!smrs)
-		return;
 
 	/* Invalidate the SMRs before freeing back to the allocator */
 	for (i = 0; i < cfg->num_streamids; ++i) {
-		u8 idx = smrs[i].idx;
+		if (smmu->smrs)
+			arm_smmu_free_smr(smmu, cfg->smendx[i]);
 
-		writel_relaxed(~SMR_VALID, gr0_base + ARM_SMMU_GR0_SMR(idx));
-		__arm_smmu_free_bitmap(smmu->smr_map, idx);
+		cfg->smendx[i] = INVALID_SMENDX;
 	}
-
-	cfg->smrs = NULL;
-	kfree(smrs);
 }
 
 static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
@@ -1467,14 +1478,14 @@ static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
 	void __iomem *gr0_base = ARM_SMMU_GR0(smmu);
 
 	/* Devices in an IOMMU group may already be configured */
-	ret = arm_smmu_master_configure_smrs(smmu, cfg);
+	ret = arm_smmu_master_alloc_smes(smmu, cfg);
 	if (ret)
 		return ret == -EEXIST ? 0 : ret;
 
 	for (i = 0; i < cfg->num_streamids; ++i) {
 		u32 idx, s2cr;
 
-		idx = cfg->smrs ? cfg->smrs[i].idx : cfg->streamids[i];
+		idx = cfg->smendx[i];
 		s2cr = S2CR_TYPE_TRANS |
 		       (smmu_domain->cfg.cbndx << S2CR_CBNDX_SHIFT);
 		writel_relaxed(s2cr, gr0_base + ARM_SMMU_GR0_S2CR(idx));
@@ -1490,23 +1501,23 @@ static void arm_smmu_domain_remove_master(struct arm_smmu_domain *smmu_domain,
 	struct arm_smmu_device *smmu = smmu_domain->smmu;
 	void __iomem *gr0_base = ARM_SMMU_GR0(smmu);
 
-	/* An IOMMU group is torn down by the first device to be removed */
-	if ((smmu->features & ARM_SMMU_FEAT_STREAM_MATCH) && !cfg->smrs)
-		return;
-
 	/*
 	 * We *must* clear the S2CR first, because freeing the SMR means
 	 * that it can be re-allocated immediately.
 	 * Xen: Unlike Linux, any access to non-configured stream will fault.
 	 */
 	for (i = 0; i < cfg->num_streamids; ++i) {
-		u32 idx = cfg->smrs ? cfg->smrs[i].idx : cfg->streamids[i];
+		int idx = cfg->smendx[i];
+
+		/* An IOMMU group is torn down by the first device to be removed */
+		if (idx == INVALID_SMENDX)
+			return;
 
 		writel_relaxed(S2CR_TYPE_FAULT,
 			       gr0_base + ARM_SMMU_GR0_S2CR(idx));
 	}
 
-	arm_smmu_master_free_smrs(smmu, cfg);
+	arm_smmu_master_free_smes(smmu, cfg);
 }
 
 static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
@@ -2017,16 +2028,20 @@ static void arm_smmu_device_reset(struct arm_smmu_device *smmu)
 {
 	void __iomem *gr0_base = ARM_SMMU_GR0(smmu);
 	void __iomem *cb_base;
-	int i = 0;
+	int i;
 	u32 reg;
 
 	/* clear global FSR */
 	reg = readl_relaxed(ARM_SMMU_GR0_NS(smmu) + ARM_SMMU_GR0_sGFSR);
 	writel(reg, ARM_SMMU_GR0_NS(smmu) + ARM_SMMU_GR0_sGFSR);
 
-	/* Mark all SMRn as invalid and all S2CRn as bypass */
+	/*
+	 * Reset stream mapping groups: Initial values mark all SMRn as
+	 * invalid and all S2CRn as bypass unless overridden.
+	 */
 	for (i = 0; i < smmu->num_mapping_groups; ++i) {
-		writel_relaxed(0, gr0_base + ARM_SMMU_GR0_SMR(i));
+		if (smmu->smrs)
+			arm_smmu_write_smr(smmu, i);
 		/*
 		 * Xen: Unlike Linux, any access to a non-configure stream
 		 * will fault by default.
@@ -2169,6 +2184,11 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu)
 		smr = readl_relaxed(gr0_base + ARM_SMMU_GR0_SMR(0));
 		smmu->smr_mask_mask = smr >> SMR_MASK_SHIFT;
 
+		/* Zero-initialised to mark as invalid */
+		smmu->smrs = devm_kzalloc(smmu->dev, sizeof(*smmu->smrs), GFP_KERNEL);
+		if (!smmu->smrs)
+			return -ENOMEM;
+
 		dev_notice(smmu->dev,
 			   "\tstream matching with %lu register groups, mask 0x%x",
 			   size, smmu->smr_mask_mask);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 16:23:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 16:23:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104645.200421 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lS06R-00014E-HW; Thu, 01 Apr 2021 16:23:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104645.200421; Thu, 01 Apr 2021 16:23: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 1lS06R-000146-EB; Thu, 01 Apr 2021 16:23:27 +0000
Received: by outflank-mailman (input) for mailman id 104645;
 Thu, 01 Apr 2021 16:23: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 1lS06Q-00013v-FS
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:23: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 1lS06Q-0001lI-Ee
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:23:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lS06Q-0001ix-Dm
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:23: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=cjQhiddyc1G11swJkGCI/dM+lfd7in9Mpx9vh7d4gg0=; b=iLV634qKQUfUqBcNyMB3UHiR4T
	SRmpn6ddTnKfpaTqejs8LNO58jpRu5wFvHcysrqENQJTKAylar4AEfQfhz6GTucb4XHUlu72HhUeL
	1pxziKJ9+8h8+q42JwpWywVdIbzi98srYQhE7FpsCmKRtI2nQKx+Ev/V3Y2rEDGshB/Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: smmuv1: Keep track of S2CR state
Message-Id: <E1lS06Q-0001ix-Dm@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 16:23:26 +0000

commit 06d1f7a278ddf4344efbb28c3360901b5a79ab75
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Mon Mar 22 16:11:37 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xen/arm: smmuv1: Keep track of S2CR state
    
    Backport commit 8e8b203eabd8b9e96d02d6339e4abce3e5a7ea4b
    "iommu/arm-smmu: Keep track of S2CR state" from the Linux kernel.
    
    This patch is the preparatory work to fix the stream match conflict
    when two devices have the same stream-id.
    
    Original commit message:
        iommu/arm-smmu: Keep track of S2CR state
    
        Making S2CRs first-class citizens within the driver with a high-level
        representation of their state offers a neat solution to a few problems:
    
        Firstly, the information about which context a device's stream IDs are
        associated with is already present by necessity in the S2CR. With that
        state easily accessible we can refer directly to it and obviate the need
        to track an IOMMU domain in each device's archdata (its earlier purpose
        of enforcing correct attachment of multi-device groups now being handled
        by the IOMMU core itself).
    
        Secondly, the core API now deprecates explicit domain detach and expects
        domain attach to move devices smoothly from one domain to another; for
        SMMUv2, this notion maps directly to simply rewriting the S2CRs assigned
        to the device. By giving the driver a suitable abstraction of those
        S2CRs to work with, we can massively reduce the overhead of the current
        heavy-handed "detach, free resources, reallocate resources, attach"
        approach.
    
        Thirdly, making the software state hardware-shaped and attached to the
        SMMU instance once again makes suspend/resume of this register group
        that much simpler to implement in future.
    
        Signed-off-by: Robin Murphy <robin.murphy@arm.com>
        Signed-off-by: Will Deacon <will.deacon@arm.com>
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/smmu.c | 150 ++++++++++++++++++++++---------------
 1 file changed, 89 insertions(+), 61 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index c41e94f836..e1b937bd4b 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -444,9 +444,20 @@ static struct iommu_group *iommu_group_get(struct device *dev)
 #define S2CR_CBNDX_MASK			0xff
 #define S2CR_TYPE_SHIFT			16
 #define S2CR_TYPE_MASK			0x3
-#define S2CR_TYPE_TRANS			(0 << S2CR_TYPE_SHIFT)
-#define S2CR_TYPE_BYPASS		(1 << S2CR_TYPE_SHIFT)
-#define S2CR_TYPE_FAULT			(2 << S2CR_TYPE_SHIFT)
+enum arm_smmu_s2cr_type {
+	S2CR_TYPE_TRANS,
+	S2CR_TYPE_BYPASS,
+	S2CR_TYPE_FAULT,
+};
+
+#define S2CR_PRIVCFG_SHIFT		24
+#define S2CR_PRIVCFG_MASK		0x3
+enum arm_smmu_s2cr_privcfg {
+	S2CR_PRIVCFG_DEFAULT,
+	S2CR_PRIVCFG_DIPAN,
+	S2CR_PRIVCFG_UNPRIV,
+	S2CR_PRIVCFG_PRIV,
+};
 
 /* Context bank attribute registers */
 #define ARM_SMMU_GR1_CBAR(n)		(0x0 + ((n) << 2))
@@ -585,6 +596,16 @@ enum arm_smmu_arch_version {
 	ARM_SMMU_V2,
 };
 
+struct arm_smmu_s2cr {
+	enum arm_smmu_s2cr_type		type;
+	enum arm_smmu_s2cr_privcfg	privcfg;
+	u8				cbndx;
+};
+
+#define s2cr_init_val (struct arm_smmu_s2cr){				\
+	.type = S2CR_TYPE_FAULT                                 \
+}
+
 struct arm_smmu_smr {
 	u16				mask;
 	u16				id;
@@ -631,6 +652,7 @@ struct arm_smmu_device {
 	u16				streamid_mask;
 	u16				smr_mask_mask;
 	struct arm_smmu_smr		*smrs;
+	struct arm_smmu_s2cr		*s2crs;
 
 	unsigned long			s1_input_size;
 	unsigned long			s1_output_size;
@@ -1411,6 +1433,23 @@ static void arm_smmu_write_smr(struct arm_smmu_device *smmu, int idx)
 	writel_relaxed(reg, ARM_SMMU_GR0(smmu) + ARM_SMMU_GR0_SMR(idx));
 }
 
+static void arm_smmu_write_s2cr(struct arm_smmu_device *smmu, int idx)
+{
+	struct arm_smmu_s2cr *s2cr = smmu->s2crs + idx;
+	u32 reg = (s2cr->type & S2CR_TYPE_MASK) << S2CR_TYPE_SHIFT |
+		  (s2cr->cbndx & S2CR_CBNDX_MASK) << S2CR_CBNDX_SHIFT |
+		  (s2cr->privcfg & S2CR_PRIVCFG_MASK) << S2CR_PRIVCFG_SHIFT;
+
+	writel_relaxed(reg, ARM_SMMU_GR0(smmu) + ARM_SMMU_GR0_S2CR(idx));
+}
+
+static void arm_smmu_write_sme(struct arm_smmu_device *smmu, int idx)
+{
+	arm_smmu_write_s2cr(smmu, idx);
+	if (smmu->smrs)
+		arm_smmu_write_smr(smmu, idx);
+}
+
 static int arm_smmu_master_alloc_smes(struct arm_smmu_device *smmu,
 				      struct arm_smmu_master_cfg *cfg)
 {
@@ -1461,6 +1500,23 @@ static void arm_smmu_master_free_smes(struct arm_smmu_device *smmu,
 {
 	int i;
 
+	/*
+	 * We *must* clear the S2CR first, because freeing the SMR means
+	 * that it can be re-allocated immediately.
+	 */
+	for (i = 0; i < cfg->num_streamids; ++i) {
+		int idx = cfg->smendx[i];
+
+		/* An IOMMU group is torn down by the first device to be removed */
+		if (idx == INVALID_SMENDX)
+			return;
+
+		smmu->s2crs[idx] = s2cr_init_val;
+		arm_smmu_write_s2cr(smmu, idx);
+	}
+	/* Sync S2CR updates before touching anything else */
+	__iowmb();
+
 	/* Invalidate the SMRs before freeing back to the allocator */
 	for (i = 0; i < cfg->num_streamids; ++i) {
 		if (smmu->smrs)
@@ -1473,51 +1529,30 @@ static void arm_smmu_master_free_smes(struct arm_smmu_device *smmu,
 static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
 				      struct arm_smmu_master_cfg *cfg)
 {
-	int i, ret;
+	int i, ret = 0;
 	struct arm_smmu_device *smmu = smmu_domain->smmu;
-	void __iomem *gr0_base = ARM_SMMU_GR0(smmu);
+	struct arm_smmu_s2cr *s2cr = smmu->s2crs;
+	enum arm_smmu_s2cr_type type = S2CR_TYPE_TRANS;
+	u8 cbndx = smmu_domain->cfg.cbndx;
 
-	/* Devices in an IOMMU group may already be configured */
-	ret = arm_smmu_master_alloc_smes(smmu, cfg);
+	if (cfg->smendx[0] == INVALID_SMENDX)
+		ret = arm_smmu_master_alloc_smes(smmu, cfg);
 	if (ret)
-		return ret == -EEXIST ? 0 : ret;
-
-	for (i = 0; i < cfg->num_streamids; ++i) {
-		u32 idx, s2cr;
-
-		idx = cfg->smendx[i];
-		s2cr = S2CR_TYPE_TRANS |
-		       (smmu_domain->cfg.cbndx << S2CR_CBNDX_SHIFT);
-		writel_relaxed(s2cr, gr0_base + ARM_SMMU_GR0_S2CR(idx));
-	}
-
-	return 0;
-}
-
-static void arm_smmu_domain_remove_master(struct arm_smmu_domain *smmu_domain,
-					  struct arm_smmu_master_cfg *cfg)
-{
-	int i;
-	struct arm_smmu_device *smmu = smmu_domain->smmu;
-	void __iomem *gr0_base = ARM_SMMU_GR0(smmu);
+		return ret;
 
-	/*
-	 * We *must* clear the S2CR first, because freeing the SMR means
-	 * that it can be re-allocated immediately.
-	 * Xen: Unlike Linux, any access to non-configured stream will fault.
-	 */
 	for (i = 0; i < cfg->num_streamids; ++i) {
 		int idx = cfg->smendx[i];
 
-		/* An IOMMU group is torn down by the first device to be removed */
-		if (idx == INVALID_SMENDX)
-			return;
+		/* Devices in an IOMMU group may already be configured */
+		if (type == s2cr[idx].type && cbndx == s2cr[idx].cbndx)
+			break;
 
-		writel_relaxed(S2CR_TYPE_FAULT,
-			       gr0_base + ARM_SMMU_GR0_S2CR(idx));
+		s2cr[idx].type = type ;
+		s2cr[idx].privcfg = S2CR_PRIVCFG_UNPRIV;
+		s2cr[idx].cbndx = cbndx;
+		arm_smmu_write_s2cr(smmu, idx);
 	}
-
-	arm_smmu_master_free_smes(smmu, cfg);
+	return 0;
 }
 
 static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
@@ -1564,24 +1599,17 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
 	if (!cfg)
 		return -ENODEV;
 
-	ret = arm_smmu_domain_add_master(smmu_domain, cfg);
-
-	if (!ret)
-		dev_iommu_domain(dev) = domain;
-	return ret;
+	return arm_smmu_domain_add_master(smmu_domain, cfg);
 }
 
 static void arm_smmu_detach_dev(struct iommu_domain *domain, struct device *dev)
 {
-	struct arm_smmu_domain *smmu_domain = domain->priv;
-	struct arm_smmu_master_cfg *cfg;
+	struct arm_smmu_device *smmu = find_smmu_for_device(dev);
+	struct arm_smmu_master_cfg *cfg = find_smmu_master_cfg(dev);
 
-	cfg = find_smmu_master_cfg(dev);
-	if (!cfg)
-		return;
+	if (smmu && cfg)
+		arm_smmu_master_free_smes(smmu, cfg);
 
-	dev_iommu_domain(dev) = NULL;
-	arm_smmu_domain_remove_master(smmu_domain, cfg);
 }
 
 #if 0 /*
@@ -2039,16 +2067,8 @@ static void arm_smmu_device_reset(struct arm_smmu_device *smmu)
 	 * Reset stream mapping groups: Initial values mark all SMRn as
 	 * invalid and all S2CRn as bypass unless overridden.
 	 */
-	for (i = 0; i < smmu->num_mapping_groups; ++i) {
-		if (smmu->smrs)
-			arm_smmu_write_smr(smmu, i);
-		/*
-		 * Xen: Unlike Linux, any access to a non-configure stream
-		 * will fault by default.
-		 */
-		writel_relaxed(S2CR_TYPE_FAULT,
-			gr0_base + ARM_SMMU_GR0_S2CR(i));
-	}
+	for (i = 0; i < smmu->num_mapping_groups; ++i)
+		arm_smmu_write_sme(smmu, i);
 
 	/* Make sure all context banks are disabled and clear CB_FSR  */
 	for (i = 0; i < smmu->num_context_banks; ++i) {
@@ -2110,6 +2130,7 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu)
 	unsigned long size;
 	void __iomem *gr0_base = ARM_SMMU_GR0(smmu);
 	u32 id;
+	int i;
 
 	dev_notice(smmu->dev, "probing hardware configuration...\n");
 	dev_notice(smmu->dev, "SMMUv%d with:\n", smmu->version);
@@ -2193,6 +2214,13 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu)
 			   "\tstream matching with %lu register groups, mask 0x%x",
 			   size, smmu->smr_mask_mask);
 	}
+	/* s2cr->type == 0 means translation, so initialise explicitly */
+	smmu->s2crs = kmalloc_array(size, sizeof(*smmu->s2crs), GFP_KERNEL);
+	if (!smmu->s2crs)
+		return -ENOMEM;
+	for (i = 0; i < size; i++)
+		smmu->s2crs[i] = s2cr_init_val;
+
 	smmu->num_mapping_groups = size;
 
 	/* ID1 */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 16:23:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 16:23:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104646.200425 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lS06b-00015S-Ia; Thu, 01 Apr 2021 16:23:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104646.200425; Thu, 01 Apr 2021 16:23: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 1lS06b-00015K-Fi; Thu, 01 Apr 2021 16:23:37 +0000
Received: by outflank-mailman (input) for mailman id 104646;
 Thu, 01 Apr 2021 16:23: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 1lS06a-00015C-Id
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:23: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 1lS06a-0001lQ-Hm
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:23:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lS06a-0001jr-Gx
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:23: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=lEOsYkegfEzrBUUiOa7fpHjJFVoIxOj0RtmYc+X6kMs=; b=ldiptNEvqoDa452mu1TYhSjqrI
	l6JZKPC/H95qryYLKRlQS9dWeUYKoPP/FGtxYKLXeTv6TTz8/ZRdPqqMGStSWdIRlhdVVxUP+03y6
	RJNpsWC2K7nBIyvNiuLzaznzojgEUDzDY5OxLKkHOKkfzVSk/ce8r++hQNhyRkVkHWiI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: smmuv1: Add a stream map entry iterator
Message-Id: <E1lS06a-0001jr-Gx@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 16:23:36 +0000

commit e1d96fa2832d458ec6405b41a7202063421f5dc3
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Mon Mar 22 16:11:38 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xen/arm: smmuv1: Add a stream map entry iterator
    
    Backport commit d3097e39302083d58922a3d1032d7d59a63d263d
    "iommu/arm-smmu: Add a stream map entry iterator" from the Linux kernel.
    
    This patch is the preparatory work to fix the stream match conflict
    when two devices have the same stream-id.
    
    Original commit message:
        iommu/arm-smmu: Add a stream map entry iterator
    
        We iterate over the SMEs associated with a master config quite a lot in
        various places, and are about to do so even more. Let's wrap the idiom
        in a handy iterator macro before the repetition gets out of hand.
    
        Tested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
        Signed-off-by: Robin Murphy <robin.murphy@arm.com>
        Signed-off-by: Will Deacon <will.deacon@arm.com>
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/smmu.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index e1b937bd4b..2c1ea8e6ff 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -618,6 +618,8 @@ struct arm_smmu_master_cfg {
 	s16				smendx[MAX_MASTER_STREAMIDS];
 };
 #define INVALID_SMENDX			-1
+#define for_each_cfg_sme(cfg, i, idx) \
+	for (i = 0; idx = cfg->smendx[i], i < cfg->num_streamids; ++i)
 
 struct arm_smmu_master {
 	struct device_node		*of_node;
@@ -1457,8 +1459,8 @@ static int arm_smmu_master_alloc_smes(struct arm_smmu_device *smmu,
 	int i, idx;
 
 	/* Allocate the SMRs on the SMMU */
-	for (i = 0; i < cfg->num_streamids; ++i) {
-		if (cfg->smendx[i] != INVALID_SMENDX)
+	for_each_cfg_sme(cfg, i, idx) {
+		if (idx != INVALID_SMENDX)
 			return -EEXIST;
 
 		/* ...except on stream indexing hardware, of course */
@@ -1482,8 +1484,8 @@ static int arm_smmu_master_alloc_smes(struct arm_smmu_device *smmu,
 		return 0;
 
 	/* It worked! Now, poke the actual hardware */
-	for (i = 0; i < cfg->num_streamids; ++i)
-		arm_smmu_write_smr(smmu, cfg->smendx[i]);
+	for_each_cfg_sme(cfg, i, idx)
+		arm_smmu_write_smr(smmu, idx);
 
 	return 0;
 
@@ -1498,15 +1500,13 @@ err_free_smrs:
 static void arm_smmu_master_free_smes(struct arm_smmu_device *smmu,
 				      struct arm_smmu_master_cfg *cfg)
 {
-	int i;
+	int i, idx;
 
 	/*
 	 * We *must* clear the S2CR first, because freeing the SMR means
 	 * that it can be re-allocated immediately.
 	 */
-	for (i = 0; i < cfg->num_streamids; ++i) {
-		int idx = cfg->smendx[i];
-
+	for_each_cfg_sme(cfg, i, idx) {
 		/* An IOMMU group is torn down by the first device to be removed */
 		if (idx == INVALID_SMENDX)
 			return;
@@ -1518,9 +1518,9 @@ static void arm_smmu_master_free_smes(struct arm_smmu_device *smmu,
 	__iowmb();
 
 	/* Invalidate the SMRs before freeing back to the allocator */
-	for (i = 0; i < cfg->num_streamids; ++i) {
+	for_each_cfg_sme(cfg, i, idx) {
 		if (smmu->smrs)
-			arm_smmu_free_smr(smmu, cfg->smendx[i]);
+			arm_smmu_free_smr(smmu, idx);
 
 		cfg->smendx[i] = INVALID_SMENDX;
 	}
@@ -1529,7 +1529,7 @@ static void arm_smmu_master_free_smes(struct arm_smmu_device *smmu,
 static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
 				      struct arm_smmu_master_cfg *cfg)
 {
-	int i, ret = 0;
+	int i, idx, ret = 0;
 	struct arm_smmu_device *smmu = smmu_domain->smmu;
 	struct arm_smmu_s2cr *s2cr = smmu->s2crs;
 	enum arm_smmu_s2cr_type type = S2CR_TYPE_TRANS;
@@ -1540,9 +1540,7 @@ static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
 	if (ret)
 		return ret;
 
-	for (i = 0; i < cfg->num_streamids; ++i) {
-		int idx = cfg->smendx[i];
-
+	for_each_cfg_sme(cfg, i, idx) {
 		/* Devices in an IOMMU group may already be configured */
 		if (type == s2cr[idx].type && cbndx == s2cr[idx].cbndx)
 			break;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 01 16:23:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Apr 2021 16:23:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104647.200429 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lS06l-00016j-KG; Thu, 01 Apr 2021 16:23:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104647.200429; Thu, 01 Apr 2021 16: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 1lS06l-00016b-HE; Thu, 01 Apr 2021 16:23:47 +0000
Received: by outflank-mailman (input) for mailman id 104647;
 Thu, 01 Apr 2021 16:23: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 1lS06k-00016T-LX
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:23: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 1lS06k-0001lZ-Kh
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:23:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lS06k-0001kO-K4
 for xen-changelog@lists.xenproject.org; Thu, 01 Apr 2021 16:23: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=APTQgVLhyc7qvBJPCt1qjgDT9EapPyDPpuHxuSl0qtg=; b=04T5ZvrrORhnm6hcs+8SCDJS1j
	kEGKiVQzgqgEWwE6JbRPrXppwlvBpFWn7r7PTgTv+Ld/cXzmcKoD/NKbrGAxJTdO6BAY9wgPeji1+
	E3JMaV2BjZqZM/B9AzbaGAlp/MmFuk57LJOhcuP1/JOzC9trgYy4xW7EY0XBpb8EhGjQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: smmuv1: Intelligent SMR allocation
Message-Id: <E1lS06k-0001kO-K4@xenbits.xenproject.org>
Date: Thu, 01 Apr 2021 16:23:46 +0000

commit 0435784cc75dcfef3b5f59c29deb1dbb84265ddb
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Mon Mar 22 16:11:39 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xen/arm: smmuv1: Intelligent SMR allocation
    
    Backport 588888a7399db352d2b1a41c9d5b3bf0fd482390
    "iommu/arm-smmu: Intelligent SMR allocation" from the Linux kernel
    
    This patch fix the stream match conflict issue when two devices have the
    same stream-id.
    
    Only difference while applying this patch with regard to Linux patch are
    as follows:
    1. Spinlock is used in place of mutex when attaching a device to the
       SMMU via arm_smmu_master_alloc_smes(..) function call.Replacing the
       mutex with spinlock is fine here as we are configuring the hardware
       via registers and it is very fast.
    
    2. move iommu_group_alloc(..) function call in arm_smmu_add_device(..)
       function from the start of the function to the end.
    
    Original commit message:
        iommu/arm-smmu: Intelligent SMR allocation
    
        Stream Match Registers are one of the more awkward parts of the SMMUv2
        architecture; there are typically never enough to assign one to each
        stream ID in the system, and configuring them such that a single ID
        matches multiple entries is catastrophically bad - at best, every
        transaction raises a global fault; at worst, they go *somewhere*.
    
        To address the former issue, we can mask ID bits such that a single
        register may be used to match multiple IDs belonging to the same device
        or group, but doing so also heightens the risk of the latter problem
        (which can be nasty to debug).
    
        Tackle both problems at once by replacing the simple bitmap allocator
        with something much cleverer. Now that we have convenient in-memory
        representations of the stream mapping table, it becomes straightforward
        to properly validate new SMR entries against the current state, opening
        the door to arbitrary masking and SMR sharing.
    
        Another feature which falls out of this is that with IDs shared by
        separate devices being automatically accounted for, simply associating a
        group pointer with the S2CR offers appropriate group allocation almost
        for free, so hook that up in the process.
    
        Signed-off-by: Robin Murphy <robin.murphy@arm.com>
        Signed-off-by: Will Deacon <will.deacon@arm.com>
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien GralL <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/smmu.c | 230 +++++++++++++++++++++++--------------
 1 file changed, 142 insertions(+), 88 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index 2c1ea8e6ff..20ac672e91 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -597,6 +597,8 @@ enum arm_smmu_arch_version {
 };
 
 struct arm_smmu_s2cr {
+	struct iommu_group		*group;
+	int				count;
 	enum arm_smmu_s2cr_type		type;
 	enum arm_smmu_s2cr_privcfg	privcfg;
 	u8				cbndx;
@@ -613,6 +615,7 @@ struct arm_smmu_smr {
 };
 
 struct arm_smmu_master_cfg {
+	struct arm_smmu_device		*smmu;
 	int				num_streamids;
 	u16				streamids[MAX_MASTER_STREAMIDS];
 	s16				smendx[MAX_MASTER_STREAMIDS];
@@ -655,6 +658,7 @@ struct arm_smmu_device {
 	u16				smr_mask_mask;
 	struct arm_smmu_smr		*smrs;
 	struct arm_smmu_s2cr		*s2crs;
+	spinlock_t			stream_map_lock;
 
 	unsigned long			s1_input_size;
 	unsigned long			s1_output_size;
@@ -1407,23 +1411,6 @@ static void arm_smmu_domain_destroy(struct iommu_domain *domain)
 	kfree(smmu_domain);
 }
 
-static int arm_smmu_alloc_smr(struct arm_smmu_device *smmu)
-{
-	int i;
-
-	for (i = 0; i < smmu->num_mapping_groups; i++)
-		if (!cmpxchg(&smmu->smrs[i].valid, false, true))
-			return i;
-
-	return INVALID_SMENDX;
-}
-
-static void arm_smmu_free_smr(struct arm_smmu_device *smmu, int idx)
-{
-	writel_relaxed(~SMR_VALID, ARM_SMMU_GR0(smmu) + ARM_SMMU_GR0_SMR(idx));
-	write_atomic(&smmu->smrs[idx].valid, false);
-}
-
 static void arm_smmu_write_smr(struct arm_smmu_device *smmu, int idx)
 {
 	struct arm_smmu_smr *smr = smmu->smrs + idx;
@@ -1452,98 +1439,143 @@ static void arm_smmu_write_sme(struct arm_smmu_device *smmu, int idx)
 		arm_smmu_write_smr(smmu, idx);
 }
 
-static int arm_smmu_master_alloc_smes(struct arm_smmu_device *smmu,
-				      struct arm_smmu_master_cfg *cfg)
+static int arm_smmu_find_sme(struct arm_smmu_device *smmu, u16 id, u16 mask)
 {
 	struct arm_smmu_smr *smrs = smmu->smrs;
-	int i, idx;
+	int i, free_idx = -ENOSPC;
 
-	/* Allocate the SMRs on the SMMU */
-	for_each_cfg_sme(cfg, i, idx) {
-		if (idx != INVALID_SMENDX)
-			return -EEXIST;
+	/* Stream indexing is blissfully easy */
+	if (!smrs)
+		return id;
 
-		/* ...except on stream indexing hardware, of course */
-		if (!smrs) {
-			cfg->smendx[i] = cfg->streamids[i];
+	/* Validating SMRs is... less so */
+	for (i = 0; i < smmu->num_mapping_groups; ++i) {
+		if (!smrs[i].valid) {
+			/*
+			 * Note the first free entry we come across, which
+			 * we'll claim in the end if nothing else matches.
+			 */
+			if (free_idx < 0)
+				free_idx = i;
 			continue;
 		}
+		/*
+		 * If the new entry is _entirely_ matched by an existing entry,
+		 * then reuse that, with the guarantee that there also cannot
+		 * be any subsequent conflicting entries. In normal use we'd
+		 * expect simply identical entries for this case, but there's
+		 * no harm in accommodating the generalisation.
+		 */
+		if ((mask & smrs[i].mask) == mask &&
+		    !((id ^ smrs[i].id) & ~smrs[i].mask))
+			return i;
+		/*
+		 * If the new entry has any other overlap with an existing one,
+		 * though, then there always exists at least one stream ID
+		 * which would cause a conflict, and we can't allow that risk.
+		 */
+		if (!((id ^ smrs[i].id) & ~(smrs[i].mask | mask)))
+			return -EINVAL;
+	}
 
-		idx = arm_smmu_alloc_smr(smmu);
-		if (IS_ERR_VALUE(idx)) {
-			dev_err(smmu->dev, "failed to allocate free SMR\n");
-			goto err_free_smrs;
+	return free_idx;
+}
+
+static bool arm_smmu_free_sme(struct arm_smmu_device *smmu, int idx)
+{
+	if (--smmu->s2crs[idx].count)
+		return false;
+
+	smmu->s2crs[idx] = s2cr_init_val;
+	if (smmu->smrs)
+		smmu->smrs[idx].valid = false;
+
+	return true;
+}
+
+static int arm_smmu_master_alloc_smes(struct device *dev)
+{
+	struct arm_smmu_master_cfg *cfg = find_smmu_master_cfg(dev);
+	struct arm_smmu_device *smmu = cfg->smmu;
+	struct arm_smmu_smr *smrs = smmu->smrs;
+	struct iommu_group *group;
+	int i, idx, ret;
+
+	spin_lock(&smmu->stream_map_lock);
+	/* Figure out a viable stream map entry allocation */
+	for_each_cfg_sme(cfg, i, idx) {
+		if (idx != INVALID_SMENDX) {
+			ret = -EEXIST;
+			goto out_err;
 		}
-		cfg->smendx[i] = idx;
 
-		smrs[idx].id = cfg->streamids[i];
-		smrs[idx].mask = 0; /* We don't currently share SMRs */
+		ret = arm_smmu_find_sme(smmu, cfg->streamids[i], 0);
+		if (ret < 0)
+			goto out_err;
+
+		idx = ret;
+		if (smrs && smmu->s2crs[idx].count == 0) {
+			smrs[idx].id = cfg->streamids[i];
+			smrs[idx].mask = 0; /* We don't currently share SMRs */
+			smrs[idx].valid = true;
+		}
+		smmu->s2crs[idx].count++;
+		cfg->smendx[i] = (s16)idx;
 	}
 
-	if (!smrs)
-		return 0;
+	group = iommu_group_get(dev);
+	if (!group)
+		group = ERR_PTR(-ENOMEM);
+	if (IS_ERR(group)) {
+		ret = PTR_ERR(group);
+		goto out_err;
+	}
+	iommu_group_put(group);
 
 	/* It worked! Now, poke the actual hardware */
-	for_each_cfg_sme(cfg, i, idx)
-		arm_smmu_write_smr(smmu, idx);
+	for_each_cfg_sme(cfg, i, idx) {
+		arm_smmu_write_sme(smmu, idx);
+		smmu->s2crs[idx].group = group;
+	}
 
+	spin_unlock(&smmu->stream_map_lock);
 	return 0;
 
-err_free_smrs:
+out_err:
 	while (i--) {
-		arm_smmu_free_smr(smmu, cfg->smendx[i]);
+		arm_smmu_free_sme(smmu, cfg->smendx[i]);
 		cfg->smendx[i] = INVALID_SMENDX;
 	}
-	return -ENOSPC;
+	spin_unlock(&smmu->stream_map_lock);
+	return ret;
 }
 
-static void arm_smmu_master_free_smes(struct arm_smmu_device *smmu,
-				      struct arm_smmu_master_cfg *cfg)
+static void arm_smmu_master_free_smes(struct arm_smmu_master_cfg *cfg)
 {
+    struct arm_smmu_device *smmu = cfg->smmu;
 	int i, idx;
 
-	/*
-	 * We *must* clear the S2CR first, because freeing the SMR means
-	 * that it can be re-allocated immediately.
-	 */
+	spin_lock(&smmu->stream_map_lock);
 	for_each_cfg_sme(cfg, i, idx) {
-		/* An IOMMU group is torn down by the first device to be removed */
-		if (idx == INVALID_SMENDX)
-			return;
-
-		smmu->s2crs[idx] = s2cr_init_val;
-		arm_smmu_write_s2cr(smmu, idx);
-	}
-	/* Sync S2CR updates before touching anything else */
-	__iowmb();
-
-	/* Invalidate the SMRs before freeing back to the allocator */
-	for_each_cfg_sme(cfg, i, idx) {
-		if (smmu->smrs)
-			arm_smmu_free_smr(smmu, idx);
-
+		if (arm_smmu_free_sme(smmu, idx))
+			arm_smmu_write_sme(smmu, idx);
 		cfg->smendx[i] = INVALID_SMENDX;
 	}
+	spin_unlock(&smmu->stream_map_lock);
 }
 
 static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
 				      struct arm_smmu_master_cfg *cfg)
 {
-	int i, idx, ret = 0;
 	struct arm_smmu_device *smmu = smmu_domain->smmu;
 	struct arm_smmu_s2cr *s2cr = smmu->s2crs;
 	enum arm_smmu_s2cr_type type = S2CR_TYPE_TRANS;
 	u8 cbndx = smmu_domain->cfg.cbndx;
-
-	if (cfg->smendx[0] == INVALID_SMENDX)
-		ret = arm_smmu_master_alloc_smes(smmu, cfg);
-	if (ret)
-		return ret;
+	int i, idx;
 
 	for_each_cfg_sme(cfg, i, idx) {
-		/* Devices in an IOMMU group may already be configured */
 		if (type == s2cr[idx].type && cbndx == s2cr[idx].cbndx)
-			break;
+			continue;
 
 		s2cr[idx].type = type ;
 		s2cr[idx].privcfg = S2CR_PRIVCFG_UNPRIV;
@@ -1602,11 +1634,10 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
 
 static void arm_smmu_detach_dev(struct iommu_domain *domain, struct device *dev)
 {
-	struct arm_smmu_device *smmu = find_smmu_for_device(dev);
 	struct arm_smmu_master_cfg *cfg = find_smmu_master_cfg(dev);
 
-	if (smmu && cfg)
-		arm_smmu_master_free_smes(smmu, cfg);
+	if (cfg)
+		arm_smmu_master_free_smes(cfg);
 
 }
 
@@ -1935,31 +1966,44 @@ static void __arm_smmu_release_pci_iommudata(void *data)
 	kfree(data);
 }
 
+static struct iommu_group *arm_smmu_device_group(struct
+						arm_smmu_master_cfg *cfg)
+{
+	struct arm_smmu_device *smmu = cfg->smmu;
+	struct iommu_group *group = NULL;
+	int i, idx;
+
+	for_each_cfg_sme(cfg, i, idx) {
+		if (group && smmu->s2crs[idx].group &&
+		    group != smmu->s2crs[idx].group)
+			return ERR_PTR(-EINVAL);
+
+		group = smmu->s2crs[idx].group;
+	}
+
+	if (group)
+		return group;
+
+	return NULL;
+}
+
 static int arm_smmu_add_device(struct device *dev)
 {
 	struct arm_smmu_device *smmu;
 	struct arm_smmu_master_cfg *cfg;
 	struct iommu_group *group;
 	void (*releasefn)(void *) = NULL;
-	int ret;
 
 	smmu = find_smmu_for_device(dev);
 	if (!smmu)
 		return -ENODEV;
 
-	group = iommu_group_alloc();
-	if (IS_ERR(group)) {
-		dev_err(dev, "Failed to allocate IOMMU group\n");
-		return PTR_ERR(group);
-	}
-
 	if (dev_is_pci(dev)) {
 		struct pci_dev *pdev = to_pci_dev(dev);
 
 		cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
 		if (!cfg) {
-			ret = -ENOMEM;
-			goto out_put_group;
+			return -ENOMEM;
 		}
 
 		cfg->num_streamids = 1;
@@ -1970,24 +2014,33 @@ static int arm_smmu_add_device(struct device *dev)
 		pci_for_each_dma_alias(pdev, __arm_smmu_get_pci_sid,
 				       &cfg->streamids[0]);
 		releasefn = __arm_smmu_release_pci_iommudata;
+		cfg->smmu = smmu;
 	} else {
 		struct arm_smmu_master *master;
 
 		master = find_smmu_master(smmu, dev->of_node);
 		if (!master) {
-			ret = -ENODEV;
-			goto out_put_group;
+			return -ENODEV;
 		}
 
 		cfg = &master->cfg;
+		cfg->smmu = smmu;
 	}
 
-	iommu_group_set_iommudata(group, cfg, releasefn);
-	ret = iommu_group_add_device(group, dev);
+	group = arm_smmu_device_group(cfg);
+	if (!group) {
+		group = iommu_group_alloc();
+		if (IS_ERR(group)) {
+			dev_err(dev, "Failed to allocate IOMMU group\n");
+			return PTR_ERR(group);
+		}
+	}
 
-out_put_group:
+	iommu_group_set_iommudata(group, cfg, releasefn);
+	iommu_group_add_device(group, dev);
 	iommu_group_put(group);
-	return ret;
+
+	return arm_smmu_master_alloc_smes(dev);
 }
 
 #if 0 /* Xen: We don't support remove device for now. Will be useful for PCI */
@@ -2220,6 +2273,7 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu)
 		smmu->s2crs[i] = s2cr_init_val;
 
 	smmu->num_mapping_groups = size;
+	spin_lock_init(&smmu->stream_map_lock);
 
 	/* ID1 */
 	id = readl_relaxed(gr0_base + ARM_SMMU_GR0_ID1);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 02 07:33:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Apr 2021 07:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104792.200730 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lSEIh-0005du-DB; Fri, 02 Apr 2021 07:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104792.200730; Fri, 02 Apr 2021 07: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 1lSEIh-0005dm-AE; Fri, 02 Apr 2021 07:33:03 +0000
Received: by outflank-mailman (input) for mailman id 104792;
 Fri, 02 Apr 2021 07: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 1lSEIg-0005dh-Oo
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07: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 1lSEIg-0000QA-GJ
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lSEIg-00020M-Dy
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07: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=t9NqtlwFuJJqEC/geFaRI63xP3/QKpY6NDu8iFZ8LP4=; b=oCAhGq7bzHbFH1V1W255QdmaTG
	3Sy4whNRT13YJfINLeJZcrNhEW3CRRfSZotc3qDAmSx/mU5SyfcsyXrHk3QFmNoiJQb0m6k/9SWzJ
	UpjYlMOOkhhyBYfOlHMMOQy2L64s1tUPf4YulUAxoQVdQr2t2rcWyaVwttI4V/ay7e3s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Intel Processor Trace Support: Add CHANGELOG.md and SUPPORT.md entries
Message-Id: <E1lSEIg-00020M-Dy@xenbits.xenproject.org>
Date: Fri, 02 Apr 2021 07:33:02 +0000

commit 837d03b4ecac7b988be2dd76d32ee4222bea1df9
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Tue Mar 23 13:55:57 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Thu Apr 1 11:31:11 2021 +0100

    Intel Processor Trace Support: Add CHANGELOG.md and SUPPORT.md entries
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 SUPPORT.md   | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ffbf71fcb9..4582d1fea0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Renesas IPMMU-VMSA (Supported, not security supported; was Tech Preview)
  - ARM SMMUv3 (Tech Preview)
  - Switched MSR accesses to deny by default policy.
+ - Intel Processor Trace support (Tech Preview)
 
 ### Removed / support downgraded
 
diff --git a/SUPPORT.md b/SUPPORT.md
index 3ef072681b..d0b8afe41c 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -247,6 +247,13 @@ Export hypervisor coverage data suitable for analysis by gcov or lcov.
 
     Status: Supported, Not security supported
 
+### Processor trace support
+
+Support for using Intel Processor Trace technology to trace guests
+from dom0.
+
+    Status, x86: Tech Preview
+
 ## Memory Management
 
 ### Dynamic memory control
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 02 07:33:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Apr 2021 07:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104793.200734 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lSEIr-0005ec-Eg; Fri, 02 Apr 2021 07:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104793.200734; Fri, 02 Apr 2021 07: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 1lSEIr-0005eU-Bi; Fri, 02 Apr 2021 07:33:13 +0000
Received: by outflank-mailman (input) for mailman id 104793;
 Fri, 02 Apr 2021 07: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 1lSEIq-0005eN-L5
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07: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 1lSEIq-0000QI-KA
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lSEIq-000214-Ie
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07: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=4Ytr1iGyE8QDVzvPqZKcgNI+KaSekaT9BgOqngFRaKY=; b=u0WNvjHZbj9LfSFZ2q6COsbfCG
	ARv5CgNknaCR0muOVNX09npOEIqC0nx2HVkm8DvwOjiaZO2E0t7nEQhi+O8T5xhxjALl9Bvzu3zXs
	l4nNQKz/k3+NY49ouX94rMf9l/e+3FHGag6ri0mSmk6RtVMgByrowpxfLSaBoa617LhY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: Add named PCI devices
Message-Id: <E1lSEIq-000214-Ie@xenbits.xenproject.org>
Date: Fri, 02 Apr 2021 07:33:12 +0000

commit 40ce418faa56670a468c250e4a28f953ddd14d86
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Tue Mar 23 16:52:25 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Thu Apr 1 11:31:41 2021 +0100

    CHANGELOG.md: Add named PCI devices
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4582d1fea0..c3354fc14f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - ARM SMMUv3 (Tech Preview)
  - Switched MSR accesses to deny by default policy.
  - Intel Processor Trace support (Tech Preview)
+ - Named PCI devices for xl/libxl
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 02 07:33:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Apr 2021 07:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104794.200738 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lSEJ1-0005g2-GF; Fri, 02 Apr 2021 07:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104794.200738; Fri, 02 Apr 2021 07: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 1lSEJ1-0005fu-DG; Fri, 02 Apr 2021 07:33:23 +0000
Received: by outflank-mailman (input) for mailman id 104794;
 Fri, 02 Apr 2021 07: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 1lSEJ0-0005fm-Ps
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07: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 1lSEJ0-0000QU-OE
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lSEJ0-00021s-MO
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07: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=csrAIIvd5KCrYpXHGdec9o1Ra+eTzZjPfmi6P26M2Bg=; b=H2nwLW2eAyFU2GGv9Qwzr88l3g
	KReNCGTcCUDRGDanU7nbit3UZ3DP6oU+y0o3jGv/TDjCVf2glx7q7KgHAGfJBzYVQVKV//HVGN1z4
	sgTxw3XR6srF4t3ks9XVNaRhXj0r2K1ZDHrOZxHc9nHbFg7AigjNGBJ03A/NDdcQgeRQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: Add dom0/domU zstd compression support
Message-Id: <E1lSEJ0-00021s-MO@xenbits.xenproject.org>
Date: Fri, 02 Apr 2021 07:33:22 +0000

commit 8b60b8d1f2346ab52b2d7ecf864ff59318098b25
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Tue Mar 23 16:58:42 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Thu Apr 1 11:31:44 2021 +0100

    CHANGELOG.md: Add dom0/domU zstd compression support
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index c3354fc14f..4e6e071ed5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Switched MSR accesses to deny by default policy.
  - Intel Processor Trace support (Tech Preview)
  - Named PCI devices for xl/libxl
+ - Support for zstd-compressed dom0 (x86) and domU kernels
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 02 07:33:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Apr 2021 07:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104795.200743 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lSEJB-0005hh-IN; Fri, 02 Apr 2021 07:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104795.200743; Fri, 02 Apr 2021 07: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 1lSEJB-0005hV-Ek; Fri, 02 Apr 2021 07:33:33 +0000
Received: by outflank-mailman (input) for mailman id 104795;
 Fri, 02 Apr 2021 07: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 1lSEJA-0005hO-SE
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07: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 1lSEJA-0000Qt-RP
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lSEJA-00022s-QT
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07: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=yxaotdHQlwnv9WnqIFDpt5HZFsSvhcYa3+KoN3pyb6U=; b=RcwK3gETdplbS2VAs7v9Ej724G
	SBDmTuChgSWsr8Hqp+NIIAdzOLDEtLJFl4QvytqHP3ZLBlQgGbf0Kk80aZnzq1JutlEDevRORchX3
	d+lMax+lRo/OKYr9ICtbbYLtS37Izq15D99bYerOMipV1jG0EeYKK7O9gLxeYQtpHMDk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: NetBSD lib/gnttab support
Message-Id: <E1lSEJA-00022s-QT@xenbits.xenproject.org>
Date: Fri, 02 Apr 2021 07:33:32 +0000

commit f17acb5ef6d6957ae6d92028636a091acb88677d
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Tue Mar 23 17:06:20 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Thu Apr 1 11:31:45 2021 +0100

    CHANGELOG.md: NetBSD lib/gnttab support
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4e6e071ed5..ccb1b449b1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Intel Processor Trace support (Tech Preview)
  - Named PCI devices for xl/libxl
  - Support for zstd-compressed dom0 (x86) and domU kernels
+ - Library improvements from NetBSD ports upstreamed
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 02 07:33:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Apr 2021 07:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104796.200746 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lSEJL-0005j9-JM; Fri, 02 Apr 2021 07:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104796.200746; Fri, 02 Apr 2021 07:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lSEJL-0005j1-GN; Fri, 02 Apr 2021 07:33:43 +0000
Received: by outflank-mailman (input) for mailman id 104796;
 Fri, 02 Apr 2021 07:33:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lSEJK-0005iu-Vv
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lSEJK-0000R0-VD
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lSEJK-00023d-Ta
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XUv8Vm8A6nXHL12UqgzpOeT6ImYfnZy6D71+WhZTuUo=; b=cTGBe9DL8NSzdwcv2zxLc6fdzy
	c6bA1KAVZRfwCNZy+oFWxqj0c5v5r91OYU/ccwC/EGjflnAhrIUtgnPbyvNw+y1MoJF5G99TVT8gL
	D6OhnEBUaAlcHJL/mNMqwRFVTh3h3K06IsCNASWaWpg3JJnBBwAruG1jEum8mfczatxM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: Add entries for CI loop
Message-Id: <E1lSEJK-00023d-Ta@xenbits.xenproject.org>
Date: Fri, 02 Apr 2021 07:33:42 +0000

commit c58fbc38d208f2046e077833fe2b071ff479d7e6
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Wed Mar 24 16:20:28 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Thu Apr 1 11:31:46 2021 +0100

    CHANGELOG.md: Add entries for CI loop
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ccb1b449b1..529e00dc3f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Named PCI devices for xl/libxl
  - Support for zstd-compressed dom0 (x86) and domU kernels
  - Library improvements from NetBSD ports upstreamed
+ - CI loop: Add Alpine Linux, Ubuntu Focal targets; drop CentOS 6
+ - CI loop: Add qemu-based dom0 / domU test for ARM
+ - CI loop: Add dom0less aarch64 smoke test
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 02 07:33:53 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Apr 2021 07:33:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104797.200750 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lSEJV-0005kJ-L5; Fri, 02 Apr 2021 07:33:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104797.200750; Fri, 02 Apr 2021 07:33:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lSEJV-0005kB-Hs; Fri, 02 Apr 2021 07:33:53 +0000
Received: by outflank-mailman (input) for mailman id 104797;
 Fri, 02 Apr 2021 07:33:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lSEJV-0005k5-2t
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07:33:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lSEJV-0000R9-25
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07:33:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lSEJV-00024P-1E
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07:33:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=y9JB7u4WAemOLMHuHTyJeKVWoFSagTiGRV5jmrCl61E=; b=ZKuswgqtOl8lj4/WLsvt3ba/UM
	NkQFxh81sEMomIkS7HlfKxw+MiITKIaujZL6DoPV/pvNESZv3Tt5jvXjC8zr98DjRpPJdA5RBK8/4
	ayzQhj+6XGrK8LUWHTyQ9ZGATaMnfThTsbpeyg78c9mWDALd9j+04Ins9NITmXO6jo+8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: Add entries for emulation
Message-Id: <E1lSEJV-00024P-1E@xenbits.xenproject.org>
Date: Fri, 02 Apr 2021 07:33:53 +0000

commit 8b39f21574b049c89b20815ed738d9c725faf3a4
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Wed Mar 24 13:24:45 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Thu Apr 1 11:31:47 2021 +0100

    CHANGELOG.md: Add entries for emulation
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 529e00dc3f..21cf6df4a2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - CI loop: Add Alpine Linux, Ubuntu Focal targets; drop CentOS 6
  - CI loop: Add qemu-based dom0 / domU test for ARM
  - CI loop: Add dom0less aarch64 smoke test
+ - x86: Allow domains to use AVX-VNNI instructions
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 02 07:34:04 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Apr 2021 07:34:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.104798.200753 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lSEJg-0005le-Mc; Fri, 02 Apr 2021 07:34:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 104798.200753; Fri, 02 Apr 2021 07:34:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lSEJg-0005lW-JR; Fri, 02 Apr 2021 07:34:04 +0000
Received: by outflank-mailman (input) for mailman id 104798;
 Fri, 02 Apr 2021 07:34:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lSEJf-0005lJ-96
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07:34:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lSEJf-0000RY-5A
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07:34:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lSEJf-00025Y-4J
 for xen-changelog@lists.xenproject.org; Fri, 02 Apr 2021 07:34:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S83m4nOXIDzOmQQiso0UcKhGQmFH+scuZAO/geJSCqA=; b=aqdqZoW54vICcAZOGyeYx7ZLJi
	4Xg4YVGltguB7PBRDmCQh4sn+z8lYlAb6Rs0VlgCzyxKMq5JX929qhpEMI+YPeuJPHIPeStJhlrpt
	jjBjNS2bOVTDg0GvuDRkKuwaBf9VPW1s63/BNtOAFAl3X25T+Y5VQ9lXUsdgt1NDfWBw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: Make PV shim smaller by factoring out HVM-specific shadow code
Message-Id: <E1lSEJf-00025Y-4J@xenbits.xenproject.org>
Date: Fri, 02 Apr 2021 07:34:03 +0000

commit b0976d5c0441378b6348f5bfedbf431055bd0147
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Wed Mar 24 17:24:31 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Thu Apr 1 11:31:47 2021 +0100

    CHANGELOG.md: Make PV shim smaller by factoring out HVM-specific shadow code
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 21cf6df4a2..8964bacf73 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - CI loop: Add qemu-based dom0 / domU test for ARM
  - CI loop: Add dom0less aarch64 smoke test
  - x86: Allow domains to use AVX-VNNI instructions
+ - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 14:22:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 14:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106034.202757 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTmak-0007yM-43; Tue, 06 Apr 2021 14:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106034.202757; Tue, 06 Apr 2021 14:22:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTmak-0007yD-0x; Tue, 06 Apr 2021 14:22:06 +0000
Received: by outflank-mailman (input) for mailman id 106034;
 Tue, 06 Apr 2021 14:22:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTmaj-0007y7-3x
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 14:22:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTmaj-0008OX-2E
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 14:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTmaj-0002DN-1F
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 14: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=gGCoQFjWt2o0b36jVy2XToNcfDTlo2M+gRU2wTJdV+A=; b=gT+tz8yTqAQuZHDecfmputlm2L
	mMnX4wuRM6rnyvL/+f8lQcWfCR+ZJVJO6ZvMfe0AZ2/hqYDOzmzQYC2xX5ObeJh5KJ1afyQxe0dlz
	OZOO8+NnZXiWMOkuM3H6qfK8yTucH8twotytmhp3tRHOYGHn1fDvozO2FOab1ViLMm+Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] common: map_vcpu_info() cosmetics
Message-Id: <E1lTmaj-0002DN-1F@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 14:22:05 +0000

commit 7ee7a3749bcb5d39ced5a1ee3e8284b2bb9abc29
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 6 16:17:42 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 6 16:17:42 2021 +0200

    common: map_vcpu_info() cosmetics
    
    Use ENXIO instead of EINVAL to cover the two cases of the address not
    satisfying the requirements. This will make an issue here better stand
    out at the call site.
    
    Also add a missing compat-mode related size check: If the sizes
    differed, other code in the function would need changing. Accompany this
    by a change to the initial sizeof() expression, tying it to the type of
    the variable we're actually after (matching e.g. the alignof() added by
    XSA-327).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/domain.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index d85984638a..cdda0d1f29 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1427,17 +1427,18 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
     struct page_info *page;
     unsigned int align;
 
-    if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
-        return -EINVAL;
+    if ( offset > (PAGE_SIZE - sizeof(*new_info)) )
+        return -ENXIO;
 
 #ifdef CONFIG_COMPAT
+    BUILD_BUG_ON(sizeof(*new_info) != sizeof(new_info->compat));
     if ( has_32bit_shinfo(d) )
         align = alignof(new_info->compat);
     else
 #endif
         align = alignof(*new_info);
     if ( offset & (align - 1) )
-        return -EINVAL;
+        return -ENXIO;
 
     if ( !mfn_eq(v->vcpu_info_mfn, INVALID_MFN) )
         return -EINVAL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 14:22:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 14:22:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106035.202761 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTmav-0007zU-5Z; Tue, 06 Apr 2021 14:22:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106035.202761; Tue, 06 Apr 2021 14:22: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 1lTmav-0007zN-2T; Tue, 06 Apr 2021 14:22:17 +0000
Received: by outflank-mailman (input) for mailman id 106035;
 Tue, 06 Apr 2021 14:22:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTmat-0007z7-7Z
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 14:22:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTmat-0008Oe-5r
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 14:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTmat-0002EL-4U
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 14: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=N15IzORy3GULbPm192ImTzPHZnYpj3HoAi+s1+/Yif0=; b=GauzqzNMrmhonAV4Jho2CXXMlB
	LUNslkXLvj4TN0YOOrbEAqvfbghdnd0jyhPHTtA2+1W+OObMA3Q+MDNKiK1gSzimOO2IuHFh4hscT
	9Mi6JipJBtX6GMxEa9INYHtlhZJCEtAk+8uceC6ftCzFs8UoWu/Kq/KmLBoSSQkM0D50=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] rangeset: no need to use snprintf()
Message-Id: <E1lTmat-0002EL-4U@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 14:22:15 +0000

commit 6425fcf37122b1f1e4ceaacadd00a4c280a58f57
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 6 16:18:41 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 6 16:18:41 2021 +0200

    rangeset: no need to use snprintf()
    
    As of the conversion to safe_strcpy() years ago there has been no need
    anymore to use snprintf() to prevent storing a not-nul-terminated string.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/rangeset.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/xen/common/rangeset.c b/xen/common/rangeset.c
index 4ebba30ba3..0afe638f40 100644
--- a/xen/common/rangeset.c
+++ b/xen/common/rangeset.c
@@ -436,14 +436,7 @@ struct rangeset *rangeset_new(
     BUG_ON(flags & ~RANGESETF_prettyprint_hex);
     r->flags = flags;
 
-    if ( name != NULL )
-    {
-        safe_strcpy(r->name, name);
-    }
-    else
-    {
-        snprintf(r->name, sizeof(r->name), "(no name)");
-    }
+    safe_strcpy(r->name, name ?: "(no name)");
 
     if ( (r->domain = d) != NULL )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 16:55:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 16:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106116.202900 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lToyp-0005Yv-Vd; Tue, 06 Apr 2021 16:55:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106116.202900; Tue, 06 Apr 2021 16:55:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lToyp-0005Yn-SZ; Tue, 06 Apr 2021 16:55:07 +0000
Received: by outflank-mailman (input) for mailman id 106116;
 Tue, 06 Apr 2021 16:55:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lToyo-0005Yi-A9
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:55:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lToyo-00031M-6i
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:55:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lToyo-0003lu-4O
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:55:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AUoShPT2uNyw4WJGqGXMWlR2mjDHbmv4Y5X5Jwzgf9k=; b=b//h8AL/JxCYbkfDvl25tlLSrG
	HpBfJZu0bNZBOGy0fagJ05G5C1loqz56uhsD3mcgw93hpxtSpGr8L6p3tupGjgarOzlLribfDZ5UB
	O5VS5lTHhI4xstJJLxvOKu3sBFYwgVisx1Y1gYXyFIDzmNCuOfGoHrpKuQEC9QfgPvU8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: Mention XEN_SCRIPT_DIR
Message-Id: <E1lToyo-0003lu-4O@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 16:55:06 +0000

commit 18a872f057cbd67de477dca605cdeceef51097cf
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 13:51:48 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:46:50 2021 +0100

    CHANGELOG.md: Mention XEN_SCRIPT_DIR
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-acked-by: Ian Jackson <iwj@xenproject.org>
    ---
    
    CC: Olaf Hering <olaf@aepfle.de>
    CC: Ian Jackson <iwj@xenproject.org>
---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8964bacf73..f7ce6682b9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - CI loop: Add dom0less aarch64 smoke test
  - x86: Allow domains to use AVX-VNNI instructions
  - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
+ - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
+
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 16:55:18 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 16:55:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106117.202904 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lToz0-0005Zn-0t; Tue, 06 Apr 2021 16:55:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106117.202904; Tue, 06 Apr 2021 16:55:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lToyz-0005Zf-Tz; Tue, 06 Apr 2021 16:55:17 +0000
Received: by outflank-mailman (input) for mailman id 106117;
 Tue, 06 Apr 2021 16:55:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lToyy-0005ZW-Bj
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:55:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lToyy-00031R-As
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:55:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lToyy-0003oC-90
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:55:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=e/usiGsuAsArztkhLxd3fZNVHnaMfp7s+J0M0/oKiBg=; b=ppWfxFcTm01rtODJpDa3OFPCdI
	TmaUwRUcI8qzLIKkax5eX9QNgJkqpzqkKGRVQBrnpFf/7ycBH/tbuQD9WPCnje84lc7C4GvvkoXpP
	IJUEWv4Cfb0qmGrzuJRQ7zV5p649dVJYsCXSiZJTF/OH1aEnzcQFN0fdhHHQzYGI0zwU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: xl PCI configuration doc, xenstore MTU entries
Message-Id: <E1lToyy-0003oC-90@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 16:55:16 +0000

commit f57316a909a76ee727cc8d1256a7d57a53e7c895
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 13:54:10 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:46:50 2021 +0100

    CHANGELOG.md: xl PCI configuration doc, xenstore MTU entries
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
    ---
    CC: Paul Durrant <paul@xen.org>
    CC: Ian Jackson <ian.jackson@citrix.com>
    CC: Wei Liu <wl@xen.org>
---
 CHANGELOG.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index f7ce6682b9..086a0e50d0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Switched MSR accesses to deny by default policy.
  - Intel Processor Trace support (Tech Preview)
  - Named PCI devices for xl/libxl
+ - Improved documentation for xl PCI configuration format
  - Support for zstd-compressed dom0 (x86) and domU kernels
  - Library improvements from NetBSD ports upstreamed
  - CI loop: Add Alpine Linux, Ubuntu Focal targets; drop CentOS 6
@@ -23,7 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - x86: Allow domains to use AVX-VNNI instructions
  - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
  - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
-
+ - xennet: Documented a way for the backend (or toolstack) to specify MTU to the frontend
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 16:55:28 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 16:55:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106118.202908 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTozA-0005b2-2X; Tue, 06 Apr 2021 16:55:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106118.202908; Tue, 06 Apr 2021 16:55: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 1lToz9-0005au-Vg; Tue, 06 Apr 2021 16:55:27 +0000
Received: by outflank-mailman (input) for mailman id 106118;
 Tue, 06 Apr 2021 16:55:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lToz8-0005ag-G2
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:55:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lToz8-00031Z-Eq
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:55:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lToz8-0003zI-DX
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:55:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/O1A9riFbVU2yaSi3itpKzbR+NXhNC94QNS2ma8sP6g=; b=gB5WZNtGQPdK2U7u4CwkzW26XN
	QtIOaU8eitUg1DCeBNnB5I91NXJpm6rgguDZ9QmWFuaUM67X4oj7mOHa/ekz45R4PzY5h6S/TdL6E
	BcGuYw12xI/unN1lxCndmDeOseAp0kZCPmOnYFFyFW+je+0poWg0ulNoA6lHtxGQ7qeI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: Some additional affordances in various xl subcommands
Message-Id: <E1lToz8-0003zI-DX@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 16:55:26 +0000

commit 6645040c9f93a6bc106c755859f435e76192c33f
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:06:36 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:46:50 2021 +0100

    CHANGELOG.md: Some additional affordances in various xl subcommands
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
    ---
    CC: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 086a0e50d0..a12dab1c33 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
  - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
  - xennet: Documented a way for the backend (or toolstack) to specify MTU to the frontend
+ - Some additional affordances in various xl subcommands.
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 16:55:38 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 16:55:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106119.202912 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTozK-0005cu-3v; Tue, 06 Apr 2021 16:55:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106119.202912; Tue, 06 Apr 2021 16:55: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 1lTozK-0005cm-0y; Tue, 06 Apr 2021 16:55:38 +0000
Received: by outflank-mailman (input) for mailman id 106119;
 Tue, 06 Apr 2021 16:55:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTozI-0005ca-J0
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:55:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTozI-00031g-IF
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:55:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTozI-00041C-H9
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:55:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sF/ap6q8lBGsnBW9B0hKEN3Y6cYrliOJUbbQJcialV8=; b=ml3R4LS0LCMZAlArT7lFRrguVb
	WCd8pENO4QFCws6oj8p9f94Kf1LtK1U00MaCIcLPT/1nAHxLDkA+YYch3aqdVvSd33PHV9Qp1cxJH
	sxBl+UbIbn6Nj1AZoWa1EhSf4Q/JST3TxQif2pDcEW6hUAXq8AZ1umH9fxLtPxzfBSAc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: Mention various ARM errata
Message-Id: <E1lTozI-00041C-H9@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 16:55:36 +0000

commit 649151e4b8809c5eddd1b1f8f84dc45fd7b7fb3d
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:08:04 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:46:50 2021 +0100

    CHANGELOG.md: Mention various ARM errata
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    ---
    v2:
     - Tweaked wording
    CC: Ian Jackson <ian.jackson@citrix.com>
    CC: Stefano Stabellini <sstabellini@kernel.org>
    CC: Julien Grall <julien@xen.org>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a12dab1c33..6863f2a530 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
  - xennet: Documented a way for the backend (or toolstack) to specify MTU to the frontend
  - Some additional affordances in various xl subcommands.
+ - Added workarounds for the following ARM errata: Cortex A53 #843419, Cortex A55 #1530923, Cortex A72 #853709, Cortex A73 #858921, Cortex A76 #1286807, Neoverse-N1 #1165522
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 16:55:48 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 16:55:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106120.202918 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTozU-0005e7-69; Tue, 06 Apr 2021 16:55:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106120.202918; Tue, 06 Apr 2021 16:55: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 1lTozU-0005e0-2R; Tue, 06 Apr 2021 16:55:48 +0000
Received: by outflank-mailman (input) for mailman id 106120;
 Tue, 06 Apr 2021 16:55:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTozS-0005dr-MP
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:55:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTozS-000326-Lb
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:55:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTozS-0004aY-KX
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:55:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Of1+QukDljbjgh2n0zw+n7X/Fr2AzWa7lkAhnUee0jc=; b=A4U3QfwXQDvUfUUIFDHzttfnLw
	nG7RNlsexb+uc/E9GDMAmu+0VshoU5iyAumGHcdPcDzdcVZp8d8WlBrDfhUqWy10BtOBSCK0u1GNn
	13CTkElDfPKWiU7l+sw5DShoHvlZKgvl4EqA2hytNX3YZIouttJlj0p/py32jIWinSno=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: Various new entries, mostly x86
Message-Id: <E1lTozS-0004aY-KX@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 16:55:46 +0000

commit 0ddaeeb4fc80b86b25168fd5cb30f9130590f16b
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:18:36 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:46:50 2021 +0100

    CHANGELOG.md: Various new entries, mostly x86
    
    ...Grouped mostly by submitter / maintainer
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    ---
    CC: Ian Jackson <ian.jackson@citrix.com>
    CC: Andrew Cooper <andrew.cooper3@citrix.com>
    CC: Jan Beulich <jbeulich@suse.com>
    CC: Roger Pau Monne <roger.pau@citrix.com>
---
 CHANGELOG.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6863f2a530..1f370737eb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Named PCI devices for xl/libxl
  - Improved documentation for xl PCI configuration format
  - Support for zstd-compressed dom0 (x86) and domU kernels
+ - EFI: Enable booting unified hypervisor/kernel/initrd/DT images
+ - Reduce ACPI verbosity by default
+ - Add ucode=allow-same option to test late microcode loading path
  - Library improvements from NetBSD ports upstreamed
  - CI loop: Add Alpine Linux, Ubuntu Focal targets; drop CentOS 6
  - CI loop: Add qemu-based dom0 / domU test for ARM
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 16:55:58 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 16:55:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106121.202920 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lToze-0005fM-6t; Tue, 06 Apr 2021 16:55:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106121.202920; Tue, 06 Apr 2021 16:55: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 1lToze-0005fD-3q; Tue, 06 Apr 2021 16:55:58 +0000
Received: by outflank-mailman (input) for mailman id 106121;
 Tue, 06 Apr 2021 16:55:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTozc-0005f3-PW
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:55: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 1lTozc-00032G-Of
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:55:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTozc-0004bP-Nk
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:55: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=v4YLXJGnoU3JychSlo6RAF7csuzJIb7+m8m3SzKJ7P0=; b=qEbX7rVPVX6VFZnpZ4c/KMJ+9C
	eJL/ku1CNXyequIEtMBhWAaEUrnKjRg4ZgjuJu+3Rwq+tTdaqjmwsy3IaUHL22JsJZJkWxgwVOzf1
	e3WlNrDvE7XlhCkEDYQWqENczy+JdP/V01twSYgW2fITO+g4/Mu1X48HZBl9Wd+K99vM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: Various entries, mostly xenstore
Message-Id: <E1lTozc-0004bP-Nk@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 16:55:56 +0000

commit a98534a856c5a98aa0a73c21dfbe479370aec8c4
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:30:55 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:46:50 2021 +0100

    CHANGELOG.md: Various entries, mostly xenstore
    
    ...grouped by submitters / maintainers
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    ---
    CC: Juergen Gross <jgross@suse.com>
    CC: Jan Beulich <jbeulich@suse.com>
    CC: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1f370737eb..67daeb0c93 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,8 +28,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
  - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
  - xennet: Documented a way for the backend (or toolstack) to specify MTU to the frontend
+ - xenstore can now be live-updated on a running system. (Tech preview)
  - Some additional affordances in various xl subcommands.
  - Added workarounds for the following ARM errata: Cortex A53 #843419, Cortex A55 #1530923, Cortex A72 #853709, Cortex A73 #858921, Cortex A76 #1286807, Neoverse-N1 #1165522
+ - On detecting a host crash, some debug key handlers can automatically triggered to aid in debugging
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 16:56:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 16:56:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106122.202924 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTozo-0005gd-94; Tue, 06 Apr 2021 16:56:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106122.202924; Tue, 06 Apr 2021 16:56: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 1lTozo-0005gV-5R; Tue, 06 Apr 2021 16:56:08 +0000
Received: by outflank-mailman (input) for mailman id 106122;
 Tue, 06 Apr 2021 16:56: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 1lTozm-0005gM-Sx
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:56: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 1lTozm-00032a-SB
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:56:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTozm-0004ce-R0
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 16:56: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=trhGW8l1gZdoKUExx8X9v9D/8PXK12b8KpTAxy2HB28=; b=LcnF2CTckX0asMvrhFW/9m6Lnx
	jedtaiwLi57pgiMSAZWqiUbvBWUi373fR7jPG1uOUfXtJqrnZk9eyS6ksbYHGmn5srWSF+svcmNEx
	ukRy2CX+hQ47w2CNapsDZ35aX5agspOIZjLoR6ApiPXKJO+gzYblYibo7ZMT1HDXgVlE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: irq-max-guests
Message-Id: <E1lTozm-0004ce-R0@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 16:56:06 +0000

commit 3b368340c41823e24559192ccd158cf071bf4a8f
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:34:04 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:46:50 2021 +0100

    CHANGELOG.md: irq-max-guests
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    ---
    CC: Igor Druzhinin <igor.druzhinin@citrix.com>
    CC: Jan Beulich <jbeulich@suse.com>
    CC: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 67daeb0c93..0106fccec1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,6 +32,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Some additional affordances in various xl subcommands.
  - Added workarounds for the following ARM errata: Cortex A53 #843419, Cortex A55 #1530923, Cortex A72 #853709, Cortex A73 #858921, Cortex A76 #1286807, Neoverse-N1 #1165522
  - On detecting a host crash, some debug key handlers can automatically triggered to aid in debugging
+ - Increase the maximum number of guests which can share a single IRQ from 7 to 16, and make this configurable with irq-max-guests
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 17:22:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 17:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106142.202964 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpOw-000077-V6; Tue, 06 Apr 2021 17:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106142.202964; Tue, 06 Apr 2021 17:22:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpOw-00006z-Rx; Tue, 06 Apr 2021 17:22:06 +0000
Received: by outflank-mailman (input) for mailman id 106142;
 Tue, 06 Apr 2021 17:22:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpOw-00006u-7B
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:22:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpOw-0003U8-3Q
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:22:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpOw-0006ze-1z
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:22:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/vwm7/VH+CQhZYBS3qqExQqPCPuLCQwOYrjCnZpBnlg=; b=3K2fhFHLO3JOocCLkoz29PpE2p
	hYWnwxfzcD7z7ER6395fLuD7hvwsCQOkQL9G0iDKzkGZfl6D6/L3tyq3TXJir/mtiutXjmYGkxaeG
	bFJOZrGeVg0ggSH87H9FNcTyHV2cE3BmpFgJqVJlzUQ5W3Dmx9XJK3blycvXrwXYsK7g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] Intel Processor Trace Support: Add CHANGELOG.md and SUPPORT.md entries
Message-Id: <E1lTpOw-0006ze-1z@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 17:22:06 +0000

commit a4b346260cf2ca863d224c38c8ba8c0a4295f864
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Tue Mar 23 13:55:57 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    Intel Processor Trace Support: Add CHANGELOG.md and SUPPORT.md entries
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 SUPPORT.md   | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 30b53e73e8..2f5edf091e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Renesas IPMMU-VMSA (Supported, not security supported; was Tech Preview)
  - ARM SMMUv3 (Tech Preview)
  - Switched MSR accesses to deny by default policy.
+ - Intel Processor Trace support (Tech Preview)
 
 ### Removed / support downgraded
 
diff --git a/SUPPORT.md b/SUPPORT.md
index a1efd8fcfd..cd0c09e6a4 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -247,6 +247,13 @@ Export hypervisor coverage data suitable for analysis by gcov or lcov.
 
     Status: Supported, Not security supported
 
+### Processor trace support
+
+Support for using Intel Processor Trace technology to trace guests
+from dom0.
+
+    Status, x86: Tech Preview
+
 ## Memory Management
 
 ### Dynamic memory control
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 17:22:18 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 17:22:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106143.202968 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpP7-000087-0J; Tue, 06 Apr 2021 17:22:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106143.202968; Tue, 06 Apr 2021 17:22:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpP6-00007z-TU; Tue, 06 Apr 2021 17:22:16 +0000
Received: by outflank-mailman (input) for mailman id 106143;
 Tue, 06 Apr 2021 17:22:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpP6-00007s-8y
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:22:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpP6-0003UH-72
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:22:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpP6-00070K-5s
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:22:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Fu1FBiy7bZ5MZeKP27uEvYN1t9HJFUYHq7l4Y6jrLqU=; b=bW7BsMxXDasqFbBaGHg4FjfzOF
	sx1VAIWrepguBO+IlJf+e40PTVsuPk/5kqiN0GV1uCpo3q2TNBIc4qrV2PNclZtGDt5uV+sx6jY5K
	J7++2wwESa8dNT6EH4GJjbwd3lyrOPCN9FHJZ/Uou50Vkp5Q2SOkGYD5F+x1SZ/2zR8s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] CHANGELOG.md: Add named PCI devices
Message-Id: <E1lTpP6-00070K-5s@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 17:22:16 +0000

commit 6437cff8af0fd8d6670fd32b09c4e3d450b165e3
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Tue Mar 23 16:52:25 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    CHANGELOG.md: Add named PCI devices
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2f5edf091e..1d88a06527 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - ARM SMMUv3 (Tech Preview)
  - Switched MSR accesses to deny by default policy.
  - Intel Processor Trace support (Tech Preview)
+ - Named PCI devices for xl/libxl
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 17:22:28 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 17:22:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106144.202972 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpPI-00009Z-2C; Tue, 06 Apr 2021 17:22:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106144.202972; Tue, 06 Apr 2021 17:22:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpPH-00009R-VE; Tue, 06 Apr 2021 17:22:27 +0000
Received: by outflank-mailman (input) for mailman id 106144;
 Tue, 06 Apr 2021 17:22:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpPG-00009E-DO
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:22:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpPG-0003UO-CT
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:22:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpPG-00070y-9H
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:22: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=IGcomiLowF7z90MDUrot4yTwQSwbHHoSwU9XhzhvK8Y=; b=0eRBfL0SVoJfdSo0mMTdkhXXZ0
	b5iQKL9/0fwkDIMuOIYPQK+rvKI+miUV058VHGp9JKgMEoe/gOqsH6/m4y4TKRvp4AWfLVUQhtRsM
	qYRSazb6CGNACf7DcFppHVR+F/EdwDWpo4CNGrQRjOD77Sokrs+eO/O8AnZpMdeZBr+g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] CHANGELOG.md: Add dom0/domU zstd compression support
Message-Id: <E1lTpPG-00070y-9H@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 17:22:26 +0000

commit 049c1917fdea7aaaebdb449d769aaf625b1cfb6a
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Tue Mar 23 16:58:42 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    CHANGELOG.md: Add dom0/domU zstd compression support
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1d88a06527..9e9d49092a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Switched MSR accesses to deny by default policy.
  - Intel Processor Trace support (Tech Preview)
  - Named PCI devices for xl/libxl
+ - Support for zstd-compressed dom0 (x86) and domU kernels
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 17:22:38 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 17:22:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106145.202976 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpPS-0000BT-3M; Tue, 06 Apr 2021 17:22:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106145.202976; Tue, 06 Apr 2021 17:22:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpPS-0000BK-0R; Tue, 06 Apr 2021 17:22:38 +0000
Received: by outflank-mailman (input) for mailman id 106145;
 Tue, 06 Apr 2021 17:22: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 1lTpPQ-0000B8-Ho
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:22: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 1lTpPQ-0003UW-Fp
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:22:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpPQ-00071m-Eq
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:22: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=0j7wIwYsY+lTDbkVLH9JoR9ZpjUEpR5SR/nV0DEF8Nw=; b=DDFLG3Pej1fCJaoVKbL2rkMjC7
	IVzt5Klpnp22U1dmHqD2RAmFGFfWRzZMcv51nHD1nQwEQxl0B2SmGOnBCpqwI/QBC/GxBiKVHJJnf
	5ADxM2u5C3wB+2ootjx+L3rBI79+/aFdbIo4rUvBrqgkmmHMxemuCDMtuyzC/NKs4UVk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] CHANGELOG.md: NetBSD lib/gnttab support
Message-Id: <E1lTpPQ-00071m-Eq@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 17:22:36 +0000

commit 3c191adec260edda842b9d199432eb55573c0f5f
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Tue Mar 23 17:06:20 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    CHANGELOG.md: NetBSD lib/gnttab support
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9e9d49092a..e454248df9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Intel Processor Trace support (Tech Preview)
  - Named PCI devices for xl/libxl
  - Support for zstd-compressed dom0 (x86) and domU kernels
+ - Library improvements from NetBSD ports upstreamed
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 17:22:48 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 17:22:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106146.202980 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpPc-0000Ck-5K; Tue, 06 Apr 2021 17:22:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106146.202980; Tue, 06 Apr 2021 17:22: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 1lTpPc-0000Cd-2J; Tue, 06 Apr 2021 17:22:48 +0000
Received: by outflank-mailman (input) for mailman id 106146;
 Tue, 06 Apr 2021 17:22: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 1lTpPa-0000CT-K2
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:22: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 1lTpPa-0003Uw-J2
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:22:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpPa-00072Y-I7
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:22: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=4SSLVLS9b0RYsmp3RSdCeP1/pdMcEffwPcokLVHIKL4=; b=zvvX1HF/9P4S3hl6xrNVapAZ/c
	PXdX9H1lskZr7tBim9OXbVIJJyXTJ+hynNFWdbNLN6j4pOrA/bxIO5mIMhS+mdVGeeD1B3IDHVvWC
	NiYZXKI31rGGyyjU5Dgh8Qq+tJ6QyhTD4L523Dn3cW7QbkilxqksfNkDycumF7ha0JB4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] CHANGELOG.md: Add entries for CI loop
Message-Id: <E1lTpPa-00072Y-I7@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 17:22:46 +0000

commit 2c38f024ee82e629ba1a9e14e9dce1d21e6f2426
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Wed Mar 24 16:20:28 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    CHANGELOG.md: Add entries for CI loop
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e454248df9..6d093edc0e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Named PCI devices for xl/libxl
  - Support for zstd-compressed dom0 (x86) and domU kernels
  - Library improvements from NetBSD ports upstreamed
+ - CI loop: Add Alpine Linux, Ubuntu Focal targets; drop CentOS 6
+ - CI loop: Add qemu-based dom0 / domU test for ARM
+ - CI loop: Add dom0less aarch64 smoke test
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 17:22:58 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 17:22:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106147.202983 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpPm-0000Dy-6c; Tue, 06 Apr 2021 17:22:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106147.202983; Tue, 06 Apr 2021 17:22: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 1lTpPm-0000Dq-3t; Tue, 06 Apr 2021 17:22:58 +0000
Received: by outflank-mailman (input) for mailman id 106147;
 Tue, 06 Apr 2021 17:22: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 1lTpPk-0000Dg-NN
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:22: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 1lTpPk-0003Wc-MX
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:22:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpPk-00073Q-LS
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:22: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=mKoW06XS51ItpTF/2jWze7ng5AP8MNpQszqq2Ftmw38=; b=OPjqeZ1/wkG9CvW8TWmQl599TE
	f8ll/MmtygABe+mAeCId6aI/fVFCo9AUP2x5Kz5GK3RBtbdpkhMndGOtQTj7XHKjYSY8qbZhBdrQQ
	IO2ZYEppgEboyf/8BIaO5nJPwOwhHnX2/MUqd1v4nytGI3jGgjTbJjk2/7RHWlYEy32A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] CHANGELOG.md: Add entries for emulation
Message-Id: <E1lTpPk-00073Q-LS@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 17:22:56 +0000

commit e388292a93cb90b53f054b27e7c877c4ebdee5de
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Wed Mar 24 13:24:45 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    CHANGELOG.md: Add entries for emulation
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6d093edc0e..a1f1873940 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - CI loop: Add Alpine Linux, Ubuntu Focal targets; drop CentOS 6
  - CI loop: Add qemu-based dom0 / domU test for ARM
  - CI loop: Add dom0less aarch64 smoke test
+ - x86: Allow domains to use AVX-VNNI instructions
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 17:23:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 17:23:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106148.202988 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpPw-0000FD-8S; Tue, 06 Apr 2021 17:23:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106148.202988; Tue, 06 Apr 2021 17:23:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpPw-0000F5-5L; Tue, 06 Apr 2021 17:23:08 +0000
Received: by outflank-mailman (input) for mailman id 106148;
 Tue, 06 Apr 2021 17:23: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 1lTpPu-0000Ez-Rd
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:23: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 1lTpPu-0003X5-Q7
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:23:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpPu-00074Z-Oq
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:23: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=laFLTjg1TPZ+Sdctr0tgGYpvs7wTrdtar0mIPqX5FLw=; b=X09oWVMOgqw3uNBF/TjdEOdqkE
	0lgwvhuwm46+6CTNP4EzsFT2YAE67YaWS1x4h5RRtAiRENrhMEJcS12ikOADNo9jlX5aReA7cfJ0y
	OYHclmP1p+y2kx74A1H3uvsx9hvmOM0+/LCYYk6qI6w58zZ6c1udu5fwHjhnrOj7NlxA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] CHANGELOG.md: Make PV shim smaller by factoring out HVM-specific shadow code
Message-Id: <E1lTpPu-00074Z-Oq@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 17:23:06 +0000

commit 42249debeb9d08a3c014fd975546736430471198
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Wed Mar 24 17:24:31 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    CHANGELOG.md: Make PV shim smaller by factoring out HVM-specific shadow code
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a1f1873940..2046b43e3e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - CI loop: Add qemu-based dom0 / domU test for ARM
  - CI loop: Add dom0less aarch64 smoke test
  - x86: Allow domains to use AVX-VNNI instructions
+ - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 17:23:18 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 17:23:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106149.202992 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpQ6-0000GW-9w; Tue, 06 Apr 2021 17:23:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106149.202992; Tue, 06 Apr 2021 17:23:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpQ6-0000GO-70; Tue, 06 Apr 2021 17:23:18 +0000
Received: by outflank-mailman (input) for mailman id 106149;
 Tue, 06 Apr 2021 17:23: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 1lTpQ4-0000GG-UG
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:23: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 1lTpQ4-0003XD-TP
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:23:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpQ4-000761-SX
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:23: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=gH4A4qUAEsKrpAt6olXVe6JlHBYKuLZsYJTHe5FhznU=; b=UIsqV4K7Yk8qHZSd0Fq1NYKSp+
	N/BWkue42+uUDEWOTczit8lTx+b+1wO4OBcSu2jPeSBac3Jm8OSvKYViL7e74uFuPe/7bSLIFdPpp
	BvIJNYhxPL2rs3Xls8IsisXE61xYOz53W/j5dWBG1V7Xg3VVGGySDJlWtx82A4FSOec0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] CHANGELOG.md: Mention XEN_SCRIPT_DIR
Message-Id: <E1lTpQ4-000761-SX@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 17:23:16 +0000

commit a6a8cdde356979c259fa21ea36b11c14874d4060
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 13:51:48 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    CHANGELOG.md: Mention XEN_SCRIPT_DIR
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-acked-by: Ian Jackson <iwj@xenproject.org>
    ---
    
    CC: Olaf Hering <olaf@aepfle.de>
    CC: Ian Jackson <iwj@xenproject.org>
---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2046b43e3e..f17cfedae2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - CI loop: Add dom0less aarch64 smoke test
  - x86: Allow domains to use AVX-VNNI instructions
  - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
+ - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
+
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 17:23:28 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 17:23:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106150.202996 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpQG-0000Hy-Bi; Tue, 06 Apr 2021 17:23:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106150.202996; Tue, 06 Apr 2021 17:23:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpQG-0000Hn-8a; Tue, 06 Apr 2021 17:23:28 +0000
Received: by outflank-mailman (input) for mailman id 106150;
 Tue, 06 Apr 2021 17:23:27 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpQF-0000Hf-1Z
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:23:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpQF-0003XL-0Q
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:23:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpQE-00076y-Vq
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:23: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=1XZLY36hk9mWxAEWZg5os5fyX/ocGFvolY1IZcDtAC8=; b=YIdIxYKphcKcOpZsCpXhOgWjoI
	eZqyU/8SaEXtPlhfKgP54dvjA63MLJBA/Em6Ren41mCFheof097CiCOOqtEKqwY642DDHWY6Fv0Nh
	S/J/aZZc3y5GgZHn17yRl7jepsXI/KONTB4hG9HT28BLe+IzYJyvc3sri1r1aUaKkUzw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] CHANGELOG.md: xl PCI configuration doc, xenstore MTU entries
Message-Id: <E1lTpQE-00076y-Vq@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 17:23:26 +0000

commit ba0b0f7fcd2250a848fb5e91a6ca4dcef0c7c5a3
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 13:54:10 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    CHANGELOG.md: xl PCI configuration doc, xenstore MTU entries
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
    ---
    CC: Paul Durrant <paul@xen.org>
    CC: Ian Jackson <ian.jackson@citrix.com>
    CC: Wei Liu <wl@xen.org>
---
 CHANGELOG.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index f17cfedae2..3d39af0a07 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Switched MSR accesses to deny by default policy.
  - Intel Processor Trace support (Tech Preview)
  - Named PCI devices for xl/libxl
+ - Improved documentation for xl PCI configuration format
  - Support for zstd-compressed dom0 (x86) and domU kernels
  - Library improvements from NetBSD ports upstreamed
  - CI loop: Add Alpine Linux, Ubuntu Focal targets; drop CentOS 6
@@ -21,7 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - x86: Allow domains to use AVX-VNNI instructions
  - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
  - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
-
+ - xennet: Documented a way for the backend (or toolstack) to specify MTU to the frontend
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 17:23:38 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 17:23:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106151.203000 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpQQ-0000Jh-Db; Tue, 06 Apr 2021 17:23:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106151.203000; Tue, 06 Apr 2021 17:23:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpQQ-0000JZ-AI; Tue, 06 Apr 2021 17:23:38 +0000
Received: by outflank-mailman (input) for mailman id 106151;
 Tue, 06 Apr 2021 17:23:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpQP-0000JR-4I
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:23:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpQP-0003XY-3d
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:23:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpQP-000780-2j
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:23:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NOwnM11AdguavC1OdyUJdgw6xWYhW6lNPKvFaYGQFtc=; b=0TCg9M7wTnSL2eQy3xlqrF5JGx
	iVgkqZGntiJWJnp/siPOKR//79gTqwi1fHAMM4VaO5vrFgwN74NeH3AYx7h9NtuR+SrigNv9DgO2S
	NFpSLW4uXDPRGaYanspJ3HIJlevwRDsDxMpHkuj4BkGOoCk1aPnwSWb12X7wBj1CSEvQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] CHANGELOG.md: Some additional affordances in various xl subcommands
Message-Id: <E1lTpQP-000780-2j@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 17:23:37 +0000

commit c144ebec264359e36091982804240d5746266589
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:06:36 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    CHANGELOG.md: Some additional affordances in various xl subcommands
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
    ---
    CC: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3d39af0a07..1680c23ec1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
  - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
  - xennet: Documented a way for the backend (or toolstack) to specify MTU to the frontend
+ - Some additional affordances in various xl subcommands.
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 17:23:48 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 17:23:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106152.203004 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpQa-0000LS-G4; Tue, 06 Apr 2021 17:23:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106152.203004; Tue, 06 Apr 2021 17:23: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 1lTpQa-0000LF-D9; Tue, 06 Apr 2021 17:23:48 +0000
Received: by outflank-mailman (input) for mailman id 106152;
 Tue, 06 Apr 2021 17:23: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 1lTpQZ-0000L8-8l
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:23: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 1lTpQZ-0003Y0-7n
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:23:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpQZ-00079L-6M
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:23: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=+6c74/GZxVfWhN3TRB74l4DEdW4d6W/JxmxRVGJ/xRo=; b=b+NEHounCknPPwvrTOQvGLImkV
	fNj5hLtY3LVTmKaq/Xb7mJzLrBzZvWuE6ELRxxm16SsrgKrS/QoFuHKENCej2uijE2ewvNFhJ3URY
	XV8hpI8ijeENHZcEnCoj55rO49ThW9k9jNA+JC/aRfijdRXZPoFI+LinJgG8S/z4LlUE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] CHANGELOG.md: Mention various ARM errata
Message-Id: <E1lTpQZ-00079L-6M@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 17:23:47 +0000

commit 2af8e70d2818c56a2bf338d99372fc4c8762785a
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:08:04 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:20 2021 +0100

    CHANGELOG.md: Mention various ARM errata
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    ---
    v2:
     - Tweaked wording
    CC: Ian Jackson <ian.jackson@citrix.com>
    CC: Stefano Stabellini <sstabellini@kernel.org>
    CC: Julien Grall <julien@xen.org>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1680c23ec1..15562c2490 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
  - xennet: Documented a way for the backend (or toolstack) to specify MTU to the frontend
  - Some additional affordances in various xl subcommands.
+ - Added workarounds for the following ARM errata: Cortex A53 #843419, Cortex A55 #1530923, Cortex A72 #853709, Cortex A73 #858921, Cortex A76 #1286807, Neoverse-N1 #1165522
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 17:23:58 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 17:23:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106153.203008 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpQk-0000MZ-HW; Tue, 06 Apr 2021 17:23:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106153.203008; Tue, 06 Apr 2021 17:23: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 1lTpQk-0000MR-EZ; Tue, 06 Apr 2021 17:23:58 +0000
Received: by outflank-mailman (input) for mailman id 106153;
 Tue, 06 Apr 2021 17:23: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 1lTpQj-0000MK-D8
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:23: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 1lTpQj-0003YA-CN
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:23:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpQj-0007Ap-B7
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:23: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=AkW2gUpOVEwSdtZEFVLrPUw8nyJoGIw2NiFm4er7two=; b=yVOEK4hkul6fZpKpHoE3BNto9C
	zrM8W+ZmAQw2VKBkLw6MNJdN6TW6RN8PD1EbwVFKo2ozQBSTANbujIaXZdUk9Z8ftpCXAQkoodduK
	gyISlXx+gf9lybZRE15nzfpWNTGqAhXDGIAG2R84Xyqumyi4i5hgsHkFNyHISEFEW1p0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] CHANGELOG.md: Various new entries, mostly x86
Message-Id: <E1lTpQj-0007Ap-B7@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 17:23:57 +0000

commit 210c1f263177f8cc289e9e7794bf0a534c098f29
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:18:36 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:20 2021 +0100

    CHANGELOG.md: Various new entries, mostly x86
    
    ...Grouped mostly by submitter / maintainer
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    ---
    CC: Ian Jackson <ian.jackson@citrix.com>
    CC: Andrew Cooper <andrew.cooper3@citrix.com>
    CC: Jan Beulich <jbeulich@suse.com>
    CC: Roger Pau Monne <roger.pau@citrix.com>
---
 CHANGELOG.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 15562c2490..106f3f45c1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Named PCI devices for xl/libxl
  - Improved documentation for xl PCI configuration format
  - Support for zstd-compressed dom0 (x86) and domU kernels
+ - EFI: Enable booting unified hypervisor/kernel/initrd/DT images
+ - Reduce ACPI verbosity by default
+ - Add ucode=allow-same option to test late microcode loading path
  - Library improvements from NetBSD ports upstreamed
  - CI loop: Add Alpine Linux, Ubuntu Focal targets; drop CentOS 6
  - CI loop: Add qemu-based dom0 / domU test for ARM
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 17:24:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 17:24:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106154.203012 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpQu-0000Nu-J4; Tue, 06 Apr 2021 17:24:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106154.203012; Tue, 06 Apr 2021 17:24: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 1lTpQu-0000Nm-G4; Tue, 06 Apr 2021 17:24:08 +0000
Received: by outflank-mailman (input) for mailman id 106154;
 Tue, 06 Apr 2021 17:24: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 1lTpQt-0000Nb-Gx
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:24: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 1lTpQt-0003YV-GD
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:24:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpQt-0007Bs-Et
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:24: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=4h6S9bi7FylRfRdej/cQrR9Dd+y7ATs1luZ56R9sGBg=; b=XFgGaELvAdwKvVc042RWjfO8Nd
	LZucnGA/KQvPcpY99n9MmV7yxqCZCy4YtEa43I/GCnGgnObsSDFW8Y3A19z6Bc/Kbfa1deUgxS+/8
	TJhOa6zzGsUM0GgjkVINnufbJezif2XPLk2s0tmwEURRoB9RYPvXziF2BiZvd75/+vGA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] CHANGELOG.md: Various entries, mostly xenstore
Message-Id: <E1lTpQt-0007Bs-Et@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 17:24:07 +0000

commit 2f8436bb41104e7f4ec867a1e758ba90fa53be0f
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:30:55 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:20 2021 +0100

    CHANGELOG.md: Various entries, mostly xenstore
    
    ...grouped by submitters / maintainers
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    ---
    CC: Juergen Gross <jgross@suse.com>
    CC: Jan Beulich <jbeulich@suse.com>
    CC: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 106f3f45c1..57b06e8cb8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,8 +26,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
  - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
  - xennet: Documented a way for the backend (or toolstack) to specify MTU to the frontend
+ - xenstore can now be live-updated on a running system. (Tech preview)
  - Some additional affordances in various xl subcommands.
  - Added workarounds for the following ARM errata: Cortex A53 #843419, Cortex A55 #1530923, Cortex A72 #853709, Cortex A73 #858921, Cortex A76 #1286807, Neoverse-N1 #1165522
+ - On detecting a host crash, some debug key handlers can automatically triggered to aid in debugging
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 17:24:19 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 17:24:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106155.203016 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpR5-0000PF-Kd; Tue, 06 Apr 2021 17:24:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106155.203016; Tue, 06 Apr 2021 17:24:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpR5-0000P7-Hd; Tue, 06 Apr 2021 17:24:19 +0000
Received: by outflank-mailman (input) for mailman id 106155;
 Tue, 06 Apr 2021 17:24: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 1lTpR3-0000Ox-KQ
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:24: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 1lTpR3-0003Yc-Ji
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:24:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpR3-0007Cc-Ip
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:24: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=A3QQhkA71GrHe0TBIZmqVhdXDOGFjRjvH59IrOQHZmE=; b=kcfwOKg47TMnrq9IUTSZ6Qksnx
	xU6wmaP9qeNVejEtY6diFs1AM3w6TO9rCbjpckXTOHXcvovXq04K0Ns+9joj6NN1IS7DFerNywlWK
	ZmVZH0XAjIuxSlDmGMn0eX8L9ICS+tO72gvi+vXh6zNN7iFrHXws33pCNQOlBP0EJx4o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] CHANGELOG.md: irq-max-guests
Message-Id: <E1lTpR3-0007Cc-Ip@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 17:24:17 +0000

commit 29bb238417fb114feb26d9234f58a375448379a2
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:34:04 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:20 2021 +0100

    CHANGELOG.md: irq-max-guests
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    ---
    CC: Igor Druzhinin <igor.druzhinin@citrix.com>
    CC: Jan Beulich <jbeulich@suse.com>
    CC: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 57b06e8cb8..a9589aacc9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Some additional affordances in various xl subcommands.
  - Added workarounds for the following ARM errata: Cortex A53 #843419, Cortex A55 #1530923, Cortex A72 #853709, Cortex A73 #858921, Cortex A76 #1286807, Neoverse-N1 #1165522
  - On detecting a host crash, some debug key handlers can automatically triggered to aid in debugging
+ - Increase the maximum number of guests which can share a single IRQ from 7 to 16, and make this configurable with irq-max-guests
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 17:24:29 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 17:24:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106156.203020 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpRF-0000Rk-M9; Tue, 06 Apr 2021 17:24:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106156.203020; Tue, 06 Apr 2021 17:24:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpRF-0000Rc-J8; Tue, 06 Apr 2021 17:24:29 +0000
Received: by outflank-mailman (input) for mailman id 106156;
 Tue, 06 Apr 2021 17:24: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 1lTpRD-0000RS-Nh
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:24: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 1lTpRD-0003Yk-Mw
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:24:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpRD-0007DV-M4
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:24: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=c/bx2JQiifCDb8MTuDeJ4srauNX0HRQqQP7JO+Z3Bg8=; b=mlDbRJcSisP6vnGT8FPeIZnrP2
	T6aSIqRPh+m7bAGA2PokOeeI0tToDK2QurvdYMzFyr9hPEau+kMEjJ8gxnYy8C+zaYu+loCSrqqDp
	FXZ5W4W9ifH2lomA9bwL6iTtMYVSSfcrl5dex0NwFLm5wsJlm7WMAxdQL7MP7BZbw+zA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] Prep for release: Pin minios and both qemu versions to tags
Message-Id: <E1lTpRD-0007DV-M4@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 17:24:27 +0000

commit 1d471499cae71c27747ff9681600a66d79479998
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Apr 6 18:09:32 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Apr 6 18:09:32 2021 +0100

    Prep for release: Pin minios and both qemu versions to tags
    
    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 a56a971028..2ff1ed2ce3 100644
--- a/Config.mk
+++ b/Config.mk
@@ -245,15 +245,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= a3741780fe3535e19e02efa869a7cac481891129
-QEMU_UPSTREAM_REVISION ?= 7ea428895af2840d85c524f0bd11a38aac308308
-MINIOS_UPSTREAM_REVISION ?= 051b87bb9c19609976fb038f386920e1ce5454c5
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.15.0
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.15.0
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= xen-4.15.0-rc1
+QEMU_TRADITIONAL_REVISION ?= xen-4.15.0
 # Wed Jul 15 10:01:40 2020 +0100
 # qemu-trad: remove Xen path dependencies
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 17:24:39 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 17:24:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106157.203025 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpRP-0000TI-Ns; Tue, 06 Apr 2021 17:24:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106157.203025; Tue, 06 Apr 2021 17:24:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpRP-0000T6-KZ; Tue, 06 Apr 2021 17:24:39 +0000
Received: by outflank-mailman (input) for mailman id 106157;
 Tue, 06 Apr 2021 17:24: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 1lTpRN-0000Ss-RZ
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:24: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 1lTpRN-0003Yq-Q1
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:24:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpRN-0007EB-PD
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:24: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=WvgKdApnAS0EyG8PC3Hh8TKW/1qsbBLwNFtw6ybcdNg=; b=zMCFF0UgzEmFOQIqIDjnZAQXhr
	HlH3+yPal2v+efhtqBdUiNetzdRlQ/e4o1gRBvMcsqKu5eFYlOY6f7VPMfJ+kiXIVx4Ki1qGGQGWQ
	t6ZMXb1zxsf6pCSc6KJ1Z/5LfApeHvIyq0dZ8QrYIa/CQ0F6CeZIQt5rjH9i0NL7M1FA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] SUPPORT.md: Specify support lifetime etc. for Xen 4.15
Message-Id: <E1lTpRN-0007EB-PD@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 17:24:37 +0000

commit 03db1efd02872015d26737132b3d41c4650dac95
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Mon Mar 29 15:23:42 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Apr 6 18:11:18 2021 +0100

    SUPPORT.md: Specify support lifetime etc. for Xen 4.15
    
    CC: committers@xenproject.org
    CC: security@xenproject.org
    CC: community.manager@xenproject.org
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 SUPPORT.md | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index cd0c09e6a4..d89af5abc8 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -9,13 +9,13 @@ for the definitions of the support status levels etc.
 
 # Release Support
 
-    Xen-Version: 4.15-rc
-    Initial-Release: n/a
-    Supported-Until: TBD
-    Security-Support-Until: Unreleased - not yet security-supported
+    Xen-Version: 4.15
+    Initial-Release: 2021-04-08
+    Supported-Until: 2022-10-08
+    Security-Support-Until: 2024-04-08
 
 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.15_Release_Notes">RN</a>
 
 # Feature Support
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 17:24:49 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 17:24:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106158.203029 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpRZ-0000Uk-PA; Tue, 06 Apr 2021 17:24:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106158.203029; Tue, 06 Apr 2021 17:24:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTpRZ-0000Ub-Lu; Tue, 06 Apr 2021 17:24:49 +0000
Received: by outflank-mailman (input) for mailman id 106158;
 Tue, 06 Apr 2021 17:24: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 1lTpRX-0000UP-Tp
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:24: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 1lTpRX-0003ZG-T3
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:24:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTpRX-0007Eo-SJ
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 17:24: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=23QMvcrEYQp9+zm9bv6sH+G8+q3pTGgCURh/Y+vV+uM=; b=S8imxjy4y2StGHTpmVMI88CDv0
	53KvYNYoYU1IrZcdPuEV1dV3y+W3lKzzjSK7z0hGJgznFbhLkHsTLfYZnNu9DB1MA4mp9SljvJpXS
	P83Xi7H4CaReqkDtJQ1Qn1dDRvSNgi63Q9Uv/iO4+tPe0zLnLQtILNm5WIs9cP2x6eEo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] README, Makefile: Prep for release
Message-Id: <E1lTpRX-0007Eo-SJ@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 17:24:47 +0000

commit e25aa9939ae0cd8317605be3d5c5611b76bc4ab4
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Apr 6 18:14:18 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Apr 6 18:14:18 2021 +0100

    README, Makefile: Prep for release
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 README       | 16 ++++++++--------
 xen/Makefile |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/README b/README
index aa8b4fe126..de579080d7 100644
--- a/README
+++ b/README
@@ -1,11 +1,11 @@
-#################################
- _  _    _ ____
-| || |  / | ___|       _ __ ___
-| || |_ | |___ \ _____| '__/ __|
-|__   _|| |___) |_____| | | (__
-   |_|(_)_|____/      |_|  \___|
-
-#################################
+##################################
+__  __            _  _    _ ____
+\ \/ /___ _ __   | || |  / | ___|
+ \  // _ \ '_ \  | || |_ | |___ \
+ /  \  __/ | | | |__   _|| |___) |
+/_/\_\___|_| |_|    |_|(_)_|____/
+
+##################################
 
 https://www.xen.org/
 
diff --git a/xen/Makefile b/xen/Makefile
index 0b97e459e2..acb2d28891 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 15
-export XEN_EXTRAVERSION ?= .0-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.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 18:33:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 18:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106226.203173 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTqVe-0007iD-Pw; Tue, 06 Apr 2021 18:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106226.203173; Tue, 06 Apr 2021 18:33:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTqVe-0007i5-Mx; Tue, 06 Apr 2021 18:33:06 +0000
Received: by outflank-mailman (input) for mailman id 106226;
 Tue, 06 Apr 2021 18:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTqVd-0007hy-4t
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 18:33:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTqVd-0004oq-40
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 18:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTqVd-0004sO-20
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 18:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qlt8kJLKurUGVFAWMG8Ekq9XACZA61vj5KPoBgw0FCo=; b=WD+ZzGdleKRbpZ1t12yDK59BJE
	u+3eqYmilWQRI831PABitde9wVp/obN3eNEBfqJKsZM7MCKyf2puEYCnaeQO9EyO1gRoXhfbtGNM/
	U4Mktay2/V4IghCch78oIfs7yjmnveWSJ07RumMBniyylonKPJ9uc/wYWLCmf37P6HSc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/gunzip: Allow perform_gunzip() to be called multiple times
Message-Id: <E1lTqVd-0004sO-20@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 18:33:05 +0000

commit 33bc2a8495f755510f63629ed3f011134416310c
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed Mar 3 19:27:56 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 6 19:30:33 2021 +0100

    xen/gunzip: Allow perform_gunzip() to be called multiple times
    
    Currently perform_gunzip() can only be called once because the
    the internal state (e.g allocate) is not fully re-initialized.
    
    This works fine if you are only booting dom0. But this will break when
    booting multiple using the dom0less that uses compressed kernel images.
    
    This can be resolved by re-initializing bytes_out, malloc_ptr,
    malloc_count every time perform_gunzip() is called.
    
    Note the latter is only re-initialized for hardening purpose as there is
    no guarantee that every malloc() are followed by free() (It should in
    theory!).
    
    Take the opportunity to check the return of alloc_heap_pages() to return
    an error rather than dereferencing a NULL pointer later on failure.
    
    Reported-by: Charles Chiou <cchiou@ambarella.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/gunzip.c  | 5 +++++
 xen/common/inflate.c | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/xen/common/gunzip.c b/xen/common/gunzip.c
index db4efcd34b..425d64e904 100644
--- a/xen/common/gunzip.c
+++ b/xen/common/gunzip.c
@@ -114,11 +114,16 @@ __init int perform_gunzip(char *output, char *image, unsigned long image_len)
     window = (unsigned char *)output;
 
     free_mem_ptr = (unsigned long)alloc_xenheap_pages(HEAPORDER, 0);
+    if ( !free_mem_ptr )
+        return -ENOMEM;
+
     free_mem_end_ptr = free_mem_ptr + (PAGE_SIZE << HEAPORDER);
+    init_allocator();
 
     inbuf = (unsigned char *)image;
     insize = image_len;
     inptr = 0;
+    bytes_out = 0;
 
     makecrc();
 
diff --git a/xen/common/inflate.c b/xen/common/inflate.c
index f99c985d61..d8c28a3e95 100644
--- a/xen/common/inflate.c
+++ b/xen/common/inflate.c
@@ -238,6 +238,12 @@ STATIC const ush mask_bits[] = {
 static unsigned long INITDATA malloc_ptr;
 static int INITDATA malloc_count;
 
+static void init_allocator(void)
+{
+    malloc_ptr = free_mem_ptr;
+    malloc_count = 0;
+}
+
 static void *INIT malloc(int size)
 {
     void *p;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 19:11:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 19:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106251.203213 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTr6Q-00033T-Cr; Tue, 06 Apr 2021 19:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106251.203213; Tue, 06 Apr 2021 19:11:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTr6Q-00033L-A1; Tue, 06 Apr 2021 19:11:06 +0000
Received: by outflank-mailman (input) for mailman id 106251;
 Tue, 06 Apr 2021 19:11:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTr6P-00033F-3Q
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 19:11:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTr6P-0005R0-2c
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 19:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTr6P-0008Mb-1F
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 19:11:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tO9F2KrqZ87rCR91r5ZE21xSpBNZF5hlEVu7Gw6/Yl8=; b=FQcmfX5TiG1RYHv1ZVZHHdbPF2
	xnu6xEK2fe3OEIoW8eKoexLH6gmcTIM7ZBK5AD+qndfbNDysY1DxXfRt3yyUaY093sHEX7NarYolr
	a77da8mFubDzxdt1gTRV8DPAaX4ZrLCK5CBBQJ2nvQp3Gsj3q4SI6ROX2BRUIcmuWFDY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: Constify the second parameter of rangeset_new()
Message-Id: <E1lTr6P-0008Mb-1F@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 19:11:05 +0000

commit 91df35e32b0c624df4b326329336df770844d932
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Apr 6 19:03:49 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 6 20:03:10 2021 +0100

    xen: Constify the second parameter of rangeset_new()
    
    The string 'name' will never get modified by the function, so mark it
    as const.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/rangeset.c      | 2 +-
 xen/include/xen/rangeset.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/rangeset.c b/xen/common/rangeset.c
index 0afe638f40..885b6b15c2 100644
--- a/xen/common/rangeset.c
+++ b/xen/common/rangeset.c
@@ -421,7 +421,7 @@ bool_t rangeset_is_empty(
 }
 
 struct rangeset *rangeset_new(
-    struct domain *d, char *name, unsigned int flags)
+    struct domain *d, const char *name, unsigned int flags)
 {
     struct rangeset *r;
 
diff --git a/xen/include/xen/rangeset.h b/xen/include/xen/rangeset.h
index 5f62a97971..135f33f606 100644
--- a/xen/include/xen/rangeset.h
+++ b/xen/include/xen/rangeset.h
@@ -36,7 +36,7 @@ void rangeset_domain_destroy(
  * rangeset_destroy(r).
  */
 struct rangeset *rangeset_new(
-    struct domain *d, char *name, unsigned int flags);
+    struct domain *d, const char *name, unsigned int flags);
 void rangeset_destroy(
     struct rangeset *r);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 19:11:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 19:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106252.203217 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTr6a-00034m-Fa; Tue, 06 Apr 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 106252.203217; Tue, 06 Apr 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 1lTr6a-00034e-Ci; Tue, 06 Apr 2021 19:11:16 +0000
Received: by outflank-mailman (input) for mailman id 106252;
 Tue, 06 Apr 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 1lTr6Z-00034V-7d
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 19:11:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTr6Z-0005R9-5c
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 19:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTr6Z-0008NF-4j
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 19:11:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JyXHTx6Uklwcw1NblxdPjqbGgoiDBc/OQIogelMhkf4=; b=wFujbjBZ3w09OtrUaE+dOIe3nl
	QbBYPZtO5Toirgs+Z9nsx4c2ayQwK129WXhjb7ztvnyRnIAT1f8wsSV3GUmE9NUoi8oulPITy/6SW
	x483CFIYxPgYIY6jv8e5tL7ID5lWgICOgIsc0SLIwfsZlVKtJwhg1ugNtOvK7TFN2DpU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/sched: Constify name and opt_name in struct scheduler
Message-Id: <E1lTr6Z-0008NF-4j@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 19:11:15 +0000

commit 1f0358093c101b170f7516779b70d3c8e11965ef
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Apr 6 19:34:08 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 6 20:03:10 2021 +0100

    xen/sched: Constify name and opt_name in struct scheduler
    
    Both name and opt_name are pointing to literal string. So mark both of
    the fields as const.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
---
 xen/common/sched/private.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/sched/private.h b/xen/common/sched/private.h
index 92d0d49610..a870320146 100644
--- a/xen/common/sched/private.h
+++ b/xen/common/sched/private.h
@@ -272,8 +272,8 @@ static inline spinlock_t *pcpu_schedule_trylock(unsigned int cpu)
 }
 
 struct scheduler {
-    char *name;             /* full name for this scheduler      */
-    char *opt_name;         /* option name for this scheduler    */
+    const char *name;       /* full name for this scheduler      */
+    const char *opt_name;   /* option name for this scheduler    */
     unsigned int sched_id;  /* ID for this scheduler             */
     void *sched_data;       /* global data pointer               */
     struct cpupool *cpupool;/* points to this scheduler's pool   */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 19:11:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 19:11:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106253.203221 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTr6k-00036J-HS; Tue, 06 Apr 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 106253.203221; Tue, 06 Apr 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 1lTr6k-00036C-EW; Tue, 06 Apr 2021 19:11:26 +0000
Received: by outflank-mailman (input) for mailman id 106253;
 Tue, 06 Apr 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 1lTr6j-00035z-A6
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 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 1lTr6j-0005RJ-8t
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 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 1lTr6j-0008OQ-83
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 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=L77w2LuSrXgcLz1ebrIKgPdg1BxMa+5zS7882qhMGJI=; b=OLxazkz8EmMidHibPbIe8DMdHh
	n8VLoP46T39k9MmPBRH0QiyzMbc2jYJYmPaZ8cPA56Q/22TfHsa6W7F0xFWNxx3/qbwGDjVlGjgO9
	ASIVy0Lo4CtHICJPcjcSy/GfEoTrePTQvdSvQ5jTG094cGbG36dQf1HasNuqtKqjCMxc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/x86: shadow: The return type of sh_audit_flags() should be const
Message-Id: <E1lTr6j-0008OQ-83@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 19:11:25 +0000

commit 8b9a78269d2c819194fcc6843d6da64cab5e0ca4
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Apr 6 19:58:05 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 6 20:03:10 2021 +0100

    xen/x86: shadow: The return type of sh_audit_flags() should be const
    
    The function sh_audit_flags() is returning pointer to literal strings.
    They should not be modified, so the return is now const and this is
    propagated to the callers.
    
    Take the opportunity to fix the coding style in the declaration of
    sh_audit_flags.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/multi.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 9b43cb116c..0342de81d2 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -4290,8 +4290,8 @@ static void sh_pagetable_dying(paddr_t gpa)
     done = 1;                                                           \
 } while (0)
 
-static char * sh_audit_flags(struct vcpu *v, int level,
-                              int gflags, int sflags)
+static const char *sh_audit_flags(struct vcpu *v, int level,
+                                  int gflags, int sflags)
 /* Common code for auditing flag bits */
 {
     if ( (sflags & _PAGE_PRESENT) && !(gflags & _PAGE_PRESENT) )
@@ -4324,7 +4324,7 @@ int sh_audit_l1_table(struct vcpu *v, mfn_t sl1mfn, mfn_t x)
     mfn_t mfn, gmfn, gl1mfn;
     gfn_t gfn;
     p2m_type_t p2mt;
-    char *s;
+    const char *s;
     int done = 0;
 
     /* Follow the backpointer */
@@ -4419,7 +4419,7 @@ int sh_audit_l2_table(struct vcpu *v, mfn_t sl2mfn, mfn_t x)
     mfn_t mfn, gmfn, gl2mfn;
     gfn_t gfn;
     p2m_type_t p2mt;
-    char *s;
+    const char *s;
     int done = 0;
 
     /* Follow the backpointer */
@@ -4471,7 +4471,7 @@ int sh_audit_l3_table(struct vcpu *v, mfn_t sl3mfn, mfn_t x)
     mfn_t mfn, gmfn, gl3mfn;
     gfn_t gfn;
     p2m_type_t p2mt;
-    char *s;
+    const char *s;
     int done = 0;
 
     /* Follow the backpointer */
@@ -4521,7 +4521,7 @@ int sh_audit_l4_table(struct vcpu *v, mfn_t sl4mfn, mfn_t x)
     mfn_t mfn, gmfn, gl4mfn;
     gfn_t gfn;
     p2m_type_t p2mt;
-    char *s;
+    const char *s;
     int done = 0;
 
     /* Follow the backpointer */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 19:11:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 19:11:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106254.203225 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTr6u-00037y-J0; Tue, 06 Apr 2021 19:11:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106254.203225; Tue, 06 Apr 2021 19:11:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTr6u-00037q-G7; Tue, 06 Apr 2021 19:11:36 +0000
Received: by outflank-mailman (input) for mailman id 106254;
 Tue, 06 Apr 2021 19:11:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTr6t-00037k-D8
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 19:11:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTr6t-0005RR-CP
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 19:11:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTr6t-0008Pk-BO
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 19:11:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=h0tgsabiQeGySqm7O2jzgQWKEkPixorDEptiTRPrwtc=; b=xwD8C5YW07OJNQTdFrQFlcdsol
	1+EtQtmc3e+o6LzcprVy/YmYnul0yTxvsl+Ac/GXJ24PagECWKuP2E7rWNIk1LboKYsFb4WiPuZkU
	dmhRm5uW8nLNu+1pVWjpnqB/BamhHkE0K3OXBF2SSnUi4XynBteV2nIdHVTO3kXVTIsw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/kdd: Use const whenever we point to literal strings
Message-Id: <E1lTr6t-0008Pk-BO@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 19:11:35 +0000

commit 922dcbab0b465f9da006b31da1a61e93734a080e
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Apr 6 19:59:25 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 6 20:03:10 2021 +0100

    tools/kdd: Use const whenever we point to literal strings
    
    literal strings are not meant to be modified. So we should use const
    char * rather than char * when we want to shore a pointer to them.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 tools/debugger/kdd/kdd.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c
index a7d0976ea4..17513c2650 100644
--- a/tools/debugger/kdd/kdd.c
+++ b/tools/debugger/kdd/kdd.c
@@ -67,7 +67,7 @@ typedef struct {
     uint32_t build;             
     int w64;
     int mp;
-    char *name;
+    const char *name;
     uint64_t base;              /* KernBase: start looking here */
     uint32_t range;             /* |         and search an area this size */
     uint32_t version;           /* +-> NtBuildNumber */
@@ -237,7 +237,7 @@ static size_t blocking_write(int fd, const void *buf, size_t count)
 }
 
 /* Dump the contents of a complete serial packet into a log file. */
-static void kdd_log_pkt(kdd_state *s, char *name, kdd_pkt *p)
+static void kdd_log_pkt(kdd_state *s, const char *name, kdd_pkt *p)
 {
     uint32_t sum = 0;
     unsigned int i, j;
@@ -504,8 +504,8 @@ static int check_os(kdd_state *s)
  * @return -1 on failure to find the section name
  * @return 0 on success
  */
-static int get_pe64_sections(kdd_state *s, uint64_t filebase, char *sectname,
-        uint64_t *vaddr, uint32_t *vsize)
+static int get_pe64_sections(kdd_state *s, uint64_t filebase,
+        const char *sectname, uint64_t *vaddr, uint32_t *vsize)
 {
     uint64_t pe_hdr = 0;
     uint64_t sect_start = 0;
@@ -781,7 +781,7 @@ static void kdd_send_cmd(kdd_state *s, uint32_t subtype, size_t extra)
 }
 
 /* Cause the client to print a string */
-static void kdd_send_string(kdd_state *s, char *fmt, ...)
+static void kdd_send_string(kdd_state *s, const char *fmt, ...)
 {
     uint32_t len = 0xffff - sizeof (kdd_msg);
     char *buf = (char *) s->txb + sizeof (kdd_hdr) + sizeof (kdd_msg);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 19:11:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 19:11:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106255.203229 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTr74-00039B-KV; Tue, 06 Apr 2021 19:11:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106255.203229; Tue, 06 Apr 2021 19:11: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 1lTr74-000393-Hc; Tue, 06 Apr 2021 19:11:46 +0000
Received: by outflank-mailman (input) for mailman id 106255;
 Tue, 06 Apr 2021 19:11:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTr73-00038r-Gc
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 19:11:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTr73-0005Rs-Fq
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 19:11:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTr73-0008Qm-F1
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 19:11:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rFiE4exispuHDk1KuLG0GuK7/GXg4vPwen+rAktWOi4=; b=LvUizwl3KCp/6h8+O+pyV9EGqn
	1m5jr6Q8usJjMH+jE8XqbgRZn/bC0mG73RyLPHipAVu22OHCZv3XYxRH5edtR07j++TZXrCpburAk
	RsQVhG0oH1lKqURBclm1olJvgEDiyay9wF4P8yCWwUQitADm2pOrB1enPtcHgebzxpz8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xentrace: Use const whenever we point to literal strings
Message-Id: <E1lTr73-0008Qm-F1@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 19:11:45 +0000

commit 51207a2999bc69531412acc6010e2c4fbfbaf7fc
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Apr 6 20:00:25 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 6 20:03:10 2021 +0100

    tools/xentrace: Use const whenever we point to literal strings
    
    literal strings are not meant to be modified. So we should use const
    char * rather than char * when we want to store a pointer to them.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
---
 tools/xentrace/xenalyze.c | 71 ++++++++++++++++++++++++-----------------------
 tools/xentrace/xenctx.c   |  4 +--
 2 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c
index b7f4e2bea8..5de167031e 100644
--- a/tools/xentrace/xenalyze.c
+++ b/tools/xentrace/xenalyze.c
@@ -356,7 +356,7 @@ void parse_symbol_file(char *fn) {
 char * find_symbol(unsigned long long addr) {
     struct symbol_struct * p=G.symbols;
     int i;
-    char * lastname="ZERO";
+    const char * lastname="ZERO";
     unsigned long long offset=addr;
     static char name[144];
 
@@ -495,7 +495,7 @@ struct {
 
 #define HVM_VMX_EXIT_REASON_MAX (EXIT_REASON_XSETBV+1)
 
-char * hvm_vmx_exit_reason_name[HVM_VMX_EXIT_REASON_MAX] = {
+const char * hvm_vmx_exit_reason_name[HVM_VMX_EXIT_REASON_MAX] = {
     [EXIT_REASON_EXCEPTION_NMI]="EXCEPTION_NMI",
     [EXIT_REASON_EXTERNAL_INTERRUPT]="EXTERNAL_INTERRUPT",
     [EXIT_REASON_TRIPLE_FAULT]="TRIPLE_FAULT",
@@ -698,7 +698,7 @@ enum VMEXIT_EXITCODE
 };
 
 #define HVM_SVM_EXIT_REASON_MAX 1025
-char * hvm_svm_exit_reason_name[HVM_SVM_EXIT_REASON_MAX] = {
+const char * hvm_svm_exit_reason_name[HVM_SVM_EXIT_REASON_MAX] = {
     /* 0-15 */
     "VMEXIT_CR0_READ",
     "VMEXIT_CR1_READ",
@@ -875,7 +875,7 @@ char * hvm_svm_exit_reason_name[HVM_SVM_EXIT_REASON_MAX] = {
 #define EXTERNAL_INTERRUPT_MAX 256
 
 /* Stringify numbers */
-char * hvm_extint_vector_name[EXTERNAL_INTERRUPT_MAX] = {
+const char * hvm_extint_vector_name[EXTERNAL_INTERRUPT_MAX] = {
     [SPURIOUS_APIC_VECTOR] = "SPURIOS_APIC",
     [ERROR_APIC_VECTOR] =    "ERROR_APIC",
     [INVALIDATE_TLB_VECTOR]= "INVALIDATE_TLB",
@@ -887,7 +887,7 @@ char * hvm_extint_vector_name[EXTERNAL_INTERRUPT_MAX] = {
 
 #define HVM_TRAP_MAX 20
 
-char * hvm_trap_name[HVM_TRAP_MAX] = {
+const char * hvm_trap_name[HVM_TRAP_MAX] = {
     [0] =  "Divide",
     [1] =  "RESERVED",
     [2] =  "NMI",
@@ -947,7 +947,7 @@ enum {
     HVM_EVENT_VLAPIC,
     HVM_EVENT_HANDLER_MAX
 };
-char * hvm_event_handler_name[HVM_EVENT_HANDLER_MAX] = {
+const char * hvm_event_handler_name[HVM_EVENT_HANDLER_MAX] = {
     "(no handler)",
     "pf_xen",
     "pf_inject",
@@ -1001,7 +1001,7 @@ enum {
     GUEST_INTERRUPT_CASE_MAX,
 };
 
-char *guest_interrupt_case_name[] = {
+const char *guest_interrupt_case_name[] = {
     [GUEST_INTERRUPT_CASE_WAKE_TO_HALT_ALONE]="wake to halt alone",
     /* This interrupt woke, maybe another interrupt before halt */
     [GUEST_INTERRUPT_CASE_WAKE_TO_HALT_ANY]  ="wake to halt any  ",
@@ -1009,7 +1009,7 @@ char *guest_interrupt_case_name[] = {
     [GUEST_INTERRUPT_CASE_INTERRUPT_TO_HALT] ="intr to halt      ",
 };
 
-char *hvm_vol_name[HVM_VOL_MAX] = {
+const char *hvm_vol_name[HVM_VOL_MAX] = {
     [HVM_VOL_VMENTRY]="vmentry",
     [HVM_VOL_VMEXIT] ="vmexit",
     [HVM_VOL_HANDLER]="handler",
@@ -1056,7 +1056,7 @@ enum {
     HYPERCALL_MAX
 };
 
-char *hypercall_name[HYPERCALL_MAX] = {
+const char *hypercall_name[HYPERCALL_MAX] = {
     [HYPERCALL_set_trap_table]="set_trap_table",
     [HYPERCALL_mmu_update]="mmu_update",
     [HYPERCALL_set_gdt]="set_gdt",
@@ -1114,7 +1114,7 @@ enum {
     PF_XEN_EMUL_MAX,
 };
 
-char * pf_xen_emul_name[PF_XEN_EMUL_MAX] = {
+const char * pf_xen_emul_name[PF_XEN_EMUL_MAX] = {
     [PF_XEN_EMUL_LVL_0]="non-linmap",
     [PF_XEN_EMUL_LVL_1]="linmap l1",
     [PF_XEN_EMUL_LVL_2]="linmap l2",
@@ -1140,7 +1140,7 @@ enum {
     PF_XEN_NON_EMUL_MAX,
 };
 
-char * pf_xen_non_emul_name[PF_XEN_NON_EMUL_MAX] = {
+const char * pf_xen_non_emul_name[PF_XEN_NON_EMUL_MAX] = {
     [PF_XEN_NON_EMUL_VA_USER]="va user",
     [PF_XEN_NON_EMUL_VA_KERNEL]="va kernel",
     [PF_XEN_NON_EMUL_EIP_USER]="eip user",
@@ -1160,7 +1160,7 @@ enum {
     PF_XEN_FIXUP_MAX,
 };
 
-char * pf_xen_fixup_name[PF_XEN_FIXUP_MAX] = {
+const char * pf_xen_fixup_name[PF_XEN_FIXUP_MAX] = {
     [PF_XEN_FIXUP_PREALLOC_UNPIN] = "unpin",
     [PF_XEN_FIXUP_PREALLOC_UNHOOK] = "unhook",
     [PF_XEN_FIXUP_UNSYNC] = "unsync",
@@ -1195,7 +1195,7 @@ enum {
 #define SHADOW_RESYNC_FULL    14
 #define SHADOW_RESYNC_ONLY    15
 
-char * pf_xen_name[PF_XEN_MAX] = {
+const char * pf_xen_name[PF_XEN_MAX] = {
     [PF_XEN_NOT_SHADOW]="propagate",
     [PF_XEN_FAST_PROPAGATE]="fast propagate",
     [PF_XEN_FAST_MMIO]="fast mmio",
@@ -1304,7 +1304,7 @@ struct hvm_data {
     struct vcpu_data *v; /* up-pointer */
 
     /* SVM / VMX compatibility. FIXME - should be global */
-    char ** exit_reason_name;
+    const char ** exit_reason_name;
     int exit_reason_max;
     struct hvm_summary_handler_node *exit_reason_summary_handler_list[HVM_EXIT_REASON_MAX];
 
@@ -1408,7 +1408,7 @@ enum {
     HVM_SHORT_SUMMARY_MAX,
 };
 
-char *hvm_short_summary_name[HVM_SHORT_SUMMARY_MAX] = {
+const char *hvm_short_summary_name[HVM_SHORT_SUMMARY_MAX] = {
     [HVM_SHORT_SUMMARY_EMULATE]  ="emulate",
     [HVM_SHORT_SUMMARY_UNSYNC]   ="unsync",
     [HVM_SHORT_SUMMARY_FIXUP]    ="fixup",
@@ -1478,7 +1478,7 @@ enum {
     PV_MAX
 };
 
-char *pv_name[PV_MAX] = {
+const char *pv_name[PV_MAX] = {
     [PV_HYPERCALL]="hypercall",
     [PV_TRAP]="trap",
     [PV_PAGE_FAULT]="page_fault",
@@ -1527,7 +1527,7 @@ int runstate_graph[RUNSTATE_MAX] =
     [RUNSTATE_INIT]=-2,
 };
 
-char * runstate_name[RUNSTATE_MAX]={
+const char * runstate_name[RUNSTATE_MAX]={
     [RUNSTATE_RUNNING]= "running",
     [RUNSTATE_RUNNABLE]="runnable",
     [RUNSTATE_BLOCKED]= "blocked", /* to be blocked */
@@ -1545,7 +1545,7 @@ enum {
     RUNNABLE_STATE_MAX
 };
 
-char * runnable_state_name[RUNNABLE_STATE_MAX]={
+const char * runnable_state_name[RUNNABLE_STATE_MAX]={
     [RUNNABLE_STATE_INVALID]="invalid", /* Should never show up */
     [RUNNABLE_STATE_WAKE]="wake",
     [RUNNABLE_STATE_PREEMPT]="preempt",
@@ -1565,7 +1565,7 @@ enum {
     MEM_MAX
 };
 
-char *mem_name[MEM_MAX] = {
+const char *mem_name[MEM_MAX] = {
     [MEM_PAGE_GRANT_MAP]         = "grant-map",
     [MEM_PAGE_GRANT_UNMAP]       = "grant-unmap",
     [MEM_PAGE_GRANT_TRANSFER]    = "grant-transfer",
@@ -1681,7 +1681,7 @@ enum {
     DOMAIN_RUNSTATE_MAX
 };
 
-char * domain_runstate_name[] = {
+const char * domain_runstate_name[] = {
     [DOMAIN_RUNSTATE_BLOCKED]="blocked",
     [DOMAIN_RUNSTATE_PARTIAL_RUN]="partial run",
     [DOMAIN_RUNSTATE_FULL_RUN]="full run",
@@ -1698,7 +1698,7 @@ enum {
     POD_RECLAIM_CONTEXT_MAX
 };
 
-char * pod_reclaim_context_name[] = {
+const char * pod_reclaim_context_name[] = {
     [POD_RECLAIM_CONTEXT_UNKNOWN]="unknown",
     [POD_RECLAIM_CONTEXT_FAULT]="fault",
     [POD_RECLAIM_CONTEXT_BALLOON]="balloon",
@@ -1756,7 +1756,7 @@ enum {
     TOPLEVEL_MAX=TOPLEVEL_HW+1,
 };
 
-char * toplevel_name[TOPLEVEL_MAX] = {
+const char * toplevel_name[TOPLEVEL_MAX] = {
     [TOPLEVEL_GEN]="gen",
     [TOPLEVEL_SCHED]="sched",
     [TOPLEVEL_DOM0OP]="dom0op",
@@ -2263,7 +2263,7 @@ static inline void clear_interval_cycles(struct interval_element *e) {
     e->instructions = 0;
 }
 
-static inline void print_cpu_affinity(struct cycle_summary *s, char *p) {
+static inline void print_cpu_affinity(struct cycle_summary *s, const char *p) {
     if(s->count) {
         long long avg;
 
@@ -2326,7 +2326,8 @@ static inline void print_cycle_percent_summary(struct cycle_summary *s,
     }
 }
 
-static inline void print_cycle_summary(struct cycle_summary *s, char *p) {
+static inline void print_cycle_summary(struct cycle_summary *s,
+                                       const char *p) {
     if(s->count) {
         long long avg;
 
@@ -2938,7 +2939,7 @@ void hvm_update_short_summary(struct hvm_data *h, int element) {
 }
 
 void hvm_short_summary(struct hvm_short_summary_struct *hss,
-                       tsc_t total, char *prefix) {
+                       tsc_t total, const char *prefix) {
     char desc[80];
     int i;
 
@@ -3352,7 +3353,7 @@ void hvm_pf_xen_process(struct record_info *ri, struct hvm_data *h) {
          fprintf(warn, "%s: Strange, postprocess already set\n", __func__);
 }
 
-char * hvm_vlapic_icr_dest_shorthand_name[4] = {
+const char * hvm_vlapic_icr_dest_shorthand_name[4] = {
     "dest_field", "self", "all-inc", "all-exc"
 };
 
@@ -3800,7 +3801,7 @@ void update_io_address(struct io_address ** list, unsigned int pa, int dir,
     update_cycles(&p->summary[dir], arc_cycles);
 }
 
-void hvm_io_address_summary(struct io_address *list, char * s) {
+void hvm_io_address_summary(struct io_address *list, const char * s) {
     if(!list)
         return;
 
@@ -4484,7 +4485,7 @@ void hvm_intr_window_process(struct record_info *ri, struct hvm_data *h)
         int32_t intr;
     } *r = (typeof(r))h->d;
 
-    char *intsrc_name[] = {
+    const char *intsrc_name[] = {
         "none",
         "pic",
         "lapic",
@@ -4687,14 +4688,15 @@ void hvm_generic_postprocess(struct hvm_data *h)
     }
 }
 
-void hvm_generic_dump(struct record_info *ri, char * prefix)
+void hvm_generic_dump(struct record_info *ri, const char * prefix)
 {
     struct {
         unsigned vcpu:16, domain:16;
         unsigned d[4];
     } *cr = (typeof(cr))ri->d;
 
-    char *evt_string, evt_number[256];
+    const char *evt_string;
+    char evt_number[256];
     int i, evt, is_64 = 0;
 
     evt = ri->event - TRC_HVM_HANDLER;
@@ -6042,10 +6044,11 @@ void shadow_propagate_process(struct record_info *ri, struct hvm_data *h)
         fprintf(warn, "%s: Strange, postprocess already set\n", __func__);
 }
 
-void shadow_fault_generic_dump(unsigned int event, uint32_t *d, char *prefix,
-                         char * dump_header)
+void shadow_fault_generic_dump(unsigned int event, uint32_t *d,
+                               const char *prefix, const char * dump_header)
 {
-    char *evt_string, evt_number[10];
+    const char *evt_string;
+    char evt_number[10];
     union shadow_event sevt = { .event = event };
     int i;
 
@@ -8643,7 +8646,7 @@ void dump_generic(FILE * f, struct record_info *ri)
     fprintf(f, " ]\n");
 }
 
-void dump_raw(char * s, struct record_info *ri)
+void dump_raw(const char * s, struct record_info *ri)
 {
     int i;
 
diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c
index 2fa864f867..972f473dbf 100644
--- a/tools/xentrace/xenctx.c
+++ b/tools/xentrace/xenctx.c
@@ -302,7 +302,7 @@ static void read_symbol_table(const char *symtab)
 
 #if defined(__i386__) || defined(__x86_64__)
 #define CR0_PE  0x1
-char *flag_values[22][2] =
+const char *flag_values[22][2] =
 {/*  clear,     set,       bit# */
     { NULL,     "c"    }, // 0        Carry
     { NULL,     NULL   }, // 1
@@ -334,7 +334,7 @@ static void print_flags(uint64_t flags)
 
     printf("\nflags: %08" PRIx64, flags);
     for (i = 21; i >= 0; i--) {
-        char *s = flag_values[i][(flags >> i) & 1];
+        const char *s = flag_values[i][(flags >> i) & 1];
         if (s != NULL)
             printf(" %s", s);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 06 19:11:56 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Apr 2021 19:11:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106256.203233 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTr7E-0003Ad-Ms; Tue, 06 Apr 2021 19:11:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106256.203233; Tue, 06 Apr 2021 19:11: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 1lTr7E-0003AV-J9; Tue, 06 Apr 2021 19:11:56 +0000
Received: by outflank-mailman (input) for mailman id 106256;
 Tue, 06 Apr 2021 19:11: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 1lTr7D-0003AM-K5
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 19:11: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 1lTr7D-0005S4-JM
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 19:11:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTr7D-0008SI-IH
 for xen-changelog@lists.xenproject.org; Tue, 06 Apr 2021 19:11:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ups2djYljGHZqHkSF9CYxo9b+j9g3yUgJLffsOtrrXU=; b=yp88ZEYkJJPsz9jdntdlnXYnXK
	N6M8m1GjGR2n0TybD4YMFr9UyCNBbcm5D7dCbs3ypYM61LS+QQrUOpw9pQuja1JcYJWL6O5nWTc4L
	3vFol6Jq++p/JkOcEVX4L57CM5xZcZQEDKi/Afew542HInTAXBj8sOKRouzOR3P0xT5o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/firmware: hvmloader: Use const in __bug() and __assert_failed()
Message-Id: <E1lTr7D-0008SI-IH@xenbits.xenproject.org>
Date: Tue, 06 Apr 2021 19:11:55 +0000

commit 19be4d56a1f7aa65eb4d92276fa5d386e9cb2a62
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Apr 6 20:01:18 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 6 20:03:21 2021 +0100

    tools/firmware: hvmloader: Use const in __bug() and __assert_failed()
    
    __bug() and __assert_failed() are not meant to modify the string
    parameters. So mark them as const.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/firmware/hvmloader/util.c | 4 ++--
 tools/firmware/hvmloader/util.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c
index 7da144b0bb..581b35e5cf 100644
--- a/tools/firmware/hvmloader/util.c
+++ b/tools/firmware/hvmloader/util.c
@@ -722,14 +722,14 @@ static void __attribute__((noreturn)) crash(void)
         asm volatile ( "hlt" );
 }
 
-void __assert_failed(char *assertion, char *file, int line)
+void __assert_failed(const char *assertion, const char *file, int line)
 {
     printf("*** HVMLoader assertion '%s' failed at %s:%d\n",
            assertion, file, line);
     crash();
 }
 
-void __bug(char *file, int line)
+void __bug(const char *file, int line)
 {
     printf("*** HVMLoader bug at %s:%d\n", file, line);
     crash();
diff --git a/tools/firmware/hvmloader/util.h b/tools/firmware/hvmloader/util.h
index 4f0baade0e..8d95eab28a 100644
--- a/tools/firmware/hvmloader/util.h
+++ b/tools/firmware/hvmloader/util.h
@@ -34,11 +34,11 @@ enum {
 #undef NULL
 #define NULL ((void*)0)
 
-void __assert_failed(char *assertion, char *file, int line)
+void __assert_failed(const char *assertion, const char *file, int line)
     __attribute__((noreturn));
 #define ASSERT(p) \
     do { if (!(p)) __assert_failed(#p, __FILE__, __LINE__); } while (0)
-void __bug(char *file, int line) __attribute__((noreturn));
+void __bug(const char *file, int line) __attribute__((noreturn));
 #define BUG() __bug(__FILE__, __LINE__)
 #define BUG_ON(p) do { if (p) BUG(); } while (0)
 #define BUILD_BUG_ON(p) ((void)sizeof(char[1 - 2 * !!(p)]))
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 00:33:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 00:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106362.203390 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw7z-0007Ip-FK; Wed, 07 Apr 2021 00:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106362.203390; Wed, 07 Apr 2021 00: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 1lTw7z-0007Ih-CO; Wed, 07 Apr 2021 00:33:03 +0000
Received: by outflank-mailman (input) for mailman id 106362;
 Wed, 07 Apr 2021 00: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 1lTw7y-0007Ic-Bd
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00: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 1lTw7y-0002wd-7W
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw7y-0003EM-6W
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00: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=GH31eJBaj3s0qqI0It5L35S6YfG3KtCEbfWhQzd7CnM=; b=DKcri1D2bf3ERB8jN9Hhe/oq/7
	mV1kH8rzYDUQWAPCfCPlZ706/c46s9MtDAzOzWh8m9o3ujtp6LjwWl3DiYChOju9zv0t9/bpdF6Cr
	VLuSZtBPpo5+ari4dGglrA49PjSVU8hYzRWKSyvLzg7/AC9yFBfuRZdp/MEcPgLlUKkA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] Intel Processor Trace Support: Add CHANGELOG.md and SUPPORT.md entries
Message-Id: <E1lTw7y-0003EM-6W@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 00:33:02 +0000

commit a4b346260cf2ca863d224c38c8ba8c0a4295f864
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Tue Mar 23 13:55:57 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    Intel Processor Trace Support: Add CHANGELOG.md and SUPPORT.md entries
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 SUPPORT.md   | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 30b53e73e8..2f5edf091e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Renesas IPMMU-VMSA (Supported, not security supported; was Tech Preview)
  - ARM SMMUv3 (Tech Preview)
  - Switched MSR accesses to deny by default policy.
+ - Intel Processor Trace support (Tech Preview)
 
 ### Removed / support downgraded
 
diff --git a/SUPPORT.md b/SUPPORT.md
index a1efd8fcfd..cd0c09e6a4 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -247,6 +247,13 @@ Export hypervisor coverage data suitable for analysis by gcov or lcov.
 
     Status: Supported, Not security supported
 
+### Processor trace support
+
+Support for using Intel Processor Trace technology to trace guests
+from dom0.
+
+    Status, x86: Tech Preview
+
 ## Memory Management
 
 ### Dynamic memory control
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 00:33:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 00:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106363.203394 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw89-0007Jd-Go; Wed, 07 Apr 2021 00:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106363.203394; Wed, 07 Apr 2021 00: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 1lTw89-0007JV-Dr; Wed, 07 Apr 2021 00:33:13 +0000
Received: by outflank-mailman (input) for mailman id 106363;
 Wed, 07 Apr 2021 00: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 1lTw88-0007JP-CP
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00: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 1lTw88-0002wo-BZ
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw88-0003FA-9l
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00: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=zBrCM2UOTfWlXOctsgQ/7GDri7zn6rbl64+4rK91LsA=; b=GM3XqpE9uDWrBmlM43euGGs5Cl
	xaTSb42GOsaWmRLVrQfELOsjP876g+1AWRqwWRzM69n6tcBsM6wE8T6XlR96r+ykyPnuJsG9DVjeT
	IeUX9WjHN26zGlDkXDHuDACIbSoY+ri5IqCBs/AxkEmBkBFbkcwqk8+G6mVSQ+fgcCW8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] CHANGELOG.md: Add named PCI devices
Message-Id: <E1lTw88-0003FA-9l@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 00:33:12 +0000

commit 6437cff8af0fd8d6670fd32b09c4e3d450b165e3
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Tue Mar 23 16:52:25 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    CHANGELOG.md: Add named PCI devices
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2f5edf091e..1d88a06527 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - ARM SMMUv3 (Tech Preview)
  - Switched MSR accesses to deny by default policy.
  - Intel Processor Trace support (Tech Preview)
+ - Named PCI devices for xl/libxl
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 00:33:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 00:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106364.203397 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw8J-0007Kz-IC; Wed, 07 Apr 2021 00:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106364.203397; Wed, 07 Apr 2021 00: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 1lTw8J-0007Kr-FJ; Wed, 07 Apr 2021 00:33:23 +0000
Received: by outflank-mailman (input) for mailman id 106364;
 Wed, 07 Apr 2021 00: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 1lTw8I-0007Kg-Fe
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00: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 1lTw8I-0002wx-Ew
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw8I-0003Fy-Du
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00: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=ihCrKeyKSlk7JbaZOKuaLR2I5l5ay76iV1YzzsqNB+0=; b=TfF6YGdEU8tR8NyHZD77CW/lCf
	A4yK9hbgzvtxNCTFliMaLhOMU2IMPjR1L4XeFJLcdgJGOcby6NEwjpYB80JaSPkZMVTQLgPNJZHMm
	h8I67DyLgHHHc7eCGQE2pk8cdjpGHuU4eH73w6HQxcOpomoeVZjenoLo09zZmiT9zq7Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] CHANGELOG.md: Add dom0/domU zstd compression support
Message-Id: <E1lTw8I-0003Fy-Du@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 00:33:22 +0000

commit 049c1917fdea7aaaebdb449d769aaf625b1cfb6a
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Tue Mar 23 16:58:42 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    CHANGELOG.md: Add dom0/domU zstd compression support
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1d88a06527..9e9d49092a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Switched MSR accesses to deny by default policy.
  - Intel Processor Trace support (Tech Preview)
  - Named PCI devices for xl/libxl
+ - Support for zstd-compressed dom0 (x86) and domU kernels
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 00:33:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 00:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106365.203401 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw8U-0007MY-Jx; Wed, 07 Apr 2021 00:33:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106365.203401; Wed, 07 Apr 2021 00:33:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw8U-0007MQ-Gw; Wed, 07 Apr 2021 00:33:34 +0000
Received: by outflank-mailman (input) for mailman id 106365;
 Wed, 07 Apr 2021 00: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 1lTw8S-0007MH-Is
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00: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 1lTw8S-0002x7-I2
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw8S-0003Gs-H9
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00: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=TA6coudPVMFqyQTaJx/qsmvikwsEqH5liM6qn5QIxbg=; b=oOfzEpM24AK+88/Eev9e+zrUi9
	pMbEp+uFQUfQbU1GwfAAdk7efGkEll4DRtUhXgqf/BTa+4PrZFjCBseEg5EVcwqQOJBICJl+dzKvY
	zBwOD10BSpO8+n+iDzaybYRJPRGK22A1OcArkxD786q8Xly46oLpEH0c5L70as/X3u2s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] CHANGELOG.md: NetBSD lib/gnttab support
Message-Id: <E1lTw8S-0003Gs-H9@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 00:33:32 +0000

commit 3c191adec260edda842b9d199432eb55573c0f5f
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Tue Mar 23 17:06:20 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    CHANGELOG.md: NetBSD lib/gnttab support
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9e9d49092a..e454248df9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Intel Processor Trace support (Tech Preview)
  - Named PCI devices for xl/libxl
  - Support for zstd-compressed dom0 (x86) and domU kernels
+ - Library improvements from NetBSD ports upstreamed
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 00:33:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 00:33:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106366.203406 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw8e-0007O4-Lg; Wed, 07 Apr 2021 00:33:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106366.203406; Wed, 07 Apr 2021 00:33:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw8e-0007Nw-IZ; Wed, 07 Apr 2021 00:33:44 +0000
Received: by outflank-mailman (input) for mailman id 106366;
 Wed, 07 Apr 2021 00:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw8c-0007Nl-M8
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw8c-0002xF-LL
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw8c-0003Hn-KI
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9VHwqLV3/1wQOmr6z4d9IDHUBF2OXB25LZ2E/3YZLv8=; b=SM+QVDBp7ntlNu9Pa9KGmrflLd
	S+NiJUZVOgTUJ4bAGigkU9sCnENGHHsBAp+xNR5k3fE/Rdu73QH9XPSKimgliZmGcIEUrIQxVtwWe
	HP1k/KIahRBTX7We3JyQv+ziy843rdpwK+r4K95fTtpshEtDbvf8TV4TGuWl8QnHfa5Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] CHANGELOG.md: Add entries for CI loop
Message-Id: <E1lTw8c-0003Hn-KI@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 00:33:42 +0000

commit 2c38f024ee82e629ba1a9e14e9dce1d21e6f2426
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Wed Mar 24 16:20:28 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    CHANGELOG.md: Add entries for CI loop
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e454248df9..6d093edc0e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Named PCI devices for xl/libxl
  - Support for zstd-compressed dom0 (x86) and domU kernels
  - Library improvements from NetBSD ports upstreamed
+ - CI loop: Add Alpine Linux, Ubuntu Focal targets; drop CentOS 6
+ - CI loop: Add qemu-based dom0 / domU test for ARM
+ - CI loop: Add dom0less aarch64 smoke test
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 00:33:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 00:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106367.203409 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw8o-0007PL-NH; Wed, 07 Apr 2021 00:33:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106367.203409; Wed, 07 Apr 2021 00:33:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw8o-0007PD-K9; Wed, 07 Apr 2021 00:33:54 +0000
Received: by outflank-mailman (input) for mailman id 106367;
 Wed, 07 Apr 2021 00:33:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw8m-0007P0-PP
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:33:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw8m-0002xi-Od
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw8m-0003Iq-Nb
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:33:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qAwSMzFp4AgqtYS7V+nJIB7IvHkxZc7nSiMyBxM6wss=; b=FUqnT7pwxnF4n81t4qAPlVNtMj
	e60VjWajE0vDBewW6CDD5gXSzNxo6Nc95onWRb3OJxdhs16Ds2Ww/5VrmgkPAN1F2gRmYxs1xlM3v
	+PX2tb6UpLWUy1WKlbG0OObXTnVr71Lcw4GUjPUWjA3BTB8cehf4FK6QHv/z4gIGB7JY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] CHANGELOG.md: Add entries for emulation
Message-Id: <E1lTw8m-0003Iq-Nb@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 00:33:52 +0000

commit e388292a93cb90b53f054b27e7c877c4ebdee5de
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Wed Mar 24 13:24:45 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    CHANGELOG.md: Add entries for emulation
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6d093edc0e..a1f1873940 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - CI loop: Add Alpine Linux, Ubuntu Focal targets; drop CentOS 6
  - CI loop: Add qemu-based dom0 / domU test for ARM
  - CI loop: Add dom0less aarch64 smoke test
+ - x86: Allow domains to use AVX-VNNI instructions
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 00:34:04 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 00:34:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106368.203414 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw8y-0007Qa-Oy; Wed, 07 Apr 2021 00:34:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106368.203414; Wed, 07 Apr 2021 00:34:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw8y-0007QS-Li; Wed, 07 Apr 2021 00:34:04 +0000
Received: by outflank-mailman (input) for mailman id 106368;
 Wed, 07 Apr 2021 00:34:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw8w-0007QI-TR
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:34:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw8w-0002y5-Rf
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw8w-0003K3-Qs
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:34:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wCBk+s/Z08AIbyHj+UnXYKZNCrllA6w2Xr1vn1oUnZg=; b=d4POZvs7aR24lwNhbudmDIISMR
	cqtMiCYUvJiJ8P16rz7CiitKbC0hMLkcHM0HPRZVv6GQnDG9WSrM8kwqpM7fUutGDB30wV8h+O19k
	d+YHo8FWzIqQM3sgXvo4sEpJBKskoiRn4nR0dHF95DM/w+t7/AHk0ubtS2wFnvLBzhi8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] CHANGELOG.md: Make PV shim smaller by factoring out HVM-specific shadow code
Message-Id: <E1lTw8w-0003K3-Qs@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 00:34:02 +0000

commit 42249debeb9d08a3c014fd975546736430471198
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Wed Mar 24 17:24:31 2021 +0000
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    CHANGELOG.md: Make PV shim smaller by factoring out HVM-specific shadow code
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a1f1873940..2046b43e3e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - CI loop: Add qemu-based dom0 / domU test for ARM
  - CI loop: Add dom0less aarch64 smoke test
  - x86: Allow domains to use AVX-VNNI instructions
+ - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 00:34:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 00:34:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106369.203418 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw98-0007Ro-QL; Wed, 07 Apr 2021 00:34:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106369.203418; Wed, 07 Apr 2021 00:34:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw98-0007Re-ND; Wed, 07 Apr 2021 00:34:14 +0000
Received: by outflank-mailman (input) for mailman id 106369;
 Wed, 07 Apr 2021 00:34:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw97-0007RU-0E
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:34:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw96-0002yB-VI
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:34:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw96-0003Kq-UE
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:34:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uZMKR8s2q9HnStbWYmn/zNoVLFKJTvt3MAyPfUYsZXU=; b=fMdXrPiyPDhQRmtM8wikFaJgUI
	Awwdfdyuu48SIQsaxcSDsSu3c4Y4Mwf7QYASE/EKeF8J0apmhDeorLZo9iFBCyDydn4bD864pv79p
	vtpOq1qwKzpZMT2BjaqIr+k1D63KmPVXRnc0lyHUP++jXSO5idi3uIM6B2Oo07//9kfs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] CHANGELOG.md: Mention XEN_SCRIPT_DIR
Message-Id: <E1lTw96-0003Kq-UE@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 00:34:12 +0000

commit a6a8cdde356979c259fa21ea36b11c14874d4060
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 13:51:48 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    CHANGELOG.md: Mention XEN_SCRIPT_DIR
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-acked-by: Ian Jackson <iwj@xenproject.org>
    ---
    
    CC: Olaf Hering <olaf@aepfle.de>
    CC: Ian Jackson <iwj@xenproject.org>
---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2046b43e3e..f17cfedae2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - CI loop: Add dom0less aarch64 smoke test
  - x86: Allow domains to use AVX-VNNI instructions
  - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
+ - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
+
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 00:34:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 00:34:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106370.203422 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw9I-0007Sy-S2; Wed, 07 Apr 2021 00:34:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106370.203422; Wed, 07 Apr 2021 00:34:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw9I-0007Sq-Ok; Wed, 07 Apr 2021 00:34:24 +0000
Received: by outflank-mailman (input) for mailman id 106370;
 Wed, 07 Apr 2021 00:34:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw9H-0007Sd-3O
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:34:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw9H-0002yJ-2d
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:34:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw9H-0003LZ-1Y
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:34:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+ub+CP3BQrEimeyDqrxArSFMoC8YSVoh9H4PEEhbwto=; b=KSRRofRFjlyFJ93uNVNIo1KTsR
	5Rb2JsOFw1jBiwq/zqazo0Tiwd5lc+CYnplHDPxJdmv7RLr34akMxGvfy7nfnwqc7optxfcKAHMSJ
	2B9yEAtzb1C5ycUbs7cNfMzYeCal14sC3NnbJ8h6cyQA1ZlOqCufCGi1/MrbbtgqSKUI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] CHANGELOG.md: xl PCI configuration doc, xenstore MTU entries
Message-Id: <E1lTw9H-0003LZ-1Y@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 00:34:23 +0000

commit ba0b0f7fcd2250a848fb5e91a6ca4dcef0c7c5a3
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 13:54:10 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    CHANGELOG.md: xl PCI configuration doc, xenstore MTU entries
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
    ---
    CC: Paul Durrant <paul@xen.org>
    CC: Ian Jackson <ian.jackson@citrix.com>
    CC: Wei Liu <wl@xen.org>
---
 CHANGELOG.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index f17cfedae2..3d39af0a07 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Switched MSR accesses to deny by default policy.
  - Intel Processor Trace support (Tech Preview)
  - Named PCI devices for xl/libxl
+ - Improved documentation for xl PCI configuration format
  - Support for zstd-compressed dom0 (x86) and domU kernels
  - Library improvements from NetBSD ports upstreamed
  - CI loop: Add Alpine Linux, Ubuntu Focal targets; drop CentOS 6
@@ -21,7 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - x86: Allow domains to use AVX-VNNI instructions
  - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
  - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
-
+ - xennet: Documented a way for the backend (or toolstack) to specify MTU to the frontend
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 00:34:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 00:34:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106371.203426 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw9S-0007Vo-Tm; Wed, 07 Apr 2021 00:34:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106371.203426; Wed, 07 Apr 2021 00:34:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw9S-0007Vh-QK; Wed, 07 Apr 2021 00:34:34 +0000
Received: by outflank-mailman (input) for mailman id 106371;
 Wed, 07 Apr 2021 00:34:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw9R-0007VZ-6o
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:34:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw9R-0002yT-63
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw9R-0003MD-53
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:34:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iH1iu3MdpT0L3jxH/5gqqA+Ja+8GeFQ+OzKySRIDC2I=; b=UmA4cZ3h+qicm/PSyZ4U2TahML
	0SXr2KwPTiY+ZpiFMQKCx5tBE5uQOud3QGdQMSewGWPg/b1hek1z2UcATwCMwyIP7LoYLYgDxE+Ea
	NM+TGZagdYrXcUvSCduwu669I18lAAHplRJoQ98D+lOd7F36ioQzW/HNMRoJWhqKu3vk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] CHANGELOG.md: Some additional affordances in various xl subcommands
Message-Id: <E1lTw9R-0003MD-53@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 00:34:33 +0000

commit c144ebec264359e36091982804240d5746266589
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:06:36 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:19 2021 +0100

    CHANGELOG.md: Some additional affordances in various xl subcommands
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
    ---
    CC: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3d39af0a07..1680c23ec1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
  - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
  - xennet: Documented a way for the backend (or toolstack) to specify MTU to the frontend
+ - Some additional affordances in various xl subcommands.
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 00:34:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 00:34:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106372.203430 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw9c-0007XL-15; Wed, 07 Apr 2021 00:34:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106372.203430; Wed, 07 Apr 2021 00:34:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw9b-0007XE-Ty; Wed, 07 Apr 2021 00:34:43 +0000
Received: by outflank-mailman (input) for mailman id 106372;
 Wed, 07 Apr 2021 00:34:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw9b-0007X8-AM
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:34:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw9b-0002yb-9j
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw9b-0003N0-8L
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:34:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fASIUH64YjOlM7Msur8Z6qERn7HnZaIz8d+nm+6ygGY=; b=4bCWacSccOPopBfrqy8nRtXnQG
	693r68ehP7gXMTjLCqM6T+u2hvCYYzeVgi1YC20QnQD5z+tfnC482fyH5adPbwG8+xATDMBnXjB1l
	NzyNdq7T/mOgMcPmeJ3bY1TnFeoh74oND22yaDo9wQB9B5aoTRHwtLdTDhsQnnRrRquQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] CHANGELOG.md: Mention various ARM errata
Message-Id: <E1lTw9b-0003N0-8L@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 00:34:43 +0000

commit 2af8e70d2818c56a2bf338d99372fc4c8762785a
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:08:04 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:20 2021 +0100

    CHANGELOG.md: Mention various ARM errata
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    ---
    v2:
     - Tweaked wording
    CC: Ian Jackson <ian.jackson@citrix.com>
    CC: Stefano Stabellini <sstabellini@kernel.org>
    CC: Julien Grall <julien@xen.org>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1680c23ec1..15562c2490 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
  - xennet: Documented a way for the backend (or toolstack) to specify MTU to the frontend
  - Some additional affordances in various xl subcommands.
+ - Added workarounds for the following ARM errata: Cortex A53 #843419, Cortex A55 #1530923, Cortex A72 #853709, Cortex A73 #858921, Cortex A76 #1286807, Neoverse-N1 #1165522
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 00:34:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 00:34:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106373.203434 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw9m-0007Yf-2K; Wed, 07 Apr 2021 00:34:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106373.203434; Wed, 07 Apr 2021 00:34:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw9l-0007YX-VY; Wed, 07 Apr 2021 00:34:53 +0000
Received: by outflank-mailman (input) for mailman id 106373;
 Wed, 07 Apr 2021 00:34:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw9l-0007YN-F3
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:34:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw9l-0002yz-DH
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:34:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw9l-0003Nl-CH
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:34:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=I+qUNlMnvl04i6MkRGYMK3YVCdegPQc8HbtmtUcgGKc=; b=gyM+eoWJuJtTpI1reeML+nF1Xt
	3z3vEz2cifDsQzt9P7v3Qk+ISnFVoj3NQ6VgapVC6lFPWB5s8Ug7GJIseY14LLyz6FuFVuSgpiOqb
	e2AKmVI1lYm5/YP0gjTMPi/0uQun024RAmX6zdAcEtaNy2mBv5UtS5dOMvZAIeT5gUY8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] CHANGELOG.md: Various new entries, mostly x86
Message-Id: <E1lTw9l-0003Nl-CH@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 00:34:53 +0000

commit 210c1f263177f8cc289e9e7794bf0a534c098f29
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:18:36 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:20 2021 +0100

    CHANGELOG.md: Various new entries, mostly x86
    
    ...Grouped mostly by submitter / maintainer
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    ---
    CC: Ian Jackson <ian.jackson@citrix.com>
    CC: Andrew Cooper <andrew.cooper3@citrix.com>
    CC: Jan Beulich <jbeulich@suse.com>
    CC: Roger Pau Monne <roger.pau@citrix.com>
---
 CHANGELOG.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 15562c2490..106f3f45c1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Named PCI devices for xl/libxl
  - Improved documentation for xl PCI configuration format
  - Support for zstd-compressed dom0 (x86) and domU kernels
+ - EFI: Enable booting unified hypervisor/kernel/initrd/DT images
+ - Reduce ACPI verbosity by default
+ - Add ucode=allow-same option to test late microcode loading path
  - Library improvements from NetBSD ports upstreamed
  - CI loop: Add Alpine Linux, Ubuntu Focal targets; drop CentOS 6
  - CI loop: Add qemu-based dom0 / domU test for ARM
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 00:35:04 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 00:35:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106374.203437 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw9w-0007a1-3v; Wed, 07 Apr 2021 00:35:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106374.203437; Wed, 07 Apr 2021 00:35:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTw9w-0007Zt-0n; Wed, 07 Apr 2021 00:35:04 +0000
Received: by outflank-mailman (input) for mailman id 106374;
 Wed, 07 Apr 2021 00:35:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw9v-0007Zo-HT
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:35:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw9v-0002zK-Gj
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:35:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTw9v-0003On-Fg
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:35:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sz+jPxd55RIWjhhfyCX3UZXVPsx6LeY72ETG8vzjEIg=; b=LcbP1SyavwDCvdRqXPIpSQ99lL
	VKylCHrSJ8t6YnK0EycLLLjv5qSfNhbYdyQ3R6GUzjPnqOV5mlxJZsKPjzsdiYIoBbxTOtM+pUt23
	VCDJvv1kxl8Q77LEyOslw5JQeuA+3CbCx26rdRUnO55KPnJG7Uvkr/8dxmqz3LgbaUZo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] CHANGELOG.md: Various entries, mostly xenstore
Message-Id: <E1lTw9v-0003On-Fg@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 00:35:03 +0000

commit 2f8436bb41104e7f4ec867a1e758ba90fa53be0f
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:30:55 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:20 2021 +0100

    CHANGELOG.md: Various entries, mostly xenstore
    
    ...grouped by submitters / maintainers
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    ---
    CC: Juergen Gross <jgross@suse.com>
    CC: Jan Beulich <jbeulich@suse.com>
    CC: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 106f3f45c1..57b06e8cb8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,8 +26,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
  - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
  - xennet: Documented a way for the backend (or toolstack) to specify MTU to the frontend
+ - xenstore can now be live-updated on a running system. (Tech preview)
  - Some additional affordances in various xl subcommands.
  - Added workarounds for the following ARM errata: Cortex A53 #843419, Cortex A55 #1530923, Cortex A72 #853709, Cortex A73 #858921, Cortex A76 #1286807, Neoverse-N1 #1165522
+ - On detecting a host crash, some debug key handlers can automatically triggered to aid in debugging
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 00:35:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 00:35:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106375.203442 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTwA6-0007bH-5W; Wed, 07 Apr 2021 00:35:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106375.203442; Wed, 07 Apr 2021 00:35: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 1lTwA6-0007b9-2R; Wed, 07 Apr 2021 00:35:14 +0000
Received: by outflank-mailman (input) for mailman id 106375;
 Wed, 07 Apr 2021 00:35:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTwA5-0007b1-L7
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:35:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTwA5-0002zS-KK
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:35:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTwA5-0003Pz-JN
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:35:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SRjsVXBCbY/X8sMhwharwU8oECx7HDX6BaxyzcMF2KA=; b=HXEyz4dOhsj4oe9XITCJQg4jWc
	NolyrRHPEXnICMcsKqZ99QbkMFYmOUtwJoTUFVcGXmqQkzepaICrJ3XBeygZ28T//whOyZdmFGA+5
	tjePY5bNGRVlv1xHUVbQY1l3tjfbqbZSAgAfBhmw6KHzWiUpr0TdqiaogTB9L8onTJac=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] CHANGELOG.md: irq-max-guests
Message-Id: <E1lTwA5-0003Pz-JN@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 00:35:13 +0000

commit 29bb238417fb114feb26d9234f58a375448379a2
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:34:04 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:55:20 2021 +0100

    CHANGELOG.md: irq-max-guests
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    ---
    CC: Igor Druzhinin <igor.druzhinin@citrix.com>
    CC: Jan Beulich <jbeulich@suse.com>
    CC: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 57b06e8cb8..a9589aacc9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Some additional affordances in various xl subcommands.
  - Added workarounds for the following ARM errata: Cortex A53 #843419, Cortex A55 #1530923, Cortex A72 #853709, Cortex A73 #858921, Cortex A76 #1286807, Neoverse-N1 #1165522
  - On detecting a host crash, some debug key handlers can automatically triggered to aid in debugging
+ - Increase the maximum number of guests which can share a single IRQ from 7 to 16, and make this configurable with irq-max-guests
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 00:35:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 00:35:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106376.203447 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTwAG-0007ca-8D; Wed, 07 Apr 2021 00:35:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106376.203447; Wed, 07 Apr 2021 00:35: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 1lTwAG-0007cR-4A; Wed, 07 Apr 2021 00:35:24 +0000
Received: by outflank-mailman (input) for mailman id 106376;
 Wed, 07 Apr 2021 00:35: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 1lTwAF-0007cK-O5
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:35: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 1lTwAF-0002zc-NG
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:35:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTwAF-0003R4-MY
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:35: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=pUTy65tk4/qChB60YGNE7pqBmJQmDY49h/IVLyIxRag=; b=a7FKcVD3UndOQKUhuccMEj4mAr
	M3TAftnbq7MPrBVFxnTfo8P/KDWVhP61qU1NnvuC6uP5tPtpAHUoyVOMjUjm3ziUDhXIwRDgckRkO
	N+4Jv3m11mPlK2fZ5YUl8K+s6ENIuyjwuagyz+gKalNDVSP2dL71qJZ8Ja8uTohAOqKU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] Prep for release: Pin minios and both qemu versions to tags
Message-Id: <E1lTwAF-0003R4-MY@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 00:35:23 +0000

commit 1d471499cae71c27747ff9681600a66d79479998
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Apr 6 18:09:32 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Apr 6 18:09:32 2021 +0100

    Prep for release: Pin minios and both qemu versions to tags
    
    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 a56a971028..2ff1ed2ce3 100644
--- a/Config.mk
+++ b/Config.mk
@@ -245,15 +245,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= a3741780fe3535e19e02efa869a7cac481891129
-QEMU_UPSTREAM_REVISION ?= 7ea428895af2840d85c524f0bd11a38aac308308
-MINIOS_UPSTREAM_REVISION ?= 051b87bb9c19609976fb038f386920e1ce5454c5
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.15.0
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.15.0
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.14.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= xen-4.15.0-rc1
+QEMU_TRADITIONAL_REVISION ?= xen-4.15.0
 # Wed Jul 15 10:01:40 2020 +0100
 # qemu-trad: remove Xen path dependencies
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 00:35:35 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 00:35:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106377.203450 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTwAR-0007ds-8r; Wed, 07 Apr 2021 00:35:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106377.203450; Wed, 07 Apr 2021 00:35:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTwAR-0007dk-5s; Wed, 07 Apr 2021 00:35:35 +0000
Received: by outflank-mailman (input) for mailman id 106377;
 Wed, 07 Apr 2021 00:35: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 1lTwAP-0007dc-Rq
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:35: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 1lTwAP-0002zk-RA
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:35:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTwAP-0003S0-PT
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:35: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=WUzTiPvhqh3PYGAENdbus6tk17OocET67FwV3FjXKFk=; b=5xzFbH8z5wnJmdKAV7tLV+dvzg
	fkynPe4Ng/hHQIUVGiOOxXHnUmF9eHW25R6VlwBZDrSg2UF86YEveFQayE7T1b3X8GhJpQv/CAiPb
	SAxmzinNQqTd7dCzuI+3SmHGjLCHJUQcmcFAukWMQW+mCZZZTJIiVnFH0to8+/68cuaw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] SUPPORT.md: Specify support lifetime etc. for Xen 4.15
Message-Id: <E1lTwAP-0003S0-PT@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 00:35:33 +0000

commit 03db1efd02872015d26737132b3d41c4650dac95
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Mon Mar 29 15:23:42 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Apr 6 18:11:18 2021 +0100

    SUPPORT.md: Specify support lifetime etc. for Xen 4.15
    
    CC: committers@xenproject.org
    CC: security@xenproject.org
    CC: community.manager@xenproject.org
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 SUPPORT.md | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index cd0c09e6a4..d89af5abc8 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -9,13 +9,13 @@ for the definitions of the support status levels etc.
 
 # Release Support
 
-    Xen-Version: 4.15-rc
-    Initial-Release: n/a
-    Supported-Until: TBD
-    Security-Support-Until: Unreleased - not yet security-supported
+    Xen-Version: 4.15
+    Initial-Release: 2021-04-08
+    Supported-Until: 2022-10-08
+    Security-Support-Until: 2024-04-08
 
 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.15_Release_Notes">RN</a>
 
 # Feature Support
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 00:35:45 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 00:35:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106378.203454 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTwAb-0007fM-AV; Wed, 07 Apr 2021 00:35:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106378.203454; Wed, 07 Apr 2021 00:35:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lTwAb-0007fD-7O; Wed, 07 Apr 2021 00:35:45 +0000
Received: by outflank-mailman (input) for mailman id 106378;
 Wed, 07 Apr 2021 00:35:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTwAZ-0007f5-Up
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:35: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 1lTwAZ-0002zs-UA
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:35:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lTwAZ-0003T4-TT
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 00:35: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=srmNyapBtvtiZdEyeo0mM52CDzFKBpXE7LJSCHGYEjY=; b=5/mP/4TMUF8l4Kvck6mnw07Hia
	Iv/I2oDIovWctW6NA80zz7oGTTwWeFnHb1oQprDg42IOKRiAffHtS7kPvwWeYADGfBj/RN40dDu31
	zNiFjLgD5SEXyjLVNASd43IhGIwN2nf/8BThmE7I+6sR1zU7xJ0IynYCBUqyZ2x5nST4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] README, Makefile: Prep for release
Message-Id: <E1lTwAZ-0003T4-TT@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 00:35:43 +0000

commit e25aa9939ae0cd8317605be3d5c5611b76bc4ab4
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Tue Apr 6 18:14:18 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Tue Apr 6 18:14:18 2021 +0100

    README, Makefile: Prep for release
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 README       | 16 ++++++++--------
 xen/Makefile |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/README b/README
index aa8b4fe126..de579080d7 100644
--- a/README
+++ b/README
@@ -1,11 +1,11 @@
-#################################
- _  _    _ ____
-| || |  / | ___|       _ __ ___
-| || |_ | |___ \ _____| '__/ __|
-|__   _|| |___) |_____| | | (__
-   |_|(_)_|____/      |_|  \___|
-
-#################################
+##################################
+__  __            _  _    _ ____
+\ \/ /___ _ __   | || |  / | ___|
+ \  // _ \ '_ \  | || |_ | |___ \
+ /  \  __/ | | | |__   _|| |___) |
+/_/\_\___|_| |_|    |_|(_)_|____/
+
+##################################
 
 https://www.xen.org/
 
diff --git a/xen/Makefile b/xen/Makefile
index 0b97e459e2..acb2d28891 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 15
-export XEN_EXTRAVERSION ?= .0-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.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 10:33:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 10:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106605.203845 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lU5Uf-0002qL-W0; Wed, 07 Apr 2021 10:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106605.203845; Wed, 07 Apr 2021 10:33:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lU5Uf-0002qD-Sx; Wed, 07 Apr 2021 10:33:05 +0000
Received: by outflank-mailman (input) for mailman id 106605;
 Wed, 07 Apr 2021 10:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lU5Uf-0002q8-1x
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 10:33:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lU5Ue-00037c-Ty
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 10:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lU5Ue-0007TS-Qq
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 10: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=UsSJc/fTY5YMO1aJhIGtFG7SG1F4AVFn2hEI6yh+qbU=; b=Bf/QL/enZHeZnvuK613ZR7OmVB
	ch8VwyK6JJuaT9Y83uyCzyDxUvl+SOGSFAg1Q6n7PZFyeelAxUKF4hUy44/wCQsjAFNdSkWZL9fph
	UqlcE5NSG81qKMgJLTjMuoGWJ7yQjHWm+kiLPk0IZvaXXthOR7KRz8U0dVGeen82Wkbo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] fix for_each_cpu() again for NR_CPUS=1
Message-Id: <E1lU5Ue-0007TS-Qq@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 10:33:04 +0000

commit 625faf9f002bd6ff4b6457a016b8ff338223b659
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Apr 7 12:24:45 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Apr 7 12:24:45 2021 +0200

    fix for_each_cpu() again for NR_CPUS=1
    
    Unfortunately aa50f45332f1 ("xen: fix for_each_cpu when NR_CPUS=1") has
    caused quite a bit of fallout with gcc10, e.g. (there are at least two
    more similar ones, and I didn't bother trying to find them all):
    
    In file included from .../xen/include/xen/config.h:13,
                     from <command-line>:
    core_parking.c: In function ‘core_parking_power’:
    .../xen/include/asm/percpu.h:12:51: error: array subscript 1 is above array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds]
       12 |     (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
    .../xen/include/xen/compiler.h:141:29: note: in definition of macro ‘RELOC_HIDE’
      141 |     (typeof(ptr)) (__ptr + (off)); })
          |                             ^~~
    core_parking.c:133:39: note: in expansion of macro ‘per_cpu’
      133 |             core_tmp = cpumask_weight(per_cpu(cpu_core_mask, cpu));
          |                                       ^~~~~~~
    In file included from .../xen/include/xen/percpu.h:4,
                     from .../xen/include/asm/msr.h:7,
                     from .../xen/include/asm/time.h:5,
                     from .../xen/include/xen/time.h:76,
                     from .../xen/include/xen/spinlock.h:4,
                     from .../xen/include/xen/cpu.h:5,
                     from core_parking.c:19:
    .../xen/include/asm/percpu.h:6:22: note: while referencing ‘__per_cpu_offset’
        6 | extern unsigned long __per_cpu_offset[NR_CPUS];
          |                      ^~~~~~~~~~~~~~~~
    
    One of the further errors even went as far as claiming that an array
    index (range) of [0, 0] was outside the bounds of a [1] array, so
    something fishy is pretty clearly going on there.
    
    The compiler apparently wants to be able to see that the loop isn't
    really a loop in order to avoid triggering such warnings, yet what
    exactly makes it consider the loop exit condition constant and within
    the [0, 1] range isn't obvious - using ((mask)->bits[0] & 1) instead of
    cpumask_test_cpu() for example did _not_ help.
    
    Re-instate a special form of for_each_cpu(), experimentally "proven" to
    avoid the diagnostics.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
---
 xen/include/xen/cpumask.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/xen/cpumask.h b/xen/include/xen/cpumask.h
index e69589fc08..9826707909 100644
--- a/xen/include/xen/cpumask.h
+++ b/xen/include/xen/cpumask.h
@@ -368,10 +368,15 @@ static inline void free_cpumask_var(cpumask_var_t mask)
 #define FREE_CPUMASK_VAR(m) free_cpumask_var(m)
 #endif
 
+#if NR_CPUS > 1
 #define for_each_cpu(cpu, mask)			\
 	for ((cpu) = cpumask_first(mask);	\
 	     (cpu) < nr_cpu_ids;		\
 	     (cpu) = cpumask_next(cpu, mask))
+#else /* NR_CPUS == 1 */
+#define for_each_cpu(cpu, mask)			\
+	for ((cpu) = 0; (cpu) < cpumask_test_cpu(0, mask); ++(cpu))
+#endif /* NR_CPUS */
 
 /*
  * The following particular system cpumasks and operations manage
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 15:44:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 15:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106779.204172 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUALf-0007Uj-JS; Wed, 07 Apr 2021 15:44:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106779.204172; Wed, 07 Apr 2021 15:44:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUALf-0007Uc-Ge; Wed, 07 Apr 2021 15:44:07 +0000
Received: by outflank-mailman (input) for mailman id 106779;
 Wed, 07 Apr 2021 15: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 1lUALd-0007UW-Nw
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 15: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 1lUALd-0008Jj-JU
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 15:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUALd-0008Aq-GF
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 15:44:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=r6o5T5ZuB7LStHF8YfUwIVh/NlNVrX0rem893993sPk=; b=NCwcD0JeDC2j1FKW3xGc7e3Yp0
	QPS8eZuJZhOTvWdZ+XSlAJaX8QXxLr25rmHx7FF45RrszNjPML9D7jS8TTPfpHyjE9G5vkdM7i9SY
	xlfviBCqcuZzFdB/9SlRfcQKWqcwCkEGtvUvcR2de4Rim2QWTtkGAu2/ZrHHoQDaPGwk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.14] build: -no-pie is no functional linker flag
Message-Id: <E1lUALd-0008Aq-GF@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 15:44:05 +0000

commit d7d6a60e73ee21e82f0bac2036153ccccf996e6c
Author:     Christian Ehrhardt <christian.ehrhardt@canonical.com>
AuthorDate: Mon Dec 14 16:09:38 2020 +0100
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Wed Apr 7 16:24:21 2021 +0100

    build: -no-pie is no functional linker flag
    
    Recent binutils changes dropping unsupported options [1] caused a build
    issue in regard to the optionroms.
    
      ld -m elf_i386 -T /<<PKGBUILDDIR>>/pc-bios/optionrom//flat.lds -no-pie \
        -s -o multiboot.img multiboot.o
      ld.bfd: Error: unable to disambiguate: -no-pie (did you mean --no-pie ?)
    
    This isn't really a regression in ld.bfd, filing the bug upstream
    revealed that this never worked as a ld flag [2] - in fact it seems we
    were by accident setting --nmagic).
    
    Since it never had the wanted effect this usage of LDFLAGS_NOPIE, should be
    droppable without any effect. This also is the only use-case of LDFLAGS_NOPIE
    in .mak, therefore we can also remove it from being added there.
    
    [1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=983d925d
    [2]: https://sourceware.org/bugzilla/show_bug.cgi?id=27050#c5
    
    Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
    Message-Id: <20201214150938.1297512-1-christian.ehrhardt@canonical.com>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit bbd2d5a8120771ec59b86a80a1f51884e0a26e53)
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 configure                  | 3 ---
 pc-bios/optionrom/Makefile | 4 ++--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 23b5e93752..c74f0910f7 100755
--- a/configure
+++ b/configure
@@ -2116,7 +2116,6 @@ EOF
 # Check we support --no-pie first; we will need this for building ROMs.
 if compile_prog "-Werror -fno-pie" "-no-pie"; then
   CFLAGS_NOPIE="-fno-pie"
-  LDFLAGS_NOPIE="-no-pie"
 fi
 
 if test "$static" = "yes"; then
@@ -2132,7 +2131,6 @@ if test "$static" = "yes"; then
   fi
 elif test "$pie" = "no"; then
   QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS"
-  QEMU_LDFLAGS="$LDFLAGS_NOPIE $QEMU_LDFLAGS"
 elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
   QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
   QEMU_LDFLAGS="-pie $QEMU_LDFLAGS"
@@ -7673,7 +7671,6 @@ if test "$sparse" = "yes" ; then
   echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
 fi
 echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
-echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
 echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
 echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
 echo "LIBS+=$LIBS" >> $config_host_mak
diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index e33a24da0d..bbb57ee138 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -47,10 +47,10 @@ build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
 	$(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@,"AS","$(TARGET_DIR)$@")
 
 pvh.img: pvh.o pvh_main.o
-	$(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $^,"BUILD","$(TARGET_DIR)$@")
+	$(call quiet-command,$(LD) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $^,"BUILD","$(TARGET_DIR)$@")
 
 %.img: %.o
-	$(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<,"BUILD","$(TARGET_DIR)$@")
+	$(call quiet-command,$(LD) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<,"BUILD","$(TARGET_DIR)$@")
 
 %.raw: %.img
 	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"BUILD","$(TARGET_DIR)$@")
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Apr 07 18:55:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Apr 2021 18:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.106904.204379 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUDKU-00012O-TC; Wed, 07 Apr 2021 18:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 106904.204379; Wed, 07 Apr 2021 18: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 1lUDKU-00012G-Ps; Wed, 07 Apr 2021 18:55:06 +0000
Received: by outflank-mailman (input) for mailman id 106904;
 Wed, 07 Apr 2021 18:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUDKT-00012B-FQ
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 18:55:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUDKT-0003c8-92
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 18:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUDKT-0001Vt-7q
 for xen-changelog@lists.xenproject.org; Wed, 07 Apr 2021 18:55:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ap+EAhVMtv8U/3RWIH9vInbqBKOuwZ8riraohdpzYeo=; b=WUZXwpmVTIdhy3wvNCjafOBCpo
	vw0U/3He3HmogCAb7ABYt9kts7fTh/DX5DSnfiSr4PVcbi4XW2ze81LafZIpzJBQeLyanFaflA2y8
	2LGWwUOHSb9TYr8t37Tr7j6I4VImBcmekbwIaxtpByj5e6ll5ujtQUToGefDJo1xdnes=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/page_alloc: Don't hold the heap_lock when clearing PGC_need_scrub
Message-Id: <E1lUDKT-0001Vt-7q@xenbits.xenproject.org>
Date: Wed, 07 Apr 2021 18:55:05 +0000

commit 025eacc13f6147ffa99da5ecee4ed96e7fe8e887
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Jan 21 11:12:00 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Apr 7 19:30:55 2021 +0100

    xen/page_alloc: Don't hold the heap_lock when clearing PGC_need_scrub
    
    Currently, the heap_lock is held when clearing PGC_need_scrub in
    alloc_heap_pages(). However, this is unnecessary because the only caller
    (mark_page_offline()) that can concurrently modify the count_info is
    using cmpxchg() in a loop.
    
    Therefore, rework the code to avoid holding the heap_lock and use
    test_and_clear_bit() instead.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/page_alloc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 1744e6faa5..ace6333c18 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1032,16 +1032,12 @@ static struct page_info *alloc_heap_pages(
     {
         for ( i = 0; i < (1U << order); i++ )
         {
-            if ( test_bit(_PGC_need_scrub, &pg[i].count_info) )
+            if ( test_and_clear_bit(_PGC_need_scrub, &pg[i].count_info) )
             {
                 if ( !(memflags & MEMF_no_scrub) )
                     scrub_one_page(&pg[i]);
 
                 dirty_cnt++;
-
-                spin_lock(&heap_lock);
-                pg[i].count_info &= ~PGC_need_scrub;
-                spin_unlock(&heap_lock);
             }
             else if ( !(memflags & MEMF_no_scrub) )
                 check_one_page(&pg[i]);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 08 10:55:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Apr 2021 10:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107167.204847 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUSJU-0003XA-8g; Thu, 08 Apr 2021 10:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107167.204847; Thu, 08 Apr 2021 10:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUSJU-0003X2-5W; Thu, 08 Apr 2021 10:55:04 +0000
Received: by outflank-mailman (input) for mailman id 107167;
 Thu, 08 Apr 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 1lUSJS-0003Wx-Sp
 for xen-changelog@lists.xenproject.org; Thu, 08 Apr 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 1lUSJS-0001Y9-PF
 for xen-changelog@lists.xenproject.org; Thu, 08 Apr 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 1lUSJS-0005u6-Na
 for xen-changelog@lists.xenproject.org; Thu, 08 Apr 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=jmPckvbbAYoqFEdU4HaKTtJVeqR7hylWOoSDbmgd7sc=; b=PSmdquiRWzfD2QddJhT8v0NUr5
	CdHDB0V6ucJAZqAl3a3tP0VO77hnHgpM7jzyeRMlTVrDJfiv8wU3Hv7Gcol3NXUVN0oDg7Kdt+d/C
	WEuYCJtCsf6eA+iR3TmujWtMddLAkiDH7yxiwZV/TjzlUvaA+xAUcErX4ION35hgJzHY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.14] build: -no-pie is no functional linker flag
Message-Id: <E1lUSJS-0005u6-Na@xenbits.xenproject.org>
Date: Thu, 08 Apr 2021 10:55:02 +0000

commit d7d6a60e73ee21e82f0bac2036153ccccf996e6c
Author:     Christian Ehrhardt <christian.ehrhardt@canonical.com>
AuthorDate: Mon Dec 14 16:09:38 2020 +0100
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Wed Apr 7 16:24:21 2021 +0100

    build: -no-pie is no functional linker flag
    
    Recent binutils changes dropping unsupported options [1] caused a build
    issue in regard to the optionroms.
    
      ld -m elf_i386 -T /<<PKGBUILDDIR>>/pc-bios/optionrom//flat.lds -no-pie \
        -s -o multiboot.img multiboot.o
      ld.bfd: Error: unable to disambiguate: -no-pie (did you mean --no-pie ?)
    
    This isn't really a regression in ld.bfd, filing the bug upstream
    revealed that this never worked as a ld flag [2] - in fact it seems we
    were by accident setting --nmagic).
    
    Since it never had the wanted effect this usage of LDFLAGS_NOPIE, should be
    droppable without any effect. This also is the only use-case of LDFLAGS_NOPIE
    in .mak, therefore we can also remove it from being added there.
    
    [1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=983d925d
    [2]: https://sourceware.org/bugzilla/show_bug.cgi?id=27050#c5
    
    Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
    Message-Id: <20201214150938.1297512-1-christian.ehrhardt@canonical.com>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit bbd2d5a8120771ec59b86a80a1f51884e0a26e53)
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 configure                  | 3 ---
 pc-bios/optionrom/Makefile | 4 ++--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 23b5e93752..c74f0910f7 100755
--- a/configure
+++ b/configure
@@ -2116,7 +2116,6 @@ EOF
 # Check we support --no-pie first; we will need this for building ROMs.
 if compile_prog "-Werror -fno-pie" "-no-pie"; then
   CFLAGS_NOPIE="-fno-pie"
-  LDFLAGS_NOPIE="-no-pie"
 fi
 
 if test "$static" = "yes"; then
@@ -2132,7 +2131,6 @@ if test "$static" = "yes"; then
   fi
 elif test "$pie" = "no"; then
   QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS"
-  QEMU_LDFLAGS="$LDFLAGS_NOPIE $QEMU_LDFLAGS"
 elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
   QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
   QEMU_LDFLAGS="-pie $QEMU_LDFLAGS"
@@ -7673,7 +7671,6 @@ if test "$sparse" = "yes" ; then
   echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
 fi
 echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
-echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
 echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
 echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
 echo "LIBS+=$LIBS" >> $config_host_mak
diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index e33a24da0d..bbb57ee138 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -47,10 +47,10 @@ build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
 	$(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@,"AS","$(TARGET_DIR)$@")
 
 pvh.img: pvh.o pvh_main.o
-	$(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $^,"BUILD","$(TARGET_DIR)$@")
+	$(call quiet-command,$(LD) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $^,"BUILD","$(TARGET_DIR)$@")
 
 %.img: %.o
-	$(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<,"BUILD","$(TARGET_DIR)$@")
+	$(call quiet-command,$(LD) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<,"BUILD","$(TARGET_DIR)$@")
 
 %.raw: %.img
 	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"BUILD","$(TARGET_DIR)$@")
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:33:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107642.205682 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUldb-0002in-9S; Fri, 09 Apr 2021 07:33:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107642.205682; Fri, 09 Apr 2021 07:33:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUldb-0002if-6Y; Fri, 09 Apr 2021 07:33:07 +0000
Received: by outflank-mailman (input) for mailman id 107642;
 Fri, 09 Apr 2021 07:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUldZ-0002ia-Ga
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:33:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUldZ-0004Fa-9w
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUldZ-0004W3-8l
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ix1O3p/KpnpRgXGgQI7e2u1OIYgbwCPTDCSlkWRbzCM=; b=zSYFUbaH+MPQF2pH82YHrIkf+y
	Ub0K/dWoDXg3dOTfBsYqluIHHDu7BFt7i05FZOpizmQGkN8UXMyeO5aQvZz7sfoUzLze0sgMYGpMh
	9Rs6bu98J2LIy21CGIex/f2STXW73eZykhlLaHwIh07p08tQnXTXydQmcSESJ2bH+VXg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: refine guest_mode()
Message-Id: <E1lUldZ-0004W3-8l@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:33:05 +0000

commit dfcf494f96671a9d3ee2fed70250ef1eedc1c00e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:12:51 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:12:51 2021 +0200

    x86: refine guest_mode()
    
    The 2nd of the assertions as well as the macro's return value have been
    assuming we're on the primary stack. While for most IST exceptions we
    switch back to the main one when user mode was interrupted, for #DF we
    intentionally never do, and hence a #DF actually triggering on a user
    mode insn (which then is still a Xen bug) would in turn trigger this
    assertion, rather than cleanly logging state.
    
    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>
---
 xen/include/asm-x86/regs.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/include/asm-x86/regs.h b/xen/include/asm-x86/regs.h
index 8d984ea388..3fb94deedc 100644
--- a/xen/include/asm-x86/regs.h
+++ b/xen/include/asm-x86/regs.h
@@ -10,9 +10,10 @@
     /* Frame pointer must point into current CPU stack. */                    \
     ASSERT(diff < STACK_SIZE);                                                \
     /* If not a guest frame, it must be a hypervisor frame. */                \
-    ASSERT((diff == 0) || (r->cs == __HYPERVISOR_CS));                        \
+    if ( diff < PRIMARY_STACK_SIZE )                                          \
+        ASSERT(!diff || ((r)->cs == __HYPERVISOR_CS));                        \
     /* Return TRUE if it's a guest frame. */                                  \
-    (diff == 0);                                                              \
+    !diff || ((r)->cs != __HYPERVISOR_CS);                                    \
 })
 
 #define read_sreg(name) ({                           \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:33:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:33:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107643.205687 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUldl-0002jq-B0; Fri, 09 Apr 2021 07:33:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107643.205687; Fri, 09 Apr 2021 07:33:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUldl-0002ji-80; Fri, 09 Apr 2021 07:33:17 +0000
Received: by outflank-mailman (input) for mailman id 107643;
 Fri, 09 Apr 2021 07:33:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUldj-0002jb-Eb
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:33:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUldj-0004Fd-Dl
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUldj-0004We-CO
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:33:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aUxMW03MQOILwFxI4d7Yu6jPCuICOZAtI+qvMdOccow=; b=cqOot2CKGqr8y+cyLX8p6a9pfM
	LjnXh4/cmloH82Xw704qSOCamHaiLdQjiMIx0YUyl1FP2ge1thTG5QmK+iAfxUUyFioE8yHKVDWYo
	6gUt4SweRuQGWRKWyWz4E+nJHlP5wR1nEcwKxvAddDPi1K3UR6MKA2ifDG9nZHR049WI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/CPUID: move some static masks into .init
Message-Id: <E1lUldj-0004We-CO@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:33:15 +0000

commit 186b09ea01c925c3997f1a05f585b35151d32d1a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:14:25 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:14:25 2021 +0200

    x86/CPUID: move some static masks into .init
    
    Except for hvm_shadow_max_featuremask and deep_features they're
    referenced by __init functions only.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpuid.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index dde3e95284..18b08d9b87 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -16,12 +16,15 @@
 const uint32_t known_features[] = INIT_KNOWN_FEATURES;
 const uint32_t special_features[] = INIT_SPECIAL_FEATURES;
 
-static const uint32_t pv_max_featuremask[] = INIT_PV_MAX_FEATURES;
+static const uint32_t __initconst pv_max_featuremask[] = INIT_PV_MAX_FEATURES;
 static const uint32_t hvm_shadow_max_featuremask[] = INIT_HVM_SHADOW_MAX_FEATURES;
-static const uint32_t hvm_hap_max_featuremask[] = INIT_HVM_HAP_MAX_FEATURES;
-static const uint32_t pv_def_featuremask[] = INIT_PV_DEF_FEATURES;
-static const uint32_t hvm_shadow_def_featuremask[] = INIT_HVM_SHADOW_DEF_FEATURES;
-static const uint32_t hvm_hap_def_featuremask[] = INIT_HVM_HAP_DEF_FEATURES;
+static const uint32_t __initconst hvm_hap_max_featuremask[] =
+    INIT_HVM_HAP_MAX_FEATURES;
+static const uint32_t __initconst pv_def_featuremask[] = INIT_PV_DEF_FEATURES;
+static const uint32_t __initconst hvm_shadow_def_featuremask[] =
+    INIT_HVM_SHADOW_DEF_FEATURES;
+static const uint32_t __initconst hvm_hap_def_featuremask[] =
+    INIT_HVM_HAP_DEF_FEATURES;
 static const uint32_t deep_features[] = INIT_DEEP_FEATURES;
 
 static int __init parse_xen_cpuid(const char *s)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:33:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:33:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107644.205691 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUldv-0002ky-Ch; Fri, 09 Apr 2021 07:33:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107644.205691; Fri, 09 Apr 2021 07:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUldv-0002kr-9a; Fri, 09 Apr 2021 07:33:27 +0000
Received: by outflank-mailman (input) for mailman id 107644;
 Fri, 09 Apr 2021 07: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 1lUldt-0002kh-J6
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07: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 1lUldt-0004Fz-IK
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUldt-0004XD-G9
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:33:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aSnsHNfpumFMR95jH7ZHId/QNbMjETRVNyIvjHxIfO4=; b=eqV2+5mqeNHbzBKFHoPJNT4YGL
	2xDbIvt9Ln+NPHbFbCmxXYOdfd6LmVhBn+toP03v2v5i09HEN3tiOdOBF3i4sBx/cDY8Hb52DMxtZ
	TtxVWjghJCX8Fl4Q7lWEYTuONmR6oKsUL/+RJ7oP7DOp4gWEWG1v7jYtakD7qtVVwnfw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxg: don't use max policy in xc_cpuid_xend_policy()
Message-Id: <E1lUldt-0004XD-G9@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:33:25 +0000

commit d0d1003b97279f88232d6ec7a406d3cf58c71327
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:14:58 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:14:58 2021 +0200

    libxg: don't use max policy in xc_cpuid_xend_policy()
    
    using max undermines the separation between default and max. For
    example, turning off AVX512F on an MPX-capable system silently turns on
    MPX, despite this not being part of the default policy anymore. Since
    the information is used only for determining what to convert 'x' to (but
    not to e.g. validate '1' settings), the effect of this change is
    identical for guests with (suitable) "cpuid=" settings to that of the
    changes separating default from max and then converting (e.g.) MPX from
    being part of default to only being part of max for guests without
    (affected) "cpuid=" settings.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/guest/xg_cpuid_x86.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index aae6931a11..5ea69ad3d5 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -288,11 +288,11 @@ static int xc_cpuid_xend_policy(
     unsigned int nr_leaves, nr_msrs;
     uint32_t err_leaf = -1, err_subleaf = -1, err_msr = -1;
     /*
-     * Three full policies.  The host, domain max, and domain current for the
-     * domain type.
+     * Three full policies.  The host, default for the domain type,
+     * and domain current.
      */
-    xen_cpuid_leaf_t *host = NULL, *max = NULL, *cur = NULL;
-    unsigned int nr_host, nr_max, nr_cur;
+    xen_cpuid_leaf_t *host = NULL, *def = NULL, *cur = NULL;
+    unsigned int nr_host, nr_def, nr_cur;
 
     if ( xc_domain_getinfo(xch, domid, 1, &di) != 1 ||
          di.domid != domid )
@@ -312,7 +312,7 @@ static int xc_cpuid_xend_policy(
 
     rc = -ENOMEM;
     if ( (host = calloc(nr_leaves, sizeof(*host))) == NULL ||
-         (max  = calloc(nr_leaves, sizeof(*max)))  == NULL ||
+         (def  = calloc(nr_leaves, sizeof(*def)))  == NULL ||
          (cur  = calloc(nr_leaves, sizeof(*cur)))  == NULL )
     {
         ERROR("Unable to allocate memory for %u CPUID leaves", nr_leaves);
@@ -330,15 +330,16 @@ static int xc_cpuid_xend_policy(
         goto fail;
     }
 
-    /* Get the domain's max policy. */
+    /* Get the domain type's default policy. */
     nr_msrs = 0;
-    nr_max = nr_leaves;
-    rc = xc_get_system_cpu_policy(xch, di.hvm ? XEN_SYSCTL_cpu_policy_hvm_max
-                                              : XEN_SYSCTL_cpu_policy_pv_max,
-                                  &nr_max, max, &nr_msrs, NULL);
+    nr_def = nr_leaves;
+    rc = xc_get_system_cpu_policy(xch,
+                                  di.hvm ? XEN_SYSCTL_cpu_policy_hvm_default
+                                         : XEN_SYSCTL_cpu_policy_pv_default,
+                                  &nr_def, def, &nr_msrs, NULL);
     if ( rc )
     {
-        PERROR("Failed to obtain %s max policy", di.hvm ? "hvm" : "pv");
+        PERROR("Failed to obtain %s def policy", di.hvm ? "hvm" : "pv");
         rc = -errno;
         goto fail;
     }
@@ -359,10 +360,10 @@ static int xc_cpuid_xend_policy(
     for ( ; xend->leaf != XEN_CPUID_INPUT_UNUSED; ++xend )
     {
         xen_cpuid_leaf_t *cur_leaf = find_leaf(cur, nr_cur, xend);
-        const xen_cpuid_leaf_t *max_leaf = find_leaf(max, nr_max, xend);
+        const xen_cpuid_leaf_t *def_leaf = find_leaf(def, nr_def, xend);
         const xen_cpuid_leaf_t *host_leaf = find_leaf(host, nr_host, xend);
 
-        if ( cur_leaf == NULL || max_leaf == NULL || host_leaf == NULL )
+        if ( cur_leaf == NULL || def_leaf == NULL || host_leaf == NULL )
         {
             ERROR("Missing leaf %#x, subleaf %#x", xend->leaf, xend->subleaf);
             goto fail;
@@ -371,7 +372,7 @@ static int xc_cpuid_xend_policy(
         for ( unsigned int i = 0; i < ARRAY_SIZE(xend->policy); i++ )
         {
             uint32_t *cur_reg = &cur_leaf->a + i;
-            const uint32_t *max_reg = &max_leaf->a + i;
+            const uint32_t *def_reg = &def_leaf->a + i;
             const uint32_t *host_reg = &host_leaf->a + i;
 
             if ( xend->policy[i] == NULL )
@@ -386,7 +387,7 @@ static int xc_cpuid_xend_policy(
                 else if ( xend->policy[i][j] == '0' )
                     val = false;
                 else if ( xend->policy[i][j] == 'x' )
-                    val = test_bit(31 - j, max_reg);
+                    val = test_bit(31 - j, def_reg);
                 else if ( xend->policy[i][j] == 'k' ||
                           xend->policy[i][j] == 's' )
                     val = test_bit(31 - j, host_reg);
@@ -419,7 +420,7 @@ static int xc_cpuid_xend_policy(
 
  fail:
     free(cur);
-    free(max);
+    free(def);
     free(host);
 
     return rc;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:33:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:33:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107645.205695 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUle5-0002ma-Eb; Fri, 09 Apr 2021 07:33:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107645.205695; Fri, 09 Apr 2021 07:33:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUle5-0002mO-BJ; Fri, 09 Apr 2021 07:33:37 +0000
Received: by outflank-mailman (input) for mailman id 107645;
 Fri, 09 Apr 2021 07: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 1lUle3-0002mE-Mv
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07: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 1lUle3-0004G6-M3
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:33:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUle3-0004Xv-Kg
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07: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=kRQcmslxexRn0w5N5TzkH04LVHoflm1ilEjSJNzuAoA=; b=COt7bCZKLo7oZw/9dHCANu6H+T
	/gHg46ZuMNhN20YUFMjjlCERzpBTOybfSmnYdOkM3ZzUCNVLgTwgaBChVgAVBE0RSnPpeTsx252kh
	ogbhiwpasKPswsAnuD+JKuDjVZIGn9RSC10bbucvqIGmuYpw/I65IPTYhY1gIdP7INOc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/PV: make post-migration page state consistent
Message-Id: <E1lUle3-0004Xv-Kg@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:33:35 +0000

commit 0a87e677f4f4527c439fa12a6d7fa44a28e43cb3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:15:38 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:15:38 2021 +0200

    x86/PV: make post-migration page state consistent
    
    When a page table page gets de-validated, its type reference count drops
    to zero (and PGT_validated gets cleared), but its type remains intact.
    XEN_DOMCTL_getpageframeinfo3, therefore, so far reported prior usage for
    such pages. An intermediate write to such a page via e.g.
    MMU_NORMAL_PT_UPDATE, however, would transition the page's type to
    PGT_writable_page, thus altering what XEN_DOMCTL_getpageframeinfo3 would
    return. In libxc the decision which pages to normalize / localize
    depends solely on the type returned from the domctl. As a result without
    further precautions the guest won't be able to tell whether such a page
    has had its (apparent) PTE entries transitioned to the new MFNs.
    
    Add a check of PGT_validated, thus consistently avoiding normalization /
    localization in the tool stack.
    
    Also use XEN_DOMCTL_PFINFO_NOTAB in the variable's initializer instead
    open coding it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/domctl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index b129d2cc2f..2aea5b6e9a 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -262,7 +262,7 @@ long arch_do_domctl(
 
         for ( i = 0; i < num; ++i )
         {
-            unsigned long gfn = 0, type = 0;
+            unsigned long gfn = 0, type = XEN_DOMCTL_PFINFO_NOTAB;
             struct page_info *page;
             p2m_type_t t;
 
@@ -302,6 +302,8 @@ long arch_do_domctl(
 
                 if ( page->u.inuse.type_info & PGT_pinned )
                     type |= XEN_DOMCTL_PFINFO_LPINTAB;
+                else if ( !(page->u.inuse.type_info & PGT_validated) )
+                    type = XEN_DOMCTL_PFINFO_NOTAB;
 
                 if ( page->count_info & PGC_broken )
                     type = XEN_DOMCTL_PFINFO_BROKEN;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:33:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:33:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107646.205699 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUleF-0002no-Fs; Fri, 09 Apr 2021 07:33:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107646.205699; Fri, 09 Apr 2021 07:33:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUleF-0002nh-Ct; Fri, 09 Apr 2021 07:33:47 +0000
Received: by outflank-mailman (input) for mailman id 107646;
 Fri, 09 Apr 2021 07: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 1lUleD-0002nY-QY
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07: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 1lUleD-0004GK-Pi
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:33:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUleD-0004Yp-OV
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07: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=k/aKiUwGI+Mgu4YkwUW4xM1It9NFpGSjCFZHEg4Ymxg=; b=UuFWH/c1mxLZrmDbtcj8TUrpRR
	UhAk28V897b20sd5+Ht85ep4f/re85J+OOvZbydDtYPBrv8J7z1qBR025QjfetyntIl8l3fCE8ifl
	H9T73BowiTQRFMGUo2erfBYs+OS9d0kGjEWbluoddpPI9hHcMHu6Ijon5q6lVG+JQ/ak=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: guard against straight-line speculation past RET
Message-Id: <E1lUleD-0004Yp-OV@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:33:45 +0000

commit 71b0b475d801ebeb83a6ba402425135c314fa2df
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:16:22 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:16:22 2021 +0200

    x86: guard against straight-line speculation past RET
    
    Under certain conditions CPUs can speculate into the instruction stream
    past a RET instruction. Guard against this just like 3b7dab93f240
    ("x86/spec-ctrl: Protect against CALL/JMP straight-line speculation")
    did - by inserting an "INT $3" insn. It's merely the mechanics of how to
    achieve this that differ: A set of macros gets introduced to post-
    process RET insns issued by the compiler (or living in assembly files).
    
    Unfortunately for clang this requires further features their built-in
    assembler doesn't support: We need to be able to override insn mnemonics
    produced by the compiler (which may be impossible, if internally
    assembly mnemonics never get generated).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/Makefile                    |  5 ++++-
 xen/include/asm-x86/asm-defns.h | 16 ++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 9f3be7766d..3a8fb7ec7e 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -145,7 +145,10 @@ t2 = $(call as-insn,$(CC) -I$(BASEDIR)/include,".include \"asm-x86/asm-defns.h\"
 # https://bugs.llvm.org/show_bug.cgi?id=36110
 t3 = $(call as-insn,$(CC),".macro FOO;.endm"$(close); asm volatile $(open)".macro FOO;.endm",-no-integrated-as)
 
-CLANG_FLAGS += $(call or,$(t1),$(t2),$(t3))
+# Check whether macros can override insn mnemonics in inline assembly.
+t4 = $(call as-insn,$(CC),".macro ret; .error; .endm; .macro retq; .error; .endm",-no-integrated-as)
+
+CLANG_FLAGS += $(call or,$(t1),$(t2),$(t3),$(t4))
 endif
 
 CLANG_FLAGS += -Werror=unknown-warning-option
diff --git a/xen/include/asm-x86/asm-defns.h b/xen/include/asm-x86/asm-defns.h
index 505f39ad5f..e164437798 100644
--- a/xen/include/asm-x86/asm-defns.h
+++ b/xen/include/asm-x86/asm-defns.h
@@ -57,6 +57,22 @@
     INDIRECT_BRANCH jmp \arg
 .endm
 
+/*
+ * To guard against speculation past RET, insert a breakpoint insn
+ * immediately after them.
+ */
+.macro ret operand:vararg
+    retq \operand
+.endm
+.macro retq operand:vararg
+    .ifb \operand
+    .byte 0xc3
+    .else
+    .byte 0xc2
+    .word \operand
+    .endif
+.endm
+
 .macro guest_access_mask_ptr ptr:req, scratch1:req, scratch2:req
 #if defined(CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS)
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:33:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:33:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107647.205703 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUleP-0002pB-Hl; Fri, 09 Apr 2021 07:33:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107647.205703; Fri, 09 Apr 2021 07: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 1lUleP-0002p3-Ed; Fri, 09 Apr 2021 07:33:57 +0000
Received: by outflank-mailman (input) for mailman id 107647;
 Fri, 09 Apr 2021 07: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 1lUleN-0002ox-UG
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07: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 1lUleN-0004GW-TM
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:33:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUleN-0004ZR-S1
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07: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=cLttgMiDRsaCdQ1Jy5S20jZHLJbLN0lYt65BLgVPV+U=; b=AuPQbdWlyc0qdf2ufuFbuvbKn7
	WGu5nAiEzc9Vm8otTd5MpzhNVXKrcX5+MbwI/WTsxGFlv7k8lOmLToGU0JEdn96EgYDEtr1HK0dpb
	KMcVmhdCAGFBaRm2U1qtlTxfvqWh6moSH8qGhuY2LZ5Ovzg0FnIlmlL1EIIDXXkam90E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: limit amount of INT3 in IND_THUNK_*
Message-Id: <E1lUleN-0004ZR-S1@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:33:55 +0000

commit 9689b1acab71adc2bcc07b3e23c141907dd9ecb8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:17:04 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:17:04 2021 +0200

    x86: limit amount of INT3 in IND_THUNK_*
    
    There's no point having every replacement variant to also specify the
    INT3 - just have it once in the base macro. When patching, NOPs will get
    inserted, which are fine to speculate through (until reaching the INT3).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/indirect-thunk.S | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/indirect-thunk.S b/xen/arch/x86/indirect-thunk.S
index 7392aee127..a090b35dcf 100644
--- a/xen/arch/x86/indirect-thunk.S
+++ b/xen/arch/x86/indirect-thunk.S
@@ -11,6 +11,9 @@
 
 #include <asm/asm_defns.h>
 
+/* Don't transform the "ret" further down. */
+.purgem ret
+
 .macro IND_THUNK_RETPOLINE reg:req
         call 2f
 1:
@@ -24,12 +27,10 @@
 .macro IND_THUNK_LFENCE reg:req
         lfence
         jmp *%\reg
-        int3 /* Halt straight-line speculation */
 .endm
 
 .macro IND_THUNK_JMP reg:req
         jmp *%\reg
-        int3 /* Halt straight-line speculation */
 .endm
 
 /*
@@ -44,6 +45,8 @@ ENTRY(__x86_indirect_thunk_\reg)
         __stringify(IND_THUNK_LFENCE \reg), X86_FEATURE_IND_THUNK_LFENCE, \
         __stringify(IND_THUNK_JMP \reg),    X86_FEATURE_IND_THUNK_JMP
 
+        int3 /* Halt straight-line speculation */
+
         .size __x86_indirect_thunk_\reg, . - __x86_indirect_thunk_\reg
         .type __x86_indirect_thunk_\reg, @function
 .endm
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:34:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:34:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107648.205706 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUleZ-0002qM-JV; Fri, 09 Apr 2021 07:34:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107648.205706; Fri, 09 Apr 2021 07:34:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUleZ-0002qE-GA; Fri, 09 Apr 2021 07:34:07 +0000
Received: by outflank-mailman (input) for mailman id 107648;
 Fri, 09 Apr 2021 07:34:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUleY-0002q5-32
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:34:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUleY-0004Gr-1T
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:34:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUleX-0004af-W3
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07: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=dpJl5BOmOI6upqhmlWQKrKcrwJXzxN4zKuAVehiaGMg=; b=T1twO2qpbCFIReOIG8PBeuvWQW
	VKmOFaoVckNQVmu0FtYE1n9UTB0ZXsMqC1eq9ByphCnnymM7Q8C9YLzWIilA6d0BVB15SSSIpKXSh
	ZsL3hMsSEmyoVpOgn+DsX0WsXNuMtVJ70lMN4aVrVV6JFtk1vs5/ICRsbbXoDgTPVJdc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/PV: _PAGE_RW changes may take fast path of mod_l[234]_entry()
Message-Id: <E1lUleX-0004af-W3@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:34:05 +0000

commit 64581e5ade68bca185ea8b1be0f50fdcbe39205c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:18:17 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:18:17 2021 +0200

    x86/PV: _PAGE_RW changes may take fast path of mod_l[234]_entry()
    
    The only time _PAGE_RW matters when validating an L2 or higher entry is
    when a linear page table is tried to be installed (see the comment ahead
    of define_get_linear_pagetable()). Therefore when we disallow such at
    build time, we can allow _PAGE_RW changes to take the fast paths there.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index afb4febf6f..7be0338cb6 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -2143,6 +2143,18 @@ static void l3t_unlock(struct page_info *page)
     (_PAGE_NX_BIT | _PAGE_AVAIL_HIGH | _PAGE_AVAIL | _PAGE_GLOBAL | \
      _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_USER)
 
+/*
+ * PDE flags that a guest may change without re-validating the PDE.
+ * All other bits affect translation, caching, or Xen's safety. When guest
+ * created linear page tables aren't allowed, intermediate page tables may
+ * have _PAGE_RW altered without this requiring re-validation.
+ */
+#ifndef CONFIG_PV_LINEAR_PT
+# define FASTPATH_PDE_FLAG_WHITELIST (FASTPATH_FLAG_WHITELIST | _PAGE_RW)
+#else
+# define FASTPATH_PDE_FLAG_WHITELIST FASTPATH_FLAG_WHITELIST
+#endif
+
 /* Update the L1 entry at pl1e to new value nl1e. */
 static int mod_l1_entry(l1_pgentry_t *pl1e, l1_pgentry_t nl1e,
                         mfn_t gl1mfn, unsigned int cmd,
@@ -2285,7 +2297,7 @@ static int mod_l2_entry(l2_pgentry_t *pl2e,
         nl2e = adjust_guest_l2e(nl2e, d);
 
         /* Fast path for sufficiently-similar mappings. */
-        if ( !l2e_has_changed(ol2e, nl2e, ~FASTPATH_FLAG_WHITELIST) )
+        if ( !l2e_has_changed(ol2e, nl2e, ~FASTPATH_PDE_FLAG_WHITELIST) )
         {
             if ( UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, mfn, vcpu, preserve_ad) )
                 return 0;
@@ -2347,7 +2359,7 @@ static int mod_l3_entry(l3_pgentry_t *pl3e,
         nl3e = adjust_guest_l3e(nl3e, d);
 
         /* Fast path for sufficiently-similar mappings. */
-        if ( !l3e_has_changed(ol3e, nl3e, ~FASTPATH_FLAG_WHITELIST) )
+        if ( !l3e_has_changed(ol3e, nl3e, ~FASTPATH_PDE_FLAG_WHITELIST) )
         {
             rc = UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, mfn, vcpu, preserve_ad);
             return rc ? 0 : -EFAULT;
@@ -2409,7 +2421,7 @@ static int mod_l4_entry(l4_pgentry_t *pl4e,
         nl4e = adjust_guest_l4e(nl4e, d);
 
         /* Fast path for sufficiently-similar mappings. */
-        if ( !l4e_has_changed(ol4e, nl4e, ~FASTPATH_FLAG_WHITELIST) )
+        if ( !l4e_has_changed(ol4e, nl4e, ~FASTPATH_PDE_FLAG_WHITELIST) )
         {
             rc = UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, mfn, vcpu, preserve_ad);
             return rc ? 0 : -EFAULT;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:34:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:34:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107649.205711 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUlei-0002s9-Mc; Fri, 09 Apr 2021 07:34:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107649.205711; Fri, 09 Apr 2021 07:34: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 1lUlei-0002s1-JP; Fri, 09 Apr 2021 07:34:16 +0000
Received: by outflank-mailman (input) for mailman id 107649;
 Fri, 09 Apr 2021 07:34:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlei-0002rw-6H
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:34:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlei-0004Gz-5F
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:34:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlei-0004bh-4U
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:34:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Q8g+o8D99z0p0JIkXQXAu1ZoN0Y1mug0YPeImihedtg=; b=5iFhjYctHFWCWxWPiOA++fTSBf
	qcabLwbpF/fUxAyDdaMnyZdghVxW9mKFpxX0NsJq8W1Kgay3SAzDFQUSEoQXXuqPO4kzZ9Gx2SF4g
	ZUa3oD6xBLnJ7GWApEySKY2SZlaSQfk5S6TDGyuO4Xnl9N5Um4l8KvqlEAPGY9nyLDYQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/PV: restrict TLB flushing after mod_l[234]_entry()
Message-Id: <E1lUlei-0004bh-4U@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:34:16 +0000

commit edcfce55917bb412f986d7b28358f6ef155b3664
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:18:51 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:18:51 2021 +0200

    x86/PV: restrict TLB flushing after mod_l[234]_entry()
    
    Just like we avoid to invoke remote root pt flushes when all uses of an
    L4 table can be accounted for locally, the same can be done for all of
    L[234] for the linear pt flush when the table is a "free floating" one,
    i.e. it is pinned but not hooked up anywhere. While this situation
    doesn't occur very often, it can be observed.
    
    Since this breaks one of the implications of the XSA-286 fix, drop the
    flush_root_pt_local variable again and set ->root_pgt_changed directly,
    just like it was before that change.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 7be0338cb6..44e4c4cf1f 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -3906,8 +3906,7 @@ long do_mmu_update(
     struct vcpu *curr = current, *v = curr;
     struct domain *d = v->domain, *pt_owner = d, *pg_owner;
     mfn_t map_mfn = INVALID_MFN, mfn;
-    bool flush_linear_pt = false, flush_root_pt_local = false,
-        flush_root_pt_others = false;
+    bool flush_linear_pt = false, flush_root_pt_others = false;
     uint32_t xsm_needed = 0;
     uint32_t xsm_checked = 0;
     int rc = put_old_guest_table(curr);
@@ -4057,7 +4056,9 @@ long do_mmu_update(
                         break;
                     rc = mod_l2_entry(va, l2e_from_intpte(req.val), mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
-                    if ( !rc )
+                    if ( !rc &&
+                         (page->u.inuse.type_info & PGT_count_mask) >
+                         1 + !!(page->u.inuse.type_info & PGT_pinned) )
                         flush_linear_pt = true;
                     break;
 
@@ -4066,7 +4067,9 @@ long do_mmu_update(
                         break;
                     rc = mod_l3_entry(va, l3e_from_intpte(req.val), mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
-                    if ( !rc )
+                    if ( !rc &&
+                         (page->u.inuse.type_info & PGT_count_mask) >
+                         1 + !!(page->u.inuse.type_info & PGT_pinned) )
                         flush_linear_pt = true;
                     break;
 
@@ -4075,7 +4078,9 @@ long do_mmu_update(
                         break;
                     rc = mod_l4_entry(va, l4e_from_intpte(req.val), mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
-                    if ( !rc )
+                    if ( !rc &&
+                         (page->u.inuse.type_info & PGT_count_mask) >
+                         1 + !!(page->u.inuse.type_info & PGT_pinned) )
                         flush_linear_pt = true;
                     if ( !rc && pt_owner->arch.pv.xpti )
                     {
@@ -4085,7 +4090,7 @@ long do_mmu_update(
                                     mfn) )
                         {
                             local_in_use = true;
-                            flush_root_pt_local = true;
+                            get_cpu_info()->root_pgt_changed = true;
                         }
 
                         /*
@@ -4202,8 +4207,8 @@ long do_mmu_update(
     /*
      * Perform required TLB maintenance.
      *
-     * This logic currently depend on flush_linear_pt being a superset of the
-     * flush_root_pt_* conditions.
+     * This logic currently depends on flush_linear_pt being a superset of the
+     * flush_root_pt_others condition.
      *
      * pt_owner may not be current->domain.  This may occur during
      * construction of 32bit PV guests, or debugging of PV guests.  The
@@ -4222,7 +4227,7 @@ long do_mmu_update(
      * pt_owner->dirty_cpumask), and/or all *other* dirty CPUs as there are
      * references we can't account for locally.
      */
-    if ( flush_linear_pt /* || flush_root_pt_local || flush_root_pt_others */ )
+    if ( flush_linear_pt /* || flush_root_pt_others */ )
     {
         unsigned int cpu = smp_processor_id();
         cpumask_t *mask = pt_owner->dirty_cpumask;
@@ -4239,12 +4244,8 @@ long do_mmu_update(
             cpumask_copy(mask, pt_owner->dirty_cpumask);
             __cpumask_clear_cpu(cpu, mask);
 
-            flush_local(FLUSH_TLB |
-                        (flush_root_pt_local ? FLUSH_ROOT_PGTBL : 0));
+            flush_local(FLUSH_TLB);
         }
-        else
-            /* Sanity check.  flush_root_pt_local implies local cpu is dirty. */
-            ASSERT(!flush_root_pt_local);
 
         /* Flush the remote dirty CPUs.  Does not include the local CPU. */
         if ( !cpumask_empty(mask) )
@@ -4252,8 +4253,8 @@ long do_mmu_update(
                        (flush_root_pt_others ? FLUSH_ROOT_PGTBL : 0));
     }
     else
-        /* Sanity check.  flush_root_pt_* implies flush_linear_pt. */
-        ASSERT(!flush_root_pt_local && !flush_root_pt_others);
+        /* Sanity check.  flush_root_pt_others implies flush_linear_pt. */
+        ASSERT(!flush_root_pt_others);
 
     perfc_add(num_page_updates, i);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:34:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:34:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107650.205715 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUles-0002v6-O5; Fri, 09 Apr 2021 07:34:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107650.205715; Fri, 09 Apr 2021 07:34: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 1lUles-0002uy-L8; Fri, 09 Apr 2021 07:34:26 +0000
Received: by outflank-mailman (input) for mailman id 107650;
 Fri, 09 Apr 2021 07: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 1lUles-0002um-9u
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07: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 1lUles-0004HQ-94
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:34:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUles-0004cg-8B
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07: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=EesjsiuWQi30QxsBOWNeXPdKStXiB5II9OV771OKW+E=; b=ILglvmiI7AUULU4kqYk+1XPBOC
	a+qdUco3TxQC0j66i6BXrr3jjNY2aNTzVBtaeEpbMjrd0jyZCT5oXP5Zb25D1nwwjLS8H/hGbIXHZ
	geyEi11YX9FMgxvwxsFUtf6Y9233D94LvvTTIls5MUI6g9nEgmlru16tslqgiI85XwKM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/PV32: avoid TLB flushing after mod_l3_entry()
Message-Id: <E1lUles-0004cg-8B@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:34:26 +0000

commit bed7e6cad30ec8db0c9ce9a1676856e9dc4c39da
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:19:18 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:19:18 2021 +0200

    x86/PV32: avoid TLB flushing after mod_l3_entry()
    
    32-bit guests may not depend upon the side effect of using ordinary
    4-level paging when running on a 64-bit hypervisor. For L3 entry updates
    to take effect, they have to use a CR3 reload. Therefore there's no need
    to issue a paging structure invalidating TLB flush in this case.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 44e4c4cf1f..69d04ad809 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4069,7 +4069,8 @@ long do_mmu_update(
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
                     if ( !rc &&
                          (page->u.inuse.type_info & PGT_count_mask) >
-                         1 + !!(page->u.inuse.type_info & PGT_pinned) )
+                         1 + !!(page->u.inuse.type_info & PGT_pinned) &&
+                         !is_pv_32bit_domain(pt_owner) )
                         flush_linear_pt = true;
                     break;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:34:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:34:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107651.205719 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUlf3-0002wP-Pe; Fri, 09 Apr 2021 07:34:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107651.205719; Fri, 09 Apr 2021 07: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 1lUlf3-0002wH-Mc; Fri, 09 Apr 2021 07:34:37 +0000
Received: by outflank-mailman (input) for mailman id 107651;
 Fri, 09 Apr 2021 07: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 1lUlf2-0002w7-DP
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07: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 1lUlf2-0004HY-CZ
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:34:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlf2-0004dQ-Bg
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07: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=gB92fv0YemXN4+CBfJmyvnQPiYqRqkrqKV54xGOrsok=; b=mTY8aHcOFrZW96wTq2m7p8IQYw
	n5vVLbR+86NlsOjow2cHXzTevbJKP9nlrhyPEEQjJbK08JdcKuAnMOL3GT8uPeUo+kWKr5ejdycKB
	2AtADeVxwguVp6zKPdqo/SHkF9iMA4DcR6H7e49D8hr6PYJSlsB85gMSW1tW9If0Qu2A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: encode full GFN in magic MMIO entries
Message-Id: <E1lUlf2-0004dQ-Bg@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:34:36 +0000

commit e113ed7134118757980a1d12837fa0f118f81a05
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:20:15 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:20:15 2021 +0200

    x86/shadow: encode full GFN in magic MMIO entries
    
    Since we don't need to encode all of the PTE flags, we have enough bits
    in the shadow entry to store the full GFN. Limit use of literal numbers
    a little and instead derive some of the involved values. Sanity-check
    the result via BUILD_BUG_ON()s.
    
    This then allows dropping from sh_l1e_mmio() again the guarding against
    too large GFNs. It needs replacing by an L1TF safety check though, which
    in turn requires exposing cpu_has_bug_l1tf.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/types.h  | 36 ++++++++++++++++++++++++++----------
 xen/arch/x86/spec_ctrl.c        |  2 +-
 xen/include/asm-x86/spec_ctrl.h |  1 +
 3 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/types.h b/xen/arch/x86/mm/shadow/types.h
index 27de593d87..a86be62d88 100644
--- a/xen/arch/x86/mm/shadow/types.h
+++ b/xen/arch/x86/mm/shadow/types.h
@@ -283,9 +283,18 @@ static inline shadow_l4e_t shadow_l4e_from_mfn(mfn_t mfn, u32 flags)
  * This is only feasible for PAE and 64bit Xen: 32-bit non-PAE PTEs don't
  * have reserved bits that we can use for this.  And even there it can only
  * be used if we can be certain the processor doesn't use all 52 address bits.
+ *
+ * For the MMIO encoding (see below) we need the bottom 4 bits for
+ * identifying the kind of entry and a full GFN's worth of bits to encode
+ * the originating frame number.  Set all remaining bits to trigger
+ * reserved bit faults, if (see above) the hardware permits triggering such.
  */
 
-#define SH_L1E_MAGIC 0xffffffff00000001ULL
+#ifdef CONFIG_BIGMEM
+# define SH_L1E_MAGIC_MASK (0xfffff00000000000UL | _PAGE_PRESENT)
+#else
+# define SH_L1E_MAGIC_MASK (0xfffffff000000000UL | _PAGE_PRESENT)
+#endif
 
 static inline bool sh_have_pte_rsvd_bits(void)
 {
@@ -294,7 +303,8 @@ static inline bool sh_have_pte_rsvd_bits(void)
 
 static inline bool sh_l1e_is_magic(shadow_l1e_t sl1e)
 {
-    return (sl1e.l1 & SH_L1E_MAGIC) == SH_L1E_MAGIC;
+    BUILD_BUG_ON(!(PADDR_MASK & PAGE_MASK & SH_L1E_MAGIC_MASK));
+    return (sl1e.l1 & SH_L1E_MAGIC_MASK) == SH_L1E_MAGIC_MASK;
 }
 
 /* Guest not present: a single magic value */
@@ -320,24 +330,30 @@ static inline bool sh_l1e_is_gnp(shadow_l1e_t sl1e)
 
 /*
  * MMIO: an invalid PTE that contains the GFN of the equivalent guest l1e.
- * We store 28 bits of GFN in bits 4:32 of the entry.
+ * We store the GFN in bits 4:35 (BIGMEM: 4:43) of the entry.
  * The present bit is set, and the U/S and R/W bits are taken from the guest.
  * Bit 3 is always 0, to differentiate from gnp above.
  */
-#define SH_L1E_MMIO_MAGIC       0xffffffff00000001ULL
-#define SH_L1E_MMIO_MAGIC_MASK  0xffffffff00000009ULL
-#define SH_L1E_MMIO_GFN_MASK    0x00000000fffffff0ULL
+#define SH_L1E_MMIO_MAGIC       SH_L1E_MAGIC_MASK
+#define SH_L1E_MMIO_MAGIC_BIT   8
+#define SH_L1E_MMIO_MAGIC_MASK  (SH_L1E_MMIO_MAGIC | SH_L1E_MMIO_MAGIC_BIT)
+#define SH_L1E_MMIO_GFN_MASK    ~(SH_L1E_MMIO_MAGIC_MASK | _PAGE_RW | _PAGE_USER)
 
 static inline shadow_l1e_t sh_l1e_mmio(gfn_t gfn, u32 gflags)
 {
     unsigned long gfn_val = MASK_INSR(gfn_x(gfn), SH_L1E_MMIO_GFN_MASK);
+    shadow_l1e_t sl1e = { (SH_L1E_MMIO_MAGIC | gfn_val |
+                           (gflags & (_PAGE_USER | _PAGE_RW))) };
+
+    BUILD_BUG_ON(SH_L1E_MMIO_MAGIC_BIT <= _PAGE_RW);
+    BUILD_BUG_ON(SH_L1E_MMIO_MAGIC_BIT <= _PAGE_USER);
 
     if ( !sh_have_pte_rsvd_bits() ||
-         gfn_x(gfn) != MASK_EXTR(gfn_val, SH_L1E_MMIO_GFN_MASK) )
-        return shadow_l1e_empty();
+         (cpu_has_bug_l1tf &&
+          !is_l1tf_safe_maddr(shadow_l1e_get_paddr(sl1e))) )
+        sl1e = shadow_l1e_empty();
 
-    return (shadow_l1e_t) { (SH_L1E_MMIO_MAGIC | gfn_val |
-                             (gflags & (_PAGE_USER | _PAGE_RW))) };
+    return sl1e;
 }
 
 static inline bool sh_l1e_is_mmio(shadow_l1e_t sl1e)
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index c9f78ead62..cd05f42394 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -59,7 +59,7 @@ uint8_t __read_mostly default_xen_spec_ctrl;
 uint8_t __read_mostly default_spec_ctrl_flags;
 
 paddr_t __read_mostly l1tf_addr_mask, __read_mostly l1tf_safe_maddr;
-static bool __initdata cpu_has_bug_l1tf;
+bool __read_mostly cpu_has_bug_l1tf;
 static unsigned int __initdata l1d_maxphysaddr;
 
 static bool __initdata cpu_has_bug_msbds_only; /* => minimal HT impact. */
diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/asm-x86/spec_ctrl.h
index b252bb8631..e671b6fd8d 100644
--- a/xen/include/asm-x86/spec_ctrl.h
+++ b/xen/include/asm-x86/spec_ctrl.h
@@ -45,6 +45,7 @@ extern uint8_t default_spec_ctrl_flags;
 
 extern int8_t opt_xpti_hwdom, opt_xpti_domu;
 
+extern bool cpu_has_bug_l1tf;
 extern int8_t opt_pv_l1tf_hwdom, opt_pv_l1tf_domu;
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:34:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:34:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107652.205722 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUlfD-0002xa-RI; Fri, 09 Apr 2021 07:34:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107652.205722; Fri, 09 Apr 2021 07: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 1lUlfD-0002xS-OJ; Fri, 09 Apr 2021 07:34:47 +0000
Received: by outflank-mailman (input) for mailman id 107652;
 Fri, 09 Apr 2021 07: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 1lUlfC-0002xK-Hb
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07: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 1lUlfC-0004He-Gq
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:34:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlfC-0004ei-Fg
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07: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=IvM9qpHvlX1qcMb+mMvZOEijv/1ElU542wTPSka9xBY=; b=vFeE+2y31yQujvz9Xqmve0+iks
	xkgao7Jdjqxc00VlUfUtAuoinJpS6SA39cLvNwX1+LpWbrpWRcLFNsc/FpcSHMptLVTbNWKzUmaq1
	zyAWt6/EaBh6jWz8W/y5qArcChHiVaCb8n/R18/TzxPSC5yZDifiYunBv09TprCSk/nU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/irq: simplify loop in unmap_domain_pirq
Message-Id: <E1lUlfC-0004ei-Fg@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:34:46 +0000

commit f811f890ff549fe433091076da308a44b906f271
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri Apr 9 09:20:57 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:20:57 2021 +0200

    x86/irq: simplify loop in unmap_domain_pirq
    
    The for loop in unmap_domain_pirq is unnecessary complicated, with
    several places where the index is incremented, and also different
    exit conditions spread between the loop body.
    
    Simplify it by looping over each possible PIRQ using the for loop
    syntax, and remove all possible in-loop exit points.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/irq.c | 60 +++++++++++++++---------------------------------------
 1 file changed, 16 insertions(+), 44 deletions(-)

diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index 032fe82167..a1693f92dd 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2305,7 +2305,6 @@ done:
 /* The pirq should have been unbound before this call. */
 int unmap_domain_pirq(struct domain *d, int pirq)
 {
-    unsigned long flags;
     struct irq_desc *desc;
     int irq, ret = 0, rc;
     unsigned int i, nr = 1;
@@ -2356,11 +2355,23 @@ int unmap_domain_pirq(struct domain *d, int pirq)
     if ( msi_desc != NULL )
         pci_disable_msi(msi_desc);
 
-    spin_lock_irqsave(&desc->lock, flags);
-
-    for ( i = 0; ; )
+    for ( i = 0; i < nr; i++, info = pirq_info(d, pirq + i) )
     {
+        unsigned long flags;
+
+        if ( !info || info->arch.irq <= 0 )
+        {
+            printk(XENLOG_G_ERR "%pd: MSI pirq %d not mapped\n",
+                   d, pirq + i);
+            continue;
+        }
+        irq = info->arch.irq;
+        desc = irq_to_desc(irq);
+
+        spin_lock_irqsave(&desc->lock, flags);
+
         BUG_ON(irq != domain_pirq_to_irq(d, pirq + i));
+        BUG_ON(desc->msi_desc != msi_desc + i);
 
         if ( !forced_unbind )
             clear_domain_irq_pirq(d, irq, info);
@@ -2378,45 +2389,6 @@ int unmap_domain_pirq(struct domain *d, int pirq)
             desc->msi_desc = NULL;
         }
 
-        if ( ++i == nr )
-            break;
-
-        spin_unlock_irqrestore(&desc->lock, flags);
-
-        if ( !forced_unbind )
-           cleanup_domain_irq_pirq(d, irq, info);
-
-        rc = irq_deny_access(d, irq);
-        if ( rc )
-        {
-            printk(XENLOG_G_ERR
-                   "dom%d: could not deny access to IRQ%d (pirq %d)\n",
-                   d->domain_id, irq, pirq + i);
-            ret = rc;
-        }
-
-        do {
-            info = pirq_info(d, pirq + i);
-            if ( info && (irq = info->arch.irq) > 0 )
-                break;
-            printk(XENLOG_G_ERR "dom%d: MSI pirq %d not mapped\n",
-                   d->domain_id, pirq + i);
-        } while ( ++i < nr );
-
-        if ( i == nr )
-        {
-            desc = NULL;
-            break;
-        }
-
-        desc = irq_to_desc(irq);
-        BUG_ON(desc->msi_desc != msi_desc + i);
-
-        spin_lock_irqsave(&desc->lock, flags);
-    }
-
-    if ( desc )
-    {
         spin_unlock_irqrestore(&desc->lock, flags);
 
         if ( !forced_unbind )
@@ -2427,7 +2399,7 @@ int unmap_domain_pirq(struct domain *d, int pirq)
         {
             printk(XENLOG_G_ERR
                    "dom%d: could not deny access to IRQ%d (pirq %d)\n",
-                   d->domain_id, irq, pirq + nr - 1);
+                   d->domain_id, irq, pirq + i);
             ret = rc;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:34:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:34:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107653.205727 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUlfN-0002yx-Sy; Fri, 09 Apr 2021 07:34:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107653.205727; Fri, 09 Apr 2021 07: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 1lUlfN-0002yo-Pp; Fri, 09 Apr 2021 07:34:57 +0000
Received: by outflank-mailman (input) for mailman id 107653;
 Fri, 09 Apr 2021 07: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 1lUlfM-0002yd-Ky
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07: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 1lUlfM-0004Ho-KD
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:34:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlfM-0004fi-JH
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07: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=cR0BIxs8TMetujW+DgGrK6EIRQL2QmSmP2Jc+2/pfMc=; b=bmq1sZh3jauhZTqQzqK5JM25rL
	vWgUIQUU5uKYW5piJgtT6cygMJANaArHQfR5S2i8F3nrOOo2uTLcjqw7UEjLdq5kPh/WT+syKQnNY
	eNgv5pfVHhbOmRhJYhRlmwqROAr0VT+1ikvd0kYnsK9isNmEtfN72NxiJMf7xfqUOEBo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vpt: do not take pt_migrate rwlock in some cases
Message-Id: <E1lUlfM-0004fi-JH@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:34:56 +0000

commit 1f3d87c7512975274cc45c40097b05550eba1ac9
Author:     Boris Ostrovsky <boris.ostrovsky@oracle.com>
AuthorDate: Fri Apr 9 09:21:27 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:21:27 2021 +0200

    x86/vpt: do not take pt_migrate rwlock in some cases
    
    Commit 8e76aef72820 ("x86/vpt: fix race when migrating timers between
    vCPUs") addressed XSA-336 by introducing a per-domain rwlock that was
    intended to protect periodic timer during VCPU migration. Since such
    migration is an infrequent event no performance impact was expected.
    
    Unfortunately this turned out not to be the case: on a fairly large
    guest (92 VCPUs) we've observed as much as 40% TPCC performance
    regression with some guest kernels. Further investigation pointed to
    pt_migrate read lock taken in pt_update_irq() as the largest contributor
    to this regression. With large number of VCPUs and large number of VMEXITs
    (from where pt_update_irq() is always called) the update of an atomic in
    read_lock() is thought to be the main cause.
    
    Stephen Brennan analyzed locking pattern and classified lock users as
    follows:
    
    1. Functions which read (maybe write) all periodic_time instances attached
    to a particular vCPU. These are functions which use pt_vcpu_lock() such
    as pt_restore_timer(), pt_save_timer(), etc.
    2. Functions which want to modify a particular periodic_time object.
    These functions lock whichever vCPU the periodic_time is attached to, but
    since the vCPU could be modified without holding any lock, they are
    vulnerable to XSA-336. Functions in this group use pt_lock(), such as
    pt_timer_fn() or destroy_periodic_time().
    3. Functions which not only want to modify the periodic_time, but also
    would like to modify the =vcpu= fields. These are create_periodic_time()
    or pt_adjust_vcpu(). They create XSA-336 conditions for group 2, but we
    can't simply hold 2 vcpu locks due to the deadlock risk.
    
    Roger then pointed out that group 1 functions don't really need to hold
    the pt_migrate rwlock and that instead groups 2 and 3 should hold per-vcpu
    lock whenever they modify per-vcpu timer lists.
    
    Suggested-by: Stephen Brennan <stephen.s.brennan@oracle.com>
    Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Stephen Brennan <stephen.s.brennan@oracle.com>
---
 xen/arch/x86/hvm/vpt.c        | 44 ++++++++++++++++++++++++++++++++++---------
 xen/include/asm-x86/hvm/vpt.h | 18 ++++++++++++------
 2 files changed, 47 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 4c2afe2e91..560fab9cfc 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -153,32 +153,43 @@ static int pt_irq_masked(struct periodic_time *pt)
     return 1;
 }
 
+/*
+ * Functions which read (maybe write) all periodic_time instances
+ * attached to a particular vCPU use pt_vcpu_{un}lock locking helpers.
+ *
+ * Such users are explicitly forbidden from changing the value of the
+ * pt->vcpu field, because another thread holding the pt_migrate lock
+ * may already be spinning waiting for your vcpu lock.
+ */
 static void pt_vcpu_lock(struct vcpu *v)
 {
-    read_lock(&v->domain->arch.hvm.pl_time->pt_migrate);
     spin_lock(&v->arch.hvm.tm_lock);
 }
 
 static void pt_vcpu_unlock(struct vcpu *v)
 {
     spin_unlock(&v->arch.hvm.tm_lock);
-    read_unlock(&v->domain->arch.hvm.pl_time->pt_migrate);
 }
 
+/*
+ * Functions which want to modify a particular periodic_time object
+ * use pt_{un}lock locking helpers.
+ *
+ * These users lock whichever vCPU the periodic_time is attached to,
+ * but since the vCPU could be modified without holding any lock, they
+ * need to take an additional lock that protects against pt->vcpu
+ * changing.
+ */
 static void pt_lock(struct periodic_time *pt)
 {
-    /*
-     * We cannot use pt_vcpu_lock here, because we need to acquire the
-     * per-domain lock first and then (re-)fetch the value of pt->vcpu, or
-     * else we might be using a stale value of pt->vcpu.
-     */
     read_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
     spin_lock(&pt->vcpu->arch.hvm.tm_lock);
 }
 
 static void pt_unlock(struct periodic_time *pt)
 {
-    pt_vcpu_unlock(pt->vcpu);
+    spin_unlock(&pt->vcpu->arch.hvm.tm_lock);
+    read_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
 }
 
 static void pt_process_missed_ticks(struct periodic_time *pt)
@@ -543,8 +554,10 @@ void create_periodic_time(
     pt->cb = cb;
     pt->priv = data;
 
+    pt_vcpu_lock(v);
     pt->on_list = 1;
     list_add(&pt->list, &v->arch.hvm.tm_list);
+    pt_vcpu_unlock(v);
 
     init_timer(&pt->timer, pt_timer_fn, pt, v->processor);
     set_timer(&pt->timer, pt->scheduled);
@@ -580,13 +593,26 @@ static void pt_adjust_vcpu(struct periodic_time *pt, struct vcpu *v)
         return;
 
     write_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
+
+    if ( pt->vcpu == v )
+        goto out;
+
+    pt_vcpu_lock(pt->vcpu);
+    if ( pt->on_list )
+        list_del(&pt->list);
+    pt_vcpu_unlock(pt->vcpu);
+
     pt->vcpu = v;
+
+    pt_vcpu_lock(v);
     if ( pt->on_list )
     {
-        list_del(&pt->list);
         list_add(&pt->list, &v->arch.hvm.tm_list);
         migrate_timer(&pt->timer, v->processor);
     }
+    pt_vcpu_unlock(v);
+
+ out:
     write_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
 }
 
diff --git a/xen/include/asm-x86/hvm/vpt.h b/xen/include/asm-x86/hvm/vpt.h
index 39d26cbda4..74c0cedd11 100644
--- a/xen/include/asm-x86/hvm/vpt.h
+++ b/xen/include/asm-x86/hvm/vpt.h
@@ -128,12 +128,18 @@ struct pl_time {    /* platform time */
     struct RTCState  vrtc;
     struct HPETState vhpet;
     struct PMTState  vpmt;
-    /*
-     * rwlock to prevent periodic_time vCPU migration. Take the lock in read
-     * mode in order to prevent the vcpu field of periodic_time from changing.
-     * Lock must be taken in write mode when changes to the vcpu field are
-     * performed, as it allows exclusive access to all the timers of a domain.
-     */
+     /*
+      * Functions which want to modify the vcpu field of the vpt need
+      * to hold the global lock (pt_migrate) in write mode together
+      * with the per-vcpu locks of the lists being modified. Functions
+      * that want to lock a periodic_timer that's possibly on a
+      * different vCPU list need to take the lock in read mode first in
+      * order to prevent the vcpu field of periodic_timer from
+      * changing.
+      *
+      * Note that two vcpu locks cannot be held at the same time to
+      * avoid a deadlock.
+      */
     rwlock_t pt_migrate;
     /* guest_time = Xen sys time + stime_offset */
     int64_t stime_offset;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:35:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:35:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107654.205731 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUlfX-00030R-Vl; Fri, 09 Apr 2021 07:35:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107654.205731; Fri, 09 Apr 2021 07:35:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUlfX-00030J-Sn; Fri, 09 Apr 2021 07:35:07 +0000
Received: by outflank-mailman (input) for mailman id 107654;
 Fri, 09 Apr 2021 07:35:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlfW-00030B-OB
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:35:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlfW-0004I9-NU
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:35:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlfW-0004gx-Mf
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:35:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pTtNX4ZchV4cSCQrmEVMVwVzvHVinH8lK1Oq4BmeEkQ=; b=RcwJjgim76guR+e7tbfSdO48Yf
	xfOCxP++XHbJIEzk1X1PLs+ed0hEpvMqB7aoAaTEDz4K2DeQFMND4Lw7knbPDG2e3YYCjv5WxMyeP
	F2hZ6OLcyQx/ixTXw6GLILvdfn+aRTpML9n9kWgJHhfOz0BDOYCg+iKgmmPGSwWSDHeQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vpt: simplify locking argument to write_{,un}lock
Message-Id: <E1lUlfW-0004gx-Mf@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:35:06 +0000

commit e67b9816427a62f0b12916bab36763840fa41854
Author:     Boris Ostrovsky <boris.ostrovsky@oracle.com>
AuthorDate: Fri Apr 9 09:22:04 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:22:04 2021 +0200

    x86/vpt: simplify locking argument to write_{,un}lock
    
    Make pt_adjust_vcpu() call write_{,un}lock with less indirection, like
    create_periodic_time() already does.
    
    Requested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vpt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 560fab9cfc..4cc0a0848b 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -592,7 +592,7 @@ static void pt_adjust_vcpu(struct periodic_time *pt, struct vcpu *v)
     if ( pt->vcpu == NULL )
         return;
 
-    write_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
+    write_lock(&v->domain->arch.hvm.pl_time->pt_migrate);
 
     if ( pt->vcpu == v )
         goto out;
@@ -613,7 +613,7 @@ static void pt_adjust_vcpu(struct periodic_time *pt, struct vcpu *v)
     pt_vcpu_unlock(v);
 
  out:
-    write_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
+    write_unlock(&v->domain->arch.hvm.pl_time->pt_migrate);
 }
 
 void pt_adjust_global_vcpu_target(struct vcpu *v)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:35:18 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:35:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107655.205735 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUlfi-00031y-1G; Fri, 09 Apr 2021 07:35:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107655.205735; Fri, 09 Apr 2021 07:35:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUlfh-00031p-UI; Fri, 09 Apr 2021 07:35:17 +0000
Received: by outflank-mailman (input) for mailman id 107655;
 Fri, 09 Apr 2021 07:35:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlfg-00031g-RT
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:35:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlfg-0004II-Qh
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:35:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlfg-0004i0-Pt
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:35:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YimCTxHOX1bzZcJ6adyBQd8l9f3r3pCp0oppbQXl45A=; b=q3J9p6TLoJDYGBhqd1I9tYT3Z4
	NFnXiMO0EHTjH+wTvoY9bSgQOK28cfkU+pwxmpaTi4NowHfykfDh7iZyP4gQ+d9MT17cEFIAGnhPh
	do4k5Z16VOd73tU0M5j56wszdLO9hgrlVEtCRs3CHxjUpI/3Pknm9XZI9e9UDEZoQtic=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] pci: move ATS code to common directory
Message-Id: <E1lUlfg-0004i0-Pt@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:35:16 +0000

commit b4c3d45c26d22490c08872596fcd1f8db9153dfc
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Fri Apr 9 09:22:26 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:22:26 2021 +0200

    pci: move ATS code to common directory
    
    PCI ATS code is common for all architecture, move code to common
    directory to be usable for other architectures.
    
    No functional change intended.
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/drivers/passthrough/Makefile     |  1 +
 xen/drivers/passthrough/ats.c        | 86 ++++++++++++++++++++++++++++++++++++
 xen/drivers/passthrough/x86/Makefile |  1 -
 xen/drivers/passthrough/x86/ats.c    | 86 ------------------------------------
 4 files changed, 87 insertions(+), 87 deletions(-)

diff --git a/xen/drivers/passthrough/Makefile b/xen/drivers/passthrough/Makefile
index cc646612c7..445690e3e5 100644
--- a/xen/drivers/passthrough/Makefile
+++ b/xen/drivers/passthrough/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_ARM) += arm/
 obj-y += iommu.o
 obj-$(CONFIG_HAS_PCI) += pci.o
 obj-$(CONFIG_HAS_DEVICE_TREE) += device_tree.o
+obj-$(CONFIG_HAS_PCI) += ats.o
diff --git a/xen/drivers/passthrough/ats.c b/xen/drivers/passthrough/ats.c
new file mode 100644
index 0000000000..7f7b16dc49
--- /dev/null
+++ b/xen/drivers/passthrough/ats.c
@@ -0,0 +1,86 @@
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <xen/param.h>
+#include <xen/sched.h>
+#include <xen/pci.h>
+#include <xen/pci_regs.h>
+#include "ats.h"
+
+bool_t __read_mostly ats_enabled = 0;
+boolean_param("ats", ats_enabled);
+
+int enable_ats_device(struct pci_dev *pdev, struct list_head *ats_list)
+{
+    u32 value;
+    u16 seg = pdev->seg;
+    u8 bus = pdev->bus, devfn = pdev->devfn;
+    int pos;
+
+    pos = pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS);
+    BUG_ON(!pos);
+
+    if ( iommu_verbose )
+        dprintk(XENLOG_INFO, "%pp: ATS capability found\n", &pdev->sbdf);
+
+    value = pci_conf_read16(pdev->sbdf, pos + ATS_REG_CTL);
+    if ( value & ATS_ENABLE )
+    {
+        struct pci_dev *other;
+
+        list_for_each_entry ( other, ats_list, ats.list )
+            if ( other == pdev )
+            {
+                pos = 0;
+                break;
+            }
+    }
+
+    if ( !(value & ATS_ENABLE) )
+    {
+        value |= ATS_ENABLE;
+        pci_conf_write16(pdev->sbdf, pos + ATS_REG_CTL, value);
+    }
+
+    if ( pos )
+    {
+        pdev->ats.cap_pos = pos;
+        value = pci_conf_read16(pdev->sbdf, pos + ATS_REG_CAP);
+        pdev->ats.queue_depth = value & ATS_QUEUE_DEPTH_MASK ?:
+                                ATS_QUEUE_DEPTH_MASK + 1;
+        list_add(&pdev->ats.list, ats_list);
+    }
+
+    if ( iommu_verbose )
+        dprintk(XENLOG_INFO, "%pp: ATS %s enabled\n",
+                &pdev->sbdf, pos ? "is" : "was");
+
+    return pos;
+}
+
+void disable_ats_device(struct pci_dev *pdev)
+{
+    u32 value;
+
+    BUG_ON(!pdev->ats.cap_pos);
+
+    value = pci_conf_read16(pdev->sbdf, pdev->ats.cap_pos + ATS_REG_CTL);
+    value &= ~ATS_ENABLE;
+    pci_conf_write16(pdev->sbdf, pdev->ats.cap_pos + ATS_REG_CTL, value);
+
+    list_del(&pdev->ats.list);
+
+    if ( iommu_verbose )
+        dprintk(XENLOG_INFO, "%pp: ATS is disabled\n", &pdev->sbdf);
+}
diff --git a/xen/drivers/passthrough/x86/Makefile b/xen/drivers/passthrough/x86/Makefile
index 69284a5d19..75b2885336 100644
--- a/xen/drivers/passthrough/x86/Makefile
+++ b/xen/drivers/passthrough/x86/Makefile
@@ -1,3 +1,2 @@
-obj-y += ats.o
 obj-y += iommu.o
 obj-$(CONFIG_HVM) += hvm.o
diff --git a/xen/drivers/passthrough/x86/ats.c b/xen/drivers/passthrough/x86/ats.c
deleted file mode 100644
index 4628ffde45..0000000000
--- a/xen/drivers/passthrough/x86/ats.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <xen/param.h>
-#include <xen/sched.h>
-#include <xen/pci.h>
-#include <xen/pci_regs.h>
-#include "../ats.h"
-
-bool_t __read_mostly ats_enabled = 0;
-boolean_param("ats", ats_enabled);
-
-int enable_ats_device(struct pci_dev *pdev, struct list_head *ats_list)
-{
-    u32 value;
-    u16 seg = pdev->seg;
-    u8 bus = pdev->bus, devfn = pdev->devfn;
-    int pos;
-
-    pos = pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS);
-    BUG_ON(!pos);
-
-    if ( iommu_verbose )
-        dprintk(XENLOG_INFO, "%pp: ATS capability found\n", &pdev->sbdf);
-
-    value = pci_conf_read16(pdev->sbdf, pos + ATS_REG_CTL);
-    if ( value & ATS_ENABLE )
-    {
-        struct pci_dev *other;
-
-        list_for_each_entry ( other, ats_list, ats.list )
-            if ( other == pdev )
-            {
-                pos = 0;
-                break;
-            }
-    }
-
-    if ( !(value & ATS_ENABLE) )
-    {
-        value |= ATS_ENABLE;
-        pci_conf_write16(pdev->sbdf, pos + ATS_REG_CTL, value);
-    }
-
-    if ( pos )
-    {
-        pdev->ats.cap_pos = pos;
-        value = pci_conf_read16(pdev->sbdf, pos + ATS_REG_CAP);
-        pdev->ats.queue_depth = value & ATS_QUEUE_DEPTH_MASK ?:
-                                ATS_QUEUE_DEPTH_MASK + 1;
-        list_add(&pdev->ats.list, ats_list);
-    }
-
-    if ( iommu_verbose )
-        dprintk(XENLOG_INFO, "%pp: ATS %s enabled\n",
-                &pdev->sbdf, pos ? "is" : "was");
-
-    return pos;
-}
-
-void disable_ats_device(struct pci_dev *pdev)
-{
-    u32 value;
-
-    BUG_ON(!pdev->ats.cap_pos);
-
-    value = pci_conf_read16(pdev->sbdf, pdev->ats.cap_pos + ATS_REG_CTL);
-    value &= ~ATS_ENABLE;
-    pci_conf_write16(pdev->sbdf, pdev->ats.cap_pos + ATS_REG_CTL, value);
-
-    list_del(&pdev->ats.list);
-
-    if ( iommu_verbose )
-        dprintk(XENLOG_INFO, "%pp: ATS is disabled\n", &pdev->sbdf);
-}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:35:28 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:35:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107656.205739 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUlfs-000333-3D; Fri, 09 Apr 2021 07:35:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107656.205739; Fri, 09 Apr 2021 07:35:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUlfr-00032u-Vu; Fri, 09 Apr 2021 07:35:27 +0000
Received: by outflank-mailman (input) for mailman id 107656;
 Fri, 09 Apr 2021 07:35: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 1lUlfq-00032l-UV
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:35:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlfq-0004Ig-Tj
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:35:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlfq-0004j8-T5
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:35:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nsoqyIOo391eZn8sUpcvaLOMlrW4wGbAbulVebrTKZA=; b=K6doh3Qr7Ait6VmearEClsBBlQ
	aOa61BNeMg6zYPiUu6T119KylQ6445TlLNCNtB4G9F8H2MY/InQQstl2u5GIuibKeSyQenzL+bxJ4
	7PE4Rh8brT1rOeRhMgwx2mRArEI6bMegL2WYqLPjHPNl0X/IsiQARybrtkMHkO4DMulE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] MAINTAINERS: add myself as hypfs maintainer
Message-Id: <E1lUlfq-0004j8-T5@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:35:26 +0000

commit 4bd1811dcab1145e7ff7652d9ba6800cbf7234a9
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Apr 9 09:23:28 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:23:28 2021 +0200

    MAINTAINERS: add myself as hypfs maintainer
    
    As I have contributed all the code for hypfs, it would be natural to
    be the maintainer.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Ian Jackson <iwj@xenproject.org>
---
 MAINTAINERS | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 6a7fa8717e..d46b08a0d2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -308,6 +308,15 @@ M:     Nick Rosbrook <rosbrookn@ainfosec.com>
 S:	Maintained
 F:	tools/golang
 
+HYPFS
+M:	Juergen Gross <jgross@suse.com>
+S:	Supported
+F:	tools/include/xenhypfs.h
+F:	tools/libs/hypfs/
+F:	tools/misc/xenhypfs.c
+F:	xen/common/hypfs.c
+F:	xen/include/xen/hypfs.h
+
 INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT)
 R:	Lukasz Hawrylko <lukasz.hawrylko@linux.intel.com>
 S:	Odd Fixes
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:35:38 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:35:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107657.205743 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUlg2-00034S-4P; Fri, 09 Apr 2021 07:35:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107657.205743; Fri, 09 Apr 2021 07:35:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUlg2-00034K-19; Fri, 09 Apr 2021 07:35:38 +0000
Received: by outflank-mailman (input) for mailman id 107657;
 Fri, 09 Apr 2021 07:35:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlg1-00034D-1d
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:35:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlg1-0004Io-0n
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:35:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlg1-0004k2-03
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:35:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jVXtTrLo4BUmG7Uy7GVKwu+PL+wlj5wKPawQyoD/x4k=; b=MaN1gje09/llvgN83jw1KxLOqh
	EpWtVxVIZqWMdZA71WSmMlFFXaD+L31bmN8xvM5l/clTfJbuVznCBFBBbvK+C8Ap5EWw3MXw/Wc8K
	YMoEuXJtyPRwRsVfygScOly6imy0YcoZDfvmbUeM341V9FyHypiJYJy5XqgiTS3oCEIM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: avoid effectively open-coding xzalloc_flex_struct()
Message-Id: <E1lUlg1-0004k2-03@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:35:37 +0000

commit 23eda45f12ec98638d0175b615d3bc3428fd2eda
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:24:23 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:24:23 2021 +0200

    x86/HVM: avoid effectively open-coding xzalloc_flex_struct()
    
    Drop hvm_irq_size(), which exists for just this purpose.
    
    There is a difference in generated code: xzalloc_bytes() forces
    SMP_CACHE_BYTES alignment. I think we not only don't need this here, but
    actually don't want it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/hvm.c        | 3 ++-
 xen/include/asm-x86/hvm/irq.h | 1 -
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index e7bcffebc4..ae37bc434a 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -642,7 +642,8 @@ int hvm_domain_initialise(struct domain *d)
     d->arch.hvm.params = xzalloc_array(uint64_t, HVM_NR_PARAMS);
     d->arch.hvm.io_handler = xzalloc_array(struct hvm_io_handler,
                                            NR_IO_HANDLERS);
-    d->arch.hvm.irq = xzalloc_bytes(hvm_irq_size(nr_gsis));
+    d->arch.hvm.irq = xzalloc_flex_struct(struct hvm_irq,
+                                          gsi_assert_count, nr_gsis);
 
     rc = -ENOMEM;
     if ( !d->arch.hvm.pl_time || !d->arch.hvm.irq ||
diff --git a/xen/include/asm-x86/hvm/irq.h b/xen/include/asm-x86/hvm/irq.h
index 7f76f6c437..717c2299de 100644
--- a/xen/include/asm-x86/hvm/irq.h
+++ b/xen/include/asm-x86/hvm/irq.h
@@ -98,7 +98,6 @@ struct hvm_irq {
 #define hvm_pci_intx_link(dev, intx) \
     (((dev) + (intx)) & 3)
 #define hvm_domain_irq(d) ((d)->arch.hvm.irq)
-#define hvm_irq_size(cnt) offsetof(struct hvm_irq, gsi_assert_count[cnt])
 
 #define hvm_isa_irq_to_gsi(isa_irq) ((isa_irq) ? : 2)
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:35:48 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:35:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107658.205746 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUlgC-00035f-5j; Fri, 09 Apr 2021 07:35:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107658.205746; Fri, 09 Apr 2021 07:35:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUlgC-00035Y-2r; Fri, 09 Apr 2021 07:35:48 +0000
Received: by outflank-mailman (input) for mailman id 107658;
 Fri, 09 Apr 2021 07:35:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlgB-00035Q-4W
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:35:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlgB-0004Iw-3j
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:35:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlgB-0004ky-33
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:35:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZcXDdcpabWsJvH8EKPBNvSTG+jOwNibJtlatJaVP7EU=; b=TyzszP0bXrjoMzMF+CbENZI6v1
	5gJwXFJ21bcfxBRyfSOTGX+MVB1Js61rYdByg/Ejuh1kI65dvvhdS1wF4GgGdv5w1ECJzaZ+/yawc
	WBNiu/61WHMBdZO7/DnLVcDvqZXeVbW7H1j3ljlYby7UlY2KV1EfS32qzCzkK6rhp4y8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vPMU: avoid effectively open-coding xzalloc_flex_struct()
Message-Id: <E1lUlgB-0004ky-33@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:35:47 +0000

commit 463e8e6cf764beda5f58117a422dcb3a06fed405
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:25:17 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:25:17 2021 +0200

    x86/vPMU: avoid effectively open-coding xzalloc_flex_struct()
    
    There is a difference in generated code: xzalloc_bytes() forces
    SMP_CACHE_BYTES alignment. I think we not only don't need this here, but
    actually don't want it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu/vpmu_intel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
index 6e97ce7900..64334c5fab 100644
--- a/xen/arch/x86/cpu/vpmu_intel.c
+++ b/xen/arch/x86/cpu/vpmu_intel.c
@@ -461,10 +461,10 @@ static int core2_vpmu_alloc_resource(struct vcpu *v)
             goto out_err;
     }
 
-    core2_vpmu_cxt = xzalloc_bytes(sizeof(*core2_vpmu_cxt) +
-                                   sizeof(uint64_t) * fixed_pmc_cnt +
-                                   sizeof(struct xen_pmu_cntr_pair) *
-                                   arch_pmc_cnt);
+    core2_vpmu_cxt = xzalloc_flex_struct(struct xen_pmu_intel_ctxt, regs,
+                                         fixed_pmc_cnt + arch_pmc_cnt *
+                                         (sizeof(struct xen_pmu_cntr_pair) /
+                                          sizeof(*core2_vpmu_cxt->regs)));
     p = xzalloc(uint64_t);
     if ( !core2_vpmu_cxt || !p )
         goto out_err;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:35:58 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:35:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107659.205751 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUlgM-00036o-7u; Fri, 09 Apr 2021 07:35:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107659.205751; Fri, 09 Apr 2021 07:35:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUlgM-00036g-4f; Fri, 09 Apr 2021 07:35:58 +0000
Received: by outflank-mailman (input) for mailman id 107659;
 Fri, 09 Apr 2021 07:35:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlgL-00036Y-7p
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:35:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlgL-0004J4-74
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:35:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlgL-0004m1-6B
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:35:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rBz/X5i/ah/B1lBOYUzyofo4GGzRkh+Q2z6O4bFj4S0=; b=de/2b0MhbxAFG4mXei69kAjEGR
	OLKXSIqzsrB7cQ5/9MDfRD2tdGvCW9z6nb9EvJ2lwhWOojy+z71kqB7jPbzCeJxfC20sXDqMolC0R
	74cQXT7uZqWYX2F6Myx7AWHgJC4+1k2WExIY0KqGjqBWke6MDACk5DQT/mnutWspCgTs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] hypfs: avoid effectively open-coding xzalloc_array()
Message-Id: <E1lUlgL-0004m1-6B@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:35:57 +0000

commit ca68c70d30d68a671a45789a85f8ace6d8360334
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:25:42 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:25:42 2021 +0200

    hypfs: avoid effectively open-coding xzalloc_array()
    
    There is a difference in generated code: xzalloc_bytes() forces
    SMP_CACHE_BYTES alignment. I think we not only don't need this here, but
    actually don't want it.
    
    To avoid the need to add a cast, do away with the only forward-declared
    struct hypfs_dyndata.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/common/hypfs.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/common/hypfs.c b/xen/common/hypfs.c
index 5468497404..e71f7df479 100644
--- a/xen/common/hypfs.c
+++ b/xen/common/hypfs.c
@@ -72,7 +72,7 @@ enum hypfs_lock_state {
     hypfs_write_locked
 };
 static DEFINE_PER_CPU(enum hypfs_lock_state, hypfs_locked);
-static DEFINE_PER_CPU(struct hypfs_dyndata *, hypfs_dyndata);
+static DEFINE_PER_CPU(void *, hypfs_dyndata);
 
 static DEFINE_PER_CPU(const struct hypfs_entry *, hypfs_last_node_entered);
 
@@ -160,19 +160,19 @@ static void node_exit_all(void)
 void *hypfs_alloc_dyndata(unsigned long size)
 {
     unsigned int cpu = smp_processor_id();
-    struct hypfs_dyndata **dyndata = &per_cpu(hypfs_dyndata, cpu);
+    void **dyndata = &per_cpu(hypfs_dyndata, cpu);
 
     ASSERT(per_cpu(hypfs_locked, cpu) != hypfs_unlocked);
     ASSERT(*dyndata == NULL);
 
-    *dyndata = xzalloc_bytes(size);
+    *dyndata = xzalloc_array(unsigned char, size);
 
     return *dyndata;
 }
 
 void *hypfs_get_dyndata(void)
 {
-    struct hypfs_dyndata *dyndata = this_cpu(hypfs_dyndata);
+    void *dyndata = this_cpu(hypfs_dyndata);
 
     ASSERT(dyndata);
 
@@ -181,7 +181,7 @@ void *hypfs_get_dyndata(void)
 
 void hypfs_free_dyndata(void)
 {
-    struct hypfs_dyndata **dyndata = &this_cpu(hypfs_dyndata);
+    void **dyndata = &this_cpu(hypfs_dyndata);
 
     XFREE(*dyndata);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 07:55:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 07:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107668.205776 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUlyt-00052r-2R; Fri, 09 Apr 2021 07:55:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107668.205776; Fri, 09 Apr 2021 07:55:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUlys-00052j-Vm; Fri, 09 Apr 2021 07:55:06 +0000
Received: by outflank-mailman (input) for mailman id 107668;
 Fri, 09 Apr 2021 07:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlyr-00052d-9b
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:55:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlyr-0004cc-7z
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUlyr-00064e-64
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 07:55:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GksK4vtSynBb7KP8T5sYxV8p76g4iyEY59M2cQRdfAo=; b=irEYu6nOCAVp9m3WXCpCXT5um9
	kFbBUS2vxLPsJzjXddcW8D2drkOQqIIq74zNlaEMEUaDCrKcKdIirN06vc5hnIGIRgumuUbDLMrZW
	+NRv6Cp3PPZ6fl5i2JHFbwWTXXLsKCSAVWd9KgRorHQQtUAR7xqKwC2hsfZMU/zDGtiM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Revert "x86: guard against straight-line speculation past RET"
Message-Id: <E1lUlyr-00064e-64@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 07:55:05 +0000

commit 9cd905bae87fb06efa59c347ef1e96c5dc6cdb62
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:50:40 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:53:53 2021 +0200

    Revert "x86: guard against straight-line speculation past RET"
    
    This reverts commit 71b0b475d801ebeb83a6ba402425135c314fa2df,
    which has no real effect - the most recent version of the patch
    had lost the INT3 insn.
---
 xen/Makefile                    |  5 +----
 xen/arch/x86/indirect-thunk.S   |  3 ---
 xen/include/asm-x86/asm-defns.h | 16 ----------------
 3 files changed, 1 insertion(+), 23 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index 3a8fb7ec7e..9f3be7766d 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -145,10 +145,7 @@ t2 = $(call as-insn,$(CC) -I$(BASEDIR)/include,".include \"asm-x86/asm-defns.h\"
 # https://bugs.llvm.org/show_bug.cgi?id=36110
 t3 = $(call as-insn,$(CC),".macro FOO;.endm"$(close); asm volatile $(open)".macro FOO;.endm",-no-integrated-as)
 
-# Check whether macros can override insn mnemonics in inline assembly.
-t4 = $(call as-insn,$(CC),".macro ret; .error; .endm; .macro retq; .error; .endm",-no-integrated-as)
-
-CLANG_FLAGS += $(call or,$(t1),$(t2),$(t3),$(t4))
+CLANG_FLAGS += $(call or,$(t1),$(t2),$(t3))
 endif
 
 CLANG_FLAGS += -Werror=unknown-warning-option
diff --git a/xen/arch/x86/indirect-thunk.S b/xen/arch/x86/indirect-thunk.S
index a090b35dcf..7cc22da0ef 100644
--- a/xen/arch/x86/indirect-thunk.S
+++ b/xen/arch/x86/indirect-thunk.S
@@ -11,9 +11,6 @@
 
 #include <asm/asm_defns.h>
 
-/* Don't transform the "ret" further down. */
-.purgem ret
-
 .macro IND_THUNK_RETPOLINE reg:req
         call 2f
 1:
diff --git a/xen/include/asm-x86/asm-defns.h b/xen/include/asm-x86/asm-defns.h
index e164437798..505f39ad5f 100644
--- a/xen/include/asm-x86/asm-defns.h
+++ b/xen/include/asm-x86/asm-defns.h
@@ -57,22 +57,6 @@
     INDIRECT_BRANCH jmp \arg
 .endm
 
-/*
- * To guard against speculation past RET, insert a breakpoint insn
- * immediately after them.
- */
-.macro ret operand:vararg
-    retq \operand
-.endm
-.macro retq operand:vararg
-    .ifb \operand
-    .byte 0xc3
-    .else
-    .byte 0xc2
-    .word \operand
-    .endif
-.endm
-
 .macro guest_access_mask_ptr ptr:req, scratch1:req, scratch2:req
 #if defined(CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS)
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 08:44:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 08:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107697.205851 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUmkI-00028G-5W; Fri, 09 Apr 2021 08:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107697.205851; Fri, 09 Apr 2021 08: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 1lUmkI-000288-2e; Fri, 09 Apr 2021 08:44:06 +0000
Received: by outflank-mailman (input) for mailman id 107697;
 Fri, 09 Apr 2021 08: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 1lUmkH-00027v-Ba
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 08: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 1lUmkH-0005xn-Af
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 08:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUmkH-0002AB-9P
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 08: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=ydk2YIMlKd6+bOAz7NxU7yudiyzvJBEqg9MgAZXZPdw=; b=Qqy0kS3bRPtEzQtEWesqCMzZEv
	2r/MtyxHI+rC/oaSk2TCN0a5cAblUHjyr2ykUbBIju+O1NkoAE2hkFFz+iCc15xDqK8YjEfdY2u3T
	rYByoQZt0qIGBkxfJLbcQclMIqBBqq3WhjEjUqj9nqeA65FlaPOlhfysVpJR7wqn/xGE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/gunzip: Fix build with clang after 33bc2a8495f7
Message-Id: <E1lUmkH-0002AB-9P@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 08:44:05 +0000

commit 11ba6936d378c72da6ad70eabdfa976e71777788
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed Apr 7 19:22:10 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Apr 9 09:43:12 2021 +0100

    xen/gunzip: Fix build with clang after 33bc2a8495f7
    
    The compilation will fail when building Xen with clang and
    CONFIG_DEBUG=y:
    
    make[4]: Leaving directory '/oss/xen/xen/common/libelf'
      INIT_O  gunzip.init.o
    Error: size of gunzip.o:.text is 0x00000019
    
    This is because the function init_allocator() will not be inlined
    and is not part of the init section.
    
    Fix it by marking init_allocator() with INIT.
    
    Fixes: 33bc2a8495f7 ("xen/gunzip: Allow perform_gunzip() to be called multiple times")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/inflate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/inflate.c b/xen/common/inflate.c
index d8c28a3e95..c593b94d48 100644
--- a/xen/common/inflate.c
+++ b/xen/common/inflate.c
@@ -238,7 +238,7 @@ STATIC const ush mask_bits[] = {
 static unsigned long INITDATA malloc_ptr;
 static int INITDATA malloc_count;
 
-static void init_allocator(void)
+static void INIT init_allocator(void)
 {
     malloc_ptr = free_mem_ptr;
     malloc_count = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 09:33:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 09:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107705.205868 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUnVi-0006og-R6; Fri, 09 Apr 2021 09:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107705.205868; Fri, 09 Apr 2021 09: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 1lUnVi-0006oY-OD; Fri, 09 Apr 2021 09:33:06 +0000
Received: by outflank-mailman (input) for mailman id 107705;
 Fri, 09 Apr 2021 09:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUnVh-0006oT-S2
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 09:33:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUnVh-0006le-O1
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 09:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUnVh-0007ai-N5
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 09:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6Kj0C7Uccb7+lK0DLI+o3lMLJnpoQvO4fApDFiWE9pE=; b=SsN/vBKeb6+zVm3raX6Ns/35ni
	nqZVt5fRNKboz+PHCKqAk2Mli+qgZKMQePp4QzeCz2Xo1ZfNY6QrZobZ6l70jPEwYzAT/rsWucwOj
	NEi1Cg1TCfMTka0tKeR9nY61jIaNn5hJJdmYFV6TxbgL2cePGuG9G0K776wn5MmhuR3M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: Drop gettext as a build dependency
Message-Id: <E1lUnVh-0007ai-N5@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 09:33:05 +0000

commit e21a6a4f966a7e91cb0bb014dbe15d15cc0502ad
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 26 11:25:07 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Apr 9 10:31:17 2021 +0100

    tools: Drop gettext as a build dependency
    
    It has not been a dependency since at least 4.13.  Remove its mandatory check
    from ./configure.
    
    Annotate the dependency in the CI dockerfiles, and drop them from CirrusCI and
    TravisCI.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 .cirrus.yml                                        |  2 +-
 .travis.yml                                        |  1 -
 README                                             |  1 -
 automation/build/alpine/3.12-arm64v8.dockerfile    |  1 +
 automation/build/alpine/3.12.dockerfile            |  1 +
 automation/build/centos/7.2.dockerfile             |  1 +
 automation/build/centos/7.dockerfile               |  1 +
 automation/build/debian/jessie-i386.dockerfile     |  1 +
 automation/build/debian/jessie.dockerfile          |  1 +
 automation/build/debian/stretch-i386.dockerfile    |  1 +
 automation/build/debian/stretch.dockerfile         |  1 +
 .../build/debian/unstable-arm64v8.dockerfile       |  1 +
 automation/build/debian/unstable-i386.dockerfile   |  1 +
 automation/build/debian/unstable.dockerfile        |  1 +
 automation/build/fedora/29.dockerfile              |  1 +
 automation/build/suse/opensuse-leap.dockerfile     |  1 +
 .../build/suse/opensuse-tumbleweed.dockerfile      |  1 +
 automation/build/ubuntu/bionic.dockerfile          |  1 +
 automation/build/ubuntu/focal.dockerfile           |  1 +
 automation/build/ubuntu/trusty.dockerfile          |  1 +
 automation/build/ubuntu/xenial.dockerfile          |  1 +
 .../tests-artifacts/alpine/3.12-arm64v8.dockerfile |  1 +
 tools/configure                                    | 49 ----------------------
 tools/configure.ac                                 |  2 -
 24 files changed, 20 insertions(+), 54 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 0efff6fa98..fdb1c9c94d 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -4,7 +4,7 @@ freebsd_template: &FREEBSD_TEMPLATE
     APPEND_LIB: /usr/local/lib
     APPEND_INCLUDES: /usr/local/include
 
-  install_script: pkg install -y seabios gettext-tools gmake
+  install_script: pkg install -y seabios gmake
                                  pkgconf python libiconv bison perl5
                                  yajl lzo2 pixman argp-standalone
                                  libxml2 glib git
diff --git a/.travis.yml b/.travis.yml
index 2362475f7a..f3cd15b79f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -54,7 +54,6 @@ addons:
             - pkg-config
             - flex
             - bison
-            - gettext
             - acpica-tools
             - bin86
             - bcc
diff --git a/README b/README
index fad96672af..562b808080 100644
--- a/README
+++ b/README
@@ -63,7 +63,6 @@ provided by your OS distributor:
     * bridge-utils package (/sbin/brctl)
     * iproute package (/sbin/ip)
     * GNU bison and GNU flex
-    * GNU gettext
     * ACPI ASL compiler (iasl)
 
 In addition to the above there are a number of optional build
diff --git a/automation/build/alpine/3.12-arm64v8.dockerfile b/automation/build/alpine/3.12-arm64v8.dockerfile
index d6cdf5b200..a1ac960595 100644
--- a/automation/build/alpine/3.12-arm64v8.dockerfile
+++ b/automation/build/alpine/3.12-arm64v8.dockerfile
@@ -22,6 +22,7 @@ RUN \
   apk add dev86 && \
   apk add dtc-dev && \
   apk add gcc  && \
+  # gettext for Xen < 4.13
   apk add gettext && \
   apk add git && \
   apk add iasl && \
diff --git a/automation/build/alpine/3.12.dockerfile b/automation/build/alpine/3.12.dockerfile
index 94557e239b..bb8e5ece74 100644
--- a/automation/build/alpine/3.12.dockerfile
+++ b/automation/build/alpine/3.12.dockerfile
@@ -23,6 +23,7 @@ RUN \
   apk add gcc  && \
   apk add g++ && \
   apk add clang  && \
+  # gettext for Xen < 4.13
   apk add gettext && \
   apk add git && \
   apk add iasl && \
diff --git a/automation/build/centos/7.2.dockerfile b/automation/build/centos/7.2.dockerfile
index af672a0be1..4baa097e31 100644
--- a/automation/build/centos/7.2.dockerfile
+++ b/automation/build/centos/7.2.dockerfile
@@ -26,6 +26,7 @@ RUN rpm --rebuilddb && \
         python-devel \
         libuuid-devel \
         pkgconfig \
+        # gettext for Xen < 4.13
         gettext \
         flex \
         bison \
diff --git a/automation/build/centos/7.dockerfile b/automation/build/centos/7.dockerfile
index 5f83c97d0c..e688a4cece 100644
--- a/automation/build/centos/7.dockerfile
+++ b/automation/build/centos/7.dockerfile
@@ -24,6 +24,7 @@ RUN yum -y install \
         python-devel \
         libuuid-devel \
         pkgconfig \
+        # gettext for Xen < 4.13
         gettext \
         flex \
         bison \
diff --git a/automation/build/debian/jessie-i386.dockerfile b/automation/build/debian/jessie-i386.dockerfile
index 66a6abb381..3f86d91f63 100644
--- a/automation/build/debian/jessie-i386.dockerfile
+++ b/automation/build/debian/jessie-i386.dockerfile
@@ -28,6 +28,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/build/debian/jessie.dockerfile b/automation/build/debian/jessie.dockerfile
index 808d6272e4..2f19adcad3 100644
--- a/automation/build/debian/jessie.dockerfile
+++ b/automation/build/debian/jessie.dockerfile
@@ -26,6 +26,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/build/debian/stretch-i386.dockerfile b/automation/build/debian/stretch-i386.dockerfile
index 7b6f8eff69..c7840d33ab 100644
--- a/automation/build/debian/stretch-i386.dockerfile
+++ b/automation/build/debian/stretch-i386.dockerfile
@@ -29,6 +29,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/build/debian/stretch.dockerfile b/automation/build/debian/stretch.dockerfile
index e3bace1f87..e2ee14e201 100644
--- a/automation/build/debian/stretch.dockerfile
+++ b/automation/build/debian/stretch.dockerfile
@@ -27,6 +27,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/build/debian/unstable-arm64v8.dockerfile b/automation/build/debian/unstable-arm64v8.dockerfile
index 8455d67b72..4409f596e1 100644
--- a/automation/build/debian/unstable-arm64v8.dockerfile
+++ b/automation/build/debian/unstable-arm64v8.dockerfile
@@ -27,6 +27,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         libfdt-dev \
diff --git a/automation/build/debian/unstable-i386.dockerfile b/automation/build/debian/unstable-i386.dockerfile
index 86ff3585df..06ffb97384 100644
--- a/automation/build/debian/unstable-i386.dockerfile
+++ b/automation/build/debian/unstable-i386.dockerfile
@@ -29,6 +29,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/build/debian/unstable.dockerfile b/automation/build/debian/unstable.dockerfile
index 9a10ee08d6..bd61cd12c2 100644
--- a/automation/build/debian/unstable.dockerfile
+++ b/automation/build/debian/unstable.dockerfile
@@ -27,6 +27,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/build/fedora/29.dockerfile b/automation/build/fedora/29.dockerfile
index 5482952523..027b93ceaf 100644
--- a/automation/build/fedora/29.dockerfile
+++ b/automation/build/fedora/29.dockerfile
@@ -17,6 +17,7 @@ RUN dnf -y install \
         python3-devel \
         libuuid-devel \
         pkgconfig \
+        # gettext for Xen < 4.13
         gettext \
         flex \
         bison \
diff --git a/automation/build/suse/opensuse-leap.dockerfile b/automation/build/suse/opensuse-leap.dockerfile
index 685dd5d7fd..573fbd8ae4 100644
--- a/automation/build/suse/opensuse-leap.dockerfile
+++ b/automation/build/suse/opensuse-leap.dockerfile
@@ -22,6 +22,7 @@ RUN zypper install -y --no-recommends \
         flex \
         gcc \
         gcc-c++ \
+        # gettext-tools for Xen < 4.13
         gettext-tools \
         git \
         glib2-devel \
diff --git a/automation/build/suse/opensuse-tumbleweed.dockerfile b/automation/build/suse/opensuse-tumbleweed.dockerfile
index 061173e751..8ff7b9b5ce 100644
--- a/automation/build/suse/opensuse-tumbleweed.dockerfile
+++ b/automation/build/suse/opensuse-tumbleweed.dockerfile
@@ -22,6 +22,7 @@ RUN zypper install -y --no-recommends \
         flex \
         gcc \
         gcc-c++ \
+        # gettext-tools for Xen < 4.13
         gettext-tools \
         git \
         glib2-devel \
diff --git a/automation/build/ubuntu/bionic.dockerfile b/automation/build/ubuntu/bionic.dockerfile
index 408063698c..406a97494c 100644
--- a/automation/build/ubuntu/bionic.dockerfile
+++ b/automation/build/ubuntu/bionic.dockerfile
@@ -27,6 +27,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/build/ubuntu/focal.dockerfile b/automation/build/ubuntu/focal.dockerfile
index 90b4001a6a..952a3172aa 100644
--- a/automation/build/ubuntu/focal.dockerfile
+++ b/automation/build/ubuntu/focal.dockerfile
@@ -26,6 +26,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/build/ubuntu/trusty.dockerfile b/automation/build/ubuntu/trusty.dockerfile
index fd377d948f..b4b2f85e73 100644
--- a/automation/build/ubuntu/trusty.dockerfile
+++ b/automation/build/ubuntu/trusty.dockerfile
@@ -27,6 +27,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/build/ubuntu/xenial.dockerfile b/automation/build/ubuntu/xenial.dockerfile
index 57a71eb8c6..82171d856d 100644
--- a/automation/build/ubuntu/xenial.dockerfile
+++ b/automation/build/ubuntu/xenial.dockerfile
@@ -27,6 +27,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/tests-artifacts/alpine/3.12-arm64v8.dockerfile b/automation/tests-artifacts/alpine/3.12-arm64v8.dockerfile
index 9457009452..7eb1f22940 100644
--- a/automation/tests-artifacts/alpine/3.12-arm64v8.dockerfile
+++ b/automation/tests-artifacts/alpine/3.12-arm64v8.dockerfile
@@ -19,6 +19,7 @@ RUN \
   apk add dbus && \
   apk add bash && \
   apk add python2 && \
+  # gettext for Xen < 4.13
   apk add gettext && \
   apk add zlib && \
   apk add ncurses && \
diff --git a/tools/configure b/tools/configure
index 99d08a4d81..33814b24b3 100755
--- a/tools/configure
+++ b/tools/configure
@@ -689,7 +689,6 @@ INSTALL_PROGRAM
 SET_MAKE
 AWK
 IASL
-XGETTEXT
 FLEX
 BISON
 PERL
@@ -847,7 +846,6 @@ PYTHON
 PERL
 BISON
 FLEX
-XGETTEXT
 AS86
 LD86
 BCC
@@ -1597,7 +1595,6 @@ Some influential environment variables:
   PERL        Path to Perl parser
   BISON       Path to Bison parser generator
   FLEX        Path to Flex lexical analyser generator
-  XGETTEXT    Path to xgetttext tool
   AS86        Path to as86 tool
   LD86        Path to ld86 tool
   BCC         Path to bcc tool
@@ -4738,7 +4735,6 @@ LDFLAGS="$PREPEND_LDFLAGS $LDFLAGS $APPEND_LDFLAGS"
 
 
 
-
 # Checks for programs.
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -7846,51 +7842,6 @@ fi
 
 if ! $rump; then
 
-# Extract the first word of "xgettext", so it can be a program name with args.
-set dummy xgettext; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_XGETTEXT+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $XGETTEXT in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_XGETTEXT="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT="no"
-  ;;
-esac
-fi
-XGETTEXT=$ac_cv_path_XGETTEXT
-if test -n "$XGETTEXT"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5
-$as_echo "$XGETTEXT" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-if test x"${XGETTEXT}" = x"no"
-then
-    as_fn_error $? "Unable to find xgettext, please install xgettext" "$LINENO" 5
-fi
 case "$host_cpu" in
 i[3456]86|x86_64|aarch64)
     # Extract the first word of "iasl", so it can be a program name with args.
diff --git a/tools/configure.ac b/tools/configure.ac
index 636e7077be..6414fcbb44 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -298,7 +298,6 @@ AC_ARG_VAR([PYTHON], [Path to the Python parser])
 AC_ARG_VAR([PERL], [Path to Perl parser])
 AC_ARG_VAR([BISON], [Path to Bison parser generator])
 AC_ARG_VAR([FLEX], [Path to Flex lexical analyser generator])
-AC_ARG_VAR([XGETTEXT], [Path to xgetttext tool])
 AC_ARG_VAR([AS86], [Path to as86 tool])
 AC_ARG_VAR([LD86], [Path to ld86 tool])
 AC_ARG_VAR([BCC], [Path to bcc tool])
@@ -381,7 +380,6 @@ AS_IF([test "$cross_compiling" != yes], [
 
 if ! $rump; then
 
-AX_PATH_PROG_OR_FAIL([XGETTEXT], [xgettext])
 dnl as86, ld86, bcc and iasl are only required when the host system is x86*.
 dnl "host" here means the platform on which the hypervisor and tools is
 dnl going to run, not the platform on which we are building (known as
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 09:33:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 09:33:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107706.205874 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUnVs-0006ph-Tp; Fri, 09 Apr 2021 09:33:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107706.205874; Fri, 09 Apr 2021 09: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 1lUnVs-0006pX-Pl; Fri, 09 Apr 2021 09:33:16 +0000
Received: by outflank-mailman (input) for mailman id 107706;
 Fri, 09 Apr 2021 09:33:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUnVr-0006pR-SV
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 09:33:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUnVr-0006lh-Re
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 09:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUnVr-0007be-QQ
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 09:33:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=r3c9OBsFLiQSjzJXdz0yY4PaM+nvhmEyJdVt8tC5C2U=; b=FC2BjM4JpsIBN+s03YsQawK6AB
	T6YM8dZBe3ezWsxfkhelEE85YHls9rT5IwOrAbr1STyH6/rYar0UcFBPS/7i1kmZ/osVD+lI2gL/m
	XtubqjCIr13CEV5/TWiYkDbj2xMCEXkSywFLDHpZeZ9PbCR1ij5nHVifg1NfFrQnaGDs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs: Simplify internal *.pc files
Message-Id: <E1lUnVr-0007be-QQ@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 09:33:15 +0000

commit 7ae04e1de449843a4b19d684c79ee07e3e42abfc
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 25 14:37:00 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Apr 9 10:31:17 2021 +0100

    tools/libs: Simplify internal *.pc files
    
    The internal package config file for libxenlight reads (reformatted to avoid
    exceeding the SMTP 998-character line length):
    
      Libs: -L${libdir}
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/evtchn
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/call
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/evtchn
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/gnttab
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/foreignmemory
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/call
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/devicemodel
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/ctrl
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/store
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/call
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/hypfs
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/evtchn
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/call
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/evtchn
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/gnttab
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/foreignmemory
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/call
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/devicemodel
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/ctrl
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/guest
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/light
      -lxenlight
    
    Drop duplicate -rpath-link='s to turn it into the slightly-more-manageable:
    
      Libs: -L${libdir}
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/call
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/ctrl
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/devicemodel
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/evtchn
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/foreignmemory
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/gnttab
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/guest
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/hypfs
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/light
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/store
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -lxenlight
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/libs.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 2d973ccb95..84130ccbaf 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -33,7 +33,7 @@ PKG_CONFIG ?= $(LIB_FILE_NAME).pc
 PKG_CONFIG_NAME ?= Xen$(LIBNAME)
 PKG_CONFIG_DESC ?= The $(PKG_CONFIG_NAME) library for Xen hypervisor
 PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
-PKG_CONFIG_USELIBS := $(SHLIB_libxen$(LIBNAME))
+PKG_CONFIG_USELIBS := $(sort $(SHLIB_libxen$(LIBNAME)))
 PKG_CONFIG_LIB := $(LIB_FILE_NAME)
 PKG_CONFIG_REQPRIV := $(subst $(space),$(comma),$(strip $(foreach lib,$(patsubst ctrl,control,$(USELIBS_$(LIBNAME))),xen$(lib))))
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 09:33:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 09:33:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107707.205875 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUnW2-0006qp-UV; Fri, 09 Apr 2021 09:33:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107707.205875; Fri, 09 Apr 2021 09: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 1lUnW2-0006qd-RJ; Fri, 09 Apr 2021 09:33:26 +0000
Received: by outflank-mailman (input) for mailman id 107707;
 Fri, 09 Apr 2021 09:33:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUnW1-0006qT-WE
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 09:33:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUnW1-0006m8-VM
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 09:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUnW1-0007d2-UI
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 09:33:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pJ3LkcV9vTJz7Wc2umTlr1UCkUFKLKU5c+G+EV6a7zE=; b=J2Vnv7ZAZzx/L1YC9nbf6oSUNP
	xfh3TLL7ofSye4SXyivlXdMF3IWSScDJnbD0jXpa+7kfD61jkQS3k/9WHPPxGNcnwcROnR00ZXprY
	QbNZSP1xc59fHepK7bPpqOiECpOwf4PfE1YJcJsSGkIxVZ+bJcD0f6tjlIoMqAYF9PIc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/xsm: Improve alloc/free of evtchn buckets
Message-Id: <E1lUnW1-0007d2-UI@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 09:33:25 +0000

commit 935d501ccbf5b8c4db1f6d0730a4a4c998e9e76a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Jan 16 16:09:10 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Apr 9 10:31:17 2021 +0100

    xen/xsm: Improve alloc/free of evtchn buckets
    
    Currently, flask_alloc_security_evtchn() is called in loops of
    64 (EVTCHNS_PER_BUCKET), which for non-dummy implementations is a function
    pointer call even in the no-op case.  The non no-op case only sets a single
    constant, and doesn't actually fail.
    
    Spectre v2 protections has made function pointer calls far more expensive, and
    64 back-to-back calls is a waste.  Rework the APIs to pass the size of the
    bucket instead, and call them once.
    
    No practical change, but {alloc,free}_evtchn_bucket() should be rather more
    efficient now.
    
    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/common/event_channel.c | 36 ++++++++++++++++--------------------
 xen/include/xsm/dummy.h    |  6 ++++--
 xen/include/xsm/xsm.h      | 14 ++++++++------
 xen/xsm/dummy.c            |  4 ++--
 xen/xsm/flask/hooks.c      | 20 +++++++++++++-------
 5 files changed, 43 insertions(+), 37 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index c94ea74b12..5479315aae 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -147,6 +147,14 @@ static bool virq_is_global(unsigned int virq)
     return true;
 }
 
+static void free_evtchn_bucket(struct domain *d, struct evtchn *bucket)
+{
+    if ( !bucket )
+        return;
+
+    xsm_free_security_evtchns(bucket, EVTCHNS_PER_BUCKET);
+    xfree(bucket);
+}
 
 static struct evtchn *alloc_evtchn_bucket(struct domain *d, unsigned int port)
 {
@@ -155,34 +163,22 @@ static struct evtchn *alloc_evtchn_bucket(struct domain *d, unsigned int port)
 
     chn = xzalloc_array(struct evtchn, EVTCHNS_PER_BUCKET);
     if ( !chn )
-        return NULL;
+        goto err;
+
+    if ( xsm_alloc_security_evtchns(chn, EVTCHNS_PER_BUCKET) )
+        goto err;
 
     for ( i = 0; i < EVTCHNS_PER_BUCKET; i++ )
     {
-        if ( xsm_alloc_security_evtchn(&chn[i]) )
-        {
-            while ( i-- )
-                xsm_free_security_evtchn(&chn[i]);
-            xfree(chn);
-            return NULL;
-        }
         chn[i].port = port + i;
         rwlock_init(&chn[i].lock);
     }
-    return chn;
-}
-
-static void free_evtchn_bucket(struct domain *d, struct evtchn *bucket)
-{
-    unsigned int i;
 
-    if ( !bucket )
-        return;
-
-    for ( i = 0; i < EVTCHNS_PER_BUCKET; i++ )
-        xsm_free_security_evtchn(bucket + i);
+    return chn;
 
-    xfree(bucket);
+ err:
+    free_evtchn_bucket(d, chn);
+    return NULL;
 }
 
 int evtchn_allocate_port(struct domain *d, evtchn_port_t port)
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 10739e7f35..a6dab0c809 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -309,12 +309,14 @@ static XSM_INLINE int xsm_evtchn_reset(XSM_DEFAULT_ARG struct domain *d1, struct
     return xsm_default_action(action, d1, d2);
 }
 
-static XSM_INLINE int xsm_alloc_security_evtchn(struct evtchn *chn)
+static XSM_INLINE int xsm_alloc_security_evtchns(
+    struct evtchn chn[], unsigned int nr)
 {
     return 0;
 }
 
-static XSM_INLINE void xsm_free_security_evtchn(struct evtchn *chn)
+static XSM_INLINE void xsm_free_security_evtchns(
+    struct evtchn chn[], unsigned int nr)
 {
     return;
 }
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 91ecff4f11..7bdd254420 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -72,8 +72,8 @@ struct xsm_operations {
 
     int (*alloc_security_domain) (struct domain *d);
     void (*free_security_domain) (struct domain *d);
-    int (*alloc_security_evtchn) (struct evtchn *chn);
-    void (*free_security_evtchn) (struct evtchn *chn);
+    int (*alloc_security_evtchns) (struct evtchn chn[], unsigned int nr);
+    void (*free_security_evtchns) (struct evtchn chn[], unsigned int nr);
     char *(*show_security_evtchn) (struct domain *d, const struct evtchn *chn);
     int (*init_hardware_domain) (struct domain *d);
 
@@ -314,14 +314,16 @@ static inline void xsm_free_security_domain (struct domain *d)
     xsm_ops->free_security_domain(d);
 }
 
-static inline int xsm_alloc_security_evtchn (struct evtchn *chn)
+static inline int xsm_alloc_security_evtchns(
+    struct evtchn chn[], unsigned int nr)
 {
-    return xsm_ops->alloc_security_evtchn(chn);
+    return xsm_ops->alloc_security_evtchns(chn, nr);
 }
 
-static inline void xsm_free_security_evtchn (struct evtchn *chn)
+static inline void xsm_free_security_evtchns(
+    struct evtchn chn[], unsigned int nr)
 {
-    (void)xsm_ops->free_security_evtchn(chn);
+    xsm_ops->free_security_evtchns(chn, nr);
 }
 
 static inline char *xsm_show_security_evtchn (struct domain *d, const struct evtchn *chn)
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index 8bdffe740e..627f12dbff 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -49,8 +49,8 @@ void __init xsm_fixup_ops (struct xsm_operations *ops)
 
     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_evtchn);
-    set_to_dummy_if_null(ops, free_security_evtchn);
+    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);
 
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 3b7313b949..5a24d01f04 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -307,19 +307,25 @@ static int flask_evtchn_reset(struct domain *d1, struct domain *d2)
     return domain_has_perm(d1, d2, SECCLASS_EVENT, EVENT__RESET);
 }
 
-static int flask_alloc_security_evtchn(struct evtchn *chn)
+static int flask_alloc_security_evtchns(struct evtchn chn[], unsigned int nr)
 {
-    chn->ssid.flask_sid = SECINITSID_UNLABELED;
+    unsigned int i;
+
+    for ( i = 0; i < nr; ++i )
+        chn[i].ssid.flask_sid = SECINITSID_UNLABELED;
 
-    return 0;    
+    return 0;
 }
 
-static void flask_free_security_evtchn(struct evtchn *chn)
+static void flask_free_security_evtchns(struct evtchn chn[], unsigned int nr)
 {
+    unsigned int i;
+
     if ( !chn )
         return;
 
-    chn->ssid.flask_sid = SECINITSID_UNLABELED;
+    for ( i = 0; i < nr; ++i )
+        chn[i].ssid.flask_sid = SECINITSID_UNLABELED;
 }
 
 static char *flask_show_security_evtchn(struct domain *d, const struct evtchn *chn)
@@ -1766,8 +1772,8 @@ static struct xsm_operations flask_ops = {
 
     .alloc_security_domain = flask_domain_alloc_security,
     .free_security_domain = flask_domain_free_security,
-    .alloc_security_evtchn = flask_alloc_security_evtchn,
-    .free_security_evtchn = flask_free_security_evtchn,
+    .alloc_security_evtchns = flask_alloc_security_evtchns,
+    .free_security_evtchns = flask_free_security_evtchns,
     .show_security_evtchn = flask_show_security_evtchn,
     .init_hardware_domain = flask_init_hardware_domain,
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 09 10:11:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Apr 2021 10:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.107738.205936 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lUo6V-0002gM-Bx; Fri, 09 Apr 2021 10:11:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 107738.205936; Fri, 09 Apr 2021 10: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 1lUo6V-0002gE-7F; Fri, 09 Apr 2021 10:11:07 +0000
Received: by outflank-mailman (input) for mailman id 107738;
 Fri, 09 Apr 2021 10:11: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 1lUo6U-0002fz-0q
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 10:11: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 1lUo6T-0007Tm-VH
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 10:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lUo6T-0003uF-Su
 for xen-changelog@lists.xenproject.org; Fri, 09 Apr 2021 10:11:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NMbE9aHKhO/o294YIQZgnmxrhXsAFmqH7mSJd6uaGdQ=; b=gNeNUczBxlJj7KW2Rpl2BRSlnz
	If0W5fmdN715rfFwe9rOw5zROIi3ypxk/AbSSlhmI+wQE4na7lvCzQMkULh0rXVpGRR+4CrXuAQV8
	Bk3VTIjWkqLXCKLZs7k1ecb3TdFpjJBl5t4kFc+KryH1KGvx6Rs/pMvaaWmbLZpE/sbY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.15] build: -no-pie is no functional linker flag
Message-Id: <E1lUo6T-0003uF-Su@xenbits.xenproject.org>
Date: Fri, 09 Apr 2021 10:11:05 +0000

commit e2af2d050338c99e8436e251ad67aafb3ebbd501
Author:     Christian Ehrhardt <christian.ehrhardt@canonical.com>
AuthorDate: Mon Dec 14 16:09:38 2020 +0100
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Wed Apr 7 16:38:52 2021 +0100

    build: -no-pie is no functional linker flag
    
    Recent binutils changes dropping unsupported options [1] caused a build
    issue in regard to the optionroms.
    
      ld -m elf_i386 -T /<<PKGBUILDDIR>>/pc-bios/optionrom//flat.lds -no-pie \
        -s -o multiboot.img multiboot.o
      ld.bfd: Error: unable to disambiguate: -no-pie (did you mean --no-pie ?)
    
    This isn't really a regression in ld.bfd, filing the bug upstream
    revealed that this never worked as a ld flag [2] - in fact it seems we
    were by accident setting --nmagic).
    
    Since it never had the wanted effect this usage of LDFLAGS_NOPIE, should be
    droppable without any effect. This also is the only use-case of LDFLAGS_NOPIE
    in .mak, therefore we can also remove it from being added there.
    
    [1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=983d925d
    [2]: https://sourceware.org/bugzilla/show_bug.cgi?id=27050#c5
    
    Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
    Message-Id: <20201214150938.1297512-1-christian.ehrhardt@canonical.com>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit bbd2d5a8120771ec59b86a80a1f51884e0a26e53)
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 configure                  | 3 ---
 pc-bios/optionrom/Makefile | 4 ++--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 2acc4d1465..71778ec414 100755
--- a/configure
+++ b/configure
@@ -2184,7 +2184,6 @@ EOF
 # Check we support --no-pie first; we will need this for building ROMs.
 if compile_prog "-Werror -fno-pie" "-no-pie"; then
   CFLAGS_NOPIE="-fno-pie"
-  LDFLAGS_NOPIE="-no-pie"
 fi
 
 if test "$static" = "yes"; then
@@ -2200,7 +2199,6 @@ if test "$static" = "yes"; then
   fi
 elif test "$pie" = "no"; then
   QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS"
-  QEMU_LDFLAGS="$LDFLAGS_NOPIE $QEMU_LDFLAGS"
 elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
   QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
   QEMU_LDFLAGS="-pie $QEMU_LDFLAGS"
@@ -7996,7 +7994,6 @@ if test "$sparse" = "yes" ; then
   echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
 fi
 echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
-echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
 echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
 echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
 echo "LIBS+=$LIBS" >> $config_host_mak
diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index e33a24da0d..bbb57ee138 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -47,10 +47,10 @@ build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
 	$(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@,"AS","$(TARGET_DIR)$@")
 
 pvh.img: pvh.o pvh_main.o
-	$(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $^,"BUILD","$(TARGET_DIR)$@")
+	$(call quiet-command,$(LD) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $^,"BUILD","$(TARGET_DIR)$@")
 
 %.img: %.o
-	$(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<,"BUILD","$(TARGET_DIR)$@")
+	$(call quiet-command,$(LD) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<,"BUILD","$(TARGET_DIR)$@")
 
 %.raw: %.img
 	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"BUILD","$(TARGET_DIR)$@")
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Sat Apr 10 02:44:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 10 Apr 2021 02:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.108030.206409 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lV3bQ-00017t-9D; Sat, 10 Apr 2021 02:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 108030.206409; Sat, 10 Apr 2021 02: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 1lV3bQ-00017k-5R; Sat, 10 Apr 2021 02:44:04 +0000
Received: by outflank-mailman (input) for mailman id 108030;
 Sat, 10 Apr 2021 02:44: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 1lV3bP-00017f-4s
 for xen-changelog@lists.xenproject.org; Sat, 10 Apr 2021 02:44: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 1lV3bO-0005jR-Vb
 for xen-changelog@lists.xenproject.org; Sat, 10 Apr 2021 02:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lV3bO-0003fd-T3
 for xen-changelog@lists.xenproject.org; Sat, 10 Apr 2021 02: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=GxGoHzSw1HmXzib+hASw8koc1hlq4DjAUzF2quHNMkA=; b=CI+EriXdTF319rRZMemMRKnplG
	4aHmVBGpu98oE4GckdO6JyPNMIPZXMWJVcwf9YwnCwk0vYjEkVARBFE+udRlb2qc9MkoxWRTHeii4
	nsJktfWvgCh0PHXF312XB/xpu45qulZUzx9af0CdhOdqLVpgbuwVgnJe49vv58+zJhyU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.15] build: -no-pie is no functional linker flag
Message-Id: <E1lV3bO-0003fd-T3@xenbits.xenproject.org>
Date: Sat, 10 Apr 2021 02:44:02 +0000

commit e2af2d050338c99e8436e251ad67aafb3ebbd501
Author:     Christian Ehrhardt <christian.ehrhardt@canonical.com>
AuthorDate: Mon Dec 14 16:09:38 2020 +0100
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Wed Apr 7 16:38:52 2021 +0100

    build: -no-pie is no functional linker flag
    
    Recent binutils changes dropping unsupported options [1] caused a build
    issue in regard to the optionroms.
    
      ld -m elf_i386 -T /<<PKGBUILDDIR>>/pc-bios/optionrom//flat.lds -no-pie \
        -s -o multiboot.img multiboot.o
      ld.bfd: Error: unable to disambiguate: -no-pie (did you mean --no-pie ?)
    
    This isn't really a regression in ld.bfd, filing the bug upstream
    revealed that this never worked as a ld flag [2] - in fact it seems we
    were by accident setting --nmagic).
    
    Since it never had the wanted effect this usage of LDFLAGS_NOPIE, should be
    droppable without any effect. This also is the only use-case of LDFLAGS_NOPIE
    in .mak, therefore we can also remove it from being added there.
    
    [1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=983d925d
    [2]: https://sourceware.org/bugzilla/show_bug.cgi?id=27050#c5
    
    Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
    Message-Id: <20201214150938.1297512-1-christian.ehrhardt@canonical.com>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit bbd2d5a8120771ec59b86a80a1f51884e0a26e53)
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 configure                  | 3 ---
 pc-bios/optionrom/Makefile | 4 ++--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 2acc4d1465..71778ec414 100755
--- a/configure
+++ b/configure
@@ -2184,7 +2184,6 @@ EOF
 # Check we support --no-pie first; we will need this for building ROMs.
 if compile_prog "-Werror -fno-pie" "-no-pie"; then
   CFLAGS_NOPIE="-fno-pie"
-  LDFLAGS_NOPIE="-no-pie"
 fi
 
 if test "$static" = "yes"; then
@@ -2200,7 +2199,6 @@ if test "$static" = "yes"; then
   fi
 elif test "$pie" = "no"; then
   QEMU_CFLAGS="$CFLAGS_NOPIE $QEMU_CFLAGS"
-  QEMU_LDFLAGS="$LDFLAGS_NOPIE $QEMU_LDFLAGS"
 elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
   QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
   QEMU_LDFLAGS="-pie $QEMU_LDFLAGS"
@@ -7996,7 +7994,6 @@ if test "$sparse" = "yes" ; then
   echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
 fi
 echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
-echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
 echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak
 echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
 echo "LIBS+=$LIBS" >> $config_host_mak
diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index e33a24da0d..bbb57ee138 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -47,10 +47,10 @@ build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
 	$(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@,"AS","$(TARGET_DIR)$@")
 
 pvh.img: pvh.o pvh_main.o
-	$(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $^,"BUILD","$(TARGET_DIR)$@")
+	$(call quiet-command,$(LD) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $^,"BUILD","$(TARGET_DIR)$@")
 
 %.img: %.o
-	$(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<,"BUILD","$(TARGET_DIR)$@")
+	$(call quiet-command,$(LD) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<,"BUILD","$(TARGET_DIR)$@")
 
 %.raw: %.img
 	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"BUILD","$(TARGET_DIR)$@")
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Mon Apr 12 10:11:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Apr 2021 10:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.108890.207765 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVtX8-0004Dw-Ey; Mon, 12 Apr 2021 10:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 108890.207765; Mon, 12 Apr 2021 10: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 1lVtX8-0004Do-9U; Mon, 12 Apr 2021 10:11:06 +0000
Received: by outflank-mailman (input) for mailman id 108890;
 Mon, 12 Apr 2021 10:11:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVtX7-0004Dj-Lb
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:11:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVtX7-0002Qw-KJ
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVtX7-0001ch-Iw
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:11:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OnucmT9X3rniP62uQXmZ5i0J5Smj4cFZCJ7fbJ2gfGQ=; b=hWfA82Fv/bDCxhMyW+5hFD+S9d
	prlN53UD0LCIElFEsFHavunUQYCRRrBNcRLS69VCDyGJbFSuldPDqoybnCnmRNxELGd3h8e/dGPOJ
	+kwVxV8rnldR2vKdD6IyucmZdr00nTt10CgWFF7V2ale0SGBkAkJjoNv8P+HbEHNLriI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] post 4.15: Updaate version
Message-Id: <E1lVtX7-0001ch-Iw@xenbits.xenproject.org>
Date: Mon, 12 Apr 2021 10:11:05 +0000

commit e72bf725eb040d862d190357a78f245c2c11220d
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Mon Apr 12 11:06:44 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Apr 12 11:06:44 2021 +0100

    post 4.15: Updaate 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 acb2d28891..d4a7014f59 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 15
-export XEN_EXTRAVERSION ?= .0$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .1-pre$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Mon Apr 12 10:11:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Apr 2021 10:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.108891.207766 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVtXI-0004Eu-FH; Mon, 12 Apr 2021 10:11:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 108891.207766; Mon, 12 Apr 2021 10: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 1lVtXI-0004Em-Bo; Mon, 12 Apr 2021 10:11:16 +0000
Received: by outflank-mailman (input) for mailman id 108891;
 Mon, 12 Apr 2021 10: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 1lVtXH-0004Ef-Oh
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:11:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVtXH-0002Qz-Nm
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVtXH-0001dt-Mh
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:11:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PCOBea3NvBME2F4ZCrL4ekwKYgJkKMLlr9TfNf0sQ4k=; b=t5jPQzGLFt0WAfaai9vxs1jhTH
	x4n+aAPM0A9SJPRFU1wf250uR/VTy5RhMblvEP3S5m2mLFTieXndrI0f4yGhozPfsOnKtACqK+kQv
	FRoS9Z1H6WqZ5AGozGnfA1LKLpI8VO0cMZ8smEXdExwyyMlvrBfMvaPtNdUGDFOUCTfM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] MAINTAINERS: Add stable information, remove checkin policy
Message-Id: <E1lVtXH-0001dt-Mh@xenbits.xenproject.org>
Date: Mon, 12 Apr 2021 10:11:15 +0000

commit c86d8ec3b816cc1317d9cc2fb0817e59b5bc4cfa
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Mon Apr 12 11:09:22 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Apr 12 11:09:22 2021 +0100

    MAINTAINERS: Add stable information, remove checkin policy
    
    As per release-technician-checklist.txt, somewhat ad-hoc.
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 MAINTAINERS | 92 ++++++-------------------------------------------------------
 1 file changed, 9 insertions(+), 83 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 6a7fa8717e..85f660c30f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -54,6 +54,15 @@ list. Remember to copy the appropriate stable branch maintainer who
 will be listed in this section of the MAINTAINERS file in the
 appropriate branch.
 
+The maintainer for this branch is:
+
+	Jan Beulich <jbeulich@suse.com>
+
+Tools backport requests should also be copied to:
+
+	Ian Jackson <Ian.Jackson@eu.citrix.com>
+
+
 	Unstable Subsystem Maintainers
 	==============================
 
@@ -104,89 +113,6 @@ Descriptions of section entries:
 	   xen-maintainers-<version format number of this file>
 
 
-	Check-in policy
-	===============
-
-In order for a patch to be checked in, in general, several conditions
-must be met:
-
-1. In order to get a change to a given file committed, it must have
-   the approval of at least one maintainer of that file.
-
-   A patch of course needs Acks from the maintainers of each file that
-   it changes; so a patch which changes xen/arch/x86/traps.c,
-   xen/arch/x86/mm/p2m.c, and xen/arch/x86/mm/shadow/multi.c would
-   require an Ack from each of the three sets of maintainers.
-
-   See below for rules on nested maintainership.
-
-2. It must have appropriate approval from someone other than the
-   submitter.  This can be either:
-
-  a. An Acked-by from a maintainer of the code being touched (a
-     co-maintainer if available, or a more general level maintainer if
-     not available; see the secton on nested maintainership)
-
-  b. A Reviewed-by by anyone of suitable stature in the community
-
-3. Sufficient time must have been given for anyone to respond.  This
-   depends in large part upon the urgency and nature of the patch.
-   For a straightforward uncontroversial patch, a day or two may be
-   sufficient; for a controversial patch, a week or two may be better.
-
-4. There must be no "open" objections.
-
-In a case where one person submits a patch and a maintainer gives an
-Ack, the Ack stands in for both the approval requirement (#1) and the
-Acked-by-non-submitter requirement (#2).
-
-In a case where a maintainer themselves submits a patch, the
-Signed-off-by meets the approval requirement (#1); so a Review
-from anyone in the community suffices for requirement #2.
-
-Before a maintainer checks in their own patch with another community
-member's R-b but no co-maintainer Ack, it is especially important to
-give their co-maintainer opportunity to give feedback, perhaps
-declaring their intention to check it in without their co-maintainers
-ack a day before doing so.
-
-Maintainers may choose to override non-maintainer objections in the
-case that consensus can't be reached.
-
-As always, no policy can cover all possible situations.  In
-exceptional circumstances, committers may commit a patch in absence of
-one or more of the above requirements, if they are reasonably
-confident that the other maintainers will approve of their decision in
-retrospect.
-
-       The meaning of nesting
-       ======================
-
-Many maintainership areas are "nested": for example, there are entries
-for xen/arch/x86 as well as xen/arch/x86/mm, and even
-xen/arch/x86/mm/shadow; and there is a section at the end called "THE
-REST" which lists all committers.  The meaning of nesting is that:
-
-1. Under normal circumstances, the Ack of the most specific maintainer
-is both necessary and sufficient to get a change to a given file
-committed.  So a change to xen/arch/x86/mm/shadow/multi.c requires the
-the Ack of the xen/arch/x86/mm/shadow maintainer for that part of the
-patch, but would not require the Ack of the xen/arch/x86 maintainer or
-the xen/arch/x86/mm maintainer.
-
-2. In unusual circumstances, a more general maintainer's Ack can stand
-in for or even overrule a specific maintainer's Ack.  Unusual
-circumstances might include:
- - The patch is fixing a high-priority issue causing immediate pain,
- and the more specific maintainer is not available.
- - The more specific maintainer has not responded either to the
- original patch, nor to "pings", within a reasonable amount of time.
- - The more general maintainer wants to overrule the more specific
- maintainer on some issue. (This should be exceptional.)
- - In the case of a disagreement between maintainers, THE REST can
- settle the matter by majority vote.  (This should be very exceptional
- indeed.)
-
 
 Maintainers List (try to look for most precise areas first)
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Mon Apr 12 10:22:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Apr 2021 10:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.108910.207807 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVthm-0005UH-9a; Mon, 12 Apr 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 108910.207807; Mon, 12 Apr 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 1lVthm-0005U9-6O; Mon, 12 Apr 2021 10:22:06 +0000
Received: by outflank-mailman (input) for mailman id 108910;
 Mon, 12 Apr 2021 10: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 1lVthl-0005U1-BK
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10: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 1lVthl-0002c3-72
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVthl-0002lB-5J
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10: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=tHlvqGrzrzbwdFLdee3Uvw0u9khWLmbjGeVMM45/LTE=; b=xASEU3ePLlsVfUjblIE/167P5/
	iuxG/qkHjjNNVRr6c325IQGvx9bsUfzwBzrOjSHAYNPYxTL04Bc/fGzrapAbf1uUNTiA+86QUKPYe
	1xM5y1hwy5ZeiMQDR0fdfMW3/OHrmQybHmZ4ZcLLZxHsCp3iFjcjGRPDKb0D5IPrUbco=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] MAINTAINERS: Belatedly update for this being a stable branch
Message-Id: <E1lVthl-0002lB-5J@xenbits.xenproject.org>
Date: Mon, 12 Apr 2021 10:22:05 +0000

commit 1ebc077a5608bd8eff7e6401696f16c9a266b73f
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Mon Apr 12 11:13:15 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Apr 12 11:13:15 2021 +0100

    MAINTAINERS: Belatedly update for this being a stable branch
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 MAINTAINERS | 92 ++++++-------------------------------------------------------
 1 file changed, 9 insertions(+), 83 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index e374816755..4b72a6adae 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -54,6 +54,15 @@ list. Remember to copy the appropriate stable branch maintainer who
 will be listed in this section of the MAINTAINERS file in the
 appropriate branch.
 
+The maintainer for this branch is:
+
+	Jan Beulich <jbeulich@suse.com>
+
+Tools backport requests should also be copied to:
+
+	Ian Jackson <Ian.Jackson@eu.citrix.com>
+
+
 	Unstable Subsystem Maintainers
 	==============================
 
@@ -104,89 +113,6 @@ Descriptions of section entries:
 	   xen-maintainers-<version format number of this file>
 
 
-	Check-in policy
-	===============
-
-In order for a patch to be checked in, in general, several conditions
-must be met:
-
-1. In order to get a change to a given file committed, it must have
-   the approval of at least one maintainer of that file.
-
-   A patch of course needs Acks from the maintainers of each file that
-   it changes; so a patch which changes xen/arch/x86/traps.c,
-   xen/arch/x86/mm/p2m.c, and xen/arch/x86/mm/shadow/multi.c would
-   require an Ack from each of the three sets of maintainers.
-
-   See below for rules on nested maintainership.
-
-2. It must have appropriate approval from someone other than the
-   submitter.  This can be either:
-
-  a. An Acked-by from a maintainer of the code being touched (a
-     co-maintainer if available, or a more general level maintainer if
-     not available; see the secton on nested maintainership)
-
-  b. A Reviewed-by by anyone of suitable stature in the community
-
-3. Sufficient time must have been given for anyone to respond.  This
-   depends in large part upon the urgency and nature of the patch.
-   For a straightforward uncontroversial patch, a day or two may be
-   sufficient; for a controversial patch, a week or two may be better.
-
-4. There must be no "open" objections.
-
-In a case where one person submits a patch and a maintainer gives an
-Ack, the Ack stands in for both the approval requirement (#1) and the
-Acked-by-non-submitter requirement (#2).
-
-In a case where a maintainer themselves submits a patch, the
-Signed-off-by meets the approval requirement (#1); so a Review
-from anyone in the community suffices for requirement #2.
-
-Before a maintainer checks in their own patch with another community
-member's R-b but no co-maintainer Ack, it is especially important to
-give their co-maintainer opportunity to give feedback, perhaps
-declaring their intention to check it in without their co-maintainers
-ack a day before doing so.
-
-Maintainers may choose to override non-maintainer objections in the
-case that consensus can't be reached.
-
-As always, no policy can cover all possible situations.  In
-exceptional circumstances, committers may commit a patch in absence of
-one or more of the above requirements, if they are reasonably
-confident that the other maintainers will approve of their decision in
-retrospect.
-
-       The meaning of nesting
-       ======================
-
-Many maintainership areas are "nested": for example, there are entries
-for xen/arch/x86 as well as xen/arch/x86/mm, and even
-xen/arch/x86/mm/shadow; and there is a section at the end called "THE
-REST" which lists all committers.  The meaning of nesting is that:
-
-1. Under normal circumstances, the Ack of the most specific maintainer
-is both necessary and sufficient to get a change to a given file
-committed.  So a change to xen/arch/x86/mm/shadow/multi.c requires the
-the Ack of the xen/arch/x86/mm/shadow maintainer for that part of the
-patch, but would not require the Ack of the xen/arch/x86 maintainer or
-the xen/arch/x86/mm maintainer.
-
-2. In unusual circumstances, a more general maintainer's Ack can stand
-in for or even overrule a specific maintainer's Ack.  Unusual
-circumstances might include:
- - The patch is fixing a high-priority issue causing immediate pain,
- and the more specific maintainer is not available.
- - The more specific maintainer has not responded either to the
- original patch, nor to "pings", within a reasonable amount of time.
- - The more general maintainer wants to overrule the more specific
- maintainer on some issue. (This should be exceptional.)
- - In the case of a disagreement between maintainers, THE REST can
- settle the matter by majority vote.  (This should be very exceptional
- indeed.)
-
 
 Maintainers List (try to look for most precise areas first)
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Mon Apr 12 10:44:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Apr 2021 10:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.108932.207859 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu3A-0007g5-0t; Mon, 12 Apr 2021 10:44:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 108932.207859; Mon, 12 Apr 2021 10:44:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu39-0007fx-UH; Mon, 12 Apr 2021 10:44:11 +0000
Received: by outflank-mailman (input) for mailman id 108932;
 Mon, 12 Apr 2021 10:44:10 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu38-0007fo-RF
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:44:10 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu38-0002xZ-O3
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:44:10 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu38-00051b-L5
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:44:10 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FmBivPuSoFdqOnFeKk3wTs1edi5x5l2m9jg/+2wL5jU=; b=6Thh9cthwtSq3w1wurilNR4OuK
	BjzNo5sW2PDb5Zncqu1/eow26SILI98SZiutwoQF0bXklun5MWS86rvf4Gsvdkq7Iz7SEBz7BiFst
	HZY0Fad3QUcsSKbkM1eDjArF7jEhH9Ms+D4XwSrzEg69ph1zNiRbmyLl/tsG1P+vYToU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxenguest: drop redundant decompression declarations
Message-Id: <E1lVu38-00051b-L5@xenbits.xenproject.org>
Date: Mon, 12 Apr 2021 10:44:10 +0000

commit c5dad825d98a818cbc123a22777bd7110d00bffb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:25:55 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:25:55 2021 +0200

    libxenguest: drop redundant decompression declarations
    
    The ones in xg_dom_decompress_unsafe.h suffice.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/guest/xg_dom_bzimageloader.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/tools/libs/guest/xg_dom_bzimageloader.c b/tools/libs/guest/xg_dom_bzimageloader.c
index 55457d901b..0fa6d1ef92 100644
--- a/tools/libs/guest/xg_dom_bzimageloader.c
+++ b/tools/libs/guest/xg_dom_bzimageloader.c
@@ -673,13 +673,6 @@ static int xc_try_zstd_decode(
 
 #endif
 
-#else /* __MINIOS__ */
-
-int xc_try_bzip2_decode(struct xc_dom_image *dom, void **blob, size_t *size);
-int xc_try_lzma_decode(struct xc_dom_image *dom, void **blob, size_t *size);
-int xc_try_lzo1x_decode(struct xc_dom_image *dom, void **blob, size_t *size);
-int xc_try_xz_decode(struct xc_dom_image *dom, void **blob, size_t *size);
-
 #endif /* !__MINIOS__ */
 
 struct setup_header {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 12 10:44:22 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Apr 2021 10:44:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.108933.207863 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu3K-0007hL-2e; Mon, 12 Apr 2021 10:44:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 108933.207863; Mon, 12 Apr 2021 10:44:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu3J-0007hD-Vu; Mon, 12 Apr 2021 10:44:21 +0000
Received: by outflank-mailman (input) for mailman id 108933;
 Mon, 12 Apr 2021 10:44:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu3I-0007h0-V7
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:44:20 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu3I-0002xf-UG
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:44:20 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu3I-00052P-Qn
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:44:20 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZkJa9e3wlZmF4ffQj/7muzymT5mksRTnki77ReTdhiA=; b=OJoU9CqxBCuN4d7ScpemskidUS
	/dbZ5g49v7xGeb/Gvg7CEQNlVEBacOKaYjennboAMKKJlvR9mxNBHykXwZGihqQbqymLctSfj+QHr
	fQsyFF/CiINi+ilGy6/+dYw1VbjVcOM242iei3NNpzxs1k7zqNB5NnuDkI4CSSfaQAWM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxenguest: simplify kernel decompression
Message-Id: <E1lVu3I-00052P-Qn@xenbits.xenproject.org>
Date: Mon, 12 Apr 2021 10:44:20 +0000

commit d3d9889467ca4a0ddc5dc9222d353c37a3e8dc6a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:26:18 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:26:18 2021 +0200

    libxenguest: simplify kernel decompression
    
    In all cases the kernel build makes available the uncompressed size in
    the final 4 bytes of the bzImage payload. Utilize this to avoid
    repeated realloc()ing of the output buffer.
    
    As a side effect this also addresses the previous mistaken return of 0
    (success) from xc_try_{bzip2,lzma,xz}_decode() in case
    xc_dom_register_external() would have failed.
    
    As another side effect this also addresses the first error path of
    _xc_try_lzma_decode() previously bypassing lzma_end().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/guest/xg_dom_bzimageloader.c | 297 +++++++++++++-------------------
 1 file changed, 124 insertions(+), 173 deletions(-)

diff --git a/tools/libs/guest/xg_dom_bzimageloader.c b/tools/libs/guest/xg_dom_bzimageloader.c
index 0fa6d1ef92..764ddbb43e 100644
--- a/tools/libs/guest/xg_dom_bzimageloader.c
+++ b/tools/libs/guest/xg_dom_bzimageloader.c
@@ -48,18 +48,16 @@ static int xc_try_bzip2_decode(
     bz_stream stream;
     int ret;
     char *out_buf;
-    char *tmp_buf;
     int retval = -1;
-    unsigned int outsize;
-    uint64_t total;
+    unsigned int insize, outsize;
 
     stream.bzalloc = NULL;
     stream.bzfree = NULL;
     stream.opaque = NULL;
 
-    if ( dom->kernel_size == 0)
+    if ( *size <= 8 )
     {
-        DOMPRINTF("BZIP2: Input is 0 size");
+        DOMPRINTF("BZIP2: insufficient input data");
         return -1;
     }
 
@@ -70,22 +68,25 @@ static int xc_try_bzip2_decode(
         return -1;
     }
 
-    /* sigh.  We don't know up-front how much memory we are going to need
-     * for the output buffer.  Allocate the output buffer to be equal
-     * the input buffer to start, and we'll realloc as needed.
-     */
-    outsize = dom->kernel_size;
+    insize = *size - 4;
+    outsize = get_unaligned_le32(*blob + insize);
 
     /*
-     * stream.avail_in and outsize are unsigned int, while kernel_size
+     * stream.avail_in and insize are unsigned int, while *size
      * is a size_t. Check we aren't overflowing.
      */
-    if ( outsize != dom->kernel_size )
+    if ( insize + 4 != *size )
     {
         DOMPRINTF("BZIP2: Input too large");
         goto bzip2_cleanup;
     }
 
+    if ( xc_dom_kernel_check_size(dom, outsize) )
+    {
+        DOMPRINTF("BZIP2: output too large");
+        goto bzip2_cleanup;
+    }
+
     out_buf = malloc(outsize);
     if ( out_buf == NULL )
     {
@@ -94,86 +95,45 @@ static int xc_try_bzip2_decode(
     }
 
     stream.next_in = dom->kernel_blob;
-    stream.avail_in = dom->kernel_size;
+    stream.avail_in = insize;
 
     stream.next_out = out_buf;
-    stream.avail_out = dom->kernel_size;
+    stream.avail_out = outsize;
 
-    for ( ; ; )
+    ret = BZ2_bzDecompress(&stream);
+    if ( ret == BZ_STREAM_END )
+        DOMPRINTF("BZIP2: Saw data stream end");
+    else if ( ret != BZ_OK )
     {
-        ret = BZ2_bzDecompress(&stream);
-        if ( ret == BZ_STREAM_END )
-        {
-            DOMPRINTF("BZIP2: Saw data stream end");
-            retval = 0;
-            break;
-        }
-        if ( ret != BZ_OK )
-        {
-            DOMPRINTF("BZIP2: error %d", ret);
-            free(out_buf);
-            goto bzip2_cleanup;
-        }
+        DOMPRINTF("BZIP2: error %d", ret);
+        free(out_buf);
+        goto bzip2_cleanup;
+    }
 
-        if ( stream.avail_out == 0 )
-        {
-            /* Protect against output buffer overflow */
-            if ( outsize > UINT_MAX / 2 )
-            {
-                DOMPRINTF("BZIP2: output buffer overflow");
-                free(out_buf);
-                goto bzip2_cleanup;
-            }
-
-            if ( xc_dom_kernel_check_size(dom, outsize * 2) )
-            {
-                DOMPRINTF("BZIP2: output too large");
-                free(out_buf);
-                goto bzip2_cleanup;
-            }
-
-            tmp_buf = realloc(out_buf, outsize * 2);
-            if ( tmp_buf == NULL )
-            {
-                DOMPRINTF("BZIP2: Failed to realloc memory");
-                free(out_buf);
-                goto bzip2_cleanup;
-            }
-            out_buf = tmp_buf;
-
-            stream.next_out = out_buf + outsize;
-            stream.avail_out = (outsize * 2) - outsize;
-            outsize *= 2;
-        }
-        else if ( stream.avail_in == 0 )
-        {
-            /*
-             * If there is output buffer available then this indicates
-             * that BZ2_bzDecompress would like more input data to be
-             * provided.  However our complete input buffer is in
-             * memory and provided upfront so if avail_in is zero this
-             * actually indicates a truncated input.
-             */
-            DOMPRINTF("BZIP2: not enough input");
-            free(out_buf);
-            goto bzip2_cleanup;
-        }
+    if ( stream.total_out_lo32 != outsize || stream.total_out_hi32 )
+    {
+        DOMPRINTF("BZIP2: got 0x%x%08x bytes instead of 0x%09x",
+                  stream.total_out_hi32, stream.total_out_lo32, outsize);
+        free(out_buf);
+        goto bzip2_cleanup;
     }
 
-    total = (((uint64_t)stream.total_out_hi32) << 32) | stream.total_out_lo32;
+    if ( stream.avail_in )
+        DOMPRINTF("BZIP2: Warning: %#x unconsumed bytes", stream.avail_in);
 
-    if ( xc_dom_register_external(dom, out_buf, total) )
+    if ( xc_dom_register_external(dom, out_buf, outsize) )
     {
         DOMPRINTF("BZIP2: Error registering stream output");
         free(out_buf);
         goto bzip2_cleanup;
     }
 
-    DOMPRINTF("%s: BZIP2 decompress OK, 0x%zx -> 0x%lx",
-              __FUNCTION__, *size, (long unsigned int) total);
+    DOMPRINTF("%s: BZIP2 decompress OK, 0x%zx -> 0x%x",
+              __FUNCTION__, *size, outsize);
 
     *blob = out_buf;
-    *size = total;
+    *size = outsize;
+    retval = 0;
 
  bzip2_cleanup:
     BZ2_bzDecompressEnd(&stream);
@@ -205,22 +165,24 @@ static int _xc_try_lzma_decode(
     lzma_ret ret;
     lzma_action action = LZMA_RUN;
     unsigned char *out_buf;
-    unsigned char *tmp_buf;
     int retval = -1;
-    size_t outsize;
-    const char *msg;
+    size_t insize, outsize;
 
-    if ( dom->kernel_size == 0)
+    if ( *size < 8 )
     {
-        DOMPRINTF("%s: Input is 0 size", what);
-        return -1;
+        DOMPRINTF("%s: insufficient input data", what);
+        goto lzma_cleanup;
+    }
+
+    insize = *size - 4;
+    outsize = get_unaligned_le32(*blob + insize);
+
+    if ( xc_dom_kernel_check_size(dom, outsize) )
+    {
+        DOMPRINTF("%s: output too large", what);
+        goto lzma_cleanup;
     }
 
-    /* sigh.  We don't know up-front how much memory we are going to need
-     * for the output buffer.  Allocate the output buffer to be equal
-     * the input buffer to start, and we'll realloc as needed.
-     */
-    outsize = dom->kernel_size;
     out_buf = malloc(outsize);
     if ( out_buf == NULL )
     {
@@ -229,92 +191,68 @@ static int _xc_try_lzma_decode(
     }
 
     stream->next_in = dom->kernel_blob;
-    stream->avail_in = dom->kernel_size;
+    stream->avail_in = insize;
 
     stream->next_out = out_buf;
-    stream->avail_out = dom->kernel_size;
+    stream->avail_out = outsize;
 
-    for ( ; ; )
+    ret = lzma_code(stream, action);
+    if ( ret == LZMA_STREAM_END )
+        DOMPRINTF("%s: Saw data stream end", what);
+    else if ( ret != LZMA_OK )
     {
-        ret = lzma_code(stream, action);
-        if ( ret == LZMA_STREAM_END )
+        const char *msg;
+
+        switch ( ret )
         {
-            DOMPRINTF("%s: Saw data stream end", what);
-            retval = 0;
+        case LZMA_MEM_ERROR:
+            msg = strerror(ENOMEM);
             break;
-        }
-        if ( ret != LZMA_OK )
-        {
-            switch ( ret )
-            {
-            case LZMA_MEM_ERROR:
-                msg = strerror(ENOMEM);
-                break;
 
-            case LZMA_MEMLIMIT_ERROR:
-                msg = "Memory usage limit reached";
-                break;
+        case LZMA_MEMLIMIT_ERROR:
+            msg = "Memory usage limit reached";
+            break;
 
-            case LZMA_FORMAT_ERROR:
-                msg = "File format not recognized";
-                break;
+        case LZMA_FORMAT_ERROR:
+            msg = "File format not recognized";
+            break;
 
-            case LZMA_OPTIONS_ERROR:
-                // FIXME: Better message?
-                msg = "Unsupported compression options";
-                break;
+        case LZMA_OPTIONS_ERROR:
+            // FIXME: Better message?
+            msg = "Unsupported compression options";
+            break;
 
-            case LZMA_DATA_ERROR:
-                msg = "File is corrupt";
-                break;
+        case LZMA_DATA_ERROR:
+            msg = "File is corrupt";
+            break;
 
-            case LZMA_BUF_ERROR:
-                msg = "Unexpected end of input";
-                break;
+        case LZMA_BUF_ERROR:
+            msg = "Unexpected end of input";
+            break;
 
-            default:
-                msg = "Internal program error (bug)";
-                break;
-            }
-            DOMPRINTF("%s: %s decompression error: %s",
-                      __FUNCTION__, what, msg);
-            free(out_buf);
-            goto lzma_cleanup;
+         default:
+            msg = "Internal program error (bug)";
+            break;
         }
 
-        if ( stream->avail_out == 0 )
-        {
-            /* Protect against output buffer overflow */
-            if ( outsize > SIZE_MAX / 2 )
-            {
-                DOMPRINTF("%s: output buffer overflow", what);
-                free(out_buf);
-                goto lzma_cleanup;
-            }
-
-            if ( xc_dom_kernel_check_size(dom, outsize * 2) )
-            {
-                DOMPRINTF("%s: output too large", what);
-                free(out_buf);
-                goto lzma_cleanup;
-            }
-
-            tmp_buf = realloc(out_buf, outsize * 2);
-            if ( tmp_buf == NULL )
-            {
-                DOMPRINTF("%s: Failed to realloc memory", what);
-                free(out_buf);
-                goto lzma_cleanup;
-            }
-            out_buf = tmp_buf;
-
-            stream->next_out = out_buf + outsize;
-            stream->avail_out = (outsize * 2) - outsize;
-            outsize *= 2;
-        }
+        DOMPRINTF("%s: %s decompression error: %s",
+                  __FUNCTION__, what, msg);
+        free(out_buf);
+        goto lzma_cleanup;
     }
 
-    if ( xc_dom_register_external(dom, out_buf, stream->total_out) )
+    if ( stream->total_out != outsize )
+    {
+        DOMPRINTF("%s: got 0x%"PRIx64" bytes instead of 0x%zx",
+                  what, stream->total_out, outsize);
+        free(out_buf);
+        goto lzma_cleanup;
+    }
+
+    if ( stream->avail_in )
+        DOMPRINTF("%s: Warning: %#zx unconsumed bytes", what, stream->avail_in);
+
+    if ( xc_dom_register_external(dom, out_buf, outsize) )
     {
         DOMPRINTF("%s: Error registering stream output", what);
         free(out_buf);
@@ -322,10 +260,11 @@ static int _xc_try_lzma_decode(
     }
 
     DOMPRINTF("%s: %s decompress OK, 0x%zx -> 0x%zx",
-              __FUNCTION__, what, *size, (size_t)stream->total_out);
+              __FUNCTION__, what, *size, outsize);
 
     *blob = out_buf;
-    *size = stream->total_out;
+    *size = outsize;
+    retval = 0;
 
  lzma_cleanup:
     lzma_end(stream);
@@ -408,8 +347,8 @@ static int xc_try_lzo1x_decode(
 {
     int ret;
     const unsigned char *cur = dom->kernel_blob;
-    unsigned char *out_buf = NULL;
-    size_t left = dom->kernel_size, outsize;
+    unsigned char *out_buf;
+    size_t left = dom->kernel_size, outsize, outtot;
     const char *msg;
     unsigned version;
     static const unsigned char magic[] = {
@@ -435,6 +374,15 @@ static int xc_try_lzo1x_decode(
         return -1;
     }
 
+    left -= 4;
+    outtot = get_unaligned_le32(*blob + left);
+
+    if ( xc_dom_kernel_check_size(dom, outtot) )
+    {
+        DOMPRINTF("LZO1x: output too large");
+        return -1;
+    }
+
     /* get version (2bytes), skip library version (2),
      * 'need to be extracted' version (2) and method (1) */
     version = lzo_read_16(cur + 9);
@@ -471,10 +419,16 @@ static int xc_try_lzo1x_decode(
     cur += ret;
     left -= ret;
 
+    out_buf = malloc(outtot);
+    if ( !out_buf )
+    {
+        DOMPRINTF("LZO1x: failed to alloc memory");
+        return -1;
+    }
+
     for ( outsize = 0; ; )
     {
         lzo_uint src_len, dst_len, out_len;
-        unsigned char *tmp_buf;
 
         msg = "Short input";
         if ( left < 4 )
@@ -483,6 +437,13 @@ static int xc_try_lzo1x_decode(
         dst_len = lzo_read_32(cur);
         if ( !dst_len )
         {
+            msg = "Unexpected output size";
+            if ( outsize != outtot )
+                break;
+
+            if ( left != 4 )
+                DOMPRINTF("LZO1x: Warning: %#zx unconsumed bytes", left - 4);
+
             msg = "Error registering stream output";
             if ( xc_dom_register_external(dom, out_buf, outsize) )
                 break;
@@ -514,19 +475,9 @@ static int xc_try_lzo1x_decode(
             break;
 
         msg = "Output buffer overflow";
-        if ( outsize > SIZE_MAX - dst_len )
-            break;
-
-        msg = "Decompressed image too large";
-        if ( xc_dom_kernel_check_size(dom, outsize + dst_len) )
-            break;
-
-        msg = "Failed to (re)alloc memory";
-        tmp_buf = realloc(out_buf, outsize + dst_len);
-        if ( tmp_buf == NULL )
+        if ( dst_len > outtot - outsize )
             break;
 
-        out_buf = tmp_buf;
         out_len = dst_len;
 
         ret = lzo1x_decompress_safe(cur, src_len,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 12 10:44:32 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Apr 2021 10:44:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.108935.207867 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu3U-0007j1-5f; Mon, 12 Apr 2021 10:44:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 108935.207867; Mon, 12 Apr 2021 10:44:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu3U-0007iv-2O; Mon, 12 Apr 2021 10:44:32 +0000
Received: by outflank-mailman (input) for mailman id 108935;
 Mon, 12 Apr 2021 10:44: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 1lVu3T-0007il-1h
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:44:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu3T-0002xm-0t
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:44:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu3T-00053t-0G
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:44:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SjHhRJdnze0X2fCjCmtVT6LCyPsjyD5fKeEbzMqAKFM=; b=63Vq0BlORkmtLNhT+BIWEjsZ6P
	zrPwFsu+sHSlmjXKFINCi1azHG7nWV3RUqizDqhAyXWEWaKY+XrI/PapX6h6JKLv2aHJlCXsteyBB
	eRnmtjPa2yNHH1zWnzONWwUHB9tmJM0139UoQbyK6O4wZyIUh59TvtRSimfhw8Pdw0+M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] gunzip: drop INIT{,DATA} and STATIC
Message-Id: <E1lVu3T-00053t-0G@xenbits.xenproject.org>
Date: Mon, 12 Apr 2021 10:44:31 +0000

commit b0c2213a1c72fefda1cd0f7c9f30dde655bfb5ad
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:26:54 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:26:54 2021 +0200

    gunzip: drop INIT{,DATA} and STATIC
    
    There's no need for the extra abstraction.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 xen/common/gunzip.c  |  4 ---
 xen/common/inflate.c | 75 ++++++++++++++++++++++++----------------------------
 2 files changed, 35 insertions(+), 44 deletions(-)

diff --git a/xen/common/gunzip.c b/xen/common/gunzip.c
index 425d64e904..b9ecc17e44 100644
--- a/xen/common/gunzip.c
+++ b/xen/common/gunzip.c
@@ -22,7 +22,6 @@ static unsigned __initdata inptr;
 static unsigned __initdata outcnt;
 
 #define OF(args)        args
-#define STATIC          static
 
 #define memzero(s, n)   memset((s), 0, (n))
 
@@ -30,9 +29,6 @@ typedef unsigned char   uch;
 typedef unsigned short  ush;
 typedef unsigned long   ulg;
 
-#define INIT            __init
-#define INITDATA        __initdata
-
 #define get_byte()      (inptr < insize ? inbuf[inptr++] : fill_inbuf())
 
 /* Diagnostic functions */
diff --git a/xen/common/inflate.c b/xen/common/inflate.c
index c593b94d48..8fa4b96d12 100644
--- a/xen/common/inflate.c
+++ b/xen/common/inflate.c
@@ -107,7 +107,7 @@
 static char rcsid[] = "#Id: inflate.c,v 0.14 1993/06/10 13:27:04 jloup Exp #";
 #endif
 
-#ifndef STATIC
+#ifndef __XEN__
 
 #if defined(STDC_HEADERS) || defined(HAVE_STDLIB_H)
 #  include <sys/types.h>
@@ -115,14 +115,9 @@ static char rcsid[] = "#Id: inflate.c,v 0.14 1993/06/10 13:27:04 jloup Exp #";
 #endif
 
 #include "gzip.h"
-#define STATIC
-#endif /* !STATIC */
 
-#ifndef INIT
-#define INIT
-#define INITDATA
-#endif
- 
+#endif /* !__XEN__ */
+
 #define slide window
 
 /* Huffman code lookup table entry--this entry is four bytes for machines
@@ -143,15 +138,15 @@ struct huft {
 
 
 /* Function prototypes */
-STATIC int INIT huft_build OF((unsigned *, unsigned, unsigned, 
-                               const ush *, const ush *, struct huft **, int *));
-STATIC int INIT huft_free OF((struct huft *));
-STATIC int INIT inflate_codes OF((struct huft *, struct huft *, int, int));
-STATIC int INIT inflate_stored OF((void));
-STATIC int INIT inflate_fixed OF((void));
-STATIC int INIT inflate_dynamic OF((void));
-STATIC int INIT inflate_block OF((int *));
-STATIC int INIT inflate OF((void));
+static int huft_build OF((unsigned *, unsigned, unsigned,
+                          const ush *, const ush *, struct huft **, int *));
+static int huft_free OF((struct huft *));
+static int inflate_codes OF((struct huft *, struct huft *, int, int));
+static int inflate_stored OF((void));
+static int inflate_fixed OF((void));
+static int inflate_dynamic OF((void));
+static int inflate_block OF((int *));
+static int inflate OF((void));
 
 
 /* The inflate algorithm uses a sliding 32 K byte window on the uncompressed
@@ -217,10 +212,10 @@ static const ush cpdext[] = {         /* Extra bits for distance codes */
    the stream.
  */
 
-STATIC ulg INITDATA bb;                /* bit buffer */
-STATIC unsigned INITDATA bk;           /* bits in bit buffer */
+static ulg __initdata bb;                /* bit buffer */
+static unsigned __initdata bk;           /* bits in bit buffer */
 
-STATIC const ush mask_bits[] = {
+static const ush mask_bits[] = {
     0x0000,
     0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
     0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
@@ -235,16 +230,16 @@ STATIC const ush mask_bits[] = {
  *  malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
  */
 
-static unsigned long INITDATA malloc_ptr;
-static int INITDATA malloc_count;
+static unsigned long __initdata malloc_ptr;
+static int __initdata malloc_count;
 
-static void INIT init_allocator(void)
+static void __init init_allocator(void)
 {
     malloc_ptr = free_mem_ptr;
     malloc_count = 0;
 }
 
-static void *INIT malloc(int size)
+static void *__init malloc(int size)
 {
     void *p;
 
@@ -265,7 +260,7 @@ static void *INIT malloc(int size)
     return p;
 }
 
-static void INIT free(void *where)
+static void __init free(void *where)
 {
     malloc_count--;
     if (!malloc_count)
@@ -309,8 +304,8 @@ static void INIT free(void *where)
  */
 
 
-STATIC const int lbits = 9;          /* bits in base literal/length lookup table */
-STATIC const int dbits = 6;          /* bits in base distance lookup table */
+static const int lbits = 9;          /* bits in base literal/length lookup table */
+static const int dbits = 6;          /* bits in base distance lookup table */
 
 
 /* If BMAX needs to be larger than 16, then h and x[] should be ulg. */
@@ -318,10 +313,10 @@ STATIC const int dbits = 6;          /* bits in base distance lookup table */
 #define N_MAX 288       /* maximum number of codes in any set */
 
 
-STATIC unsigned INITDATA hufts;      /* track memory usage */
+static unsigned __initdata hufts;      /* track memory usage */
 
 
-STATIC int INIT huft_build(
+static int __init huft_build(
     unsigned *b,            /* code lengths in bits (all assumed <= BMAX) */
     unsigned n,             /* number of codes (assumed <= N_MAX) */
     unsigned s,             /* number of simple-valued codes (0..s-1) */
@@ -566,7 +561,7 @@ STATIC int INIT huft_build(
 
 
 
-STATIC int INIT huft_free(
+static int __init huft_free(
     struct huft *t         /* table to free */
     )
 /* Free the malloc'ed tables built by huft_build(), which makes a linked
@@ -588,7 +583,7 @@ STATIC int INIT huft_free(
 }
 
 
-STATIC int INIT inflate_codes(
+static int __init inflate_codes(
     struct huft *tl,    /* literal/length decoder tables */
     struct huft *td,    /* distance decoder tables */
     int bl,             /* number of bits decoded by tl[] */
@@ -703,7 +698,7 @@ STATIC int INIT inflate_codes(
 
 
 
-STATIC int INIT inflate_stored(void)
+static int __init inflate_stored(void)
 /* "decompress" an inflated type 0 (stored) block. */
 {
     unsigned n;           /* number of bytes in block */
@@ -764,7 +759,7 @@ STATIC int INIT inflate_stored(void)
 /*
  * We use `noinline' here to prevent gcc-3.5 from using too much stack space
  */
-STATIC int noinline INIT inflate_fixed(void)
+static int noinline __init inflate_fixed(void)
 /* decompress an inflated type 1 (fixed Huffman codes) block.  We should
    either replace this with a custom decoder, or at least precompute the
    Huffman tables. */
@@ -828,7 +823,7 @@ STATIC int noinline INIT inflate_fixed(void)
 /*
  * We use `noinline' here to prevent gcc-3.5 from using too much stack space
  */
-STATIC int noinline INIT inflate_dynamic(void)
+static int noinline __init inflate_dynamic(void)
 /* decompress an inflated type 2 (dynamic Huffman codes) block. */
 {
     int i;                /* temporary variables */
@@ -1033,7 +1028,7 @@ goto out;
 
 
 
-STATIC int INIT inflate_block(
+static int __init inflate_block(
 int *e                  /* last block flag */
 )
 /* decompress an inflated block */
@@ -1084,7 +1079,7 @@ NEEDBITS(1)
 
 
 
-STATIC int INIT inflate(void)
+static int __init inflate(void)
 /* decompress an inflated entry */
 {
     int e;                /* last block flag */
@@ -1136,8 +1131,8 @@ STATIC int INIT inflate(void)
  *
  **********************************************************************/
 
-static ulg INITDATA crc_32_tab[256];
-static ulg INITDATA crc;  /* initialized in makecrc() so it'll reside in bss */
+static ulg __initdata crc_32_tab[256];
+static ulg __initdata crc;  /* initialized in makecrc() so it'll reside in bss */
 #define CRC_VALUE (crc ^ 0xffffffffUL)
 
 /*
@@ -1145,7 +1140,7 @@ static ulg INITDATA crc;  /* initialized in makecrc() so it'll reside in bss */
  * gzip-1.0.3/makecrc.c.
  */
 
-static void INIT
+static void __init
 makecrc(void)
 {
 /* Not copyrighted 1990 Mark Adler */
@@ -1193,7 +1188,7 @@ makecrc(void)
 /*
  * Do the uncompression!
  */
-static int INIT gunzip(void)
+static int __init gunzip(void)
 {
     uch flags;
     unsigned char magic[2]; /* magic header */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 12 10:44:42 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Apr 2021 10:44:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.108936.207871 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu3e-0007kX-7X; Mon, 12 Apr 2021 10:44:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 108936.207871; Mon, 12 Apr 2021 10:44:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu3e-0007kP-41; Mon, 12 Apr 2021 10:44:42 +0000
Received: by outflank-mailman (input) for mailman id 108936;
 Mon, 12 Apr 2021 10:44:41 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu3d-0007kI-4r
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:44:41 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu3d-0002y6-47
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:44:41 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu3d-00054y-3E
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:44:41 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Hr0mkh55KyZVkeOuZGjKbkMrBxq+r0v7PMap2LA9QNs=; b=Tcp8licaqZMydJB/dq2VrDN97i
	kqILx58bwQLTo5M5t6yLkpJThsBB3IElr39MjKQc+W9ALsemmOjdwF9vzigxCaV4yfwkr77wISp2e
	uZJ4KCIM07EgaNuW4IHxVxIvgVo9yOlHETHpKZqXa+lBeCqO9aREmuNwVI1pyTh+eKjE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: use get_unsafe() instead of copy_from_unsafe()
Message-Id: <E1lVu3d-00054y-3E@xenbits.xenproject.org>
Date: Mon, 12 Apr 2021 10:44:41 +0000

commit c864eb01965ab212ce9663d5d83b482e9d149825
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:28:52 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:28:52 2021 +0200

    x86/shadow: use get_unsafe() instead of copy_from_unsafe()
    
    This is the slightly more direct way of getting at what we want, and
    better in line with shadow_write_entries()'s use of put_unsafe().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/multi.c | 33 +++++++++++++++------------------
 1 file changed, 15 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 0342de81d2..88194df302 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -2613,10 +2613,9 @@ static int sh_page_fault(struct vcpu *v,
         {
             shadow_l2e_t sl2e;
             mfn_t gl1mfn;
-            if ( (copy_from_unsafe(&sl2e,
-                                   (sh_linear_l2_table(v)
-                                    + shadow_l2_linear_offset(va)),
-                                   sizeof(sl2e)) != 0)
+            if ( (get_unsafe(sl2e,
+                             (sh_linear_l2_table(v) +
+                              shadow_l2_linear_offset(va))) != 0)
                  || !(shadow_l2e_get_flags(sl2e) & _PAGE_PRESENT)
                  || !mfn_valid(gl1mfn = backpointer(mfn_to_page(
                                   shadow_l2e_get_mfn(sl2e))))
@@ -2632,10 +2631,9 @@ static int sh_page_fault(struct vcpu *v,
 #endif /* SHOPT_OUT_OF_SYNC */
         /* The only reasons for reserved bits to be set in shadow entries
          * are the two "magic" shadow_l1e entries. */
-        if ( likely((copy_from_unsafe(&sl1e,
-                                      (sh_linear_l1_table(v)
-                                       + shadow_l1_linear_offset(va)),
-                                      sizeof(sl1e)) == 0)
+        if ( likely((get_unsafe(sl1e,
+                                (sh_linear_l1_table(v) +
+                                 shadow_l1_linear_offset(va))) == 0)
                     && sh_l1e_is_magic(sl1e)) )
         {
 
@@ -3310,9 +3308,9 @@ static bool sh_invlpg(struct vcpu *v, unsigned long linear)
         /* This must still be a copy-from-unsafe because we don't have the
          * paging lock, and the higher-level shadows might disappear
          * under our feet. */
-        if ( copy_from_unsafe(&sl3e, (sh_linear_l3_table(v)
-                                      + shadow_l3_linear_offset(linear)),
-                              sizeof (sl3e)) != 0 )
+        if ( get_unsafe(sl3e,
+                        (sh_linear_l3_table(v) +
+                         shadow_l3_linear_offset(linear))) != 0 )
         {
             perfc_incr(shadow_invlpg_fault);
             return false;
@@ -3331,9 +3329,9 @@ static bool sh_invlpg(struct vcpu *v, unsigned long linear)
 
     /* This must still be a copy-from-unsafe because we don't have the shadow
      * lock, and the higher-level shadows might disappear under our feet. */
-    if ( copy_from_unsafe(&sl2e,
-                          sh_linear_l2_table(v) + shadow_l2_linear_offset(linear),
-                          sizeof (sl2e)) != 0 )
+    if ( get_unsafe(sl2e,
+                    (sh_linear_l2_table(v) +
+                     shadow_l2_linear_offset(linear))) != 0 )
     {
         perfc_incr(shadow_invlpg_fault);
         return false;
@@ -3374,10 +3372,9 @@ static bool sh_invlpg(struct vcpu *v, unsigned long linear)
              * have the paging lock last time we checked, and the
              * higher-level shadows might have disappeared under our
              * feet. */
-            if ( copy_from_unsafe(&sl2e,
-                                  sh_linear_l2_table(v)
-                                  + shadow_l2_linear_offset(linear),
-                                  sizeof (sl2e)) != 0 )
+            if ( get_unsafe(sl2e,
+                            (sh_linear_l2_table(v) +
+                             shadow_l2_linear_offset(linear))) != 0 )
             {
                 perfc_incr(shadow_invlpg_fault);
                 paging_unlock(d);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 12 10:44:52 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Apr 2021 10:44:52 +0000
Received: from list by lists.xenproject.org with outflank-mailman.108937.207875 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu3o-0007ou-8q; Mon, 12 Apr 2021 10:44:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 108937.207875; Mon, 12 Apr 2021 10:44:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu3o-0007ok-5i; Mon, 12 Apr 2021 10:44:52 +0000
Received: by outflank-mailman (input) for mailman id 108937;
 Mon, 12 Apr 2021 10:44:51 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu3n-0007oc-8Z
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:44:51 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu3n-0002yW-7o
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:44:51 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu3n-00056F-6o
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:44:51 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UDgr2J0akV/lO1QiND5RR7RGLtFasmi8cCzMFS7KUfw=; b=sJtxVqrTKQ3by3tSxmkUliuGFX
	6HE45YSX0ir1NhcRTXsLFiCWEHUcoq0rwb5eermb4EeM6pGqU+zVocOKvIYXqZR8GKRKD1sLJl0SC
	Y6A0Umv+5gF7nmVSBcsDGamva5IWuSWO82dPgBWY3di9KOfx30pwmBsZTgaU10UdxPMk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: polish shadow_write_entries()
Message-Id: <E1lVu3n-00056F-6o@xenbits.xenproject.org>
Date: Mon, 12 Apr 2021 10:44:51 +0000

commit a3621d6b4a919c49fc04234776569c435bae0ce7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:30:13 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:30:13 2021 +0200

    x86/shadow: polish shadow_write_entries()
    
    First of all, avoid the initial dummy write: Try to write the actual
    new value instead, and start the loop from 1 if this was successful.
    Further, drop safe_write_entry() and use write_atomic() instead. This
    eliminates the need for the BUILD_BUG_ON() there at the same time.
    
    Then
    - use const and unsigned,
    - drop a redundant NULL check,
    - don't open-code PAGE_OFFSET() and IS_ALIGNED(),
    - adjust comment style.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/multi.c | 56 +++++++++++++++++++++---------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 88194df302..cf6512c4d2 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -747,50 +747,50 @@ l1e_propagate_from_guest(struct vcpu *v,
  * functions which ever write (non-zero) data onto a shadow page.
  */
 
-static inline void safe_write_entry(void *dst, void *src)
-/* Copy one PTE safely when processors might be running on the
- * destination pagetable.   This does *not* give safety against
- * concurrent writes (that's what the paging lock is for), just
- * stops the hardware picking up partially written entries. */
-{
-    volatile unsigned long *d = dst;
-    unsigned long *s = src;
-    ASSERT(!((unsigned long) d & (sizeof (shadow_l1e_t) - 1)));
-    /* In 64-bit, sizeof(pte) == sizeof(ulong) == 1 word,
-     * which will be an atomic write, since the entry is aligned. */
-    BUILD_BUG_ON(sizeof (shadow_l1e_t) != sizeof (unsigned long));
-    *d = *s;
-}
-
-
 static inline void
-shadow_write_entries(void *d, void *s, int entries, mfn_t mfn)
-/* This function does the actual writes to shadow pages.
+shadow_write_entries(void *d, const void *s, unsigned int entries, mfn_t mfn)
+/*
+ * This function does the actual writes to shadow pages.
  * It must not be called directly, since it doesn't do the bookkeeping
- * that shadow_set_l*e() functions do. */
+ * that shadow_set_l*e() functions do.
+ *
+ * Copy PTEs safely when processors might be running on the
+ * destination pagetable.  This does *not* give safety against
+ * concurrent writes (that's what the paging lock is for), just
+ * stops the hardware picking up partially written entries.
+ */
 {
     shadow_l1e_t *dst = d;
-    shadow_l1e_t *src = s;
+    const shadow_l1e_t *src = s;
     void *map = NULL;
-    int i;
+    unsigned int i = 0;
 
-    /* Because we mirror access rights at all levels in the shadow, an
+    /*
+     * Because we mirror access rights at all levels in the shadow, an
      * l2 (or higher) entry with the RW bit cleared will leave us with
      * no write access through the linear map.
      * We detect that by writing to the shadow with put_unsafe() and
-     * using map_domain_page() to get a writeable mapping if we need to. */
-    if ( put_unsafe(*dst, dst) )
+     * using map_domain_page() to get a writeable mapping if we need to.
+     */
+    if ( put_unsafe(*src, dst) )
     {
         perfc_incr(shadow_linear_map_failed);
         map = map_domain_page(mfn);
-        dst = map + ((unsigned long)dst & (PAGE_SIZE - 1));
+        dst = map + PAGE_OFFSET(dst);
+    }
+    else
+    {
+        ++src;
+        ++dst;
+        i = 1;
     }
 
+    ASSERT(IS_ALIGNED((unsigned long)dst, sizeof(*dst)));
 
-    for ( i = 0; i < entries; i++ )
-        safe_write_entry(dst++, src++);
+    for ( ; i < entries; i++ )
+        write_atomic(&dst++->l1, src++->l1);
 
-    if ( map != NULL ) unmap_domain_page(map);
+    unmap_domain_page(map);
 }
 
 /* type is only used to distinguish grant map pages from ordinary RAM
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 12 10:45:02 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Apr 2021 10:45:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.108938.207879 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu3y-0007qU-Aq; Mon, 12 Apr 2021 10:45:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 108938.207879; Mon, 12 Apr 2021 10:45:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu3y-0007qL-7P; Mon, 12 Apr 2021 10:45:02 +0000
Received: by outflank-mailman (input) for mailman id 108938;
 Mon, 12 Apr 2021 10:45: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 1lVu3x-0007qA-Cr
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:45: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 1lVu3x-0002z5-Bu
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:45:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu3x-00057M-AR
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:45: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=BnIYBbbtSdeX9S5uMg60lQgJlXCrtEyKMsVCUI2MF0c=; b=E7FkvzIDnk2XPBCKQ29QS2mUYc
	8bxKgdo9Zycebrhsmr8PbQYf7L/gaDCIdU3TDOhiGO8qVyn/esxtlQxNXjwfqcIGxueC3as67fWS5
	OytcsBuoAVV0zONqARQnwAobln73fNO9rNOAH8ByVuymL3LiCxx2kZSCqpfyNd9cQX8k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: move shadow_set_l<N>e() to their own source file
Message-Id: <E1lVu3x-00057M-AR@xenbits.xenproject.org>
Date: Mon, 12 Apr 2021 10:45:01 +0000

commit b49f8bda2399002e3cfaa472cc6959ec2ac20526
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:31:19 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:31:19 2021 +0200

    x86/shadow: move shadow_set_l<N>e() to their own source file
    
    The few GUEST_PAGING_LEVELS dependencies (of shadow_set_l2e() only) can
    be easily expressed by function parameters; I suppose the extra indirect
    call is acceptable for the increasingly little used 32-bit non-PAE case.
    This way shadow_set_l[12]e(), each of which compiles to almost 1k of
    code, need building just once.
    
    The implication is the need for some "relaxation" in types.h: The
    underlying PTE types don't vary anymore (and aren't expected to down the
    road), so they as well as some basic helpers can be exposed even in the
    new, artificial GUEST_PAGING_LEVELS == 0 case.
    
    Almost pure code movement - exceptions are the conversion of
    "#if GUEST_PAGING_LEVELS == 2" to runtime conditionals and style
    corrections (including to avoid open-coding mfn_to_maddr() and
    PAGE_OFFSET()).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/Makefile |   2 +-
 xen/arch/x86/mm/shadow/multi.c  | 388 +------------------------------------
 xen/arch/x86/mm/shadow/set.c    | 416 ++++++++++++++++++++++++++++++++++++++++
 xen/arch/x86/mm/shadow/types.h  |  44 +++--
 4 files changed, 450 insertions(+), 400 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/Makefile b/xen/arch/x86/mm/shadow/Makefile
index 23d3ff1080..05ffc164eb 100644
--- a/xen/arch/x86/mm/shadow/Makefile
+++ b/xen/arch/x86/mm/shadow/Makefile
@@ -1,5 +1,5 @@
 ifeq ($(CONFIG_SHADOW_PAGING),y)
-obj-y += common.o guest_2.o guest_3.o guest_4.o
+obj-y += common.o guest_2.o guest_3.o guest_4.o set.o
 obj-$(CONFIG_HVM) += hvm.o
 obj-$(CONFIG_PV) += pv.o
 else
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index cf6512c4d2..422ab54a94 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -389,8 +389,13 @@ static inline mfn_t sh_next_page(mfn_t smfn)
     ASSERT(!next->u.sh.head);
     return page_to_mfn(next);
 }
+#else
+# define sh_next_page NULL
 #endif
 
+#define shadow_set_l2e(d, sl2e, new_sl2e, sl2mfn) \
+    shadow_set_l2e(d, sl2e, new_sl2e, sl2mfn, SH_type_fl1_shadow, sh_next_page)
+
 static inline u32
 guest_index(void *ptr)
 {
@@ -741,389 +746,6 @@ l1e_propagate_from_guest(struct vcpu *v,
 }
 
 
-/**************************************************************************/
-/* These functions update shadow entries (and do bookkeeping on the shadow
- * tables they are in).  It is intended that they are the only
- * functions which ever write (non-zero) data onto a shadow page.
- */
-
-static inline void
-shadow_write_entries(void *d, const void *s, unsigned int entries, mfn_t mfn)
-/*
- * This function does the actual writes to shadow pages.
- * It must not be called directly, since it doesn't do the bookkeeping
- * that shadow_set_l*e() functions do.
- *
- * Copy PTEs safely when processors might be running on the
- * destination pagetable.  This does *not* give safety against
- * concurrent writes (that's what the paging lock is for), just
- * stops the hardware picking up partially written entries.
- */
-{
-    shadow_l1e_t *dst = d;
-    const shadow_l1e_t *src = s;
-    void *map = NULL;
-    unsigned int i = 0;
-
-    /*
-     * Because we mirror access rights at all levels in the shadow, an
-     * l2 (or higher) entry with the RW bit cleared will leave us with
-     * no write access through the linear map.
-     * We detect that by writing to the shadow with put_unsafe() and
-     * using map_domain_page() to get a writeable mapping if we need to.
-     */
-    if ( put_unsafe(*src, dst) )
-    {
-        perfc_incr(shadow_linear_map_failed);
-        map = map_domain_page(mfn);
-        dst = map + PAGE_OFFSET(dst);
-    }
-    else
-    {
-        ++src;
-        ++dst;
-        i = 1;
-    }
-
-    ASSERT(IS_ALIGNED((unsigned long)dst, sizeof(*dst)));
-
-    for ( ; i < entries; i++ )
-        write_atomic(&dst++->l1, src++->l1);
-
-    unmap_domain_page(map);
-}
-
-/* type is only used to distinguish grant map pages from ordinary RAM
- * i.e. non-p2m_is_grant() pages are treated as p2m_ram_rw.  */
-static int inline
-shadow_get_page_from_l1e(shadow_l1e_t sl1e, struct domain *d, p2m_type_t type)
-{
-    int res;
-    mfn_t mfn;
-    struct domain *owner;
-
-    ASSERT(!sh_l1e_is_magic(sl1e));
-    ASSERT(shadow_mode_refcounts(d));
-
-    res = get_page_from_l1e(sl1e, d, d);
-
-    // If a privileged domain is attempting to install a map of a page it does
-    // not own, we let it succeed anyway.
-    //
-    if ( unlikely(res < 0) &&
-         !shadow_mode_translate(d) &&
-         mfn_valid(mfn = shadow_l1e_get_mfn(sl1e)) &&
-         (owner = page_get_owner(mfn_to_page(mfn))) &&
-         (d != owner) )
-    {
-        res = xsm_priv_mapping(XSM_TARGET, d, owner);
-        if ( !res ) {
-            res = get_page_from_l1e(sl1e, d, owner);
-            SHADOW_PRINTK("privileged domain %d installs map of mfn %"PRI_mfn" "
-                           "which is owned by d%d: %s\n",
-                           d->domain_id, mfn_x(mfn), owner->domain_id,
-                           res >= 0 ? "success" : "failed");
-        }
-    }
-
-    /* Okay, it might still be a grant mapping PTE.  Try it. */
-    if ( unlikely(res < 0) &&
-         (type == p2m_grant_map_rw ||
-          (type == p2m_grant_map_ro &&
-           !(shadow_l1e_get_flags(sl1e) & _PAGE_RW))) )
-    {
-        /* It's a grant mapping.  The grant table implementation will
-           already have checked that we're supposed to have access, so
-           we can just grab a reference directly. */
-        mfn = shadow_l1e_get_mfn(sl1e);
-        if ( mfn_valid(mfn) )
-            res = get_page_from_l1e(sl1e, d, page_get_owner(mfn_to_page(mfn)));
-    }
-
-    if ( unlikely(res < 0) )
-    {
-        perfc_incr(shadow_get_page_fail);
-        SHADOW_PRINTK("failed: l1e=" SH_PRI_pte "\n");
-    }
-
-    return res;
-}
-
-static void inline
-shadow_put_page_from_l1e(shadow_l1e_t sl1e, struct domain *d)
-{
-    if ( !shadow_mode_refcounts(d) )
-        return;
-
-    put_page_from_l1e(sl1e, d);
-}
-
-#if GUEST_PAGING_LEVELS >= 4
-static int shadow_set_l4e(struct domain *d,
-                          shadow_l4e_t *sl4e,
-                          shadow_l4e_t new_sl4e,
-                          mfn_t sl4mfn)
-{
-    int flags = 0;
-    shadow_l4e_t old_sl4e;
-    paddr_t paddr;
-    ASSERT(sl4e != NULL);
-    old_sl4e = *sl4e;
-
-    if ( old_sl4e.l4 == new_sl4e.l4 ) return 0; /* Nothing to do */
-
-    paddr = ((((paddr_t)mfn_x(sl4mfn)) << PAGE_SHIFT)
-             | (((unsigned long)sl4e) & ~PAGE_MASK));
-
-    if ( shadow_l4e_get_flags(new_sl4e) & _PAGE_PRESENT )
-    {
-        /* About to install a new reference */
-        mfn_t sl3mfn = shadow_l4e_get_mfn(new_sl4e);
-
-        if ( !sh_get_ref(d, sl3mfn, paddr) )
-        {
-            domain_crash(d);
-            return SHADOW_SET_ERROR;
-        }
-
-        /* Are we pinning l3 shadows to handle weird Linux behaviour? */
-        if ( sh_type_is_pinnable(d, SH_type_l3_64_shadow) )
-            sh_pin(d, sl3mfn);
-    }
-
-    /* Write the new entry */
-    shadow_write_entries(sl4e, &new_sl4e, 1, sl4mfn);
-    flush_root_pgtbl_domain(d);
-
-    flags |= SHADOW_SET_CHANGED;
-
-    if ( shadow_l4e_get_flags(old_sl4e) & _PAGE_PRESENT )
-    {
-        /* We lost a reference to an old mfn. */
-        mfn_t osl3mfn = shadow_l4e_get_mfn(old_sl4e);
-
-        if ( !mfn_eq(osl3mfn, shadow_l4e_get_mfn(new_sl4e))
-             || !perms_strictly_increased(shadow_l4e_get_flags(old_sl4e),
-                                          shadow_l4e_get_flags(new_sl4e)) )
-        {
-            flags |= SHADOW_SET_FLUSH;
-        }
-        sh_put_ref(d, osl3mfn, paddr);
-    }
-
-    return flags;
-}
-
-static int shadow_set_l3e(struct domain *d,
-                          shadow_l3e_t *sl3e,
-                          shadow_l3e_t new_sl3e,
-                          mfn_t sl3mfn)
-{
-    int flags = 0;
-    shadow_l3e_t old_sl3e;
-    paddr_t paddr;
-    ASSERT(sl3e != NULL);
-    old_sl3e = *sl3e;
-
-    if ( old_sl3e.l3 == new_sl3e.l3 ) return 0; /* Nothing to do */
-
-    paddr = ((((paddr_t)mfn_x(sl3mfn)) << PAGE_SHIFT)
-             | (((unsigned long)sl3e) & ~PAGE_MASK));
-
-    if ( shadow_l3e_get_flags(new_sl3e) & _PAGE_PRESENT )
-    {
-        /* About to install a new reference */
-        if ( !sh_get_ref(d, shadow_l3e_get_mfn(new_sl3e), paddr) )
-        {
-            domain_crash(d);
-            return SHADOW_SET_ERROR;
-        }
-    }
-
-    /* Write the new entry */
-    shadow_write_entries(sl3e, &new_sl3e, 1, sl3mfn);
-    flags |= SHADOW_SET_CHANGED;
-
-    if ( shadow_l3e_get_flags(old_sl3e) & _PAGE_PRESENT )
-    {
-        /* We lost a reference to an old mfn. */
-        mfn_t osl2mfn = shadow_l3e_get_mfn(old_sl3e);
-
-        if ( !mfn_eq(osl2mfn, shadow_l3e_get_mfn(new_sl3e)) ||
-             !perms_strictly_increased(shadow_l3e_get_flags(old_sl3e),
-                                       shadow_l3e_get_flags(new_sl3e)) )
-        {
-            flags |= SHADOW_SET_FLUSH;
-        }
-        sh_put_ref(d, osl2mfn, paddr);
-    }
-    return flags;
-}
-#endif /* GUEST_PAGING_LEVELS >= 4 */
-
-static int shadow_set_l2e(struct domain *d,
-                          shadow_l2e_t *sl2e,
-                          shadow_l2e_t new_sl2e,
-                          mfn_t sl2mfn)
-{
-    int flags = 0;
-    shadow_l2e_t old_sl2e;
-    paddr_t paddr;
-
-#if GUEST_PAGING_LEVELS == 2
-    /* In 2-on-3 we work with pairs of l2es pointing at two-page
-     * shadows.  Reference counting and up-pointers track from the first
-     * page of the shadow to the first l2e, so make sure that we're
-     * working with those:
-     * Start with a pair of identical entries */
-    shadow_l2e_t pair[2] = { new_sl2e, new_sl2e };
-    /* Align the pointer down so it's pointing at the first of the pair */
-    sl2e = (shadow_l2e_t *)((unsigned long)sl2e & ~(sizeof(shadow_l2e_t)));
-#endif
-
-    ASSERT(sl2e != NULL);
-    old_sl2e = *sl2e;
-
-    if ( old_sl2e.l2 == new_sl2e.l2 ) return 0; /* Nothing to do */
-
-    paddr = ((((paddr_t)mfn_x(sl2mfn)) << PAGE_SHIFT)
-             | (((unsigned long)sl2e) & ~PAGE_MASK));
-
-    if ( shadow_l2e_get_flags(new_sl2e) & _PAGE_PRESENT )
-    {
-        mfn_t sl1mfn = shadow_l2e_get_mfn(new_sl2e);
-        ASSERT(mfn_to_page(sl1mfn)->u.sh.head);
-
-        /* About to install a new reference */
-        if ( !sh_get_ref(d, sl1mfn, paddr) )
-        {
-            domain_crash(d);
-            return SHADOW_SET_ERROR;
-        }
-#if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
-        {
-            struct page_info *sp = mfn_to_page(sl1mfn);
-            mfn_t gl1mfn;
-
-            ASSERT(sp->u.sh.head);
-            gl1mfn = backpointer(sp);
-            /* If the shadow is a fl1 then the backpointer contains
-               the GFN instead of the GMFN, and it's definitely not
-               OOS. */
-            if ( (sp->u.sh.type != SH_type_fl1_shadow) && mfn_valid(gl1mfn)
-                 && mfn_is_out_of_sync(gl1mfn) )
-                sh_resync(d, gl1mfn);
-        }
-#endif
-#if GUEST_PAGING_LEVELS == 2
-        /* Update the second entry to point tio the second half of the l1 */
-        sl1mfn = sh_next_page(sl1mfn);
-        pair[1] = shadow_l2e_from_mfn(sl1mfn, shadow_l2e_get_flags(new_sl2e));
-#endif
-    }
-
-    /* Write the new entry */
-#if GUEST_PAGING_LEVELS == 2
-    shadow_write_entries(sl2e, &pair, 2, sl2mfn);
-#else /* normal case */
-    shadow_write_entries(sl2e, &new_sl2e, 1, sl2mfn);
-#endif
-    flags |= SHADOW_SET_CHANGED;
-
-    if ( shadow_l2e_get_flags(old_sl2e) & _PAGE_PRESENT )
-    {
-        /* We lost a reference to an old mfn. */
-        mfn_t osl1mfn = shadow_l2e_get_mfn(old_sl2e);
-
-        if ( !mfn_eq(osl1mfn, shadow_l2e_get_mfn(new_sl2e)) ||
-             !perms_strictly_increased(shadow_l2e_get_flags(old_sl2e),
-                                       shadow_l2e_get_flags(new_sl2e)) )
-        {
-            flags |= SHADOW_SET_FLUSH;
-        }
-        sh_put_ref(d, osl1mfn, paddr);
-    }
-    return flags;
-}
-
-static int shadow_set_l1e(struct domain *d,
-                          shadow_l1e_t *sl1e,
-                          shadow_l1e_t new_sl1e,
-                          p2m_type_t new_type,
-                          mfn_t sl1mfn)
-{
-    int flags = 0;
-    shadow_l1e_t old_sl1e;
-    unsigned int old_sl1f;
-#if SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC
-    mfn_t new_gmfn = shadow_l1e_get_mfn(new_sl1e);
-#endif
-    ASSERT(sl1e != NULL);
-
-#if SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC
-    if ( mfn_valid(new_gmfn) && mfn_oos_may_write(new_gmfn)
-         && ((shadow_l1e_get_flags(new_sl1e) & (_PAGE_RW|_PAGE_PRESENT))
-             == (_PAGE_RW|_PAGE_PRESENT)) )
-        oos_fixup_add(d, new_gmfn, sl1mfn, pgentry_ptr_to_slot(sl1e));
-#endif
-
-    old_sl1e = *sl1e;
-
-    if ( old_sl1e.l1 == new_sl1e.l1 ) return 0; /* Nothing to do */
-
-    if ( (shadow_l1e_get_flags(new_sl1e) & _PAGE_PRESENT)
-         && !sh_l1e_is_magic(new_sl1e) )
-    {
-        /* About to install a new reference */
-        if ( shadow_mode_refcounts(d) )
-        {
-#define PAGE_FLIPPABLE (_PAGE_RW | _PAGE_PWT | _PAGE_PCD | _PAGE_PAT)
-            int rc;
-
-            TRACE_SHADOW_PATH_FLAG(TRCE_SFLAG_SHADOW_L1_GET_REF);
-            switch ( rc = shadow_get_page_from_l1e(new_sl1e, d, new_type) )
-            {
-            default:
-                /* Doesn't look like a pagetable. */
-                flags |= SHADOW_SET_ERROR;
-                new_sl1e = shadow_l1e_empty();
-                break;
-            case PAGE_FLIPPABLE & -PAGE_FLIPPABLE ... PAGE_FLIPPABLE:
-                ASSERT(!(rc & ~PAGE_FLIPPABLE));
-                new_sl1e = shadow_l1e_flip_flags(new_sl1e, rc);
-                /* fall through */
-            case 0:
-                shadow_vram_get_mfn(shadow_l1e_get_mfn(new_sl1e),
-                                    shadow_l1e_get_flags(new_sl1e),
-                                    sl1mfn, sl1e, d);
-                break;
-            }
-#undef PAGE_FLIPPABLE
-        }
-    }
-
-    /* Write the new entry */
-    shadow_write_entries(sl1e, &new_sl1e, 1, sl1mfn);
-    flags |= SHADOW_SET_CHANGED;
-
-    old_sl1f = shadow_l1e_get_flags(old_sl1e);
-    if ( (old_sl1f & _PAGE_PRESENT) && !sh_l1e_is_magic(old_sl1e) &&
-         shadow_mode_refcounts(d) )
-    {
-        /* We lost a reference to an old mfn. */
-        /* N.B. Unlike higher-level sets, never need an extra flush
-         * when writing an l1e.  Because it points to the same guest frame
-         * as the guest l1e did, it's the guest's responsibility to
-         * trigger a flush later. */
-        shadow_vram_put_mfn(shadow_l1e_get_mfn(old_sl1e), old_sl1f,
-                            sl1mfn, sl1e, d);
-        shadow_put_page_from_l1e(old_sl1e, d);
-        TRACE_SHADOW_PATH_FLAG(TRCE_SFLAG_SHADOW_L1_PUT_REF);
-    }
-    return flags;
-}
-
-
 /**************************************************************************/
 /* Macros to walk pagetables.  These take the shadow of a pagetable and
  * walk every "interesting" entry.  That is, they don't touch Xen mappings,
diff --git a/xen/arch/x86/mm/shadow/set.c b/xen/arch/x86/mm/shadow/set.c
new file mode 100644
index 0000000000..fff4d1633c
--- /dev/null
+++ b/xen/arch/x86/mm/shadow/set.c
@@ -0,0 +1,416 @@
+/******************************************************************************
+ * arch/x86/mm/shadow/set.c
+ *
+ * Simple, mostly-synchronous shadow page tables.
+ * Parts of this code are Copyright (c) 2006 by XenSource Inc.
+ * Parts of this code are Copyright (c) 2006 by Michael A Fetterman
+ * Parts based on earlier work by Michael A Fetterman, Ian Pratt et al.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define GUEST_PAGING_LEVELS 0
+
+#include <xen/sched.h>
+#include <xsm/xsm.h>
+#include <asm/shadow.h>
+#include "private.h"
+#include "types.h"
+
+/*
+ * These functions update shadow entries (and do bookkeeping on the shadow
+ * tables they are in).  It is intended that they are the only
+ * functions which ever write (non-zero) data onto a shadow page.
+ */
+
+static inline void
+shadow_write_entries(void *d, const void *s, unsigned int entries, mfn_t mfn)
+/*
+ * This function does the actual writes to shadow pages.
+ * It must not be called directly, since it doesn't do the bookkeeping
+ * that shadow_set_l*e() functions do.
+ *
+ * Copy PTEs safely when processors might be running on the
+ * destination pagetable.  This does *not* give safety against
+ * concurrent writes (that's what the paging lock is for), just
+ * stops the hardware picking up partially written entries.
+ */
+{
+    shadow_l1e_t *dst = d;
+    const shadow_l1e_t *src = s;
+    void *map = NULL;
+    unsigned int i = 0;
+
+    /*
+     * Because we mirror access rights at all levels in the shadow, an
+     * l2 (or higher) entry with the RW bit cleared will leave us with
+     * no write access through the linear map.
+     * We detect that by writing to the shadow with put_unsafe() and
+     * using map_domain_page() to get a writeable mapping if we need to.
+     */
+    if ( put_unsafe(*src, dst) )
+    {
+        perfc_incr(shadow_linear_map_failed);
+        map = map_domain_page(mfn);
+        dst = map + PAGE_OFFSET(dst);
+    }
+    else
+    {
+        ++src;
+        ++dst;
+        i = 1;
+    }
+
+    ASSERT(IS_ALIGNED((unsigned long)dst, sizeof(*dst)));
+
+    for ( ; i < entries; i++ )
+        write_atomic(&dst++->l1, src++->l1);
+
+    unmap_domain_page(map);
+}
+
+/*
+ * "type" is only used to distinguish grant map pages from ordinary RAM
+ * i.e. non-p2m_is_grant() pages are treated as p2m_ram_rw.
+ */
+static int inline
+shadow_get_page_from_l1e(shadow_l1e_t sl1e, struct domain *d, p2m_type_t type)
+{
+    int res;
+    mfn_t mfn;
+    struct domain *owner;
+
+    ASSERT(!sh_l1e_is_magic(sl1e));
+    ASSERT(shadow_mode_refcounts(d));
+
+    res = get_page_from_l1e(sl1e, d, d);
+
+    /*
+     * If a privileged domain is attempting to install a map of a page it does
+     * not own, we let it succeed anyway.
+     */
+    if ( unlikely(res < 0) &&
+         !shadow_mode_translate(d) &&
+         mfn_valid(mfn = shadow_l1e_get_mfn(sl1e)) &&
+         (owner = page_get_owner(mfn_to_page(mfn))) &&
+         (d != owner) )
+    {
+        res = xsm_priv_mapping(XSM_TARGET, d, owner);
+        if ( !res )
+        {
+            res = get_page_from_l1e(sl1e, d, owner);
+            SHADOW_PRINTK("privileged %pd installs map of mfn %"PRI_mfn" owned by %pd: %s\n",
+                           d, mfn_x(mfn), owner,
+                           res >= 0 ? "success" : "failed");
+        }
+    }
+
+    /* Okay, it might still be a grant mapping PTE.  Try it. */
+    if ( unlikely(res < 0) &&
+         (type == p2m_grant_map_rw ||
+          (type == p2m_grant_map_ro &&
+           !(shadow_l1e_get_flags(sl1e) & _PAGE_RW))) )
+    {
+        /*
+         * It's a grant mapping.  The grant table implementation will
+         * already have checked that we're supposed to have access, so
+         * we can just grab a reference directly.
+         */
+        mfn = shadow_l1e_get_mfn(sl1e);
+        if ( mfn_valid(mfn) )
+            res = get_page_from_l1e(sl1e, d, page_get_owner(mfn_to_page(mfn)));
+    }
+
+    if ( unlikely(res < 0) )
+    {
+        perfc_incr(shadow_get_page_fail);
+        SHADOW_PRINTK("failed: l1e=" SH_PRI_pte "\n");
+    }
+
+    return res;
+}
+
+int shadow_set_l4e(struct domain *d, shadow_l4e_t *sl4e,
+                   shadow_l4e_t new_sl4e, mfn_t sl4mfn)
+{
+    int flags = 0;
+    shadow_l4e_t old_sl4e;
+    paddr_t paddr;
+
+    ASSERT(sl4e != NULL);
+    old_sl4e = *sl4e;
+
+    if ( old_sl4e.l4 == new_sl4e.l4 ) return 0; /* Nothing to do */
+
+    paddr = mfn_to_maddr(sl4mfn) | PAGE_OFFSET(sl4e);
+
+    if ( shadow_l4e_get_flags(new_sl4e) & _PAGE_PRESENT )
+    {
+        /* About to install a new reference */
+        mfn_t sl3mfn = shadow_l4e_get_mfn(new_sl4e);
+
+        if ( !sh_get_ref(d, sl3mfn, paddr) )
+        {
+            domain_crash(d);
+            return SHADOW_SET_ERROR;
+        }
+
+        /* Are we pinning l3 shadows to handle weird Linux behaviour? */
+        if ( sh_type_is_pinnable(d, SH_type_l3_64_shadow) )
+            sh_pin(d, sl3mfn);
+    }
+
+    /* Write the new entry */
+    shadow_write_entries(sl4e, &new_sl4e, 1, sl4mfn);
+    flush_root_pgtbl_domain(d);
+
+    flags |= SHADOW_SET_CHANGED;
+
+    if ( shadow_l4e_get_flags(old_sl4e) & _PAGE_PRESENT )
+    {
+        /* We lost a reference to an old mfn. */
+        mfn_t osl3mfn = shadow_l4e_get_mfn(old_sl4e);
+
+        if ( !mfn_eq(osl3mfn, shadow_l4e_get_mfn(new_sl4e)) ||
+             !perms_strictly_increased(shadow_l4e_get_flags(old_sl4e),
+                                       shadow_l4e_get_flags(new_sl4e)) )
+            flags |= SHADOW_SET_FLUSH;
+
+        sh_put_ref(d, osl3mfn, paddr);
+    }
+
+    return flags;
+}
+
+int shadow_set_l3e(struct domain *d, shadow_l3e_t *sl3e,
+                   shadow_l3e_t new_sl3e, mfn_t sl3mfn)
+{
+    int flags = 0;
+    shadow_l3e_t old_sl3e;
+    paddr_t paddr;
+
+    ASSERT(sl3e != NULL);
+    old_sl3e = *sl3e;
+
+    if ( old_sl3e.l3 == new_sl3e.l3 ) return 0; /* Nothing to do */
+
+    paddr = mfn_to_maddr(sl3mfn) | PAGE_OFFSET(sl3e);
+
+    if ( shadow_l3e_get_flags(new_sl3e) & _PAGE_PRESENT )
+    {
+        /* About to install a new reference */
+        if ( !sh_get_ref(d, shadow_l3e_get_mfn(new_sl3e), paddr) )
+        {
+            domain_crash(d);
+            return SHADOW_SET_ERROR;
+        }
+    }
+
+    /* Write the new entry */
+    shadow_write_entries(sl3e, &new_sl3e, 1, sl3mfn);
+    flags |= SHADOW_SET_CHANGED;
+
+    if ( shadow_l3e_get_flags(old_sl3e) & _PAGE_PRESENT )
+    {
+        /* We lost a reference to an old mfn. */
+        mfn_t osl2mfn = shadow_l3e_get_mfn(old_sl3e);
+
+        if ( !mfn_eq(osl2mfn, shadow_l3e_get_mfn(new_sl3e)) ||
+             !perms_strictly_increased(shadow_l3e_get_flags(old_sl3e),
+                                       shadow_l3e_get_flags(new_sl3e)) )
+            flags |= SHADOW_SET_FLUSH;
+
+        sh_put_ref(d, osl2mfn, paddr);
+    }
+
+    return flags;
+}
+
+int shadow_set_l2e(struct domain *d, shadow_l2e_t *sl2e,
+                   shadow_l2e_t new_sl2e, mfn_t sl2mfn,
+                   unsigned int type_fl1_shadow,
+                   mfn_t (*next_page)(mfn_t smfn))
+{
+    int flags = 0;
+    shadow_l2e_t old_sl2e;
+    paddr_t paddr;
+    /*
+     * In 2-on-3 we work with pairs of l2es pointing at two-page
+     * shadows.  Reference counting and up-pointers track from the first
+     * page of the shadow to the first l2e, so make sure that we're
+     * working with those:
+     * Start with a pair of identical entries.
+     */
+    shadow_l2e_t pair[2] = { new_sl2e, new_sl2e };
+
+    if ( next_page )
+    {
+        /* Align the pointer down so it's pointing at the first of the pair */
+        sl2e = (shadow_l2e_t *)((unsigned long)sl2e & ~sizeof(shadow_l2e_t));
+    }
+
+    ASSERT(sl2e != NULL);
+    old_sl2e = *sl2e;
+
+    if ( old_sl2e.l2 == new_sl2e.l2 ) return 0; /* Nothing to do */
+
+    paddr = mfn_to_maddr(sl2mfn) | PAGE_OFFSET(sl2e);
+
+    if ( shadow_l2e_get_flags(new_sl2e) & _PAGE_PRESENT )
+    {
+        mfn_t sl1mfn = shadow_l2e_get_mfn(new_sl2e);
+        ASSERT(mfn_to_page(sl1mfn)->u.sh.head);
+
+        /* About to install a new reference */
+        if ( !sh_get_ref(d, sl1mfn, paddr) )
+        {
+            domain_crash(d);
+            return SHADOW_SET_ERROR;
+        }
+
+#if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
+        {
+            struct page_info *sp = mfn_to_page(sl1mfn);
+            mfn_t gl1mfn;
+
+            ASSERT(sp->u.sh.head);
+            gl1mfn = backpointer(sp);
+            /*
+             * If the shadow is a fl1 then the backpointer contains the
+             * GFN instead of the GMFN, and it's definitely not OOS.
+             */
+            if ( (sp->u.sh.type != type_fl1_shadow) && mfn_valid(gl1mfn)
+                 && mfn_is_out_of_sync(gl1mfn) )
+                sh_resync(d, gl1mfn);
+        }
+#endif
+
+        if ( next_page )
+        {
+            /* Update the second entry to point to the second half of the l1 */
+            sl1mfn = next_page(sl1mfn);
+            pair[1] = shadow_l2e_from_mfn(sl1mfn,
+                                          shadow_l2e_get_flags(new_sl2e));
+        }
+    }
+
+    /* Write the new entry / entries */
+    shadow_write_entries(sl2e, &pair, !next_page ? 1 : 2, sl2mfn);
+
+    flags |= SHADOW_SET_CHANGED;
+
+    if ( shadow_l2e_get_flags(old_sl2e) & _PAGE_PRESENT )
+    {
+        /* We lost a reference to an old mfn. */
+        mfn_t osl1mfn = shadow_l2e_get_mfn(old_sl2e);
+
+        if ( !mfn_eq(osl1mfn, shadow_l2e_get_mfn(new_sl2e)) ||
+             !perms_strictly_increased(shadow_l2e_get_flags(old_sl2e),
+                                       shadow_l2e_get_flags(new_sl2e)) )
+            flags |= SHADOW_SET_FLUSH;
+
+        sh_put_ref(d, osl1mfn, paddr);
+    }
+
+    return flags;
+}
+
+int shadow_set_l1e(struct domain *d, shadow_l1e_t *sl1e,
+                   shadow_l1e_t new_sl1e, p2m_type_t new_type,
+                   mfn_t sl1mfn)
+{
+    int flags = 0;
+    shadow_l1e_t old_sl1e;
+    unsigned int old_sl1f;
+#if SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC
+    mfn_t new_gmfn = shadow_l1e_get_mfn(new_sl1e);
+#endif
+
+    ASSERT(sl1e != NULL);
+
+#if SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC
+    if ( mfn_valid(new_gmfn) && mfn_oos_may_write(new_gmfn) &&
+         ((shadow_l1e_get_flags(new_sl1e) & (_PAGE_RW | _PAGE_PRESENT)) ==
+          (_PAGE_RW | _PAGE_PRESENT)) )
+        oos_fixup_add(d, new_gmfn, sl1mfn, pgentry_ptr_to_slot(sl1e));
+#endif
+
+    old_sl1e = *sl1e;
+
+    if ( old_sl1e.l1 == new_sl1e.l1 ) return 0; /* Nothing to do */
+
+    if ( (shadow_l1e_get_flags(new_sl1e) & _PAGE_PRESENT) &&
+         !sh_l1e_is_magic(new_sl1e) )
+    {
+        /* About to install a new reference */
+        if ( shadow_mode_refcounts(d) )
+        {
+#define PAGE_FLIPPABLE (_PAGE_RW | _PAGE_PWT | _PAGE_PCD | _PAGE_PAT)
+            int rc;
+
+            TRACE_SHADOW_PATH_FLAG(TRCE_SFLAG_SHADOW_L1_GET_REF);
+            switch ( rc = shadow_get_page_from_l1e(new_sl1e, d, new_type) )
+            {
+            default:
+                /* Doesn't look like a pagetable. */
+                flags |= SHADOW_SET_ERROR;
+                new_sl1e = shadow_l1e_empty();
+                break;
+            case PAGE_FLIPPABLE & -PAGE_FLIPPABLE ... PAGE_FLIPPABLE:
+                ASSERT(!(rc & ~PAGE_FLIPPABLE));
+                new_sl1e = shadow_l1e_flip_flags(new_sl1e, rc);
+                /* fall through */
+            case 0:
+                shadow_vram_get_mfn(shadow_l1e_get_mfn(new_sl1e),
+                                    shadow_l1e_get_flags(new_sl1e),
+                                    sl1mfn, sl1e, d);
+                break;
+            }
+#undef PAGE_FLIPPABLE
+        }
+    }
+
+    /* Write the new entry */
+    shadow_write_entries(sl1e, &new_sl1e, 1, sl1mfn);
+    flags |= SHADOW_SET_CHANGED;
+
+    old_sl1f = shadow_l1e_get_flags(old_sl1e);
+    if ( (old_sl1f & _PAGE_PRESENT) && !sh_l1e_is_magic(old_sl1e) &&
+         shadow_mode_refcounts(d) )
+    {
+        /*
+         * We lost a reference to an old mfn.
+         *
+         * N.B. Unlike higher-level sets, never need an extra flush when
+         * writing an l1e.  Because it points to the same guest frame as the
+         * guest l1e did, it's the guest's responsibility to trigger a flush
+         * later.
+         */
+        shadow_vram_put_mfn(shadow_l1e_get_mfn(old_sl1e), old_sl1f,
+                            sl1mfn, sl1e, d);
+        shadow_put_page_from_l1e(old_sl1e, d);
+        TRACE_SHADOW_PATH_FLAG(TRCE_SFLAG_SHADOW_L1_PUT_REF);
+    }
+
+    return flags;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/x86/mm/shadow/types.h b/xen/arch/x86/mm/shadow/types.h
index a86be62d88..a671fc9a49 100644
--- a/xen/arch/x86/mm/shadow/types.h
+++ b/xen/arch/x86/mm/shadow/types.h
@@ -24,8 +24,8 @@
 
 /* The number of levels in the shadow pagetable is entirely determined
  * by the number of levels in the guest pagetable */
-#if GUEST_PAGING_LEVELS == 4
-#define SHADOW_PAGING_LEVELS 4
+#if GUEST_PAGING_LEVELS != 2
+#define SHADOW_PAGING_LEVELS GUEST_PAGING_LEVELS
 #else
 #define SHADOW_PAGING_LEVELS 3
 #endif
@@ -43,7 +43,7 @@
 #define SHADOW_L1_PAGETABLE_SHIFT        12
 #define SHADOW_L2_PAGETABLE_SHIFT        21
 #define SHADOW_L3_PAGETABLE_SHIFT        30
-#else /* SHADOW_PAGING_LEVELS == 4 */
+#elif SHADOW_PAGING_LEVELS == 4
 #define SHADOW_L1_PAGETABLE_ENTRIES     512
 #define SHADOW_L2_PAGETABLE_ENTRIES     512
 #define SHADOW_L3_PAGETABLE_ENTRIES     512
@@ -58,9 +58,7 @@
 typedef l1_pgentry_t shadow_l1e_t;
 typedef l2_pgentry_t shadow_l2e_t;
 typedef l3_pgentry_t shadow_l3e_t;
-#if SHADOW_PAGING_LEVELS >= 4
 typedef l4_pgentry_t shadow_l4e_t;
-#endif
 
 /* Access functions for them */
 static inline paddr_t shadow_l1e_get_paddr(shadow_l1e_t sl1e)
@@ -69,10 +67,8 @@ static inline paddr_t shadow_l2e_get_paddr(shadow_l2e_t sl2e)
 { return l2e_get_paddr(sl2e); }
 static inline paddr_t shadow_l3e_get_paddr(shadow_l3e_t sl3e)
 { return l3e_get_paddr(sl3e); }
-#if SHADOW_PAGING_LEVELS >= 4
 static inline paddr_t shadow_l4e_get_paddr(shadow_l4e_t sl4e)
 { return l4e_get_paddr(sl4e); }
-#endif
 
 static inline mfn_t shadow_l1e_get_mfn(shadow_l1e_t sl1e)
 { return l1e_get_mfn(sl1e); }
@@ -80,10 +76,8 @@ static inline mfn_t shadow_l2e_get_mfn(shadow_l2e_t sl2e)
 { return l2e_get_mfn(sl2e); }
 static inline mfn_t shadow_l3e_get_mfn(shadow_l3e_t sl3e)
 { return l3e_get_mfn(sl3e); }
-#if SHADOW_PAGING_LEVELS >= 4
 static inline mfn_t shadow_l4e_get_mfn(shadow_l4e_t sl4e)
 { return l4e_get_mfn(sl4e); }
-#endif
 
 static inline u32 shadow_l1e_get_flags(shadow_l1e_t sl1e)
 { return l1e_get_flags(sl1e); }
@@ -91,10 +85,8 @@ static inline u32 shadow_l2e_get_flags(shadow_l2e_t sl2e)
 { return l2e_get_flags(sl2e); }
 static inline u32 shadow_l3e_get_flags(shadow_l3e_t sl3e)
 { return l3e_get_flags(sl3e); }
-#if SHADOW_PAGING_LEVELS >= 4
 static inline u32 shadow_l4e_get_flags(shadow_l4e_t sl4e)
 { return l4e_get_flags(sl4e); }
-#endif
 
 static inline shadow_l1e_t
 shadow_l1e_remove_flags(shadow_l1e_t sl1e, u32 flags)
@@ -109,10 +101,8 @@ static inline shadow_l2e_t shadow_l2e_empty(void)
 { return l2e_empty(); }
 static inline shadow_l3e_t shadow_l3e_empty(void)
 { return l3e_empty(); }
-#if SHADOW_PAGING_LEVELS >= 4
 static inline shadow_l4e_t shadow_l4e_empty(void)
 { return l4e_empty(); }
-#endif
 
 static inline shadow_l1e_t shadow_l1e_from_mfn(mfn_t mfn, u32 flags)
 { return l1e_from_mfn(mfn, flags); }
@@ -120,10 +110,8 @@ static inline shadow_l2e_t shadow_l2e_from_mfn(mfn_t mfn, u32 flags)
 { return l2e_from_mfn(mfn, flags); }
 static inline shadow_l3e_t shadow_l3e_from_mfn(mfn_t mfn, u32 flags)
 { return l3e_from_mfn(mfn, flags); }
-#if SHADOW_PAGING_LEVELS >= 4
 static inline shadow_l4e_t shadow_l4e_from_mfn(mfn_t mfn, u32 flags)
 { return l4e_from_mfn(mfn, flags); }
-#endif
 
 #define shadow_l1_table_offset(a) l1_table_offset(a)
 #define shadow_l2_table_offset(a) l2_table_offset(a)
@@ -208,7 +196,7 @@ static inline shadow_l4e_t shadow_l4e_from_mfn(mfn_t mfn, u32 flags)
 #define SH_type_fl1_shadow SH_type_fl1_pae_shadow
 #define SH_type_l2_shadow  SH_type_l2_pae_shadow
 #define SH_type_l2h_shadow SH_type_l2h_pae_shadow
-#else
+#elif GUEST_PAGING_LEVELS == 4
 #define SH_type_l1_shadow  SH_type_l1_64_shadow
 #define SH_type_fl1_shadow SH_type_fl1_64_shadow
 #define SH_type_l2_shadow  SH_type_l2_64_shadow
@@ -217,6 +205,8 @@ static inline shadow_l4e_t shadow_l4e_from_mfn(mfn_t mfn, u32 flags)
 #define SH_type_l4_shadow  SH_type_l4_64_shadow
 #endif
 
+#if GUEST_PAGING_LEVELS
+
 /* macros for dealing with the naming of the internal function names of the
  * shadow code's external entry points.
  */
@@ -262,6 +252,8 @@ static inline shadow_l4e_t shadow_l4e_from_mfn(mfn_t mfn, u32 flags)
 #define sh_rm_write_access_from_sl1p INTERNAL_NAME(sh_rm_write_access_from_sl1p)
 #endif
 
+#endif /* GUEST_PAGING_LEVELS */
+
 #if SHADOW_PAGING_LEVELS == 3
 #define MFN_FITS_IN_HVM_CR3(_MFN) !(mfn_x(_MFN) >> 20)
 #endif
@@ -270,6 +262,26 @@ static inline shadow_l4e_t shadow_l4e_from_mfn(mfn_t mfn, u32 flags)
 #define SH_PRI_gpte PRI_gpte
 #define SH_PRI_gfn  PRI_gfn
 
+int shadow_set_l1e(struct domain *d, shadow_l1e_t *sl1e,
+                   shadow_l1e_t new_sl1e, p2m_type_t new_type,
+                   mfn_t sl1mfn);
+int shadow_set_l2e(struct domain *d, shadow_l2e_t *sl2e,
+                   shadow_l2e_t new_sl2e, mfn_t sl2mfn,
+                   unsigned int type_fl1_shadow,
+                   mfn_t (*next_page)(mfn_t smfn));
+int shadow_set_l3e(struct domain *d, shadow_l3e_t *sl3e,
+                   shadow_l3e_t new_sl3e, mfn_t sl3mfn);
+int shadow_set_l4e(struct domain *d, shadow_l4e_t *sl4e,
+                   shadow_l4e_t new_sl4e, mfn_t sl4mfn);
+
+static void inline
+shadow_put_page_from_l1e(shadow_l1e_t sl1e, struct domain *d)
+{
+    if ( !shadow_mode_refcounts(d) )
+        return;
+
+    put_page_from_l1e(sl1e, d);
+}
 
 #if (SHADOW_OPTIMIZATIONS & SHOPT_FAST_FAULT_PATH)
 /******************************************************************************
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 12 10:45:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Apr 2021 10:45:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.108939.207883 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu48-0007rz-EW; Mon, 12 Apr 2021 10:45:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 108939.207883; Mon, 12 Apr 2021 10:45: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 1lVu48-0007rr-BS; Mon, 12 Apr 2021 10:45:12 +0000
Received: by outflank-mailman (input) for mailman id 108939;
 Mon, 12 Apr 2021 10:45: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 1lVu47-0007rm-GM
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:45: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 1lVu47-0002zE-Fa
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:45:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu47-00058S-Ef
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:45: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=0Efj9wb+L1XvW/G3Cddj2fPhoiMCd93oeBOtvRTKUvs=; b=Y7NqnivD6CP33/ZYmJqQSTImy4
	9VRSYSASEEDJbIzHQZomsrNHg6bTBEhmy/wukT9IB+1fKNuoMmr0PiJQ5xJ76q3f6EU5dCmlwx5ZT
	B5jL0o4wHZkgo0MU3fm37WSEuDtbWpyAqwswPOXi/qJDfwG15N1xIvPstBrDve/NrH10=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: don't open-code SHF_* shorthands
Message-Id: <E1lVu47-00058S-Ef@xenbits.xenproject.org>
Date: Mon, 12 Apr 2021 10:45:11 +0000

commit 099fcfb037477bcc2e8c4c5c8a3c5c54a95e7350
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:32:18 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:32:18 2021 +0200

    x86/shadow: don't open-code SHF_* shorthands
    
    Use SHF_L1_ANY, SHF_32, SHF_PAE, as well as SHF_64, and introduce
    SHF_FL1_ANY.
    
    Note that in shadow_audit_tables() this has the effect of no longer
    (I assume mistakenly, or else I don't see why the respective callback
    table entry isn't NULL) excluding SHF_L2H_64.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c  | 26 +++++---------------------
 xen/arch/x86/mm/shadow/private.h |  1 +
 2 files changed, 6 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index c64de3b789..bcc3d6c3ae 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -1834,14 +1834,7 @@ int sh_remove_write_access(struct domain *d, mfn_t gmfn,
         NULL  /* unused  */
     };
 
-    static const unsigned int callback_mask =
-          SHF_L1_32
-        | SHF_FL1_32
-        | SHF_L1_PAE
-        | SHF_FL1_PAE
-        | SHF_L1_64
-        | SHF_FL1_64
-        ;
+    static const unsigned int callback_mask = SHF_L1_ANY | SHF_FL1_ANY;
     struct page_info *pg = mfn_to_page(gmfn);
 #if SHADOW_OPTIMIZATIONS & SHOPT_WRITABLE_HEURISTIC
     struct vcpu *curr = current;
@@ -2065,14 +2058,7 @@ int sh_remove_all_mappings(struct domain *d, mfn_t gmfn, gfn_t gfn)
         NULL  /* unused  */
     };
 
-    static const unsigned int callback_mask =
-          SHF_L1_32
-        | SHF_FL1_32
-        | SHF_L1_PAE
-        | SHF_FL1_PAE
-        | SHF_L1_64
-        | SHF_FL1_64
-        ;
+    static const unsigned int callback_mask = SHF_L1_ANY | SHF_FL1_ANY;
 
     perfc_incr(shadow_mappings);
     if ( sh_check_page_has_no_refs(page) )
@@ -3424,11 +3410,9 @@ void shadow_audit_tables(struct vcpu *v)
         /* Audit only the current mode's tables */
         switch ( v->arch.paging.mode->guest_levels )
         {
-        case 2: mask = (SHF_L1_32|SHF_FL1_32|SHF_L2_32); break;
-        case 3: mask = (SHF_L1_PAE|SHF_FL1_PAE|SHF_L2_PAE
-                        |SHF_L2H_PAE); break;
-        case 4: mask = (SHF_L1_64|SHF_FL1_64|SHF_L2_64
-                        |SHF_L3_64|SHF_L4_64); break;
+        case 2: mask = SHF_32; break;
+        case 3: mask = SHF_PAE; break;
+        case 4: mask = SHF_64; break;
         default: BUG();
         }
     }
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 911db46e73..e2c352f878 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -269,6 +269,7 @@ static inline void sh_terminate_list(struct page_list_head *tmp_list)
 #define SHF_64  (SHF_L1_64|SHF_FL1_64|SHF_L2_64|SHF_L2H_64|SHF_L3_64|SHF_L4_64)
 
 #define SHF_L1_ANY  (SHF_L1_32|SHF_L1_PAE|SHF_L1_64)
+#define SHF_FL1_ANY (SHF_FL1_32|SHF_FL1_PAE|SHF_FL1_64)
 
 #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
 /* Marks a guest L1 page table which is shadowed but not write-protected.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 12 10:45:22 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Apr 2021 10:45:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.108941.207887 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu4I-0007tQ-Fz; Mon, 12 Apr 2021 10:45:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 108941.207887; Mon, 12 Apr 2021 10:45: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 1lVu4I-0007tI-D0; Mon, 12 Apr 2021 10:45:22 +0000
Received: by outflank-mailman (input) for mailman id 108941;
 Mon, 12 Apr 2021 10:45: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 1lVu4H-0007t9-LV
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:45: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 1lVu4H-0002zN-Kd
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:45:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu4H-00059S-Ih
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:45: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=2fJzUuFzEvd/hRoHWOKTCiG5WuMpONel5QzbZYquo3g=; b=EJX9yNPztfo7lp2TFgC5alhj1X
	kl/TbusC+1/DAS+xPHFbriMiGoLp/4sLdqBYbPSd591xsoJj36H0kcgJYorn/2/EAv3lzK/EfWq+0
	XZ0x513C71Waa4gZCzru3FRFpEqcTky9IVWtB7h8LPSltNoKCe7nHZLxvZdX1aWaw5vo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: SH_type_l2h_shadow is PV-only
Message-Id: <E1lVu4H-00059S-Ih@xenbits.xenproject.org>
Date: Mon, 12 Apr 2021 10:45:21 +0000

commit 5eb6f827ddaaa2cf6d589fc3dc954f82ea0d4833
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:32:50 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:32:50 2021 +0200

    x86/shadow: SH_type_l2h_shadow is PV-only
    
    ..., i.e. being used only with 4 guest paging levels. Drop its L2/PAE
    alias and adjust / drop conditionals. Use >= 4 where touching them
    anyway, in preparation for 5-level paging.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/multi.c | 29 ++++++++++++-----------------
 xen/arch/x86/mm/shadow/types.h |  1 -
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 422ab54a94..54d1e1bc05 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -334,7 +334,7 @@ static void sh_audit_gw(struct vcpu *v, const walk_t *gw)
         if ( mfn_valid((smfn = get_shadow_status(d, gw->l2mfn,
                                                  SH_type_l2_shadow))) )
             (void) sh_audit_l2_table(v, smfn, INVALID_MFN);
-#if GUEST_PAGING_LEVELS == 3
+#if GUEST_PAGING_LEVELS >= 4 /* 32-bit PV only */
         if ( mfn_valid((smfn = get_shadow_status(d, gw->l2mfn,
                                                  SH_type_l2h_shadow))) )
             (void) sh_audit_l2_table(v, smfn, INVALID_MFN);
@@ -938,7 +938,8 @@ sh_make_shadow(struct vcpu *v, mfn_t gmfn, u32 shadow_type)
         /* Lower-level shadow, not yet linked form a higher level */
         mfn_to_page(smfn)->up = 0;
 
-#if GUEST_PAGING_LEVELS == 4
+#if GUEST_PAGING_LEVELS >= 4
+
 #if (SHADOW_OPTIMIZATIONS & SHOPT_LINUX_L3_TOPLEVEL)
     if ( shadow_type == SH_type_l4_64_shadow &&
          unlikely(d->arch.paging.shadow.opt_flags & SHOPT_LINUX_L3_TOPLEVEL) )
@@ -969,7 +970,6 @@ sh_make_shadow(struct vcpu *v, mfn_t gmfn, u32 shadow_type)
             sh_reset_l3_up_pointers(v);
         }
     }
-#endif
 #endif
 
     // Create the Xen mappings...
@@ -977,7 +977,6 @@ sh_make_shadow(struct vcpu *v, mfn_t gmfn, u32 shadow_type)
     {
         switch (shadow_type)
         {
-#if GUEST_PAGING_LEVELS == 4
         case SH_type_l4_shadow:
         {
             shadow_l4e_t *l4t = map_domain_page(smfn);
@@ -989,8 +988,7 @@ sh_make_shadow(struct vcpu *v, mfn_t gmfn, u32 shadow_type)
             unmap_domain_page(l4t);
         }
         break;
-#endif
-#if GUEST_PAGING_LEVELS >= 3
+
         case SH_type_l2h_shadow:
             BUILD_BUG_ON(sizeof(l2_pgentry_t) != sizeof(shadow_l2e_t));
             if ( is_pv_32bit_domain(d) )
@@ -1001,11 +999,12 @@ sh_make_shadow(struct vcpu *v, mfn_t gmfn, u32 shadow_type)
                 unmap_domain_page(l2t);
             }
             break;
-#endif
         default: /* Do nothing */ break;
         }
     }
 
+#endif /* GUEST_PAGING_LEVELS >= 4 */
+
     shadow_promote(d, gmfn, shadow_type);
     set_shadow_status(d, gmfn, shadow_type, smfn);
 
@@ -1335,7 +1334,7 @@ void sh_destroy_l2_shadow(struct domain *d, mfn_t smfn)
 
     SHADOW_DEBUG(DESTROY_SHADOW, "%"PRI_mfn"\n", mfn_x(smfn));
 
-#if GUEST_PAGING_LEVELS >= 3
+#if GUEST_PAGING_LEVELS >= 4
     ASSERT(t == SH_type_l2_shadow || t == SH_type_l2h_shadow);
 #else
     ASSERT(t == SH_type_l2_shadow);
@@ -1859,7 +1858,7 @@ int
 sh_map_and_validate_gl2he(struct vcpu *v, mfn_t gl2mfn,
                            void *new_gl2p, u32 size)
 {
-#if GUEST_PAGING_LEVELS >= 3
+#if GUEST_PAGING_LEVELS >= 4
     return sh_map_and_validate(v, gl2mfn, new_gl2p, size,
                                 SH_type_l2h_shadow,
                                 shadow_l2_index,
@@ -3360,9 +3359,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
                 gl2gfn = guest_l3e_get_gfn(gl3e[i]);
                 gl2mfn = get_gfn_query_unlocked(d, gfn_x(gl2gfn), &p2mt);
                 if ( p2m_is_ram(p2mt) )
-                    sh_set_toplevel_shadow(v, i, gl2mfn, (i == 3)
-                                           ? SH_type_l2h_shadow
-                                           : SH_type_l2_shadow,
+                    sh_set_toplevel_shadow(v, i, gl2mfn, SH_type_l2_shadow,
                                            sh_make_shadow);
                 else
                     sh_set_toplevel_shadow(v, i, INVALID_MFN, 0,
@@ -3664,7 +3661,7 @@ void sh_clear_shadow_entry(struct domain *d, void *ep, mfn_t smfn)
         (void) shadow_set_l1e(d, ep, shadow_l1e_empty(), p2m_invalid, smfn);
         break;
     case SH_type_l2_shadow:
-#if GUEST_PAGING_LEVELS >= 3
+#if GUEST_PAGING_LEVELS >= 4
     case SH_type_l2h_shadow:
 #endif
         (void) shadow_set_l2e(d, ep, shadow_l2e_empty(), smfn);
@@ -4116,10 +4113,8 @@ int sh_audit_l3_table(struct vcpu *v, mfn_t sl3mfn, mfn_t x)
             mfn = shadow_l3e_get_mfn(*sl3e);
             gmfn = get_shadow_status(d, get_gfn_query_unlocked(
                                         d, gfn_x(gfn), &p2mt),
-                                     ((GUEST_PAGING_LEVELS == 3 ||
-                                       is_pv_32bit_domain(d))
-                                      && !shadow_mode_external(d)
-                                      && (guest_index(gl3e) % 4) == 3)
+                                     (is_pv_32bit_domain(d) &&
+                                      guest_index(gl3e) == 3)
                                      ? SH_type_l2h_shadow
                                      : SH_type_l2_shadow);
             if ( !mfn_eq(gmfn, mfn) )
diff --git a/xen/arch/x86/mm/shadow/types.h b/xen/arch/x86/mm/shadow/types.h
index a671fc9a49..814a401853 100644
--- a/xen/arch/x86/mm/shadow/types.h
+++ b/xen/arch/x86/mm/shadow/types.h
@@ -195,7 +195,6 @@ static inline shadow_l4e_t shadow_l4e_from_mfn(mfn_t mfn, u32 flags)
 #define SH_type_l1_shadow  SH_type_l1_pae_shadow
 #define SH_type_fl1_shadow SH_type_fl1_pae_shadow
 #define SH_type_l2_shadow  SH_type_l2_pae_shadow
-#define SH_type_l2h_shadow SH_type_l2h_pae_shadow
 #elif GUEST_PAGING_LEVELS == 4
 #define SH_type_l1_shadow  SH_type_l1_64_shadow
 #define SH_type_fl1_shadow SH_type_fl1_64_shadow
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 12 10:45:32 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Apr 2021 10:45:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.108942.207891 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu4S-0007uj-Hl; Mon, 12 Apr 2021 10:45:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 108942.207891; Mon, 12 Apr 2021 10:45: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 1lVu4S-0007ub-Ee; Mon, 12 Apr 2021 10:45:32 +0000
Received: by outflank-mailman (input) for mailman id 108942;
 Mon, 12 Apr 2021 10:45: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 1lVu4R-0007uV-PH
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:45: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 1lVu4R-0002zX-OY
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:45:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu4R-0005AF-Nq
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:45: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=aQc9ktQWwpl9y66iV50Lz+dAawHw8iyNn/vYsnbi3is=; b=H1hgeeUktF3iG+vfE349HRpczU
	t+7g+AAv+CGiIPNcRpQi+Ejsa2StMsLI8pHW0BQbhj+PhsLlrhTc6RZAISYoKs5bvoFZDSvtSAsHj
	Kxm3OHFVbYDAo7fzFHSTcTbLNOXyXzMs5PK+O+gmz7s+22BINYPPut/Tf44XnAaPY/Ic=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: drop SH_type_l2h_pae_shadow
Message-Id: <E1lVu4R-0005AF-Nq@xenbits.xenproject.org>
Date: Mon, 12 Apr 2021 10:45:31 +0000

commit 42bbda6bcc35b3b402a64b8571a4fe7bd43dde22
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:33:17 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:33:17 2021 +0200

    x86/shadow: drop SH_type_l2h_pae_shadow
    
    This is a remnant from 32-bit days, having no place anymore where a
    shadow of this type would be created.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c  | 16 +---------------
 xen/arch/x86/mm/shadow/hvm.c     |  2 +-
 xen/arch/x86/mm/shadow/multi.c   |  3 +--
 xen/arch/x86/mm/shadow/private.h | 27 ++++++++++++---------------
 4 files changed, 15 insertions(+), 33 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index bcc3d6c3ae..2b75ea6856 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -792,9 +792,6 @@ sh_validate_guest_entry(struct vcpu *v, mfn_t gmfn, void *entry, u32 size)
     if ( page->shadow_flags & SHF_L2_PAE )
         result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2e, 3)
             (v, gmfn, entry, size);
-    if ( page->shadow_flags & SHF_L2H_PAE )
-        result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2he, 3)
-            (v, gmfn, entry, size);
 
     if ( page->shadow_flags & SHF_L1_64 )
         result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl1e, 4)
@@ -859,7 +856,6 @@ const u8 sh_type_to_size[] = {
     1, /* SH_type_l1_pae_shadow  */
     1, /* SH_type_fl1_pae_shadow */
     1, /* SH_type_l2_pae_shadow  */
-    1, /* SH_type_l2h_pae_shadow */
     1, /* SH_type_l1_64_shadow   */
     1, /* SH_type_fl1_64_shadow  */
     1, /* SH_type_l2_64_shadow   */
@@ -900,7 +896,6 @@ void shadow_unhook_mappings(struct domain *d, mfn_t smfn, int user_only)
         SHADOW_INTERNAL_NAME(sh_unhook_32b_mappings, 2)(d, smfn, user_only);
         break;
     case SH_type_l2_pae_shadow:
-    case SH_type_l2h_pae_shadow:
         SHADOW_INTERNAL_NAME(sh_unhook_pae_mappings, 3)(d, smfn, user_only);
         break;
     case SH_type_l4_64_shadow:
@@ -1764,7 +1759,6 @@ void sh_destroy_shadow(struct domain *d, mfn_t smfn)
         SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 3)(d, smfn);
         break;
     case SH_type_l2_pae_shadow:
-    case SH_type_l2h_pae_shadow:
         SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 3)(d, smfn);
         break;
 
@@ -1823,7 +1817,6 @@ int sh_remove_write_access(struct domain *d, mfn_t gmfn,
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 3), /* l1_pae  */
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 3), /* fl1_pae */
         NULL, /* l2_pae  */
-        NULL, /* l2h_pae */
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 4), /* l1_64   */
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 4), /* fl1_64  */
         NULL, /* l2_64   */
@@ -2047,7 +2040,6 @@ int sh_remove_all_mappings(struct domain *d, mfn_t gmfn, gfn_t gfn)
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3), /* l1_pae  */
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3), /* fl1_pae */
         NULL, /* l2_pae  */
-        NULL, /* l2h_pae */
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 4), /* l1_64   */
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 4), /* fl1_64  */
         NULL, /* l2_64   */
@@ -2145,7 +2137,6 @@ static int sh_remove_shadow_via_pointer(struct domain *d, mfn_t smfn)
         break;
     case SH_type_l1_pae_shadow:
     case SH_type_l2_pae_shadow:
-    case SH_type_l2h_pae_shadow:
         SHADOW_INTERNAL_NAME(sh_clear_shadow_entry, 3)(d, vaddr, pmfn);
         break;
     case SH_type_l1_64_shadow:
@@ -2190,7 +2181,6 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
         NULL, /* l1_pae  */
         NULL, /* fl1_pae */
         SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 3), /* l2_pae  */
-        SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 3), /* l2h_pae */
         NULL, /* l1_64   */
         NULL, /* fl1_64  */
         SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 4), /* l2_64   */
@@ -2207,10 +2197,9 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
         SHF_L2_32, /* l1_32   */
         0, /* fl1_32  */
         0, /* l2_32   */
-        SHF_L2H_PAE | SHF_L2_PAE, /* l1_pae  */
+        SHF_L2_PAE, /* l1_pae  */
         0, /* fl1_pae */
         0, /* l2_pae  */
-        0, /* l2h_pae  */
         SHF_L2H_64 | SHF_L2_64, /* l1_64   */
         0, /* fl1_64  */
         SHF_L3_64, /* l2_64   */
@@ -2273,7 +2262,6 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
 
     DO_UNSHADOW(SH_type_l2_32_shadow);
     DO_UNSHADOW(SH_type_l1_32_shadow);
-    DO_UNSHADOW(SH_type_l2h_pae_shadow);
     DO_UNSHADOW(SH_type_l2_pae_shadow);
     DO_UNSHADOW(SH_type_l1_pae_shadow);
     DO_UNSHADOW(SH_type_l4_64_shadow);
@@ -2356,7 +2344,6 @@ void sh_reset_l3_up_pointers(struct vcpu *v)
         NULL, /* l1_pae  */
         NULL, /* fl1_pae */
         NULL, /* l2_pae  */
-        NULL, /* l2h_pae */
         NULL, /* l1_64   */
         NULL, /* fl1_64  */
         NULL, /* l2_64   */
@@ -3381,7 +3368,6 @@ void shadow_audit_tables(struct vcpu *v)
         SHADOW_INTERNAL_NAME(sh_audit_l1_table, 3),  /* l1_pae  */
         SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 3), /* fl1_pae */
         SHADOW_INTERNAL_NAME(sh_audit_l2_table, 3),  /* l2_pae  */
-        SHADOW_INTERNAL_NAME(sh_audit_l2_table, 3),  /* l2h_pae */
         SHADOW_INTERNAL_NAME(sh_audit_l1_table, 4),  /* l1_64   */
         SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 4), /* fl1_64  */
         SHADOW_INTERNAL_NAME(sh_audit_l2_table, 4),  /* l2_64   */
diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index 87fc57704f..7f98286385 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -568,7 +568,7 @@ static inline void check_for_early_unshadow(struct vcpu *v, mfn_t gmfn)
          && sh_mfn_is_a_page_table(gmfn)
          && (!d->arch.paging.shadow.pagetable_dying_op ||
              !(mfn_to_page(gmfn)->shadow_flags
-               & (SHF_L2_32|SHF_L2_PAE|SHF_L2H_PAE|SHF_L4_64))) )
+               & (SHF_L2_32|SHF_L2_PAE|SHF_L4_64))) )
     {
         perfc_incr(shadow_early_unshadow);
         sh_remove_shadows(d, gmfn, 1, 0 /* Fast, can fail to unshadow */ );
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 54d1e1bc05..5e33f6d3db 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -838,8 +838,7 @@ do {                                                                       \
     int _i;                                                                \
     shadow_l2e_t *_sp = map_domain_page((_sl2mfn));                        \
     ASSERT(shadow_mode_external(_dom));                                    \
-    ASSERT(mfn_to_page(_sl2mfn)->u.sh.type == SH_type_l2_pae_shadow        \
-           || mfn_to_page(_sl2mfn)->u.sh.type == SH_type_l2h_pae_shadow);  \
+    ASSERT(mfn_to_page(_sl2mfn)->u.sh.type == SH_type_l2_pae_shadow);      \
     for ( _i = 0; _i < SHADOW_L2_PAGETABLE_ENTRIES; _i++ )                 \
     {                                                                      \
         (_sl2e) = _sp + _i;                                                \
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index e2c352f878..5b899399b6 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -177,18 +177,17 @@ extern void shadow_audit_tables(struct vcpu *v);
 #define SH_type_l1_pae_shadow  (4U) /* shadowing a pae L1 page */
 #define SH_type_fl1_pae_shadow (5U) /* L1 shadow for pae 2M superpg */
 #define SH_type_l2_pae_shadow  (6U) /* shadowing a pae L2-low page */
-#define SH_type_l2h_pae_shadow (7U) /* shadowing a pae L2-high page */
-#define SH_type_l1_64_shadow   (8U) /* shadowing a 64-bit L1 page */
-#define SH_type_fl1_64_shadow  (9U) /* L1 shadow for 64-bit 2M superpg */
-#define SH_type_l2_64_shadow  (10U) /* shadowing a 64-bit L2 page */
-#define SH_type_l2h_64_shadow (11U) /* shadowing a compat PAE L2 high page */
-#define SH_type_l3_64_shadow  (12U) /* shadowing a 64-bit L3 page */
-#define SH_type_l4_64_shadow  (13U) /* shadowing a 64-bit L4 page */
-#define SH_type_max_shadow    (13U)
-#define SH_type_p2m_table     (14U) /* in use as the p2m table */
-#define SH_type_monitor_table (15U) /* in use as a monitor table */
-#define SH_type_oos_snapshot  (16U) /* in use as OOS snapshot */
-#define SH_type_unused        (17U)
+#define SH_type_l1_64_shadow   (7U) /* shadowing a 64-bit L1 page */
+#define SH_type_fl1_64_shadow  (8U) /* L1 shadow for 64-bit 2M superpg */
+#define SH_type_l2_64_shadow   (9U) /* shadowing a 64-bit L2 page */
+#define SH_type_l2h_64_shadow (10U) /* shadowing a compat PAE L2 high page */
+#define SH_type_l3_64_shadow  (11U) /* shadowing a 64-bit L3 page */
+#define SH_type_l4_64_shadow  (12U) /* shadowing a 64-bit L4 page */
+#define SH_type_max_shadow    (12U)
+#define SH_type_p2m_table     (13U) /* in use as the p2m table */
+#define SH_type_monitor_table (14U) /* in use as a monitor table */
+#define SH_type_oos_snapshot  (15U) /* in use as OOS snapshot */
+#define SH_type_unused        (16U)
 
 /*
  * What counts as a pinnable shadow?
@@ -200,7 +199,6 @@ static inline int sh_type_is_pinnable(struct domain *d, unsigned int t)
      * persist even when not currently in use in a guest CR3 */
     if ( t == SH_type_l2_32_shadow
          || t == SH_type_l2_pae_shadow
-         || t == SH_type_l2h_pae_shadow
          || t == SH_type_l4_64_shadow )
         return 1;
 
@@ -256,7 +254,6 @@ static inline void sh_terminate_list(struct page_list_head *tmp_list)
 #define SHF_L1_PAE  (1u << SH_type_l1_pae_shadow)
 #define SHF_FL1_PAE (1u << SH_type_fl1_pae_shadow)
 #define SHF_L2_PAE  (1u << SH_type_l2_pae_shadow)
-#define SHF_L2H_PAE (1u << SH_type_l2h_pae_shadow)
 #define SHF_L1_64   (1u << SH_type_l1_64_shadow)
 #define SHF_FL1_64  (1u << SH_type_fl1_64_shadow)
 #define SHF_L2_64   (1u << SH_type_l2_64_shadow)
@@ -265,7 +262,7 @@ static inline void sh_terminate_list(struct page_list_head *tmp_list)
 #define SHF_L4_64   (1u << SH_type_l4_64_shadow)
 
 #define SHF_32  (SHF_L1_32|SHF_FL1_32|SHF_L2_32)
-#define SHF_PAE (SHF_L1_PAE|SHF_FL1_PAE|SHF_L2_PAE|SHF_L2H_PAE)
+#define SHF_PAE (SHF_L1_PAE|SHF_FL1_PAE|SHF_L2_PAE)
 #define SHF_64  (SHF_L1_64|SHF_FL1_64|SHF_L2_64|SHF_L2H_64|SHF_L3_64|SHF_L4_64)
 
 #define SHF_L1_ANY  (SHF_L1_32|SHF_L1_PAE|SHF_L1_64)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 12 10:45:42 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Apr 2021 10:45:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.108943.207895 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu4c-0007wC-Ji; Mon, 12 Apr 2021 10:45:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 108943.207895; Mon, 12 Apr 2021 10:45:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu4c-0007w5-GF; Mon, 12 Apr 2021 10:45:42 +0000
Received: by outflank-mailman (input) for mailman id 108943;
 Mon, 12 Apr 2021 10:45:41 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu4b-0007vi-UG
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:45:41 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu4b-0002zf-SS
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:45:41 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu4b-0005B3-R5
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:45:41 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uaLZTrm0W7M+dzkqg4c2gqKed9aK1fePL1MPLw5sDIY=; b=3mJ0NkQ5WfT8TTYxlRwJ9AfBL2
	wHagvLpGOSYvpU1hvm1t6BtaNpaVFk3AjfahLSpWUvEYUauEkkmdkovy9A8AOFeF52kbsU0+Ke7KX
	Nshvnt23dhpe5qDqsHuDgHKwnVQRpHTz7Ub49kdWYm0a/Z8tbaXf3aeJgyY+gpq+6DMc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: only 4-level guest code needs building when !HVM
Message-Id: <E1lVu4b-0005B3-R5@xenbits.xenproject.org>
Date: Mon, 12 Apr 2021 10:45:41 +0000

commit aff8bf94ce652bab55d4e0ec8832445bcc1c071f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:34:04 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:34:04 2021 +0200

    x86/shadow: only 4-level guest code needs building when !HVM
    
    In order to limit #ifdef-ary, provide "stub" #define-s for
    SH_type_{l1,fl1,l2}_{32,pae}_shadow and SHF_{L1,FL1,L2}_{32,PAE}.
    
    The change in shadow_vcpu_init() is necessary to cover for "x86: correct
    is_pv_domain() when !CONFIG_PV" (or any other change along those lines)
    - we should only rely on is_hvm_*() to become a build time constant.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/Makefile         |  2 +-
 xen/arch/x86/mm/shadow/Makefile  |  6 +++---
 xen/arch/x86/mm/shadow/common.c  | 30 +++++++++++++++++++++++++++---
 xen/arch/x86/mm/shadow/private.h | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 67 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index a2431fde6b..24f4ec40e0 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -3,7 +3,7 @@ obj-$(CONFIG_HVM) += hap/
 
 obj-$(CONFIG_HVM) += altp2m.o
 obj-$(CONFIG_HVM) += guest_walk_2.o guest_walk_3.o guest_walk_4.o
-obj-$(CONFIG_SHADOW_PAGING) += guest_walk_2.o guest_walk_3.o guest_walk_4.o
+obj-$(CONFIG_SHADOW_PAGING) += guest_walk_4.o
 obj-$(CONFIG_MEM_ACCESS) += mem_access.o
 obj-y += mem_paging.o
 obj-$(CONFIG_MEM_SHARING) += mem_sharing.o
diff --git a/xen/arch/x86/mm/shadow/Makefile b/xen/arch/x86/mm/shadow/Makefile
index 05ffc164eb..770213fe9d 100644
--- a/xen/arch/x86/mm/shadow/Makefile
+++ b/xen/arch/x86/mm/shadow/Makefile
@@ -1,7 +1,7 @@
 ifeq ($(CONFIG_SHADOW_PAGING),y)
-obj-y += common.o guest_2.o guest_3.o guest_4.o set.o
-obj-$(CONFIG_HVM) += hvm.o
-obj-$(CONFIG_PV) += pv.o
+obj-y += common.o set.o
+obj-$(CONFIG_HVM) += hvm.o guest_2.o guest_3.o guest_4.o
+obj-$(CONFIG_PV) += pv.o guest_4.o
 else
 obj-y += none.o
 endif
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 2b75ea6856..c0c4ce46e4 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -90,9 +90,9 @@ void shadow_vcpu_init(struct vcpu *v)
     }
 #endif
 
-    v->arch.paging.mode = is_pv_vcpu(v) ?
-                          &SHADOW_INTERNAL_NAME(sh_paging_mode, 4) :
-                          &SHADOW_INTERNAL_NAME(sh_paging_mode, 3);
+    v->arch.paging.mode = is_hvm_vcpu(v) ?
+                          &SHADOW_INTERNAL_NAME(sh_paging_mode, 3) :
+                          &SHADOW_INTERNAL_NAME(sh_paging_mode, 4);
 }
 
 #if SHADOW_AUDIT
@@ -257,6 +257,7 @@ static int sh_remove_write_access_from_sl1p(struct domain *d, mfn_t gmfn,
 
     switch ( mfn_to_page(smfn)->u.sh.type )
     {
+#ifdef CONFIG_HVM
     case SH_type_l1_32_shadow:
     case SH_type_fl1_32_shadow:
         return SHADOW_INTERNAL_NAME(sh_rm_write_access_from_sl1p, 2)
@@ -266,6 +267,7 @@ static int sh_remove_write_access_from_sl1p(struct domain *d, mfn_t gmfn,
     case SH_type_fl1_pae_shadow:
         return SHADOW_INTERNAL_NAME(sh_rm_write_access_from_sl1p, 3)
             (d, gmfn, smfn, off);
+#endif
 
     case SH_type_l1_64_shadow:
     case SH_type_fl1_64_shadow:
@@ -848,6 +850,7 @@ sh_validate_guest_entry(struct vcpu *v, mfn_t gmfn, void *entry, u32 size)
  * the free pool.
  */
 
+#ifdef CONFIG_HVM
 const u8 sh_type_to_size[] = {
     1, /* SH_type_none           */
     2, /* SH_type_l1_32_shadow   */
@@ -866,6 +869,7 @@ const u8 sh_type_to_size[] = {
     1, /* SH_type_monitor_table  */
     1  /* SH_type_oos_snapshot   */
 };
+#endif
 
 /*
  * Figure out the least acceptable quantity of shadow memory.
@@ -892,12 +896,14 @@ void shadow_unhook_mappings(struct domain *d, mfn_t smfn, int user_only)
     struct page_info *sp = mfn_to_page(smfn);
     switch ( sp->u.sh.type )
     {
+#ifdef CONFIG_HVM
     case SH_type_l2_32_shadow:
         SHADOW_INTERNAL_NAME(sh_unhook_32b_mappings, 2)(d, smfn, user_only);
         break;
     case SH_type_l2_pae_shadow:
         SHADOW_INTERNAL_NAME(sh_unhook_pae_mappings, 3)(d, smfn, user_only);
         break;
+#endif
     case SH_type_l4_64_shadow:
         SHADOW_INTERNAL_NAME(sh_unhook_64b_mappings, 4)(d, smfn, user_only);
         break;
@@ -1104,8 +1110,10 @@ mfn_t shadow_alloc(struct domain *d,
     /* Backpointers that are MFNs need to be packed into PDXs (PFNs don't) */
     switch (shadow_type)
     {
+#ifdef CONFIG_HVM
     case SH_type_fl1_32_shadow:
     case SH_type_fl1_pae_shadow:
+#endif
     case SH_type_fl1_64_shadow:
         break;
     default:
@@ -1746,6 +1754,7 @@ void sh_destroy_shadow(struct domain *d, mfn_t smfn)
      * small numbers that the compiler will enjoy */
     switch ( t )
     {
+#ifdef CONFIG_HVM
     case SH_type_l1_32_shadow:
     case SH_type_fl1_32_shadow:
         SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 2)(d, smfn);
@@ -1761,6 +1770,7 @@ void sh_destroy_shadow(struct domain *d, mfn_t smfn)
     case SH_type_l2_pae_shadow:
         SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 3)(d, smfn);
         break;
+#endif
 
     case SH_type_l1_64_shadow:
     case SH_type_fl1_64_shadow:
@@ -1811,12 +1821,14 @@ int sh_remove_write_access(struct domain *d, mfn_t gmfn,
     /* Dispatch table for getting per-type functions */
     static const hash_domain_callback_t callbacks[SH_type_unused] = {
         NULL, /* none    */
+#ifdef CONFIG_HVM
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 2), /* l1_32   */
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 2), /* fl1_32  */
         NULL, /* l2_32   */
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 3), /* l1_pae  */
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 3), /* fl1_pae */
         NULL, /* l2_pae  */
+#endif
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 4), /* l1_64   */
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 4), /* fl1_64  */
         NULL, /* l2_64   */
@@ -2034,12 +2046,14 @@ int sh_remove_all_mappings(struct domain *d, mfn_t gmfn, gfn_t gfn)
     /* Dispatch table for getting per-type functions */
     static const hash_domain_callback_t callbacks[SH_type_unused] = {
         NULL, /* none    */
+#ifdef CONFIG_HVM
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 2), /* l1_32   */
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 2), /* fl1_32  */
         NULL, /* l2_32   */
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3), /* l1_pae  */
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3), /* fl1_pae */
         NULL, /* l2_pae  */
+#endif
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 4), /* l1_64   */
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 4), /* fl1_64  */
         NULL, /* l2_64   */
@@ -2131,6 +2145,7 @@ static int sh_remove_shadow_via_pointer(struct domain *d, mfn_t smfn)
     /* Blank the offending entry */
     switch (sp->u.sh.type)
     {
+#ifdef CONFIG_HVM
     case SH_type_l1_32_shadow:
     case SH_type_l2_32_shadow:
         SHADOW_INTERNAL_NAME(sh_clear_shadow_entry, 2)(d, vaddr, pmfn);
@@ -2139,6 +2154,7 @@ static int sh_remove_shadow_via_pointer(struct domain *d, mfn_t smfn)
     case SH_type_l2_pae_shadow:
         SHADOW_INTERNAL_NAME(sh_clear_shadow_entry, 3)(d, vaddr, pmfn);
         break;
+#endif
     case SH_type_l1_64_shadow:
     case SH_type_l2_64_shadow:
     case SH_type_l2h_64_shadow:
@@ -2175,12 +2191,14 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
      * be called with the function to remove a lower-level shadow. */
     static const hash_domain_callback_t callbacks[SH_type_unused] = {
         NULL, /* none    */
+#ifdef CONFIG_HVM
         NULL, /* l1_32   */
         NULL, /* fl1_32  */
         SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 2), /* l2_32   */
         NULL, /* l1_pae  */
         NULL, /* fl1_pae */
         SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 3), /* l2_pae  */
+#endif
         NULL, /* l1_64   */
         NULL, /* fl1_64  */
         SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 4), /* l2_64   */
@@ -2194,12 +2212,14 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
     /* Another lookup table, for choosing which mask to use */
     static const unsigned int masks[SH_type_unused] = {
         0, /* none    */
+#ifdef CONFIG_HVM
         SHF_L2_32, /* l1_32   */
         0, /* fl1_32  */
         0, /* l2_32   */
         SHF_L2_PAE, /* l1_pae  */
         0, /* fl1_pae */
         0, /* l2_pae  */
+#endif
         SHF_L2H_64 | SHF_L2_64, /* l1_64   */
         0, /* fl1_64  */
         SHF_L3_64, /* l2_64   */
@@ -2338,12 +2358,14 @@ void sh_reset_l3_up_pointers(struct vcpu *v)
 {
     static const hash_vcpu_callback_t callbacks[SH_type_unused] = {
         NULL, /* none    */
+#ifdef CONFIG_HVM
         NULL, /* l1_32   */
         NULL, /* fl1_32  */
         NULL, /* l2_32   */
         NULL, /* l1_pae  */
         NULL, /* fl1_pae */
         NULL, /* l2_pae  */
+#endif
         NULL, /* l1_64   */
         NULL, /* fl1_64  */
         NULL, /* l2_64   */
@@ -3362,12 +3384,14 @@ void shadow_audit_tables(struct vcpu *v)
     static const hash_vcpu_callback_t callbacks[SH_type_unused] = {
         NULL, /* none    */
 #if SHADOW_AUDIT & (SHADOW_AUDIT_ENTRIES | SHADOW_AUDIT_ENTRIES_FULL)
+# ifdef CONFIG_HVM
         SHADOW_INTERNAL_NAME(sh_audit_l1_table, 2),  /* l1_32   */
         SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 2), /* fl1_32  */
         SHADOW_INTERNAL_NAME(sh_audit_l2_table, 2),  /* l2_32   */
         SHADOW_INTERNAL_NAME(sh_audit_l1_table, 3),  /* l1_pae  */
         SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 3), /* fl1_pae */
         SHADOW_INTERNAL_NAME(sh_audit_l2_table, 3),  /* l2_pae  */
+# endif
         SHADOW_INTERNAL_NAME(sh_audit_l1_table, 4),  /* l1_64   */
         SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 4), /* fl1_64  */
         SHADOW_INTERNAL_NAME(sh_audit_l2_table, 4),  /* l2_64   */
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 5b899399b6..35efb1b984 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -171,6 +171,7 @@ extern void shadow_audit_tables(struct vcpu *v);
 /* Shadow type codes */
 #define SH_type_none           (0U) /* on the shadow free list */
 #define SH_type_min_shadow     (1U)
+#ifdef CONFIG_HVM
 #define SH_type_l1_32_shadow   (1U) /* shadowing a 32-bit L1 guest page */
 #define SH_type_fl1_32_shadow  (2U) /* L1 shadow for a 32b 4M superpage */
 #define SH_type_l2_32_shadow   (3U) /* shadowing a 32-bit L2 guest page */
@@ -188,6 +189,25 @@ extern void shadow_audit_tables(struct vcpu *v);
 #define SH_type_monitor_table (14U) /* in use as a monitor table */
 #define SH_type_oos_snapshot  (15U) /* in use as OOS snapshot */
 #define SH_type_unused        (16U)
+#else
+#define SH_type_l1_32_shadow   SH_type_unused
+#define SH_type_fl1_32_shadow  SH_type_unused
+#define SH_type_l2_32_shadow   SH_type_unused
+#define SH_type_l1_pae_shadow  SH_type_unused
+#define SH_type_fl1_pae_shadow SH_type_unused
+#define SH_type_l2_pae_shadow  SH_type_unused
+#define SH_type_l1_64_shadow   1U /* shadowing a 64-bit L1 page */
+#define SH_type_fl1_64_shadow  2U /* L1 shadow for 64-bit 2M superpg */
+#define SH_type_l2_64_shadow   3U /* shadowing a 64-bit L2 page */
+#define SH_type_l2h_64_shadow  4U /* shadowing a compat PAE L2 high page */
+#define SH_type_l3_64_shadow   5U /* shadowing a 64-bit L3 page */
+#define SH_type_l4_64_shadow   6U /* shadowing a 64-bit L4 page */
+#define SH_type_max_shadow     6U
+#define SH_type_p2m_table      7U /* in use as the p2m table */
+#define SH_type_monitor_table  8U /* in use as a monitor table */
+#define SH_type_oos_snapshot   9U /* in use as OOS snapshot */
+#define SH_type_unused        10U
+#endif
 
 /*
  * What counts as a pinnable shadow?
@@ -248,12 +268,21 @@ static inline void sh_terminate_list(struct page_list_head *tmp_list)
     (((1u << (SH_type_max_shadow + 1u)) - 1u) - \
      ((1u << SH_type_min_shadow) - 1u))
 
+#ifdef CONFIG_HVM
 #define SHF_L1_32   (1u << SH_type_l1_32_shadow)
 #define SHF_FL1_32  (1u << SH_type_fl1_32_shadow)
 #define SHF_L2_32   (1u << SH_type_l2_32_shadow)
 #define SHF_L1_PAE  (1u << SH_type_l1_pae_shadow)
 #define SHF_FL1_PAE (1u << SH_type_fl1_pae_shadow)
 #define SHF_L2_PAE  (1u << SH_type_l2_pae_shadow)
+#else
+#define SHF_L1_32   0
+#define SHF_FL1_32  0
+#define SHF_L2_32   0
+#define SHF_L1_PAE  0
+#define SHF_FL1_PAE 0
+#define SHF_L2_PAE  0
+#endif
 #define SHF_L1_64   (1u << SH_type_l1_64_shadow)
 #define SHF_FL1_64  (1u << SH_type_fl1_64_shadow)
 #define SHF_L2_64   (1u << SH_type_l2_64_shadow)
@@ -329,8 +358,13 @@ extern const u8 sh_type_to_size[SH_type_unused];
 static inline unsigned int
 shadow_size(unsigned int shadow_type)
 {
+#ifdef CONFIG_HVM
     ASSERT(shadow_type < ARRAY_SIZE(sh_type_to_size));
     return sh_type_to_size[shadow_type];
+#else
+    ASSERT(shadow_type < SH_type_unused);
+    return 1;
+#endif
 }
 
 /******************************************************************************
@@ -488,8 +522,10 @@ static inline unsigned long __backpointer(const struct page_info *sp)
 {
     switch (sp->u.sh.type)
     {
+#ifdef CONFIG_HVM
     case SH_type_fl1_32_shadow:
     case SH_type_fl1_pae_shadow:
+#endif
     case SH_type_fl1_64_shadow:
         return sp->v.sh.back;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 12 10:45:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Apr 2021 10:45:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.108944.207898 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu4n-0007xp-Nq; Mon, 12 Apr 2021 10:45:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 108944.207898; Mon, 12 Apr 2021 10:45:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lVu4n-0007xh-Jx; Mon, 12 Apr 2021 10:45:53 +0000
Received: by outflank-mailman (input) for mailman id 108944;
 Mon, 12 Apr 2021 10:45:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu4m-0007xU-1L
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:45:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu4m-0002zy-0W
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:45:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lVu4l-0005Bz-V5
 for xen-changelog@lists.xenproject.org; Mon, 12 Apr 2021 10:45:51 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hJ//GnMjTWUj0RCvCDBveJtOO7MT3b0u4Fj8yL2t8HM=; b=ZUm8dc6M3qoiSx5ooAE3x7X646
	pIShbCE5E6YoQYy3dx8sMrDBYiR1gSgk0YDefoM7CsRjh3s+CLuULAAdlPr0knAEPgzALYfDce6gs
	DtHl/sexyejSk8Nz38nIcwijHz8V1xC3jebpkvl0TDpvK/VjZiouo0pdvX+yasbWBH+o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: adjust is_pv_*() checks
Message-Id: <E1lVu4l-0005Bz-V5@xenbits.xenproject.org>
Date: Mon, 12 Apr 2021 10:45:51 +0000

commit be167ac0f0268074880b961c936519f756ac045b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:37:19 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:37:19 2021 +0200

    x86/shadow: adjust is_pv_*() checks
    
    To cover for "x86: correct is_pv_domain() when !CONFIG_PV" (or any other
    change along those lines) we should prefer is_hvm_*(), as it may become
    a build time constant while is_pv_*() generally won't.
    
    Also when a domain pointer is in scope, prefer is_*_domain() over
    is_*_vcpu().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c |  4 ++--
 xen/arch/x86/mm/shadow/multi.c  | 10 +++++-----
 xen/arch/x86/mm/shadow/none.c   |  2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index c0c4ce46e4..b99ca14e71 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -674,7 +674,7 @@ int sh_unsync(struct vcpu *v, mfn_t gmfn)
     if ( pg->shadow_flags &
          ((SHF_page_type_mask & ~SHF_L1_ANY) | SHF_out_of_sync)
          || sh_page_has_multiple_shadows(pg)
-         || is_pv_vcpu(v)
+         || !is_hvm_vcpu(v)
          || !v->domain->arch.paging.shadow.oos_active )
         return 0;
 
@@ -2432,7 +2432,7 @@ static void sh_update_paging_modes(struct vcpu *v)
         v->arch.paging.mode->shadow.detach_old_tables(v);
 
 #ifdef CONFIG_HVM
-    if ( !is_pv_domain(d) )
+    if ( is_hvm_domain(d) )
     {
         const struct paging_mode *old_mode = v->arch.paging.mode;
 
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 5e33f6d3db..ae65da439f 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -667,8 +667,8 @@ _sh_propagate(struct vcpu *v,
     // PV guests in 64-bit mode use two different page tables for user vs
     // supervisor permissions, making the guest's _PAGE_USER bit irrelevant.
     // It is always shadowed as present...
-    if ( (GUEST_PAGING_LEVELS == 4) && !is_pv_32bit_domain(d)
-         && is_pv_domain(d) )
+    if ( (GUEST_PAGING_LEVELS == 4) && !is_hvm_domain(d) &&
+         !is_pv_32bit_domain(d) )
     {
         sflags |= _PAGE_USER;
     }
@@ -1120,7 +1120,7 @@ static shadow_l2e_t * shadow_get_and_create_l2e(struct vcpu *v,
         unsigned int t = SH_type_l2_shadow;
 
         /* Tag compat L2 containing hypervisor (m2p) mappings */
-        if ( is_pv_32bit_vcpu(v) &&
+        if ( is_pv_32bit_domain(d) &&
              guest_l4_table_offset(gw->va) == 0 &&
              guest_l3_table_offset(gw->va) == 3 )
             t = SH_type_l2h_shadow;
@@ -2314,7 +2314,7 @@ static int sh_page_fault(struct vcpu *v,
         return 0;
     }
 
-    cpl = is_pv_vcpu(v) ? (regs->ss & 3) : hvm_get_cpl(v);
+    cpl = is_hvm_domain(d) ? hvm_get_cpl(v) : (regs->ss & 3);
 
  rewalk:
 
@@ -3237,7 +3237,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 #endif
 
     /* Don't do anything on an uninitialised vcpu */
-    if ( is_pv_domain(d) && !v->is_initialised )
+    if ( !is_hvm_domain(d) && !v->is_initialised )
     {
         ASSERT(v->arch.cr3 == 0);
         return;
diff --git a/xen/arch/x86/mm/shadow/none.c b/xen/arch/x86/mm/shadow/none.c
index 691269a59e..67745074c4 100644
--- a/xen/arch/x86/mm/shadow/none.c
+++ b/xen/arch/x86/mm/shadow/none.c
@@ -27,7 +27,7 @@ int shadow_domain_init(struct domain *d)
     };
 
     paging_log_dirty_init(d, &sh_none_ops);
-    return is_pv_domain(d) ? 0 : -EOPNOTSUPP;
+    return is_hvm_domain(d) ? -EOPNOTSUPP : 0;
 }
 
 static int _page_fault(struct vcpu *v, unsigned long va,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 13 02:33:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Apr 2021 02:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.109482.208968 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lW8rP-0006Gf-Jf; Tue, 13 Apr 2021 02:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 109482.208968; Tue, 13 Apr 2021 02: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 1lW8rP-0006GX-Gs; Tue, 13 Apr 2021 02:33:03 +0000
Received: by outflank-mailman (input) for mailman id 109482;
 Tue, 13 Apr 2021 02: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 1lW8rN-0006GS-Vn
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 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 1lW8rN-0000RW-Ux
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 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 1lW8rN-0008TK-SE
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 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=gg1cUJ5yWFeVs48gQBEKgLKcTjmjdKx4B2vligLDUjs=; b=vwFbRNZg4WGsEr49TmgIJBn3aG
	GFA07ZAK3ZlsRr+pMGN72DewvhP/U7J6z53oeoQOa5SjlMzwlgf/SipGJbEhJJ9FdyZfdzRntKFvw
	Lksx36sg551zUcNyZYV6/mC1W+5mvMB9s0hkQhFQekaAsOwavRU5q0GiRLmkENQ/oWSw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] MAINTAINERS: Belatedly update for this being a stable branch
Message-Id: <E1lW8rN-0008TK-SE@xenbits.xenproject.org>
Date: Tue, 13 Apr 2021 02:33:01 +0000

commit 1ebc077a5608bd8eff7e6401696f16c9a266b73f
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Mon Apr 12 11:13:15 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Apr 12 11:13:15 2021 +0100

    MAINTAINERS: Belatedly update for this being a stable branch
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 MAINTAINERS | 92 ++++++-------------------------------------------------------
 1 file changed, 9 insertions(+), 83 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index e374816755..4b72a6adae 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -54,6 +54,15 @@ list. Remember to copy the appropriate stable branch maintainer who
 will be listed in this section of the MAINTAINERS file in the
 appropriate branch.
 
+The maintainer for this branch is:
+
+	Jan Beulich <jbeulich@suse.com>
+
+Tools backport requests should also be copied to:
+
+	Ian Jackson <Ian.Jackson@eu.citrix.com>
+
+
 	Unstable Subsystem Maintainers
 	==============================
 
@@ -104,89 +113,6 @@ Descriptions of section entries:
 	   xen-maintainers-<version format number of this file>
 
 
-	Check-in policy
-	===============
-
-In order for a patch to be checked in, in general, several conditions
-must be met:
-
-1. In order to get a change to a given file committed, it must have
-   the approval of at least one maintainer of that file.
-
-   A patch of course needs Acks from the maintainers of each file that
-   it changes; so a patch which changes xen/arch/x86/traps.c,
-   xen/arch/x86/mm/p2m.c, and xen/arch/x86/mm/shadow/multi.c would
-   require an Ack from each of the three sets of maintainers.
-
-   See below for rules on nested maintainership.
-
-2. It must have appropriate approval from someone other than the
-   submitter.  This can be either:
-
-  a. An Acked-by from a maintainer of the code being touched (a
-     co-maintainer if available, or a more general level maintainer if
-     not available; see the secton on nested maintainership)
-
-  b. A Reviewed-by by anyone of suitable stature in the community
-
-3. Sufficient time must have been given for anyone to respond.  This
-   depends in large part upon the urgency and nature of the patch.
-   For a straightforward uncontroversial patch, a day or two may be
-   sufficient; for a controversial patch, a week or two may be better.
-
-4. There must be no "open" objections.
-
-In a case where one person submits a patch and a maintainer gives an
-Ack, the Ack stands in for both the approval requirement (#1) and the
-Acked-by-non-submitter requirement (#2).
-
-In a case where a maintainer themselves submits a patch, the
-Signed-off-by meets the approval requirement (#1); so a Review
-from anyone in the community suffices for requirement #2.
-
-Before a maintainer checks in their own patch with another community
-member's R-b but no co-maintainer Ack, it is especially important to
-give their co-maintainer opportunity to give feedback, perhaps
-declaring their intention to check it in without their co-maintainers
-ack a day before doing so.
-
-Maintainers may choose to override non-maintainer objections in the
-case that consensus can't be reached.
-
-As always, no policy can cover all possible situations.  In
-exceptional circumstances, committers may commit a patch in absence of
-one or more of the above requirements, if they are reasonably
-confident that the other maintainers will approve of their decision in
-retrospect.
-
-       The meaning of nesting
-       ======================
-
-Many maintainership areas are "nested": for example, there are entries
-for xen/arch/x86 as well as xen/arch/x86/mm, and even
-xen/arch/x86/mm/shadow; and there is a section at the end called "THE
-REST" which lists all committers.  The meaning of nesting is that:
-
-1. Under normal circumstances, the Ack of the most specific maintainer
-is both necessary and sufficient to get a change to a given file
-committed.  So a change to xen/arch/x86/mm/shadow/multi.c requires the
-the Ack of the xen/arch/x86/mm/shadow maintainer for that part of the
-patch, but would not require the Ack of the xen/arch/x86 maintainer or
-the xen/arch/x86/mm maintainer.
-
-2. In unusual circumstances, a more general maintainer's Ack can stand
-in for or even overrule a specific maintainer's Ack.  Unusual
-circumstances might include:
- - The patch is fixing a high-priority issue causing immediate pain,
- and the more specific maintainer is not available.
- - The more specific maintainer has not responded either to the
- original patch, nor to "pings", within a reasonable amount of time.
- - The more general maintainer wants to overrule the more specific
- maintainer on some issue. (This should be exceptional.)
- - In the case of a disagreement between maintainers, THE REST can
- settle the matter by majority vote.  (This should be very exceptional
- indeed.)
-
 
 Maintainers List (try to look for most precise areas first)
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Apr 13 05:11:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Apr 2021 05:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.109511.209029 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWBKJ-00047t-Tv; Tue, 13 Apr 2021 05:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 109511.209029; Tue, 13 Apr 2021 05: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 1lWBKJ-00047l-R7; Tue, 13 Apr 2021 05:11:03 +0000
Received: by outflank-mailman (input) for mailman id 109511;
 Tue, 13 Apr 2021 05: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 1lWBKI-00047g-6X
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 05: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 1lWBKI-0003Wi-5f
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 05:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWBKI-00046h-2h
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 05: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=kdEo3BxuuaVAeZjxuSf2+BheVv0UH0yhjRZhdUVhI7s=; b=LgMFxtIoV4FVMUX3aATXdj0RDh
	gYq8n5uNEoKIld7WldT8DKwzW1TyWrLqeernhjzsfkjbmNT7hHTOfY6CtgU/nVaV0a1KovhfmJ4Sf
	viUP3awr8k3qxlzR40GljZvd8yfntGJVy+1Cp+PvpDUs39labXM53ZUqfmwUjBti1iEI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] post 4.15: Updaate version
Message-Id: <E1lWBKI-00046h-2h@xenbits.xenproject.org>
Date: Tue, 13 Apr 2021 05:11:02 +0000

commit e72bf725eb040d862d190357a78f245c2c11220d
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Mon Apr 12 11:06:44 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Apr 12 11:06:44 2021 +0100

    post 4.15: Updaate 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 acb2d28891..d4a7014f59 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 15
-export XEN_EXTRAVERSION ?= .0$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .1-pre$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 13 05:11:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Apr 2021 05:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.109512.209033 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWBKS-00048k-VT; Tue, 13 Apr 2021 05:11:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 109512.209033; Tue, 13 Apr 2021 05: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 1lWBKS-00048c-SZ; Tue, 13 Apr 2021 05:11:12 +0000
Received: by outflank-mailman (input) for mailman id 109512;
 Tue, 13 Apr 2021 05: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 1lWBKS-00048W-A4
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 05: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 1lWBKS-0003Xa-9H
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 05:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWBKS-00047B-8B
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 05: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=syCGZVtij4Ryc8Zz57kWovOtdSuVLAghtdAjUgJj64w=; b=jCNBIypLAYuV9zLiAI8bVmbNWP
	9EkVOmEJVIKNvC07GaaT2Evo2BMdL082y291ZE2RXFpJxWLJ226bdo+Cac3lLZHVj2/S/a66r8buM
	9gbz5UaGKS6zTmRzsfdgyYSo113Pw5hvKFpck4SLXDAcl687tRDUDiRyG6eutLh4TSmY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] MAINTAINERS: Add stable information, remove checkin policy
Message-Id: <E1lWBKS-00047B-8B@xenbits.xenproject.org>
Date: Tue, 13 Apr 2021 05:11:12 +0000

commit c86d8ec3b816cc1317d9cc2fb0817e59b5bc4cfa
Author:     Ian Jackson <iwj@xenproject.org>
AuthorDate: Mon Apr 12 11:09:22 2021 +0100
Commit:     Ian Jackson <iwj@xenproject.org>
CommitDate: Mon Apr 12 11:09:22 2021 +0100

    MAINTAINERS: Add stable information, remove checkin policy
    
    As per release-technician-checklist.txt, somewhat ad-hoc.
    
    Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 MAINTAINERS | 92 ++++++-------------------------------------------------------
 1 file changed, 9 insertions(+), 83 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 6a7fa8717e..85f660c30f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -54,6 +54,15 @@ list. Remember to copy the appropriate stable branch maintainer who
 will be listed in this section of the MAINTAINERS file in the
 appropriate branch.
 
+The maintainer for this branch is:
+
+	Jan Beulich <jbeulich@suse.com>
+
+Tools backport requests should also be copied to:
+
+	Ian Jackson <Ian.Jackson@eu.citrix.com>
+
+
 	Unstable Subsystem Maintainers
 	==============================
 
@@ -104,89 +113,6 @@ Descriptions of section entries:
 	   xen-maintainers-<version format number of this file>
 
 
-	Check-in policy
-	===============
-
-In order for a patch to be checked in, in general, several conditions
-must be met:
-
-1. In order to get a change to a given file committed, it must have
-   the approval of at least one maintainer of that file.
-
-   A patch of course needs Acks from the maintainers of each file that
-   it changes; so a patch which changes xen/arch/x86/traps.c,
-   xen/arch/x86/mm/p2m.c, and xen/arch/x86/mm/shadow/multi.c would
-   require an Ack from each of the three sets of maintainers.
-
-   See below for rules on nested maintainership.
-
-2. It must have appropriate approval from someone other than the
-   submitter.  This can be either:
-
-  a. An Acked-by from a maintainer of the code being touched (a
-     co-maintainer if available, or a more general level maintainer if
-     not available; see the secton on nested maintainership)
-
-  b. A Reviewed-by by anyone of suitable stature in the community
-
-3. Sufficient time must have been given for anyone to respond.  This
-   depends in large part upon the urgency and nature of the patch.
-   For a straightforward uncontroversial patch, a day or two may be
-   sufficient; for a controversial patch, a week or two may be better.
-
-4. There must be no "open" objections.
-
-In a case where one person submits a patch and a maintainer gives an
-Ack, the Ack stands in for both the approval requirement (#1) and the
-Acked-by-non-submitter requirement (#2).
-
-In a case where a maintainer themselves submits a patch, the
-Signed-off-by meets the approval requirement (#1); so a Review
-from anyone in the community suffices for requirement #2.
-
-Before a maintainer checks in their own patch with another community
-member's R-b but no co-maintainer Ack, it is especially important to
-give their co-maintainer opportunity to give feedback, perhaps
-declaring their intention to check it in without their co-maintainers
-ack a day before doing so.
-
-Maintainers may choose to override non-maintainer objections in the
-case that consensus can't be reached.
-
-As always, no policy can cover all possible situations.  In
-exceptional circumstances, committers may commit a patch in absence of
-one or more of the above requirements, if they are reasonably
-confident that the other maintainers will approve of their decision in
-retrospect.
-
-       The meaning of nesting
-       ======================
-
-Many maintainership areas are "nested": for example, there are entries
-for xen/arch/x86 as well as xen/arch/x86/mm, and even
-xen/arch/x86/mm/shadow; and there is a section at the end called "THE
-REST" which lists all committers.  The meaning of nesting is that:
-
-1. Under normal circumstances, the Ack of the most specific maintainer
-is both necessary and sufficient to get a change to a given file
-committed.  So a change to xen/arch/x86/mm/shadow/multi.c requires the
-the Ack of the xen/arch/x86/mm/shadow maintainer for that part of the
-patch, but would not require the Ack of the xen/arch/x86 maintainer or
-the xen/arch/x86/mm maintainer.
-
-2. In unusual circumstances, a more general maintainer's Ack can stand
-in for or even overrule a specific maintainer's Ack.  Unusual
-circumstances might include:
- - The patch is fixing a high-priority issue causing immediate pain,
- and the more specific maintainer is not available.
- - The more specific maintainer has not responded either to the
- original patch, nor to "pings", within a reasonable amount of time.
- - The more general maintainer wants to overrule the more specific
- maintainer on some issue. (This should be exceptional.)
- - In the case of a disagreement between maintainers, THE REST can
- settle the matter by majority vote.  (This should be very exceptional
- indeed.)
-
 
 Maintainers List (try to look for most precise areas first)
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 13 08:22:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Apr 2021 08:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.109579.209157 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWEJB-0006AS-V7; Tue, 13 Apr 2021 08:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 109579.209157; Tue, 13 Apr 2021 08: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 1lWEJB-0006AK-SB; Tue, 13 Apr 2021 08:22:05 +0000
Received: by outflank-mailman (input) for mailman id 109579;
 Tue, 13 Apr 2021 08: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 1lWEJB-0006AF-71
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08: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 1lWEJB-0007FW-2g
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWEJA-0002nq-Vz
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08: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=zOjWc00dM13JKDW0wThXEFKuL57mGDJA4tNVEYDhA+U=; b=B2FZNVy7IgsvbfBdD4ZLNk4RCe
	1BptLDh69O4tnlr2ZAv+S4o/r4IrpW66PLuTaDEJ0HCkeDSWWt5T83Q2VUA9Mymx7IbGQwmrkW/Nh
	f8G1syaUl8Qr3izg+yfatnp2S4M1cvqrofgO4Npz+/mh2naf+9HgPWP7CgNqRCqU9Ljg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: improve save/restore of registers across S3
Message-Id: <E1lWEJA-0002nq-Vz@xenbits.xenproject.org>
Date: Tue, 13 Apr 2021 08:22:04 +0000

commit 27713fa2aa2166407bb962e80a39480f7ca5cee2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 13 10:14:23 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 13 10:14:23 2021 +0200

    VT-d: improve save/restore of registers across S3
    
    The static allocation of the save space is not only very inefficient
    (most of the array slots won't ever get used), but is also the sole
    reason for a build-time upper bound on the number of IOMMUs. Introduce
    a structure containing just the one needed field we can't (easily)
    restore from other in-memory state, and allocate the respective
    array dynamically.
    
    Take the opportunity and make the FEUADDR write dependent upon
    x2apic_enabled, like is already the case in dma_msi_set_affinity().
    
    Also alter properties of nr_iommus: static, unsigned, and __initdata.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 46 +++++++++++++++----------------------
 xen/drivers/passthrough/vtd/iommu.h |  2 --
 xen/include/asm-x86/iommu.h         |  1 -
 3 files changed, 19 insertions(+), 30 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 6428c8fe3e..10c71132db 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -57,7 +57,7 @@ bool __read_mostly iommu_qinval = true;
 bool __read_mostly iommu_snoop = true;
 #endif
 
-int nr_iommus;
+static unsigned int __initdata nr_iommus;
 
 static struct iommu_ops vtd_ops;
 static struct tasklet vtd_fault_tasklet;
@@ -1165,13 +1165,6 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
     unsigned long sagaw, nr_dom;
     int agaw;
 
-    if ( nr_iommus >= MAX_IOMMUS )
-    {
-        dprintk(XENLOG_ERR VTDPREFIX,
-                "IOMMU: nr_iommus %d > MAX_IOMMUS\n", nr_iommus + 1);
-        return -ENOMEM;
-    }
-
     iommu = xzalloc(struct vtd_iommu);
     if ( iommu == NULL )
         return -ENOMEM;
@@ -2226,6 +2219,10 @@ static void __hwdom_init setup_hwdom_rmrr(struct domain *d)
     pcidevs_unlock();
 }
 
+static struct iommu_state {
+    uint32_t fectl;
+} *__read_mostly iommu_state;
+
 static int __init vtd_setup(void)
 {
     struct acpi_drhd_unit *drhd;
@@ -2251,6 +2248,13 @@ static int __init vtd_setup(void)
         goto error;
     }
 
+    iommu_state = xmalloc_array(struct iommu_state, nr_iommus);
+    if ( !iommu_state )
+    {
+        ret = -ENOMEM;
+        goto error;
+    }
+
     /* We enable the following features only if they are supported by all VT-d
      * engines: Snoop Control, DMA passthrough, Queued Invalidation, Interrupt
      * Remapping, and Posted Interrupt
@@ -2508,8 +2512,6 @@ static int intel_iommu_group_id(u16 seg, u8 bus, u8 devfn)
         return PCI_BDF2(bus, devfn);
 }
 
-static u32 iommu_state[MAX_IOMMUS][MAX_IOMMU_REGS];
-
 static int __must_check vtd_suspend(void)
 {
     struct acpi_drhd_unit *drhd;
@@ -2534,14 +2536,7 @@ static int __must_check vtd_suspend(void)
         iommu = drhd->iommu;
         i = iommu->index;
 
-        iommu_state[i][DMAR_FECTL_REG] =
-            (u32) dmar_readl(iommu->reg, DMAR_FECTL_REG);
-        iommu_state[i][DMAR_FEDATA_REG] =
-            (u32) dmar_readl(iommu->reg, DMAR_FEDATA_REG);
-        iommu_state[i][DMAR_FEADDR_REG] =
-            (u32) dmar_readl(iommu->reg, DMAR_FEADDR_REG);
-        iommu_state[i][DMAR_FEUADDR_REG] =
-            (u32) dmar_readl(iommu->reg, DMAR_FEUADDR_REG);
+        iommu_state[i].fectl = dmar_readl(iommu->reg, DMAR_FECTL_REG);
 
         /* don't disable VT-d engine when force_iommu is set. */
         if ( force_iommu )
@@ -2594,15 +2589,13 @@ static void vtd_resume(void)
     for_each_drhd_unit ( drhd )
     {
         iommu = drhd->iommu;
-        i = iommu->index;
 
         spin_lock_irqsave(&iommu->register_lock, flags);
-        dmar_writel(iommu->reg, DMAR_FEDATA_REG,
-                    iommu_state[i][DMAR_FEDATA_REG]);
-        dmar_writel(iommu->reg, DMAR_FEADDR_REG,
-                    iommu_state[i][DMAR_FEADDR_REG]);
-        dmar_writel(iommu->reg, DMAR_FEUADDR_REG,
-                    iommu_state[i][DMAR_FEUADDR_REG]);
+        dmar_writel(iommu->reg, DMAR_FEDATA_REG, iommu->msi.msg.data);
+        dmar_writel(iommu->reg, DMAR_FEADDR_REG, iommu->msi.msg.address_lo);
+        if ( x2apic_enabled )
+            dmar_writel(iommu->reg, DMAR_FEUADDR_REG,
+                        iommu->msi.msg.address_hi);
         spin_unlock_irqrestore(&iommu->register_lock, flags);
     }
 
@@ -2615,8 +2608,7 @@ static void vtd_resume(void)
         i = iommu->index;
 
         spin_lock_irqsave(&iommu->register_lock, flags);
-        dmar_writel(iommu->reg, DMAR_FECTL_REG,
-                    (u32) iommu_state[i][DMAR_FECTL_REG]);
+        dmar_writel(iommu->reg, DMAR_FECTL_REG, iommu_state[i].fectl);
         spin_unlock_irqrestore(&iommu->register_lock, flags);
 
         iommu_enable_translation(drhd);
diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h
index 216791b3d6..6f41068c09 100644
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -499,8 +499,6 @@ struct qinval_entry {
 #define VTD_PAGE_TABLE_LEVEL_3  3
 #define VTD_PAGE_TABLE_LEVEL_4  4
 
-#define MAX_IOMMU_REGS 0xc0
-
 extern struct list_head acpi_drhd_units;
 extern struct list_head acpi_rmrr_units;
 extern struct list_head acpi_ioapic_units;
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 970eb06ffa..65a0b02f60 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -22,7 +22,6 @@
 #include <asm/hvm/vmx/vmcs.h>
 
 #define DEFAULT_DOMAIN_ADDRESS_WIDTH 48
-#define MAX_IOMMUS 32
 
 struct g2m_ioport {
     struct list_head list;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 13 08:22:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Apr 2021 08:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.109580.209160 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWEJM-0006BF-0F; Tue, 13 Apr 2021 08:22:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 109580.209160; Tue, 13 Apr 2021 08: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 1lWEJL-0006B7-Te; Tue, 13 Apr 2021 08:22:15 +0000
Received: by outflank-mailman (input) for mailman id 109580;
 Tue, 13 Apr 2021 08: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 1lWEJL-0006B1-7p
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08: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 1lWEJL-0007FZ-6q
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWEJL-0002ob-59
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08: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=w08N1yXD6KERA3WKqoroiFTO3ctT28K5W5ro7USFL6c=; b=n9RWIdjT3JJfsosm65YZHHAuek
	/lhndTnXQXdHWG5drZ+gnW9FGBkyfqxa0dwzT40ewqKs04RPWRJPK0AaOO/891j1gKPJi9mvzpG7d
	Vch1oH8gavfs5xM7Ffq0CDNlpX+2FwxmBgkrLhlj8yGZ87jvFg8sVtIUVms0aj7I8jcM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: don't open-code dmar_readl()
Message-Id: <E1lWEJL-0002ob-59@xenbits.xenproject.org>
Date: Tue, 13 Apr 2021 08:22:15 +0000

commit 1ea7f6353405a59fea8d11f2ec1ca08ba3b299d0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 13 10:15:08 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 13 10:15:08 2021 +0200

    VT-d: don't open-code dmar_readl()
    
    While at it also drop the unnecessary use of a local variable there.
    
    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, 1 insertion(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 10c71132db..b2ca152e1f 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -990,8 +990,7 @@ static void __do_iommu_page_fault(struct vtd_iommu *iommu)
     }
 clear_overflow:
     /* clear primary fault overflow */
-    fault_status = readl(iommu->reg + DMAR_FSTS_REG);
-    if ( fault_status & DMA_FSTS_PFO )
+    if ( dmar_readl(iommu->reg, DMAR_FSTS_REG) & DMA_FSTS_PFO )
     {
         spin_lock_irqsave(&iommu->register_lock, flags);
         dmar_writel(iommu->reg, DMAR_FSTS_REG, DMA_FSTS_PFO);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 13 08:22:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Apr 2021 08:22:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.109581.209164 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWEJW-0006Ca-1j; Tue, 13 Apr 2021 08:22:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 109581.209164; Tue, 13 Apr 2021 08: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 1lWEJV-0006CS-V9; Tue, 13 Apr 2021 08:22:25 +0000
Received: by outflank-mailman (input) for mailman id 109581;
 Tue, 13 Apr 2021 08: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 1lWEJV-0006CJ-Aw
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08: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 1lWEJV-0007Fh-9v
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08:22:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWEJV-0002pK-9B
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08: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=jYLwXIHUKy7x5fBGHfJN330PiQT5sDOyBlNIQyGh128=; b=vhAsD9gypZiOIyEJ5Ts3WCaF4+
	lPZJzWcYXNe9s5r9ywP95j1KC9FJz8vBFo7h9ZrD66k9qnph0eos9x3UJH8xHrp1OUc4f+D7iCrWE
	AqBLhhNX62TAKdkb+Ifz+VXvswjWDEX5l90HN+IA7n2UfWxnvKMnge8+EaO7kL8BZ/G4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: bring print_qi_regs() in line with print_iommu_regs()
Message-Id: <E1lWEJV-0002pK-9B@xenbits.xenproject.org>
Date: Tue, 13 Apr 2021 08:22:25 +0000

commit d8b05ce83fd17920752d608ab3a0ff31027472d1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 13 10:15:41 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 13 10:15:41 2021 +0200

    VT-d: bring print_qi_regs() in line with print_iommu_regs()
    
    Shorten the names printed. There's also no need to go through a local
    variable.
    
    While at it also constify the function's parameter.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/qinval.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c
index 764ef9f0fc..6100e778f3 100644
--- a/xen/drivers/passthrough/vtd/qinval.c
+++ b/xen/drivers/passthrough/vtd/qinval.c
@@ -33,18 +33,11 @@
 
 static int __must_check invalidate_sync(struct vtd_iommu *iommu);
 
-static void print_qi_regs(struct vtd_iommu *iommu)
+static void print_qi_regs(const struct vtd_iommu *iommu)
 {
-    u64 val;
-
-    val = dmar_readq(iommu->reg, DMAR_IQA_REG);
-    printk("DMAR_IQA_REG = %"PRIx64"\n", val);
-
-    val = dmar_readq(iommu->reg, DMAR_IQH_REG);
-    printk("DMAR_IQH_REG = %"PRIx64"\n", val);
-
-    val = dmar_readq(iommu->reg, DMAR_IQT_REG);
-    printk("DMAR_IQT_REG = %"PRIx64"\n", val);
+    printk(" IQA = %"PRIx64"\n", dmar_readq(iommu->reg, DMAR_IQA_REG));
+    printk(" IQH = %"PRIx64"\n", dmar_readq(iommu->reg, DMAR_IQH_REG));
+    printk(" IQT = %"PRIx64"\n", dmar_readq(iommu->reg, DMAR_IQT_REG));
 }
 
 static unsigned int qinval_next_index(struct vtd_iommu *iommu)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 13 08:22:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Apr 2021 08:22:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.109582.209169 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWEJg-0006EP-4q; Tue, 13 Apr 2021 08:22:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 109582.209169; Tue, 13 Apr 2021 08: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 1lWEJg-0006EH-1d; Tue, 13 Apr 2021 08:22:36 +0000
Received: by outflank-mailman (input) for mailman id 109582;
 Tue, 13 Apr 2021 08: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 1lWEJf-0006E9-EX
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08: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 1lWEJf-0007Ft-Dk
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08:22:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWEJf-0002q6-CJ
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08: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=ZNZcQdjYBlV3JMG28RCgVWV+m2X+3Zujcbqrt4Yb15k=; b=RwrUE8jgwwWtScBw7x5OIHneIB
	InJaqY8ZOczHNw4LsRR48aXI1/DL0/zkagzYeMoOprlmJJsAGxaq1Ixcp5EK3U4F/sWs1SHDB11UP
	705R0Ivk8ra9HV6ORjye0hPdcGJf65c8Nyxbhk067aOKogvly0Q2wiYmPY/IJFkekD5s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: qinval indexes are only up to 19 bits wide
Message-Id: <E1lWEJf-0002q6-CJ@xenbits.xenproject.org>
Date: Tue, 13 Apr 2021 08:22:35 +0000

commit 1b5d913fa0b3e4b9a8bba10c1db83082193bcc7a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 13 10:16:06 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 13 10:16:06 2021 +0200

    VT-d: qinval indexes are only up to 19 bits wide
    
    There's no need for 64-bit accesses to these registers (outside of
    initial setup and dumping).
    
    Also remove some stray blanks.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/qinval.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c
index 6100e778f3..c0ea19d4bd 100644
--- a/xen/drivers/passthrough/vtd/qinval.c
+++ b/xen/drivers/passthrough/vtd/qinval.c
@@ -42,14 +42,13 @@ static void print_qi_regs(const struct vtd_iommu *iommu)
 
 static unsigned int qinval_next_index(struct vtd_iommu *iommu)
 {
-    u64 tail;
+    unsigned int tail = dmar_readl(iommu->reg, DMAR_IQT_REG);
 
-    tail = dmar_readq(iommu->reg, DMAR_IQT_REG);
     tail >>= QINVAL_INDEX_SHIFT;
 
     /* (tail+1 == head) indicates a full queue, wait for HW */
-    while ( ( tail + 1 ) % QINVAL_ENTRY_NR ==
-            ( dmar_readq(iommu->reg, DMAR_IQH_REG) >> QINVAL_INDEX_SHIFT ) )
+    while ( (tail + 1) % QINVAL_ENTRY_NR ==
+            (dmar_readl(iommu->reg, DMAR_IQH_REG) >> QINVAL_INDEX_SHIFT) )
         cpu_relax();
 
     return tail;
@@ -57,12 +56,12 @@ static unsigned int qinval_next_index(struct vtd_iommu *iommu)
 
 static void qinval_update_qtail(struct vtd_iommu *iommu, unsigned int index)
 {
-    u64 val;
+    unsigned int val;
 
     /* Need hold register lock when update tail */
     ASSERT( spin_is_locked(&iommu->register_lock) );
     val = (index + 1) % QINVAL_ENTRY_NR;
-    dmar_writeq(iommu->reg, DMAR_IQT_REG, (val << QINVAL_INDEX_SHIFT));
+    dmar_writel(iommu->reg, DMAR_IQT_REG, val << QINVAL_INDEX_SHIFT);
 }
 
 static int __must_check queue_invalidate_context_sync(struct vtd_iommu *iommu,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 13 08:22:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Apr 2021 08:22:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.109583.209173 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWEJq-0006Fh-6L; Tue, 13 Apr 2021 08:22:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 109583.209173; Tue, 13 Apr 2021 08: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 1lWEJq-0006FZ-3M; Tue, 13 Apr 2021 08:22:46 +0000
Received: by outflank-mailman (input) for mailman id 109583;
 Tue, 13 Apr 2021 08: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 1lWEJp-0006FR-Hi
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08: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 1lWEJp-0007G0-Gs
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08:22:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWEJp-0002qz-Fy
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08: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=C+0UElfUjX1pvYZsC6JAC9cntq7VE2MfukjbBl7zdl4=; b=kPsaeY8wlFQSB0NGlGkU+Uielm
	l6dfq25jBgaVGUW6Ckfa5c+fgnf8BQtt5zEoVkmOzuiESij3xpzyRwR/ikrEYbU+UYqbK/wbvBkj+
	4xTnBGy5/2h/MVeptNxCXbPfS6jN9NMScUqviKSh99eDI+vQ3Dsa9WdHuTRYiPsnWD+c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: avoid pointless use of 64-bit constants
Message-Id: <E1lWEJp-0002qz-Fy@xenbits.xenproject.org>
Date: Tue, 13 Apr 2021 08:22:45 +0000

commit ab7625a05e8329a8c7a34f7942e8240aafbc9742
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 13 10:16:28 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 13 10:16:28 2021 +0200

    VT-d: avoid pointless use of 64-bit constants
    
    When the respective registers are just 32 bits wide there's no point in
    making corresponding constants 64-bit ones.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.h | 62 +++++++++++++++++++------------------
 1 file changed, 32 insertions(+), 30 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h
index 6f41068c09..6804e3d58c 100644
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -121,30 +121,30 @@
 #define DMA_TLB_IVA_HINT(x) ((((u64)x) & 1) << 6)
 
 /* GCMD_REG */
-#define DMA_GCMD_TE     (((u64)1) << 31)
-#define DMA_GCMD_SRTP   (((u64)1) << 30)
-#define DMA_GCMD_SFL    (((u64)1) << 29)
-#define DMA_GCMD_EAFL   (((u64)1) << 28)
-#define DMA_GCMD_WBF    (((u64)1) << 27)
-#define DMA_GCMD_QIE    (((u64)1) << 26)
-#define DMA_GCMD_IRE    (((u64)1) << 25)
-#define DMA_GCMD_SIRTP  (((u64)1) << 24)
-#define DMA_GCMD_CFI    (((u64)1) << 23)
+#define DMA_GCMD_TE     (1u << 31)
+#define DMA_GCMD_SRTP   (1u << 30)
+#define DMA_GCMD_SFL    (1u << 29)
+#define DMA_GCMD_EAFL   (1u << 28)
+#define DMA_GCMD_WBF    (1u << 27)
+#define DMA_GCMD_QIE    (1u << 26)
+#define DMA_GCMD_IRE    (1u << 25)
+#define DMA_GCMD_SIRTP  (1u << 24)
+#define DMA_GCMD_CFI    (1u << 23)
 
 /* GSTS_REG */
-#define DMA_GSTS_TES    (((u64)1) << 31)
-#define DMA_GSTS_RTPS   (((u64)1) << 30)
-#define DMA_GSTS_FLS    (((u64)1) << 29)
-#define DMA_GSTS_AFLS   (((u64)1) << 28)
-#define DMA_GSTS_WBFS   (((u64)1) << 27)
-#define DMA_GSTS_QIES   (((u64)1) <<26)
-#define DMA_GSTS_IRES   (((u64)1) <<25)
-#define DMA_GSTS_SIRTPS (((u64)1) << 24)
-#define DMA_GSTS_CFIS   (((u64)1) <<23)
+#define DMA_GSTS_TES    (1u << 31)
+#define DMA_GSTS_RTPS   (1u << 30)
+#define DMA_GSTS_FLS    (1u << 29)
+#define DMA_GSTS_AFLS   (1u << 28)
+#define DMA_GSTS_WBFS   (1u << 27)
+#define DMA_GSTS_QIES   (1u << 26)
+#define DMA_GSTS_IRES   (1u << 25)
+#define DMA_GSTS_SIRTPS (1u << 24)
+#define DMA_GSTS_CFIS   (1u << 23)
 
 /* PMEN_REG */
-#define DMA_PMEN_EPM    (((u32)1) << 31)
-#define DMA_PMEN_PRS    (((u32)1) << 0)
+#define DMA_PMEN_EPM    (1u << 31)
+#define DMA_PMEN_PRS    (1u <<  0)
 
 /* CCMD_REG */
 #define DMA_CCMD_INVL_GRANU_OFFSET  61
@@ -164,21 +164,23 @@
 #define DMA_CCMD_CAIG_MASK(x) (((u64)x) & ((u64) 0x3 << 59))
 
 /* FECTL_REG */
-#define DMA_FECTL_IM (((u64)1) << 31)
+#define DMA_FECTL_IM (1u << 31)
 
 /* FSTS_REG */
-#define DMA_FSTS_PFO ((u64)1 << 0)
-#define DMA_FSTS_PPF ((u64)1 << 1)
-#define DMA_FSTS_AFO ((u64)1 << 2)
-#define DMA_FSTS_APF ((u64)1 << 3)
-#define DMA_FSTS_IQE ((u64)1 << 4)
-#define DMA_FSTS_ICE ((u64)1 << 5)
-#define DMA_FSTS_ITE ((u64)1 << 6)
-#define DMA_FSTS_FAULTS    DMA_FSTS_PFO | DMA_FSTS_PPF | DMA_FSTS_AFO | DMA_FSTS_APF | DMA_FSTS_IQE | DMA_FSTS_ICE | DMA_FSTS_ITE
+#define DMA_FSTS_PFO (1u << 0)
+#define DMA_FSTS_PPF (1u << 1)
+#define DMA_FSTS_AFO (1u << 2)
+#define DMA_FSTS_APF (1u << 3)
+#define DMA_FSTS_IQE (1u << 4)
+#define DMA_FSTS_ICE (1u << 5)
+#define DMA_FSTS_ITE (1u << 6)
+#define DMA_FSTS_FAULTS (DMA_FSTS_PFO | DMA_FSTS_PPF | DMA_FSTS_AFO | \
+                         DMA_FSTS_APF | DMA_FSTS_IQE | DMA_FSTS_ICE | \
+                         DMA_FSTS_ITE)
 #define dma_fsts_fault_record_index(s) (((s) >> 8) & 0xff)
 
 /* FRCD_REG, 32 bits access */
-#define DMA_FRCD_F (((u64)1) << 31)
+#define DMA_FRCD_F (1u << 31)
 #define dma_frcd_type(d) ((d >> 30) & 1)
 #define dma_frcd_fault_reason(c) (c & 0xff)
 #define dma_frcd_source_id(c) (c & 0xffff)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 13 08:22:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Apr 2021 08:22:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.109584.209177 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWEK1-0006HD-85; Tue, 13 Apr 2021 08:22:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 109584.209177; Tue, 13 Apr 2021 08:22: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 1lWEK1-0006H4-4u; Tue, 13 Apr 2021 08:22:57 +0000
Received: by outflank-mailman (input) for mailman id 109584;
 Tue, 13 Apr 2021 08: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 1lWEJz-0006Ga-Li
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08: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 1lWEJz-0007GA-KQ
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08:22:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWEJz-0002rb-JD
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08: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=34Qu/RMcF0PdN6t/Oh9eEJerKWVyavERTpf/dviziEw=; b=UmfdVIv+AYKCJZkt88HLCSPQZR
	nzAfAl2vGTXT4mePFn2epFxW7M1/hnjPU2aKLXmbiGjV3pYpJ9GuxpZ6nD8xoxacFaEAK3Kfb2sY1
	FYrdYMFqTfX9r3tU+xYLuwWzq+O2cterEeyL5H9RQjs4F/uSgNLdksRxAFpdo6Dt1N1o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: drop unused #define-s
Message-Id: <E1lWEJz-0002rb-JD@xenbits.xenproject.org>
Date: Tue, 13 Apr 2021 08:22:55 +0000

commit de7853ed741267435a5a86e0505288ccd5c6aaed
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 13 10:16:50 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 13 10:16:50 2021 +0200

    VT-d: drop unused #define-s
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.h | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h
index 6804e3d58c..aaf9e864ff 100644
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -471,26 +471,12 @@ struct qinval_entry {
 /* Queue invalidation head/tail shift */
 #define QINVAL_INDEX_SHIFT 4
 
-#define qinval_present(v) ((v).lo & 1)
-#define qinval_fault_disable(v) (((v).lo >> 1) & 1)
-
-#define qinval_set_present(v) do {(v).lo |= 1;} while(0)
-#define qinval_clear_present(v) do {(v).lo &= ~1;} while(0)
-
-#define RESERVED_VAL        0
-
 #define TYPE_INVAL_CONTEXT      0x1
 #define TYPE_INVAL_IOTLB        0x2
 #define TYPE_INVAL_DEVICE_IOTLB 0x3
 #define TYPE_INVAL_IEC          0x4
 #define TYPE_INVAL_WAIT         0x5
 
-#define NOTIFY_TYPE_POLL        1
-#define NOTIFY_TYPE_INTR        1
-#define INTERRUTP_FLAG          1
-#define STATUS_WRITE            1
-#define FENCE_FLAG              1
-
 #define IEC_GLOBAL_INVL         0
 #define IEC_INDEX_INVL          1
 #define IRTA_EIME               (((u64)1) << 11)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 13 08:23:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Apr 2021 08:23:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.109585.209181 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWEKB-0006IJ-9J; Tue, 13 Apr 2021 08:23:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 109585.209181; Tue, 13 Apr 2021 08:23: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 1lWEKB-0006IB-6U; Tue, 13 Apr 2021 08:23:07 +0000
Received: by outflank-mailman (input) for mailman id 109585;
 Tue, 13 Apr 2021 08: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 1lWEK9-0006I4-P9
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08: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 1lWEK9-0007Gs-Nu
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08:23:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWEK9-0002sM-N3
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08: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=5C0WYWi81Lgf+xJkbGUa8G86wsSV9yKKbDKXA/4fP4c=; b=kOgkkUkLc6qd9c3Y/gCJGPYvxO
	TH868F6X6meOlQbKvmwWGFW52c5UoBDIA67h2wLPUlKvgt0R5iF/T2yBTV7mcj0Xz2EqiW/zji6Ry
	fIZrAliKgtGp5VylIgqvGc+Z+lEwKFjkSvsKrAbi55bFkTuZTG+ZwBJ/rFukUZeM9MUI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] iommu: remove read_msi_from_ire hook
Message-Id: <E1lWEK9-0002sM-N3@xenbits.xenproject.org>
Date: Tue, 13 Apr 2021 08:23:05 +0000

commit d1de2d02cae568c3b81e6104d877a76d9570189d
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Apr 13 10:17:15 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 13 10:17:15 2021 +0200

    iommu: remove read_msi_from_ire hook
    
    It's now unused after commit 28fb8cf323dd93f59a9c851c93ba9b79de8b1c4e.
    
    Fixes: 28fb8cf323d ('x86/iommu: remove code to fetch MSI message from remap table')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/iommu.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index d59ed7cbad..ea0cd0f1a2 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -244,7 +244,6 @@ struct iommu_ops {
 #ifdef CONFIG_HAS_PCI
     int (*get_device_group_id)(u16 seg, u8 bus, u8 devfn);
     int (*update_ire_from_msi)(struct msi_desc *msi_desc, struct msi_msg *msg);
-    void (*read_msi_from_ire)(struct msi_desc *msi_desc, struct msi_msg *msg);
 #endif /* HAS_PCI */
 
     void (*teardown)(struct domain *d);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 13 08:23:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Apr 2021 08:23:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.109586.209185 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWEKL-0006Jj-As; Tue, 13 Apr 2021 08:23:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 109586.209185; Tue, 13 Apr 2021 08:23: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 1lWEKL-0006Jb-7w; Tue, 13 Apr 2021 08:23:17 +0000
Received: by outflank-mailman (input) for mailman id 109586;
 Tue, 13 Apr 2021 08: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 1lWEKJ-0006JQ-Rv
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08: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 1lWEKJ-0007H0-R4
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08:23:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWEKJ-0002sw-QL
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08: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=Y3nRIfvzrql7dHAgJLlSV2T2MWrbbXhR3htJoR923ms=; b=6FWrIsrEgK3mSx5iXN3kh97cK+
	z/Xa6IzIYHKtsesrw5y0J/cO1N+EqqaUl9waC5yr4zXXyxJbalWb+t9EFTxCBZ6M42yz434ZiVOwZ
	l+6n1WEpt0AFvwui/DSeuaf6nAWAjBXWYJVnBzr8YraxJ4e9RaV/uuGFbNtPz+ZVk8qs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/EPT: minor local variable adjustment in ept_set_entry()
Message-Id: <E1lWEKJ-0002sw-QL@xenbits.xenproject.org>
Date: Tue, 13 Apr 2021 08:23:15 +0000

commit 0faa6ef54af330867d836e99d34e8dc1e622b54f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 13 10:18:08 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 13 10:18:08 2021 +0200

    x86/EPT: minor local variable adjustment in ept_set_entry()
    
    Not having direct_mmio (used only once anyway) as a local variable gets
    the epte_get_entry_emt() invocation here in better sync with the other
    ones. While at it also reduce ipat's scope.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/mm/p2m-ept.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 23d411f01d..a3beaf91e2 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -677,8 +677,6 @@ ept_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
     unsigned long fn_mask = !mfn_eq(mfn, INVALID_MFN) ? (gfn | mfn_x(mfn)) : gfn;
     int ret, rc = 0;
     bool_t entry_written = 0;
-    bool_t direct_mmio = (p2mt == p2m_mmio_direct);
-    uint8_t ipat = 0;
     bool_t need_modify_vtd_table = 1;
     bool_t vtd_pte_present = 0;
     unsigned int iommu_flags = p2m_get_iommu_flags(p2mt, mfn);
@@ -790,8 +788,10 @@ ept_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
 
     if ( mfn_valid(mfn) || p2m_allows_invalid_mfn(p2mt) )
     {
+        uint8_t ipat = 0;
         int emt = epte_get_entry_emt(p2m->domain, gfn, mfn,
-                                     i * EPT_TABLE_ORDER, &ipat, direct_mmio);
+                                     i * EPT_TABLE_ORDER, &ipat,
+                                     p2mt == p2m_mmio_direct);
 
         if ( emt >= 0 )
             new_entry.emt = emt;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 13 08:23:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Apr 2021 08:23:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.109587.209189 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWEKV-0006Kw-CV; Tue, 13 Apr 2021 08:23:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 109587.209189; Tue, 13 Apr 2021 08:23: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 1lWEKV-0006Ko-9U; Tue, 13 Apr 2021 08:23:27 +0000
Received: by outflank-mailman (input) for mailman id 109587;
 Tue, 13 Apr 2021 08:23: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 1lWEKU-0006Ke-01
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08:23: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 1lWEKT-0007HB-VS
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08:23:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWEKT-0002v8-TM
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 08: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=AyM2ysEeezzbykMX0JpUeW1Z5UoRJSPDeM2aaFPtjJE=; b=rdEGQh4eT+A99wN4xJBtAkF1If
	bo35/ALClyQkVHWFkqtdlGoUtkymwLwSbU5q7rEAgClz3688ruadFwMCnQfeSKdwXBbSqlYxlnN3o
	zs8yChcLf5Uq5EoVPVRAvB0Y/Bmmx06LsieSOrZP2U97Np+F33sDJNL0v9jypLd+uZ0Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: move is_s3_suspended field
Message-Id: <E1lWEKT-0002v8-TM@xenbits.xenproject.org>
Date: Tue, 13 Apr 2021 08:23:25 +0000

commit 3ccd796952deda179cb148606f7f7b3d6bea74b7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 13 10:18:34 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 13 10:18:34 2021 +0200

    x86/HVM: move is_s3_suspended field
    
    Put it next to another boolean, so they will "share" the subsequent
    padding hole.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/asm-x86/hvm/domain.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-x86/hvm/domain.h
index 7b60e9125f..698455444e 100644
--- a/xen/include/asm-x86/hvm/domain.h
+++ b/xen/include/asm-x86/hvm/domain.h
@@ -113,15 +113,15 @@ struct hvm_domain {
      * mtrr/pat between vcpus is not the same, set is_in_uc_mode
      */
     spinlock_t             uc_lock;
-    bool_t                 is_in_uc_mode;
+    bool                   is_in_uc_mode;
+
+    bool                   is_s3_suspended;
 
     /* hypervisor intercepted msix table */
     struct list_head       msixtbl_list;
 
     struct viridian_domain *viridian;
 
-    bool_t                 is_s3_suspended;
-
     /*
      * TSC value that VCPUs use to calculate their tsc_offset value.
      * Used during initialization and save/restore.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 13 14:22:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Apr 2021 14:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.109898.209758 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWJvb-0000la-8p; Tue, 13 Apr 2021 14:22:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 109898.209758; Tue, 13 Apr 2021 14:22: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 1lWJvb-0000lS-53; Tue, 13 Apr 2021 14:22:07 +0000
Received: by outflank-mailman (input) for mailman id 109898;
 Tue, 13 Apr 2021 14:22:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWJvZ-0000lN-RO
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 14:22:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWJvZ-0004yE-M5
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 14:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWJvZ-0005xP-JI
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 14: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=4K36RXH0P67+GBZmBpy8V9eH/i1+UziCI+CmknBCuSs=; b=xoIzAYMWN8BBetlzHeNeZtoDWX
	KfjwgOJTyokg2kLwjbxB3/SmdLxDdP9XUuUQJHHGJE91BYWC8/4MHiMqLWWLUfuEqFkR+SCq+BOJw
	vKHhsjETD9vahf1q0jhxNLAXto/JA3PZOGL7cnLoF+1t6PmKXiyWnJeRyGBQRE1U65i8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cpuid: Advertise no-lmsl unilaterally to hvm guests
Message-Id: <E1lWJvZ-0005xP-JI@xenbits.xenproject.org>
Date: Tue, 13 Apr 2021 14:22:05 +0000

commit 23ccf530431561268b0190f0f1b740b618771b7b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Apr 2 14:10:25 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Apr 13 15:11:55 2021 +0100

    x86/cpuid: Advertise no-lmsl unilaterally to hvm guests
    
    While part of the original AMD64 spec, Long Mode Segment Limit was a feature
    not picked up by Intel, and therefore didn't see much adoption in software.
    AMD have finally dropped the feature from hardware, and allocated a CPUID bit
    to indicate its absence.
    
    Xen has never supported the feature for guests, even when running on capable
    hardware, so advertise the feature's absence unilaterally.
    
    There is nothing specifically wrong with exposing this bit to PV guests, but
    the PV ABI doesn't include a working concept of MSR_EFER in the first place,
    so exposing it to PV guests would be out-of-place.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/libs/light/libxl_cpuid.c              | 1 +
 tools/misc/xen-cpuid.c                      | 1 +
 xen/arch/x86/cpuid.c                        | 6 ++++++
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 xen/tools/gen-cpuid.py                      | 4 +++-
 5 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 289c59c742..aee28b0430 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -270,6 +270,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"rstr-fp-err-ptrs", 0x80000008, NA, CPUID_REG_EBX, 2, 1},
         {"wbnoinvd",     0x80000008, NA, CPUID_REG_EBX,  9,  1},
         {"ibpb",         0x80000008, NA, CPUID_REG_EBX, 12,  1},
+        {"no-lmsl",      0x80000008, NA, CPUID_REG_EBX, 20,  1},
         {"ppin",         0x80000008, NA, CPUID_REG_EBX, 23,  1},
 
         {"nc",           0x80000008, NA, CPUID_REG_ECX,  0,  8},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 2d04162d8d..628e8f5aa2 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -152,6 +152,7 @@ static const char *const str_e8b[32] =
 
     [12] = "ibpb",
 
+    [20] = "no-lmsl",
     /* [22] */                 [23] = "ppin",
 };
 
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 18b08d9b87..050cd5713e 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -455,6 +455,12 @@ static void __init calculate_hvm_max_policy(void)
     __set_bit(X86_FEATURE_APIC, hvm_featureset);
     __set_bit(X86_FEATURE_X2APIC, hvm_featureset);
 
+    /*
+     * We don't support EFER.LMSLE at all.  AMD has dropped the feature from
+     * hardware and allocated a CPUID bit to indicate its absence.
+     */
+    __set_bit(X86_FEATURE_NO_LMSL, hvm_featureset);
+
     /*
      * On AMD, PV guests are entirely unable to use SYSENTER as Xen runs in
      * long mode (and init_amd() has cleared it out of host capabilities), but
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index a501479820..42bc8d4279 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -255,6 +255,7 @@ XEN_CPUFEATURE(CLZERO,        8*32+ 0) /*A  CLZERO instruction */
 XEN_CPUFEATURE(RSTR_FP_ERR_PTRS, 8*32+ 2) /*A  (F)X{SAVE,RSTOR} always saves/restores FPU Error pointers */
 XEN_CPUFEATURE(WBNOINVD,      8*32+ 9) /*   WBNOINVD instruction */
 XEN_CPUFEATURE(IBPB,          8*32+12) /*A  IBPB support only (no IBRS, used by AMD) */
+XEN_CPUFEATURE(NO_LMSL,       8*32+20) /*S  EFER.LMSLE no longer supported. */
 XEN_CPUFEATURE(AMD_PPIN,      8*32+23) /*   Protected Processor Inventory Number */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:0.edx, word 9 */
diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 36f67750e5..b953648b65 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -242,7 +242,9 @@ def crunch_numbers(state):
         # CX16 is only encodable in Long Mode.  LAHF_LM indicates that the
         # SAHF/LAHF instructions are reintroduced in Long Mode.  1GB
         # superpages, PCID and PKU are only available in 4 level paging.
-        LM: [CX16, PCID, LAHF_LM, PAGE1GB, PKU],
+        # NO_LMSL indicates the absense of Long Mode Segment Limits, which
+        # have been dropped in hardware.
+        LM: [CX16, PCID, LAHF_LM, PAGE1GB, PKU, NO_LMSL],
 
         # AMD K6-2+ and K6-III processors shipped with 3DNow+, beyond the
         # standard 3DNow in the earlier K6 processors.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 13 14:22:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Apr 2021 14:22:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.109899.209761 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWJvl-0000mI-9Z; Tue, 13 Apr 2021 14:22:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 109899.209761; Tue, 13 Apr 2021 14:22: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 1lWJvl-0000mA-6Z; Tue, 13 Apr 2021 14:22:17 +0000
Received: by outflank-mailman (input) for mailman id 109899;
 Tue, 13 Apr 2021 14:22:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWJvj-0000m4-Ud
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 14:22:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWJvj-0004yH-QF
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 14:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWJvj-0005y6-Oo
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 14: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=HBEQb5kY9IRnaZJXj0nTIiFw10dfIBZXBkOvswi3ca4=; b=OH52wP1PizzG4Q1GbOKAlwzC7U
	X1FEEwGtm4gKV7a/wS6JCrC2/ATBVjj3sh4N6P3sUmAxx0vbLftCy0GJbYM/eiAXR9M21aX1b7CdJ
	RyIOog9vWBWXKGpjLtU38mVCwWG1mun1BDekTwTAls4A9/IijKgf2hCaBTebZOgvbiHo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: User defined max_maptrack_frames in a stub domain
Message-Id: <E1lWJvj-0005y6-Oo@xenbits.xenproject.org>
Date: Tue, 13 Apr 2021 14:22:15 +0000

commit 80714e55042b2242cd82eccfb7405d671ecbebda
Author:     Dmitry Fedorov <d.fedorov@tabit.pro>
AuthorDate: Tue Apr 13 15:17:29 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Apr 13 15:17:29 2021 +0100

    libxl: User defined max_maptrack_frames in a stub domain
    
    Implementing qrexec+usbip+qemu in Linux-based stub domain leads me to
    an issue where a device model stub domain doesn't have maptrack entries.
    
    Signed-off-by: Dmitry Fedorov <d.fedorov@tabit.pro>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/light/libxl_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 5309496c58..3599a82ef0 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -2311,7 +2311,7 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
     dm_config->b_info.target_memkb = dm_config->b_info.max_memkb;
 
     dm_config->b_info.max_grant_frames = guest_config->b_info.max_grant_frames;
-    dm_config->b_info.max_maptrack_frames = 0;
+    dm_config->b_info.max_maptrack_frames = guest_config->b_info.max_maptrack_frames;
 
     dm_config->b_info.u.pv.features = "";
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 13 16:22:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Apr 2021 16:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.109981.209918 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWLnj-0004j8-9Y; Tue, 13 Apr 2021 16:22:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 109981.209918; Tue, 13 Apr 2021 16:22: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 1lWLnj-0004j0-6g; Tue, 13 Apr 2021 16:22:07 +0000
Received: by outflank-mailman (input) for mailman id 109981;
 Tue, 13 Apr 2021 16: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 1lWLnh-0004iv-LS
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 16: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 1lWLnh-0007Xc-Jn
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 16:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWLnh-0007V5-Ir
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 16: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=x8o31qktF/ebIYhDyYX2gVP6zf/J+8kmIjgqKRJLExE=; b=Pj6/nQPInzU9GPvRVMlOKxyM7F
	vQwrtyF7Il27kwI7qctIFCvz6ps14eItiY/GddZT7JFuh350Y1DyT/6KcFS7+qxqGfJWHmIgGGaw1
	V8lKefnD8r/n7PxicSZNUQ6P1H8nCZEKIQuKNl0hF+HJaeIQtV0n46WxeyaYSVEfZBSs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Revert "xen/arm: mm: flush_page_to_ram() only need to clean to PoC"
Message-Id: <E1lWLnh-0007V5-Ir@xenbits.xenproject.org>
Date: Tue, 13 Apr 2021 16:22:05 +0000

commit a33ad60cc3c2a107b43f9c368b1718eda3282760
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Apr 13 17:15:39 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 13 17:15:39 2021 +0100

    Revert "xen/arm: mm: flush_page_to_ram() only need to clean to PoC"
    
    Some callers of flush_page_to_ram() expect the memory to be
    invalidated. Reverts commit 9617d5f9c19d1d157629e1e436791509526e0ce5
    to unblock OssTest.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 2f11d214e1..59f8a3f15f 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -529,7 +529,7 @@ void flush_page_to_ram(unsigned long mfn, bool sync_icache)
 {
     void *v = map_domain_page(_mfn(mfn));
 
-    clean_dcache_va_range(v, PAGE_SIZE);
+    clean_and_invalidate_dcache_va_range(v, PAGE_SIZE);
     unmap_domain_page(v);
 
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 13 18:00:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Apr 2021 18:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110083.210126 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWNKY-0006tn-2j; Tue, 13 Apr 2021 18:00:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110083.210126; Tue, 13 Apr 2021 18: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 1lWNKX-0006th-VT; Tue, 13 Apr 2021 18:00:05 +0000
Received: by outflank-mailman (input) for mailman id 110083;
 Tue, 13 Apr 2021 18: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 1lWNKX-0006ne-5z
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 18: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 1lWNKX-0000pI-5A
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 18:00:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWNKX-00023v-4L
 for xen-changelog@lists.xenproject.org; Tue, 13 Apr 2021 18: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=BF7cTa/oVnx+OStNUsUPmHGpZmyCKelfyHjw/dunfIE=; b=tmrUFLy+SW/gQtjGYFFgILf4HW
	DsUccPHLuKoD/YGkd/gQGj8ybdvSuetRO520nZmhgR9VAVKhy20gYHwPT8G0hpel3ZPdeE0NJvB8m
	qIt3fe39dBIQwumeScirBPA4J03zhb0A6Ifh1wQpcgyOzMiSPfIboVcbyGkNOE6cYIOY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/iommu: smmu: Silence clang in arm_smmu_device_dt_probe()
Message-Id: <E1lWNKX-00023v-4L@xenbits.xenproject.org>
Date: Tue, 13 Apr 2021 18:00:05 +0000

commit 264aa183ad85b2779b27d1312724a291259ccc9f
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Apr 2 16:51:06 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 13 18:57:59 2021 +0100

    xen/iommu: smmu: Silence clang in arm_smmu_device_dt_probe()
    
    Clang 11 will throw the following error:
    
    smmu.c:2284:18: error: cast to smaller integer type 'enum arm_smmu_arch_version' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
            smmu->version = (enum arm_smmu_arch_version)of_id->data;
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    The error can be prevented by initially casting to (uintptr_t) and then
    enum.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/drivers/passthrough/arm/smmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index 20ac672e91..fab7be8b48 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -2382,7 +2382,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
 	smmu->dev = dev;
 
 	of_id = of_match_node(arm_smmu_of_match, dev->of_node);
-	smmu->version = (enum arm_smmu_arch_version)of_id->data;
+	smmu->version = (enum arm_smmu_arch_version)(uintptr_t)of_id->data;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	smmu->base = devm_ioremap_resource(dev, res);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:44:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110711.211327 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjYa-00034Z-Hs; Wed, 14 Apr 2021 17:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110711.211327; Wed, 14 Apr 2021 17: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 1lWjYa-00034S-Ex; Wed, 14 Apr 2021 17:44:04 +0000
Received: by outflank-mailman (input) for mailman id 110711;
 Wed, 14 Apr 2021 17:44: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 1lWjYY-00034N-WA
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:44: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 1lWjYY-0006xw-Ud
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjYY-0005lf-SZ
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17: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=hWLFf4H67vjszLhEAKCnkO4h+4bMNXH0pSAyJpqaH8Y=; b=oNooqnopp4ChxPFYZZFwcXoE0v
	kiEEIeASxH8Hs8IEE28AQETgd1K7ShGZS+JorlfpQ88Cs5M4jAbZLLWMDcF510BxHp3Txe+9LdcYO
	4k4uaOzXs9VT8yjf6rUkCwmvJVn41TngQaaRF0HPWupCEYA9SDfgRJm4fh+/Qw4ENaTU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vioapic: top word redir entry writes don't trigger interrupts
Message-Id: <E1lWjYY-0005lf-SZ@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:44:02 +0000

commit 6f59dc12962be61ef84774d0630bdb7c1050851f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Apr 1 16:41:48 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 1 16:41:48 2021 +0200

    x86/vioapic: top word redir entry writes don't trigger interrupts
    
    Top word writes just update the destination of the interrupt, but
    since there's no change on the masking or the triggering mode no
    guest interrupt injection can result of such write. Add an assert to
    that effect.
    
    Requested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vioapic.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index 804bc77279..e3ee747b7d 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -262,6 +262,8 @@ static void vioapic_write_redirent(
               !ent.fields.remote_irr &&
               hvm_irq->gsi_assert_count[gsi] )
     {
+        /* A top word write should never trigger an interrupt injection. */
+        ASSERT(!top_word);
         pent->fields.remote_irr = 1;
         vioapic_deliver(vioapic, idx);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:44:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110713.211333 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjYk-00035u-KS; Wed, 14 Apr 2021 17:44:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110713.211333; Wed, 14 Apr 2021 17:44:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjYk-00035n-HF; Wed, 14 Apr 2021 17:44:14 +0000
Received: by outflank-mailman (input) for mailman id 110713;
 Wed, 14 Apr 2021 17:44: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 1lWjYj-00035h-60
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:44: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 1lWjYj-0006y3-1v
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:44:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjYj-0005mk-0z
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:44: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=Uw51BHkGoQacZsjqex3sjeiOXDKf9YD3ratU/uzhwKE=; b=v0DSx3G8e9tUvK8ytGQYMeTkiU
	2ragzOzhOmKkbr3gv+v5Uq7/ehDWMac3NMVwd57GeDET/i1xltw7TxuLB2dnt+OeBB6MuGimSBNIe
	Y8ydBmQ7IovNR+eFjR1iq5OpXkvMoozL3CnFpCmEakCvlLixSqDY+FqZKjdbe2VpU4fA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vioapic: issue EOI to dpci when switching pin to edge trigger mode
Message-Id: <E1lWjYj-0005mk-0z@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:44:13 +0000

commit 0dc28066e9f0339ad8f4aea233cc5912139c5f79
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Apr 1 16:42:54 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 1 16:42:54 2021 +0200

    x86/vioapic: issue EOI to dpci when switching pin to edge trigger mode
    
    When an IO-APIC pin is switched from level to edge trigger mode the
    IRR bit is cleared, so it can be used as a way to EOI an interrupt at
    the IO-APIC level.
    
    Such EOI however does not get forwarded to the dpci code like it's
    done for the local APIC initiated EOI. This change adds the code in
    order to notify dpci of such EOI, so that dpci and the interrupt
    controller are in sync.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vioapic.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index e3ee747b7d..87370dd417 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -219,6 +219,7 @@ static void vioapic_write_redirent(
     struct domain *d = vioapic_domain(vioapic);
     struct hvm_irq *hvm_irq = hvm_domain_irq(d);
     union vioapic_redir_entry *pent, ent;
+    bool prev_level;
     int unmasked = 0;
     unsigned int gsi;
 
@@ -234,6 +235,7 @@ static void vioapic_write_redirent(
 
     pent = &vioapic->redirtbl[idx];
     ent  = *pent;
+    prev_level = ent.fields.trig_mode == VIOAPIC_LEVEL_TRIG;
 
     if ( top_word )
     {
@@ -270,6 +272,21 @@ static void vioapic_write_redirent(
 
     spin_unlock(&d->arch.hvm.irq_lock);
 
+    if ( ent.fields.trig_mode == VIOAPIC_EDGE_TRIG &&
+         ent.fields.remote_irr && is_iommu_enabled(d) )
+    {
+            /*
+             * Since IRR has been cleared and further interrupts can be
+             * injected also attempt to deassert any virtual line of passed
+             * through devices using this pin. Switching a pin from level to
+             * edge trigger mode can be used as a way to EOI an interrupt at
+             * the IO-APIC level.
+             */
+            ASSERT(prev_level);
+            ASSERT(!top_word);
+            hvm_dpci_eoi(d, gsi);
+    }
+
     if ( is_hardware_domain(d) && unmasked )
     {
         /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:44:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110714.211338 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjYu-00037D-MO; Wed, 14 Apr 2021 17:44:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110714.211338; Wed, 14 Apr 2021 17:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjYu-000375-JH; Wed, 14 Apr 2021 17:44:24 +0000
Received: by outflank-mailman (input) for mailman id 110714;
 Wed, 14 Apr 2021 17:44: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 1lWjYt-00036w-6O
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:44: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 1lWjYt-0006yE-5W
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:44:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjYt-0005nc-4V
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:44: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=fAReMTilkY9J9Msvwvh7b5ExmPLn1X71sEKwL2P0r/w=; b=LHm51h309A+o985YUe5KmAel+s
	vD5UcpG2J36pJA6BtZz0iowWgzIvKSCyvYZ8SjN5vCJSfo2pFskmN/Qptsf4UEssNM9lEit0fv0A1
	RJ3l5yyhMjN27yLmB3JoWEV3S7BaG/VyzSEoihF82+1TBZKfIU5mv6+D93xIBpBP8SQ8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ucode: log blob date also for AMD
Message-Id: <E1lWjYt-0005nc-4V@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:44:23 +0000

commit f36179726847a08418a0b4f9c319b24ecb60fe3a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 1 16:43:50 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 1 16:43:50 2021 +0200

    x86/ucode: log blob date also for AMD
    
    Like Intel, AMD also records the date in their blobs. The field was
    merely misnamed as "data_code" so far; this was perhaps meant to be
    "date_code". Split it into individual fields, just like we did for Intel
    some time ago, and extend the message logged after a successful update.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu/microcode/amd.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 809ba4967c..fe92e594f1 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -33,7 +33,9 @@ struct equiv_cpu_entry {
 };
 
 struct microcode_patch {
-    uint32_t data_code;
+    uint16_t year;
+    uint8_t  day;
+    uint8_t  month;
     uint32_t patch_id;
     uint8_t  mc_patch_data_id[2];
     uint8_t  mc_patch_data_len;
@@ -251,8 +253,9 @@ static int apply_microcode(const struct microcode_patch *patch)
         return -EIO;
     }
 
-    printk(XENLOG_WARNING "microcode: CPU%u updated from revision %#x to %#x\n",
-           cpu, old_rev, rev);
+    printk(XENLOG_WARNING
+           "microcode: CPU%u updated from revision %#x to %#x, date = %04x-%02x-%02x\n",
+           cpu, old_rev, rev, patch->year, patch->month, patch->day);
 
     return 0;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:44:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:44:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110715.211342 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjZ4-00038j-Nz; Wed, 14 Apr 2021 17:44:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110715.211342; Wed, 14 Apr 2021 17: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 1lWjZ4-00038b-Kr; Wed, 14 Apr 2021 17:44:34 +0000
Received: by outflank-mailman (input) for mailman id 110715;
 Wed, 14 Apr 2021 17:44: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 1lWjZ3-00038T-9r
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:44: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 1lWjZ3-0006yb-96
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:44:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjZ3-0005op-84
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:44: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=c1VYe3qvEuWl/DzhAn+e4agaKRaEoQ1bTqv23BZqsyY=; b=oIwYMrzUDEtpG8yRnkrE0t5H0+
	wWl8tn6xpsO0XcHIHTjI0RgnaehXQqSBtZ/5sKk1p+fbd5GRsc4tPawA6bYB9WMcm6OpAYN4UIeWz
	S03RNR4T9kRb4q81zVeWFwv3S6XfL5BgDm9UXNaftQSTBboNIsamD/A6TvtbQmUkWe2M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/EFI: drop stale section special casing when generating base relocs
Message-Id: <E1lWjZ3-0005op-84@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:44:33 +0000

commit 5c3c410bd2ea8d2cc520e8e8f83ad143c9c5cff7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 1 16:44:24 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 1 16:44:24 2021 +0200

    x86/EFI: drop stale section special casing when generating base relocs
    
    As of commit a6066af5b142 ("xen/init: Annotate all command line
    parameter infrastructure as const") .init.setup has been part of .init.
    As of commit 544ad7f5caf5 ("xen/init: Move initcall infrastructure into
    .init.data") .initcall* have been part of .init. Hence neither can be
    encountered as a stand-alone section in the final binaries anymore.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/efi/mkreloc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/x86/efi/mkreloc.c b/xen/arch/x86/efi/mkreloc.c
index 83a0afa00b..9efeaee7c5 100644
--- a/xen/arch/x86/efi/mkreloc.c
+++ b/xen/arch/x86/efi/mkreloc.c
@@ -346,9 +346,7 @@ int main(int argc, char *argv[])
          * Don't generate relocations for sections that definitely
          * aren't used by the boot loader code.
          */
-        if ( memcmp(sec1[i].name, ".initcal", sizeof(sec1[i].name)) == 0 ||
-             memcmp(sec1[i].name, ".init.se", sizeof(sec1[i].name)) == 0 ||
-             memcmp(sec1[i].name, ".buildid", sizeof(sec1[i].name)) == 0 ||
+        if ( memcmp(sec1[i].name, ".buildid", sizeof(sec1[i].name)) == 0 ||
              memcmp(sec1[i].name, ".lockpro", sizeof(sec1[i].name)) == 0 )
             continue;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:44:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:44:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110716.211345 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjZE-0003BU-Pk; Wed, 14 Apr 2021 17:44:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110716.211345; Wed, 14 Apr 2021 17:44: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 1lWjZE-0003BM-MX; Wed, 14 Apr 2021 17:44:44 +0000
Received: by outflank-mailman (input) for mailman id 110716;
 Wed, 14 Apr 2021 17:44: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 1lWjZD-00039c-DJ
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:44: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 1lWjZD-0006yv-CW
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:44:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjZD-0005pw-Bc
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:44: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=59MnJ2i7nR9CLTrlCbA0SBY1bLxu9Tm7UqIPhPsp5Go=; b=wBwIUeSygk9rJ5Q2ouu2AjyCbN
	GvTe6uglC0GDHc2oBKcUlTljeJtpqIfE3ll1nXaU+4teXV7BJqOd09C/cNhduqB/oBLfjJLf+LaBD
	DpqOc3FjwaItRF+zQHuvK/TNkCOVFxyeWt1f3RzOXZNEizt/CUaToKYdaXsdhmkBqIq0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: mm: flush_page_to_ram() only need to clean to PoC
Message-Id: <E1lWjZD-0005pw-Bc@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:44:43 +0000

commit 9617d5f9c19d1d157629e1e436791509526e0ce5
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sat Feb 20 17:54:13 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xen/arm: mm: flush_page_to_ram() only need to clean to PoC
    
    At the moment, flush_page_to_ram() is both cleaning and invalidate to
    PoC the page.
    
    The goal of flush_page_to_ram() is to prevent corruption when the guest
    has disabled the cache (the cache line may be dirty) and the guest to
    read previous content.
    
    Per this definition, the invalidating the line is not necessary. So
    invalidating the cache is unnecessary. In fact, it may be counter-
    productive as the line may be (speculatively) accessed a bit after.
    So this will incurr an expensive access to the memory.
    
    More generally, we should avoid interferring too much with cache.
    Therefore, flush_page_to_ram() is updated to only clean to PoC the page.
    
    The performance impact of this change will depend on your
    workload/processor.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 59f8a3f15f..2f11d214e1 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -529,7 +529,7 @@ void flush_page_to_ram(unsigned long mfn, bool sync_icache)
 {
     void *v = map_domain_page(_mfn(mfn));
 
-    clean_and_invalidate_dcache_va_range(v, PAGE_SIZE);
+    clean_dcache_va_range(v, PAGE_SIZE);
     unmap_domain_page(v);
 
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:44:55 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:44:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110717.211349 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjZO-0003CY-R4; Wed, 14 Apr 2021 17:44:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110717.211349; Wed, 14 Apr 2021 17:44: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 1lWjZO-0003CR-O8; Wed, 14 Apr 2021 17:44:54 +0000
Received: by outflank-mailman (input) for mailman id 110717;
 Wed, 14 Apr 2021 17:44: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 1lWjZN-0003CJ-IS
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:44: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 1lWjZN-0006z2-Gy
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:44:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjZN-0005qy-FA
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:44: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=NchgJML8xCSZ/GxuxURKbCn4STRms/e148tjda6SV8M=; b=ZDJ8Cns+YlcF6DLzD3i+BzeLGT
	76e6iKUfPFGZJrAG4Qy1ZNhNHN1y5qMOEnCoGpmFWP7DhCVFvVynQk+cIFjHKTXkq+jrb6yeacYlt
	GwCUNIPNfcFSwc0JvKMBw2JMhVGf1KYm8/EZPlpcFpEV/lHxrp3E4TazX2H58MR+J4Tg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xenstore_client: handle memory on error
Message-Id: <E1lWjZN-0005qy-FA@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:44:53 +0000

commit 00948dcd6a5412695b42c6d5045b0d3075b14114
Author:     Norbert Manthey <nmanthey@amazon.de>
AuthorDate: Fri Feb 26 15:41:38 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xenstore_client: handle memory on error
    
    In case a command fails, also free the memory. As this is for the CLI
    client, currently the leaked memory is freed right after receiving the
    error, as the application terminates next.
    
    Similarly, if the allocation fails, do not use the NULL pointer
    afterwards, but instead error out.
    
    This bug was discovered and resolved using Coverity Static Analysis
    Security Testing (SAST) by Synopsys, Inc.
    
    Signed-off-by: Norbert Manthey <nmanthey@amazon.de>
    Reviewed-by: Thomas Friebel <friebelt@amazon.de>
    Reviewed-by: Julien Grall <jgrall@amazon.co.uk>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/xenstore/xenstore_client.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c
index 8015bfe5be..ddbafc5175 100644
--- a/tools/xenstore/xenstore_client.c
+++ b/tools/xenstore/xenstore_client.c
@@ -382,11 +382,14 @@ perform(enum mode mode, int optind, int argc, char **argv, struct xs_handle *xsh
                 /* Copy path, because we can't modify argv because we will need it
                    again if xs_transaction_end gives us EAGAIN. */
                 char *p = malloc(strlen(path) + 1);
+                if (!p)
+                    return 1;
                 strcpy(p, path);
                 path = p;
 
             again:
                 if (do_rm(path, xsh, xth)) {
+                    free(path);
                     return 1;
                 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:45:04 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:45:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110718.211354 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjZY-0003De-TW; Wed, 14 Apr 2021 17:45:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110718.211354; Wed, 14 Apr 2021 17:45:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjZY-0003DW-Pq; Wed, 14 Apr 2021 17:45:04 +0000
Received: by outflank-mailman (input) for mailman id 110718;
 Wed, 14 Apr 2021 17:45: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 1lWjZX-0003DM-Lc
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:45: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 1lWjZX-0006za-Kp
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:45:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjZX-0005sK-Jo
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:45: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=5IqaderyhH+pK7kVqYh4e2PJBiNZ1ygqAs2lzMyeuwA=; b=1Fkf3e8+oruU+sXmCMLgmS3HFW
	sf0goj2GoAj3Xs5pm9lIgb/Ne6CzGx4XITPAmXFk2+onu8ewZk5FIFlfpAf2KvZ+zGdKZuV0+AtYV
	ggdgrXCtbgwnW24raoJGsCsn3IYpCWo+pS+qqwyKx0MONS91R5Bq7DlMiaxhTsjybew8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xenstore: handle daemon creation errors
Message-Id: <E1lWjZX-0005sK-Jo@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:45:03 +0000

commit 60f0ba136d5a4c88377e28e5eb40606a7f9f6785
Author:     Norbert Manthey <nmanthey@amazon.de>
AuthorDate: Fri Feb 26 15:41:39 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xenstore: handle daemon creation errors
    
    In rare cases, the path to the daemon socket cannot be created as it is
    longer than PATH_MAX. Instead of failing with a NULL pointer dereference,
    terminate the application with an error message.
    
    This bug was discovered and resolved using Coverity Static Analysis
    Security Testing (SAST) by Synopsys, Inc.
    
    Signed-off-by: Norbert Manthey <nmanthey@amazon.de>
    Reviewed-by: Thomas Friebel <friebelt@amazon.de>
    Reviewed-by: Julien Grall <jgrall@amazon.co.uk>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/xenstore/xenstored_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 8033c1e0eb..d54a6042a9 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2005,6 +2005,9 @@ static void init_sockets(void)
 	struct sockaddr_un addr;
 	const char *soc_str = xs_daemon_socket();
 
+	if (!soc_str)
+		barf_perror("Failed to obtain xs domain socket");
+
 	/* Create sockets for them to listen to. */
 	atexit(destroy_fds);
 	sock = socket(PF_UNIX, SOCK_STREAM, 0);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:45:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:45:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110719.211360 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjZj-0003Fm-0F; Wed, 14 Apr 2021 17:45:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110719.211360; Wed, 14 Apr 2021 17:45:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjZi-0003Fa-Re; Wed, 14 Apr 2021 17:45:14 +0000
Received: by outflank-mailman (input) for mailman id 110719;
 Wed, 14 Apr 2021 17:45:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjZh-0003Ed-PT
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:45: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 1lWjZh-0006zi-OB
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:45:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjZh-0005tC-NN
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:45: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=QjYKL5tTdh0llSoL10pqag1oijz0Zv4RI3D3afeBMvI=; b=knnRkpaCUDLiIgsxERcfT1WsIo
	hwLoU3NOCVLwAJddkIH0vLGZNPBjOxN7lEQkxpmnRYiaYfrwqNVPzOUFYM3+OUuezWfxgigGiSXRu
	9h1wKEHLdJhj6lNzlNTyRMoSP+sLdzktG2VRdQFbqHuxtzRma0iuEu/aTw4XkRplaw5I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Use register_t type of cpuinfo entries
Message-Id: <E1lWjZh-0005tC-NN@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:45:13 +0000

commit e650311d4ebfd5bdff1f689b237f790ac05e1cab
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Mon Mar 15 10:38:30 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xen/arm: Use register_t type of cpuinfo entries
    
    All cpu identification registers that we store in the cpuinfo structure
    are 64bit on arm64 and 32bit on arm32 so storing the values in 32bit on
    arm64 is removing the higher bits which might contain information in the
    future.
    
    This patch is changing the types in cpuinfo to register_t (which is
    32bit on arm32 and 64bit on arm64) and adding the necessary paddings
    inside the unions.
    For consistency uint64_t entries are also changed to register_t on 64bit
    systems.
    
    It is also fixing all prints using directly the bits values from cpuinfo
    to use PRIregister and adapt the printed value to print all bits
    available on the architecture.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/setup.c             | 17 +++++++++--------
 xen/arch/arm/smpboot.c           |  5 +++--
 xen/include/asm-arm/cpufeature.h | 34 +++++++++++++++++++++++-----------
 3 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 2532ec9739..9ba2f267f6 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -116,8 +116,8 @@ static void __init processor_id(void)
         printk("Huh, cpu architecture %x, expected 0xf (defined by cpuid)\n",
                c->midr.architecture);
 
-    printk("Processor: %08"PRIx32": \"%s\", variant: 0x%x, part 0x%03x, rev 0x%x\n",
-           c->midr.bits, implementer,
+    printk("Processor: %"PRIregister": \"%s\", variant: 0x%x, part 0x%03x,"
+           "rev 0x%x\n", c->midr.bits, implementer,
            c->midr.variant, c->midr.part_number, c->midr.revision);
 
 #if defined(CONFIG_ARM_64)
@@ -163,7 +163,7 @@ static void __init processor_id(void)
     if ( cpu_has_aarch32 )
     {
         printk("32-bit Execution:\n");
-        printk("  Processor Features: %08"PRIx32":%08"PRIx32"\n",
+        printk("  Processor Features: %"PRIregister":%"PRIregister"\n",
                boot_cpu_data.pfr32.bits[0], boot_cpu_data.pfr32.bits[1]);
         printk("    Instruction Sets:%s%s%s%s%s%s\n",
                cpu_has_aarch32 ? " AArch32" : "",
@@ -176,15 +176,16 @@ static void __init processor_id(void)
                cpu_has_gentimer ? " GenericTimer" : "",
                cpu_has_security ? " Security" : "");
 
-        printk("  Debug Features: %08"PRIx32"\n",
+        printk("  Debug Features: %"PRIregister"\n",
                boot_cpu_data.dbg32.bits[0]);
-        printk("  Auxiliary Features: %08"PRIx32"\n",
+        printk("  Auxiliary Features: %"PRIregister"\n",
                boot_cpu_data.aux32.bits[0]);
-        printk("  Memory Model Features: "
-               "%08"PRIx32" %08"PRIx32" %08"PRIx32" %08"PRIx32"\n",
+        printk("  Memory Model Features: %"PRIregister" %"PRIregister"\n"
+               "                         %"PRIregister" %"PRIregister"\n",
                boot_cpu_data.mm32.bits[0], boot_cpu_data.mm32.bits[1],
                boot_cpu_data.mm32.bits[2], boot_cpu_data.mm32.bits[3]);
-        printk(" ISA Features: %08x %08x %08x %08x %08x %08x\n",
+        printk("  ISA Features: %"PRIregister" %"PRIregister" %"PRIregister"\n"
+               "                %"PRIregister" %"PRIregister" %"PRIregister"\n",
                boot_cpu_data.isa32.bits[0], boot_cpu_data.isa32.bits[1],
                boot_cpu_data.isa32.bits[2], boot_cpu_data.isa32.bits[3],
                boot_cpu_data.isa32.bits[4], boot_cpu_data.isa32.bits[5]);
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index cae2179126..a1ee3146ef 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -321,8 +321,9 @@ void start_secondary(void)
     if ( !opt_hmp_unsafe &&
          current_cpu_data.midr.bits != boot_cpu_data.midr.bits )
     {
-        printk(XENLOG_ERR "CPU%u MIDR (0x%x) does not match boot CPU MIDR (0x%x),\n"
-               "disable cpu (see big.LITTLE.txt under docs/).\n",
+        printk(XENLOG_ERR
+               "CPU%u MIDR (0x%"PRIregister") does not match boot CPU MIDR (0x%"PRIregister"),\n"
+               XENLOG_ERR "disable cpu (see big.LITTLE.txt under docs/).\n",
                smp_processor_id(), current_cpu_data.midr.bits,
                boot_cpu_data.midr.bits);
         stop_cpu();
diff --git a/xen/include/asm-arm/cpufeature.h b/xen/include/asm-arm/cpufeature.h
index 9ea3970c70..ba48db3eac 100644
--- a/xen/include/asm-arm/cpufeature.h
+++ b/xen/include/asm-arm/cpufeature.h
@@ -118,13 +118,16 @@ int enable_nonboot_cpu_caps(const struct arm_cpu_capabilities *caps);
  */
 struct cpuinfo_arm {
     union {
-        uint32_t bits;
+        register_t bits;
         struct {
             unsigned long revision:4;
             unsigned long part_number:12;
             unsigned long architecture:4;
             unsigned long variant:4;
             unsigned long implementer:8;
+#ifdef CONFIG_ARM_64
+            unsigned long _res0:32;
+#endif
         };
     } midr;
     union {
@@ -148,7 +151,7 @@ struct cpuinfo_arm {
 #ifdef CONFIG_ARM_64
     /* 64-bit CPUID registers. */
     union {
-        uint64_t bits[2];
+        register_t bits[2];
         struct {
             /* PFR0 */
             unsigned long el0:4;
@@ -179,15 +182,15 @@ struct cpuinfo_arm {
     } pfr64;
 
     struct {
-        uint64_t bits[2];
+        register_t bits[2];
     } dbg64;
 
     struct {
-        uint64_t bits[2];
+        register_t bits[2];
     } aux64;
 
     union {
-        uint64_t bits[3];
+        register_t bits[3];
         struct {
             unsigned long pa_range:4;
             unsigned long asid_bits:4;
@@ -213,7 +216,7 @@ struct cpuinfo_arm {
     } mm64;
 
     union {
-        uint64_t bits[2];
+        register_t bits[2];
         struct {
             /* ISAR0 */
             unsigned long __res0:4;
@@ -263,7 +266,7 @@ struct cpuinfo_arm {
      * when running in 32-bit mode.
      */
     union {
-        uint32_t bits[3];
+        register_t bits[3];
         struct {
             /* PFR0 */
             unsigned long arm:4;
@@ -274,6 +277,9 @@ struct cpuinfo_arm {
             unsigned long amu:4;
             unsigned long dit:4;
             unsigned long ras:4;
+#ifdef CONFIG_ARM_64
+            unsigned long __res0:32;
+#endif
 
             /* PFR1 */
             unsigned long progmodel:4;
@@ -284,29 +290,35 @@ struct cpuinfo_arm {
             unsigned long sec_frac:4;
             unsigned long virt_frac:4;
             unsigned long gic:4;
+#ifdef CONFIG_ARM_64
+            unsigned long __res1:32;
+#endif
 
             /* PFR2 */
             unsigned long csv3:4;
             unsigned long ssbs:4;
             unsigned long ras_frac:4;
             unsigned long __res2:20;
+#ifdef CONFIG_ARM_64
+            unsigned long __res3:32;
+#endif
         };
     } pfr32;
 
     struct {
-        uint32_t bits[2];
+        register_t bits[2];
     } dbg32;
 
     struct {
-        uint32_t bits[1];
+        register_t bits[1];
     } aux32;
 
     struct {
-        uint32_t bits[6];
+        register_t bits[6];
     } mm32;
 
     struct {
-        uint32_t bits[7];
+        register_t bits[7];
     } isa32;
 
     struct {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:45:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:45:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110720.211362 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjZt-0003Le-1w; Wed, 14 Apr 2021 17:45:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110720.211362; Wed, 14 Apr 2021 17:45: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 1lWjZs-0003LW-VE; Wed, 14 Apr 2021 17:45:24 +0000
Received: by outflank-mailman (input) for mailman id 110720;
 Wed, 14 Apr 2021 17:45: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 1lWjZr-0003LN-Sv
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:45: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 1lWjZr-000707-S8
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:45:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjZr-0005u0-Qt
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:45: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=4S79FUjF/Gmtoq4OGZFcV8lm3GCBSdxj6MsimJVIcb0=; b=mBYHUjUaEK6yXJJWqqnbXyeArH
	1enM25NDVPuLcVnkvkWyyShLZ+6LBh2gDE/P0bTTuI7mpTrQvKf7EY9ldBUFvSx56Q77iKhN+fm77
	QZvCadd7Ebwufqegfrt0iJItny9+Q79EHprNxP9AATlGJP99+Z5ymWIwmd8p3EOqvxTE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: introduce XENFEAT_direct_mapped and XENFEAT_not_direct_mapped
Message-Id: <E1lWjZr-0005u0-Qt@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:45:23 +0000

commit d66bf122c0ab79063a607d6cf68edf5e91d17d5e
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Fri Mar 12 15:16:32 2021 -0800
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xen: introduce XENFEAT_direct_mapped and XENFEAT_not_direct_mapped
    
    Introduce two feature flags to tell the domain whether it is
    direct-mapped or not. It allows the guest kernel to make informed
    decisions on things such as swiotlb-xen enablement.
    
    The introduction of both flags (XENFEAT_direct_mapped and
    XENFEAT_not_direct_mapped) allows the guest kernel to avoid any
    guesswork if one of the two is present, or fallback to the current
    checks if neither of them is present.
    
    XENFEAT_direct_mapped is always set for not auto-translated guests.
    
    For auto-translated guests, only Dom0 on ARM is direct-mapped. Also,
    see is_domain_direct_mapped() which refers to auto-translated guests:
    xen/include/asm-arm/domain.h:is_domain_direct_mapped
    xen/include/asm-x86/domain.h:is_domain_direct_mapped
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    
    CC: jbeulich@suse.com
    CC: andrew.cooper3@citrix.com
    CC: julien@xen.org
---
 xen/common/kernel.c           |  4 ++++
 xen/include/public/features.h | 14 ++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 7a345ae45e..d77756a81e 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -560,6 +560,10 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
                              (1U << XENFEAT_hvm_callback_vector) |
                              (has_pirq(d) ? (1U << XENFEAT_hvm_pirqs) : 0);
 #endif
+            if ( !paging_mode_translate(d) || is_domain_direct_mapped(d) )
+                fi.submap |= (1U << XENFEAT_direct_mapped);
+            else
+                fi.submap |= (1U << XENFEAT_not_direct_mapped);
             break;
         default:
             return -EINVAL;
diff --git a/xen/include/public/features.h b/xen/include/public/features.h
index 1613b2aab8..9ee2f760ef 100644
--- a/xen/include/public/features.h
+++ b/xen/include/public/features.h
@@ -114,6 +114,20 @@
  */
 #define XENFEAT_linux_rsdp_unrestricted   15
 
+/*
+ * A direct-mapped (or 1:1 mapped) domain is a domain for which its
+ * local pages have gfn == mfn. If a domain is direct-mapped,
+ * XENFEAT_direct_mapped is set; otherwise XENFEAT_not_direct_mapped
+ * is set.
+ *
+ * If neither flag is set (e.g. older Xen releases) the assumptions are:
+ * - not auto_translated domains (x86 only) are always direct-mapped
+ * - on x86, auto_translated domains are not direct-mapped
+ * - on ARM, Dom0 is direct-mapped, DomUs are not
+ */
+#define XENFEAT_not_direct_mapped         16
+#define XENFEAT_direct_mapped             17
+
 #define XENFEAT_NR_SUBMAPS 1
 
 #endif /* __XEN_PUBLIC_FEATURES_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:45:35 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:45:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110721.211365 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWja3-0003Mw-3M; Wed, 14 Apr 2021 17:45:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110721.211365; Wed, 14 Apr 2021 17:45: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 1lWja3-0003Mq-0R; Wed, 14 Apr 2021 17:45:35 +0000
Received: by outflank-mailman (input) for mailman id 110721;
 Wed, 14 Apr 2021 17:45: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 1lWja2-0003Mg-0N
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:45: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 1lWja1-00070G-Vd
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:45:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWja1-0005um-Us
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:45: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=NlLnq7C1v10FkqZhyu7o2fi/rfqOC/NxljgssR4VNG8=; b=XB0rRrdJ30H/bDoKP4N4OJMLC8
	6TPSyto0rrwqYnDAIIXFdV86nOjQphwmPNwz5xVfoS+PpWYKywtnz/hrfpM0sx7NfHEew9dBj7RPC
	F7TULMP0G7XAZyWHZYNJ0cn5HsP7KlqTvNErF8vi+aQ2wR/82ipiwOrgl0USTfo0EBI4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm: Add Kconfig entry to select CONFIG_DTB_FILE
Message-Id: <E1lWja1-0005um-Us@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:45:33 +0000

commit 831f01021f99d2d08909b5c054dd87de30c4f5e1
Author:     Michal Orzel <michal.orzel@arm.com>
AuthorDate: Mon Mar 22 09:17:15 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    arm: Add Kconfig entry to select CONFIG_DTB_FILE
    
    Currently in order to link existing DTB into Xen image
    we need to either specify option CONFIG_DTB_FILE on the
    command line or manually add it into .config.
    Add Kconfig entry: CONFIG_DTB_FILE
    to be able to provide the path to DTB we want to embed
    into Xen image. If no path provided - the dtb will not
    be embedded.
    
    Remove the line: AFLAGS-y += -DCONFIG_DTB_FILE=\"$(CONFIG_DTB_FILE)\"
    as it is not needed since Kconfig will define it in a header
    with all the other config options.
    
    Move definition of _sdtb into dtb.S to prevent defining it
    if there is no reference to it or if someone protects
    _sdtb with #ifdef rather than with .ifnes. If the latter,
    we will get a compiler error.
    
    Signed-off-by: Michal Orzel <michal.orzel@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/Makefile     |  5 ++---
 xen/arch/arm/arm32/head.S |  4 ++--
 xen/arch/arm/arm64/head.S |  4 ++--
 xen/arch/arm/dtb.S        |  1 +
 xen/arch/arm/xen.lds.S    |  3 ---
 xen/common/Kconfig        | 10 ++++++++++
 6 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 16e6523e2c..46e6a95fec 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -68,9 +68,8 @@ extra-y += $(TARGET_SUBARCH)/head.o
 
 #obj-bin-y += ....o
 
-ifdef CONFIG_DTB_FILE
+ifneq ($(CONFIG_DTB_FILE),"")
 obj-y += dtb.o
-AFLAGS-y += -DCONFIG_DTB_FILE=\"$(CONFIG_DTB_FILE)\"
 endif
 
 ALL_OBJS := $(TARGET_SUBARCH)/head.o $(ALL_OBJS)
@@ -137,7 +136,7 @@ asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
 xen.lds: xen.lds.S
 	$(CPP) -P $(a_flags) -MQ $@ -o $@ $<
 
-dtb.o: $(CONFIG_DTB_FILE)
+dtb.o: $(patsubst "%",%,$(CONFIG_DTB_FILE))
 
 .PHONY: clean
 clean::
diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index c404fa973e..50f019ed98 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -156,10 +156,10 @@ past_zImage:
         sub   r10, r9, r0            /* r10 := phys-offset */
 
         /* Using the DTB in the .dtb section? */
-#ifdef CONFIG_DTB_FILE
+.ifnes CONFIG_DTB_FILE,""
         ldr   r8, =_sdtb
         add   r8, r10                /* r8 := paddr(DTB) */
-#endif
+.endif
 
         /* Initialize the UART if earlyprintk has been enabled. */
 #ifdef CONFIG_EARLY_PRINTK
diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index 5d44667bd8..f38a8dfca7 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -296,9 +296,9 @@ real_start_efi:
         sub   x20, x19, x0           /* x20 := phys-offset */
 
         /* Using the DTB in the .dtb section? */
-#ifdef CONFIG_DTB_FILE
+.ifnes CONFIG_DTB_FILE,""
         load_paddr x21, _sdtb
-#endif
+.endif
 
         /* Initialize the UART if earlyprintk has been enabled. */
 #ifdef CONFIG_EARLY_PRINTK
diff --git a/xen/arch/arm/dtb.S b/xen/arch/arm/dtb.S
index c703aef12b..c39f3a095c 100644
--- a/xen/arch/arm/dtb.S
+++ b/xen/arch/arm/dtb.S
@@ -1,2 +1,3 @@
         .section .dtb,#alloc
+        GLOBAL(_sdtb)
         .incbin CONFIG_DTB_FILE
diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index 004b182acb..fc1d39a886 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -220,11 +220,8 @@ SECTIONS
   } :text
   _end = . ;
 
-#ifdef CONFIG_DTB_FILE
   /* Section for the device tree blob (if any). */
-  _sdtb = .;
   .dtb : { *(.dtb) } :text
-#endif
 
   /* Sections to be discarded */
   /DISCARD/ : {
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index eb953d171e..a1755cd380 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -400,6 +400,16 @@ config DOM0_MEM
 
 	  Leave empty if you are not sure what to specify.
 
+config DTB_FILE
+	string "Absolute path to device tree blob"
+	depends on HAS_DEVICE_TREE
+	help
+	  When using a bootloader that has no device tree support or when there
+	  is no bootloader at all, use this option to specify the absolute path
+	  to a device tree that will be linked directly inside Xen binary.
+
+	  This is an optional config. Leave empty if not needed.
+
 config TRACEBUFFER
 	bool "Enable tracing infrastructure" if EXPERT
 	default y
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:45:45 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:45:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110722.211370 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjaD-0003Oc-5W; Wed, 14 Apr 2021 17:45:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110722.211370; Wed, 14 Apr 2021 17:45: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 1lWjaD-0003OU-2A; Wed, 14 Apr 2021 17:45:45 +0000
Received: by outflank-mailman (input) for mailman id 110722;
 Wed, 14 Apr 2021 17:45: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 1lWjaC-0003OL-3T
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:45: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 1lWjaC-00070T-2k
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:45:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjaC-0005va-1z
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:45: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=la4noErvJw9yGX8QVxs+TMDoX7fm7jvyzKTu+BoScmY=; b=LdRuDGtBlmBiq/3MhH98gCUC0Q
	WMqR622+kpgVePVMUST5Wr8otis3v/BTEjiklMWw241QYVcn5a6gGly8nIfXwVvIBTqIxp1Iu2mqg
	7g5hkrkuVSscbrR5xPiUsyelJV5LQW46QO6aruyGe0qxcKpJ0v5s918tBgvClYy1knzE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: smmuv1: Handle stream IDs more dynamically
Message-Id: <E1lWjaC-0005va-1z@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:45:44 +0000

commit e889809bbdf2f0eb91105d7f7d4f36c9d5497acc
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Mon Mar 22 16:11:35 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xen/arm: smmuv1: Handle stream IDs more dynamically
    
    Backport commit 21174240e4f4439bb8ed6c116cdbdc03eba2126e
    "iommu/arm-smmu: Handle stream IDs more dynamically" from the Linux
    ernel.
    
    This patch is the preparatory work to fix the stream match conflict
    when two devices have the same stream-id.
    
    Original commit message:
        iommu/arm-smmu: Handle stream IDs more dynamically
    
        Rather than assuming fixed worst-case values for stream IDs and SMR
        masks, keep track of whatever implemented bits the hardware actually
        reports. This also obviates the slightly questionable validation of SMR
        fields in isolation - rather than aborting the whole SMMU probe for a
        hardware configuration which is still architecturally valid, we can
        simply refuse masters later if they try to claim an unrepresentable ID
        or mask (which almost certainly implies a DT error anyway).
    
        Acked-by: Will Deacon <will.deacon@arm.com>
        Tested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
        Signed-off-by: Robin Murphy <robin.murphy@arm.com>
        Signed-off-by: Will Deacon <will.deacon@arm.com>
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/smmu.c | 43 +++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 21 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index 3e8aa37866..adfab8ee84 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -440,9 +440,7 @@ static struct iommu_group *iommu_group_get(struct device *dev)
 #define ARM_SMMU_GR0_SMR(n)		(0x800 + ((n) << 2))
 #define SMR_VALID			(1U << 31)
 #define SMR_MASK_SHIFT			16
-#define SMR_MASK_MASK			0x7fff
 #define SMR_ID_SHIFT			0
-#define SMR_ID_MASK			0x7fff
 
 #define ARM_SMMU_GR0_S2CR(n)		(0xc00 + ((n) << 2))
 #define S2CR_CBNDX_SHIFT		0
@@ -632,6 +630,8 @@ struct arm_smmu_device {
 	atomic_t			irptndx;
 
 	u32				num_mapping_groups;
+	u16				streamid_mask;
+	u16				smr_mask_mask;
 	DECLARE_BITMAP(smr_map, ARM_SMMU_MAX_SMRS);
 
 	unsigned long			s1_input_size;
@@ -2140,39 +2140,40 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu)
 		dev_notice(smmu->dev, "\tcoherent table walk\n");
 	}
 
+	/* Max. number of entries we have for stream matching/indexing */
+	size = 1 << ((id >> ID0_NUMSIDB_SHIFT) & ID0_NUMSIDB_MASK);
+	smmu->streamid_mask = size - 1;
 	if (id & ID0_SMS) {
-		u32 smr, sid, mask;
+		u32 smr;
 
 		smmu->features |= ARM_SMMU_FEAT_STREAM_MATCH;
-		smmu->num_mapping_groups = (id >> ID0_NUMSMRG_SHIFT) &
-					   ID0_NUMSMRG_MASK;
-		if (smmu->num_mapping_groups == 0) {
+		size = (id >> ID0_NUMSMRG_SHIFT) & ID0_NUMSMRG_MASK;
+		if (size == 0) {
 			dev_err(smmu->dev,
 				"stream-matching supported, but no SMRs present!\n");
 			return -ENODEV;
 		}
 
-		smr = SMR_MASK_MASK << SMR_MASK_SHIFT;
-		smr |= (SMR_ID_MASK << SMR_ID_SHIFT);
+		/*
+		 * SMR.ID bits may not be preserved if the corresponding MASK
+		 * bits are set, so check each one separately. We can reject
+		 * masters later if they try to claim IDs outside these masks.
+		 */
+		smr = smmu->streamid_mask << SMR_ID_SHIFT;
 		writel_relaxed(smr, gr0_base + ARM_SMMU_GR0_SMR(0));
 		smr = readl_relaxed(gr0_base + ARM_SMMU_GR0_SMR(0));
+		smmu->streamid_mask = smr >> SMR_ID_SHIFT;
 
-		mask = (smr >> SMR_MASK_SHIFT) & SMR_MASK_MASK;
-		sid = (smr >> SMR_ID_SHIFT) & SMR_ID_MASK;
-		if ((mask & sid) != sid) {
-			dev_err(smmu->dev,
-				"SMR mask bits (0x%x) insufficient for ID field (0x%x)\n",
-				mask, sid);
-			return -ENODEV;
-		}
+		smr = smmu->streamid_mask << SMR_MASK_SHIFT;
+		writel_relaxed(smr, gr0_base + ARM_SMMU_GR0_SMR(0));
+		smr = readl_relaxed(gr0_base + ARM_SMMU_GR0_SMR(0));
+		smmu->smr_mask_mask = smr >> SMR_MASK_SHIFT;
 
 		dev_notice(smmu->dev,
-			   "\tstream matching with %u register groups, mask 0x%x\n",
-			   smmu->num_mapping_groups, mask);
-	} else {
-		smmu->num_mapping_groups = (id >> ID0_NUMSIDB_SHIFT) &
-					   ID0_NUMSIDB_MASK;
+			   "\tstream matching with %lu register groups, mask 0x%x",
+			   size, smmu->smr_mask_mask);
 	}
+	smmu->num_mapping_groups = size;
 
 	/* ID1 */
 	id = readl_relaxed(gr0_base + ARM_SMMU_GR0_ID1);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:45:55 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:45:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110723.211373 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjaN-0003Pp-7Y; Wed, 14 Apr 2021 17:45:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110723.211373; Wed, 14 Apr 2021 17:45: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 1lWjaN-0003Ph-3v; Wed, 14 Apr 2021 17:45:55 +0000
Received: by outflank-mailman (input) for mailman id 110723;
 Wed, 14 Apr 2021 17:45: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 1lWjaM-0003PZ-6z
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:45: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 1lWjaM-00070b-6G
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:45:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjaM-0005wS-5S
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:45: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=6+1LYWTUAqyg8mjS+0dmP8BuNrNvktY2kBX+C4sUiS0=; b=VaV45j2jSWxIuWCIfy9Zp2TSG5
	VCj8MBhTQt9VMVWNEUz3h3fvisCDcb2kpVo9fDBB2B5CpY8NWn1mEEIBsyIM/JyE9kEPhBhkkESm8
	SBVXQxf/AINVKi+pvH+soFZExjxHkKdmDr/eX8SsMaTf6K9WKjb2KMXYKFi4jOUjH3n0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: smmuv1: Consolidate stream map entry state
Message-Id: <E1lWjaM-0005wS-5S@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:45:54 +0000

commit 5e08586afbb90b2e2d56c175c07db77a4afa873c
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Mon Mar 22 16:11:36 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xen/arm: smmuv1: Consolidate stream map entry state
    
    Backport commit 1f3d5ca43019bff1105838712d55be087d93c0da
    "iommu/arm-smmu: Consolidate stream map entry state" from the Linux
    kernel.
    
    This patch is the preparatory work to fix the stream match conflict
    when two devices have the same stream-id.
    
    Original commit message:
        iommu/arm-smmu: Consolidate stream map entry state
    
        In order to consider SMR masking, we really want to be able to validate
        ID/mask pairs against existing SMR contents to prevent stream match
        conflicts, which at best would cause transactions to fault unexpectedly,
        and at worst lead to silent unpredictable behaviour. With our SMMU
        instance data holding only an allocator bitmap, and the SMR values
        themselves scattered across master configs hanging off devices which we
        may have no way of finding, there's essentially no way short of digging
        everything back out of the hardware. Similarly, the thought of power
        management ops to support suspend/resume faces the exact same problem.
    
        By massaging the software state into a closer shape to the underlying
        hardware, everything comes together quite nicely; the allocator and the
        high-level view of the data become a single centralised state which we
        can easily keep track of, and to which any updates can be validated in
        full before being synchronised to the hardware itself.
    
        Signed-off-by: Robin Murphy <robin.murphy@arm.com>
        Signed-off-by: Will Deacon <will.deacon@arm.com>
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/smmu.c | 138 +++++++++++++++++++++----------------
 1 file changed, 79 insertions(+), 59 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index adfab8ee84..c41e94f836 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -308,9 +308,6 @@ static struct iommu_group *iommu_group_get(struct device *dev)
 /* Maximum number of context banks per SMMU */
 #define ARM_SMMU_MAX_CBS		128
 
-/* Maximum number of mapping groups per SMMU */
-#define ARM_SMMU_MAX_SMRS		128
-
 /* SMMU global address space */
 #define ARM_SMMU_GR0(smmu)		((smmu)->base)
 #define ARM_SMMU_GR1(smmu)		((smmu)->base + (1 << (smmu)->pgshift))
@@ -589,16 +586,17 @@ enum arm_smmu_arch_version {
 };
 
 struct arm_smmu_smr {
-	u8				idx;
 	u16				mask;
 	u16				id;
+	bool				valid;
 };
 
 struct arm_smmu_master_cfg {
 	int				num_streamids;
 	u16				streamids[MAX_MASTER_STREAMIDS];
-	struct arm_smmu_smr		*smrs;
+	s16				smendx[MAX_MASTER_STREAMIDS];
 };
+#define INVALID_SMENDX			-1
 
 struct arm_smmu_master {
 	struct device_node		*of_node;
@@ -632,7 +630,7 @@ struct arm_smmu_device {
 	u32				num_mapping_groups;
 	u16				streamid_mask;
 	u16				smr_mask_mask;
-	DECLARE_BITMAP(smr_map, ARM_SMMU_MAX_SMRS);
+	struct arm_smmu_smr		*smrs;
 
 	unsigned long			s1_input_size;
 	unsigned long			s1_output_size;
@@ -818,6 +816,7 @@ static int register_smmu_master(struct arm_smmu_device *smmu,
 			return -ERANGE;
 		}
 		master->cfg.streamids[i] = streamid;
+		master->cfg.smendx[i] = INVALID_SMENDX;
 	}
 	return insert_smmu_master(smmu, master);
 }
@@ -1384,79 +1383,91 @@ static void arm_smmu_domain_destroy(struct iommu_domain *domain)
 	kfree(smmu_domain);
 }
 
-static int arm_smmu_master_configure_smrs(struct arm_smmu_device *smmu,
-					  struct arm_smmu_master_cfg *cfg)
+static int arm_smmu_alloc_smr(struct arm_smmu_device *smmu)
 {
 	int i;
-	struct arm_smmu_smr *smrs;
-	void __iomem *gr0_base = ARM_SMMU_GR0(smmu);
 
-	if (!(smmu->features & ARM_SMMU_FEAT_STREAM_MATCH))
-		return 0;
+	for (i = 0; i < smmu->num_mapping_groups; i++)
+		if (!cmpxchg(&smmu->smrs[i].valid, false, true))
+			return i;
 
-	if (cfg->smrs)
-		return -EEXIST;
+	return INVALID_SMENDX;
+}
 
-	smrs = kmalloc_array(cfg->num_streamids, sizeof(*smrs), GFP_KERNEL);
-	if (!smrs) {
-		dev_err(smmu->dev, "failed to allocate %d SMRs\n",
-			cfg->num_streamids);
-		return -ENOMEM;
-	}
+static void arm_smmu_free_smr(struct arm_smmu_device *smmu, int idx)
+{
+	writel_relaxed(~SMR_VALID, ARM_SMMU_GR0(smmu) + ARM_SMMU_GR0_SMR(idx));
+	write_atomic(&smmu->smrs[idx].valid, false);
+}
+
+static void arm_smmu_write_smr(struct arm_smmu_device *smmu, int idx)
+{
+	struct arm_smmu_smr *smr = smmu->smrs + idx;
+	u32 reg = (smr->id & smmu->streamid_mask) << SMR_ID_SHIFT |
+		  (smr->mask & smmu->smr_mask_mask) << SMR_MASK_SHIFT;
+
+	if (smr->valid)
+		reg |= SMR_VALID;
+	writel_relaxed(reg, ARM_SMMU_GR0(smmu) + ARM_SMMU_GR0_SMR(idx));
+}
+
+static int arm_smmu_master_alloc_smes(struct arm_smmu_device *smmu,
+				      struct arm_smmu_master_cfg *cfg)
+{
+	struct arm_smmu_smr *smrs = smmu->smrs;
+	int i, idx;
 
 	/* Allocate the SMRs on the SMMU */
 	for (i = 0; i < cfg->num_streamids; ++i) {
-		int idx = __arm_smmu_alloc_bitmap(smmu->smr_map, 0,
-						  smmu->num_mapping_groups);
+		if (cfg->smendx[i] != INVALID_SMENDX)
+			return -EEXIST;
+
+		/* ...except on stream indexing hardware, of course */
+		if (!smrs) {
+			cfg->smendx[i] = cfg->streamids[i];
+			continue;
+		}
+
+		idx = arm_smmu_alloc_smr(smmu);
 		if (IS_ERR_VALUE(idx)) {
 			dev_err(smmu->dev, "failed to allocate free SMR\n");
 			goto err_free_smrs;
 		}
+		cfg->smendx[i] = idx;
 
-		smrs[i] = (struct arm_smmu_smr) {
-			.idx	= idx,
-			.mask	= 0, /* We don't currently share SMRs */
-			.id	= cfg->streamids[i],
-		};
+		smrs[idx].id = cfg->streamids[i];
+		smrs[idx].mask = 0; /* We don't currently share SMRs */
 	}
 
+	if (!smrs)
+		return 0;
+
 	/* It worked! Now, poke the actual hardware */
-	for (i = 0; i < cfg->num_streamids; ++i) {
-		u32 reg = SMR_VALID | smrs[i].id << SMR_ID_SHIFT |
-			  smrs[i].mask << SMR_MASK_SHIFT;
-		writel_relaxed(reg, gr0_base + ARM_SMMU_GR0_SMR(smrs[i].idx));
-	}
+	for (i = 0; i < cfg->num_streamids; ++i)
+		arm_smmu_write_smr(smmu, cfg->smendx[i]);
 
-	cfg->smrs = smrs;
 	return 0;
 
 err_free_smrs:
-	while (--i >= 0)
-		__arm_smmu_free_bitmap(smmu->smr_map, smrs[i].idx);
-	kfree(smrs);
+	while (i--) {
+		arm_smmu_free_smr(smmu, cfg->smendx[i]);
+		cfg->smendx[i] = INVALID_SMENDX;
+	}
 	return -ENOSPC;
 }
 
-static void arm_smmu_master_free_smrs(struct arm_smmu_device *smmu,
+static void arm_smmu_master_free_smes(struct arm_smmu_device *smmu,
 				      struct arm_smmu_master_cfg *cfg)
 {
 	int i;
-	void __iomem *gr0_base = ARM_SMMU_GR0(smmu);
-	struct arm_smmu_smr *smrs = cfg->smrs;
-
-	if (!smrs)
-		return;
 
 	/* Invalidate the SMRs before freeing back to the allocator */
 	for (i = 0; i < cfg->num_streamids; ++i) {
-		u8 idx = smrs[i].idx;
+		if (smmu->smrs)
+			arm_smmu_free_smr(smmu, cfg->smendx[i]);
 
-		writel_relaxed(~SMR_VALID, gr0_base + ARM_SMMU_GR0_SMR(idx));
-		__arm_smmu_free_bitmap(smmu->smr_map, idx);
+		cfg->smendx[i] = INVALID_SMENDX;
 	}
-
-	cfg->smrs = NULL;
-	kfree(smrs);
 }
 
 static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
@@ -1467,14 +1478,14 @@ static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
 	void __iomem *gr0_base = ARM_SMMU_GR0(smmu);
 
 	/* Devices in an IOMMU group may already be configured */
-	ret = arm_smmu_master_configure_smrs(smmu, cfg);
+	ret = arm_smmu_master_alloc_smes(smmu, cfg);
 	if (ret)
 		return ret == -EEXIST ? 0 : ret;
 
 	for (i = 0; i < cfg->num_streamids; ++i) {
 		u32 idx, s2cr;
 
-		idx = cfg->smrs ? cfg->smrs[i].idx : cfg->streamids[i];
+		idx = cfg->smendx[i];
 		s2cr = S2CR_TYPE_TRANS |
 		       (smmu_domain->cfg.cbndx << S2CR_CBNDX_SHIFT);
 		writel_relaxed(s2cr, gr0_base + ARM_SMMU_GR0_S2CR(idx));
@@ -1490,23 +1501,23 @@ static void arm_smmu_domain_remove_master(struct arm_smmu_domain *smmu_domain,
 	struct arm_smmu_device *smmu = smmu_domain->smmu;
 	void __iomem *gr0_base = ARM_SMMU_GR0(smmu);
 
-	/* An IOMMU group is torn down by the first device to be removed */
-	if ((smmu->features & ARM_SMMU_FEAT_STREAM_MATCH) && !cfg->smrs)
-		return;
-
 	/*
 	 * We *must* clear the S2CR first, because freeing the SMR means
 	 * that it can be re-allocated immediately.
 	 * Xen: Unlike Linux, any access to non-configured stream will fault.
 	 */
 	for (i = 0; i < cfg->num_streamids; ++i) {
-		u32 idx = cfg->smrs ? cfg->smrs[i].idx : cfg->streamids[i];
+		int idx = cfg->smendx[i];
+
+		/* An IOMMU group is torn down by the first device to be removed */
+		if (idx == INVALID_SMENDX)
+			return;
 
 		writel_relaxed(S2CR_TYPE_FAULT,
 			       gr0_base + ARM_SMMU_GR0_S2CR(idx));
 	}
 
-	arm_smmu_master_free_smrs(smmu, cfg);
+	arm_smmu_master_free_smes(smmu, cfg);
 }
 
 static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
@@ -2017,16 +2028,20 @@ static void arm_smmu_device_reset(struct arm_smmu_device *smmu)
 {
 	void __iomem *gr0_base = ARM_SMMU_GR0(smmu);
 	void __iomem *cb_base;
-	int i = 0;
+	int i;
 	u32 reg;
 
 	/* clear global FSR */
 	reg = readl_relaxed(ARM_SMMU_GR0_NS(smmu) + ARM_SMMU_GR0_sGFSR);
 	writel(reg, ARM_SMMU_GR0_NS(smmu) + ARM_SMMU_GR0_sGFSR);
 
-	/* Mark all SMRn as invalid and all S2CRn as bypass */
+	/*
+	 * Reset stream mapping groups: Initial values mark all SMRn as
+	 * invalid and all S2CRn as bypass unless overridden.
+	 */
 	for (i = 0; i < smmu->num_mapping_groups; ++i) {
-		writel_relaxed(0, gr0_base + ARM_SMMU_GR0_SMR(i));
+		if (smmu->smrs)
+			arm_smmu_write_smr(smmu, i);
 		/*
 		 * Xen: Unlike Linux, any access to a non-configure stream
 		 * will fault by default.
@@ -2169,6 +2184,11 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu)
 		smr = readl_relaxed(gr0_base + ARM_SMMU_GR0_SMR(0));
 		smmu->smr_mask_mask = smr >> SMR_MASK_SHIFT;
 
+		/* Zero-initialised to mark as invalid */
+		smmu->smrs = devm_kzalloc(smmu->dev, sizeof(*smmu->smrs), GFP_KERNEL);
+		if (!smmu->smrs)
+			return -ENOMEM;
+
 		dev_notice(smmu->dev,
 			   "\tstream matching with %lu register groups, mask 0x%x",
 			   size, smmu->smr_mask_mask);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:46:06 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:46:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110724.211378 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjaY-0003R4-AW; Wed, 14 Apr 2021 17:46:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110724.211378; Wed, 14 Apr 2021 17:46: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 1lWjaY-0003Qw-7V; Wed, 14 Apr 2021 17:46:06 +0000
Received: by outflank-mailman (input) for mailman id 110724;
 Wed, 14 Apr 2021 17:46: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 1lWjaW-0003Qg-AS
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:46: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 1lWjaW-00072V-9h
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:46:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjaW-0005xb-8x
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:46: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=5u0k4bfbttOqyXjMWHE7yogQ/SIXjh587fE7mQJma5o=; b=rTyIeTQI+iMoGfIP2wk2icY+zx
	M7ahxPrw/Xh7dCoauxY8s1/MT3Ob4OuKs3cdOVP8r6zEj8YvbDnrGcUsdmmk8GQHvY543XjCJLkzd
	AaEsGCgOiQLp1yTRVPqtDE65qQbCB5PTjTBvm1ZiWoBxRYTuZJoBCDPJK/Kfq3AV3qrQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: smmuv1: Keep track of S2CR state
Message-Id: <E1lWjaW-0005xb-8x@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:46:04 +0000

commit 06d1f7a278ddf4344efbb28c3360901b5a79ab75
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Mon Mar 22 16:11:37 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xen/arm: smmuv1: Keep track of S2CR state
    
    Backport commit 8e8b203eabd8b9e96d02d6339e4abce3e5a7ea4b
    "iommu/arm-smmu: Keep track of S2CR state" from the Linux kernel.
    
    This patch is the preparatory work to fix the stream match conflict
    when two devices have the same stream-id.
    
    Original commit message:
        iommu/arm-smmu: Keep track of S2CR state
    
        Making S2CRs first-class citizens within the driver with a high-level
        representation of their state offers a neat solution to a few problems:
    
        Firstly, the information about which context a device's stream IDs are
        associated with is already present by necessity in the S2CR. With that
        state easily accessible we can refer directly to it and obviate the need
        to track an IOMMU domain in each device's archdata (its earlier purpose
        of enforcing correct attachment of multi-device groups now being handled
        by the IOMMU core itself).
    
        Secondly, the core API now deprecates explicit domain detach and expects
        domain attach to move devices smoothly from one domain to another; for
        SMMUv2, this notion maps directly to simply rewriting the S2CRs assigned
        to the device. By giving the driver a suitable abstraction of those
        S2CRs to work with, we can massively reduce the overhead of the current
        heavy-handed "detach, free resources, reallocate resources, attach"
        approach.
    
        Thirdly, making the software state hardware-shaped and attached to the
        SMMU instance once again makes suspend/resume of this register group
        that much simpler to implement in future.
    
        Signed-off-by: Robin Murphy <robin.murphy@arm.com>
        Signed-off-by: Will Deacon <will.deacon@arm.com>
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/smmu.c | 150 ++++++++++++++++++++++---------------
 1 file changed, 89 insertions(+), 61 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index c41e94f836..e1b937bd4b 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -444,9 +444,20 @@ static struct iommu_group *iommu_group_get(struct device *dev)
 #define S2CR_CBNDX_MASK			0xff
 #define S2CR_TYPE_SHIFT			16
 #define S2CR_TYPE_MASK			0x3
-#define S2CR_TYPE_TRANS			(0 << S2CR_TYPE_SHIFT)
-#define S2CR_TYPE_BYPASS		(1 << S2CR_TYPE_SHIFT)
-#define S2CR_TYPE_FAULT			(2 << S2CR_TYPE_SHIFT)
+enum arm_smmu_s2cr_type {
+	S2CR_TYPE_TRANS,
+	S2CR_TYPE_BYPASS,
+	S2CR_TYPE_FAULT,
+};
+
+#define S2CR_PRIVCFG_SHIFT		24
+#define S2CR_PRIVCFG_MASK		0x3
+enum arm_smmu_s2cr_privcfg {
+	S2CR_PRIVCFG_DEFAULT,
+	S2CR_PRIVCFG_DIPAN,
+	S2CR_PRIVCFG_UNPRIV,
+	S2CR_PRIVCFG_PRIV,
+};
 
 /* Context bank attribute registers */
 #define ARM_SMMU_GR1_CBAR(n)		(0x0 + ((n) << 2))
@@ -585,6 +596,16 @@ enum arm_smmu_arch_version {
 	ARM_SMMU_V2,
 };
 
+struct arm_smmu_s2cr {
+	enum arm_smmu_s2cr_type		type;
+	enum arm_smmu_s2cr_privcfg	privcfg;
+	u8				cbndx;
+};
+
+#define s2cr_init_val (struct arm_smmu_s2cr){				\
+	.type = S2CR_TYPE_FAULT                                 \
+}
+
 struct arm_smmu_smr {
 	u16				mask;
 	u16				id;
@@ -631,6 +652,7 @@ struct arm_smmu_device {
 	u16				streamid_mask;
 	u16				smr_mask_mask;
 	struct arm_smmu_smr		*smrs;
+	struct arm_smmu_s2cr		*s2crs;
 
 	unsigned long			s1_input_size;
 	unsigned long			s1_output_size;
@@ -1411,6 +1433,23 @@ static void arm_smmu_write_smr(struct arm_smmu_device *smmu, int idx)
 	writel_relaxed(reg, ARM_SMMU_GR0(smmu) + ARM_SMMU_GR0_SMR(idx));
 }
 
+static void arm_smmu_write_s2cr(struct arm_smmu_device *smmu, int idx)
+{
+	struct arm_smmu_s2cr *s2cr = smmu->s2crs + idx;
+	u32 reg = (s2cr->type & S2CR_TYPE_MASK) << S2CR_TYPE_SHIFT |
+		  (s2cr->cbndx & S2CR_CBNDX_MASK) << S2CR_CBNDX_SHIFT |
+		  (s2cr->privcfg & S2CR_PRIVCFG_MASK) << S2CR_PRIVCFG_SHIFT;
+
+	writel_relaxed(reg, ARM_SMMU_GR0(smmu) + ARM_SMMU_GR0_S2CR(idx));
+}
+
+static void arm_smmu_write_sme(struct arm_smmu_device *smmu, int idx)
+{
+	arm_smmu_write_s2cr(smmu, idx);
+	if (smmu->smrs)
+		arm_smmu_write_smr(smmu, idx);
+}
+
 static int arm_smmu_master_alloc_smes(struct arm_smmu_device *smmu,
 				      struct arm_smmu_master_cfg *cfg)
 {
@@ -1461,6 +1500,23 @@ static void arm_smmu_master_free_smes(struct arm_smmu_device *smmu,
 {
 	int i;
 
+	/*
+	 * We *must* clear the S2CR first, because freeing the SMR means
+	 * that it can be re-allocated immediately.
+	 */
+	for (i = 0; i < cfg->num_streamids; ++i) {
+		int idx = cfg->smendx[i];
+
+		/* An IOMMU group is torn down by the first device to be removed */
+		if (idx == INVALID_SMENDX)
+			return;
+
+		smmu->s2crs[idx] = s2cr_init_val;
+		arm_smmu_write_s2cr(smmu, idx);
+	}
+	/* Sync S2CR updates before touching anything else */
+	__iowmb();
+
 	/* Invalidate the SMRs before freeing back to the allocator */
 	for (i = 0; i < cfg->num_streamids; ++i) {
 		if (smmu->smrs)
@@ -1473,51 +1529,30 @@ static void arm_smmu_master_free_smes(struct arm_smmu_device *smmu,
 static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
 				      struct arm_smmu_master_cfg *cfg)
 {
-	int i, ret;
+	int i, ret = 0;
 	struct arm_smmu_device *smmu = smmu_domain->smmu;
-	void __iomem *gr0_base = ARM_SMMU_GR0(smmu);
+	struct arm_smmu_s2cr *s2cr = smmu->s2crs;
+	enum arm_smmu_s2cr_type type = S2CR_TYPE_TRANS;
+	u8 cbndx = smmu_domain->cfg.cbndx;
 
-	/* Devices in an IOMMU group may already be configured */
-	ret = arm_smmu_master_alloc_smes(smmu, cfg);
+	if (cfg->smendx[0] == INVALID_SMENDX)
+		ret = arm_smmu_master_alloc_smes(smmu, cfg);
 	if (ret)
-		return ret == -EEXIST ? 0 : ret;
-
-	for (i = 0; i < cfg->num_streamids; ++i) {
-		u32 idx, s2cr;
-
-		idx = cfg->smendx[i];
-		s2cr = S2CR_TYPE_TRANS |
-		       (smmu_domain->cfg.cbndx << S2CR_CBNDX_SHIFT);
-		writel_relaxed(s2cr, gr0_base + ARM_SMMU_GR0_S2CR(idx));
-	}
-
-	return 0;
-}
-
-static void arm_smmu_domain_remove_master(struct arm_smmu_domain *smmu_domain,
-					  struct arm_smmu_master_cfg *cfg)
-{
-	int i;
-	struct arm_smmu_device *smmu = smmu_domain->smmu;
-	void __iomem *gr0_base = ARM_SMMU_GR0(smmu);
+		return ret;
 
-	/*
-	 * We *must* clear the S2CR first, because freeing the SMR means
-	 * that it can be re-allocated immediately.
-	 * Xen: Unlike Linux, any access to non-configured stream will fault.
-	 */
 	for (i = 0; i < cfg->num_streamids; ++i) {
 		int idx = cfg->smendx[i];
 
-		/* An IOMMU group is torn down by the first device to be removed */
-		if (idx == INVALID_SMENDX)
-			return;
+		/* Devices in an IOMMU group may already be configured */
+		if (type == s2cr[idx].type && cbndx == s2cr[idx].cbndx)
+			break;
 
-		writel_relaxed(S2CR_TYPE_FAULT,
-			       gr0_base + ARM_SMMU_GR0_S2CR(idx));
+		s2cr[idx].type = type ;
+		s2cr[idx].privcfg = S2CR_PRIVCFG_UNPRIV;
+		s2cr[idx].cbndx = cbndx;
+		arm_smmu_write_s2cr(smmu, idx);
 	}
-
-	arm_smmu_master_free_smes(smmu, cfg);
+	return 0;
 }
 
 static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
@@ -1564,24 +1599,17 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
 	if (!cfg)
 		return -ENODEV;
 
-	ret = arm_smmu_domain_add_master(smmu_domain, cfg);
-
-	if (!ret)
-		dev_iommu_domain(dev) = domain;
-	return ret;
+	return arm_smmu_domain_add_master(smmu_domain, cfg);
 }
 
 static void arm_smmu_detach_dev(struct iommu_domain *domain, struct device *dev)
 {
-	struct arm_smmu_domain *smmu_domain = domain->priv;
-	struct arm_smmu_master_cfg *cfg;
+	struct arm_smmu_device *smmu = find_smmu_for_device(dev);
+	struct arm_smmu_master_cfg *cfg = find_smmu_master_cfg(dev);
 
-	cfg = find_smmu_master_cfg(dev);
-	if (!cfg)
-		return;
+	if (smmu && cfg)
+		arm_smmu_master_free_smes(smmu, cfg);
 
-	dev_iommu_domain(dev) = NULL;
-	arm_smmu_domain_remove_master(smmu_domain, cfg);
 }
 
 #if 0 /*
@@ -2039,16 +2067,8 @@ static void arm_smmu_device_reset(struct arm_smmu_device *smmu)
 	 * Reset stream mapping groups: Initial values mark all SMRn as
 	 * invalid and all S2CRn as bypass unless overridden.
 	 */
-	for (i = 0; i < smmu->num_mapping_groups; ++i) {
-		if (smmu->smrs)
-			arm_smmu_write_smr(smmu, i);
-		/*
-		 * Xen: Unlike Linux, any access to a non-configure stream
-		 * will fault by default.
-		 */
-		writel_relaxed(S2CR_TYPE_FAULT,
-			gr0_base + ARM_SMMU_GR0_S2CR(i));
-	}
+	for (i = 0; i < smmu->num_mapping_groups; ++i)
+		arm_smmu_write_sme(smmu, i);
 
 	/* Make sure all context banks are disabled and clear CB_FSR  */
 	for (i = 0; i < smmu->num_context_banks; ++i) {
@@ -2110,6 +2130,7 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu)
 	unsigned long size;
 	void __iomem *gr0_base = ARM_SMMU_GR0(smmu);
 	u32 id;
+	int i;
 
 	dev_notice(smmu->dev, "probing hardware configuration...\n");
 	dev_notice(smmu->dev, "SMMUv%d with:\n", smmu->version);
@@ -2193,6 +2214,13 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu)
 			   "\tstream matching with %lu register groups, mask 0x%x",
 			   size, smmu->smr_mask_mask);
 	}
+	/* s2cr->type == 0 means translation, so initialise explicitly */
+	smmu->s2crs = kmalloc_array(size, sizeof(*smmu->s2crs), GFP_KERNEL);
+	if (!smmu->s2crs)
+		return -ENOMEM;
+	for (i = 0; i < size; i++)
+		smmu->s2crs[i] = s2cr_init_val;
+
 	smmu->num_mapping_groups = size;
 
 	/* ID1 */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:46:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:46:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110726.211394 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjai-0003Uk-JS; Wed, 14 Apr 2021 17:46:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110726.211394; Wed, 14 Apr 2021 17:46: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 1lWjai-0003Uc-GN; Wed, 14 Apr 2021 17:46:16 +0000
Received: by outflank-mailman (input) for mailman id 110726;
 Wed, 14 Apr 2021 17:46: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 1lWjag-0003Ty-Dl
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:46: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 1lWjag-00072b-D3
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:46:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjag-0005yq-CG
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:46: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=GPZJyAbZWyGRmQiRn7ZhkWHrRt9WtD6tWV+vRPm50UE=; b=m6S/WPxms+FrP3Tkt7O3WaRi/G
	+5YuxyHFYPUZfI1RGyaLoekr0IFGkJDX+a+C+uAxSDwbcoQi4jVM3H7VoyxpzFqvgtoi33jzEuaq8
	7PwOne4fh+Nw7riJkRgX2rlx3YTyfLKEBGMIYPson8gOsbr8FH+kJTrR5N3dFAkqwCsY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: smmuv1: Add a stream map entry iterator
Message-Id: <E1lWjag-0005yq-CG@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:46:14 +0000

commit e1d96fa2832d458ec6405b41a7202063421f5dc3
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Mon Mar 22 16:11:38 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xen/arm: smmuv1: Add a stream map entry iterator
    
    Backport commit d3097e39302083d58922a3d1032d7d59a63d263d
    "iommu/arm-smmu: Add a stream map entry iterator" from the Linux kernel.
    
    This patch is the preparatory work to fix the stream match conflict
    when two devices have the same stream-id.
    
    Original commit message:
        iommu/arm-smmu: Add a stream map entry iterator
    
        We iterate over the SMEs associated with a master config quite a lot in
        various places, and are about to do so even more. Let's wrap the idiom
        in a handy iterator macro before the repetition gets out of hand.
    
        Tested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
        Signed-off-by: Robin Murphy <robin.murphy@arm.com>
        Signed-off-by: Will Deacon <will.deacon@arm.com>
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/smmu.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index e1b937bd4b..2c1ea8e6ff 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -618,6 +618,8 @@ struct arm_smmu_master_cfg {
 	s16				smendx[MAX_MASTER_STREAMIDS];
 };
 #define INVALID_SMENDX			-1
+#define for_each_cfg_sme(cfg, i, idx) \
+	for (i = 0; idx = cfg->smendx[i], i < cfg->num_streamids; ++i)
 
 struct arm_smmu_master {
 	struct device_node		*of_node;
@@ -1457,8 +1459,8 @@ static int arm_smmu_master_alloc_smes(struct arm_smmu_device *smmu,
 	int i, idx;
 
 	/* Allocate the SMRs on the SMMU */
-	for (i = 0; i < cfg->num_streamids; ++i) {
-		if (cfg->smendx[i] != INVALID_SMENDX)
+	for_each_cfg_sme(cfg, i, idx) {
+		if (idx != INVALID_SMENDX)
 			return -EEXIST;
 
 		/* ...except on stream indexing hardware, of course */
@@ -1482,8 +1484,8 @@ static int arm_smmu_master_alloc_smes(struct arm_smmu_device *smmu,
 		return 0;
 
 	/* It worked! Now, poke the actual hardware */
-	for (i = 0; i < cfg->num_streamids; ++i)
-		arm_smmu_write_smr(smmu, cfg->smendx[i]);
+	for_each_cfg_sme(cfg, i, idx)
+		arm_smmu_write_smr(smmu, idx);
 
 	return 0;
 
@@ -1498,15 +1500,13 @@ err_free_smrs:
 static void arm_smmu_master_free_smes(struct arm_smmu_device *smmu,
 				      struct arm_smmu_master_cfg *cfg)
 {
-	int i;
+	int i, idx;
 
 	/*
 	 * We *must* clear the S2CR first, because freeing the SMR means
 	 * that it can be re-allocated immediately.
 	 */
-	for (i = 0; i < cfg->num_streamids; ++i) {
-		int idx = cfg->smendx[i];
-
+	for_each_cfg_sme(cfg, i, idx) {
 		/* An IOMMU group is torn down by the first device to be removed */
 		if (idx == INVALID_SMENDX)
 			return;
@@ -1518,9 +1518,9 @@ static void arm_smmu_master_free_smes(struct arm_smmu_device *smmu,
 	__iowmb();
 
 	/* Invalidate the SMRs before freeing back to the allocator */
-	for (i = 0; i < cfg->num_streamids; ++i) {
+	for_each_cfg_sme(cfg, i, idx) {
 		if (smmu->smrs)
-			arm_smmu_free_smr(smmu, cfg->smendx[i]);
+			arm_smmu_free_smr(smmu, idx);
 
 		cfg->smendx[i] = INVALID_SMENDX;
 	}
@@ -1529,7 +1529,7 @@ static void arm_smmu_master_free_smes(struct arm_smmu_device *smmu,
 static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
 				      struct arm_smmu_master_cfg *cfg)
 {
-	int i, ret = 0;
+	int i, idx, ret = 0;
 	struct arm_smmu_device *smmu = smmu_domain->smmu;
 	struct arm_smmu_s2cr *s2cr = smmu->s2crs;
 	enum arm_smmu_s2cr_type type = S2CR_TYPE_TRANS;
@@ -1540,9 +1540,7 @@ static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
 	if (ret)
 		return ret;
 
-	for (i = 0; i < cfg->num_streamids; ++i) {
-		int idx = cfg->smendx[i];
-
+	for_each_cfg_sme(cfg, i, idx) {
 		/* Devices in an IOMMU group may already be configured */
 		if (type == s2cr[idx].type && cbndx == s2cr[idx].cbndx)
 			break;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:46:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:46:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110727.211397 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjar-0003Xk-Kx; Wed, 14 Apr 2021 17:46:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110727.211397; Wed, 14 Apr 2021 17:46: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 1lWjar-0003Xd-I0; Wed, 14 Apr 2021 17:46:25 +0000
Received: by outflank-mailman (input) for mailman id 110727;
 Wed, 14 Apr 2021 17:46: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 1lWjaq-0003XI-H1
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:46: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 1lWjaq-00072z-GI
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:46:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjaq-0005zu-Ff
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:46: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=W5wGeXa0kw6GMNJRE/tqwFB1H6U7dbsF0yy0xMQghGc=; b=1rp9yNW6WngKcFkdXwS8KWcTO+
	VCig1Wt6SCkZaGvYrzsEjXjn3fSwNbZhl31Dm7XUzDa3ktBJM43YVPYIsWOY355GrJlPRH1vKsFlK
	36ylgTOFdbwL8fKY5amkZLztZozluXClfiXCbbJ/2mp9afeFLUJFjN2P7ojP0pB7VLIQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: smmuv1: Intelligent SMR allocation
Message-Id: <E1lWjaq-0005zu-Ff@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:46:24 +0000

commit 0435784cc75dcfef3b5f59c29deb1dbb84265ddb
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Mon Mar 22 16:11:39 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 1 17:12:05 2021 +0100

    xen/arm: smmuv1: Intelligent SMR allocation
    
    Backport 588888a7399db352d2b1a41c9d5b3bf0fd482390
    "iommu/arm-smmu: Intelligent SMR allocation" from the Linux kernel
    
    This patch fix the stream match conflict issue when two devices have the
    same stream-id.
    
    Only difference while applying this patch with regard to Linux patch are
    as follows:
    1. Spinlock is used in place of mutex when attaching a device to the
       SMMU via arm_smmu_master_alloc_smes(..) function call.Replacing the
       mutex with spinlock is fine here as we are configuring the hardware
       via registers and it is very fast.
    
    2. move iommu_group_alloc(..) function call in arm_smmu_add_device(..)
       function from the start of the function to the end.
    
    Original commit message:
        iommu/arm-smmu: Intelligent SMR allocation
    
        Stream Match Registers are one of the more awkward parts of the SMMUv2
        architecture; there are typically never enough to assign one to each
        stream ID in the system, and configuring them such that a single ID
        matches multiple entries is catastrophically bad - at best, every
        transaction raises a global fault; at worst, they go *somewhere*.
    
        To address the former issue, we can mask ID bits such that a single
        register may be used to match multiple IDs belonging to the same device
        or group, but doing so also heightens the risk of the latter problem
        (which can be nasty to debug).
    
        Tackle both problems at once by replacing the simple bitmap allocator
        with something much cleverer. Now that we have convenient in-memory
        representations of the stream mapping table, it becomes straightforward
        to properly validate new SMR entries against the current state, opening
        the door to arbitrary masking and SMR sharing.
    
        Another feature which falls out of this is that with IDs shared by
        separate devices being automatically accounted for, simply associating a
        group pointer with the S2CR offers appropriate group allocation almost
        for free, so hook that up in the process.
    
        Signed-off-by: Robin Murphy <robin.murphy@arm.com>
        Signed-off-by: Will Deacon <will.deacon@arm.com>
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien GralL <jgrall@amazon.com>
---
 xen/drivers/passthrough/arm/smmu.c | 230 +++++++++++++++++++++++--------------
 1 file changed, 142 insertions(+), 88 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index 2c1ea8e6ff..20ac672e91 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -597,6 +597,8 @@ enum arm_smmu_arch_version {
 };
 
 struct arm_smmu_s2cr {
+	struct iommu_group		*group;
+	int				count;
 	enum arm_smmu_s2cr_type		type;
 	enum arm_smmu_s2cr_privcfg	privcfg;
 	u8				cbndx;
@@ -613,6 +615,7 @@ struct arm_smmu_smr {
 };
 
 struct arm_smmu_master_cfg {
+	struct arm_smmu_device		*smmu;
 	int				num_streamids;
 	u16				streamids[MAX_MASTER_STREAMIDS];
 	s16				smendx[MAX_MASTER_STREAMIDS];
@@ -655,6 +658,7 @@ struct arm_smmu_device {
 	u16				smr_mask_mask;
 	struct arm_smmu_smr		*smrs;
 	struct arm_smmu_s2cr		*s2crs;
+	spinlock_t			stream_map_lock;
 
 	unsigned long			s1_input_size;
 	unsigned long			s1_output_size;
@@ -1407,23 +1411,6 @@ static void arm_smmu_domain_destroy(struct iommu_domain *domain)
 	kfree(smmu_domain);
 }
 
-static int arm_smmu_alloc_smr(struct arm_smmu_device *smmu)
-{
-	int i;
-
-	for (i = 0; i < smmu->num_mapping_groups; i++)
-		if (!cmpxchg(&smmu->smrs[i].valid, false, true))
-			return i;
-
-	return INVALID_SMENDX;
-}
-
-static void arm_smmu_free_smr(struct arm_smmu_device *smmu, int idx)
-{
-	writel_relaxed(~SMR_VALID, ARM_SMMU_GR0(smmu) + ARM_SMMU_GR0_SMR(idx));
-	write_atomic(&smmu->smrs[idx].valid, false);
-}
-
 static void arm_smmu_write_smr(struct arm_smmu_device *smmu, int idx)
 {
 	struct arm_smmu_smr *smr = smmu->smrs + idx;
@@ -1452,98 +1439,143 @@ static void arm_smmu_write_sme(struct arm_smmu_device *smmu, int idx)
 		arm_smmu_write_smr(smmu, idx);
 }
 
-static int arm_smmu_master_alloc_smes(struct arm_smmu_device *smmu,
-				      struct arm_smmu_master_cfg *cfg)
+static int arm_smmu_find_sme(struct arm_smmu_device *smmu, u16 id, u16 mask)
 {
 	struct arm_smmu_smr *smrs = smmu->smrs;
-	int i, idx;
+	int i, free_idx = -ENOSPC;
 
-	/* Allocate the SMRs on the SMMU */
-	for_each_cfg_sme(cfg, i, idx) {
-		if (idx != INVALID_SMENDX)
-			return -EEXIST;
+	/* Stream indexing is blissfully easy */
+	if (!smrs)
+		return id;
 
-		/* ...except on stream indexing hardware, of course */
-		if (!smrs) {
-			cfg->smendx[i] = cfg->streamids[i];
+	/* Validating SMRs is... less so */
+	for (i = 0; i < smmu->num_mapping_groups; ++i) {
+		if (!smrs[i].valid) {
+			/*
+			 * Note the first free entry we come across, which
+			 * we'll claim in the end if nothing else matches.
+			 */
+			if (free_idx < 0)
+				free_idx = i;
 			continue;
 		}
+		/*
+		 * If the new entry is _entirely_ matched by an existing entry,
+		 * then reuse that, with the guarantee that there also cannot
+		 * be any subsequent conflicting entries. In normal use we'd
+		 * expect simply identical entries for this case, but there's
+		 * no harm in accommodating the generalisation.
+		 */
+		if ((mask & smrs[i].mask) == mask &&
+		    !((id ^ smrs[i].id) & ~smrs[i].mask))
+			return i;
+		/*
+		 * If the new entry has any other overlap with an existing one,
+		 * though, then there always exists at least one stream ID
+		 * which would cause a conflict, and we can't allow that risk.
+		 */
+		if (!((id ^ smrs[i].id) & ~(smrs[i].mask | mask)))
+			return -EINVAL;
+	}
 
-		idx = arm_smmu_alloc_smr(smmu);
-		if (IS_ERR_VALUE(idx)) {
-			dev_err(smmu->dev, "failed to allocate free SMR\n");
-			goto err_free_smrs;
+	return free_idx;
+}
+
+static bool arm_smmu_free_sme(struct arm_smmu_device *smmu, int idx)
+{
+	if (--smmu->s2crs[idx].count)
+		return false;
+
+	smmu->s2crs[idx] = s2cr_init_val;
+	if (smmu->smrs)
+		smmu->smrs[idx].valid = false;
+
+	return true;
+}
+
+static int arm_smmu_master_alloc_smes(struct device *dev)
+{
+	struct arm_smmu_master_cfg *cfg = find_smmu_master_cfg(dev);
+	struct arm_smmu_device *smmu = cfg->smmu;
+	struct arm_smmu_smr *smrs = smmu->smrs;
+	struct iommu_group *group;
+	int i, idx, ret;
+
+	spin_lock(&smmu->stream_map_lock);
+	/* Figure out a viable stream map entry allocation */
+	for_each_cfg_sme(cfg, i, idx) {
+		if (idx != INVALID_SMENDX) {
+			ret = -EEXIST;
+			goto out_err;
 		}
-		cfg->smendx[i] = idx;
 
-		smrs[idx].id = cfg->streamids[i];
-		smrs[idx].mask = 0; /* We don't currently share SMRs */
+		ret = arm_smmu_find_sme(smmu, cfg->streamids[i], 0);
+		if (ret < 0)
+			goto out_err;
+
+		idx = ret;
+		if (smrs && smmu->s2crs[idx].count == 0) {
+			smrs[idx].id = cfg->streamids[i];
+			smrs[idx].mask = 0; /* We don't currently share SMRs */
+			smrs[idx].valid = true;
+		}
+		smmu->s2crs[idx].count++;
+		cfg->smendx[i] = (s16)idx;
 	}
 
-	if (!smrs)
-		return 0;
+	group = iommu_group_get(dev);
+	if (!group)
+		group = ERR_PTR(-ENOMEM);
+	if (IS_ERR(group)) {
+		ret = PTR_ERR(group);
+		goto out_err;
+	}
+	iommu_group_put(group);
 
 	/* It worked! Now, poke the actual hardware */
-	for_each_cfg_sme(cfg, i, idx)
-		arm_smmu_write_smr(smmu, idx);
+	for_each_cfg_sme(cfg, i, idx) {
+		arm_smmu_write_sme(smmu, idx);
+		smmu->s2crs[idx].group = group;
+	}
 
+	spin_unlock(&smmu->stream_map_lock);
 	return 0;
 
-err_free_smrs:
+out_err:
 	while (i--) {
-		arm_smmu_free_smr(smmu, cfg->smendx[i]);
+		arm_smmu_free_sme(smmu, cfg->smendx[i]);
 		cfg->smendx[i] = INVALID_SMENDX;
 	}
-	return -ENOSPC;
+	spin_unlock(&smmu->stream_map_lock);
+	return ret;
 }
 
-static void arm_smmu_master_free_smes(struct arm_smmu_device *smmu,
-				      struct arm_smmu_master_cfg *cfg)
+static void arm_smmu_master_free_smes(struct arm_smmu_master_cfg *cfg)
 {
+    struct arm_smmu_device *smmu = cfg->smmu;
 	int i, idx;
 
-	/*
-	 * We *must* clear the S2CR first, because freeing the SMR means
-	 * that it can be re-allocated immediately.
-	 */
+	spin_lock(&smmu->stream_map_lock);
 	for_each_cfg_sme(cfg, i, idx) {
-		/* An IOMMU group is torn down by the first device to be removed */
-		if (idx == INVALID_SMENDX)
-			return;
-
-		smmu->s2crs[idx] = s2cr_init_val;
-		arm_smmu_write_s2cr(smmu, idx);
-	}
-	/* Sync S2CR updates before touching anything else */
-	__iowmb();
-
-	/* Invalidate the SMRs before freeing back to the allocator */
-	for_each_cfg_sme(cfg, i, idx) {
-		if (smmu->smrs)
-			arm_smmu_free_smr(smmu, idx);
-
+		if (arm_smmu_free_sme(smmu, idx))
+			arm_smmu_write_sme(smmu, idx);
 		cfg->smendx[i] = INVALID_SMENDX;
 	}
+	spin_unlock(&smmu->stream_map_lock);
 }
 
 static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
 				      struct arm_smmu_master_cfg *cfg)
 {
-	int i, idx, ret = 0;
 	struct arm_smmu_device *smmu = smmu_domain->smmu;
 	struct arm_smmu_s2cr *s2cr = smmu->s2crs;
 	enum arm_smmu_s2cr_type type = S2CR_TYPE_TRANS;
 	u8 cbndx = smmu_domain->cfg.cbndx;
-
-	if (cfg->smendx[0] == INVALID_SMENDX)
-		ret = arm_smmu_master_alloc_smes(smmu, cfg);
-	if (ret)
-		return ret;
+	int i, idx;
 
 	for_each_cfg_sme(cfg, i, idx) {
-		/* Devices in an IOMMU group may already be configured */
 		if (type == s2cr[idx].type && cbndx == s2cr[idx].cbndx)
-			break;
+			continue;
 
 		s2cr[idx].type = type ;
 		s2cr[idx].privcfg = S2CR_PRIVCFG_UNPRIV;
@@ -1602,11 +1634,10 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
 
 static void arm_smmu_detach_dev(struct iommu_domain *domain, struct device *dev)
 {
-	struct arm_smmu_device *smmu = find_smmu_for_device(dev);
 	struct arm_smmu_master_cfg *cfg = find_smmu_master_cfg(dev);
 
-	if (smmu && cfg)
-		arm_smmu_master_free_smes(smmu, cfg);
+	if (cfg)
+		arm_smmu_master_free_smes(cfg);
 
 }
 
@@ -1935,31 +1966,44 @@ static void __arm_smmu_release_pci_iommudata(void *data)
 	kfree(data);
 }
 
+static struct iommu_group *arm_smmu_device_group(struct
+						arm_smmu_master_cfg *cfg)
+{
+	struct arm_smmu_device *smmu = cfg->smmu;
+	struct iommu_group *group = NULL;
+	int i, idx;
+
+	for_each_cfg_sme(cfg, i, idx) {
+		if (group && smmu->s2crs[idx].group &&
+		    group != smmu->s2crs[idx].group)
+			return ERR_PTR(-EINVAL);
+
+		group = smmu->s2crs[idx].group;
+	}
+
+	if (group)
+		return group;
+
+	return NULL;
+}
+
 static int arm_smmu_add_device(struct device *dev)
 {
 	struct arm_smmu_device *smmu;
 	struct arm_smmu_master_cfg *cfg;
 	struct iommu_group *group;
 	void (*releasefn)(void *) = NULL;
-	int ret;
 
 	smmu = find_smmu_for_device(dev);
 	if (!smmu)
 		return -ENODEV;
 
-	group = iommu_group_alloc();
-	if (IS_ERR(group)) {
-		dev_err(dev, "Failed to allocate IOMMU group\n");
-		return PTR_ERR(group);
-	}
-
 	if (dev_is_pci(dev)) {
 		struct pci_dev *pdev = to_pci_dev(dev);
 
 		cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
 		if (!cfg) {
-			ret = -ENOMEM;
-			goto out_put_group;
+			return -ENOMEM;
 		}
 
 		cfg->num_streamids = 1;
@@ -1970,24 +2014,33 @@ static int arm_smmu_add_device(struct device *dev)
 		pci_for_each_dma_alias(pdev, __arm_smmu_get_pci_sid,
 				       &cfg->streamids[0]);
 		releasefn = __arm_smmu_release_pci_iommudata;
+		cfg->smmu = smmu;
 	} else {
 		struct arm_smmu_master *master;
 
 		master = find_smmu_master(smmu, dev->of_node);
 		if (!master) {
-			ret = -ENODEV;
-			goto out_put_group;
+			return -ENODEV;
 		}
 
 		cfg = &master->cfg;
+		cfg->smmu = smmu;
 	}
 
-	iommu_group_set_iommudata(group, cfg, releasefn);
-	ret = iommu_group_add_device(group, dev);
+	group = arm_smmu_device_group(cfg);
+	if (!group) {
+		group = iommu_group_alloc();
+		if (IS_ERR(group)) {
+			dev_err(dev, "Failed to allocate IOMMU group\n");
+			return PTR_ERR(group);
+		}
+	}
 
-out_put_group:
+	iommu_group_set_iommudata(group, cfg, releasefn);
+	iommu_group_add_device(group, dev);
 	iommu_group_put(group);
-	return ret;
+
+	return arm_smmu_master_alloc_smes(dev);
 }
 
 #if 0 /* Xen: We don't support remove device for now. Will be useful for PCI */
@@ -2220,6 +2273,7 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu)
 		smmu->s2crs[i] = s2cr_init_val;
 
 	smmu->num_mapping_groups = size;
+	spin_lock_init(&smmu->stream_map_lock);
 
 	/* ID1 */
 	id = readl_relaxed(gr0_base + ARM_SMMU_GR0_ID1);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:46:35 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:46:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110729.211402 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjb1-0003Zx-OG; Wed, 14 Apr 2021 17:46:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110729.211402; Wed, 14 Apr 2021 17:46: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 1lWjb1-0003Zo-L8; Wed, 14 Apr 2021 17:46:35 +0000
Received: by outflank-mailman (input) for mailman id 110729;
 Wed, 14 Apr 2021 17:46: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 1lWjb0-0003Ze-KS
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:46: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 1lWjb0-000738-JZ
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:46:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjb0-00060p-In
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:46: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=8NF3BfhqRdpDV/VP8kNwo6MfO0shV4fTX1/qj7ItTgI=; b=ER7rl5w3XPevPApQ+reSq6fDBX
	m0iFAdoFbMzjzTIIj8tr29imuq0yVGKagaAGQMq4qOHCLDh1KvlQhqeibHbsjPoPggB7fW0riPHIC
	SssK2Mn0pPOcCGgO393IgOT0CdN3E/8qfdC1WjhW0prRussO9LzSp06I+g3QrAySboBQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] common: map_vcpu_info() cosmetics
Message-Id: <E1lWjb0-00060p-In@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:46:34 +0000

commit 7ee7a3749bcb5d39ced5a1ee3e8284b2bb9abc29
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 6 16:17:42 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 6 16:17:42 2021 +0200

    common: map_vcpu_info() cosmetics
    
    Use ENXIO instead of EINVAL to cover the two cases of the address not
    satisfying the requirements. This will make an issue here better stand
    out at the call site.
    
    Also add a missing compat-mode related size check: If the sizes
    differed, other code in the function would need changing. Accompany this
    by a change to the initial sizeof() expression, tying it to the type of
    the variable we're actually after (matching e.g. the alignof() added by
    XSA-327).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/domain.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index d85984638a..cdda0d1f29 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1427,17 +1427,18 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
     struct page_info *page;
     unsigned int align;
 
-    if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
-        return -EINVAL;
+    if ( offset > (PAGE_SIZE - sizeof(*new_info)) )
+        return -ENXIO;
 
 #ifdef CONFIG_COMPAT
+    BUILD_BUG_ON(sizeof(*new_info) != sizeof(new_info->compat));
     if ( has_32bit_shinfo(d) )
         align = alignof(new_info->compat);
     else
 #endif
         align = alignof(*new_info);
     if ( offset & (align - 1) )
-        return -EINVAL;
+        return -ENXIO;
 
     if ( !mfn_eq(v->vcpu_info_mfn, INVALID_MFN) )
         return -EINVAL;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:46:45 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:46:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110731.211406 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjbB-0003bY-Pw; Wed, 14 Apr 2021 17:46:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110731.211406; Wed, 14 Apr 2021 17:46: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 1lWjbB-0003bQ-Mp; Wed, 14 Apr 2021 17:46:45 +0000
Received: by outflank-mailman (input) for mailman id 110731;
 Wed, 14 Apr 2021 17:46: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 1lWjbA-0003bC-Nv
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:46: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 1lWjbA-00073F-NB
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:46:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjbA-00061b-M2
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:46: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=RnNo+dLeh/Yf3ZSjjiGh14cwtWi7dn2mXrLm/YlyOb0=; b=10gz6e2fEkLNZPv/lQRdn4tWPA
	KWHdNC37qBsnYaUh/9In8ToACAfdhf4D9IYC1WO6yHsNseAN+zIK7NjrpKSBuoDLtZiPU7STVtxC9
	DVCKSoV+4EUEBKfSh/h5llQLwIT/5TnrcxK2UPWVZLmR0iunDWu7EHvvxR7esCmM7iQ4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] rangeset: no need to use snprintf()
Message-Id: <E1lWjbA-00061b-M2@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:46:44 +0000

commit 6425fcf37122b1f1e4ceaacadd00a4c280a58f57
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 6 16:18:41 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 6 16:18:41 2021 +0200

    rangeset: no need to use snprintf()
    
    As of the conversion to safe_strcpy() years ago there has been no need
    anymore to use snprintf() to prevent storing a not-nul-terminated string.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/rangeset.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/xen/common/rangeset.c b/xen/common/rangeset.c
index 4ebba30ba3..0afe638f40 100644
--- a/xen/common/rangeset.c
+++ b/xen/common/rangeset.c
@@ -436,14 +436,7 @@ struct rangeset *rangeset_new(
     BUG_ON(flags & ~RANGESETF_prettyprint_hex);
     r->flags = flags;
 
-    if ( name != NULL )
-    {
-        safe_strcpy(r->name, name);
-    }
-    else
-    {
-        snprintf(r->name, sizeof(r->name), "(no name)");
-    }
+    safe_strcpy(r->name, name ?: "(no name)");
 
     if ( (r->domain = d) != NULL )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:46:55 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:46:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110732.211410 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjbL-0003d2-Rh; Wed, 14 Apr 2021 17:46:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110732.211410; Wed, 14 Apr 2021 17:46: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 1lWjbL-0003ct-OP; Wed, 14 Apr 2021 17:46:55 +0000
Received: by outflank-mailman (input) for mailman id 110732;
 Wed, 14 Apr 2021 17:46: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 1lWjbK-0003cm-R0
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:46: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 1lWjbK-00073S-QF
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:46:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjbK-00062D-PZ
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:46: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=F1GOItI9ABsYRH6aQvdkzM7H87SJvo0tLD4t7HPyuko=; b=JYDerLq/E1ecz83fndSGSA3j53
	j1WnkBxoE1ePZGk5AygOKklCnd6UxpX+DjcvMQs99dGMwNpkbCCGrN8Pi7ZpxWIkM01vaKQDx9k+U
	3X/HDlF2lzNGDo2jXSpv0xUkGSCuACF7DvQHf8hMwnBpBYu+UvvmMdSbimjyQ/KcTQ70=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: Mention XEN_SCRIPT_DIR
Message-Id: <E1lWjbK-00062D-PZ@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:46:54 +0000

commit 18a872f057cbd67de477dca605cdeceef51097cf
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 13:51:48 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:46:50 2021 +0100

    CHANGELOG.md: Mention XEN_SCRIPT_DIR
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Ian Jackson <iwj@xenproject.org>
    Release-acked-by: Ian Jackson <iwj@xenproject.org>
    ---
    
    CC: Olaf Hering <olaf@aepfle.de>
    CC: Ian Jackson <iwj@xenproject.org>
---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8964bacf73..f7ce6682b9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - CI loop: Add dom0less aarch64 smoke test
  - x86: Allow domains to use AVX-VNNI instructions
  - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
+ - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
+
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:47:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:47:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110733.211413 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjbV-0003f1-Sx; Wed, 14 Apr 2021 17:47:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110733.211413; Wed, 14 Apr 2021 17:47: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 1lWjbV-0003et-Pv; Wed, 14 Apr 2021 17:47:05 +0000
Received: by outflank-mailman (input) for mailman id 110733;
 Wed, 14 Apr 2021 17:47: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 1lWjbU-0003el-VD
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:47: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 1lWjbU-00073t-TV
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:47:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjbU-00063A-Sn
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:47: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=uzn5rHdvesMFXsD6lfU72y0S/07FsEvAG+kRFSF5g6U=; b=m/APda1DRLf7zw8Ta+w5pp30RW
	0pioEiW7UnFEdh+Nr0zCK0v4el+QMSgB/Kog0RNQDzR2a4wIW3Cg3wBN6cXAoCDKNym/op6yphVlZ
	IRu/E9dUpLXpIld7snmcIfYQeNZXxWbvdZySzlItR7+oe2W1beMuT7K1ifTAWqTSXr+A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: xl PCI configuration doc, xenstore MTU entries
Message-Id: <E1lWjbU-00063A-Sn@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:47:04 +0000

commit f57316a909a76ee727cc8d1256a7d57a53e7c895
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 13:54:10 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:46:50 2021 +0100

    CHANGELOG.md: xl PCI configuration doc, xenstore MTU entries
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Ian Jackson <ian.jackson@citrix.com>
    ---
    CC: Paul Durrant <paul@xen.org>
    CC: Ian Jackson <ian.jackson@citrix.com>
    CC: Wei Liu <wl@xen.org>
---
 CHANGELOG.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index f7ce6682b9..086a0e50d0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Switched MSR accesses to deny by default policy.
  - Intel Processor Trace support (Tech Preview)
  - Named PCI devices for xl/libxl
+ - Improved documentation for xl PCI configuration format
  - Support for zstd-compressed dom0 (x86) and domU kernels
  - Library improvements from NetBSD ports upstreamed
  - CI loop: Add Alpine Linux, Ubuntu Focal targets; drop CentOS 6
@@ -23,7 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - x86: Allow domains to use AVX-VNNI instructions
  - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
  - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
-
+ - xennet: Documented a way for the backend (or toolstack) to specify MTU to the frontend
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:47:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:47:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110734.211418 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjbf-0003gZ-UO; Wed, 14 Apr 2021 17:47:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110734.211418; Wed, 14 Apr 2021 17:47: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 1lWjbf-0003gR-RG; Wed, 14 Apr 2021 17:47:15 +0000
Received: by outflank-mailman (input) for mailman id 110734;
 Wed, 14 Apr 2021 17:47: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 1lWjbf-0003gH-1o
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:47: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 1lWjbf-000748-12
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:47:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjbe-00063t-W5
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:47: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=AQbwnqYGsjbqI3Ia65oAoXBtPLnfYMeZbRr1Eu45b6A=; b=YjXDCB4XPJEW8W3/vqFeKGbBoK
	vJjLGzwKYriywqSWkTXlG23N+cob/QVjAU7iy0cohVo5ZRaPVCw2HAVLTt/cYmdqfSLwF9in8m9Xe
	c3pfW56ObY3/UA9QCnwsx3tOn+wAI5qZyEe2XrqrWhr5AUQry7lxm+SFPxX+TP2Z07IY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: Some additional affordances in various xl subcommands
Message-Id: <E1lWjbe-00063t-W5@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:47:14 +0000

commit 6645040c9f93a6bc106c755859f435e76192c33f
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:06:36 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:46:50 2021 +0100

    CHANGELOG.md: Some additional affordances in various xl subcommands
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
    ---
    CC: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 086a0e50d0..a12dab1c33 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
  - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
  - xennet: Documented a way for the backend (or toolstack) to specify MTU to the frontend
+ - Some additional affordances in various xl subcommands.
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:47:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:47:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110735.211423 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjbp-0003iG-WC; Wed, 14 Apr 2021 17:47:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110735.211423; Wed, 14 Apr 2021 17:47: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 1lWjbp-0003i7-Si; Wed, 14 Apr 2021 17:47:25 +0000
Received: by outflank-mailman (input) for mailman id 110735;
 Wed, 14 Apr 2021 17:47: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 1lWjbp-0003hz-5S
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:47: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 1lWjbp-00074d-4d
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:47:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjbp-00065o-3Y
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:47: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=DoWkoZNcH709uMfoAedN/fmGprWCJZuC59/7cg6ueVA=; b=PPH7yYtcFlueDAqMxmort2JOkg
	A0Mc2TmMGGFNNGEIpKeqAbOrc8W6GA5HGfQNJJjSlWko+8kBcc5r2RLTHWcfRTYyUeVqAvswoSI7Y
	MHu6wH2siyJrRpJmlM3AhKV7e49DgdIdElSpltimmlz3mysyonFKSdsjah0PvNN53vC0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: Mention various ARM errata
Message-Id: <E1lWjbp-00065o-3Y@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:47:25 +0000

commit 649151e4b8809c5eddd1b1f8f84dc45fd7b7fb3d
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:08:04 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:46:50 2021 +0100

    CHANGELOG.md: Mention various ARM errata
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    ---
    v2:
     - Tweaked wording
    CC: Ian Jackson <ian.jackson@citrix.com>
    CC: Stefano Stabellini <sstabellini@kernel.org>
    CC: Julien Grall <julien@xen.org>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a12dab1c33..6863f2a530 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
  - xennet: Documented a way for the backend (or toolstack) to specify MTU to the frontend
  - Some additional affordances in various xl subcommands.
+ - Added workarounds for the following ARM errata: Cortex A53 #843419, Cortex A55 #1530923, Cortex A72 #853709, Cortex A73 #858921, Cortex A76 #1286807, Neoverse-N1 #1165522
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:47:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:47:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110736.211426 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjc0-0003jl-0t; Wed, 14 Apr 2021 17:47:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110736.211426; Wed, 14 Apr 2021 17:47: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 1lWjbz-0003je-UD; Wed, 14 Apr 2021 17:47:35 +0000
Received: by outflank-mailman (input) for mailman id 110736;
 Wed, 14 Apr 2021 17:47: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 1lWjbz-0003jU-8P
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:47: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 1lWjbz-00074k-7k
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:47:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjbz-00066b-75
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:47: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=nBPyjDT+7FjUuuCZsAWermtXc9/GE1YxppUNbN0ZbOY=; b=KzC370I3IM2LWO0iQi8CSF1Pf/
	JyL7Ammy4hRwp70IDSgv2CJuUqZ7XmSrM/PJroELMgDWaIrjOQAKvJzqELZ/NK2l2MJ6gmZyfXPvz
	1lRlt2KpmZwf0aKjSvwtZA0T+SKnC1ZWMFK3OYQQKt9PDaMkU5qeZKwnVdCFFwTbEPzM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: Various new entries, mostly x86
Message-Id: <E1lWjbz-00066b-75@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:47:35 +0000

commit 0ddaeeb4fc80b86b25168fd5cb30f9130590f16b
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:18:36 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:46:50 2021 +0100

    CHANGELOG.md: Various new entries, mostly x86
    
    ...Grouped mostly by submitter / maintainer
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    ---
    CC: Ian Jackson <ian.jackson@citrix.com>
    CC: Andrew Cooper <andrew.cooper3@citrix.com>
    CC: Jan Beulich <jbeulich@suse.com>
    CC: Roger Pau Monne <roger.pau@citrix.com>
---
 CHANGELOG.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6863f2a530..1f370737eb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Named PCI devices for xl/libxl
  - Improved documentation for xl PCI configuration format
  - Support for zstd-compressed dom0 (x86) and domU kernels
+ - EFI: Enable booting unified hypervisor/kernel/initrd/DT images
+ - Reduce ACPI verbosity by default
+ - Add ucode=allow-same option to test late microcode loading path
  - Library improvements from NetBSD ports upstreamed
  - CI loop: Add Alpine Linux, Ubuntu Focal targets; drop CentOS 6
  - CI loop: Add qemu-based dom0 / domU test for ARM
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:47:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:47:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110737.211430 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjcA-0003l5-2k; Wed, 14 Apr 2021 17:47:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110737.211430; Wed, 14 Apr 2021 17:47: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 1lWjc9-0003kx-Vw; Wed, 14 Apr 2021 17:47:45 +0000
Received: by outflank-mailman (input) for mailman id 110737;
 Wed, 14 Apr 2021 17:47: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 1lWjc9-0003kr-Bi
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:47: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 1lWjc9-00074r-Az
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:47:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjc9-00067H-AG
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:47: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=F9KRwSw1nFWKzVMqMVq0hBDAtNNEoJnBfpVWI/v/VcU=; b=rVJrwKL1DMl/ev+H/2aMVZp/jH
	nK4n4nx739ns4RYHMYY3W8yNh9sQ5LSAZZdugy24KjUUMWzPIrK0UxEVCa/vEjjj7ZbTRSy+upOFA
	WdG75x/xGyzPt2P7HIu3QKLGtaGPsjWrHDHV+f3csebj29uDwqqAEhkeBEyOmgsSiMrk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: Various entries, mostly xenstore
Message-Id: <E1lWjc9-00067H-AG@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:47:45 +0000

commit a98534a856c5a98aa0a73c21dfbe479370aec8c4
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:30:55 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:46:50 2021 +0100

    CHANGELOG.md: Various entries, mostly xenstore
    
    ...grouped by submitters / maintainers
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    ---
    CC: Juergen Gross <jgross@suse.com>
    CC: Jan Beulich <jbeulich@suse.com>
    CC: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1f370737eb..67daeb0c93 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,8 +28,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Factored out HVM-specific shadow code, improving code clarity and reducing the size of PV-only hypervisor builds
  - Added XEN_SCRIPT_DIR configuration option to specify location for Xen scripts, rather than hard-coding /etc/xen/scripts
  - xennet: Documented a way for the backend (or toolstack) to specify MTU to the frontend
+ - xenstore can now be live-updated on a running system. (Tech preview)
  - Some additional affordances in various xl subcommands.
  - Added workarounds for the following ARM errata: Cortex A53 #843419, Cortex A55 #1530923, Cortex A72 #853709, Cortex A73 #858921, Cortex A76 #1286807, Neoverse-N1 #1165522
+ - On detecting a host crash, some debug key handlers can automatically triggered to aid in debugging
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:47:56 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:47:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110738.211434 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjcK-0003mG-4f; Wed, 14 Apr 2021 17:47:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110738.211434; Wed, 14 Apr 2021 17:47: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 1lWjcK-0003m8-1F; Wed, 14 Apr 2021 17:47:56 +0000
Received: by outflank-mailman (input) for mailman id 110738;
 Wed, 14 Apr 2021 17:47: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 1lWjcJ-0003m0-G2
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:47: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 1lWjcJ-00074w-FL
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:47:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjcJ-000683-Df
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:47: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=RGhZ6dFLsmbmcDpS60ftygz2yqrt8O4AH7k5cNTZ8Xo=; b=v3XFkuBJCcJpk3gG4/9HxebSvO
	nGaRSNY7x9zxoVzC/Cf3Li4rBq8IzA0gEZrEFvwwrq8glj/RvrzYa84bvlpn32p/0jLa+sCry9TAR
	KndoNLLZLEJJTJZbY9OgHuxwQSA6pQKybRSh/refrjNesW+0cHo/YUW/4XnyvJqXE5uU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: irq-max-guests
Message-Id: <E1lWjcJ-000683-Df@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:47:55 +0000

commit 3b368340c41823e24559192ccd158cf071bf4a8f
Author:     George Dunlap <george.dunlap@citrix.com>
AuthorDate: Thu Apr 1 14:34:04 2021 +0100
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Tue Apr 6 17:46:50 2021 +0100

    CHANGELOG.md: irq-max-guests
    
    Signed-off-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    ---
    CC: Igor Druzhinin <igor.druzhinin@citrix.com>
    CC: Jan Beulich <jbeulich@suse.com>
    CC: Ian Jackson <ian.jackson@citrix.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 67daeb0c93..0106fccec1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,6 +32,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Some additional affordances in various xl subcommands.
  - Added workarounds for the following ARM errata: Cortex A53 #843419, Cortex A55 #1530923, Cortex A72 #853709, Cortex A73 #858921, Cortex A76 #1286807, Neoverse-N1 #1165522
  - On detecting a host crash, some debug key handlers can automatically triggered to aid in debugging
+ - Increase the maximum number of guests which can share a single IRQ from 7 to 16, and make this configurable with irq-max-guests
 
 ### Removed / support downgraded
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:48:06 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:48:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110739.211438 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjcU-0003ni-75; Wed, 14 Apr 2021 17:48:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110739.211438; Wed, 14 Apr 2021 17:48: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 1lWjcU-0003na-40; Wed, 14 Apr 2021 17:48:06 +0000
Received: by outflank-mailman (input) for mailman id 110739;
 Wed, 14 Apr 2021 17:48: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 1lWjcT-0003nT-JH
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:48: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 1lWjcT-00075D-IV
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:48:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjcT-000692-Hu
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:48: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=nv9ko2d0XAWmeUyPW+SYkjQpF7XFBOS0nItx1YzQKEg=; b=jF/qlL7UaH2wfengIVHE89XHEM
	MmfZg001pVM+oKQ8e8i7Gnjsup1pCXsEpyfbaaGdke/hidqxwaKH/rVaBKL/vcnCp+G3GTOBaJg3Y
	zim0H/RdtZ0FKglMK2hIT2K7/Skp2C4zUM9D6yyt7VqtvSgZZ8XdBKYAYAWqtE/4BFYw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/gunzip: Allow perform_gunzip() to be called multiple times
Message-Id: <E1lWjcT-000692-Hu@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:48:05 +0000

commit 33bc2a8495f755510f63629ed3f011134416310c
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed Mar 3 19:27:56 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 6 19:30:33 2021 +0100

    xen/gunzip: Allow perform_gunzip() to be called multiple times
    
    Currently perform_gunzip() can only be called once because the
    the internal state (e.g allocate) is not fully re-initialized.
    
    This works fine if you are only booting dom0. But this will break when
    booting multiple using the dom0less that uses compressed kernel images.
    
    This can be resolved by re-initializing bytes_out, malloc_ptr,
    malloc_count every time perform_gunzip() is called.
    
    Note the latter is only re-initialized for hardening purpose as there is
    no guarantee that every malloc() are followed by free() (It should in
    theory!).
    
    Take the opportunity to check the return of alloc_heap_pages() to return
    an error rather than dereferencing a NULL pointer later on failure.
    
    Reported-by: Charles Chiou <cchiou@ambarella.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/gunzip.c  | 5 +++++
 xen/common/inflate.c | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/xen/common/gunzip.c b/xen/common/gunzip.c
index db4efcd34b..425d64e904 100644
--- a/xen/common/gunzip.c
+++ b/xen/common/gunzip.c
@@ -114,11 +114,16 @@ __init int perform_gunzip(char *output, char *image, unsigned long image_len)
     window = (unsigned char *)output;
 
     free_mem_ptr = (unsigned long)alloc_xenheap_pages(HEAPORDER, 0);
+    if ( !free_mem_ptr )
+        return -ENOMEM;
+
     free_mem_end_ptr = free_mem_ptr + (PAGE_SIZE << HEAPORDER);
+    init_allocator();
 
     inbuf = (unsigned char *)image;
     insize = image_len;
     inptr = 0;
+    bytes_out = 0;
 
     makecrc();
 
diff --git a/xen/common/inflate.c b/xen/common/inflate.c
index f99c985d61..d8c28a3e95 100644
--- a/xen/common/inflate.c
+++ b/xen/common/inflate.c
@@ -238,6 +238,12 @@ STATIC const ush mask_bits[] = {
 static unsigned long INITDATA malloc_ptr;
 static int INITDATA malloc_count;
 
+static void init_allocator(void)
+{
+    malloc_ptr = free_mem_ptr;
+    malloc_count = 0;
+}
+
 static void *INIT malloc(int size)
 {
     void *p;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:48:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:48:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110740.211442 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjcf-0003pK-8a; Wed, 14 Apr 2021 17:48:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110740.211442; Wed, 14 Apr 2021 17:48: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 1lWjcf-0003pC-5b; Wed, 14 Apr 2021 17:48:17 +0000
Received: by outflank-mailman (input) for mailman id 110740;
 Wed, 14 Apr 2021 17:48: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 1lWjcd-0003p3-MW
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:48: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 1lWjcd-00075G-Lj
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:48:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjcd-00069n-L6
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:48: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=ZMVDmo+iZGnSr3XRtXGrM/kBmwp24slALEFYJpRDuno=; b=DfMd4SWO0dqb4ih/WeVXJWcsic
	Q3lWvFWcbuChZmJRvXdHVLt9AyHBSVkTIH76Ju1iXhdUAcaQsnkAoGR6fFQdHCBTHQRGhIbAf6KZl
	oHXMqduZ1zbmHuguv5ix4qkuzxDtBj5Bq/YIMbKDMg1vL0DrAedfOQOae8eYGACtv5kA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: Constify the second parameter of rangeset_new()
Message-Id: <E1lWjcd-00069n-L6@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:48:15 +0000

commit 91df35e32b0c624df4b326329336df770844d932
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Apr 6 19:03:49 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 6 20:03:10 2021 +0100

    xen: Constify the second parameter of rangeset_new()
    
    The string 'name' will never get modified by the function, so mark it
    as const.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/rangeset.c      | 2 +-
 xen/include/xen/rangeset.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/rangeset.c b/xen/common/rangeset.c
index 0afe638f40..885b6b15c2 100644
--- a/xen/common/rangeset.c
+++ b/xen/common/rangeset.c
@@ -421,7 +421,7 @@ bool_t rangeset_is_empty(
 }
 
 struct rangeset *rangeset_new(
-    struct domain *d, char *name, unsigned int flags)
+    struct domain *d, const char *name, unsigned int flags)
 {
     struct rangeset *r;
 
diff --git a/xen/include/xen/rangeset.h b/xen/include/xen/rangeset.h
index 5f62a97971..135f33f606 100644
--- a/xen/include/xen/rangeset.h
+++ b/xen/include/xen/rangeset.h
@@ -36,7 +36,7 @@ void rangeset_domain_destroy(
  * rangeset_destroy(r).
  */
 struct rangeset *rangeset_new(
-    struct domain *d, char *name, unsigned int flags);
+    struct domain *d, const char *name, unsigned int flags);
 void rangeset_destroy(
     struct rangeset *r);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:48:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:48:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110741.211445 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjcp-0003qm-AA; Wed, 14 Apr 2021 17:48:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110741.211445; Wed, 14 Apr 2021 17:48: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 1lWjcp-0003qd-7D; Wed, 14 Apr 2021 17:48:27 +0000
Received: by outflank-mailman (input) for mailman id 110741;
 Wed, 14 Apr 2021 17:48: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 1lWjcn-0003qU-PW
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:48: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 1lWjcn-00075c-Op
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:48:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjcn-0006CD-OF
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:48: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=bnk8syZhsnCKFOXnW+zf1mJyPIZYtiRCjZaGOWR50AA=; b=lCXcd3nO8Xc63P7esN6Y2ewwgW
	B1Wr+jT6VsQ+Jb2rRTnedE3WTWlEPYw6vYk+df2keYpWJwPhny6QuuZ5UWwnoRvW8JfO1O3xSc1SE
	1zBcQDENAp0QXujld2O1KNwuiUyzo62QS0i6ucwgE4sjYr8cJa9UlQgTGG9Svyt4Z8XQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/sched: Constify name and opt_name in struct scheduler
Message-Id: <E1lWjcn-0006CD-OF@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:48:25 +0000

commit 1f0358093c101b170f7516779b70d3c8e11965ef
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Apr 6 19:34:08 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 6 20:03:10 2021 +0100

    xen/sched: Constify name and opt_name in struct scheduler
    
    Both name and opt_name are pointing to literal string. So mark both of
    the fields as const.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
---
 xen/common/sched/private.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/sched/private.h b/xen/common/sched/private.h
index 92d0d49610..a870320146 100644
--- a/xen/common/sched/private.h
+++ b/xen/common/sched/private.h
@@ -272,8 +272,8 @@ static inline spinlock_t *pcpu_schedule_trylock(unsigned int cpu)
 }
 
 struct scheduler {
-    char *name;             /* full name for this scheduler      */
-    char *opt_name;         /* option name for this scheduler    */
+    const char *name;       /* full name for this scheduler      */
+    const char *opt_name;   /* option name for this scheduler    */
     unsigned int sched_id;  /* ID for this scheduler             */
     void *sched_data;       /* global data pointer               */
     struct cpupool *cpupool;/* points to this scheduler's pool   */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:48:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:48:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110742.211449 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjcz-0003rz-Bc; Wed, 14 Apr 2021 17:48:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110742.211449; Wed, 14 Apr 2021 17:48: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 1lWjcz-0003rr-8j; Wed, 14 Apr 2021 17:48:37 +0000
Received: by outflank-mailman (input) for mailman id 110742;
 Wed, 14 Apr 2021 17:48: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 1lWjcx-0003rh-TM
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:48: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 1lWjcx-00075f-Sd
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:48:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjcx-0006DC-Rp
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:48: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=4XDP7MekbWcca5+V67aW5wy+vfZT4SoECEH31TZZw70=; b=Kps1aiERDMHL6fcMGYJa4AFbyz
	IuhqqHiWkAPpaS55hkI/GiQ5mqp2sS0w51yAZEuCZpfqbDf3fkExJ6Gcfo1bupVsJzU4NHtKe97fe
	bISS4fzcyld4LgbmPy3NziXFLuu30CyGF7RDZBSAusHnWS4GwQ75rrR78Y8Y+Y7aPSns=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/x86: shadow: The return type of sh_audit_flags() should be const
Message-Id: <E1lWjcx-0006DC-Rp@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:48:35 +0000

commit 8b9a78269d2c819194fcc6843d6da64cab5e0ca4
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Apr 6 19:58:05 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 6 20:03:10 2021 +0100

    xen/x86: shadow: The return type of sh_audit_flags() should be const
    
    The function sh_audit_flags() is returning pointer to literal strings.
    They should not be modified, so the return is now const and this is
    propagated to the callers.
    
    Take the opportunity to fix the coding style in the declaration of
    sh_audit_flags.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/multi.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 9b43cb116c..0342de81d2 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -4290,8 +4290,8 @@ static void sh_pagetable_dying(paddr_t gpa)
     done = 1;                                                           \
 } while (0)
 
-static char * sh_audit_flags(struct vcpu *v, int level,
-                              int gflags, int sflags)
+static const char *sh_audit_flags(struct vcpu *v, int level,
+                                  int gflags, int sflags)
 /* Common code for auditing flag bits */
 {
     if ( (sflags & _PAGE_PRESENT) && !(gflags & _PAGE_PRESENT) )
@@ -4324,7 +4324,7 @@ int sh_audit_l1_table(struct vcpu *v, mfn_t sl1mfn, mfn_t x)
     mfn_t mfn, gmfn, gl1mfn;
     gfn_t gfn;
     p2m_type_t p2mt;
-    char *s;
+    const char *s;
     int done = 0;
 
     /* Follow the backpointer */
@@ -4419,7 +4419,7 @@ int sh_audit_l2_table(struct vcpu *v, mfn_t sl2mfn, mfn_t x)
     mfn_t mfn, gmfn, gl2mfn;
     gfn_t gfn;
     p2m_type_t p2mt;
-    char *s;
+    const char *s;
     int done = 0;
 
     /* Follow the backpointer */
@@ -4471,7 +4471,7 @@ int sh_audit_l3_table(struct vcpu *v, mfn_t sl3mfn, mfn_t x)
     mfn_t mfn, gmfn, gl3mfn;
     gfn_t gfn;
     p2m_type_t p2mt;
-    char *s;
+    const char *s;
     int done = 0;
 
     /* Follow the backpointer */
@@ -4521,7 +4521,7 @@ int sh_audit_l4_table(struct vcpu *v, mfn_t sl4mfn, mfn_t x)
     mfn_t mfn, gmfn, gl4mfn;
     gfn_t gfn;
     p2m_type_t p2mt;
-    char *s;
+    const char *s;
     int done = 0;
 
     /* Follow the backpointer */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:48:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:48:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110743.211454 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjd9-0003tO-D1; Wed, 14 Apr 2021 17:48:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110743.211454; Wed, 14 Apr 2021 17:48: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 1lWjd9-0003tG-AB; Wed, 14 Apr 2021 17:48:47 +0000
Received: by outflank-mailman (input) for mailman id 110743;
 Wed, 14 Apr 2021 17:48: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 1lWjd8-0003t6-0D
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:48: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 1lWjd7-00075i-Vi
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:48:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjd7-0006EH-V8
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:48: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=3wLyhh+1Ks86toyQBFAPFaaEJH00Uhiq8oHVAxJm5XI=; b=RpPKq78S/5bZASTEbtGCDwLME0
	yuyyBtbrvsbUjbM+r0w5ZHLluer3DmXhpI8b82Gy2UF/+RasubjuQpfzv/EDTWgt8/sCaWYlW53BV
	uZJ4h5HcRN+o7lrAhh3VgFpjA3Ez1s180JUjGvds8KknFcERGEKNawrMz1RODsTo9aIA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/kdd: Use const whenever we point to literal strings
Message-Id: <E1lWjd7-0006EH-V8@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:48:45 +0000

commit 922dcbab0b465f9da006b31da1a61e93734a080e
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Apr 6 19:59:25 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 6 20:03:10 2021 +0100

    tools/kdd: Use const whenever we point to literal strings
    
    literal strings are not meant to be modified. So we should use const
    char * rather than char * when we want to shore a pointer to them.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 tools/debugger/kdd/kdd.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c
index a7d0976ea4..17513c2650 100644
--- a/tools/debugger/kdd/kdd.c
+++ b/tools/debugger/kdd/kdd.c
@@ -67,7 +67,7 @@ typedef struct {
     uint32_t build;             
     int w64;
     int mp;
-    char *name;
+    const char *name;
     uint64_t base;              /* KernBase: start looking here */
     uint32_t range;             /* |         and search an area this size */
     uint32_t version;           /* +-> NtBuildNumber */
@@ -237,7 +237,7 @@ static size_t blocking_write(int fd, const void *buf, size_t count)
 }
 
 /* Dump the contents of a complete serial packet into a log file. */
-static void kdd_log_pkt(kdd_state *s, char *name, kdd_pkt *p)
+static void kdd_log_pkt(kdd_state *s, const char *name, kdd_pkt *p)
 {
     uint32_t sum = 0;
     unsigned int i, j;
@@ -504,8 +504,8 @@ static int check_os(kdd_state *s)
  * @return -1 on failure to find the section name
  * @return 0 on success
  */
-static int get_pe64_sections(kdd_state *s, uint64_t filebase, char *sectname,
-        uint64_t *vaddr, uint32_t *vsize)
+static int get_pe64_sections(kdd_state *s, uint64_t filebase,
+        const char *sectname, uint64_t *vaddr, uint32_t *vsize)
 {
     uint64_t pe_hdr = 0;
     uint64_t sect_start = 0;
@@ -781,7 +781,7 @@ static void kdd_send_cmd(kdd_state *s, uint32_t subtype, size_t extra)
 }
 
 /* Cause the client to print a string */
-static void kdd_send_string(kdd_state *s, char *fmt, ...)
+static void kdd_send_string(kdd_state *s, const char *fmt, ...)
 {
     uint32_t len = 0xffff - sizeof (kdd_msg);
     char *buf = (char *) s->txb + sizeof (kdd_hdr) + sizeof (kdd_msg);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:48:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:48:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110744.211458 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjdJ-0003ug-FV; Wed, 14 Apr 2021 17:48:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110744.211458; Wed, 14 Apr 2021 17:48: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 1lWjdJ-0003uW-Bu; Wed, 14 Apr 2021 17:48:57 +0000
Received: by outflank-mailman (input) for mailman id 110744;
 Wed, 14 Apr 2021 17:48: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 1lWjdI-0003uM-3g
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:48: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 1lWjdI-00075t-2x
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:48:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjdI-0006Ez-2Q
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:48: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=an0td3NgXtuax7OxwIOfOQxHWwhU/P5Sl8oQ4C6+NvM=; b=B0gU34giM5KJUjYT+i0LKZck3R
	nvxG6nCCVRX2xAi1IwGJeLiAUBBWCvejXvW62oqHoHPghbTF+pGibSwdjdvdMfKuzh329YSMy/xuD
	QwYpxOICOvNScPoz74sEPwffykPhkGiT8Genp16wZyjMNc9zJ0W4dyiEz/uzrslO+JDM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xentrace: Use const whenever we point to literal strings
Message-Id: <E1lWjdI-0006Ez-2Q@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:48:56 +0000

commit 51207a2999bc69531412acc6010e2c4fbfbaf7fc
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Apr 6 20:00:25 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 6 20:03:10 2021 +0100

    tools/xentrace: Use const whenever we point to literal strings
    
    literal strings are not meant to be modified. So we should use const
    char * rather than char * when we want to store a pointer to them.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
---
 tools/xentrace/xenalyze.c | 71 ++++++++++++++++++++++++-----------------------
 tools/xentrace/xenctx.c   |  4 +--
 2 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c
index b7f4e2bea8..5de167031e 100644
--- a/tools/xentrace/xenalyze.c
+++ b/tools/xentrace/xenalyze.c
@@ -356,7 +356,7 @@ void parse_symbol_file(char *fn) {
 char * find_symbol(unsigned long long addr) {
     struct symbol_struct * p=G.symbols;
     int i;
-    char * lastname="ZERO";
+    const char * lastname="ZERO";
     unsigned long long offset=addr;
     static char name[144];
 
@@ -495,7 +495,7 @@ struct {
 
 #define HVM_VMX_EXIT_REASON_MAX (EXIT_REASON_XSETBV+1)
 
-char * hvm_vmx_exit_reason_name[HVM_VMX_EXIT_REASON_MAX] = {
+const char * hvm_vmx_exit_reason_name[HVM_VMX_EXIT_REASON_MAX] = {
     [EXIT_REASON_EXCEPTION_NMI]="EXCEPTION_NMI",
     [EXIT_REASON_EXTERNAL_INTERRUPT]="EXTERNAL_INTERRUPT",
     [EXIT_REASON_TRIPLE_FAULT]="TRIPLE_FAULT",
@@ -698,7 +698,7 @@ enum VMEXIT_EXITCODE
 };
 
 #define HVM_SVM_EXIT_REASON_MAX 1025
-char * hvm_svm_exit_reason_name[HVM_SVM_EXIT_REASON_MAX] = {
+const char * hvm_svm_exit_reason_name[HVM_SVM_EXIT_REASON_MAX] = {
     /* 0-15 */
     "VMEXIT_CR0_READ",
     "VMEXIT_CR1_READ",
@@ -875,7 +875,7 @@ char * hvm_svm_exit_reason_name[HVM_SVM_EXIT_REASON_MAX] = {
 #define EXTERNAL_INTERRUPT_MAX 256
 
 /* Stringify numbers */
-char * hvm_extint_vector_name[EXTERNAL_INTERRUPT_MAX] = {
+const char * hvm_extint_vector_name[EXTERNAL_INTERRUPT_MAX] = {
     [SPURIOUS_APIC_VECTOR] = "SPURIOS_APIC",
     [ERROR_APIC_VECTOR] =    "ERROR_APIC",
     [INVALIDATE_TLB_VECTOR]= "INVALIDATE_TLB",
@@ -887,7 +887,7 @@ char * hvm_extint_vector_name[EXTERNAL_INTERRUPT_MAX] = {
 
 #define HVM_TRAP_MAX 20
 
-char * hvm_trap_name[HVM_TRAP_MAX] = {
+const char * hvm_trap_name[HVM_TRAP_MAX] = {
     [0] =  "Divide",
     [1] =  "RESERVED",
     [2] =  "NMI",
@@ -947,7 +947,7 @@ enum {
     HVM_EVENT_VLAPIC,
     HVM_EVENT_HANDLER_MAX
 };
-char * hvm_event_handler_name[HVM_EVENT_HANDLER_MAX] = {
+const char * hvm_event_handler_name[HVM_EVENT_HANDLER_MAX] = {
     "(no handler)",
     "pf_xen",
     "pf_inject",
@@ -1001,7 +1001,7 @@ enum {
     GUEST_INTERRUPT_CASE_MAX,
 };
 
-char *guest_interrupt_case_name[] = {
+const char *guest_interrupt_case_name[] = {
     [GUEST_INTERRUPT_CASE_WAKE_TO_HALT_ALONE]="wake to halt alone",
     /* This interrupt woke, maybe another interrupt before halt */
     [GUEST_INTERRUPT_CASE_WAKE_TO_HALT_ANY]  ="wake to halt any  ",
@@ -1009,7 +1009,7 @@ char *guest_interrupt_case_name[] = {
     [GUEST_INTERRUPT_CASE_INTERRUPT_TO_HALT] ="intr to halt      ",
 };
 
-char *hvm_vol_name[HVM_VOL_MAX] = {
+const char *hvm_vol_name[HVM_VOL_MAX] = {
     [HVM_VOL_VMENTRY]="vmentry",
     [HVM_VOL_VMEXIT] ="vmexit",
     [HVM_VOL_HANDLER]="handler",
@@ -1056,7 +1056,7 @@ enum {
     HYPERCALL_MAX
 };
 
-char *hypercall_name[HYPERCALL_MAX] = {
+const char *hypercall_name[HYPERCALL_MAX] = {
     [HYPERCALL_set_trap_table]="set_trap_table",
     [HYPERCALL_mmu_update]="mmu_update",
     [HYPERCALL_set_gdt]="set_gdt",
@@ -1114,7 +1114,7 @@ enum {
     PF_XEN_EMUL_MAX,
 };
 
-char * pf_xen_emul_name[PF_XEN_EMUL_MAX] = {
+const char * pf_xen_emul_name[PF_XEN_EMUL_MAX] = {
     [PF_XEN_EMUL_LVL_0]="non-linmap",
     [PF_XEN_EMUL_LVL_1]="linmap l1",
     [PF_XEN_EMUL_LVL_2]="linmap l2",
@@ -1140,7 +1140,7 @@ enum {
     PF_XEN_NON_EMUL_MAX,
 };
 
-char * pf_xen_non_emul_name[PF_XEN_NON_EMUL_MAX] = {
+const char * pf_xen_non_emul_name[PF_XEN_NON_EMUL_MAX] = {
     [PF_XEN_NON_EMUL_VA_USER]="va user",
     [PF_XEN_NON_EMUL_VA_KERNEL]="va kernel",
     [PF_XEN_NON_EMUL_EIP_USER]="eip user",
@@ -1160,7 +1160,7 @@ enum {
     PF_XEN_FIXUP_MAX,
 };
 
-char * pf_xen_fixup_name[PF_XEN_FIXUP_MAX] = {
+const char * pf_xen_fixup_name[PF_XEN_FIXUP_MAX] = {
     [PF_XEN_FIXUP_PREALLOC_UNPIN] = "unpin",
     [PF_XEN_FIXUP_PREALLOC_UNHOOK] = "unhook",
     [PF_XEN_FIXUP_UNSYNC] = "unsync",
@@ -1195,7 +1195,7 @@ enum {
 #define SHADOW_RESYNC_FULL    14
 #define SHADOW_RESYNC_ONLY    15
 
-char * pf_xen_name[PF_XEN_MAX] = {
+const char * pf_xen_name[PF_XEN_MAX] = {
     [PF_XEN_NOT_SHADOW]="propagate",
     [PF_XEN_FAST_PROPAGATE]="fast propagate",
     [PF_XEN_FAST_MMIO]="fast mmio",
@@ -1304,7 +1304,7 @@ struct hvm_data {
     struct vcpu_data *v; /* up-pointer */
 
     /* SVM / VMX compatibility. FIXME - should be global */
-    char ** exit_reason_name;
+    const char ** exit_reason_name;
     int exit_reason_max;
     struct hvm_summary_handler_node *exit_reason_summary_handler_list[HVM_EXIT_REASON_MAX];
 
@@ -1408,7 +1408,7 @@ enum {
     HVM_SHORT_SUMMARY_MAX,
 };
 
-char *hvm_short_summary_name[HVM_SHORT_SUMMARY_MAX] = {
+const char *hvm_short_summary_name[HVM_SHORT_SUMMARY_MAX] = {
     [HVM_SHORT_SUMMARY_EMULATE]  ="emulate",
     [HVM_SHORT_SUMMARY_UNSYNC]   ="unsync",
     [HVM_SHORT_SUMMARY_FIXUP]    ="fixup",
@@ -1478,7 +1478,7 @@ enum {
     PV_MAX
 };
 
-char *pv_name[PV_MAX] = {
+const char *pv_name[PV_MAX] = {
     [PV_HYPERCALL]="hypercall",
     [PV_TRAP]="trap",
     [PV_PAGE_FAULT]="page_fault",
@@ -1527,7 +1527,7 @@ int runstate_graph[RUNSTATE_MAX] =
     [RUNSTATE_INIT]=-2,
 };
 
-char * runstate_name[RUNSTATE_MAX]={
+const char * runstate_name[RUNSTATE_MAX]={
     [RUNSTATE_RUNNING]= "running",
     [RUNSTATE_RUNNABLE]="runnable",
     [RUNSTATE_BLOCKED]= "blocked", /* to be blocked */
@@ -1545,7 +1545,7 @@ enum {
     RUNNABLE_STATE_MAX
 };
 
-char * runnable_state_name[RUNNABLE_STATE_MAX]={
+const char * runnable_state_name[RUNNABLE_STATE_MAX]={
     [RUNNABLE_STATE_INVALID]="invalid", /* Should never show up */
     [RUNNABLE_STATE_WAKE]="wake",
     [RUNNABLE_STATE_PREEMPT]="preempt",
@@ -1565,7 +1565,7 @@ enum {
     MEM_MAX
 };
 
-char *mem_name[MEM_MAX] = {
+const char *mem_name[MEM_MAX] = {
     [MEM_PAGE_GRANT_MAP]         = "grant-map",
     [MEM_PAGE_GRANT_UNMAP]       = "grant-unmap",
     [MEM_PAGE_GRANT_TRANSFER]    = "grant-transfer",
@@ -1681,7 +1681,7 @@ enum {
     DOMAIN_RUNSTATE_MAX
 };
 
-char * domain_runstate_name[] = {
+const char * domain_runstate_name[] = {
     [DOMAIN_RUNSTATE_BLOCKED]="blocked",
     [DOMAIN_RUNSTATE_PARTIAL_RUN]="partial run",
     [DOMAIN_RUNSTATE_FULL_RUN]="full run",
@@ -1698,7 +1698,7 @@ enum {
     POD_RECLAIM_CONTEXT_MAX
 };
 
-char * pod_reclaim_context_name[] = {
+const char * pod_reclaim_context_name[] = {
     [POD_RECLAIM_CONTEXT_UNKNOWN]="unknown",
     [POD_RECLAIM_CONTEXT_FAULT]="fault",
     [POD_RECLAIM_CONTEXT_BALLOON]="balloon",
@@ -1756,7 +1756,7 @@ enum {
     TOPLEVEL_MAX=TOPLEVEL_HW+1,
 };
 
-char * toplevel_name[TOPLEVEL_MAX] = {
+const char * toplevel_name[TOPLEVEL_MAX] = {
     [TOPLEVEL_GEN]="gen",
     [TOPLEVEL_SCHED]="sched",
     [TOPLEVEL_DOM0OP]="dom0op",
@@ -2263,7 +2263,7 @@ static inline void clear_interval_cycles(struct interval_element *e) {
     e->instructions = 0;
 }
 
-static inline void print_cpu_affinity(struct cycle_summary *s, char *p) {
+static inline void print_cpu_affinity(struct cycle_summary *s, const char *p) {
     if(s->count) {
         long long avg;
 
@@ -2326,7 +2326,8 @@ static inline void print_cycle_percent_summary(struct cycle_summary *s,
     }
 }
 
-static inline void print_cycle_summary(struct cycle_summary *s, char *p) {
+static inline void print_cycle_summary(struct cycle_summary *s,
+                                       const char *p) {
     if(s->count) {
         long long avg;
 
@@ -2938,7 +2939,7 @@ void hvm_update_short_summary(struct hvm_data *h, int element) {
 }
 
 void hvm_short_summary(struct hvm_short_summary_struct *hss,
-                       tsc_t total, char *prefix) {
+                       tsc_t total, const char *prefix) {
     char desc[80];
     int i;
 
@@ -3352,7 +3353,7 @@ void hvm_pf_xen_process(struct record_info *ri, struct hvm_data *h) {
          fprintf(warn, "%s: Strange, postprocess already set\n", __func__);
 }
 
-char * hvm_vlapic_icr_dest_shorthand_name[4] = {
+const char * hvm_vlapic_icr_dest_shorthand_name[4] = {
     "dest_field", "self", "all-inc", "all-exc"
 };
 
@@ -3800,7 +3801,7 @@ void update_io_address(struct io_address ** list, unsigned int pa, int dir,
     update_cycles(&p->summary[dir], arc_cycles);
 }
 
-void hvm_io_address_summary(struct io_address *list, char * s) {
+void hvm_io_address_summary(struct io_address *list, const char * s) {
     if(!list)
         return;
 
@@ -4484,7 +4485,7 @@ void hvm_intr_window_process(struct record_info *ri, struct hvm_data *h)
         int32_t intr;
     } *r = (typeof(r))h->d;
 
-    char *intsrc_name[] = {
+    const char *intsrc_name[] = {
         "none",
         "pic",
         "lapic",
@@ -4687,14 +4688,15 @@ void hvm_generic_postprocess(struct hvm_data *h)
     }
 }
 
-void hvm_generic_dump(struct record_info *ri, char * prefix)
+void hvm_generic_dump(struct record_info *ri, const char * prefix)
 {
     struct {
         unsigned vcpu:16, domain:16;
         unsigned d[4];
     } *cr = (typeof(cr))ri->d;
 
-    char *evt_string, evt_number[256];
+    const char *evt_string;
+    char evt_number[256];
     int i, evt, is_64 = 0;
 
     evt = ri->event - TRC_HVM_HANDLER;
@@ -6042,10 +6044,11 @@ void shadow_propagate_process(struct record_info *ri, struct hvm_data *h)
         fprintf(warn, "%s: Strange, postprocess already set\n", __func__);
 }
 
-void shadow_fault_generic_dump(unsigned int event, uint32_t *d, char *prefix,
-                         char * dump_header)
+void shadow_fault_generic_dump(unsigned int event, uint32_t *d,
+                               const char *prefix, const char * dump_header)
 {
-    char *evt_string, evt_number[10];
+    const char *evt_string;
+    char evt_number[10];
     union shadow_event sevt = { .event = event };
     int i;
 
@@ -8643,7 +8646,7 @@ void dump_generic(FILE * f, struct record_info *ri)
     fprintf(f, " ]\n");
 }
 
-void dump_raw(char * s, struct record_info *ri)
+void dump_raw(const char * s, struct record_info *ri)
 {
     int i;
 
diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c
index 2fa864f867..972f473dbf 100644
--- a/tools/xentrace/xenctx.c
+++ b/tools/xentrace/xenctx.c
@@ -302,7 +302,7 @@ static void read_symbol_table(const char *symtab)
 
 #if defined(__i386__) || defined(__x86_64__)
 #define CR0_PE  0x1
-char *flag_values[22][2] =
+const char *flag_values[22][2] =
 {/*  clear,     set,       bit# */
     { NULL,     "c"    }, // 0        Carry
     { NULL,     NULL   }, // 1
@@ -334,7 +334,7 @@ static void print_flags(uint64_t flags)
 
     printf("\nflags: %08" PRIx64, flags);
     for (i = 21; i >= 0; i--) {
-        char *s = flag_values[i][(flags >> i) & 1];
+        const char *s = flag_values[i][(flags >> i) & 1];
         if (s != NULL)
             printf(" %s", s);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:49:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:49:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110745.211462 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjdT-0003wA-IE; Wed, 14 Apr 2021 17:49:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110745.211462; Wed, 14 Apr 2021 17:49: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 1lWjdT-0003w2-FE; Wed, 14 Apr 2021 17:49:07 +0000
Received: by outflank-mailman (input) for mailman id 110745;
 Wed, 14 Apr 2021 17:49: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 1lWjdS-0003vr-7h
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:49: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 1lWjdS-00076E-6s
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:49:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjdS-0006GI-5V
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:49: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=z3A17lH/HOQppiAcnzr1aunajUMDiWH93PRz4X6WbSU=; b=duu/NXSejM/bbWqM/12bs6qY8a
	dOqKsHlfePPxUwT4s5HS4wQm3wTMwdYu/p2VoMblr2Cs+aI1M5I0BaWsvBjuQtZ6QoSj21hsfAMGZ
	mRyxAQkuCxbpBFsxC6vyLG+QYIlt/6z+JoUOdj4BuVVSv00ZZpiCJ/x/GsvIk7tjX6Gk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/firmware: hvmloader: Use const in __bug() and __assert_failed()
Message-Id: <E1lWjdS-0006GI-5V@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:49:06 +0000

commit 19be4d56a1f7aa65eb4d92276fa5d386e9cb2a62
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Apr 6 20:01:18 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 6 20:03:21 2021 +0100

    tools/firmware: hvmloader: Use const in __bug() and __assert_failed()
    
    __bug() and __assert_failed() are not meant to modify the string
    parameters. So mark them as const.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/firmware/hvmloader/util.c | 4 ++--
 tools/firmware/hvmloader/util.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c
index 7da144b0bb..581b35e5cf 100644
--- a/tools/firmware/hvmloader/util.c
+++ b/tools/firmware/hvmloader/util.c
@@ -722,14 +722,14 @@ static void __attribute__((noreturn)) crash(void)
         asm volatile ( "hlt" );
 }
 
-void __assert_failed(char *assertion, char *file, int line)
+void __assert_failed(const char *assertion, const char *file, int line)
 {
     printf("*** HVMLoader assertion '%s' failed at %s:%d\n",
            assertion, file, line);
     crash();
 }
 
-void __bug(char *file, int line)
+void __bug(const char *file, int line)
 {
     printf("*** HVMLoader bug at %s:%d\n", file, line);
     crash();
diff --git a/tools/firmware/hvmloader/util.h b/tools/firmware/hvmloader/util.h
index 4f0baade0e..8d95eab28a 100644
--- a/tools/firmware/hvmloader/util.h
+++ b/tools/firmware/hvmloader/util.h
@@ -34,11 +34,11 @@ enum {
 #undef NULL
 #define NULL ((void*)0)
 
-void __assert_failed(char *assertion, char *file, int line)
+void __assert_failed(const char *assertion, const char *file, int line)
     __attribute__((noreturn));
 #define ASSERT(p) \
     do { if (!(p)) __assert_failed(#p, __FILE__, __LINE__); } while (0)
-void __bug(char *file, int line) __attribute__((noreturn));
+void __bug(const char *file, int line) __attribute__((noreturn));
 #define BUG() __bug(__FILE__, __LINE__)
 #define BUG_ON(p) do { if (p) BUG(); } while (0)
 #define BUILD_BUG_ON(p) ((void)sizeof(char[1 - 2 * !!(p)]))
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:49:19 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:49:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110746.211466 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjdd-0003xW-Jc; Wed, 14 Apr 2021 17:49:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110746.211466; Wed, 14 Apr 2021 17:49: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 1lWjdd-0003xO-Gm; Wed, 14 Apr 2021 17:49:17 +0000
Received: by outflank-mailman (input) for mailman id 110746;
 Wed, 14 Apr 2021 17:49: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 1lWjdc-0003xG-By
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:49: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 1lWjdc-00076M-AB
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:49:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjdc-0006Hd-9P
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:49: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=RKOlJQjrabgL1nUQkR5lzF9BXS6EHtNs+d4Da0zMpIo=; b=gUU87L4ymNqK0WsspJHqE7cCqT
	xujdjNjYUXNHTva+oClgWehLaysQS6ILsyWFoCedXYElxXQaI1Vh+vuamwRy81FUthSqjvbyadIUp
	VU9cv4GwWzpbwsnLwzRgVfWq8e8IfYwwEUr35NXCTl8NZ56QtOtmOmZ0HKG0zPwgSPh4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] fix for_each_cpu() again for NR_CPUS=1
Message-Id: <E1lWjdc-0006Hd-9P@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:49:16 +0000

commit 625faf9f002bd6ff4b6457a016b8ff338223b659
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Apr 7 12:24:45 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Apr 7 12:24:45 2021 +0200

    fix for_each_cpu() again for NR_CPUS=1
    
    Unfortunately aa50f45332f1 ("xen: fix for_each_cpu when NR_CPUS=1") has
    caused quite a bit of fallout with gcc10, e.g. (there are at least two
    more similar ones, and I didn't bother trying to find them all):
    
    In file included from .../xen/include/xen/config.h:13,
                     from <command-line>:
    core_parking.c: In function ‘core_parking_power’:
    .../xen/include/asm/percpu.h:12:51: error: array subscript 1 is above array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds]
       12 |     (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
    .../xen/include/xen/compiler.h:141:29: note: in definition of macro ‘RELOC_HIDE’
      141 |     (typeof(ptr)) (__ptr + (off)); })
          |                             ^~~
    core_parking.c:133:39: note: in expansion of macro ‘per_cpu’
      133 |             core_tmp = cpumask_weight(per_cpu(cpu_core_mask, cpu));
          |                                       ^~~~~~~
    In file included from .../xen/include/xen/percpu.h:4,
                     from .../xen/include/asm/msr.h:7,
                     from .../xen/include/asm/time.h:5,
                     from .../xen/include/xen/time.h:76,
                     from .../xen/include/xen/spinlock.h:4,
                     from .../xen/include/xen/cpu.h:5,
                     from core_parking.c:19:
    .../xen/include/asm/percpu.h:6:22: note: while referencing ‘__per_cpu_offset’
        6 | extern unsigned long __per_cpu_offset[NR_CPUS];
          |                      ^~~~~~~~~~~~~~~~
    
    One of the further errors even went as far as claiming that an array
    index (range) of [0, 0] was outside the bounds of a [1] array, so
    something fishy is pretty clearly going on there.
    
    The compiler apparently wants to be able to see that the loop isn't
    really a loop in order to avoid triggering such warnings, yet what
    exactly makes it consider the loop exit condition constant and within
    the [0, 1] range isn't obvious - using ((mask)->bits[0] & 1) instead of
    cpumask_test_cpu() for example did _not_ help.
    
    Re-instate a special form of for_each_cpu(), experimentally "proven" to
    avoid the diagnostics.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
---
 xen/include/xen/cpumask.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/xen/cpumask.h b/xen/include/xen/cpumask.h
index e69589fc08..9826707909 100644
--- a/xen/include/xen/cpumask.h
+++ b/xen/include/xen/cpumask.h
@@ -368,10 +368,15 @@ static inline void free_cpumask_var(cpumask_var_t mask)
 #define FREE_CPUMASK_VAR(m) free_cpumask_var(m)
 #endif
 
+#if NR_CPUS > 1
 #define for_each_cpu(cpu, mask)			\
 	for ((cpu) = cpumask_first(mask);	\
 	     (cpu) < nr_cpu_ids;		\
 	     (cpu) = cpumask_next(cpu, mask))
+#else /* NR_CPUS == 1 */
+#define for_each_cpu(cpu, mask)			\
+	for ((cpu) = 0; (cpu) < cpumask_test_cpu(0, mask); ++(cpu))
+#endif /* NR_CPUS */
 
 /*
  * The following particular system cpumasks and operations manage
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:49:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:49:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110747.211469 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjdn-0003z1-LF; Wed, 14 Apr 2021 17:49:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110747.211469; Wed, 14 Apr 2021 17:49: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 1lWjdn-0003yt-IF; Wed, 14 Apr 2021 17:49:27 +0000
Received: by outflank-mailman (input) for mailman id 110747;
 Wed, 14 Apr 2021 17:49: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 1lWjdm-0003yl-Fy
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:49: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 1lWjdm-00076l-De
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:49:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjdm-0006Iv-Cm
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:49: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=48sXX93DLZT5AH0e8eKKCDlen4iVSMiB99nhMJosyDM=; b=MBfaCAbPxoHMztoRmI8DP+zTE8
	c3pseAVIIvwoMabMuj/KDdqqF3w9iaWjCkoGs9b6fnpGNXr2X1nhqToUdg5OGLk+sYGFvHchUGNJw
	6CcqQvTieiMhMJdi7tXlW/OyVUPCYdS0NLCpZtf/ZV5UXEZfIZPHSiLqjJ+hCiwtN0Yo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/page_alloc: Don't hold the heap_lock when clearing PGC_need_scrub
Message-Id: <E1lWjdm-0006Iv-Cm@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:49:26 +0000

commit 025eacc13f6147ffa99da5ecee4ed96e7fe8e887
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Jan 21 11:12:00 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Apr 7 19:30:55 2021 +0100

    xen/page_alloc: Don't hold the heap_lock when clearing PGC_need_scrub
    
    Currently, the heap_lock is held when clearing PGC_need_scrub in
    alloc_heap_pages(). However, this is unnecessary because the only caller
    (mark_page_offline()) that can concurrently modify the count_info is
    using cmpxchg() in a loop.
    
    Therefore, rework the code to avoid holding the heap_lock and use
    test_and_clear_bit() instead.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/page_alloc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 1744e6faa5..ace6333c18 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1032,16 +1032,12 @@ static struct page_info *alloc_heap_pages(
     {
         for ( i = 0; i < (1U << order); i++ )
         {
-            if ( test_bit(_PGC_need_scrub, &pg[i].count_info) )
+            if ( test_and_clear_bit(_PGC_need_scrub, &pg[i].count_info) )
             {
                 if ( !(memflags & MEMF_no_scrub) )
                     scrub_one_page(&pg[i]);
 
                 dirty_cnt++;
-
-                spin_lock(&heap_lock);
-                pg[i].count_info &= ~PGC_need_scrub;
-                spin_unlock(&heap_lock);
             }
             else if ( !(memflags & MEMF_no_scrub) )
                 check_one_page(&pg[i]);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:49:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:49:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110749.211473 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjdx-00040d-Mn; Wed, 14 Apr 2021 17:49:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110749.211473; Wed, 14 Apr 2021 17:49: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 1lWjdx-00040V-Jx; Wed, 14 Apr 2021 17:49:37 +0000
Received: by outflank-mailman (input) for mailman id 110749;
 Wed, 14 Apr 2021 17:49: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 1lWjdw-00040O-He
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:49: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 1lWjdw-00076z-Gs
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:49:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjdw-0006K8-GG
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:49: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=6CuqU+r33Qwgc7Rq7QDr3F5UUMIgTPY40k4Qi9HUj10=; b=NCnQWDplNJc1iGNmUET7Qzadli
	g0KvB5zYqRIccOzbp8x7iBmXbxzzX1+cFGzNjryWvR2Jvqk6mbMKoMmZdlfzXEwfS+0Khxp4r8O24
	lR/PSPrMhIBxGmu2wkiDY5Vtuy53CDdtJAmbGh1ouh1TkFialWmcoPn18Z3YHg3iPun0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: refine guest_mode()
Message-Id: <E1lWjdw-0006K8-GG@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:49:36 +0000

commit dfcf494f96671a9d3ee2fed70250ef1eedc1c00e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:12:51 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:12:51 2021 +0200

    x86: refine guest_mode()
    
    The 2nd of the assertions as well as the macro's return value have been
    assuming we're on the primary stack. While for most IST exceptions we
    switch back to the main one when user mode was interrupted, for #DF we
    intentionally never do, and hence a #DF actually triggering on a user
    mode insn (which then is still a Xen bug) would in turn trigger this
    assertion, rather than cleanly logging state.
    
    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>
---
 xen/include/asm-x86/regs.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/include/asm-x86/regs.h b/xen/include/asm-x86/regs.h
index 8d984ea388..3fb94deedc 100644
--- a/xen/include/asm-x86/regs.h
+++ b/xen/include/asm-x86/regs.h
@@ -10,9 +10,10 @@
     /* Frame pointer must point into current CPU stack. */                    \
     ASSERT(diff < STACK_SIZE);                                                \
     /* If not a guest frame, it must be a hypervisor frame. */                \
-    ASSERT((diff == 0) || (r->cs == __HYPERVISOR_CS));                        \
+    if ( diff < PRIMARY_STACK_SIZE )                                          \
+        ASSERT(!diff || ((r)->cs == __HYPERVISOR_CS));                        \
     /* Return TRUE if it's a guest frame. */                                  \
-    (diff == 0);                                                              \
+    !diff || ((r)->cs != __HYPERVISOR_CS);                                    \
 })
 
 #define read_sreg(name) ({                           \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:49:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:49:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110750.211478 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWje7-00041o-OQ; Wed, 14 Apr 2021 17:49:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110750.211478; Wed, 14 Apr 2021 17:49: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 1lWje7-00041g-LO; Wed, 14 Apr 2021 17:49:47 +0000
Received: by outflank-mailman (input) for mailman id 110750;
 Wed, 14 Apr 2021 17:49: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 1lWje6-00041W-Kw
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:49: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 1lWje6-00077D-K4
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:49:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWje6-0006Lf-JP
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:49: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=v2yB36wsxSZqtmmesB2Rg59l7/oF9YK7uqELRfa6vy8=; b=PVSeemVnnq36baNHmlN6c70SN6
	E3uIRel23No43lL4GyfRPEJASoOAdQWtjH8PH6pgo/CBbVU0kYsmIlAr03E39J2/nS0LVVSXuPrQ0
	iW0bZAXrsiD7lGRzs8qGGCpelSdFooncNiZYQ7F4qdxds+6gnvb3Afc8iSPZbPxYZA9M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/CPUID: move some static masks into .init
Message-Id: <E1lWje6-0006Lf-JP@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:49:46 +0000

commit 186b09ea01c925c3997f1a05f585b35151d32d1a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:14:25 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:14:25 2021 +0200

    x86/CPUID: move some static masks into .init
    
    Except for hvm_shadow_max_featuremask and deep_features they're
    referenced by __init functions only.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpuid.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index dde3e95284..18b08d9b87 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -16,12 +16,15 @@
 const uint32_t known_features[] = INIT_KNOWN_FEATURES;
 const uint32_t special_features[] = INIT_SPECIAL_FEATURES;
 
-static const uint32_t pv_max_featuremask[] = INIT_PV_MAX_FEATURES;
+static const uint32_t __initconst pv_max_featuremask[] = INIT_PV_MAX_FEATURES;
 static const uint32_t hvm_shadow_max_featuremask[] = INIT_HVM_SHADOW_MAX_FEATURES;
-static const uint32_t hvm_hap_max_featuremask[] = INIT_HVM_HAP_MAX_FEATURES;
-static const uint32_t pv_def_featuremask[] = INIT_PV_DEF_FEATURES;
-static const uint32_t hvm_shadow_def_featuremask[] = INIT_HVM_SHADOW_DEF_FEATURES;
-static const uint32_t hvm_hap_def_featuremask[] = INIT_HVM_HAP_DEF_FEATURES;
+static const uint32_t __initconst hvm_hap_max_featuremask[] =
+    INIT_HVM_HAP_MAX_FEATURES;
+static const uint32_t __initconst pv_def_featuremask[] = INIT_PV_DEF_FEATURES;
+static const uint32_t __initconst hvm_shadow_def_featuremask[] =
+    INIT_HVM_SHADOW_DEF_FEATURES;
+static const uint32_t __initconst hvm_hap_def_featuremask[] =
+    INIT_HVM_HAP_DEF_FEATURES;
 static const uint32_t deep_features[] = INIT_DEEP_FEATURES;
 
 static int __init parse_xen_cpuid(const char *s)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:49:59 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:49:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110751.211482 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjeI-00043H-Pu; Wed, 14 Apr 2021 17:49:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110751.211482; Wed, 14 Apr 2021 17:49: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 1lWjeI-000439-Mv; Wed, 14 Apr 2021 17:49:58 +0000
Received: by outflank-mailman (input) for mailman id 110751;
 Wed, 14 Apr 2021 17:49: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 1lWjeG-00042z-Qq
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:49: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 1lWjeG-00077L-Nm
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:49:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjeG-0006Mp-MU
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:49: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=ltGAQZBpaihdSwwKCqcnncD8vEyQ9KjiS5urDeQJYGU=; b=i3ooqYZ2zNBlzWOwjSmvD9TbqD
	0sWcbM6QN+OwJv2+muErI8YUuOm61bcNDLQh5gKrKDHU57CTLqwIVOosQovFYYm+7TgR2z5sYXa4D
	LVOiIQ5aO4wXvDhCup3SeSIq3yIdODO/yAjB87WzURCbQktH75ZkanSmUakGfISt5U+c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxg: don't use max policy in xc_cpuid_xend_policy()
Message-Id: <E1lWjeG-0006Mp-MU@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:49:56 +0000

commit d0d1003b97279f88232d6ec7a406d3cf58c71327
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:14:58 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:14:58 2021 +0200

    libxg: don't use max policy in xc_cpuid_xend_policy()
    
    using max undermines the separation between default and max. For
    example, turning off AVX512F on an MPX-capable system silently turns on
    MPX, despite this not being part of the default policy anymore. Since
    the information is used only for determining what to convert 'x' to (but
    not to e.g. validate '1' settings), the effect of this change is
    identical for guests with (suitable) "cpuid=" settings to that of the
    changes separating default from max and then converting (e.g.) MPX from
    being part of default to only being part of max for guests without
    (affected) "cpuid=" settings.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/guest/xg_cpuid_x86.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index aae6931a11..5ea69ad3d5 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -288,11 +288,11 @@ static int xc_cpuid_xend_policy(
     unsigned int nr_leaves, nr_msrs;
     uint32_t err_leaf = -1, err_subleaf = -1, err_msr = -1;
     /*
-     * Three full policies.  The host, domain max, and domain current for the
-     * domain type.
+     * Three full policies.  The host, default for the domain type,
+     * and domain current.
      */
-    xen_cpuid_leaf_t *host = NULL, *max = NULL, *cur = NULL;
-    unsigned int nr_host, nr_max, nr_cur;
+    xen_cpuid_leaf_t *host = NULL, *def = NULL, *cur = NULL;
+    unsigned int nr_host, nr_def, nr_cur;
 
     if ( xc_domain_getinfo(xch, domid, 1, &di) != 1 ||
          di.domid != domid )
@@ -312,7 +312,7 @@ static int xc_cpuid_xend_policy(
 
     rc = -ENOMEM;
     if ( (host = calloc(nr_leaves, sizeof(*host))) == NULL ||
-         (max  = calloc(nr_leaves, sizeof(*max)))  == NULL ||
+         (def  = calloc(nr_leaves, sizeof(*def)))  == NULL ||
          (cur  = calloc(nr_leaves, sizeof(*cur)))  == NULL )
     {
         ERROR("Unable to allocate memory for %u CPUID leaves", nr_leaves);
@@ -330,15 +330,16 @@ static int xc_cpuid_xend_policy(
         goto fail;
     }
 
-    /* Get the domain's max policy. */
+    /* Get the domain type's default policy. */
     nr_msrs = 0;
-    nr_max = nr_leaves;
-    rc = xc_get_system_cpu_policy(xch, di.hvm ? XEN_SYSCTL_cpu_policy_hvm_max
-                                              : XEN_SYSCTL_cpu_policy_pv_max,
-                                  &nr_max, max, &nr_msrs, NULL);
+    nr_def = nr_leaves;
+    rc = xc_get_system_cpu_policy(xch,
+                                  di.hvm ? XEN_SYSCTL_cpu_policy_hvm_default
+                                         : XEN_SYSCTL_cpu_policy_pv_default,
+                                  &nr_def, def, &nr_msrs, NULL);
     if ( rc )
     {
-        PERROR("Failed to obtain %s max policy", di.hvm ? "hvm" : "pv");
+        PERROR("Failed to obtain %s def policy", di.hvm ? "hvm" : "pv");
         rc = -errno;
         goto fail;
     }
@@ -359,10 +360,10 @@ static int xc_cpuid_xend_policy(
     for ( ; xend->leaf != XEN_CPUID_INPUT_UNUSED; ++xend )
     {
         xen_cpuid_leaf_t *cur_leaf = find_leaf(cur, nr_cur, xend);
-        const xen_cpuid_leaf_t *max_leaf = find_leaf(max, nr_max, xend);
+        const xen_cpuid_leaf_t *def_leaf = find_leaf(def, nr_def, xend);
         const xen_cpuid_leaf_t *host_leaf = find_leaf(host, nr_host, xend);
 
-        if ( cur_leaf == NULL || max_leaf == NULL || host_leaf == NULL )
+        if ( cur_leaf == NULL || def_leaf == NULL || host_leaf == NULL )
         {
             ERROR("Missing leaf %#x, subleaf %#x", xend->leaf, xend->subleaf);
             goto fail;
@@ -371,7 +372,7 @@ static int xc_cpuid_xend_policy(
         for ( unsigned int i = 0; i < ARRAY_SIZE(xend->policy); i++ )
         {
             uint32_t *cur_reg = &cur_leaf->a + i;
-            const uint32_t *max_reg = &max_leaf->a + i;
+            const uint32_t *def_reg = &def_leaf->a + i;
             const uint32_t *host_reg = &host_leaf->a + i;
 
             if ( xend->policy[i] == NULL )
@@ -386,7 +387,7 @@ static int xc_cpuid_xend_policy(
                 else if ( xend->policy[i][j] == '0' )
                     val = false;
                 else if ( xend->policy[i][j] == 'x' )
-                    val = test_bit(31 - j, max_reg);
+                    val = test_bit(31 - j, def_reg);
                 else if ( xend->policy[i][j] == 'k' ||
                           xend->policy[i][j] == 's' )
                     val = test_bit(31 - j, host_reg);
@@ -419,7 +420,7 @@ static int xc_cpuid_xend_policy(
 
  fail:
     free(cur);
-    free(max);
+    free(def);
     free(host);
 
     return rc;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:50:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:50:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110752.211487 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjeS-0004lH-SW; Wed, 14 Apr 2021 17:50:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110752.211487; Wed, 14 Apr 2021 17:50: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 1lWjeS-0004l9-OT; Wed, 14 Apr 2021 17:50:08 +0000
Received: by outflank-mailman (input) for mailman id 110752;
 Wed, 14 Apr 2021 17:50: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 1lWjeQ-0004h5-Tu
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:50: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 1lWjeQ-00077g-TA
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:50:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjeQ-0006O5-QN
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:50: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=te5Cxdy2nHaZoQyyeVdV+AUuIz/Eb0M9OtACdazNJ8Y=; b=BLOH2IjM75hV8NlesUu9jFotDU
	ERfiMAjc+R9hPQ7ZJwlUvPiOUJN0si45NFle70sAsbblGu79Sz1hO44XgkaiHuBFXB+zKITuS41tw
	cvCPFdZ+ns5+2cqFhMp4KnwlmPXFOSQXixOIykPOFGANSQyYKks8A377FfJHygHRnfMI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/PV: make post-migration page state consistent
Message-Id: <E1lWjeQ-0006O5-QN@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:50:06 +0000

commit 0a87e677f4f4527c439fa12a6d7fa44a28e43cb3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:15:38 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:15:38 2021 +0200

    x86/PV: make post-migration page state consistent
    
    When a page table page gets de-validated, its type reference count drops
    to zero (and PGT_validated gets cleared), but its type remains intact.
    XEN_DOMCTL_getpageframeinfo3, therefore, so far reported prior usage for
    such pages. An intermediate write to such a page via e.g.
    MMU_NORMAL_PT_UPDATE, however, would transition the page's type to
    PGT_writable_page, thus altering what XEN_DOMCTL_getpageframeinfo3 would
    return. In libxc the decision which pages to normalize / localize
    depends solely on the type returned from the domctl. As a result without
    further precautions the guest won't be able to tell whether such a page
    has had its (apparent) PTE entries transitioned to the new MFNs.
    
    Add a check of PGT_validated, thus consistently avoiding normalization /
    localization in the tool stack.
    
    Also use XEN_DOMCTL_PFINFO_NOTAB in the variable's initializer instead
    open coding it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/domctl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index b129d2cc2f..2aea5b6e9a 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -262,7 +262,7 @@ long arch_do_domctl(
 
         for ( i = 0; i < num; ++i )
         {
-            unsigned long gfn = 0, type = 0;
+            unsigned long gfn = 0, type = XEN_DOMCTL_PFINFO_NOTAB;
             struct page_info *page;
             p2m_type_t t;
 
@@ -302,6 +302,8 @@ long arch_do_domctl(
 
                 if ( page->u.inuse.type_info & PGT_pinned )
                     type |= XEN_DOMCTL_PFINFO_LPINTAB;
+                else if ( !(page->u.inuse.type_info & PGT_validated) )
+                    type = XEN_DOMCTL_PFINFO_NOTAB;
 
                 if ( page->count_info & PGC_broken )
                     type = XEN_DOMCTL_PFINFO_BROKEN;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:50:18 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:50:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110753.211490 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjec-0004o4-V2; Wed, 14 Apr 2021 17:50:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110753.211490; Wed, 14 Apr 2021 17:50: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 1lWjec-0004nw-Ro; Wed, 14 Apr 2021 17:50:18 +0000
Received: by outflank-mailman (input) for mailman id 110753;
 Wed, 14 Apr 2021 17:50: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 1lWjeb-0004nl-18
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:50: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 1lWjeb-00077m-0J
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:50:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjea-0006PD-Vi
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:50: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=3kMgJbb26OCqWyb17Um3zwIJY6AJUaj9JqXgtDwPOfU=; b=LjTjZCJOibqHd6xMKB6FeMCxlh
	p0Kyv4u/AP6vdGykzHjTcr70CtI9oR2pMntoTfheXgKBW6FvtNF9V38zKt9MKXeruxnNSjnabbwYd
	g+L4shDdNhx3+w6SN38Z6D2A5AZvbv0vbVn2SD6OPZv5/nIxmBUKyFjki/nQaf1PJ3K4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: guard against straight-line speculation past RET
Message-Id: <E1lWjea-0006PD-Vi@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:50:16 +0000

commit 71b0b475d801ebeb83a6ba402425135c314fa2df
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:16:22 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:16:22 2021 +0200

    x86: guard against straight-line speculation past RET
    
    Under certain conditions CPUs can speculate into the instruction stream
    past a RET instruction. Guard against this just like 3b7dab93f240
    ("x86/spec-ctrl: Protect against CALL/JMP straight-line speculation")
    did - by inserting an "INT $3" insn. It's merely the mechanics of how to
    achieve this that differ: A set of macros gets introduced to post-
    process RET insns issued by the compiler (or living in assembly files).
    
    Unfortunately for clang this requires further features their built-in
    assembler doesn't support: We need to be able to override insn mnemonics
    produced by the compiler (which may be impossible, if internally
    assembly mnemonics never get generated).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/Makefile                    |  5 ++++-
 xen/include/asm-x86/asm-defns.h | 16 ++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 9f3be7766d..3a8fb7ec7e 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -145,7 +145,10 @@ t2 = $(call as-insn,$(CC) -I$(BASEDIR)/include,".include \"asm-x86/asm-defns.h\"
 # https://bugs.llvm.org/show_bug.cgi?id=36110
 t3 = $(call as-insn,$(CC),".macro FOO;.endm"$(close); asm volatile $(open)".macro FOO;.endm",-no-integrated-as)
 
-CLANG_FLAGS += $(call or,$(t1),$(t2),$(t3))
+# Check whether macros can override insn mnemonics in inline assembly.
+t4 = $(call as-insn,$(CC),".macro ret; .error; .endm; .macro retq; .error; .endm",-no-integrated-as)
+
+CLANG_FLAGS += $(call or,$(t1),$(t2),$(t3),$(t4))
 endif
 
 CLANG_FLAGS += -Werror=unknown-warning-option
diff --git a/xen/include/asm-x86/asm-defns.h b/xen/include/asm-x86/asm-defns.h
index 505f39ad5f..e164437798 100644
--- a/xen/include/asm-x86/asm-defns.h
+++ b/xen/include/asm-x86/asm-defns.h
@@ -57,6 +57,22 @@
     INDIRECT_BRANCH jmp \arg
 .endm
 
+/*
+ * To guard against speculation past RET, insert a breakpoint insn
+ * immediately after them.
+ */
+.macro ret operand:vararg
+    retq \operand
+.endm
+.macro retq operand:vararg
+    .ifb \operand
+    .byte 0xc3
+    .else
+    .byte 0xc2
+    .word \operand
+    .endif
+.endm
+
 .macro guest_access_mask_ptr ptr:req, scratch1:req, scratch2:req
 #if defined(CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS)
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:50:29 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:50:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110754.211494 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjem-0004pq-WD; Wed, 14 Apr 2021 17:50:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110754.211494; Wed, 14 Apr 2021 17:50: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 1lWjem-0004ph-TE; Wed, 14 Apr 2021 17:50:28 +0000
Received: by outflank-mailman (input) for mailman id 110754;
 Wed, 14 Apr 2021 17:50: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 1lWjel-0004pW-4w
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:50: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 1lWjel-00078A-4F
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:50:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjel-0006QY-2g
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:50: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=163ojadEiL+ekMN1P+56tEjM85WRRIVnNAeimxm/YTc=; b=mCKnyn0/r+lZFaNQRQOlA5ujtJ
	plLnIPqXWFgRgDRwxQMwM5jDea4ajkFMnDbOAHzFwugX0+mDcbppGUF35yP/+8A/Z/MFWQ4fodShi
	A++wj86MjJQ7ftUhXS4vGPLCa05Nz6PEBH+51Pq4QhAOcQL2JccqdG7d2D8pFHmvZ5DA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: limit amount of INT3 in IND_THUNK_*
Message-Id: <E1lWjel-0006QY-2g@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:50:27 +0000

commit 9689b1acab71adc2bcc07b3e23c141907dd9ecb8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:17:04 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:17:04 2021 +0200

    x86: limit amount of INT3 in IND_THUNK_*
    
    There's no point having every replacement variant to also specify the
    INT3 - just have it once in the base macro. When patching, NOPs will get
    inserted, which are fine to speculate through (until reaching the INT3).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/indirect-thunk.S | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/indirect-thunk.S b/xen/arch/x86/indirect-thunk.S
index 7392aee127..a090b35dcf 100644
--- a/xen/arch/x86/indirect-thunk.S
+++ b/xen/arch/x86/indirect-thunk.S
@@ -11,6 +11,9 @@
 
 #include <asm/asm_defns.h>
 
+/* Don't transform the "ret" further down. */
+.purgem ret
+
 .macro IND_THUNK_RETPOLINE reg:req
         call 2f
 1:
@@ -24,12 +27,10 @@
 .macro IND_THUNK_LFENCE reg:req
         lfence
         jmp *%\reg
-        int3 /* Halt straight-line speculation */
 .endm
 
 .macro IND_THUNK_JMP reg:req
         jmp *%\reg
-        int3 /* Halt straight-line speculation */
 .endm
 
 /*
@@ -44,6 +45,8 @@ ENTRY(__x86_indirect_thunk_\reg)
         __stringify(IND_THUNK_LFENCE \reg), X86_FEATURE_IND_THUNK_LFENCE, \
         __stringify(IND_THUNK_JMP \reg),    X86_FEATURE_IND_THUNK_JMP
 
+        int3 /* Halt straight-line speculation */
+
         .size __x86_indirect_thunk_\reg, . - __x86_indirect_thunk_\reg
         .type __x86_indirect_thunk_\reg, @function
 .endm
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:50:39 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:50:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110755.211498 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjex-0004r4-1j; Wed, 14 Apr 2021 17:50:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110755.211498; Wed, 14 Apr 2021 17:50:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjew-0004qw-Uu; Wed, 14 Apr 2021 17:50:38 +0000
Received: by outflank-mailman (input) for mailman id 110755;
 Wed, 14 Apr 2021 17:50: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 1lWjev-0004qm-8z
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:50: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 1lWjev-00078M-7a
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:50:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjev-0006Rp-6r
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:50: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=WZei5ArdmYTrDk+Luh8BQVWyyO0OTT6ZsnCOshUER9g=; b=hb7ir9KeTD4UWqHv5N6Hj3eMqN
	o6G/9pt4PR7XheDQW1yNhmi+6dX4UbC5xLB/rIXg7MoN4ez5ZulUlQrPOeZu4fblntt0j+YH7UQBZ
	GplwKH4kuN/ZxmNjYmflSup30gcdM2GDZuarbIvVFGmsv7/3hOqnWc0fqfQ2JFpGCSVM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/PV: _PAGE_RW changes may take fast path of mod_l[234]_entry()
Message-Id: <E1lWjev-0006Rp-6r@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:50:37 +0000

commit 64581e5ade68bca185ea8b1be0f50fdcbe39205c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:18:17 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:18:17 2021 +0200

    x86/PV: _PAGE_RW changes may take fast path of mod_l[234]_entry()
    
    The only time _PAGE_RW matters when validating an L2 or higher entry is
    when a linear page table is tried to be installed (see the comment ahead
    of define_get_linear_pagetable()). Therefore when we disallow such at
    build time, we can allow _PAGE_RW changes to take the fast paths there.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index afb4febf6f..7be0338cb6 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -2143,6 +2143,18 @@ static void l3t_unlock(struct page_info *page)
     (_PAGE_NX_BIT | _PAGE_AVAIL_HIGH | _PAGE_AVAIL | _PAGE_GLOBAL | \
      _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_USER)
 
+/*
+ * PDE flags that a guest may change without re-validating the PDE.
+ * All other bits affect translation, caching, or Xen's safety. When guest
+ * created linear page tables aren't allowed, intermediate page tables may
+ * have _PAGE_RW altered without this requiring re-validation.
+ */
+#ifndef CONFIG_PV_LINEAR_PT
+# define FASTPATH_PDE_FLAG_WHITELIST (FASTPATH_FLAG_WHITELIST | _PAGE_RW)
+#else
+# define FASTPATH_PDE_FLAG_WHITELIST FASTPATH_FLAG_WHITELIST
+#endif
+
 /* Update the L1 entry at pl1e to new value nl1e. */
 static int mod_l1_entry(l1_pgentry_t *pl1e, l1_pgentry_t nl1e,
                         mfn_t gl1mfn, unsigned int cmd,
@@ -2285,7 +2297,7 @@ static int mod_l2_entry(l2_pgentry_t *pl2e,
         nl2e = adjust_guest_l2e(nl2e, d);
 
         /* Fast path for sufficiently-similar mappings. */
-        if ( !l2e_has_changed(ol2e, nl2e, ~FASTPATH_FLAG_WHITELIST) )
+        if ( !l2e_has_changed(ol2e, nl2e, ~FASTPATH_PDE_FLAG_WHITELIST) )
         {
             if ( UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, mfn, vcpu, preserve_ad) )
                 return 0;
@@ -2347,7 +2359,7 @@ static int mod_l3_entry(l3_pgentry_t *pl3e,
         nl3e = adjust_guest_l3e(nl3e, d);
 
         /* Fast path for sufficiently-similar mappings. */
-        if ( !l3e_has_changed(ol3e, nl3e, ~FASTPATH_FLAG_WHITELIST) )
+        if ( !l3e_has_changed(ol3e, nl3e, ~FASTPATH_PDE_FLAG_WHITELIST) )
         {
             rc = UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, mfn, vcpu, preserve_ad);
             return rc ? 0 : -EFAULT;
@@ -2409,7 +2421,7 @@ static int mod_l4_entry(l4_pgentry_t *pl4e,
         nl4e = adjust_guest_l4e(nl4e, d);
 
         /* Fast path for sufficiently-similar mappings. */
-        if ( !l4e_has_changed(ol4e, nl4e, ~FASTPATH_FLAG_WHITELIST) )
+        if ( !l4e_has_changed(ol4e, nl4e, ~FASTPATH_PDE_FLAG_WHITELIST) )
         {
             rc = UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, mfn, vcpu, preserve_ad);
             return rc ? 0 : -EFAULT;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:50:49 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:50:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110756.211502 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjf7-0004sM-3E; Wed, 14 Apr 2021 17:50:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110756.211502; Wed, 14 Apr 2021 17:50:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjf7-0004sE-0K; Wed, 14 Apr 2021 17:50:49 +0000
Received: by outflank-mailman (input) for mailman id 110756;
 Wed, 14 Apr 2021 17:50: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 1lWjf5-0004s2-Cm
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:50: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 1lWjf5-00078T-B9
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:50:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjf5-0006Sz-AH
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:50: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=Dhoc/nWG0tBkYuQz8o0sTMuWLTz628FxF9uDcxLMJgg=; b=j6sWWOGnF9OIT6cXxopVDAfUJP
	OfX6vW17l8uNVzw/Z62IBzs+mAdcRbCdApudsgPU9EWVBPbj6WxqxdD3XLMOZ8nmkGfmzRQWkOLo2
	DUuOOY1k4n6obRFj0M+sTweSayoVRJJWT2Nq47S5g19AOVZ4M/WOCa/e/NLQWIFiR+6s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/PV: restrict TLB flushing after mod_l[234]_entry()
Message-Id: <E1lWjf5-0006Sz-AH@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:50:47 +0000

commit edcfce55917bb412f986d7b28358f6ef155b3664
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:18:51 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:18:51 2021 +0200

    x86/PV: restrict TLB flushing after mod_l[234]_entry()
    
    Just like we avoid to invoke remote root pt flushes when all uses of an
    L4 table can be accounted for locally, the same can be done for all of
    L[234] for the linear pt flush when the table is a "free floating" one,
    i.e. it is pinned but not hooked up anywhere. While this situation
    doesn't occur very often, it can be observed.
    
    Since this breaks one of the implications of the XSA-286 fix, drop the
    flush_root_pt_local variable again and set ->root_pgt_changed directly,
    just like it was before that change.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 7be0338cb6..44e4c4cf1f 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -3906,8 +3906,7 @@ long do_mmu_update(
     struct vcpu *curr = current, *v = curr;
     struct domain *d = v->domain, *pt_owner = d, *pg_owner;
     mfn_t map_mfn = INVALID_MFN, mfn;
-    bool flush_linear_pt = false, flush_root_pt_local = false,
-        flush_root_pt_others = false;
+    bool flush_linear_pt = false, flush_root_pt_others = false;
     uint32_t xsm_needed = 0;
     uint32_t xsm_checked = 0;
     int rc = put_old_guest_table(curr);
@@ -4057,7 +4056,9 @@ long do_mmu_update(
                         break;
                     rc = mod_l2_entry(va, l2e_from_intpte(req.val), mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
-                    if ( !rc )
+                    if ( !rc &&
+                         (page->u.inuse.type_info & PGT_count_mask) >
+                         1 + !!(page->u.inuse.type_info & PGT_pinned) )
                         flush_linear_pt = true;
                     break;
 
@@ -4066,7 +4067,9 @@ long do_mmu_update(
                         break;
                     rc = mod_l3_entry(va, l3e_from_intpte(req.val), mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
-                    if ( !rc )
+                    if ( !rc &&
+                         (page->u.inuse.type_info & PGT_count_mask) >
+                         1 + !!(page->u.inuse.type_info & PGT_pinned) )
                         flush_linear_pt = true;
                     break;
 
@@ -4075,7 +4078,9 @@ long do_mmu_update(
                         break;
                     rc = mod_l4_entry(va, l4e_from_intpte(req.val), mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
-                    if ( !rc )
+                    if ( !rc &&
+                         (page->u.inuse.type_info & PGT_count_mask) >
+                         1 + !!(page->u.inuse.type_info & PGT_pinned) )
                         flush_linear_pt = true;
                     if ( !rc && pt_owner->arch.pv.xpti )
                     {
@@ -4085,7 +4090,7 @@ long do_mmu_update(
                                     mfn) )
                         {
                             local_in_use = true;
-                            flush_root_pt_local = true;
+                            get_cpu_info()->root_pgt_changed = true;
                         }
 
                         /*
@@ -4202,8 +4207,8 @@ long do_mmu_update(
     /*
      * Perform required TLB maintenance.
      *
-     * This logic currently depend on flush_linear_pt being a superset of the
-     * flush_root_pt_* conditions.
+     * This logic currently depends on flush_linear_pt being a superset of the
+     * flush_root_pt_others condition.
      *
      * pt_owner may not be current->domain.  This may occur during
      * construction of 32bit PV guests, or debugging of PV guests.  The
@@ -4222,7 +4227,7 @@ long do_mmu_update(
      * pt_owner->dirty_cpumask), and/or all *other* dirty CPUs as there are
      * references we can't account for locally.
      */
-    if ( flush_linear_pt /* || flush_root_pt_local || flush_root_pt_others */ )
+    if ( flush_linear_pt /* || flush_root_pt_others */ )
     {
         unsigned int cpu = smp_processor_id();
         cpumask_t *mask = pt_owner->dirty_cpumask;
@@ -4239,12 +4244,8 @@ long do_mmu_update(
             cpumask_copy(mask, pt_owner->dirty_cpumask);
             __cpumask_clear_cpu(cpu, mask);
 
-            flush_local(FLUSH_TLB |
-                        (flush_root_pt_local ? FLUSH_ROOT_PGTBL : 0));
+            flush_local(FLUSH_TLB);
         }
-        else
-            /* Sanity check.  flush_root_pt_local implies local cpu is dirty. */
-            ASSERT(!flush_root_pt_local);
 
         /* Flush the remote dirty CPUs.  Does not include the local CPU. */
         if ( !cpumask_empty(mask) )
@@ -4252,8 +4253,8 @@ long do_mmu_update(
                        (flush_root_pt_others ? FLUSH_ROOT_PGTBL : 0));
     }
     else
-        /* Sanity check.  flush_root_pt_* implies flush_linear_pt. */
-        ASSERT(!flush_root_pt_local && !flush_root_pt_others);
+        /* Sanity check.  flush_root_pt_others implies flush_linear_pt. */
+        ASSERT(!flush_root_pt_others);
 
     perfc_add(num_page_updates, i);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:50:59 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:50:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110757.211506 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjfH-0004tg-59; Wed, 14 Apr 2021 17:50:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110757.211506; Wed, 14 Apr 2021 17:50:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjfH-0004tY-1q; Wed, 14 Apr 2021 17:50:59 +0000
Received: by outflank-mailman (input) for mailman id 110757;
 Wed, 14 Apr 2021 17:50: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 1lWjfF-0004tP-FA
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:50: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 1lWjfF-00078b-EQ
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:50:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjfF-0006Tu-Dq
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:50: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=TJ69LWumOeOh/QZ1XKy38vha80HillHnEgOpZY43l9Y=; b=qwiYnxDPjNC6nyK1nU5JPvMZ66
	r0az/iB2JR+nAiIVIr9GAdjt2NFV9h5JDx0VMAf4VfiVi31PEWOmtDsaqaSsKto0nnh1LY12k+A3F
	SL5RM57pe7elHexV6lSyL+zdvKJTBnM2pHQ+q+UIu2NuxnCJKF4ZWBUf05xko1K6HCQw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/PV32: avoid TLB flushing after mod_l3_entry()
Message-Id: <E1lWjfF-0006Tu-Dq@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:50:57 +0000

commit bed7e6cad30ec8db0c9ce9a1676856e9dc4c39da
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:19:18 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:19:18 2021 +0200

    x86/PV32: avoid TLB flushing after mod_l3_entry()
    
    32-bit guests may not depend upon the side effect of using ordinary
    4-level paging when running on a 64-bit hypervisor. For L3 entry updates
    to take effect, they have to use a CR3 reload. Therefore there's no need
    to issue a paging structure invalidating TLB flush in this case.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 44e4c4cf1f..69d04ad809 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4069,7 +4069,8 @@ long do_mmu_update(
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
                     if ( !rc &&
                          (page->u.inuse.type_info & PGT_count_mask) >
-                         1 + !!(page->u.inuse.type_info & PGT_pinned) )
+                         1 + !!(page->u.inuse.type_info & PGT_pinned) &&
+                         !is_pv_32bit_domain(pt_owner) )
                         flush_linear_pt = true;
                     break;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:51:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:51:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110758.211510 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjfR-0004ut-7V; Wed, 14 Apr 2021 17:51:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110758.211510; Wed, 14 Apr 2021 17:51: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 1lWjfR-0004ul-48; Wed, 14 Apr 2021 17:51:09 +0000
Received: by outflank-mailman (input) for mailman id 110758;
 Wed, 14 Apr 2021 17:51: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 1lWjfP-0004uZ-IX
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:51: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 1lWjfP-0007AV-Hq
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:51:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjfP-0006Uw-HB
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:51: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=oyt+DcjOT2OuipLjqX5P+Dgr7Ye4ivfGHNjohaKzyMc=; b=nPKme88FumbRJrFsfnmCh+2ded
	bP0NsVpr4nt3lcplS4tM6Q9xc1trMzA9oHEkTOeUyPp/UdTD0Apr6KiMRO5viC9HrxA6pTwgmZvqM
	zhE/btfOnkoLL34eJvnJqXV/72lBI+8Ohl+ymceAkU9EVgkJMETdOMePMWXjBunNQVjw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: encode full GFN in magic MMIO entries
Message-Id: <E1lWjfP-0006Uw-HB@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:51:07 +0000

commit e113ed7134118757980a1d12837fa0f118f81a05
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:20:15 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:20:15 2021 +0200

    x86/shadow: encode full GFN in magic MMIO entries
    
    Since we don't need to encode all of the PTE flags, we have enough bits
    in the shadow entry to store the full GFN. Limit use of literal numbers
    a little and instead derive some of the involved values. Sanity-check
    the result via BUILD_BUG_ON()s.
    
    This then allows dropping from sh_l1e_mmio() again the guarding against
    too large GFNs. It needs replacing by an L1TF safety check though, which
    in turn requires exposing cpu_has_bug_l1tf.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/types.h  | 36 ++++++++++++++++++++++++++----------
 xen/arch/x86/spec_ctrl.c        |  2 +-
 xen/include/asm-x86/spec_ctrl.h |  1 +
 3 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/types.h b/xen/arch/x86/mm/shadow/types.h
index 27de593d87..a86be62d88 100644
--- a/xen/arch/x86/mm/shadow/types.h
+++ b/xen/arch/x86/mm/shadow/types.h
@@ -283,9 +283,18 @@ static inline shadow_l4e_t shadow_l4e_from_mfn(mfn_t mfn, u32 flags)
  * This is only feasible for PAE and 64bit Xen: 32-bit non-PAE PTEs don't
  * have reserved bits that we can use for this.  And even there it can only
  * be used if we can be certain the processor doesn't use all 52 address bits.
+ *
+ * For the MMIO encoding (see below) we need the bottom 4 bits for
+ * identifying the kind of entry and a full GFN's worth of bits to encode
+ * the originating frame number.  Set all remaining bits to trigger
+ * reserved bit faults, if (see above) the hardware permits triggering such.
  */
 
-#define SH_L1E_MAGIC 0xffffffff00000001ULL
+#ifdef CONFIG_BIGMEM
+# define SH_L1E_MAGIC_MASK (0xfffff00000000000UL | _PAGE_PRESENT)
+#else
+# define SH_L1E_MAGIC_MASK (0xfffffff000000000UL | _PAGE_PRESENT)
+#endif
 
 static inline bool sh_have_pte_rsvd_bits(void)
 {
@@ -294,7 +303,8 @@ static inline bool sh_have_pte_rsvd_bits(void)
 
 static inline bool sh_l1e_is_magic(shadow_l1e_t sl1e)
 {
-    return (sl1e.l1 & SH_L1E_MAGIC) == SH_L1E_MAGIC;
+    BUILD_BUG_ON(!(PADDR_MASK & PAGE_MASK & SH_L1E_MAGIC_MASK));
+    return (sl1e.l1 & SH_L1E_MAGIC_MASK) == SH_L1E_MAGIC_MASK;
 }
 
 /* Guest not present: a single magic value */
@@ -320,24 +330,30 @@ static inline bool sh_l1e_is_gnp(shadow_l1e_t sl1e)
 
 /*
  * MMIO: an invalid PTE that contains the GFN of the equivalent guest l1e.
- * We store 28 bits of GFN in bits 4:32 of the entry.
+ * We store the GFN in bits 4:35 (BIGMEM: 4:43) of the entry.
  * The present bit is set, and the U/S and R/W bits are taken from the guest.
  * Bit 3 is always 0, to differentiate from gnp above.
  */
-#define SH_L1E_MMIO_MAGIC       0xffffffff00000001ULL
-#define SH_L1E_MMIO_MAGIC_MASK  0xffffffff00000009ULL
-#define SH_L1E_MMIO_GFN_MASK    0x00000000fffffff0ULL
+#define SH_L1E_MMIO_MAGIC       SH_L1E_MAGIC_MASK
+#define SH_L1E_MMIO_MAGIC_BIT   8
+#define SH_L1E_MMIO_MAGIC_MASK  (SH_L1E_MMIO_MAGIC | SH_L1E_MMIO_MAGIC_BIT)
+#define SH_L1E_MMIO_GFN_MASK    ~(SH_L1E_MMIO_MAGIC_MASK | _PAGE_RW | _PAGE_USER)
 
 static inline shadow_l1e_t sh_l1e_mmio(gfn_t gfn, u32 gflags)
 {
     unsigned long gfn_val = MASK_INSR(gfn_x(gfn), SH_L1E_MMIO_GFN_MASK);
+    shadow_l1e_t sl1e = { (SH_L1E_MMIO_MAGIC | gfn_val |
+                           (gflags & (_PAGE_USER | _PAGE_RW))) };
+
+    BUILD_BUG_ON(SH_L1E_MMIO_MAGIC_BIT <= _PAGE_RW);
+    BUILD_BUG_ON(SH_L1E_MMIO_MAGIC_BIT <= _PAGE_USER);
 
     if ( !sh_have_pte_rsvd_bits() ||
-         gfn_x(gfn) != MASK_EXTR(gfn_val, SH_L1E_MMIO_GFN_MASK) )
-        return shadow_l1e_empty();
+         (cpu_has_bug_l1tf &&
+          !is_l1tf_safe_maddr(shadow_l1e_get_paddr(sl1e))) )
+        sl1e = shadow_l1e_empty();
 
-    return (shadow_l1e_t) { (SH_L1E_MMIO_MAGIC | gfn_val |
-                             (gflags & (_PAGE_USER | _PAGE_RW))) };
+    return sl1e;
 }
 
 static inline bool sh_l1e_is_mmio(shadow_l1e_t sl1e)
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index c9f78ead62..cd05f42394 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -59,7 +59,7 @@ uint8_t __read_mostly default_xen_spec_ctrl;
 uint8_t __read_mostly default_spec_ctrl_flags;
 
 paddr_t __read_mostly l1tf_addr_mask, __read_mostly l1tf_safe_maddr;
-static bool __initdata cpu_has_bug_l1tf;
+bool __read_mostly cpu_has_bug_l1tf;
 static unsigned int __initdata l1d_maxphysaddr;
 
 static bool __initdata cpu_has_bug_msbds_only; /* => minimal HT impact. */
diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/asm-x86/spec_ctrl.h
index b252bb8631..e671b6fd8d 100644
--- a/xen/include/asm-x86/spec_ctrl.h
+++ b/xen/include/asm-x86/spec_ctrl.h
@@ -45,6 +45,7 @@ extern uint8_t default_spec_ctrl_flags;
 
 extern int8_t opt_xpti_hwdom, opt_xpti_domu;
 
+extern bool cpu_has_bug_l1tf;
 extern int8_t opt_pv_l1tf_hwdom, opt_pv_l1tf_domu;
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:51:18 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:51:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110759.211514 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjfa-0004wG-AC; Wed, 14 Apr 2021 17:51:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110759.211514; Wed, 14 Apr 2021 17:51: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 1lWjfa-0004w8-77; Wed, 14 Apr 2021 17:51:18 +0000
Received: by outflank-mailman (input) for mailman id 110759;
 Wed, 14 Apr 2021 17:51: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 1lWjfZ-0004w1-Ly
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:51: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 1lWjfZ-0007Ae-L8
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:51:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjfZ-0006Vu-KX
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:51: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=x0eA9KtXlsGhZhT7MNrRITWPv9fopw3lxJWL09JNvjU=; b=60JDS6W9aCE/QSzzDXKxYc2/5L
	PEZ09IZv9HibloH7U0nm/TFEF5vbFeRMf0tr4AJz0WkrwoGiu+VqgpmdSwERYGwOexHggqeoa5vFu
	BzotST39WdjESiYEBBOEvCJ0ohdl5E3vpOHIKrGav47FBvyLPa7qLAHwQtMVopnROvwU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/irq: simplify loop in unmap_domain_pirq
Message-Id: <E1lWjfZ-0006Vu-KX@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:51:17 +0000

commit f811f890ff549fe433091076da308a44b906f271
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri Apr 9 09:20:57 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:20:57 2021 +0200

    x86/irq: simplify loop in unmap_domain_pirq
    
    The for loop in unmap_domain_pirq is unnecessary complicated, with
    several places where the index is incremented, and also different
    exit conditions spread between the loop body.
    
    Simplify it by looping over each possible PIRQ using the for loop
    syntax, and remove all possible in-loop exit points.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/irq.c | 60 +++++++++++++++---------------------------------------
 1 file changed, 16 insertions(+), 44 deletions(-)

diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index 032fe82167..a1693f92dd 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2305,7 +2305,6 @@ done:
 /* The pirq should have been unbound before this call. */
 int unmap_domain_pirq(struct domain *d, int pirq)
 {
-    unsigned long flags;
     struct irq_desc *desc;
     int irq, ret = 0, rc;
     unsigned int i, nr = 1;
@@ -2356,11 +2355,23 @@ int unmap_domain_pirq(struct domain *d, int pirq)
     if ( msi_desc != NULL )
         pci_disable_msi(msi_desc);
 
-    spin_lock_irqsave(&desc->lock, flags);
-
-    for ( i = 0; ; )
+    for ( i = 0; i < nr; i++, info = pirq_info(d, pirq + i) )
     {
+        unsigned long flags;
+
+        if ( !info || info->arch.irq <= 0 )
+        {
+            printk(XENLOG_G_ERR "%pd: MSI pirq %d not mapped\n",
+                   d, pirq + i);
+            continue;
+        }
+        irq = info->arch.irq;
+        desc = irq_to_desc(irq);
+
+        spin_lock_irqsave(&desc->lock, flags);
+
         BUG_ON(irq != domain_pirq_to_irq(d, pirq + i));
+        BUG_ON(desc->msi_desc != msi_desc + i);
 
         if ( !forced_unbind )
             clear_domain_irq_pirq(d, irq, info);
@@ -2378,45 +2389,6 @@ int unmap_domain_pirq(struct domain *d, int pirq)
             desc->msi_desc = NULL;
         }
 
-        if ( ++i == nr )
-            break;
-
-        spin_unlock_irqrestore(&desc->lock, flags);
-
-        if ( !forced_unbind )
-           cleanup_domain_irq_pirq(d, irq, info);
-
-        rc = irq_deny_access(d, irq);
-        if ( rc )
-        {
-            printk(XENLOG_G_ERR
-                   "dom%d: could not deny access to IRQ%d (pirq %d)\n",
-                   d->domain_id, irq, pirq + i);
-            ret = rc;
-        }
-
-        do {
-            info = pirq_info(d, pirq + i);
-            if ( info && (irq = info->arch.irq) > 0 )
-                break;
-            printk(XENLOG_G_ERR "dom%d: MSI pirq %d not mapped\n",
-                   d->domain_id, pirq + i);
-        } while ( ++i < nr );
-
-        if ( i == nr )
-        {
-            desc = NULL;
-            break;
-        }
-
-        desc = irq_to_desc(irq);
-        BUG_ON(desc->msi_desc != msi_desc + i);
-
-        spin_lock_irqsave(&desc->lock, flags);
-    }
-
-    if ( desc )
-    {
         spin_unlock_irqrestore(&desc->lock, flags);
 
         if ( !forced_unbind )
@@ -2427,7 +2399,7 @@ int unmap_domain_pirq(struct domain *d, int pirq)
         {
             printk(XENLOG_G_ERR
                    "dom%d: could not deny access to IRQ%d (pirq %d)\n",
-                   d->domain_id, irq, pirq + nr - 1);
+                   d->domain_id, irq, pirq + i);
             ret = rc;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:51:28 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:51:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110760.211518 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjfk-0004xq-Bg; Wed, 14 Apr 2021 17:51:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110760.211518; Wed, 14 Apr 2021 17:51: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 1lWjfk-0004xi-8f; Wed, 14 Apr 2021 17:51:28 +0000
Received: by outflank-mailman (input) for mailman id 110760;
 Wed, 14 Apr 2021 17:51: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 1lWjfj-0004xd-Q9
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:51: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 1lWjfj-0007B9-PL
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:51:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjfj-0006Wp-Nj
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:51: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=EFTBsyaL+7Or/ttBCwcIb5Ae+tSKuuW9x7s4wQ5IJSg=; b=JBDQhot43QGHEsUgKSrLBupCVy
	aAcZjKT8NayA50AvInzg4ObVLtD8cVKR1xd7yFqfbyLSkTyyGQGn5tR2y99IYilhB/pO6BhLVbau9
	mo1CB+zu3556CgRtpmOdtvfnSrclz5c04NvI2uMJSkUM+g+yeRo3aV+JBYSqoKYSN560=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vpt: do not take pt_migrate rwlock in some cases
Message-Id: <E1lWjfj-0006Wp-Nj@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:51:27 +0000

commit 1f3d87c7512975274cc45c40097b05550eba1ac9
Author:     Boris Ostrovsky <boris.ostrovsky@oracle.com>
AuthorDate: Fri Apr 9 09:21:27 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:21:27 2021 +0200

    x86/vpt: do not take pt_migrate rwlock in some cases
    
    Commit 8e76aef72820 ("x86/vpt: fix race when migrating timers between
    vCPUs") addressed XSA-336 by introducing a per-domain rwlock that was
    intended to protect periodic timer during VCPU migration. Since such
    migration is an infrequent event no performance impact was expected.
    
    Unfortunately this turned out not to be the case: on a fairly large
    guest (92 VCPUs) we've observed as much as 40% TPCC performance
    regression with some guest kernels. Further investigation pointed to
    pt_migrate read lock taken in pt_update_irq() as the largest contributor
    to this regression. With large number of VCPUs and large number of VMEXITs
    (from where pt_update_irq() is always called) the update of an atomic in
    read_lock() is thought to be the main cause.
    
    Stephen Brennan analyzed locking pattern and classified lock users as
    follows:
    
    1. Functions which read (maybe write) all periodic_time instances attached
    to a particular vCPU. These are functions which use pt_vcpu_lock() such
    as pt_restore_timer(), pt_save_timer(), etc.
    2. Functions which want to modify a particular periodic_time object.
    These functions lock whichever vCPU the periodic_time is attached to, but
    since the vCPU could be modified without holding any lock, they are
    vulnerable to XSA-336. Functions in this group use pt_lock(), such as
    pt_timer_fn() or destroy_periodic_time().
    3. Functions which not only want to modify the periodic_time, but also
    would like to modify the =vcpu= fields. These are create_periodic_time()
    or pt_adjust_vcpu(). They create XSA-336 conditions for group 2, but we
    can't simply hold 2 vcpu locks due to the deadlock risk.
    
    Roger then pointed out that group 1 functions don't really need to hold
    the pt_migrate rwlock and that instead groups 2 and 3 should hold per-vcpu
    lock whenever they modify per-vcpu timer lists.
    
    Suggested-by: Stephen Brennan <stephen.s.brennan@oracle.com>
    Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Stephen Brennan <stephen.s.brennan@oracle.com>
---
 xen/arch/x86/hvm/vpt.c        | 44 ++++++++++++++++++++++++++++++++++---------
 xen/include/asm-x86/hvm/vpt.h | 18 ++++++++++++------
 2 files changed, 47 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 4c2afe2e91..560fab9cfc 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -153,32 +153,43 @@ static int pt_irq_masked(struct periodic_time *pt)
     return 1;
 }
 
+/*
+ * Functions which read (maybe write) all periodic_time instances
+ * attached to a particular vCPU use pt_vcpu_{un}lock locking helpers.
+ *
+ * Such users are explicitly forbidden from changing the value of the
+ * pt->vcpu field, because another thread holding the pt_migrate lock
+ * may already be spinning waiting for your vcpu lock.
+ */
 static void pt_vcpu_lock(struct vcpu *v)
 {
-    read_lock(&v->domain->arch.hvm.pl_time->pt_migrate);
     spin_lock(&v->arch.hvm.tm_lock);
 }
 
 static void pt_vcpu_unlock(struct vcpu *v)
 {
     spin_unlock(&v->arch.hvm.tm_lock);
-    read_unlock(&v->domain->arch.hvm.pl_time->pt_migrate);
 }
 
+/*
+ * Functions which want to modify a particular periodic_time object
+ * use pt_{un}lock locking helpers.
+ *
+ * These users lock whichever vCPU the periodic_time is attached to,
+ * but since the vCPU could be modified without holding any lock, they
+ * need to take an additional lock that protects against pt->vcpu
+ * changing.
+ */
 static void pt_lock(struct periodic_time *pt)
 {
-    /*
-     * We cannot use pt_vcpu_lock here, because we need to acquire the
-     * per-domain lock first and then (re-)fetch the value of pt->vcpu, or
-     * else we might be using a stale value of pt->vcpu.
-     */
     read_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
     spin_lock(&pt->vcpu->arch.hvm.tm_lock);
 }
 
 static void pt_unlock(struct periodic_time *pt)
 {
-    pt_vcpu_unlock(pt->vcpu);
+    spin_unlock(&pt->vcpu->arch.hvm.tm_lock);
+    read_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
 }
 
 static void pt_process_missed_ticks(struct periodic_time *pt)
@@ -543,8 +554,10 @@ void create_periodic_time(
     pt->cb = cb;
     pt->priv = data;
 
+    pt_vcpu_lock(v);
     pt->on_list = 1;
     list_add(&pt->list, &v->arch.hvm.tm_list);
+    pt_vcpu_unlock(v);
 
     init_timer(&pt->timer, pt_timer_fn, pt, v->processor);
     set_timer(&pt->timer, pt->scheduled);
@@ -580,13 +593,26 @@ static void pt_adjust_vcpu(struct periodic_time *pt, struct vcpu *v)
         return;
 
     write_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
+
+    if ( pt->vcpu == v )
+        goto out;
+
+    pt_vcpu_lock(pt->vcpu);
+    if ( pt->on_list )
+        list_del(&pt->list);
+    pt_vcpu_unlock(pt->vcpu);
+
     pt->vcpu = v;
+
+    pt_vcpu_lock(v);
     if ( pt->on_list )
     {
-        list_del(&pt->list);
         list_add(&pt->list, &v->arch.hvm.tm_list);
         migrate_timer(&pt->timer, v->processor);
     }
+    pt_vcpu_unlock(v);
+
+ out:
     write_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
 }
 
diff --git a/xen/include/asm-x86/hvm/vpt.h b/xen/include/asm-x86/hvm/vpt.h
index 39d26cbda4..74c0cedd11 100644
--- a/xen/include/asm-x86/hvm/vpt.h
+++ b/xen/include/asm-x86/hvm/vpt.h
@@ -128,12 +128,18 @@ struct pl_time {    /* platform time */
     struct RTCState  vrtc;
     struct HPETState vhpet;
     struct PMTState  vpmt;
-    /*
-     * rwlock to prevent periodic_time vCPU migration. Take the lock in read
-     * mode in order to prevent the vcpu field of periodic_time from changing.
-     * Lock must be taken in write mode when changes to the vcpu field are
-     * performed, as it allows exclusive access to all the timers of a domain.
-     */
+     /*
+      * Functions which want to modify the vcpu field of the vpt need
+      * to hold the global lock (pt_migrate) in write mode together
+      * with the per-vcpu locks of the lists being modified. Functions
+      * that want to lock a periodic_timer that's possibly on a
+      * different vCPU list need to take the lock in read mode first in
+      * order to prevent the vcpu field of periodic_timer from
+      * changing.
+      *
+      * Note that two vcpu locks cannot be held at the same time to
+      * avoid a deadlock.
+      */
     rwlock_t pt_migrate;
     /* guest_time = Xen sys time + stime_offset */
     int64_t stime_offset;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:51:38 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:51:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110761.211522 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjfu-0004z4-Di; Wed, 14 Apr 2021 17:51:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110761.211522; Wed, 14 Apr 2021 17:51: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 1lWjfu-0004yu-AN; Wed, 14 Apr 2021 17:51:38 +0000
Received: by outflank-mailman (input) for mailman id 110761;
 Wed, 14 Apr 2021 17:51:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjft-0004yo-Up
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:51: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 1lWjft-0007BH-U6
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:51:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjft-0006XZ-Rt
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:51: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=BoB3aHzED3/VBREQ9FkxNCzPgCxmIfsJYmjRsyyFibg=; b=eLlcJ95xNDNLhtW/96QHGt9H6k
	cJA4145jF2zX42LYsupCiPMG8oi1PtLfz4a9yJ8L17jNIEMtc7bgutJTDB45JJZpV9a+Xx7lDiyN/
	EheE0YFhyaFY0/QbeDvRv0PgW9LKEcFpxKfxrEcl5/WO4pkqN1Oltn1upG/4bbMg5ais=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vpt: simplify locking argument to write_{,un}lock
Message-Id: <E1lWjft-0006XZ-Rt@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:51:37 +0000

commit e67b9816427a62f0b12916bab36763840fa41854
Author:     Boris Ostrovsky <boris.ostrovsky@oracle.com>
AuthorDate: Fri Apr 9 09:22:04 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:22:04 2021 +0200

    x86/vpt: simplify locking argument to write_{,un}lock
    
    Make pt_adjust_vcpu() call write_{,un}lock with less indirection, like
    create_periodic_time() already does.
    
    Requested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vpt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 560fab9cfc..4cc0a0848b 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -592,7 +592,7 @@ static void pt_adjust_vcpu(struct periodic_time *pt, struct vcpu *v)
     if ( pt->vcpu == NULL )
         return;
 
-    write_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
+    write_lock(&v->domain->arch.hvm.pl_time->pt_migrate);
 
     if ( pt->vcpu == v )
         goto out;
@@ -613,7 +613,7 @@ static void pt_adjust_vcpu(struct periodic_time *pt, struct vcpu *v)
     pt_vcpu_unlock(v);
 
  out:
-    write_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
+    write_unlock(&v->domain->arch.hvm.pl_time->pt_migrate);
 }
 
 void pt_adjust_global_vcpu_target(struct vcpu *v)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:51:48 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:51:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110762.211526 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjg4-00050Q-FX; Wed, 14 Apr 2021 17:51:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110762.211526; Wed, 14 Apr 2021 17:51: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 1lWjg4-00050I-Bw; Wed, 14 Apr 2021 17:51:48 +0000
Received: by outflank-mailman (input) for mailman id 110762;
 Wed, 14 Apr 2021 17:51:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjg4-00050C-1h
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:51:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjg4-0007BP-0s
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:51:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjg4-0006Yb-0C
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:51:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YIw+yC291La0x2RWMp4mhMacdAEC9yDQh07rf4WYpPM=; b=2T5WTknjOSGaKEI/on3MQt7Wuk
	1b3TycbmN7M5bjNPq/J2zs21anA7fWGJPQb9vadJ2jDUOMKqAOECBMTOrgA6jjhN8S7bgGUncrJpw
	OPHp7ZZBiG6ZmsMYpV001tLnzSziqGf+dhQy3Pyu8qnOFslOrk+FJWLGrC7TWBYy6KMM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] pci: move ATS code to common directory
Message-Id: <E1lWjg4-0006Yb-0C@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:51:48 +0000

commit b4c3d45c26d22490c08872596fcd1f8db9153dfc
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Fri Apr 9 09:22:26 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:22:26 2021 +0200

    pci: move ATS code to common directory
    
    PCI ATS code is common for all architecture, move code to common
    directory to be usable for other architectures.
    
    No functional change intended.
    
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/drivers/passthrough/Makefile     |  1 +
 xen/drivers/passthrough/ats.c        | 86 ++++++++++++++++++++++++++++++++++++
 xen/drivers/passthrough/x86/Makefile |  1 -
 xen/drivers/passthrough/x86/ats.c    | 86 ------------------------------------
 4 files changed, 87 insertions(+), 87 deletions(-)

diff --git a/xen/drivers/passthrough/Makefile b/xen/drivers/passthrough/Makefile
index cc646612c7..445690e3e5 100644
--- a/xen/drivers/passthrough/Makefile
+++ b/xen/drivers/passthrough/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_ARM) += arm/
 obj-y += iommu.o
 obj-$(CONFIG_HAS_PCI) += pci.o
 obj-$(CONFIG_HAS_DEVICE_TREE) += device_tree.o
+obj-$(CONFIG_HAS_PCI) += ats.o
diff --git a/xen/drivers/passthrough/ats.c b/xen/drivers/passthrough/ats.c
new file mode 100644
index 0000000000..7f7b16dc49
--- /dev/null
+++ b/xen/drivers/passthrough/ats.c
@@ -0,0 +1,86 @@
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <xen/param.h>
+#include <xen/sched.h>
+#include <xen/pci.h>
+#include <xen/pci_regs.h>
+#include "ats.h"
+
+bool_t __read_mostly ats_enabled = 0;
+boolean_param("ats", ats_enabled);
+
+int enable_ats_device(struct pci_dev *pdev, struct list_head *ats_list)
+{
+    u32 value;
+    u16 seg = pdev->seg;
+    u8 bus = pdev->bus, devfn = pdev->devfn;
+    int pos;
+
+    pos = pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS);
+    BUG_ON(!pos);
+
+    if ( iommu_verbose )
+        dprintk(XENLOG_INFO, "%pp: ATS capability found\n", &pdev->sbdf);
+
+    value = pci_conf_read16(pdev->sbdf, pos + ATS_REG_CTL);
+    if ( value & ATS_ENABLE )
+    {
+        struct pci_dev *other;
+
+        list_for_each_entry ( other, ats_list, ats.list )
+            if ( other == pdev )
+            {
+                pos = 0;
+                break;
+            }
+    }
+
+    if ( !(value & ATS_ENABLE) )
+    {
+        value |= ATS_ENABLE;
+        pci_conf_write16(pdev->sbdf, pos + ATS_REG_CTL, value);
+    }
+
+    if ( pos )
+    {
+        pdev->ats.cap_pos = pos;
+        value = pci_conf_read16(pdev->sbdf, pos + ATS_REG_CAP);
+        pdev->ats.queue_depth = value & ATS_QUEUE_DEPTH_MASK ?:
+                                ATS_QUEUE_DEPTH_MASK + 1;
+        list_add(&pdev->ats.list, ats_list);
+    }
+
+    if ( iommu_verbose )
+        dprintk(XENLOG_INFO, "%pp: ATS %s enabled\n",
+                &pdev->sbdf, pos ? "is" : "was");
+
+    return pos;
+}
+
+void disable_ats_device(struct pci_dev *pdev)
+{
+    u32 value;
+
+    BUG_ON(!pdev->ats.cap_pos);
+
+    value = pci_conf_read16(pdev->sbdf, pdev->ats.cap_pos + ATS_REG_CTL);
+    value &= ~ATS_ENABLE;
+    pci_conf_write16(pdev->sbdf, pdev->ats.cap_pos + ATS_REG_CTL, value);
+
+    list_del(&pdev->ats.list);
+
+    if ( iommu_verbose )
+        dprintk(XENLOG_INFO, "%pp: ATS is disabled\n", &pdev->sbdf);
+}
diff --git a/xen/drivers/passthrough/x86/Makefile b/xen/drivers/passthrough/x86/Makefile
index 69284a5d19..75b2885336 100644
--- a/xen/drivers/passthrough/x86/Makefile
+++ b/xen/drivers/passthrough/x86/Makefile
@@ -1,3 +1,2 @@
-obj-y += ats.o
 obj-y += iommu.o
 obj-$(CONFIG_HVM) += hvm.o
diff --git a/xen/drivers/passthrough/x86/ats.c b/xen/drivers/passthrough/x86/ats.c
deleted file mode 100644
index 4628ffde45..0000000000
--- a/xen/drivers/passthrough/x86/ats.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <xen/param.h>
-#include <xen/sched.h>
-#include <xen/pci.h>
-#include <xen/pci_regs.h>
-#include "../ats.h"
-
-bool_t __read_mostly ats_enabled = 0;
-boolean_param("ats", ats_enabled);
-
-int enable_ats_device(struct pci_dev *pdev, struct list_head *ats_list)
-{
-    u32 value;
-    u16 seg = pdev->seg;
-    u8 bus = pdev->bus, devfn = pdev->devfn;
-    int pos;
-
-    pos = pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS);
-    BUG_ON(!pos);
-
-    if ( iommu_verbose )
-        dprintk(XENLOG_INFO, "%pp: ATS capability found\n", &pdev->sbdf);
-
-    value = pci_conf_read16(pdev->sbdf, pos + ATS_REG_CTL);
-    if ( value & ATS_ENABLE )
-    {
-        struct pci_dev *other;
-
-        list_for_each_entry ( other, ats_list, ats.list )
-            if ( other == pdev )
-            {
-                pos = 0;
-                break;
-            }
-    }
-
-    if ( !(value & ATS_ENABLE) )
-    {
-        value |= ATS_ENABLE;
-        pci_conf_write16(pdev->sbdf, pos + ATS_REG_CTL, value);
-    }
-
-    if ( pos )
-    {
-        pdev->ats.cap_pos = pos;
-        value = pci_conf_read16(pdev->sbdf, pos + ATS_REG_CAP);
-        pdev->ats.queue_depth = value & ATS_QUEUE_DEPTH_MASK ?:
-                                ATS_QUEUE_DEPTH_MASK + 1;
-        list_add(&pdev->ats.list, ats_list);
-    }
-
-    if ( iommu_verbose )
-        dprintk(XENLOG_INFO, "%pp: ATS %s enabled\n",
-                &pdev->sbdf, pos ? "is" : "was");
-
-    return pos;
-}
-
-void disable_ats_device(struct pci_dev *pdev)
-{
-    u32 value;
-
-    BUG_ON(!pdev->ats.cap_pos);
-
-    value = pci_conf_read16(pdev->sbdf, pdev->ats.cap_pos + ATS_REG_CTL);
-    value &= ~ATS_ENABLE;
-    pci_conf_write16(pdev->sbdf, pdev->ats.cap_pos + ATS_REG_CTL, value);
-
-    list_del(&pdev->ats.list);
-
-    if ( iommu_verbose )
-        dprintk(XENLOG_INFO, "%pp: ATS is disabled\n", &pdev->sbdf);
-}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:51:59 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:51:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110763.211529 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjgF-00051f-Gx; Wed, 14 Apr 2021 17:51:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110763.211529; Wed, 14 Apr 2021 17:51:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjgF-00051W-DY; Wed, 14 Apr 2021 17:51:59 +0000
Received: by outflank-mailman (input) for mailman id 110763;
 Wed, 14 Apr 2021 17:51:58 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjgE-00051M-4r
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:51:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjgE-0007Ba-43
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:51:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjgE-0006ZV-3O
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:51:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5j1rEkfxezMtV2s1Gih2xUXXbiTO+aGEi/7rzlB1cBk=; b=T/YGPCl9X+6j1Hgj1KzDUGYUNo
	Dww1lXpzfNVYM27sQU+DlKrx/U9iCeUI4Z4xqKKcFMYswz5Y1KELkTF1ktGUoQZoecMKxCNCMG+mF
	dJNpUG3NdC0DfRROQtcXKM/OoULAtSTYxlgHGLLaUH1hMpOlXaLlTZkxDm2Iof9HyG1g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] MAINTAINERS: add myself as hypfs maintainer
Message-Id: <E1lWjgE-0006ZV-3O@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:51:58 +0000

commit 4bd1811dcab1145e7ff7652d9ba6800cbf7234a9
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Apr 9 09:23:28 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:23:28 2021 +0200

    MAINTAINERS: add myself as hypfs maintainer
    
    As I have contributed all the code for hypfs, it would be natural to
    be the maintainer.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Ian Jackson <iwj@xenproject.org>
---
 MAINTAINERS | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 6a7fa8717e..d46b08a0d2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -308,6 +308,15 @@ M:     Nick Rosbrook <rosbrookn@ainfosec.com>
 S:	Maintained
 F:	tools/golang
 
+HYPFS
+M:	Juergen Gross <jgross@suse.com>
+S:	Supported
+F:	tools/include/xenhypfs.h
+F:	tools/libs/hypfs/
+F:	tools/misc/xenhypfs.c
+F:	xen/common/hypfs.c
+F:	xen/include/xen/hypfs.h
+
 INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT)
 R:	Lukasz Hawrylko <lukasz.hawrylko@linux.intel.com>
 S:	Odd Fixes
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:52:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:52:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110764.211534 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjgP-00052s-KJ; Wed, 14 Apr 2021 17:52:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110764.211534; Wed, 14 Apr 2021 17:52: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 1lWjgP-00052k-HM; Wed, 14 Apr 2021 17:52:09 +0000
Received: by outflank-mailman (input) for mailman id 110764;
 Wed, 14 Apr 2021 17:52:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjgO-00052a-8N
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:52:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjgO-0007C1-7b
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:52:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjgO-0006aU-6u
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:52:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SyzlF52GPqt2UVfs4b0DIz8uczWefyd12Vg3ftkATs4=; b=fYm7Jh5WSgoUA5/k5JgUoiuVYy
	SimrIfcuBZkTJODl/JGl8SeiGBUraLH+ygb+LJAs9rxZLCzrdrDt9FESKrN4Mp4lUTWJ+BEGQWOOf
	NNgJdLNJ4dTkSze4GBhZrgOpOf9YuGbmCfdImdd/wEq3y5qPnUTnsL5XNs2WtFU1ucXc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: avoid effectively open-coding xzalloc_flex_struct()
Message-Id: <E1lWjgO-0006aU-6u@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:52:08 +0000

commit 23eda45f12ec98638d0175b615d3bc3428fd2eda
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:24:23 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:24:23 2021 +0200

    x86/HVM: avoid effectively open-coding xzalloc_flex_struct()
    
    Drop hvm_irq_size(), which exists for just this purpose.
    
    There is a difference in generated code: xzalloc_bytes() forces
    SMP_CACHE_BYTES alignment. I think we not only don't need this here, but
    actually don't want it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/hvm.c        | 3 ++-
 xen/include/asm-x86/hvm/irq.h | 1 -
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index e7bcffebc4..ae37bc434a 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -642,7 +642,8 @@ int hvm_domain_initialise(struct domain *d)
     d->arch.hvm.params = xzalloc_array(uint64_t, HVM_NR_PARAMS);
     d->arch.hvm.io_handler = xzalloc_array(struct hvm_io_handler,
                                            NR_IO_HANDLERS);
-    d->arch.hvm.irq = xzalloc_bytes(hvm_irq_size(nr_gsis));
+    d->arch.hvm.irq = xzalloc_flex_struct(struct hvm_irq,
+                                          gsi_assert_count, nr_gsis);
 
     rc = -ENOMEM;
     if ( !d->arch.hvm.pl_time || !d->arch.hvm.irq ||
diff --git a/xen/include/asm-x86/hvm/irq.h b/xen/include/asm-x86/hvm/irq.h
index 7f76f6c437..717c2299de 100644
--- a/xen/include/asm-x86/hvm/irq.h
+++ b/xen/include/asm-x86/hvm/irq.h
@@ -98,7 +98,6 @@ struct hvm_irq {
 #define hvm_pci_intx_link(dev, intx) \
     (((dev) + (intx)) & 3)
 #define hvm_domain_irq(d) ((d)->arch.hvm.irq)
-#define hvm_irq_size(cnt) offsetof(struct hvm_irq, gsi_assert_count[cnt])
 
 #define hvm_isa_irq_to_gsi(isa_irq) ((isa_irq) ? : 2)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:52:19 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:52:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110765.211538 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjgZ-00054e-Lk; Wed, 14 Apr 2021 17:52:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110765.211538; Wed, 14 Apr 2021 17:52:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjgZ-00054W-In; Wed, 14 Apr 2021 17:52:19 +0000
Received: by outflank-mailman (input) for mailman id 110765;
 Wed, 14 Apr 2021 17:52:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjgY-000546-CT
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:52:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjgY-0007C9-B0
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:52:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjgY-0006bJ-AF
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:52:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q0YhzFmxAH7rG5FMXSXjzdafZL6knRobALQqrlLunQ8=; b=HVKo4RIHYMYEmMEK1plw1xncDi
	xq/2gly2sExgT3faBTUtsaokuCnUPkGYHu4uFjfJ8hPmR56ZSnUeos4NbBNiwCq8CenEKodTmeyJO
	fT/jxiy9HXA6p/A5yq0ELzAfELq4QcbYucUMb6bbnnidEk4hfz1r2pzKf1CTOxrhGxQM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vPMU: avoid effectively open-coding xzalloc_flex_struct()
Message-Id: <E1lWjgY-0006bJ-AF@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:52:18 +0000

commit 463e8e6cf764beda5f58117a422dcb3a06fed405
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:25:17 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:25:17 2021 +0200

    x86/vPMU: avoid effectively open-coding xzalloc_flex_struct()
    
    There is a difference in generated code: xzalloc_bytes() forces
    SMP_CACHE_BYTES alignment. I think we not only don't need this here, but
    actually don't want it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu/vpmu_intel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
index 6e97ce7900..64334c5fab 100644
--- a/xen/arch/x86/cpu/vpmu_intel.c
+++ b/xen/arch/x86/cpu/vpmu_intel.c
@@ -461,10 +461,10 @@ static int core2_vpmu_alloc_resource(struct vcpu *v)
             goto out_err;
     }
 
-    core2_vpmu_cxt = xzalloc_bytes(sizeof(*core2_vpmu_cxt) +
-                                   sizeof(uint64_t) * fixed_pmc_cnt +
-                                   sizeof(struct xen_pmu_cntr_pair) *
-                                   arch_pmc_cnt);
+    core2_vpmu_cxt = xzalloc_flex_struct(struct xen_pmu_intel_ctxt, regs,
+                                         fixed_pmc_cnt + arch_pmc_cnt *
+                                         (sizeof(struct xen_pmu_cntr_pair) /
+                                          sizeof(*core2_vpmu_cxt->regs)));
     p = xzalloc(uint64_t);
     if ( !core2_vpmu_cxt || !p )
         goto out_err;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:52:29 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:52:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110766.211542 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjgj-00055t-NR; Wed, 14 Apr 2021 17:52:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110766.211542; Wed, 14 Apr 2021 17:52:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjgj-00055k-KF; Wed, 14 Apr 2021 17:52:29 +0000
Received: by outflank-mailman (input) for mailman id 110766;
 Wed, 14 Apr 2021 17:52:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjgi-00055a-Et
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:52:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjgi-0007CW-E9
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:52:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjgi-0006cS-DS
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:52:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=O9BvvZCAtMCsYfXJwuAQkcEYynzUBEE3/PS2qOUSyes=; b=iEgiLnnOWBzsOxWfLfuEBeP8CJ
	Z90tNIDXxg9QrOMqg0IyL8vD6rUAqeTVr8mqOCeWwS82sNUoiOyqrx/Nn/wkMr2kRW6TD7lg2S8SL
	aTwZiSPdsF93qoT3eeTIdmKKFtFptFyH9gZ46RqpA7+F+dwPWdWKMTcsgAfVgBbwpKH4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] hypfs: avoid effectively open-coding xzalloc_array()
Message-Id: <E1lWjgi-0006cS-DS@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:52:28 +0000

commit ca68c70d30d68a671a45789a85f8ace6d8360334
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:25:42 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:25:42 2021 +0200

    hypfs: avoid effectively open-coding xzalloc_array()
    
    There is a difference in generated code: xzalloc_bytes() forces
    SMP_CACHE_BYTES alignment. I think we not only don't need this here, but
    actually don't want it.
    
    To avoid the need to add a cast, do away with the only forward-declared
    struct hypfs_dyndata.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/common/hypfs.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/common/hypfs.c b/xen/common/hypfs.c
index 5468497404..e71f7df479 100644
--- a/xen/common/hypfs.c
+++ b/xen/common/hypfs.c
@@ -72,7 +72,7 @@ enum hypfs_lock_state {
     hypfs_write_locked
 };
 static DEFINE_PER_CPU(enum hypfs_lock_state, hypfs_locked);
-static DEFINE_PER_CPU(struct hypfs_dyndata *, hypfs_dyndata);
+static DEFINE_PER_CPU(void *, hypfs_dyndata);
 
 static DEFINE_PER_CPU(const struct hypfs_entry *, hypfs_last_node_entered);
 
@@ -160,19 +160,19 @@ static void node_exit_all(void)
 void *hypfs_alloc_dyndata(unsigned long size)
 {
     unsigned int cpu = smp_processor_id();
-    struct hypfs_dyndata **dyndata = &per_cpu(hypfs_dyndata, cpu);
+    void **dyndata = &per_cpu(hypfs_dyndata, cpu);
 
     ASSERT(per_cpu(hypfs_locked, cpu) != hypfs_unlocked);
     ASSERT(*dyndata == NULL);
 
-    *dyndata = xzalloc_bytes(size);
+    *dyndata = xzalloc_array(unsigned char, size);
 
     return *dyndata;
 }
 
 void *hypfs_get_dyndata(void)
 {
-    struct hypfs_dyndata *dyndata = this_cpu(hypfs_dyndata);
+    void *dyndata = this_cpu(hypfs_dyndata);
 
     ASSERT(dyndata);
 
@@ -181,7 +181,7 @@ void *hypfs_get_dyndata(void)
 
 void hypfs_free_dyndata(void)
 {
-    struct hypfs_dyndata **dyndata = &this_cpu(hypfs_dyndata);
+    void **dyndata = &this_cpu(hypfs_dyndata);
 
     XFREE(*dyndata);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:52:39 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:52:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110767.211545 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjgt-00057A-Ok; Wed, 14 Apr 2021 17:52:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110767.211545; Wed, 14 Apr 2021 17:52:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjgt-000572-Lm; Wed, 14 Apr 2021 17:52:39 +0000
Received: by outflank-mailman (input) for mailman id 110767;
 Wed, 14 Apr 2021 17:52:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjgs-00056u-Iu
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:52:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjgs-0007Ce-HF
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:52:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjgs-0006dP-GZ
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:52:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3lQmNNb3qWYcNa94B8xh+9uO9ZhTYxvr02+5ER0rINQ=; b=TcHDDNYW5aMRCvSwm7aCwEhn2I
	d3GngWpElq46UocxyLkahHYQlmziBwBy2VwmGBmGud2dfhrZirWMK0p1HjyzCxcDjaWRDjQZ1y9lz
	y/s9+/8de5Wk6LQugUa6f83lgkuFFFU8BWf4j07dmAtlOkp5xU3/S1FuERbMjyaxY/gA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Revert "x86: guard against straight-line speculation past RET"
Message-Id: <E1lWjgs-0006dP-GZ@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:52:38 +0000

commit 9cd905bae87fb06efa59c347ef1e96c5dc6cdb62
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 9 09:50:40 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 9 09:53:53 2021 +0200

    Revert "x86: guard against straight-line speculation past RET"
    
    This reverts commit 71b0b475d801ebeb83a6ba402425135c314fa2df,
    which has no real effect - the most recent version of the patch
    had lost the INT3 insn.
---
 xen/Makefile                    |  5 +----
 xen/arch/x86/indirect-thunk.S   |  3 ---
 xen/include/asm-x86/asm-defns.h | 16 ----------------
 3 files changed, 1 insertion(+), 23 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index 3a8fb7ec7e..9f3be7766d 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -145,10 +145,7 @@ t2 = $(call as-insn,$(CC) -I$(BASEDIR)/include,".include \"asm-x86/asm-defns.h\"
 # https://bugs.llvm.org/show_bug.cgi?id=36110
 t3 = $(call as-insn,$(CC),".macro FOO;.endm"$(close); asm volatile $(open)".macro FOO;.endm",-no-integrated-as)
 
-# Check whether macros can override insn mnemonics in inline assembly.
-t4 = $(call as-insn,$(CC),".macro ret; .error; .endm; .macro retq; .error; .endm",-no-integrated-as)
-
-CLANG_FLAGS += $(call or,$(t1),$(t2),$(t3),$(t4))
+CLANG_FLAGS += $(call or,$(t1),$(t2),$(t3))
 endif
 
 CLANG_FLAGS += -Werror=unknown-warning-option
diff --git a/xen/arch/x86/indirect-thunk.S b/xen/arch/x86/indirect-thunk.S
index a090b35dcf..7cc22da0ef 100644
--- a/xen/arch/x86/indirect-thunk.S
+++ b/xen/arch/x86/indirect-thunk.S
@@ -11,9 +11,6 @@
 
 #include <asm/asm_defns.h>
 
-/* Don't transform the "ret" further down. */
-.purgem ret
-
 .macro IND_THUNK_RETPOLINE reg:req
         call 2f
 1:
diff --git a/xen/include/asm-x86/asm-defns.h b/xen/include/asm-x86/asm-defns.h
index e164437798..505f39ad5f 100644
--- a/xen/include/asm-x86/asm-defns.h
+++ b/xen/include/asm-x86/asm-defns.h
@@ -57,22 +57,6 @@
     INDIRECT_BRANCH jmp \arg
 .endm
 
-/*
- * To guard against speculation past RET, insert a breakpoint insn
- * immediately after them.
- */
-.macro ret operand:vararg
-    retq \operand
-.endm
-.macro retq operand:vararg
-    .ifb \operand
-    .byte 0xc3
-    .else
-    .byte 0xc2
-    .word \operand
-    .endif
-.endm
-
 .macro guest_access_mask_ptr ptr:req, scratch1:req, scratch2:req
 #if defined(CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS)
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:52:49 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:52:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110768.211550 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjh3-00058T-QQ; Wed, 14 Apr 2021 17:52:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110768.211550; Wed, 14 Apr 2021 17:52:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjh3-00058K-NI; Wed, 14 Apr 2021 17:52:49 +0000
Received: by outflank-mailman (input) for mailman id 110768;
 Wed, 14 Apr 2021 17:52:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjh2-00058B-Ky
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:52:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjh2-0007Cm-K6
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:52:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjh2-0006eC-JZ
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:52:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=K+qsThLhY38PFi1AiObdCHmj5MJZSkKdK6TBVFkG738=; b=tvfZgvrBBWvCmJfGg4/DaYY/54
	hPkYHvZQ41ESd7bMzIKKva/Vb5vcw989dDTWI4sh7bAcZ7g2L59schprwMdOWh/lo/FRfRBI1F0fL
	OnLIpCgUxzf1MakrFM52poDWvomKkgYbcS3t3if7A+cQxhOODSg5KtHnTtP5IOSP/FPU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/gunzip: Fix build with clang after 33bc2a8495f7
Message-Id: <E1lWjh2-0006eC-JZ@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:52:48 +0000

commit 11ba6936d378c72da6ad70eabdfa976e71777788
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed Apr 7 19:22:10 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Apr 9 09:43:12 2021 +0100

    xen/gunzip: Fix build with clang after 33bc2a8495f7
    
    The compilation will fail when building Xen with clang and
    CONFIG_DEBUG=y:
    
    make[4]: Leaving directory '/oss/xen/xen/common/libelf'
      INIT_O  gunzip.init.o
    Error: size of gunzip.o:.text is 0x00000019
    
    This is because the function init_allocator() will not be inlined
    and is not part of the init section.
    
    Fix it by marking init_allocator() with INIT.
    
    Fixes: 33bc2a8495f7 ("xen/gunzip: Allow perform_gunzip() to be called multiple times")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/inflate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/inflate.c b/xen/common/inflate.c
index d8c28a3e95..c593b94d48 100644
--- a/xen/common/inflate.c
+++ b/xen/common/inflate.c
@@ -238,7 +238,7 @@ STATIC const ush mask_bits[] = {
 static unsigned long INITDATA malloc_ptr;
 static int INITDATA malloc_count;
 
-static void init_allocator(void)
+static void INIT init_allocator(void)
 {
     malloc_ptr = free_mem_ptr;
     malloc_count = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:52:59 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:52:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110769.211553 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjhD-00059d-Rv; Wed, 14 Apr 2021 17:52:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110769.211553; Wed, 14 Apr 2021 17:52:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjhD-00059W-Op; Wed, 14 Apr 2021 17:52:59 +0000
Received: by outflank-mailman (input) for mailman id 110769;
 Wed, 14 Apr 2021 17:52:58 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjhC-00059L-Ov
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:52:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjhC-0007Cu-OB
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:52:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjhC-0006eu-NS
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:52:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VXwqk3ZwgOR7tzVTfnBXiq+gI9RA6UzVZDRv/l0Qq6A=; b=3N1QgnF5WIMXyfDwNbDlWXAnTj
	LdYHApCt46UktIVDjlO9ZDrJcT5T5N8LJKbDP3IQVdCfq4y7FWTaop4P660CBEYhcAxTc6aHNoYei
	83ZkyCLHetXH1LFzDzT7nK6HoJ7wrU8M94TNgt3TndflldeACEOyeWEzc3lQrSeCvtpc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Drop gettext as a build dependency
Message-Id: <E1lWjhC-0006eu-NS@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:52:58 +0000

commit e21a6a4f966a7e91cb0bb014dbe15d15cc0502ad
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Mar 26 11:25:07 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Apr 9 10:31:17 2021 +0100

    tools: Drop gettext as a build dependency
    
    It has not been a dependency since at least 4.13.  Remove its mandatory check
    from ./configure.
    
    Annotate the dependency in the CI dockerfiles, and drop them from CirrusCI and
    TravisCI.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 .cirrus.yml                                        |  2 +-
 .travis.yml                                        |  1 -
 README                                             |  1 -
 automation/build/alpine/3.12-arm64v8.dockerfile    |  1 +
 automation/build/alpine/3.12.dockerfile            |  1 +
 automation/build/centos/7.2.dockerfile             |  1 +
 automation/build/centos/7.dockerfile               |  1 +
 automation/build/debian/jessie-i386.dockerfile     |  1 +
 automation/build/debian/jessie.dockerfile          |  1 +
 automation/build/debian/stretch-i386.dockerfile    |  1 +
 automation/build/debian/stretch.dockerfile         |  1 +
 .../build/debian/unstable-arm64v8.dockerfile       |  1 +
 automation/build/debian/unstable-i386.dockerfile   |  1 +
 automation/build/debian/unstable.dockerfile        |  1 +
 automation/build/fedora/29.dockerfile              |  1 +
 automation/build/suse/opensuse-leap.dockerfile     |  1 +
 .../build/suse/opensuse-tumbleweed.dockerfile      |  1 +
 automation/build/ubuntu/bionic.dockerfile          |  1 +
 automation/build/ubuntu/focal.dockerfile           |  1 +
 automation/build/ubuntu/trusty.dockerfile          |  1 +
 automation/build/ubuntu/xenial.dockerfile          |  1 +
 .../tests-artifacts/alpine/3.12-arm64v8.dockerfile |  1 +
 tools/configure                                    | 49 ----------------------
 tools/configure.ac                                 |  2 -
 24 files changed, 20 insertions(+), 54 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 0efff6fa98..fdb1c9c94d 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -4,7 +4,7 @@ freebsd_template: &FREEBSD_TEMPLATE
     APPEND_LIB: /usr/local/lib
     APPEND_INCLUDES: /usr/local/include
 
-  install_script: pkg install -y seabios gettext-tools gmake
+  install_script: pkg install -y seabios gmake
                                  pkgconf python libiconv bison perl5
                                  yajl lzo2 pixman argp-standalone
                                  libxml2 glib git
diff --git a/.travis.yml b/.travis.yml
index 2362475f7a..f3cd15b79f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -54,7 +54,6 @@ addons:
             - pkg-config
             - flex
             - bison
-            - gettext
             - acpica-tools
             - bin86
             - bcc
diff --git a/README b/README
index fad96672af..562b808080 100644
--- a/README
+++ b/README
@@ -63,7 +63,6 @@ provided by your OS distributor:
     * bridge-utils package (/sbin/brctl)
     * iproute package (/sbin/ip)
     * GNU bison and GNU flex
-    * GNU gettext
     * ACPI ASL compiler (iasl)
 
 In addition to the above there are a number of optional build
diff --git a/automation/build/alpine/3.12-arm64v8.dockerfile b/automation/build/alpine/3.12-arm64v8.dockerfile
index d6cdf5b200..a1ac960595 100644
--- a/automation/build/alpine/3.12-arm64v8.dockerfile
+++ b/automation/build/alpine/3.12-arm64v8.dockerfile
@@ -22,6 +22,7 @@ RUN \
   apk add dev86 && \
   apk add dtc-dev && \
   apk add gcc  && \
+  # gettext for Xen < 4.13
   apk add gettext && \
   apk add git && \
   apk add iasl && \
diff --git a/automation/build/alpine/3.12.dockerfile b/automation/build/alpine/3.12.dockerfile
index 94557e239b..bb8e5ece74 100644
--- a/automation/build/alpine/3.12.dockerfile
+++ b/automation/build/alpine/3.12.dockerfile
@@ -23,6 +23,7 @@ RUN \
   apk add gcc  && \
   apk add g++ && \
   apk add clang  && \
+  # gettext for Xen < 4.13
   apk add gettext && \
   apk add git && \
   apk add iasl && \
diff --git a/automation/build/centos/7.2.dockerfile b/automation/build/centos/7.2.dockerfile
index af672a0be1..4baa097e31 100644
--- a/automation/build/centos/7.2.dockerfile
+++ b/automation/build/centos/7.2.dockerfile
@@ -26,6 +26,7 @@ RUN rpm --rebuilddb && \
         python-devel \
         libuuid-devel \
         pkgconfig \
+        # gettext for Xen < 4.13
         gettext \
         flex \
         bison \
diff --git a/automation/build/centos/7.dockerfile b/automation/build/centos/7.dockerfile
index 5f83c97d0c..e688a4cece 100644
--- a/automation/build/centos/7.dockerfile
+++ b/automation/build/centos/7.dockerfile
@@ -24,6 +24,7 @@ RUN yum -y install \
         python-devel \
         libuuid-devel \
         pkgconfig \
+        # gettext for Xen < 4.13
         gettext \
         flex \
         bison \
diff --git a/automation/build/debian/jessie-i386.dockerfile b/automation/build/debian/jessie-i386.dockerfile
index 66a6abb381..3f86d91f63 100644
--- a/automation/build/debian/jessie-i386.dockerfile
+++ b/automation/build/debian/jessie-i386.dockerfile
@@ -28,6 +28,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/build/debian/jessie.dockerfile b/automation/build/debian/jessie.dockerfile
index 808d6272e4..2f19adcad3 100644
--- a/automation/build/debian/jessie.dockerfile
+++ b/automation/build/debian/jessie.dockerfile
@@ -26,6 +26,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/build/debian/stretch-i386.dockerfile b/automation/build/debian/stretch-i386.dockerfile
index 7b6f8eff69..c7840d33ab 100644
--- a/automation/build/debian/stretch-i386.dockerfile
+++ b/automation/build/debian/stretch-i386.dockerfile
@@ -29,6 +29,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/build/debian/stretch.dockerfile b/automation/build/debian/stretch.dockerfile
index e3bace1f87..e2ee14e201 100644
--- a/automation/build/debian/stretch.dockerfile
+++ b/automation/build/debian/stretch.dockerfile
@@ -27,6 +27,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/build/debian/unstable-arm64v8.dockerfile b/automation/build/debian/unstable-arm64v8.dockerfile
index 8455d67b72..4409f596e1 100644
--- a/automation/build/debian/unstable-arm64v8.dockerfile
+++ b/automation/build/debian/unstable-arm64v8.dockerfile
@@ -27,6 +27,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         libfdt-dev \
diff --git a/automation/build/debian/unstable-i386.dockerfile b/automation/build/debian/unstable-i386.dockerfile
index 86ff3585df..06ffb97384 100644
--- a/automation/build/debian/unstable-i386.dockerfile
+++ b/automation/build/debian/unstable-i386.dockerfile
@@ -29,6 +29,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/build/debian/unstable.dockerfile b/automation/build/debian/unstable.dockerfile
index 9a10ee08d6..bd61cd12c2 100644
--- a/automation/build/debian/unstable.dockerfile
+++ b/automation/build/debian/unstable.dockerfile
@@ -27,6 +27,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/build/fedora/29.dockerfile b/automation/build/fedora/29.dockerfile
index 5482952523..027b93ceaf 100644
--- a/automation/build/fedora/29.dockerfile
+++ b/automation/build/fedora/29.dockerfile
@@ -17,6 +17,7 @@ RUN dnf -y install \
         python3-devel \
         libuuid-devel \
         pkgconfig \
+        # gettext for Xen < 4.13
         gettext \
         flex \
         bison \
diff --git a/automation/build/suse/opensuse-leap.dockerfile b/automation/build/suse/opensuse-leap.dockerfile
index 685dd5d7fd..573fbd8ae4 100644
--- a/automation/build/suse/opensuse-leap.dockerfile
+++ b/automation/build/suse/opensuse-leap.dockerfile
@@ -22,6 +22,7 @@ RUN zypper install -y --no-recommends \
         flex \
         gcc \
         gcc-c++ \
+        # gettext-tools for Xen < 4.13
         gettext-tools \
         git \
         glib2-devel \
diff --git a/automation/build/suse/opensuse-tumbleweed.dockerfile b/automation/build/suse/opensuse-tumbleweed.dockerfile
index 061173e751..8ff7b9b5ce 100644
--- a/automation/build/suse/opensuse-tumbleweed.dockerfile
+++ b/automation/build/suse/opensuse-tumbleweed.dockerfile
@@ -22,6 +22,7 @@ RUN zypper install -y --no-recommends \
         flex \
         gcc \
         gcc-c++ \
+        # gettext-tools for Xen < 4.13
         gettext-tools \
         git \
         glib2-devel \
diff --git a/automation/build/ubuntu/bionic.dockerfile b/automation/build/ubuntu/bionic.dockerfile
index 408063698c..406a97494c 100644
--- a/automation/build/ubuntu/bionic.dockerfile
+++ b/automation/build/ubuntu/bionic.dockerfile
@@ -27,6 +27,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/build/ubuntu/focal.dockerfile b/automation/build/ubuntu/focal.dockerfile
index 90b4001a6a..952a3172aa 100644
--- a/automation/build/ubuntu/focal.dockerfile
+++ b/automation/build/ubuntu/focal.dockerfile
@@ -26,6 +26,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/build/ubuntu/trusty.dockerfile b/automation/build/ubuntu/trusty.dockerfile
index fd377d948f..b4b2f85e73 100644
--- a/automation/build/ubuntu/trusty.dockerfile
+++ b/automation/build/ubuntu/trusty.dockerfile
@@ -27,6 +27,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/build/ubuntu/xenial.dockerfile b/automation/build/ubuntu/xenial.dockerfile
index 57a71eb8c6..82171d856d 100644
--- a/automation/build/ubuntu/xenial.dockerfile
+++ b/automation/build/ubuntu/xenial.dockerfile
@@ -27,6 +27,7 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
+        # gettext for Xen < 4.13
         gettext \
         acpica-tools \
         bin86 \
diff --git a/automation/tests-artifacts/alpine/3.12-arm64v8.dockerfile b/automation/tests-artifacts/alpine/3.12-arm64v8.dockerfile
index 9457009452..7eb1f22940 100644
--- a/automation/tests-artifacts/alpine/3.12-arm64v8.dockerfile
+++ b/automation/tests-artifacts/alpine/3.12-arm64v8.dockerfile
@@ -19,6 +19,7 @@ RUN \
   apk add dbus && \
   apk add bash && \
   apk add python2 && \
+  # gettext for Xen < 4.13
   apk add gettext && \
   apk add zlib && \
   apk add ncurses && \
diff --git a/tools/configure b/tools/configure
index 99d08a4d81..33814b24b3 100755
--- a/tools/configure
+++ b/tools/configure
@@ -689,7 +689,6 @@ INSTALL_PROGRAM
 SET_MAKE
 AWK
 IASL
-XGETTEXT
 FLEX
 BISON
 PERL
@@ -847,7 +846,6 @@ PYTHON
 PERL
 BISON
 FLEX
-XGETTEXT
 AS86
 LD86
 BCC
@@ -1597,7 +1595,6 @@ Some influential environment variables:
   PERL        Path to Perl parser
   BISON       Path to Bison parser generator
   FLEX        Path to Flex lexical analyser generator
-  XGETTEXT    Path to xgetttext tool
   AS86        Path to as86 tool
   LD86        Path to ld86 tool
   BCC         Path to bcc tool
@@ -4738,7 +4735,6 @@ LDFLAGS="$PREPEND_LDFLAGS $LDFLAGS $APPEND_LDFLAGS"
 
 
 
-
 # Checks for programs.
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -7846,51 +7842,6 @@ fi
 
 if ! $rump; then
 
-# Extract the first word of "xgettext", so it can be a program name with args.
-set dummy xgettext; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_XGETTEXT+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $XGETTEXT in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_XGETTEXT="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT="no"
-  ;;
-esac
-fi
-XGETTEXT=$ac_cv_path_XGETTEXT
-if test -n "$XGETTEXT"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5
-$as_echo "$XGETTEXT" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-if test x"${XGETTEXT}" = x"no"
-then
-    as_fn_error $? "Unable to find xgettext, please install xgettext" "$LINENO" 5
-fi
 case "$host_cpu" in
 i[3456]86|x86_64|aarch64)
     # Extract the first word of "iasl", so it can be a program name with args.
diff --git a/tools/configure.ac b/tools/configure.ac
index 636e7077be..6414fcbb44 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -298,7 +298,6 @@ AC_ARG_VAR([PYTHON], [Path to the Python parser])
 AC_ARG_VAR([PERL], [Path to Perl parser])
 AC_ARG_VAR([BISON], [Path to Bison parser generator])
 AC_ARG_VAR([FLEX], [Path to Flex lexical analyser generator])
-AC_ARG_VAR([XGETTEXT], [Path to xgetttext tool])
 AC_ARG_VAR([AS86], [Path to as86 tool])
 AC_ARG_VAR([LD86], [Path to ld86 tool])
 AC_ARG_VAR([BCC], [Path to bcc tool])
@@ -381,7 +380,6 @@ AS_IF([test "$cross_compiling" != yes], [
 
 if ! $rump; then
 
-AX_PATH_PROG_OR_FAIL([XGETTEXT], [xgettext])
 dnl as86, ld86, bcc and iasl are only required when the host system is x86*.
 dnl "host" here means the platform on which the hypervisor and tools is
 dnl going to run, not the platform on which we are building (known as
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:53:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:53:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110770.211557 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjhN-0005B1-Vh; Wed, 14 Apr 2021 17:53:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110770.211557; Wed, 14 Apr 2021 17:53: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 1lWjhN-0005As-Sk; Wed, 14 Apr 2021 17:53:09 +0000
Received: by outflank-mailman (input) for mailman id 110770;
 Wed, 14 Apr 2021 17:53:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjhM-0005An-Sj
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:53:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjhM-0007DB-Ry
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:53:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjhM-0006fx-Qh
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:53:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=N9KsCLNgC3TqGOjxSqKEKcRwNVQL9WxQvRELo3rS3Ro=; b=jloGRbuEtVa4yHgzJAvamaaE31
	h3zdVG+lhKz45HsC+WyJM0uHGXbfpQnRdWvIf6vhlnuvy7smFf1drASIfNNN82fRoMTAAnEOlJbwb
	UbTCeMCHFtABuLqlJymTz22K/F5wzkpmGBPOhoqLE+E1C/l3zbbCNSwujnH7lzgGurlI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs: Simplify internal *.pc files
Message-Id: <E1lWjhM-0006fx-Qh@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:53:08 +0000

commit 7ae04e1de449843a4b19d684c79ee07e3e42abfc
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Nov 25 14:37:00 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Apr 9 10:31:17 2021 +0100

    tools/libs: Simplify internal *.pc files
    
    The internal package config file for libxenlight reads (reformatted to avoid
    exceeding the SMTP 998-character line length):
    
      Libs: -L${libdir}
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/evtchn
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/call
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/evtchn
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/gnttab
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/foreignmemory
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/call
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/devicemodel
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/ctrl
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/store
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/call
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/hypfs
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/evtchn
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/call
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/evtchn
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/gnttab
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/foreignmemory
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/call
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/devicemodel
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/ctrl
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/guest
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/light
      -lxenlight
    
    Drop duplicate -rpath-link='s to turn it into the slightly-more-manageable:
    
      Libs: -L${libdir}
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/call
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/ctrl
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/devicemodel
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/evtchn
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/foreignmemory
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/gnttab
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/guest
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/hypfs
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/light
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/store
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toolcore
      -Wl,-rpath-link=/local/security/xen.git/tools/libs/light/../../../tools/libs/toollog
      -lxenlight
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/libs.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 2d973ccb95..84130ccbaf 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -33,7 +33,7 @@ PKG_CONFIG ?= $(LIB_FILE_NAME).pc
 PKG_CONFIG_NAME ?= Xen$(LIBNAME)
 PKG_CONFIG_DESC ?= The $(PKG_CONFIG_NAME) library for Xen hypervisor
 PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
-PKG_CONFIG_USELIBS := $(SHLIB_libxen$(LIBNAME))
+PKG_CONFIG_USELIBS := $(sort $(SHLIB_libxen$(LIBNAME)))
 PKG_CONFIG_LIB := $(LIB_FILE_NAME)
 PKG_CONFIG_REQPRIV := $(subst $(space),$(comma),$(strip $(foreach lib,$(patsubst ctrl,control,$(USELIBS_$(LIBNAME))),xen$(lib))))
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:53:20 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:53:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110771.211562 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjhY-0005Cf-0u; Wed, 14 Apr 2021 17:53:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110771.211562; Wed, 14 Apr 2021 17:53:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjhX-0005CX-UG; Wed, 14 Apr 2021 17:53:19 +0000
Received: by outflank-mailman (input) for mailman id 110771;
 Wed, 14 Apr 2021 17:53:19 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjhW-0005C6-WA
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:53:19 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjhW-0007DP-VR
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:53:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjhW-0006iH-Ug
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:53:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=orkO6iyNhYXvB0B8FjCA9k/nma9S7XE9JpQD0I3oPQA=; b=gHYHYijaIHZ5RWzfBdpnqdGOtb
	oaq6qorPed9NZljhFr67nBjuONA9qxFbfUVHzVVupSs3Ef6nV6CrmMy1V2+q7lZfLDXFJpFUkBB92
	z/SUoYfeQhdx3Qr7KpsKdDBhiIfPB18EbIAyFQDvoObVoWDQpzYdRUoCD9iAbp6BVG2c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/xsm: Improve alloc/free of evtchn buckets
Message-Id: <E1lWjhW-0006iH-Ug@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:53:18 +0000

commit 935d501ccbf5b8c4db1f6d0730a4a4c998e9e76a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Jan 16 16:09:10 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Apr 9 10:31:17 2021 +0100

    xen/xsm: Improve alloc/free of evtchn buckets
    
    Currently, flask_alloc_security_evtchn() is called in loops of
    64 (EVTCHNS_PER_BUCKET), which for non-dummy implementations is a function
    pointer call even in the no-op case.  The non no-op case only sets a single
    constant, and doesn't actually fail.
    
    Spectre v2 protections has made function pointer calls far more expensive, and
    64 back-to-back calls is a waste.  Rework the APIs to pass the size of the
    bucket instead, and call them once.
    
    No practical change, but {alloc,free}_evtchn_bucket() should be rather more
    efficient now.
    
    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/common/event_channel.c | 36 ++++++++++++++++--------------------
 xen/include/xsm/dummy.h    |  6 ++++--
 xen/include/xsm/xsm.h      | 14 ++++++++------
 xen/xsm/dummy.c            |  4 ++--
 xen/xsm/flask/hooks.c      | 20 +++++++++++++-------
 5 files changed, 43 insertions(+), 37 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index c94ea74b12..5479315aae 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -147,6 +147,14 @@ static bool virq_is_global(unsigned int virq)
     return true;
 }
 
+static void free_evtchn_bucket(struct domain *d, struct evtchn *bucket)
+{
+    if ( !bucket )
+        return;
+
+    xsm_free_security_evtchns(bucket, EVTCHNS_PER_BUCKET);
+    xfree(bucket);
+}
 
 static struct evtchn *alloc_evtchn_bucket(struct domain *d, unsigned int port)
 {
@@ -155,34 +163,22 @@ static struct evtchn *alloc_evtchn_bucket(struct domain *d, unsigned int port)
 
     chn = xzalloc_array(struct evtchn, EVTCHNS_PER_BUCKET);
     if ( !chn )
-        return NULL;
+        goto err;
+
+    if ( xsm_alloc_security_evtchns(chn, EVTCHNS_PER_BUCKET) )
+        goto err;
 
     for ( i = 0; i < EVTCHNS_PER_BUCKET; i++ )
     {
-        if ( xsm_alloc_security_evtchn(&chn[i]) )
-        {
-            while ( i-- )
-                xsm_free_security_evtchn(&chn[i]);
-            xfree(chn);
-            return NULL;
-        }
         chn[i].port = port + i;
         rwlock_init(&chn[i].lock);
     }
-    return chn;
-}
-
-static void free_evtchn_bucket(struct domain *d, struct evtchn *bucket)
-{
-    unsigned int i;
 
-    if ( !bucket )
-        return;
-
-    for ( i = 0; i < EVTCHNS_PER_BUCKET; i++ )
-        xsm_free_security_evtchn(bucket + i);
+    return chn;
 
-    xfree(bucket);
+ err:
+    free_evtchn_bucket(d, chn);
+    return NULL;
 }
 
 int evtchn_allocate_port(struct domain *d, evtchn_port_t port)
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 10739e7f35..a6dab0c809 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -309,12 +309,14 @@ static XSM_INLINE int xsm_evtchn_reset(XSM_DEFAULT_ARG struct domain *d1, struct
     return xsm_default_action(action, d1, d2);
 }
 
-static XSM_INLINE int xsm_alloc_security_evtchn(struct evtchn *chn)
+static XSM_INLINE int xsm_alloc_security_evtchns(
+    struct evtchn chn[], unsigned int nr)
 {
     return 0;
 }
 
-static XSM_INLINE void xsm_free_security_evtchn(struct evtchn *chn)
+static XSM_INLINE void xsm_free_security_evtchns(
+    struct evtchn chn[], unsigned int nr)
 {
     return;
 }
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 91ecff4f11..7bdd254420 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -72,8 +72,8 @@ struct xsm_operations {
 
     int (*alloc_security_domain) (struct domain *d);
     void (*free_security_domain) (struct domain *d);
-    int (*alloc_security_evtchn) (struct evtchn *chn);
-    void (*free_security_evtchn) (struct evtchn *chn);
+    int (*alloc_security_evtchns) (struct evtchn chn[], unsigned int nr);
+    void (*free_security_evtchns) (struct evtchn chn[], unsigned int nr);
     char *(*show_security_evtchn) (struct domain *d, const struct evtchn *chn);
     int (*init_hardware_domain) (struct domain *d);
 
@@ -314,14 +314,16 @@ static inline void xsm_free_security_domain (struct domain *d)
     xsm_ops->free_security_domain(d);
 }
 
-static inline int xsm_alloc_security_evtchn (struct evtchn *chn)
+static inline int xsm_alloc_security_evtchns(
+    struct evtchn chn[], unsigned int nr)
 {
-    return xsm_ops->alloc_security_evtchn(chn);
+    return xsm_ops->alloc_security_evtchns(chn, nr);
 }
 
-static inline void xsm_free_security_evtchn (struct evtchn *chn)
+static inline void xsm_free_security_evtchns(
+    struct evtchn chn[], unsigned int nr)
 {
-    (void)xsm_ops->free_security_evtchn(chn);
+    xsm_ops->free_security_evtchns(chn, nr);
 }
 
 static inline char *xsm_show_security_evtchn (struct domain *d, const struct evtchn *chn)
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index 8bdffe740e..627f12dbff 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -49,8 +49,8 @@ void __init xsm_fixup_ops (struct xsm_operations *ops)
 
     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_evtchn);
-    set_to_dummy_if_null(ops, free_security_evtchn);
+    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);
 
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 3b7313b949..5a24d01f04 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -307,19 +307,25 @@ static int flask_evtchn_reset(struct domain *d1, struct domain *d2)
     return domain_has_perm(d1, d2, SECCLASS_EVENT, EVENT__RESET);
 }
 
-static int flask_alloc_security_evtchn(struct evtchn *chn)
+static int flask_alloc_security_evtchns(struct evtchn chn[], unsigned int nr)
 {
-    chn->ssid.flask_sid = SECINITSID_UNLABELED;
+    unsigned int i;
+
+    for ( i = 0; i < nr; ++i )
+        chn[i].ssid.flask_sid = SECINITSID_UNLABELED;
 
-    return 0;    
+    return 0;
 }
 
-static void flask_free_security_evtchn(struct evtchn *chn)
+static void flask_free_security_evtchns(struct evtchn chn[], unsigned int nr)
 {
+    unsigned int i;
+
     if ( !chn )
         return;
 
-    chn->ssid.flask_sid = SECINITSID_UNLABELED;
+    for ( i = 0; i < nr; ++i )
+        chn[i].ssid.flask_sid = SECINITSID_UNLABELED;
 }
 
 static char *flask_show_security_evtchn(struct domain *d, const struct evtchn *chn)
@@ -1766,8 +1772,8 @@ static struct xsm_operations flask_ops = {
 
     .alloc_security_domain = flask_domain_alloc_security,
     .free_security_domain = flask_domain_free_security,
-    .alloc_security_evtchn = flask_alloc_security_evtchn,
-    .free_security_evtchn = flask_free_security_evtchn,
+    .alloc_security_evtchns = flask_alloc_security_evtchns,
+    .free_security_evtchns = flask_free_security_evtchns,
     .show_security_evtchn = flask_show_security_evtchn,
     .init_hardware_domain = flask_init_hardware_domain,
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:53:30 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:53:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110772.211565 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjhi-0005Di-35; Wed, 14 Apr 2021 17:53:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110772.211565; Wed, 14 Apr 2021 17:53:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjhh-0005Da-Vs; Wed, 14 Apr 2021 17:53:29 +0000
Received: by outflank-mailman (input) for mailman id 110772;
 Wed, 14 Apr 2021 17:53:29 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjhh-0005DS-3a
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:53:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjhh-0007Dp-2P
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:53:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjhh-0006jG-1h
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:53:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PkwtSlj+55L3iEX5xpdqKIfu/Ksz8/T2D7cjUTjPnKw=; b=PpkfwHshoD709av1RiuQLfD/Xt
	6jZ4/yGlBifv0Ec6Wqhq2ufG6zSku4+xLtCcQ79W/XS/ZV+FzJE4fRT+Wu5IRwo2V5kvcmpCW7Jfx
	42tEK1mL1hfewPZbNSE4bQCHzZtyODouuUggoGxF3PnHjU6PD8xdsM99fLAq+oCWnpkU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxenguest: drop redundant decompression declarations
Message-Id: <E1lWjhh-0006jG-1h@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:53:29 +0000

commit c5dad825d98a818cbc123a22777bd7110d00bffb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:25:55 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:25:55 2021 +0200

    libxenguest: drop redundant decompression declarations
    
    The ones in xg_dom_decompress_unsafe.h suffice.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/guest/xg_dom_bzimageloader.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/tools/libs/guest/xg_dom_bzimageloader.c b/tools/libs/guest/xg_dom_bzimageloader.c
index 55457d901b..0fa6d1ef92 100644
--- a/tools/libs/guest/xg_dom_bzimageloader.c
+++ b/tools/libs/guest/xg_dom_bzimageloader.c
@@ -673,13 +673,6 @@ static int xc_try_zstd_decode(
 
 #endif
 
-#else /* __MINIOS__ */
-
-int xc_try_bzip2_decode(struct xc_dom_image *dom, void **blob, size_t *size);
-int xc_try_lzma_decode(struct xc_dom_image *dom, void **blob, size_t *size);
-int xc_try_lzo1x_decode(struct xc_dom_image *dom, void **blob, size_t *size);
-int xc_try_xz_decode(struct xc_dom_image *dom, void **blob, size_t *size);
-
 #endif /* !__MINIOS__ */
 
 struct setup_header {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:53:40 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:53:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110773.211569 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjhs-0005Fi-4r; Wed, 14 Apr 2021 17:53:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110773.211569; Wed, 14 Apr 2021 17:53:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjhs-0005Fa-1R; Wed, 14 Apr 2021 17:53:40 +0000
Received: by outflank-mailman (input) for mailman id 110773;
 Wed, 14 Apr 2021 17:53:39 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjhr-0005FQ-6C
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:53:39 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjhr-0007Dw-5P
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:53:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjhr-0006kM-4h
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:53:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QOox/PgZx1PpYEtQg+WCbXraknnS0tBhnYkn/YyxE/E=; b=p1kGMPD5KwvwG7EA7hV4G9z1tL
	WXX4aNh06yOWY3AFOPb0LXlGs1fkPUDAN29azz4O1LkVcllApUQn+TCoiwolCwoS6pcZSWZu7MKpJ
	NBXeoEY2QmMER2PCWlHBtHMeaIVgyeacl9Su3woJ/t559QlJAhMJIJx5IexSPKGp+Bjc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxenguest: simplify kernel decompression
Message-Id: <E1lWjhr-0006kM-4h@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:53:39 +0000

commit d3d9889467ca4a0ddc5dc9222d353c37a3e8dc6a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:26:18 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:26:18 2021 +0200

    libxenguest: simplify kernel decompression
    
    In all cases the kernel build makes available the uncompressed size in
    the final 4 bytes of the bzImage payload. Utilize this to avoid
    repeated realloc()ing of the output buffer.
    
    As a side effect this also addresses the previous mistaken return of 0
    (success) from xc_try_{bzip2,lzma,xz}_decode() in case
    xc_dom_register_external() would have failed.
    
    As another side effect this also addresses the first error path of
    _xc_try_lzma_decode() previously bypassing lzma_end().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/guest/xg_dom_bzimageloader.c | 297 +++++++++++++-------------------
 1 file changed, 124 insertions(+), 173 deletions(-)

diff --git a/tools/libs/guest/xg_dom_bzimageloader.c b/tools/libs/guest/xg_dom_bzimageloader.c
index 0fa6d1ef92..764ddbb43e 100644
--- a/tools/libs/guest/xg_dom_bzimageloader.c
+++ b/tools/libs/guest/xg_dom_bzimageloader.c
@@ -48,18 +48,16 @@ static int xc_try_bzip2_decode(
     bz_stream stream;
     int ret;
     char *out_buf;
-    char *tmp_buf;
     int retval = -1;
-    unsigned int outsize;
-    uint64_t total;
+    unsigned int insize, outsize;
 
     stream.bzalloc = NULL;
     stream.bzfree = NULL;
     stream.opaque = NULL;
 
-    if ( dom->kernel_size == 0)
+    if ( *size <= 8 )
     {
-        DOMPRINTF("BZIP2: Input is 0 size");
+        DOMPRINTF("BZIP2: insufficient input data");
         return -1;
     }
 
@@ -70,22 +68,25 @@ static int xc_try_bzip2_decode(
         return -1;
     }
 
-    /* sigh.  We don't know up-front how much memory we are going to need
-     * for the output buffer.  Allocate the output buffer to be equal
-     * the input buffer to start, and we'll realloc as needed.
-     */
-    outsize = dom->kernel_size;
+    insize = *size - 4;
+    outsize = get_unaligned_le32(*blob + insize);
 
     /*
-     * stream.avail_in and outsize are unsigned int, while kernel_size
+     * stream.avail_in and insize are unsigned int, while *size
      * is a size_t. Check we aren't overflowing.
      */
-    if ( outsize != dom->kernel_size )
+    if ( insize + 4 != *size )
     {
         DOMPRINTF("BZIP2: Input too large");
         goto bzip2_cleanup;
     }
 
+    if ( xc_dom_kernel_check_size(dom, outsize) )
+    {
+        DOMPRINTF("BZIP2: output too large");
+        goto bzip2_cleanup;
+    }
+
     out_buf = malloc(outsize);
     if ( out_buf == NULL )
     {
@@ -94,86 +95,45 @@ static int xc_try_bzip2_decode(
     }
 
     stream.next_in = dom->kernel_blob;
-    stream.avail_in = dom->kernel_size;
+    stream.avail_in = insize;
 
     stream.next_out = out_buf;
-    stream.avail_out = dom->kernel_size;
+    stream.avail_out = outsize;
 
-    for ( ; ; )
+    ret = BZ2_bzDecompress(&stream);
+    if ( ret == BZ_STREAM_END )
+        DOMPRINTF("BZIP2: Saw data stream end");
+    else if ( ret != BZ_OK )
     {
-        ret = BZ2_bzDecompress(&stream);
-        if ( ret == BZ_STREAM_END )
-        {
-            DOMPRINTF("BZIP2: Saw data stream end");
-            retval = 0;
-            break;
-        }
-        if ( ret != BZ_OK )
-        {
-            DOMPRINTF("BZIP2: error %d", ret);
-            free(out_buf);
-            goto bzip2_cleanup;
-        }
+        DOMPRINTF("BZIP2: error %d", ret);
+        free(out_buf);
+        goto bzip2_cleanup;
+    }
 
-        if ( stream.avail_out == 0 )
-        {
-            /* Protect against output buffer overflow */
-            if ( outsize > UINT_MAX / 2 )
-            {
-                DOMPRINTF("BZIP2: output buffer overflow");
-                free(out_buf);
-                goto bzip2_cleanup;
-            }
-
-            if ( xc_dom_kernel_check_size(dom, outsize * 2) )
-            {
-                DOMPRINTF("BZIP2: output too large");
-                free(out_buf);
-                goto bzip2_cleanup;
-            }
-
-            tmp_buf = realloc(out_buf, outsize * 2);
-            if ( tmp_buf == NULL )
-            {
-                DOMPRINTF("BZIP2: Failed to realloc memory");
-                free(out_buf);
-                goto bzip2_cleanup;
-            }
-            out_buf = tmp_buf;
-
-            stream.next_out = out_buf + outsize;
-            stream.avail_out = (outsize * 2) - outsize;
-            outsize *= 2;
-        }
-        else if ( stream.avail_in == 0 )
-        {
-            /*
-             * If there is output buffer available then this indicates
-             * that BZ2_bzDecompress would like more input data to be
-             * provided.  However our complete input buffer is in
-             * memory and provided upfront so if avail_in is zero this
-             * actually indicates a truncated input.
-             */
-            DOMPRINTF("BZIP2: not enough input");
-            free(out_buf);
-            goto bzip2_cleanup;
-        }
+    if ( stream.total_out_lo32 != outsize || stream.total_out_hi32 )
+    {
+        DOMPRINTF("BZIP2: got 0x%x%08x bytes instead of 0x%09x",
+                  stream.total_out_hi32, stream.total_out_lo32, outsize);
+        free(out_buf);
+        goto bzip2_cleanup;
     }
 
-    total = (((uint64_t)stream.total_out_hi32) << 32) | stream.total_out_lo32;
+    if ( stream.avail_in )
+        DOMPRINTF("BZIP2: Warning: %#x unconsumed bytes", stream.avail_in);
 
-    if ( xc_dom_register_external(dom, out_buf, total) )
+    if ( xc_dom_register_external(dom, out_buf, outsize) )
     {
         DOMPRINTF("BZIP2: Error registering stream output");
         free(out_buf);
         goto bzip2_cleanup;
     }
 
-    DOMPRINTF("%s: BZIP2 decompress OK, 0x%zx -> 0x%lx",
-              __FUNCTION__, *size, (long unsigned int) total);
+    DOMPRINTF("%s: BZIP2 decompress OK, 0x%zx -> 0x%x",
+              __FUNCTION__, *size, outsize);
 
     *blob = out_buf;
-    *size = total;
+    *size = outsize;
+    retval = 0;
 
  bzip2_cleanup:
     BZ2_bzDecompressEnd(&stream);
@@ -205,22 +165,24 @@ static int _xc_try_lzma_decode(
     lzma_ret ret;
     lzma_action action = LZMA_RUN;
     unsigned char *out_buf;
-    unsigned char *tmp_buf;
     int retval = -1;
-    size_t outsize;
-    const char *msg;
+    size_t insize, outsize;
 
-    if ( dom->kernel_size == 0)
+    if ( *size < 8 )
     {
-        DOMPRINTF("%s: Input is 0 size", what);
-        return -1;
+        DOMPRINTF("%s: insufficient input data", what);
+        goto lzma_cleanup;
+    }
+
+    insize = *size - 4;
+    outsize = get_unaligned_le32(*blob + insize);
+
+    if ( xc_dom_kernel_check_size(dom, outsize) )
+    {
+        DOMPRINTF("%s: output too large", what);
+        goto lzma_cleanup;
     }
 
-    /* sigh.  We don't know up-front how much memory we are going to need
-     * for the output buffer.  Allocate the output buffer to be equal
-     * the input buffer to start, and we'll realloc as needed.
-     */
-    outsize = dom->kernel_size;
     out_buf = malloc(outsize);
     if ( out_buf == NULL )
     {
@@ -229,92 +191,68 @@ static int _xc_try_lzma_decode(
     }
 
     stream->next_in = dom->kernel_blob;
-    stream->avail_in = dom->kernel_size;
+    stream->avail_in = insize;
 
     stream->next_out = out_buf;
-    stream->avail_out = dom->kernel_size;
+    stream->avail_out = outsize;
 
-    for ( ; ; )
+    ret = lzma_code(stream, action);
+    if ( ret == LZMA_STREAM_END )
+        DOMPRINTF("%s: Saw data stream end", what);
+    else if ( ret != LZMA_OK )
     {
-        ret = lzma_code(stream, action);
-        if ( ret == LZMA_STREAM_END )
+        const char *msg;
+
+        switch ( ret )
         {
-            DOMPRINTF("%s: Saw data stream end", what);
-            retval = 0;
+        case LZMA_MEM_ERROR:
+            msg = strerror(ENOMEM);
             break;
-        }
-        if ( ret != LZMA_OK )
-        {
-            switch ( ret )
-            {
-            case LZMA_MEM_ERROR:
-                msg = strerror(ENOMEM);
-                break;
 
-            case LZMA_MEMLIMIT_ERROR:
-                msg = "Memory usage limit reached";
-                break;
+        case LZMA_MEMLIMIT_ERROR:
+            msg = "Memory usage limit reached";
+            break;
 
-            case LZMA_FORMAT_ERROR:
-                msg = "File format not recognized";
-                break;
+        case LZMA_FORMAT_ERROR:
+            msg = "File format not recognized";
+            break;
 
-            case LZMA_OPTIONS_ERROR:
-                // FIXME: Better message?
-                msg = "Unsupported compression options";
-                break;
+        case LZMA_OPTIONS_ERROR:
+            // FIXME: Better message?
+            msg = "Unsupported compression options";
+            break;
 
-            case LZMA_DATA_ERROR:
-                msg = "File is corrupt";
-                break;
+        case LZMA_DATA_ERROR:
+            msg = "File is corrupt";
+            break;
 
-            case LZMA_BUF_ERROR:
-                msg = "Unexpected end of input";
-                break;
+        case LZMA_BUF_ERROR:
+            msg = "Unexpected end of input";
+            break;
 
-            default:
-                msg = "Internal program error (bug)";
-                break;
-            }
-            DOMPRINTF("%s: %s decompression error: %s",
-                      __FUNCTION__, what, msg);
-            free(out_buf);
-            goto lzma_cleanup;
+         default:
+            msg = "Internal program error (bug)";
+            break;
         }
 
-        if ( stream->avail_out == 0 )
-        {
-            /* Protect against output buffer overflow */
-            if ( outsize > SIZE_MAX / 2 )
-            {
-                DOMPRINTF("%s: output buffer overflow", what);
-                free(out_buf);
-                goto lzma_cleanup;
-            }
-
-            if ( xc_dom_kernel_check_size(dom, outsize * 2) )
-            {
-                DOMPRINTF("%s: output too large", what);
-                free(out_buf);
-                goto lzma_cleanup;
-            }
-
-            tmp_buf = realloc(out_buf, outsize * 2);
-            if ( tmp_buf == NULL )
-            {
-                DOMPRINTF("%s: Failed to realloc memory", what);
-                free(out_buf);
-                goto lzma_cleanup;
-            }
-            out_buf = tmp_buf;
-
-            stream->next_out = out_buf + outsize;
-            stream->avail_out = (outsize * 2) - outsize;
-            outsize *= 2;
-        }
+        DOMPRINTF("%s: %s decompression error: %s",
+                  __FUNCTION__, what, msg);
+        free(out_buf);
+        goto lzma_cleanup;
     }
 
-    if ( xc_dom_register_external(dom, out_buf, stream->total_out) )
+    if ( stream->total_out != outsize )
+    {
+        DOMPRINTF("%s: got 0x%"PRIx64" bytes instead of 0x%zx",
+                  what, stream->total_out, outsize);
+        free(out_buf);
+        goto lzma_cleanup;
+    }
+
+    if ( stream->avail_in )
+        DOMPRINTF("%s: Warning: %#zx unconsumed bytes", what, stream->avail_in);
+
+    if ( xc_dom_register_external(dom, out_buf, outsize) )
     {
         DOMPRINTF("%s: Error registering stream output", what);
         free(out_buf);
@@ -322,10 +260,11 @@ static int _xc_try_lzma_decode(
     }
 
     DOMPRINTF("%s: %s decompress OK, 0x%zx -> 0x%zx",
-              __FUNCTION__, what, *size, (size_t)stream->total_out);
+              __FUNCTION__, what, *size, outsize);
 
     *blob = out_buf;
-    *size = stream->total_out;
+    *size = outsize;
+    retval = 0;
 
  lzma_cleanup:
     lzma_end(stream);
@@ -408,8 +347,8 @@ static int xc_try_lzo1x_decode(
 {
     int ret;
     const unsigned char *cur = dom->kernel_blob;
-    unsigned char *out_buf = NULL;
-    size_t left = dom->kernel_size, outsize;
+    unsigned char *out_buf;
+    size_t left = dom->kernel_size, outsize, outtot;
     const char *msg;
     unsigned version;
     static const unsigned char magic[] = {
@@ -435,6 +374,15 @@ static int xc_try_lzo1x_decode(
         return -1;
     }
 
+    left -= 4;
+    outtot = get_unaligned_le32(*blob + left);
+
+    if ( xc_dom_kernel_check_size(dom, outtot) )
+    {
+        DOMPRINTF("LZO1x: output too large");
+        return -1;
+    }
+
     /* get version (2bytes), skip library version (2),
      * 'need to be extracted' version (2) and method (1) */
     version = lzo_read_16(cur + 9);
@@ -471,10 +419,16 @@ static int xc_try_lzo1x_decode(
     cur += ret;
     left -= ret;
 
+    out_buf = malloc(outtot);
+    if ( !out_buf )
+    {
+        DOMPRINTF("LZO1x: failed to alloc memory");
+        return -1;
+    }
+
     for ( outsize = 0; ; )
     {
         lzo_uint src_len, dst_len, out_len;
-        unsigned char *tmp_buf;
 
         msg = "Short input";
         if ( left < 4 )
@@ -483,6 +437,13 @@ static int xc_try_lzo1x_decode(
         dst_len = lzo_read_32(cur);
         if ( !dst_len )
         {
+            msg = "Unexpected output size";
+            if ( outsize != outtot )
+                break;
+
+            if ( left != 4 )
+                DOMPRINTF("LZO1x: Warning: %#zx unconsumed bytes", left - 4);
+
             msg = "Error registering stream output";
             if ( xc_dom_register_external(dom, out_buf, outsize) )
                 break;
@@ -514,19 +475,9 @@ static int xc_try_lzo1x_decode(
             break;
 
         msg = "Output buffer overflow";
-        if ( outsize > SIZE_MAX - dst_len )
-            break;
-
-        msg = "Decompressed image too large";
-        if ( xc_dom_kernel_check_size(dom, outsize + dst_len) )
-            break;
-
-        msg = "Failed to (re)alloc memory";
-        tmp_buf = realloc(out_buf, outsize + dst_len);
-        if ( tmp_buf == NULL )
+        if ( dst_len > outtot - outsize )
             break;
 
-        out_buf = tmp_buf;
         out_len = dst_len;
 
         ret = lzo1x_decompress_safe(cur, src_len,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:53:50 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:53:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110774.211575 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWji2-0005HG-83; Wed, 14 Apr 2021 17:53:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110774.211575; Wed, 14 Apr 2021 17:53:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWji2-0005H6-4f; Wed, 14 Apr 2021 17:53:50 +0000
Received: by outflank-mailman (input) for mailman id 110774;
 Wed, 14 Apr 2021 17:53:49 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWji1-0005Gy-9C
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:53:49 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWji1-0007E3-8U
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:53:49 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWji1-0006lS-7s
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:53:49 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HOq3QapgHOQXnhelXOTCpsyXFSzsOwXVHMieXjLxaR4=; b=ASEL4R2BvWG4CeBgRMq19aYSfD
	+7oYjKUQaL4BZFW/Ld19lmMYR/pe9ppb9B+zWUPuAXGvt5y8eYOULILJ/7QMuxN8s6PbqZy7M2HV7
	6M9QFvjZc3iZ1s5qxUcaHsYqWnAt8B4UYI5Qil6UFh42xWDdLxRkrkhkU42E2p6T+CtU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] gunzip: drop INIT{,DATA} and STATIC
Message-Id: <E1lWji1-0006lS-7s@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:53:49 +0000

commit b0c2213a1c72fefda1cd0f7c9f30dde655bfb5ad
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:26:54 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:26:54 2021 +0200

    gunzip: drop INIT{,DATA} and STATIC
    
    There's no need for the extra abstraction.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 xen/common/gunzip.c  |  4 ---
 xen/common/inflate.c | 75 ++++++++++++++++++++++++----------------------------
 2 files changed, 35 insertions(+), 44 deletions(-)

diff --git a/xen/common/gunzip.c b/xen/common/gunzip.c
index 425d64e904..b9ecc17e44 100644
--- a/xen/common/gunzip.c
+++ b/xen/common/gunzip.c
@@ -22,7 +22,6 @@ static unsigned __initdata inptr;
 static unsigned __initdata outcnt;
 
 #define OF(args)        args
-#define STATIC          static
 
 #define memzero(s, n)   memset((s), 0, (n))
 
@@ -30,9 +29,6 @@ typedef unsigned char   uch;
 typedef unsigned short  ush;
 typedef unsigned long   ulg;
 
-#define INIT            __init
-#define INITDATA        __initdata
-
 #define get_byte()      (inptr < insize ? inbuf[inptr++] : fill_inbuf())
 
 /* Diagnostic functions */
diff --git a/xen/common/inflate.c b/xen/common/inflate.c
index c593b94d48..8fa4b96d12 100644
--- a/xen/common/inflate.c
+++ b/xen/common/inflate.c
@@ -107,7 +107,7 @@
 static char rcsid[] = "#Id: inflate.c,v 0.14 1993/06/10 13:27:04 jloup Exp #";
 #endif
 
-#ifndef STATIC
+#ifndef __XEN__
 
 #if defined(STDC_HEADERS) || defined(HAVE_STDLIB_H)
 #  include <sys/types.h>
@@ -115,14 +115,9 @@ static char rcsid[] = "#Id: inflate.c,v 0.14 1993/06/10 13:27:04 jloup Exp #";
 #endif
 
 #include "gzip.h"
-#define STATIC
-#endif /* !STATIC */
 
-#ifndef INIT
-#define INIT
-#define INITDATA
-#endif
- 
+#endif /* !__XEN__ */
+
 #define slide window
 
 /* Huffman code lookup table entry--this entry is four bytes for machines
@@ -143,15 +138,15 @@ struct huft {
 
 
 /* Function prototypes */
-STATIC int INIT huft_build OF((unsigned *, unsigned, unsigned, 
-                               const ush *, const ush *, struct huft **, int *));
-STATIC int INIT huft_free OF((struct huft *));
-STATIC int INIT inflate_codes OF((struct huft *, struct huft *, int, int));
-STATIC int INIT inflate_stored OF((void));
-STATIC int INIT inflate_fixed OF((void));
-STATIC int INIT inflate_dynamic OF((void));
-STATIC int INIT inflate_block OF((int *));
-STATIC int INIT inflate OF((void));
+static int huft_build OF((unsigned *, unsigned, unsigned,
+                          const ush *, const ush *, struct huft **, int *));
+static int huft_free OF((struct huft *));
+static int inflate_codes OF((struct huft *, struct huft *, int, int));
+static int inflate_stored OF((void));
+static int inflate_fixed OF((void));
+static int inflate_dynamic OF((void));
+static int inflate_block OF((int *));
+static int inflate OF((void));
 
 
 /* The inflate algorithm uses a sliding 32 K byte window on the uncompressed
@@ -217,10 +212,10 @@ static const ush cpdext[] = {         /* Extra bits for distance codes */
    the stream.
  */
 
-STATIC ulg INITDATA bb;                /* bit buffer */
-STATIC unsigned INITDATA bk;           /* bits in bit buffer */
+static ulg __initdata bb;                /* bit buffer */
+static unsigned __initdata bk;           /* bits in bit buffer */
 
-STATIC const ush mask_bits[] = {
+static const ush mask_bits[] = {
     0x0000,
     0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
     0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
@@ -235,16 +230,16 @@ STATIC const ush mask_bits[] = {
  *  malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
  */
 
-static unsigned long INITDATA malloc_ptr;
-static int INITDATA malloc_count;
+static unsigned long __initdata malloc_ptr;
+static int __initdata malloc_count;
 
-static void INIT init_allocator(void)
+static void __init init_allocator(void)
 {
     malloc_ptr = free_mem_ptr;
     malloc_count = 0;
 }
 
-static void *INIT malloc(int size)
+static void *__init malloc(int size)
 {
     void *p;
 
@@ -265,7 +260,7 @@ static void *INIT malloc(int size)
     return p;
 }
 
-static void INIT free(void *where)
+static void __init free(void *where)
 {
     malloc_count--;
     if (!malloc_count)
@@ -309,8 +304,8 @@ static void INIT free(void *where)
  */
 
 
-STATIC const int lbits = 9;          /* bits in base literal/length lookup table */
-STATIC const int dbits = 6;          /* bits in base distance lookup table */
+static const int lbits = 9;          /* bits in base literal/length lookup table */
+static const int dbits = 6;          /* bits in base distance lookup table */
 
 
 /* If BMAX needs to be larger than 16, then h and x[] should be ulg. */
@@ -318,10 +313,10 @@ STATIC const int dbits = 6;          /* bits in base distance lookup table */
 #define N_MAX 288       /* maximum number of codes in any set */
 
 
-STATIC unsigned INITDATA hufts;      /* track memory usage */
+static unsigned __initdata hufts;      /* track memory usage */
 
 
-STATIC int INIT huft_build(
+static int __init huft_build(
     unsigned *b,            /* code lengths in bits (all assumed <= BMAX) */
     unsigned n,             /* number of codes (assumed <= N_MAX) */
     unsigned s,             /* number of simple-valued codes (0..s-1) */
@@ -566,7 +561,7 @@ STATIC int INIT huft_build(
 
 
 
-STATIC int INIT huft_free(
+static int __init huft_free(
     struct huft *t         /* table to free */
     )
 /* Free the malloc'ed tables built by huft_build(), which makes a linked
@@ -588,7 +583,7 @@ STATIC int INIT huft_free(
 }
 
 
-STATIC int INIT inflate_codes(
+static int __init inflate_codes(
     struct huft *tl,    /* literal/length decoder tables */
     struct huft *td,    /* distance decoder tables */
     int bl,             /* number of bits decoded by tl[] */
@@ -703,7 +698,7 @@ STATIC int INIT inflate_codes(
 
 
 
-STATIC int INIT inflate_stored(void)
+static int __init inflate_stored(void)
 /* "decompress" an inflated type 0 (stored) block. */
 {
     unsigned n;           /* number of bytes in block */
@@ -764,7 +759,7 @@ STATIC int INIT inflate_stored(void)
 /*
  * We use `noinline' here to prevent gcc-3.5 from using too much stack space
  */
-STATIC int noinline INIT inflate_fixed(void)
+static int noinline __init inflate_fixed(void)
 /* decompress an inflated type 1 (fixed Huffman codes) block.  We should
    either replace this with a custom decoder, or at least precompute the
    Huffman tables. */
@@ -828,7 +823,7 @@ STATIC int noinline INIT inflate_fixed(void)
 /*
  * We use `noinline' here to prevent gcc-3.5 from using too much stack space
  */
-STATIC int noinline INIT inflate_dynamic(void)
+static int noinline __init inflate_dynamic(void)
 /* decompress an inflated type 2 (dynamic Huffman codes) block. */
 {
     int i;                /* temporary variables */
@@ -1033,7 +1028,7 @@ goto out;
 
 
 
-STATIC int INIT inflate_block(
+static int __init inflate_block(
 int *e                  /* last block flag */
 )
 /* decompress an inflated block */
@@ -1084,7 +1079,7 @@ NEEDBITS(1)
 
 
 
-STATIC int INIT inflate(void)
+static int __init inflate(void)
 /* decompress an inflated entry */
 {
     int e;                /* last block flag */
@@ -1136,8 +1131,8 @@ STATIC int INIT inflate(void)
  *
  **********************************************************************/
 
-static ulg INITDATA crc_32_tab[256];
-static ulg INITDATA crc;  /* initialized in makecrc() so it'll reside in bss */
+static ulg __initdata crc_32_tab[256];
+static ulg __initdata crc;  /* initialized in makecrc() so it'll reside in bss */
 #define CRC_VALUE (crc ^ 0xffffffffUL)
 
 /*
@@ -1145,7 +1140,7 @@ static ulg INITDATA crc;  /* initialized in makecrc() so it'll reside in bss */
  * gzip-1.0.3/makecrc.c.
  */
 
-static void INIT
+static void __init
 makecrc(void)
 {
 /* Not copyrighted 1990 Mark Adler */
@@ -1193,7 +1188,7 @@ makecrc(void)
 /*
  * Do the uncompression!
  */
-static int INIT gunzip(void)
+static int __init gunzip(void)
 {
     uch flags;
     unsigned char magic[2]; /* magic header */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:54:00 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:54:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110775.211578 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjiC-0005IZ-9V; Wed, 14 Apr 2021 17:54:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110775.211578; Wed, 14 Apr 2021 17:54:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjiC-0005IR-6E; Wed, 14 Apr 2021 17:54:00 +0000
Received: by outflank-mailman (input) for mailman id 110775;
 Wed, 14 Apr 2021 17:53:59 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjiB-0005IK-CW
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:53:59 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjiB-0007EE-Bo
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:53:59 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjiB-0006mJ-B7
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:53:59 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5czWORlBHIEFnPRV5gEnomoRxHO1WDg53rLa66e5RY0=; b=NESagpn/ud0GYGa4K3Z8qBFjew
	XwEG0pDxJwN7wWqmtZM4H/c1Abw09KyAUEap1FRV5Ramg/xsc9WoUKngg/1ut5YtXn7j5+r5yvbij
	7/JVeNrOcExwTgMf0Pf12dlLsbqYulZjKrf0TAEFCNZ5g9WQMrPFXFuip62h7jo4oLow=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: use get_unsafe() instead of copy_from_unsafe()
Message-Id: <E1lWjiB-0006mJ-B7@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:53:59 +0000

commit c864eb01965ab212ce9663d5d83b482e9d149825
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:28:52 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:28:52 2021 +0200

    x86/shadow: use get_unsafe() instead of copy_from_unsafe()
    
    This is the slightly more direct way of getting at what we want, and
    better in line with shadow_write_entries()'s use of put_unsafe().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/multi.c | 33 +++++++++++++++------------------
 1 file changed, 15 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 0342de81d2..88194df302 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -2613,10 +2613,9 @@ static int sh_page_fault(struct vcpu *v,
         {
             shadow_l2e_t sl2e;
             mfn_t gl1mfn;
-            if ( (copy_from_unsafe(&sl2e,
-                                   (sh_linear_l2_table(v)
-                                    + shadow_l2_linear_offset(va)),
-                                   sizeof(sl2e)) != 0)
+            if ( (get_unsafe(sl2e,
+                             (sh_linear_l2_table(v) +
+                              shadow_l2_linear_offset(va))) != 0)
                  || !(shadow_l2e_get_flags(sl2e) & _PAGE_PRESENT)
                  || !mfn_valid(gl1mfn = backpointer(mfn_to_page(
                                   shadow_l2e_get_mfn(sl2e))))
@@ -2632,10 +2631,9 @@ static int sh_page_fault(struct vcpu *v,
 #endif /* SHOPT_OUT_OF_SYNC */
         /* The only reasons for reserved bits to be set in shadow entries
          * are the two "magic" shadow_l1e entries. */
-        if ( likely((copy_from_unsafe(&sl1e,
-                                      (sh_linear_l1_table(v)
-                                       + shadow_l1_linear_offset(va)),
-                                      sizeof(sl1e)) == 0)
+        if ( likely((get_unsafe(sl1e,
+                                (sh_linear_l1_table(v) +
+                                 shadow_l1_linear_offset(va))) == 0)
                     && sh_l1e_is_magic(sl1e)) )
         {
 
@@ -3310,9 +3308,9 @@ static bool sh_invlpg(struct vcpu *v, unsigned long linear)
         /* This must still be a copy-from-unsafe because we don't have the
          * paging lock, and the higher-level shadows might disappear
          * under our feet. */
-        if ( copy_from_unsafe(&sl3e, (sh_linear_l3_table(v)
-                                      + shadow_l3_linear_offset(linear)),
-                              sizeof (sl3e)) != 0 )
+        if ( get_unsafe(sl3e,
+                        (sh_linear_l3_table(v) +
+                         shadow_l3_linear_offset(linear))) != 0 )
         {
             perfc_incr(shadow_invlpg_fault);
             return false;
@@ -3331,9 +3329,9 @@ static bool sh_invlpg(struct vcpu *v, unsigned long linear)
 
     /* This must still be a copy-from-unsafe because we don't have the shadow
      * lock, and the higher-level shadows might disappear under our feet. */
-    if ( copy_from_unsafe(&sl2e,
-                          sh_linear_l2_table(v) + shadow_l2_linear_offset(linear),
-                          sizeof (sl2e)) != 0 )
+    if ( get_unsafe(sl2e,
+                    (sh_linear_l2_table(v) +
+                     shadow_l2_linear_offset(linear))) != 0 )
     {
         perfc_incr(shadow_invlpg_fault);
         return false;
@@ -3374,10 +3372,9 @@ static bool sh_invlpg(struct vcpu *v, unsigned long linear)
              * have the paging lock last time we checked, and the
              * higher-level shadows might have disappeared under our
              * feet. */
-            if ( copy_from_unsafe(&sl2e,
-                                  sh_linear_l2_table(v)
-                                  + shadow_l2_linear_offset(linear),
-                                  sizeof (sl2e)) != 0 )
+            if ( get_unsafe(sl2e,
+                            (sh_linear_l2_table(v) +
+                             shadow_l2_linear_offset(linear))) != 0 )
             {
                 perfc_incr(shadow_invlpg_fault);
                 paging_unlock(d);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:54:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:54:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110776.211582 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjiN-0005Jk-Av; Wed, 14 Apr 2021 17:54:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110776.211582; Wed, 14 Apr 2021 17:54:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjiN-0005Jc-7p; Wed, 14 Apr 2021 17:54:11 +0000
Received: by outflank-mailman (input) for mailman id 110776;
 Wed, 14 Apr 2021 17:54:09 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjiL-0005JQ-GV
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:54:09 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjiL-0007EY-Fi
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:54:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjiL-0006nP-Ec
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:54:09 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9tJRmjhUklr6lUhd1k1t2dYdqQ2ipbtELBoD46dj4+c=; b=Xrjh2/jabFJAoQMfIHXOPqhx5l
	AjZw/SwYtwVoLVz3Dr0c3EUULGQLVvg7MUX+SKv72ZuJouKOX9PHdA7oMjJheA/dF8ue+qKhVW1Rr
	FhrL9WZRBMKVgF+7NRMOTy2AdCGQkb6xsNI1uSrp2uSwFLJ9TFfzwrgj4+DayAnPTU2k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: polish shadow_write_entries()
Message-Id: <E1lWjiL-0006nP-Ec@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:54:09 +0000

commit a3621d6b4a919c49fc04234776569c435bae0ce7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:30:13 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:30:13 2021 +0200

    x86/shadow: polish shadow_write_entries()
    
    First of all, avoid the initial dummy write: Try to write the actual
    new value instead, and start the loop from 1 if this was successful.
    Further, drop safe_write_entry() and use write_atomic() instead. This
    eliminates the need for the BUILD_BUG_ON() there at the same time.
    
    Then
    - use const and unsigned,
    - drop a redundant NULL check,
    - don't open-code PAGE_OFFSET() and IS_ALIGNED(),
    - adjust comment style.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/multi.c | 56 +++++++++++++++++++++---------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 88194df302..cf6512c4d2 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -747,50 +747,50 @@ l1e_propagate_from_guest(struct vcpu *v,
  * functions which ever write (non-zero) data onto a shadow page.
  */
 
-static inline void safe_write_entry(void *dst, void *src)
-/* Copy one PTE safely when processors might be running on the
- * destination pagetable.   This does *not* give safety against
- * concurrent writes (that's what the paging lock is for), just
- * stops the hardware picking up partially written entries. */
-{
-    volatile unsigned long *d = dst;
-    unsigned long *s = src;
-    ASSERT(!((unsigned long) d & (sizeof (shadow_l1e_t) - 1)));
-    /* In 64-bit, sizeof(pte) == sizeof(ulong) == 1 word,
-     * which will be an atomic write, since the entry is aligned. */
-    BUILD_BUG_ON(sizeof (shadow_l1e_t) != sizeof (unsigned long));
-    *d = *s;
-}
-
-
 static inline void
-shadow_write_entries(void *d, void *s, int entries, mfn_t mfn)
-/* This function does the actual writes to shadow pages.
+shadow_write_entries(void *d, const void *s, unsigned int entries, mfn_t mfn)
+/*
+ * This function does the actual writes to shadow pages.
  * It must not be called directly, since it doesn't do the bookkeeping
- * that shadow_set_l*e() functions do. */
+ * that shadow_set_l*e() functions do.
+ *
+ * Copy PTEs safely when processors might be running on the
+ * destination pagetable.  This does *not* give safety against
+ * concurrent writes (that's what the paging lock is for), just
+ * stops the hardware picking up partially written entries.
+ */
 {
     shadow_l1e_t *dst = d;
-    shadow_l1e_t *src = s;
+    const shadow_l1e_t *src = s;
     void *map = NULL;
-    int i;
+    unsigned int i = 0;
 
-    /* Because we mirror access rights at all levels in the shadow, an
+    /*
+     * Because we mirror access rights at all levels in the shadow, an
      * l2 (or higher) entry with the RW bit cleared will leave us with
      * no write access through the linear map.
      * We detect that by writing to the shadow with put_unsafe() and
-     * using map_domain_page() to get a writeable mapping if we need to. */
-    if ( put_unsafe(*dst, dst) )
+     * using map_domain_page() to get a writeable mapping if we need to.
+     */
+    if ( put_unsafe(*src, dst) )
     {
         perfc_incr(shadow_linear_map_failed);
         map = map_domain_page(mfn);
-        dst = map + ((unsigned long)dst & (PAGE_SIZE - 1));
+        dst = map + PAGE_OFFSET(dst);
+    }
+    else
+    {
+        ++src;
+        ++dst;
+        i = 1;
     }
 
+    ASSERT(IS_ALIGNED((unsigned long)dst, sizeof(*dst)));
 
-    for ( i = 0; i < entries; i++ )
-        safe_write_entry(dst++, src++);
+    for ( ; i < entries; i++ )
+        write_atomic(&dst++->l1, src++->l1);
 
-    if ( map != NULL ) unmap_domain_page(map);
+    unmap_domain_page(map);
 }
 
 /* type is only used to distinguish grant map pages from ordinary RAM
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:54:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:54:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110777.211588 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjiX-0005LG-Dr; Wed, 14 Apr 2021 17:54:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110777.211588; Wed, 14 Apr 2021 17:54:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjiX-0005L7-9P; Wed, 14 Apr 2021 17:54:21 +0000
Received: by outflank-mailman (input) for mailman id 110777;
 Wed, 14 Apr 2021 17:54:19 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjiV-0005Ky-LF
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:54:19 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjiV-0007Eg-JN
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:54:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjiV-0006oI-Ic
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:54:19 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=paTtYo9ZnKK98VbapRvXNHKjb9qT2EH01UTHhlwLIBE=; b=PcFsuChmUDoZXthzwkuze2ihMW
	dEmbyg/haYMvtCEP+qty4+SmWVb1+Mj+ZTWF6OjiUMp3EPlu9NUaRZ/MfbGXRwlmLT9qO5z4mcPIU
	10n0W+urCky14sZGMKcTNRrEguL16piIxccg5Wvn9hN9icnpH4Kj3clyt4xZIRH8NNFk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: move shadow_set_l<N>e() to their own source file
Message-Id: <E1lWjiV-0006oI-Ic@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:54:19 +0000

commit b49f8bda2399002e3cfaa472cc6959ec2ac20526
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:31:19 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:31:19 2021 +0200

    x86/shadow: move shadow_set_l<N>e() to their own source file
    
    The few GUEST_PAGING_LEVELS dependencies (of shadow_set_l2e() only) can
    be easily expressed by function parameters; I suppose the extra indirect
    call is acceptable for the increasingly little used 32-bit non-PAE case.
    This way shadow_set_l[12]e(), each of which compiles to almost 1k of
    code, need building just once.
    
    The implication is the need for some "relaxation" in types.h: The
    underlying PTE types don't vary anymore (and aren't expected to down the
    road), so they as well as some basic helpers can be exposed even in the
    new, artificial GUEST_PAGING_LEVELS == 0 case.
    
    Almost pure code movement - exceptions are the conversion of
    "#if GUEST_PAGING_LEVELS == 2" to runtime conditionals and style
    corrections (including to avoid open-coding mfn_to_maddr() and
    PAGE_OFFSET()).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/Makefile |   2 +-
 xen/arch/x86/mm/shadow/multi.c  | 388 +------------------------------------
 xen/arch/x86/mm/shadow/set.c    | 416 ++++++++++++++++++++++++++++++++++++++++
 xen/arch/x86/mm/shadow/types.h  |  44 +++--
 4 files changed, 450 insertions(+), 400 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/Makefile b/xen/arch/x86/mm/shadow/Makefile
index 23d3ff1080..05ffc164eb 100644
--- a/xen/arch/x86/mm/shadow/Makefile
+++ b/xen/arch/x86/mm/shadow/Makefile
@@ -1,5 +1,5 @@
 ifeq ($(CONFIG_SHADOW_PAGING),y)
-obj-y += common.o guest_2.o guest_3.o guest_4.o
+obj-y += common.o guest_2.o guest_3.o guest_4.o set.o
 obj-$(CONFIG_HVM) += hvm.o
 obj-$(CONFIG_PV) += pv.o
 else
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index cf6512c4d2..422ab54a94 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -389,8 +389,13 @@ static inline mfn_t sh_next_page(mfn_t smfn)
     ASSERT(!next->u.sh.head);
     return page_to_mfn(next);
 }
+#else
+# define sh_next_page NULL
 #endif
 
+#define shadow_set_l2e(d, sl2e, new_sl2e, sl2mfn) \
+    shadow_set_l2e(d, sl2e, new_sl2e, sl2mfn, SH_type_fl1_shadow, sh_next_page)
+
 static inline u32
 guest_index(void *ptr)
 {
@@ -741,389 +746,6 @@ l1e_propagate_from_guest(struct vcpu *v,
 }
 
 
-/**************************************************************************/
-/* These functions update shadow entries (and do bookkeeping on the shadow
- * tables they are in).  It is intended that they are the only
- * functions which ever write (non-zero) data onto a shadow page.
- */
-
-static inline void
-shadow_write_entries(void *d, const void *s, unsigned int entries, mfn_t mfn)
-/*
- * This function does the actual writes to shadow pages.
- * It must not be called directly, since it doesn't do the bookkeeping
- * that shadow_set_l*e() functions do.
- *
- * Copy PTEs safely when processors might be running on the
- * destination pagetable.  This does *not* give safety against
- * concurrent writes (that's what the paging lock is for), just
- * stops the hardware picking up partially written entries.
- */
-{
-    shadow_l1e_t *dst = d;
-    const shadow_l1e_t *src = s;
-    void *map = NULL;
-    unsigned int i = 0;
-
-    /*
-     * Because we mirror access rights at all levels in the shadow, an
-     * l2 (or higher) entry with the RW bit cleared will leave us with
-     * no write access through the linear map.
-     * We detect that by writing to the shadow with put_unsafe() and
-     * using map_domain_page() to get a writeable mapping if we need to.
-     */
-    if ( put_unsafe(*src, dst) )
-    {
-        perfc_incr(shadow_linear_map_failed);
-        map = map_domain_page(mfn);
-        dst = map + PAGE_OFFSET(dst);
-    }
-    else
-    {
-        ++src;
-        ++dst;
-        i = 1;
-    }
-
-    ASSERT(IS_ALIGNED((unsigned long)dst, sizeof(*dst)));
-
-    for ( ; i < entries; i++ )
-        write_atomic(&dst++->l1, src++->l1);
-
-    unmap_domain_page(map);
-}
-
-/* type is only used to distinguish grant map pages from ordinary RAM
- * i.e. non-p2m_is_grant() pages are treated as p2m_ram_rw.  */
-static int inline
-shadow_get_page_from_l1e(shadow_l1e_t sl1e, struct domain *d, p2m_type_t type)
-{
-    int res;
-    mfn_t mfn;
-    struct domain *owner;
-
-    ASSERT(!sh_l1e_is_magic(sl1e));
-    ASSERT(shadow_mode_refcounts(d));
-
-    res = get_page_from_l1e(sl1e, d, d);
-
-    // If a privileged domain is attempting to install a map of a page it does
-    // not own, we let it succeed anyway.
-    //
-    if ( unlikely(res < 0) &&
-         !shadow_mode_translate(d) &&
-         mfn_valid(mfn = shadow_l1e_get_mfn(sl1e)) &&
-         (owner = page_get_owner(mfn_to_page(mfn))) &&
-         (d != owner) )
-    {
-        res = xsm_priv_mapping(XSM_TARGET, d, owner);
-        if ( !res ) {
-            res = get_page_from_l1e(sl1e, d, owner);
-            SHADOW_PRINTK("privileged domain %d installs map of mfn %"PRI_mfn" "
-                           "which is owned by d%d: %s\n",
-                           d->domain_id, mfn_x(mfn), owner->domain_id,
-                           res >= 0 ? "success" : "failed");
-        }
-    }
-
-    /* Okay, it might still be a grant mapping PTE.  Try it. */
-    if ( unlikely(res < 0) &&
-         (type == p2m_grant_map_rw ||
-          (type == p2m_grant_map_ro &&
-           !(shadow_l1e_get_flags(sl1e) & _PAGE_RW))) )
-    {
-        /* It's a grant mapping.  The grant table implementation will
-           already have checked that we're supposed to have access, so
-           we can just grab a reference directly. */
-        mfn = shadow_l1e_get_mfn(sl1e);
-        if ( mfn_valid(mfn) )
-            res = get_page_from_l1e(sl1e, d, page_get_owner(mfn_to_page(mfn)));
-    }
-
-    if ( unlikely(res < 0) )
-    {
-        perfc_incr(shadow_get_page_fail);
-        SHADOW_PRINTK("failed: l1e=" SH_PRI_pte "\n");
-    }
-
-    return res;
-}
-
-static void inline
-shadow_put_page_from_l1e(shadow_l1e_t sl1e, struct domain *d)
-{
-    if ( !shadow_mode_refcounts(d) )
-        return;
-
-    put_page_from_l1e(sl1e, d);
-}
-
-#if GUEST_PAGING_LEVELS >= 4
-static int shadow_set_l4e(struct domain *d,
-                          shadow_l4e_t *sl4e,
-                          shadow_l4e_t new_sl4e,
-                          mfn_t sl4mfn)
-{
-    int flags = 0;
-    shadow_l4e_t old_sl4e;
-    paddr_t paddr;
-    ASSERT(sl4e != NULL);
-    old_sl4e = *sl4e;
-
-    if ( old_sl4e.l4 == new_sl4e.l4 ) return 0; /* Nothing to do */
-
-    paddr = ((((paddr_t)mfn_x(sl4mfn)) << PAGE_SHIFT)
-             | (((unsigned long)sl4e) & ~PAGE_MASK));
-
-    if ( shadow_l4e_get_flags(new_sl4e) & _PAGE_PRESENT )
-    {
-        /* About to install a new reference */
-        mfn_t sl3mfn = shadow_l4e_get_mfn(new_sl4e);
-
-        if ( !sh_get_ref(d, sl3mfn, paddr) )
-        {
-            domain_crash(d);
-            return SHADOW_SET_ERROR;
-        }
-
-        /* Are we pinning l3 shadows to handle weird Linux behaviour? */
-        if ( sh_type_is_pinnable(d, SH_type_l3_64_shadow) )
-            sh_pin(d, sl3mfn);
-    }
-
-    /* Write the new entry */
-    shadow_write_entries(sl4e, &new_sl4e, 1, sl4mfn);
-    flush_root_pgtbl_domain(d);
-
-    flags |= SHADOW_SET_CHANGED;
-
-    if ( shadow_l4e_get_flags(old_sl4e) & _PAGE_PRESENT )
-    {
-        /* We lost a reference to an old mfn. */
-        mfn_t osl3mfn = shadow_l4e_get_mfn(old_sl4e);
-
-        if ( !mfn_eq(osl3mfn, shadow_l4e_get_mfn(new_sl4e))
-             || !perms_strictly_increased(shadow_l4e_get_flags(old_sl4e),
-                                          shadow_l4e_get_flags(new_sl4e)) )
-        {
-            flags |= SHADOW_SET_FLUSH;
-        }
-        sh_put_ref(d, osl3mfn, paddr);
-    }
-
-    return flags;
-}
-
-static int shadow_set_l3e(struct domain *d,
-                          shadow_l3e_t *sl3e,
-                          shadow_l3e_t new_sl3e,
-                          mfn_t sl3mfn)
-{
-    int flags = 0;
-    shadow_l3e_t old_sl3e;
-    paddr_t paddr;
-    ASSERT(sl3e != NULL);
-    old_sl3e = *sl3e;
-
-    if ( old_sl3e.l3 == new_sl3e.l3 ) return 0; /* Nothing to do */
-
-    paddr = ((((paddr_t)mfn_x(sl3mfn)) << PAGE_SHIFT)
-             | (((unsigned long)sl3e) & ~PAGE_MASK));
-
-    if ( shadow_l3e_get_flags(new_sl3e) & _PAGE_PRESENT )
-    {
-        /* About to install a new reference */
-        if ( !sh_get_ref(d, shadow_l3e_get_mfn(new_sl3e), paddr) )
-        {
-            domain_crash(d);
-            return SHADOW_SET_ERROR;
-        }
-    }
-
-    /* Write the new entry */
-    shadow_write_entries(sl3e, &new_sl3e, 1, sl3mfn);
-    flags |= SHADOW_SET_CHANGED;
-
-    if ( shadow_l3e_get_flags(old_sl3e) & _PAGE_PRESENT )
-    {
-        /* We lost a reference to an old mfn. */
-        mfn_t osl2mfn = shadow_l3e_get_mfn(old_sl3e);
-
-        if ( !mfn_eq(osl2mfn, shadow_l3e_get_mfn(new_sl3e)) ||
-             !perms_strictly_increased(shadow_l3e_get_flags(old_sl3e),
-                                       shadow_l3e_get_flags(new_sl3e)) )
-        {
-            flags |= SHADOW_SET_FLUSH;
-        }
-        sh_put_ref(d, osl2mfn, paddr);
-    }
-    return flags;
-}
-#endif /* GUEST_PAGING_LEVELS >= 4 */
-
-static int shadow_set_l2e(struct domain *d,
-                          shadow_l2e_t *sl2e,
-                          shadow_l2e_t new_sl2e,
-                          mfn_t sl2mfn)
-{
-    int flags = 0;
-    shadow_l2e_t old_sl2e;
-    paddr_t paddr;
-
-#if GUEST_PAGING_LEVELS == 2
-    /* In 2-on-3 we work with pairs of l2es pointing at two-page
-     * shadows.  Reference counting and up-pointers track from the first
-     * page of the shadow to the first l2e, so make sure that we're
-     * working with those:
-     * Start with a pair of identical entries */
-    shadow_l2e_t pair[2] = { new_sl2e, new_sl2e };
-    /* Align the pointer down so it's pointing at the first of the pair */
-    sl2e = (shadow_l2e_t *)((unsigned long)sl2e & ~(sizeof(shadow_l2e_t)));
-#endif
-
-    ASSERT(sl2e != NULL);
-    old_sl2e = *sl2e;
-
-    if ( old_sl2e.l2 == new_sl2e.l2 ) return 0; /* Nothing to do */
-
-    paddr = ((((paddr_t)mfn_x(sl2mfn)) << PAGE_SHIFT)
-             | (((unsigned long)sl2e) & ~PAGE_MASK));
-
-    if ( shadow_l2e_get_flags(new_sl2e) & _PAGE_PRESENT )
-    {
-        mfn_t sl1mfn = shadow_l2e_get_mfn(new_sl2e);
-        ASSERT(mfn_to_page(sl1mfn)->u.sh.head);
-
-        /* About to install a new reference */
-        if ( !sh_get_ref(d, sl1mfn, paddr) )
-        {
-            domain_crash(d);
-            return SHADOW_SET_ERROR;
-        }
-#if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
-        {
-            struct page_info *sp = mfn_to_page(sl1mfn);
-            mfn_t gl1mfn;
-
-            ASSERT(sp->u.sh.head);
-            gl1mfn = backpointer(sp);
-            /* If the shadow is a fl1 then the backpointer contains
-               the GFN instead of the GMFN, and it's definitely not
-               OOS. */
-            if ( (sp->u.sh.type != SH_type_fl1_shadow) && mfn_valid(gl1mfn)
-                 && mfn_is_out_of_sync(gl1mfn) )
-                sh_resync(d, gl1mfn);
-        }
-#endif
-#if GUEST_PAGING_LEVELS == 2
-        /* Update the second entry to point tio the second half of the l1 */
-        sl1mfn = sh_next_page(sl1mfn);
-        pair[1] = shadow_l2e_from_mfn(sl1mfn, shadow_l2e_get_flags(new_sl2e));
-#endif
-    }
-
-    /* Write the new entry */
-#if GUEST_PAGING_LEVELS == 2
-    shadow_write_entries(sl2e, &pair, 2, sl2mfn);
-#else /* normal case */
-    shadow_write_entries(sl2e, &new_sl2e, 1, sl2mfn);
-#endif
-    flags |= SHADOW_SET_CHANGED;
-
-    if ( shadow_l2e_get_flags(old_sl2e) & _PAGE_PRESENT )
-    {
-        /* We lost a reference to an old mfn. */
-        mfn_t osl1mfn = shadow_l2e_get_mfn(old_sl2e);
-
-        if ( !mfn_eq(osl1mfn, shadow_l2e_get_mfn(new_sl2e)) ||
-             !perms_strictly_increased(shadow_l2e_get_flags(old_sl2e),
-                                       shadow_l2e_get_flags(new_sl2e)) )
-        {
-            flags |= SHADOW_SET_FLUSH;
-        }
-        sh_put_ref(d, osl1mfn, paddr);
-    }
-    return flags;
-}
-
-static int shadow_set_l1e(struct domain *d,
-                          shadow_l1e_t *sl1e,
-                          shadow_l1e_t new_sl1e,
-                          p2m_type_t new_type,
-                          mfn_t sl1mfn)
-{
-    int flags = 0;
-    shadow_l1e_t old_sl1e;
-    unsigned int old_sl1f;
-#if SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC
-    mfn_t new_gmfn = shadow_l1e_get_mfn(new_sl1e);
-#endif
-    ASSERT(sl1e != NULL);
-
-#if SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC
-    if ( mfn_valid(new_gmfn) && mfn_oos_may_write(new_gmfn)
-         && ((shadow_l1e_get_flags(new_sl1e) & (_PAGE_RW|_PAGE_PRESENT))
-             == (_PAGE_RW|_PAGE_PRESENT)) )
-        oos_fixup_add(d, new_gmfn, sl1mfn, pgentry_ptr_to_slot(sl1e));
-#endif
-
-    old_sl1e = *sl1e;
-
-    if ( old_sl1e.l1 == new_sl1e.l1 ) return 0; /* Nothing to do */
-
-    if ( (shadow_l1e_get_flags(new_sl1e) & _PAGE_PRESENT)
-         && !sh_l1e_is_magic(new_sl1e) )
-    {
-        /* About to install a new reference */
-        if ( shadow_mode_refcounts(d) )
-        {
-#define PAGE_FLIPPABLE (_PAGE_RW | _PAGE_PWT | _PAGE_PCD | _PAGE_PAT)
-            int rc;
-
-            TRACE_SHADOW_PATH_FLAG(TRCE_SFLAG_SHADOW_L1_GET_REF);
-            switch ( rc = shadow_get_page_from_l1e(new_sl1e, d, new_type) )
-            {
-            default:
-                /* Doesn't look like a pagetable. */
-                flags |= SHADOW_SET_ERROR;
-                new_sl1e = shadow_l1e_empty();
-                break;
-            case PAGE_FLIPPABLE & -PAGE_FLIPPABLE ... PAGE_FLIPPABLE:
-                ASSERT(!(rc & ~PAGE_FLIPPABLE));
-                new_sl1e = shadow_l1e_flip_flags(new_sl1e, rc);
-                /* fall through */
-            case 0:
-                shadow_vram_get_mfn(shadow_l1e_get_mfn(new_sl1e),
-                                    shadow_l1e_get_flags(new_sl1e),
-                                    sl1mfn, sl1e, d);
-                break;
-            }
-#undef PAGE_FLIPPABLE
-        }
-    }
-
-    /* Write the new entry */
-    shadow_write_entries(sl1e, &new_sl1e, 1, sl1mfn);
-    flags |= SHADOW_SET_CHANGED;
-
-    old_sl1f = shadow_l1e_get_flags(old_sl1e);
-    if ( (old_sl1f & _PAGE_PRESENT) && !sh_l1e_is_magic(old_sl1e) &&
-         shadow_mode_refcounts(d) )
-    {
-        /* We lost a reference to an old mfn. */
-        /* N.B. Unlike higher-level sets, never need an extra flush
-         * when writing an l1e.  Because it points to the same guest frame
-         * as the guest l1e did, it's the guest's responsibility to
-         * trigger a flush later. */
-        shadow_vram_put_mfn(shadow_l1e_get_mfn(old_sl1e), old_sl1f,
-                            sl1mfn, sl1e, d);
-        shadow_put_page_from_l1e(old_sl1e, d);
-        TRACE_SHADOW_PATH_FLAG(TRCE_SFLAG_SHADOW_L1_PUT_REF);
-    }
-    return flags;
-}
-
-
 /**************************************************************************/
 /* Macros to walk pagetables.  These take the shadow of a pagetable and
  * walk every "interesting" entry.  That is, they don't touch Xen mappings,
diff --git a/xen/arch/x86/mm/shadow/set.c b/xen/arch/x86/mm/shadow/set.c
new file mode 100644
index 0000000000..fff4d1633c
--- /dev/null
+++ b/xen/arch/x86/mm/shadow/set.c
@@ -0,0 +1,416 @@
+/******************************************************************************
+ * arch/x86/mm/shadow/set.c
+ *
+ * Simple, mostly-synchronous shadow page tables.
+ * Parts of this code are Copyright (c) 2006 by XenSource Inc.
+ * Parts of this code are Copyright (c) 2006 by Michael A Fetterman
+ * Parts based on earlier work by Michael A Fetterman, Ian Pratt et al.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define GUEST_PAGING_LEVELS 0
+
+#include <xen/sched.h>
+#include <xsm/xsm.h>
+#include <asm/shadow.h>
+#include "private.h"
+#include "types.h"
+
+/*
+ * These functions update shadow entries (and do bookkeeping on the shadow
+ * tables they are in).  It is intended that they are the only
+ * functions which ever write (non-zero) data onto a shadow page.
+ */
+
+static inline void
+shadow_write_entries(void *d, const void *s, unsigned int entries, mfn_t mfn)
+/*
+ * This function does the actual writes to shadow pages.
+ * It must not be called directly, since it doesn't do the bookkeeping
+ * that shadow_set_l*e() functions do.
+ *
+ * Copy PTEs safely when processors might be running on the
+ * destination pagetable.  This does *not* give safety against
+ * concurrent writes (that's what the paging lock is for), just
+ * stops the hardware picking up partially written entries.
+ */
+{
+    shadow_l1e_t *dst = d;
+    const shadow_l1e_t *src = s;
+    void *map = NULL;
+    unsigned int i = 0;
+
+    /*
+     * Because we mirror access rights at all levels in the shadow, an
+     * l2 (or higher) entry with the RW bit cleared will leave us with
+     * no write access through the linear map.
+     * We detect that by writing to the shadow with put_unsafe() and
+     * using map_domain_page() to get a writeable mapping if we need to.
+     */
+    if ( put_unsafe(*src, dst) )
+    {
+        perfc_incr(shadow_linear_map_failed);
+        map = map_domain_page(mfn);
+        dst = map + PAGE_OFFSET(dst);
+    }
+    else
+    {
+        ++src;
+        ++dst;
+        i = 1;
+    }
+
+    ASSERT(IS_ALIGNED((unsigned long)dst, sizeof(*dst)));
+
+    for ( ; i < entries; i++ )
+        write_atomic(&dst++->l1, src++->l1);
+
+    unmap_domain_page(map);
+}
+
+/*
+ * "type" is only used to distinguish grant map pages from ordinary RAM
+ * i.e. non-p2m_is_grant() pages are treated as p2m_ram_rw.
+ */
+static int inline
+shadow_get_page_from_l1e(shadow_l1e_t sl1e, struct domain *d, p2m_type_t type)
+{
+    int res;
+    mfn_t mfn;
+    struct domain *owner;
+
+    ASSERT(!sh_l1e_is_magic(sl1e));
+    ASSERT(shadow_mode_refcounts(d));
+
+    res = get_page_from_l1e(sl1e, d, d);
+
+    /*
+     * If a privileged domain is attempting to install a map of a page it does
+     * not own, we let it succeed anyway.
+     */
+    if ( unlikely(res < 0) &&
+         !shadow_mode_translate(d) &&
+         mfn_valid(mfn = shadow_l1e_get_mfn(sl1e)) &&
+         (owner = page_get_owner(mfn_to_page(mfn))) &&
+         (d != owner) )
+    {
+        res = xsm_priv_mapping(XSM_TARGET, d, owner);
+        if ( !res )
+        {
+            res = get_page_from_l1e(sl1e, d, owner);
+            SHADOW_PRINTK("privileged %pd installs map of mfn %"PRI_mfn" owned by %pd: %s\n",
+                           d, mfn_x(mfn), owner,
+                           res >= 0 ? "success" : "failed");
+        }
+    }
+
+    /* Okay, it might still be a grant mapping PTE.  Try it. */
+    if ( unlikely(res < 0) &&
+         (type == p2m_grant_map_rw ||
+          (type == p2m_grant_map_ro &&
+           !(shadow_l1e_get_flags(sl1e) & _PAGE_RW))) )
+    {
+        /*
+         * It's a grant mapping.  The grant table implementation will
+         * already have checked that we're supposed to have access, so
+         * we can just grab a reference directly.
+         */
+        mfn = shadow_l1e_get_mfn(sl1e);
+        if ( mfn_valid(mfn) )
+            res = get_page_from_l1e(sl1e, d, page_get_owner(mfn_to_page(mfn)));
+    }
+
+    if ( unlikely(res < 0) )
+    {
+        perfc_incr(shadow_get_page_fail);
+        SHADOW_PRINTK("failed: l1e=" SH_PRI_pte "\n");
+    }
+
+    return res;
+}
+
+int shadow_set_l4e(struct domain *d, shadow_l4e_t *sl4e,
+                   shadow_l4e_t new_sl4e, mfn_t sl4mfn)
+{
+    int flags = 0;
+    shadow_l4e_t old_sl4e;
+    paddr_t paddr;
+
+    ASSERT(sl4e != NULL);
+    old_sl4e = *sl4e;
+
+    if ( old_sl4e.l4 == new_sl4e.l4 ) return 0; /* Nothing to do */
+
+    paddr = mfn_to_maddr(sl4mfn) | PAGE_OFFSET(sl4e);
+
+    if ( shadow_l4e_get_flags(new_sl4e) & _PAGE_PRESENT )
+    {
+        /* About to install a new reference */
+        mfn_t sl3mfn = shadow_l4e_get_mfn(new_sl4e);
+
+        if ( !sh_get_ref(d, sl3mfn, paddr) )
+        {
+            domain_crash(d);
+            return SHADOW_SET_ERROR;
+        }
+
+        /* Are we pinning l3 shadows to handle weird Linux behaviour? */
+        if ( sh_type_is_pinnable(d, SH_type_l3_64_shadow) )
+            sh_pin(d, sl3mfn);
+    }
+
+    /* Write the new entry */
+    shadow_write_entries(sl4e, &new_sl4e, 1, sl4mfn);
+    flush_root_pgtbl_domain(d);
+
+    flags |= SHADOW_SET_CHANGED;
+
+    if ( shadow_l4e_get_flags(old_sl4e) & _PAGE_PRESENT )
+    {
+        /* We lost a reference to an old mfn. */
+        mfn_t osl3mfn = shadow_l4e_get_mfn(old_sl4e);
+
+        if ( !mfn_eq(osl3mfn, shadow_l4e_get_mfn(new_sl4e)) ||
+             !perms_strictly_increased(shadow_l4e_get_flags(old_sl4e),
+                                       shadow_l4e_get_flags(new_sl4e)) )
+            flags |= SHADOW_SET_FLUSH;
+
+        sh_put_ref(d, osl3mfn, paddr);
+    }
+
+    return flags;
+}
+
+int shadow_set_l3e(struct domain *d, shadow_l3e_t *sl3e,
+                   shadow_l3e_t new_sl3e, mfn_t sl3mfn)
+{
+    int flags = 0;
+    shadow_l3e_t old_sl3e;
+    paddr_t paddr;
+
+    ASSERT(sl3e != NULL);
+    old_sl3e = *sl3e;
+
+    if ( old_sl3e.l3 == new_sl3e.l3 ) return 0; /* Nothing to do */
+
+    paddr = mfn_to_maddr(sl3mfn) | PAGE_OFFSET(sl3e);
+
+    if ( shadow_l3e_get_flags(new_sl3e) & _PAGE_PRESENT )
+    {
+        /* About to install a new reference */
+        if ( !sh_get_ref(d, shadow_l3e_get_mfn(new_sl3e), paddr) )
+        {
+            domain_crash(d);
+            return SHADOW_SET_ERROR;
+        }
+    }
+
+    /* Write the new entry */
+    shadow_write_entries(sl3e, &new_sl3e, 1, sl3mfn);
+    flags |= SHADOW_SET_CHANGED;
+
+    if ( shadow_l3e_get_flags(old_sl3e) & _PAGE_PRESENT )
+    {
+        /* We lost a reference to an old mfn. */
+        mfn_t osl2mfn = shadow_l3e_get_mfn(old_sl3e);
+
+        if ( !mfn_eq(osl2mfn, shadow_l3e_get_mfn(new_sl3e)) ||
+             !perms_strictly_increased(shadow_l3e_get_flags(old_sl3e),
+                                       shadow_l3e_get_flags(new_sl3e)) )
+            flags |= SHADOW_SET_FLUSH;
+
+        sh_put_ref(d, osl2mfn, paddr);
+    }
+
+    return flags;
+}
+
+int shadow_set_l2e(struct domain *d, shadow_l2e_t *sl2e,
+                   shadow_l2e_t new_sl2e, mfn_t sl2mfn,
+                   unsigned int type_fl1_shadow,
+                   mfn_t (*next_page)(mfn_t smfn))
+{
+    int flags = 0;
+    shadow_l2e_t old_sl2e;
+    paddr_t paddr;
+    /*
+     * In 2-on-3 we work with pairs of l2es pointing at two-page
+     * shadows.  Reference counting and up-pointers track from the first
+     * page of the shadow to the first l2e, so make sure that we're
+     * working with those:
+     * Start with a pair of identical entries.
+     */
+    shadow_l2e_t pair[2] = { new_sl2e, new_sl2e };
+
+    if ( next_page )
+    {
+        /* Align the pointer down so it's pointing at the first of the pair */
+        sl2e = (shadow_l2e_t *)((unsigned long)sl2e & ~sizeof(shadow_l2e_t));
+    }
+
+    ASSERT(sl2e != NULL);
+    old_sl2e = *sl2e;
+
+    if ( old_sl2e.l2 == new_sl2e.l2 ) return 0; /* Nothing to do */
+
+    paddr = mfn_to_maddr(sl2mfn) | PAGE_OFFSET(sl2e);
+
+    if ( shadow_l2e_get_flags(new_sl2e) & _PAGE_PRESENT )
+    {
+        mfn_t sl1mfn = shadow_l2e_get_mfn(new_sl2e);
+        ASSERT(mfn_to_page(sl1mfn)->u.sh.head);
+
+        /* About to install a new reference */
+        if ( !sh_get_ref(d, sl1mfn, paddr) )
+        {
+            domain_crash(d);
+            return SHADOW_SET_ERROR;
+        }
+
+#if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
+        {
+            struct page_info *sp = mfn_to_page(sl1mfn);
+            mfn_t gl1mfn;
+
+            ASSERT(sp->u.sh.head);
+            gl1mfn = backpointer(sp);
+            /*
+             * If the shadow is a fl1 then the backpointer contains the
+             * GFN instead of the GMFN, and it's definitely not OOS.
+             */
+            if ( (sp->u.sh.type != type_fl1_shadow) && mfn_valid(gl1mfn)
+                 && mfn_is_out_of_sync(gl1mfn) )
+                sh_resync(d, gl1mfn);
+        }
+#endif
+
+        if ( next_page )
+        {
+            /* Update the second entry to point to the second half of the l1 */
+            sl1mfn = next_page(sl1mfn);
+            pair[1] = shadow_l2e_from_mfn(sl1mfn,
+                                          shadow_l2e_get_flags(new_sl2e));
+        }
+    }
+
+    /* Write the new entry / entries */
+    shadow_write_entries(sl2e, &pair, !next_page ? 1 : 2, sl2mfn);
+
+    flags |= SHADOW_SET_CHANGED;
+
+    if ( shadow_l2e_get_flags(old_sl2e) & _PAGE_PRESENT )
+    {
+        /* We lost a reference to an old mfn. */
+        mfn_t osl1mfn = shadow_l2e_get_mfn(old_sl2e);
+
+        if ( !mfn_eq(osl1mfn, shadow_l2e_get_mfn(new_sl2e)) ||
+             !perms_strictly_increased(shadow_l2e_get_flags(old_sl2e),
+                                       shadow_l2e_get_flags(new_sl2e)) )
+            flags |= SHADOW_SET_FLUSH;
+
+        sh_put_ref(d, osl1mfn, paddr);
+    }
+
+    return flags;
+}
+
+int shadow_set_l1e(struct domain *d, shadow_l1e_t *sl1e,
+                   shadow_l1e_t new_sl1e, p2m_type_t new_type,
+                   mfn_t sl1mfn)
+{
+    int flags = 0;
+    shadow_l1e_t old_sl1e;
+    unsigned int old_sl1f;
+#if SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC
+    mfn_t new_gmfn = shadow_l1e_get_mfn(new_sl1e);
+#endif
+
+    ASSERT(sl1e != NULL);
+
+#if SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC
+    if ( mfn_valid(new_gmfn) && mfn_oos_may_write(new_gmfn) &&
+         ((shadow_l1e_get_flags(new_sl1e) & (_PAGE_RW | _PAGE_PRESENT)) ==
+          (_PAGE_RW | _PAGE_PRESENT)) )
+        oos_fixup_add(d, new_gmfn, sl1mfn, pgentry_ptr_to_slot(sl1e));
+#endif
+
+    old_sl1e = *sl1e;
+
+    if ( old_sl1e.l1 == new_sl1e.l1 ) return 0; /* Nothing to do */
+
+    if ( (shadow_l1e_get_flags(new_sl1e) & _PAGE_PRESENT) &&
+         !sh_l1e_is_magic(new_sl1e) )
+    {
+        /* About to install a new reference */
+        if ( shadow_mode_refcounts(d) )
+        {
+#define PAGE_FLIPPABLE (_PAGE_RW | _PAGE_PWT | _PAGE_PCD | _PAGE_PAT)
+            int rc;
+
+            TRACE_SHADOW_PATH_FLAG(TRCE_SFLAG_SHADOW_L1_GET_REF);
+            switch ( rc = shadow_get_page_from_l1e(new_sl1e, d, new_type) )
+            {
+            default:
+                /* Doesn't look like a pagetable. */
+                flags |= SHADOW_SET_ERROR;
+                new_sl1e = shadow_l1e_empty();
+                break;
+            case PAGE_FLIPPABLE & -PAGE_FLIPPABLE ... PAGE_FLIPPABLE:
+                ASSERT(!(rc & ~PAGE_FLIPPABLE));
+                new_sl1e = shadow_l1e_flip_flags(new_sl1e, rc);
+                /* fall through */
+            case 0:
+                shadow_vram_get_mfn(shadow_l1e_get_mfn(new_sl1e),
+                                    shadow_l1e_get_flags(new_sl1e),
+                                    sl1mfn, sl1e, d);
+                break;
+            }
+#undef PAGE_FLIPPABLE
+        }
+    }
+
+    /* Write the new entry */
+    shadow_write_entries(sl1e, &new_sl1e, 1, sl1mfn);
+    flags |= SHADOW_SET_CHANGED;
+
+    old_sl1f = shadow_l1e_get_flags(old_sl1e);
+    if ( (old_sl1f & _PAGE_PRESENT) && !sh_l1e_is_magic(old_sl1e) &&
+         shadow_mode_refcounts(d) )
+    {
+        /*
+         * We lost a reference to an old mfn.
+         *
+         * N.B. Unlike higher-level sets, never need an extra flush when
+         * writing an l1e.  Because it points to the same guest frame as the
+         * guest l1e did, it's the guest's responsibility to trigger a flush
+         * later.
+         */
+        shadow_vram_put_mfn(shadow_l1e_get_mfn(old_sl1e), old_sl1f,
+                            sl1mfn, sl1e, d);
+        shadow_put_page_from_l1e(old_sl1e, d);
+        TRACE_SHADOW_PATH_FLAG(TRCE_SFLAG_SHADOW_L1_PUT_REF);
+    }
+
+    return flags;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/x86/mm/shadow/types.h b/xen/arch/x86/mm/shadow/types.h
index a86be62d88..a671fc9a49 100644
--- a/xen/arch/x86/mm/shadow/types.h
+++ b/xen/arch/x86/mm/shadow/types.h
@@ -24,8 +24,8 @@
 
 /* The number of levels in the shadow pagetable is entirely determined
  * by the number of levels in the guest pagetable */
-#if GUEST_PAGING_LEVELS == 4
-#define SHADOW_PAGING_LEVELS 4
+#if GUEST_PAGING_LEVELS != 2
+#define SHADOW_PAGING_LEVELS GUEST_PAGING_LEVELS
 #else
 #define SHADOW_PAGING_LEVELS 3
 #endif
@@ -43,7 +43,7 @@
 #define SHADOW_L1_PAGETABLE_SHIFT        12
 #define SHADOW_L2_PAGETABLE_SHIFT        21
 #define SHADOW_L3_PAGETABLE_SHIFT        30
-#else /* SHADOW_PAGING_LEVELS == 4 */
+#elif SHADOW_PAGING_LEVELS == 4
 #define SHADOW_L1_PAGETABLE_ENTRIES     512
 #define SHADOW_L2_PAGETABLE_ENTRIES     512
 #define SHADOW_L3_PAGETABLE_ENTRIES     512
@@ -58,9 +58,7 @@
 typedef l1_pgentry_t shadow_l1e_t;
 typedef l2_pgentry_t shadow_l2e_t;
 typedef l3_pgentry_t shadow_l3e_t;
-#if SHADOW_PAGING_LEVELS >= 4
 typedef l4_pgentry_t shadow_l4e_t;
-#endif
 
 /* Access functions for them */
 static inline paddr_t shadow_l1e_get_paddr(shadow_l1e_t sl1e)
@@ -69,10 +67,8 @@ static inline paddr_t shadow_l2e_get_paddr(shadow_l2e_t sl2e)
 { return l2e_get_paddr(sl2e); }
 static inline paddr_t shadow_l3e_get_paddr(shadow_l3e_t sl3e)
 { return l3e_get_paddr(sl3e); }
-#if SHADOW_PAGING_LEVELS >= 4
 static inline paddr_t shadow_l4e_get_paddr(shadow_l4e_t sl4e)
 { return l4e_get_paddr(sl4e); }
-#endif
 
 static inline mfn_t shadow_l1e_get_mfn(shadow_l1e_t sl1e)
 { return l1e_get_mfn(sl1e); }
@@ -80,10 +76,8 @@ static inline mfn_t shadow_l2e_get_mfn(shadow_l2e_t sl2e)
 { return l2e_get_mfn(sl2e); }
 static inline mfn_t shadow_l3e_get_mfn(shadow_l3e_t sl3e)
 { return l3e_get_mfn(sl3e); }
-#if SHADOW_PAGING_LEVELS >= 4
 static inline mfn_t shadow_l4e_get_mfn(shadow_l4e_t sl4e)
 { return l4e_get_mfn(sl4e); }
-#endif
 
 static inline u32 shadow_l1e_get_flags(shadow_l1e_t sl1e)
 { return l1e_get_flags(sl1e); }
@@ -91,10 +85,8 @@ static inline u32 shadow_l2e_get_flags(shadow_l2e_t sl2e)
 { return l2e_get_flags(sl2e); }
 static inline u32 shadow_l3e_get_flags(shadow_l3e_t sl3e)
 { return l3e_get_flags(sl3e); }
-#if SHADOW_PAGING_LEVELS >= 4
 static inline u32 shadow_l4e_get_flags(shadow_l4e_t sl4e)
 { return l4e_get_flags(sl4e); }
-#endif
 
 static inline shadow_l1e_t
 shadow_l1e_remove_flags(shadow_l1e_t sl1e, u32 flags)
@@ -109,10 +101,8 @@ static inline shadow_l2e_t shadow_l2e_empty(void)
 { return l2e_empty(); }
 static inline shadow_l3e_t shadow_l3e_empty(void)
 { return l3e_empty(); }
-#if SHADOW_PAGING_LEVELS >= 4
 static inline shadow_l4e_t shadow_l4e_empty(void)
 { return l4e_empty(); }
-#endif
 
 static inline shadow_l1e_t shadow_l1e_from_mfn(mfn_t mfn, u32 flags)
 { return l1e_from_mfn(mfn, flags); }
@@ -120,10 +110,8 @@ static inline shadow_l2e_t shadow_l2e_from_mfn(mfn_t mfn, u32 flags)
 { return l2e_from_mfn(mfn, flags); }
 static inline shadow_l3e_t shadow_l3e_from_mfn(mfn_t mfn, u32 flags)
 { return l3e_from_mfn(mfn, flags); }
-#if SHADOW_PAGING_LEVELS >= 4
 static inline shadow_l4e_t shadow_l4e_from_mfn(mfn_t mfn, u32 flags)
 { return l4e_from_mfn(mfn, flags); }
-#endif
 
 #define shadow_l1_table_offset(a) l1_table_offset(a)
 #define shadow_l2_table_offset(a) l2_table_offset(a)
@@ -208,7 +196,7 @@ static inline shadow_l4e_t shadow_l4e_from_mfn(mfn_t mfn, u32 flags)
 #define SH_type_fl1_shadow SH_type_fl1_pae_shadow
 #define SH_type_l2_shadow  SH_type_l2_pae_shadow
 #define SH_type_l2h_shadow SH_type_l2h_pae_shadow
-#else
+#elif GUEST_PAGING_LEVELS == 4
 #define SH_type_l1_shadow  SH_type_l1_64_shadow
 #define SH_type_fl1_shadow SH_type_fl1_64_shadow
 #define SH_type_l2_shadow  SH_type_l2_64_shadow
@@ -217,6 +205,8 @@ static inline shadow_l4e_t shadow_l4e_from_mfn(mfn_t mfn, u32 flags)
 #define SH_type_l4_shadow  SH_type_l4_64_shadow
 #endif
 
+#if GUEST_PAGING_LEVELS
+
 /* macros for dealing with the naming of the internal function names of the
  * shadow code's external entry points.
  */
@@ -262,6 +252,8 @@ static inline shadow_l4e_t shadow_l4e_from_mfn(mfn_t mfn, u32 flags)
 #define sh_rm_write_access_from_sl1p INTERNAL_NAME(sh_rm_write_access_from_sl1p)
 #endif
 
+#endif /* GUEST_PAGING_LEVELS */
+
 #if SHADOW_PAGING_LEVELS == 3
 #define MFN_FITS_IN_HVM_CR3(_MFN) !(mfn_x(_MFN) >> 20)
 #endif
@@ -270,6 +262,26 @@ static inline shadow_l4e_t shadow_l4e_from_mfn(mfn_t mfn, u32 flags)
 #define SH_PRI_gpte PRI_gpte
 #define SH_PRI_gfn  PRI_gfn
 
+int shadow_set_l1e(struct domain *d, shadow_l1e_t *sl1e,
+                   shadow_l1e_t new_sl1e, p2m_type_t new_type,
+                   mfn_t sl1mfn);
+int shadow_set_l2e(struct domain *d, shadow_l2e_t *sl2e,
+                   shadow_l2e_t new_sl2e, mfn_t sl2mfn,
+                   unsigned int type_fl1_shadow,
+                   mfn_t (*next_page)(mfn_t smfn));
+int shadow_set_l3e(struct domain *d, shadow_l3e_t *sl3e,
+                   shadow_l3e_t new_sl3e, mfn_t sl3mfn);
+int shadow_set_l4e(struct domain *d, shadow_l4e_t *sl4e,
+                   shadow_l4e_t new_sl4e, mfn_t sl4mfn);
+
+static void inline
+shadow_put_page_from_l1e(shadow_l1e_t sl1e, struct domain *d)
+{
+    if ( !shadow_mode_refcounts(d) )
+        return;
+
+    put_page_from_l1e(sl1e, d);
+}
 
 #if (SHADOW_OPTIMIZATIONS & SHOPT_FAST_FAULT_PATH)
 /******************************************************************************
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:54:31 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:54:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110778.211589 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjih-0005Mn-GG; Wed, 14 Apr 2021 17:54:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110778.211589; Wed, 14 Apr 2021 17:54:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjih-0005Mf-Cw; Wed, 14 Apr 2021 17:54:31 +0000
Received: by outflank-mailman (input) for mailman id 110778;
 Wed, 14 Apr 2021 17:54:29 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjif-0005MR-NX
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:54:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjif-0007F1-Mq
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:54:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjif-0006pG-M6
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:54:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=O1cPintdcOST6m0AC2BZHEDtqd0hTegzQpNqlV9hi8M=; b=hBqYoWleBKuu85msAR2V2i57Ge
	IoaNn2Xd9jKJc6SEb+IyosTHkthaDXQHHY/2vV2+7hZHCexmF6N5nZNLyHWlrox6qQwtlvL8QFbmF
	hlsbtXjZiR+9A3iIptLZQvTJ+fWHQ5Ie/p8OjTAOsz2zHMGBoyCCkzpxHX6XTO12b2fU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: don't open-code SHF_* shorthands
Message-Id: <E1lWjif-0006pG-M6@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:54:29 +0000

commit 099fcfb037477bcc2e8c4c5c8a3c5c54a95e7350
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:32:18 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:32:18 2021 +0200

    x86/shadow: don't open-code SHF_* shorthands
    
    Use SHF_L1_ANY, SHF_32, SHF_PAE, as well as SHF_64, and introduce
    SHF_FL1_ANY.
    
    Note that in shadow_audit_tables() this has the effect of no longer
    (I assume mistakenly, or else I don't see why the respective callback
    table entry isn't NULL) excluding SHF_L2H_64.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c  | 26 +++++---------------------
 xen/arch/x86/mm/shadow/private.h |  1 +
 2 files changed, 6 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index c64de3b789..bcc3d6c3ae 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -1834,14 +1834,7 @@ int sh_remove_write_access(struct domain *d, mfn_t gmfn,
         NULL  /* unused  */
     };
 
-    static const unsigned int callback_mask =
-          SHF_L1_32
-        | SHF_FL1_32
-        | SHF_L1_PAE
-        | SHF_FL1_PAE
-        | SHF_L1_64
-        | SHF_FL1_64
-        ;
+    static const unsigned int callback_mask = SHF_L1_ANY | SHF_FL1_ANY;
     struct page_info *pg = mfn_to_page(gmfn);
 #if SHADOW_OPTIMIZATIONS & SHOPT_WRITABLE_HEURISTIC
     struct vcpu *curr = current;
@@ -2065,14 +2058,7 @@ int sh_remove_all_mappings(struct domain *d, mfn_t gmfn, gfn_t gfn)
         NULL  /* unused  */
     };
 
-    static const unsigned int callback_mask =
-          SHF_L1_32
-        | SHF_FL1_32
-        | SHF_L1_PAE
-        | SHF_FL1_PAE
-        | SHF_L1_64
-        | SHF_FL1_64
-        ;
+    static const unsigned int callback_mask = SHF_L1_ANY | SHF_FL1_ANY;
 
     perfc_incr(shadow_mappings);
     if ( sh_check_page_has_no_refs(page) )
@@ -3424,11 +3410,9 @@ void shadow_audit_tables(struct vcpu *v)
         /* Audit only the current mode's tables */
         switch ( v->arch.paging.mode->guest_levels )
         {
-        case 2: mask = (SHF_L1_32|SHF_FL1_32|SHF_L2_32); break;
-        case 3: mask = (SHF_L1_PAE|SHF_FL1_PAE|SHF_L2_PAE
-                        |SHF_L2H_PAE); break;
-        case 4: mask = (SHF_L1_64|SHF_FL1_64|SHF_L2_64
-                        |SHF_L3_64|SHF_L4_64); break;
+        case 2: mask = SHF_32; break;
+        case 3: mask = SHF_PAE; break;
+        case 4: mask = SHF_64; break;
         default: BUG();
         }
     }
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 911db46e73..e2c352f878 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -269,6 +269,7 @@ static inline void sh_terminate_list(struct page_list_head *tmp_list)
 #define SHF_64  (SHF_L1_64|SHF_FL1_64|SHF_L2_64|SHF_L2H_64|SHF_L3_64|SHF_L4_64)
 
 #define SHF_L1_ANY  (SHF_L1_32|SHF_L1_PAE|SHF_L1_64)
+#define SHF_FL1_ANY (SHF_FL1_32|SHF_FL1_PAE|SHF_FL1_64)
 
 #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
 /* Marks a guest L1 page table which is shadowed but not write-protected.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:54:41 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:54:41 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110779.211593 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjir-0005OJ-Hx; Wed, 14 Apr 2021 17:54:41 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110779.211593; Wed, 14 Apr 2021 17:54:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjir-0005OB-Ee; Wed, 14 Apr 2021 17:54:41 +0000
Received: by outflank-mailman (input) for mailman id 110779;
 Wed, 14 Apr 2021 17:54:39 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjip-0005Nw-R4
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:54:39 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjip-0007FF-QM
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:54:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjip-0006qJ-Pe
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:54:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=txnYBt78sIPUaQl0SyzjfscaAAjj8+T1qqmP4lzlxLM=; b=YvDH95t9Or1Ym1kJgxrBwMPqtU
	Q7DYnmTiKIIagzmfPxYiWsuXfGJKuuohkwvXfiOkKEgkygkZWdLA4tfHaSsJSJkoM1jw3Mp11po1A
	JSPS6UHigWZOXripEgaS/Q4YbpU07fsNxDvALc1GsCWSUdus8eEmrAc1TyMLMu3upqNo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: SH_type_l2h_shadow is PV-only
Message-Id: <E1lWjip-0006qJ-Pe@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:54:39 +0000

commit 5eb6f827ddaaa2cf6d589fc3dc954f82ea0d4833
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:32:50 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:32:50 2021 +0200

    x86/shadow: SH_type_l2h_shadow is PV-only
    
    ..., i.e. being used only with 4 guest paging levels. Drop its L2/PAE
    alias and adjust / drop conditionals. Use >= 4 where touching them
    anyway, in preparation for 5-level paging.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/multi.c | 29 ++++++++++++-----------------
 xen/arch/x86/mm/shadow/types.h |  1 -
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 422ab54a94..54d1e1bc05 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -334,7 +334,7 @@ static void sh_audit_gw(struct vcpu *v, const walk_t *gw)
         if ( mfn_valid((smfn = get_shadow_status(d, gw->l2mfn,
                                                  SH_type_l2_shadow))) )
             (void) sh_audit_l2_table(v, smfn, INVALID_MFN);
-#if GUEST_PAGING_LEVELS == 3
+#if GUEST_PAGING_LEVELS >= 4 /* 32-bit PV only */
         if ( mfn_valid((smfn = get_shadow_status(d, gw->l2mfn,
                                                  SH_type_l2h_shadow))) )
             (void) sh_audit_l2_table(v, smfn, INVALID_MFN);
@@ -938,7 +938,8 @@ sh_make_shadow(struct vcpu *v, mfn_t gmfn, u32 shadow_type)
         /* Lower-level shadow, not yet linked form a higher level */
         mfn_to_page(smfn)->up = 0;
 
-#if GUEST_PAGING_LEVELS == 4
+#if GUEST_PAGING_LEVELS >= 4
+
 #if (SHADOW_OPTIMIZATIONS & SHOPT_LINUX_L3_TOPLEVEL)
     if ( shadow_type == SH_type_l4_64_shadow &&
          unlikely(d->arch.paging.shadow.opt_flags & SHOPT_LINUX_L3_TOPLEVEL) )
@@ -969,7 +970,6 @@ sh_make_shadow(struct vcpu *v, mfn_t gmfn, u32 shadow_type)
             sh_reset_l3_up_pointers(v);
         }
     }
-#endif
 #endif
 
     // Create the Xen mappings...
@@ -977,7 +977,6 @@ sh_make_shadow(struct vcpu *v, mfn_t gmfn, u32 shadow_type)
     {
         switch (shadow_type)
         {
-#if GUEST_PAGING_LEVELS == 4
         case SH_type_l4_shadow:
         {
             shadow_l4e_t *l4t = map_domain_page(smfn);
@@ -989,8 +988,7 @@ sh_make_shadow(struct vcpu *v, mfn_t gmfn, u32 shadow_type)
             unmap_domain_page(l4t);
         }
         break;
-#endif
-#if GUEST_PAGING_LEVELS >= 3
+
         case SH_type_l2h_shadow:
             BUILD_BUG_ON(sizeof(l2_pgentry_t) != sizeof(shadow_l2e_t));
             if ( is_pv_32bit_domain(d) )
@@ -1001,11 +999,12 @@ sh_make_shadow(struct vcpu *v, mfn_t gmfn, u32 shadow_type)
                 unmap_domain_page(l2t);
             }
             break;
-#endif
         default: /* Do nothing */ break;
         }
     }
 
+#endif /* GUEST_PAGING_LEVELS >= 4 */
+
     shadow_promote(d, gmfn, shadow_type);
     set_shadow_status(d, gmfn, shadow_type, smfn);
 
@@ -1335,7 +1334,7 @@ void sh_destroy_l2_shadow(struct domain *d, mfn_t smfn)
 
     SHADOW_DEBUG(DESTROY_SHADOW, "%"PRI_mfn"\n", mfn_x(smfn));
 
-#if GUEST_PAGING_LEVELS >= 3
+#if GUEST_PAGING_LEVELS >= 4
     ASSERT(t == SH_type_l2_shadow || t == SH_type_l2h_shadow);
 #else
     ASSERT(t == SH_type_l2_shadow);
@@ -1859,7 +1858,7 @@ int
 sh_map_and_validate_gl2he(struct vcpu *v, mfn_t gl2mfn,
                            void *new_gl2p, u32 size)
 {
-#if GUEST_PAGING_LEVELS >= 3
+#if GUEST_PAGING_LEVELS >= 4
     return sh_map_and_validate(v, gl2mfn, new_gl2p, size,
                                 SH_type_l2h_shadow,
                                 shadow_l2_index,
@@ -3360,9 +3359,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
                 gl2gfn = guest_l3e_get_gfn(gl3e[i]);
                 gl2mfn = get_gfn_query_unlocked(d, gfn_x(gl2gfn), &p2mt);
                 if ( p2m_is_ram(p2mt) )
-                    sh_set_toplevel_shadow(v, i, gl2mfn, (i == 3)
-                                           ? SH_type_l2h_shadow
-                                           : SH_type_l2_shadow,
+                    sh_set_toplevel_shadow(v, i, gl2mfn, SH_type_l2_shadow,
                                            sh_make_shadow);
                 else
                     sh_set_toplevel_shadow(v, i, INVALID_MFN, 0,
@@ -3664,7 +3661,7 @@ void sh_clear_shadow_entry(struct domain *d, void *ep, mfn_t smfn)
         (void) shadow_set_l1e(d, ep, shadow_l1e_empty(), p2m_invalid, smfn);
         break;
     case SH_type_l2_shadow:
-#if GUEST_PAGING_LEVELS >= 3
+#if GUEST_PAGING_LEVELS >= 4
     case SH_type_l2h_shadow:
 #endif
         (void) shadow_set_l2e(d, ep, shadow_l2e_empty(), smfn);
@@ -4116,10 +4113,8 @@ int sh_audit_l3_table(struct vcpu *v, mfn_t sl3mfn, mfn_t x)
             mfn = shadow_l3e_get_mfn(*sl3e);
             gmfn = get_shadow_status(d, get_gfn_query_unlocked(
                                         d, gfn_x(gfn), &p2mt),
-                                     ((GUEST_PAGING_LEVELS == 3 ||
-                                       is_pv_32bit_domain(d))
-                                      && !shadow_mode_external(d)
-                                      && (guest_index(gl3e) % 4) == 3)
+                                     (is_pv_32bit_domain(d) &&
+                                      guest_index(gl3e) == 3)
                                      ? SH_type_l2h_shadow
                                      : SH_type_l2_shadow);
             if ( !mfn_eq(gmfn, mfn) )
diff --git a/xen/arch/x86/mm/shadow/types.h b/xen/arch/x86/mm/shadow/types.h
index a671fc9a49..814a401853 100644
--- a/xen/arch/x86/mm/shadow/types.h
+++ b/xen/arch/x86/mm/shadow/types.h
@@ -195,7 +195,6 @@ static inline shadow_l4e_t shadow_l4e_from_mfn(mfn_t mfn, u32 flags)
 #define SH_type_l1_shadow  SH_type_l1_pae_shadow
 #define SH_type_fl1_shadow SH_type_fl1_pae_shadow
 #define SH_type_l2_shadow  SH_type_l2_pae_shadow
-#define SH_type_l2h_shadow SH_type_l2h_pae_shadow
 #elif GUEST_PAGING_LEVELS == 4
 #define SH_type_l1_shadow  SH_type_l1_64_shadow
 #define SH_type_fl1_shadow SH_type_fl1_64_shadow
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:54:51 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:54:51 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110780.211598 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjj1-0005Ub-Jb; Wed, 14 Apr 2021 17:54:51 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110780.211598; Wed, 14 Apr 2021 17:54:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjj1-0005UU-GI; Wed, 14 Apr 2021 17:54:51 +0000
Received: by outflank-mailman (input) for mailman id 110780;
 Wed, 14 Apr 2021 17:54:50 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjiz-0005UK-Uq
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:54:49 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjiz-0007FT-U1
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:54:49 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjiz-0006rf-TH
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:54:49 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OgvPmNJRm9DYB00ksew+jfrkX5tro274ROQdfTWJbA8=; b=WFFlgdxKwBacx0PtwiEq9q4EWQ
	1xLfoKN5X7LqyLR0MLFFkD4VN+J5M2ngQmpcrXr6PusMs4Er3SepBTJBXbXYIlBe97B4gToOM4gvK
	+wD7SHFCxKmHdTGKiYWbgfCO4NzbpaZz5jgssjCTy92jA+Y5/NpeHGY1d0xO3Jm53vTs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: drop SH_type_l2h_pae_shadow
Message-Id: <E1lWjiz-0006rf-TH@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:54:49 +0000

commit 42bbda6bcc35b3b402a64b8571a4fe7bd43dde22
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:33:17 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:33:17 2021 +0200

    x86/shadow: drop SH_type_l2h_pae_shadow
    
    This is a remnant from 32-bit days, having no place anymore where a
    shadow of this type would be created.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c  | 16 +---------------
 xen/arch/x86/mm/shadow/hvm.c     |  2 +-
 xen/arch/x86/mm/shadow/multi.c   |  3 +--
 xen/arch/x86/mm/shadow/private.h | 27 ++++++++++++---------------
 4 files changed, 15 insertions(+), 33 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index bcc3d6c3ae..2b75ea6856 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -792,9 +792,6 @@ sh_validate_guest_entry(struct vcpu *v, mfn_t gmfn, void *entry, u32 size)
     if ( page->shadow_flags & SHF_L2_PAE )
         result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2e, 3)
             (v, gmfn, entry, size);
-    if ( page->shadow_flags & SHF_L2H_PAE )
-        result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2he, 3)
-            (v, gmfn, entry, size);
 
     if ( page->shadow_flags & SHF_L1_64 )
         result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl1e, 4)
@@ -859,7 +856,6 @@ const u8 sh_type_to_size[] = {
     1, /* SH_type_l1_pae_shadow  */
     1, /* SH_type_fl1_pae_shadow */
     1, /* SH_type_l2_pae_shadow  */
-    1, /* SH_type_l2h_pae_shadow */
     1, /* SH_type_l1_64_shadow   */
     1, /* SH_type_fl1_64_shadow  */
     1, /* SH_type_l2_64_shadow   */
@@ -900,7 +896,6 @@ void shadow_unhook_mappings(struct domain *d, mfn_t smfn, int user_only)
         SHADOW_INTERNAL_NAME(sh_unhook_32b_mappings, 2)(d, smfn, user_only);
         break;
     case SH_type_l2_pae_shadow:
-    case SH_type_l2h_pae_shadow:
         SHADOW_INTERNAL_NAME(sh_unhook_pae_mappings, 3)(d, smfn, user_only);
         break;
     case SH_type_l4_64_shadow:
@@ -1764,7 +1759,6 @@ void sh_destroy_shadow(struct domain *d, mfn_t smfn)
         SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 3)(d, smfn);
         break;
     case SH_type_l2_pae_shadow:
-    case SH_type_l2h_pae_shadow:
         SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 3)(d, smfn);
         break;
 
@@ -1823,7 +1817,6 @@ int sh_remove_write_access(struct domain *d, mfn_t gmfn,
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 3), /* l1_pae  */
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 3), /* fl1_pae */
         NULL, /* l2_pae  */
-        NULL, /* l2h_pae */
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 4), /* l1_64   */
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 4), /* fl1_64  */
         NULL, /* l2_64   */
@@ -2047,7 +2040,6 @@ int sh_remove_all_mappings(struct domain *d, mfn_t gmfn, gfn_t gfn)
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3), /* l1_pae  */
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3), /* fl1_pae */
         NULL, /* l2_pae  */
-        NULL, /* l2h_pae */
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 4), /* l1_64   */
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 4), /* fl1_64  */
         NULL, /* l2_64   */
@@ -2145,7 +2137,6 @@ static int sh_remove_shadow_via_pointer(struct domain *d, mfn_t smfn)
         break;
     case SH_type_l1_pae_shadow:
     case SH_type_l2_pae_shadow:
-    case SH_type_l2h_pae_shadow:
         SHADOW_INTERNAL_NAME(sh_clear_shadow_entry, 3)(d, vaddr, pmfn);
         break;
     case SH_type_l1_64_shadow:
@@ -2190,7 +2181,6 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
         NULL, /* l1_pae  */
         NULL, /* fl1_pae */
         SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 3), /* l2_pae  */
-        SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 3), /* l2h_pae */
         NULL, /* l1_64   */
         NULL, /* fl1_64  */
         SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 4), /* l2_64   */
@@ -2207,10 +2197,9 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
         SHF_L2_32, /* l1_32   */
         0, /* fl1_32  */
         0, /* l2_32   */
-        SHF_L2H_PAE | SHF_L2_PAE, /* l1_pae  */
+        SHF_L2_PAE, /* l1_pae  */
         0, /* fl1_pae */
         0, /* l2_pae  */
-        0, /* l2h_pae  */
         SHF_L2H_64 | SHF_L2_64, /* l1_64   */
         0, /* fl1_64  */
         SHF_L3_64, /* l2_64   */
@@ -2273,7 +2262,6 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
 
     DO_UNSHADOW(SH_type_l2_32_shadow);
     DO_UNSHADOW(SH_type_l1_32_shadow);
-    DO_UNSHADOW(SH_type_l2h_pae_shadow);
     DO_UNSHADOW(SH_type_l2_pae_shadow);
     DO_UNSHADOW(SH_type_l1_pae_shadow);
     DO_UNSHADOW(SH_type_l4_64_shadow);
@@ -2356,7 +2344,6 @@ void sh_reset_l3_up_pointers(struct vcpu *v)
         NULL, /* l1_pae  */
         NULL, /* fl1_pae */
         NULL, /* l2_pae  */
-        NULL, /* l2h_pae */
         NULL, /* l1_64   */
         NULL, /* fl1_64  */
         NULL, /* l2_64   */
@@ -3381,7 +3368,6 @@ void shadow_audit_tables(struct vcpu *v)
         SHADOW_INTERNAL_NAME(sh_audit_l1_table, 3),  /* l1_pae  */
         SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 3), /* fl1_pae */
         SHADOW_INTERNAL_NAME(sh_audit_l2_table, 3),  /* l2_pae  */
-        SHADOW_INTERNAL_NAME(sh_audit_l2_table, 3),  /* l2h_pae */
         SHADOW_INTERNAL_NAME(sh_audit_l1_table, 4),  /* l1_64   */
         SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 4), /* fl1_64  */
         SHADOW_INTERNAL_NAME(sh_audit_l2_table, 4),  /* l2_64   */
diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index 87fc57704f..7f98286385 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -568,7 +568,7 @@ static inline void check_for_early_unshadow(struct vcpu *v, mfn_t gmfn)
          && sh_mfn_is_a_page_table(gmfn)
          && (!d->arch.paging.shadow.pagetable_dying_op ||
              !(mfn_to_page(gmfn)->shadow_flags
-               & (SHF_L2_32|SHF_L2_PAE|SHF_L2H_PAE|SHF_L4_64))) )
+               & (SHF_L2_32|SHF_L2_PAE|SHF_L4_64))) )
     {
         perfc_incr(shadow_early_unshadow);
         sh_remove_shadows(d, gmfn, 1, 0 /* Fast, can fail to unshadow */ );
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 54d1e1bc05..5e33f6d3db 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -838,8 +838,7 @@ do {                                                                       \
     int _i;                                                                \
     shadow_l2e_t *_sp = map_domain_page((_sl2mfn));                        \
     ASSERT(shadow_mode_external(_dom));                                    \
-    ASSERT(mfn_to_page(_sl2mfn)->u.sh.type == SH_type_l2_pae_shadow        \
-           || mfn_to_page(_sl2mfn)->u.sh.type == SH_type_l2h_pae_shadow);  \
+    ASSERT(mfn_to_page(_sl2mfn)->u.sh.type == SH_type_l2_pae_shadow);      \
     for ( _i = 0; _i < SHADOW_L2_PAGETABLE_ENTRIES; _i++ )                 \
     {                                                                      \
         (_sl2e) = _sp + _i;                                                \
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index e2c352f878..5b899399b6 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -177,18 +177,17 @@ extern void shadow_audit_tables(struct vcpu *v);
 #define SH_type_l1_pae_shadow  (4U) /* shadowing a pae L1 page */
 #define SH_type_fl1_pae_shadow (5U) /* L1 shadow for pae 2M superpg */
 #define SH_type_l2_pae_shadow  (6U) /* shadowing a pae L2-low page */
-#define SH_type_l2h_pae_shadow (7U) /* shadowing a pae L2-high page */
-#define SH_type_l1_64_shadow   (8U) /* shadowing a 64-bit L1 page */
-#define SH_type_fl1_64_shadow  (9U) /* L1 shadow for 64-bit 2M superpg */
-#define SH_type_l2_64_shadow  (10U) /* shadowing a 64-bit L2 page */
-#define SH_type_l2h_64_shadow (11U) /* shadowing a compat PAE L2 high page */
-#define SH_type_l3_64_shadow  (12U) /* shadowing a 64-bit L3 page */
-#define SH_type_l4_64_shadow  (13U) /* shadowing a 64-bit L4 page */
-#define SH_type_max_shadow    (13U)
-#define SH_type_p2m_table     (14U) /* in use as the p2m table */
-#define SH_type_monitor_table (15U) /* in use as a monitor table */
-#define SH_type_oos_snapshot  (16U) /* in use as OOS snapshot */
-#define SH_type_unused        (17U)
+#define SH_type_l1_64_shadow   (7U) /* shadowing a 64-bit L1 page */
+#define SH_type_fl1_64_shadow  (8U) /* L1 shadow for 64-bit 2M superpg */
+#define SH_type_l2_64_shadow   (9U) /* shadowing a 64-bit L2 page */
+#define SH_type_l2h_64_shadow (10U) /* shadowing a compat PAE L2 high page */
+#define SH_type_l3_64_shadow  (11U) /* shadowing a 64-bit L3 page */
+#define SH_type_l4_64_shadow  (12U) /* shadowing a 64-bit L4 page */
+#define SH_type_max_shadow    (12U)
+#define SH_type_p2m_table     (13U) /* in use as the p2m table */
+#define SH_type_monitor_table (14U) /* in use as a monitor table */
+#define SH_type_oos_snapshot  (15U) /* in use as OOS snapshot */
+#define SH_type_unused        (16U)
 
 /*
  * What counts as a pinnable shadow?
@@ -200,7 +199,6 @@ static inline int sh_type_is_pinnable(struct domain *d, unsigned int t)
      * persist even when not currently in use in a guest CR3 */
     if ( t == SH_type_l2_32_shadow
          || t == SH_type_l2_pae_shadow
-         || t == SH_type_l2h_pae_shadow
          || t == SH_type_l4_64_shadow )
         return 1;
 
@@ -256,7 +254,6 @@ static inline void sh_terminate_list(struct page_list_head *tmp_list)
 #define SHF_L1_PAE  (1u << SH_type_l1_pae_shadow)
 #define SHF_FL1_PAE (1u << SH_type_fl1_pae_shadow)
 #define SHF_L2_PAE  (1u << SH_type_l2_pae_shadow)
-#define SHF_L2H_PAE (1u << SH_type_l2h_pae_shadow)
 #define SHF_L1_64   (1u << SH_type_l1_64_shadow)
 #define SHF_FL1_64  (1u << SH_type_fl1_64_shadow)
 #define SHF_L2_64   (1u << SH_type_l2_64_shadow)
@@ -265,7 +262,7 @@ static inline void sh_terminate_list(struct page_list_head *tmp_list)
 #define SHF_L4_64   (1u << SH_type_l4_64_shadow)
 
 #define SHF_32  (SHF_L1_32|SHF_FL1_32|SHF_L2_32)
-#define SHF_PAE (SHF_L1_PAE|SHF_FL1_PAE|SHF_L2_PAE|SHF_L2H_PAE)
+#define SHF_PAE (SHF_L1_PAE|SHF_FL1_PAE|SHF_L2_PAE)
 #define SHF_64  (SHF_L1_64|SHF_FL1_64|SHF_L2_64|SHF_L2H_64|SHF_L3_64|SHF_L4_64)
 
 #define SHF_L1_ANY  (SHF_L1_32|SHF_L1_PAE|SHF_L1_64)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:55:02 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:55:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110781.211603 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjjB-0005Vu-MB; Wed, 14 Apr 2021 17:55:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110781.211603; Wed, 14 Apr 2021 17:55:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjjB-0005Vl-I6; Wed, 14 Apr 2021 17:55:01 +0000
Received: by outflank-mailman (input) for mailman id 110781;
 Wed, 14 Apr 2021 17:55:00 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjjA-0005Vc-4a
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:55:00 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjjA-0007Fd-1V
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:55:00 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjjA-0006sh-0N
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:55:00 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=55/W1dlAjvxo/UDOXECh+zZeWQGBh1RWU69lb4vhKJs=; b=L9RAM2BvCnsHw0TMRsBb4nUsHP
	i++4YW/PuAakGISZKCgkuRlyo3tG6wkIdMbOh9Tv2RTOK9dck0aNRBJ0Cu+L/QKg5rTikWRMZRtrT
	bW9COF/PjLb7/S2ZK6+hrJR2WhYfpXtX0l9o41TYdx3z7WGtQLtLKpxaTom373AIOdHw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: only 4-level guest code needs building when !HVM
Message-Id: <E1lWjjA-0006sh-0N@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:55:00 +0000

commit aff8bf94ce652bab55d4e0ec8832445bcc1c071f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:34:04 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:34:04 2021 +0200

    x86/shadow: only 4-level guest code needs building when !HVM
    
    In order to limit #ifdef-ary, provide "stub" #define-s for
    SH_type_{l1,fl1,l2}_{32,pae}_shadow and SHF_{L1,FL1,L2}_{32,PAE}.
    
    The change in shadow_vcpu_init() is necessary to cover for "x86: correct
    is_pv_domain() when !CONFIG_PV" (or any other change along those lines)
    - we should only rely on is_hvm_*() to become a build time constant.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/Makefile         |  2 +-
 xen/arch/x86/mm/shadow/Makefile  |  6 +++---
 xen/arch/x86/mm/shadow/common.c  | 30 +++++++++++++++++++++++++++---
 xen/arch/x86/mm/shadow/private.h | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 67 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index a2431fde6b..24f4ec40e0 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -3,7 +3,7 @@ obj-$(CONFIG_HVM) += hap/
 
 obj-$(CONFIG_HVM) += altp2m.o
 obj-$(CONFIG_HVM) += guest_walk_2.o guest_walk_3.o guest_walk_4.o
-obj-$(CONFIG_SHADOW_PAGING) += guest_walk_2.o guest_walk_3.o guest_walk_4.o
+obj-$(CONFIG_SHADOW_PAGING) += guest_walk_4.o
 obj-$(CONFIG_MEM_ACCESS) += mem_access.o
 obj-y += mem_paging.o
 obj-$(CONFIG_MEM_SHARING) += mem_sharing.o
diff --git a/xen/arch/x86/mm/shadow/Makefile b/xen/arch/x86/mm/shadow/Makefile
index 05ffc164eb..770213fe9d 100644
--- a/xen/arch/x86/mm/shadow/Makefile
+++ b/xen/arch/x86/mm/shadow/Makefile
@@ -1,7 +1,7 @@
 ifeq ($(CONFIG_SHADOW_PAGING),y)
-obj-y += common.o guest_2.o guest_3.o guest_4.o set.o
-obj-$(CONFIG_HVM) += hvm.o
-obj-$(CONFIG_PV) += pv.o
+obj-y += common.o set.o
+obj-$(CONFIG_HVM) += hvm.o guest_2.o guest_3.o guest_4.o
+obj-$(CONFIG_PV) += pv.o guest_4.o
 else
 obj-y += none.o
 endif
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 2b75ea6856..c0c4ce46e4 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -90,9 +90,9 @@ void shadow_vcpu_init(struct vcpu *v)
     }
 #endif
 
-    v->arch.paging.mode = is_pv_vcpu(v) ?
-                          &SHADOW_INTERNAL_NAME(sh_paging_mode, 4) :
-                          &SHADOW_INTERNAL_NAME(sh_paging_mode, 3);
+    v->arch.paging.mode = is_hvm_vcpu(v) ?
+                          &SHADOW_INTERNAL_NAME(sh_paging_mode, 3) :
+                          &SHADOW_INTERNAL_NAME(sh_paging_mode, 4);
 }
 
 #if SHADOW_AUDIT
@@ -257,6 +257,7 @@ static int sh_remove_write_access_from_sl1p(struct domain *d, mfn_t gmfn,
 
     switch ( mfn_to_page(smfn)->u.sh.type )
     {
+#ifdef CONFIG_HVM
     case SH_type_l1_32_shadow:
     case SH_type_fl1_32_shadow:
         return SHADOW_INTERNAL_NAME(sh_rm_write_access_from_sl1p, 2)
@@ -266,6 +267,7 @@ static int sh_remove_write_access_from_sl1p(struct domain *d, mfn_t gmfn,
     case SH_type_fl1_pae_shadow:
         return SHADOW_INTERNAL_NAME(sh_rm_write_access_from_sl1p, 3)
             (d, gmfn, smfn, off);
+#endif
 
     case SH_type_l1_64_shadow:
     case SH_type_fl1_64_shadow:
@@ -848,6 +850,7 @@ sh_validate_guest_entry(struct vcpu *v, mfn_t gmfn, void *entry, u32 size)
  * the free pool.
  */
 
+#ifdef CONFIG_HVM
 const u8 sh_type_to_size[] = {
     1, /* SH_type_none           */
     2, /* SH_type_l1_32_shadow   */
@@ -866,6 +869,7 @@ const u8 sh_type_to_size[] = {
     1, /* SH_type_monitor_table  */
     1  /* SH_type_oos_snapshot   */
 };
+#endif
 
 /*
  * Figure out the least acceptable quantity of shadow memory.
@@ -892,12 +896,14 @@ void shadow_unhook_mappings(struct domain *d, mfn_t smfn, int user_only)
     struct page_info *sp = mfn_to_page(smfn);
     switch ( sp->u.sh.type )
     {
+#ifdef CONFIG_HVM
     case SH_type_l2_32_shadow:
         SHADOW_INTERNAL_NAME(sh_unhook_32b_mappings, 2)(d, smfn, user_only);
         break;
     case SH_type_l2_pae_shadow:
         SHADOW_INTERNAL_NAME(sh_unhook_pae_mappings, 3)(d, smfn, user_only);
         break;
+#endif
     case SH_type_l4_64_shadow:
         SHADOW_INTERNAL_NAME(sh_unhook_64b_mappings, 4)(d, smfn, user_only);
         break;
@@ -1104,8 +1110,10 @@ mfn_t shadow_alloc(struct domain *d,
     /* Backpointers that are MFNs need to be packed into PDXs (PFNs don't) */
     switch (shadow_type)
     {
+#ifdef CONFIG_HVM
     case SH_type_fl1_32_shadow:
     case SH_type_fl1_pae_shadow:
+#endif
     case SH_type_fl1_64_shadow:
         break;
     default:
@@ -1746,6 +1754,7 @@ void sh_destroy_shadow(struct domain *d, mfn_t smfn)
      * small numbers that the compiler will enjoy */
     switch ( t )
     {
+#ifdef CONFIG_HVM
     case SH_type_l1_32_shadow:
     case SH_type_fl1_32_shadow:
         SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 2)(d, smfn);
@@ -1761,6 +1770,7 @@ void sh_destroy_shadow(struct domain *d, mfn_t smfn)
     case SH_type_l2_pae_shadow:
         SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 3)(d, smfn);
         break;
+#endif
 
     case SH_type_l1_64_shadow:
     case SH_type_fl1_64_shadow:
@@ -1811,12 +1821,14 @@ int sh_remove_write_access(struct domain *d, mfn_t gmfn,
     /* Dispatch table for getting per-type functions */
     static const hash_domain_callback_t callbacks[SH_type_unused] = {
         NULL, /* none    */
+#ifdef CONFIG_HVM
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 2), /* l1_32   */
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 2), /* fl1_32  */
         NULL, /* l2_32   */
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 3), /* l1_pae  */
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 3), /* fl1_pae */
         NULL, /* l2_pae  */
+#endif
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 4), /* l1_64   */
         SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 4), /* fl1_64  */
         NULL, /* l2_64   */
@@ -2034,12 +2046,14 @@ int sh_remove_all_mappings(struct domain *d, mfn_t gmfn, gfn_t gfn)
     /* Dispatch table for getting per-type functions */
     static const hash_domain_callback_t callbacks[SH_type_unused] = {
         NULL, /* none    */
+#ifdef CONFIG_HVM
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 2), /* l1_32   */
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 2), /* fl1_32  */
         NULL, /* l2_32   */
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3), /* l1_pae  */
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3), /* fl1_pae */
         NULL, /* l2_pae  */
+#endif
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 4), /* l1_64   */
         SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 4), /* fl1_64  */
         NULL, /* l2_64   */
@@ -2131,6 +2145,7 @@ static int sh_remove_shadow_via_pointer(struct domain *d, mfn_t smfn)
     /* Blank the offending entry */
     switch (sp->u.sh.type)
     {
+#ifdef CONFIG_HVM
     case SH_type_l1_32_shadow:
     case SH_type_l2_32_shadow:
         SHADOW_INTERNAL_NAME(sh_clear_shadow_entry, 2)(d, vaddr, pmfn);
@@ -2139,6 +2154,7 @@ static int sh_remove_shadow_via_pointer(struct domain *d, mfn_t smfn)
     case SH_type_l2_pae_shadow:
         SHADOW_INTERNAL_NAME(sh_clear_shadow_entry, 3)(d, vaddr, pmfn);
         break;
+#endif
     case SH_type_l1_64_shadow:
     case SH_type_l2_64_shadow:
     case SH_type_l2h_64_shadow:
@@ -2175,12 +2191,14 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
      * be called with the function to remove a lower-level shadow. */
     static const hash_domain_callback_t callbacks[SH_type_unused] = {
         NULL, /* none    */
+#ifdef CONFIG_HVM
         NULL, /* l1_32   */
         NULL, /* fl1_32  */
         SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 2), /* l2_32   */
         NULL, /* l1_pae  */
         NULL, /* fl1_pae */
         SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 3), /* l2_pae  */
+#endif
         NULL, /* l1_64   */
         NULL, /* fl1_64  */
         SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 4), /* l2_64   */
@@ -2194,12 +2212,14 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
     /* Another lookup table, for choosing which mask to use */
     static const unsigned int masks[SH_type_unused] = {
         0, /* none    */
+#ifdef CONFIG_HVM
         SHF_L2_32, /* l1_32   */
         0, /* fl1_32  */
         0, /* l2_32   */
         SHF_L2_PAE, /* l1_pae  */
         0, /* fl1_pae */
         0, /* l2_pae  */
+#endif
         SHF_L2H_64 | SHF_L2_64, /* l1_64   */
         0, /* fl1_64  */
         SHF_L3_64, /* l2_64   */
@@ -2338,12 +2358,14 @@ void sh_reset_l3_up_pointers(struct vcpu *v)
 {
     static const hash_vcpu_callback_t callbacks[SH_type_unused] = {
         NULL, /* none    */
+#ifdef CONFIG_HVM
         NULL, /* l1_32   */
         NULL, /* fl1_32  */
         NULL, /* l2_32   */
         NULL, /* l1_pae  */
         NULL, /* fl1_pae */
         NULL, /* l2_pae  */
+#endif
         NULL, /* l1_64   */
         NULL, /* fl1_64  */
         NULL, /* l2_64   */
@@ -3362,12 +3384,14 @@ void shadow_audit_tables(struct vcpu *v)
     static const hash_vcpu_callback_t callbacks[SH_type_unused] = {
         NULL, /* none    */
 #if SHADOW_AUDIT & (SHADOW_AUDIT_ENTRIES | SHADOW_AUDIT_ENTRIES_FULL)
+# ifdef CONFIG_HVM
         SHADOW_INTERNAL_NAME(sh_audit_l1_table, 2),  /* l1_32   */
         SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 2), /* fl1_32  */
         SHADOW_INTERNAL_NAME(sh_audit_l2_table, 2),  /* l2_32   */
         SHADOW_INTERNAL_NAME(sh_audit_l1_table, 3),  /* l1_pae  */
         SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 3), /* fl1_pae */
         SHADOW_INTERNAL_NAME(sh_audit_l2_table, 3),  /* l2_pae  */
+# endif
         SHADOW_INTERNAL_NAME(sh_audit_l1_table, 4),  /* l1_64   */
         SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 4), /* fl1_64  */
         SHADOW_INTERNAL_NAME(sh_audit_l2_table, 4),  /* l2_64   */
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 5b899399b6..35efb1b984 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -171,6 +171,7 @@ extern void shadow_audit_tables(struct vcpu *v);
 /* Shadow type codes */
 #define SH_type_none           (0U) /* on the shadow free list */
 #define SH_type_min_shadow     (1U)
+#ifdef CONFIG_HVM
 #define SH_type_l1_32_shadow   (1U) /* shadowing a 32-bit L1 guest page */
 #define SH_type_fl1_32_shadow  (2U) /* L1 shadow for a 32b 4M superpage */
 #define SH_type_l2_32_shadow   (3U) /* shadowing a 32-bit L2 guest page */
@@ -188,6 +189,25 @@ extern void shadow_audit_tables(struct vcpu *v);
 #define SH_type_monitor_table (14U) /* in use as a monitor table */
 #define SH_type_oos_snapshot  (15U) /* in use as OOS snapshot */
 #define SH_type_unused        (16U)
+#else
+#define SH_type_l1_32_shadow   SH_type_unused
+#define SH_type_fl1_32_shadow  SH_type_unused
+#define SH_type_l2_32_shadow   SH_type_unused
+#define SH_type_l1_pae_shadow  SH_type_unused
+#define SH_type_fl1_pae_shadow SH_type_unused
+#define SH_type_l2_pae_shadow  SH_type_unused
+#define SH_type_l1_64_shadow   1U /* shadowing a 64-bit L1 page */
+#define SH_type_fl1_64_shadow  2U /* L1 shadow for 64-bit 2M superpg */
+#define SH_type_l2_64_shadow   3U /* shadowing a 64-bit L2 page */
+#define SH_type_l2h_64_shadow  4U /* shadowing a compat PAE L2 high page */
+#define SH_type_l3_64_shadow   5U /* shadowing a 64-bit L3 page */
+#define SH_type_l4_64_shadow   6U /* shadowing a 64-bit L4 page */
+#define SH_type_max_shadow     6U
+#define SH_type_p2m_table      7U /* in use as the p2m table */
+#define SH_type_monitor_table  8U /* in use as a monitor table */
+#define SH_type_oos_snapshot   9U /* in use as OOS snapshot */
+#define SH_type_unused        10U
+#endif
 
 /*
  * What counts as a pinnable shadow?
@@ -248,12 +268,21 @@ static inline void sh_terminate_list(struct page_list_head *tmp_list)
     (((1u << (SH_type_max_shadow + 1u)) - 1u) - \
      ((1u << SH_type_min_shadow) - 1u))
 
+#ifdef CONFIG_HVM
 #define SHF_L1_32   (1u << SH_type_l1_32_shadow)
 #define SHF_FL1_32  (1u << SH_type_fl1_32_shadow)
 #define SHF_L2_32   (1u << SH_type_l2_32_shadow)
 #define SHF_L1_PAE  (1u << SH_type_l1_pae_shadow)
 #define SHF_FL1_PAE (1u << SH_type_fl1_pae_shadow)
 #define SHF_L2_PAE  (1u << SH_type_l2_pae_shadow)
+#else
+#define SHF_L1_32   0
+#define SHF_FL1_32  0
+#define SHF_L2_32   0
+#define SHF_L1_PAE  0
+#define SHF_FL1_PAE 0
+#define SHF_L2_PAE  0
+#endif
 #define SHF_L1_64   (1u << SH_type_l1_64_shadow)
 #define SHF_FL1_64  (1u << SH_type_fl1_64_shadow)
 #define SHF_L2_64   (1u << SH_type_l2_64_shadow)
@@ -329,8 +358,13 @@ extern const u8 sh_type_to_size[SH_type_unused];
 static inline unsigned int
 shadow_size(unsigned int shadow_type)
 {
+#ifdef CONFIG_HVM
     ASSERT(shadow_type < ARRAY_SIZE(sh_type_to_size));
     return sh_type_to_size[shadow_type];
+#else
+    ASSERT(shadow_type < SH_type_unused);
+    return 1;
+#endif
 }
 
 /******************************************************************************
@@ -488,8 +522,10 @@ static inline unsigned long __backpointer(const struct page_info *sp)
 {
     switch (sp->u.sh.type)
     {
+#ifdef CONFIG_HVM
     case SH_type_fl1_32_shadow:
     case SH_type_fl1_pae_shadow:
+#endif
     case SH_type_fl1_64_shadow:
         return sp->v.sh.back;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:55:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110782.211606 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjjL-0005XL-P3; Wed, 14 Apr 2021 17:55:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110782.211606; Wed, 14 Apr 2021 17:55:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjjL-0005XD-Lg; Wed, 14 Apr 2021 17:55:11 +0000
Received: by outflank-mailman (input) for mailman id 110782;
 Wed, 14 Apr 2021 17:55:10 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjjK-0005X4-61
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:55:10 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjjK-0007G1-5E
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:55:10 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjjK-0006tq-4T
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:55:10 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0IGqrRcIByi1PnD0+6inGsGo4ARkF1TC0KL0siL9A4Y=; b=C12KUZ7PGrPAJsD6LEYyaM//ez
	b192jc3sHIfl54LDau5cUyCqsQhEkmnF+SO/C9mq0Dosv1GgV6ORR+sj/LJ6+PWFFg7/+dUZuAnVG
	riuo22Z2Wkm4/NCnpj6zphoLhXFYmrMz44mlL4t1zY0s81O4jcKVW2tcLYQZHKpo44/E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: adjust is_pv_*() checks
Message-Id: <E1lWjjK-0006tq-4T@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:55:10 +0000

commit be167ac0f0268074880b961c936519f756ac045b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 12 12:37:19 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 12 12:37:19 2021 +0200

    x86/shadow: adjust is_pv_*() checks
    
    To cover for "x86: correct is_pv_domain() when !CONFIG_PV" (or any other
    change along those lines) we should prefer is_hvm_*(), as it may become
    a build time constant while is_pv_*() generally won't.
    
    Also when a domain pointer is in scope, prefer is_*_domain() over
    is_*_vcpu().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c |  4 ++--
 xen/arch/x86/mm/shadow/multi.c  | 10 +++++-----
 xen/arch/x86/mm/shadow/none.c   |  2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index c0c4ce46e4..b99ca14e71 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -674,7 +674,7 @@ int sh_unsync(struct vcpu *v, mfn_t gmfn)
     if ( pg->shadow_flags &
          ((SHF_page_type_mask & ~SHF_L1_ANY) | SHF_out_of_sync)
          || sh_page_has_multiple_shadows(pg)
-         || is_pv_vcpu(v)
+         || !is_hvm_vcpu(v)
          || !v->domain->arch.paging.shadow.oos_active )
         return 0;
 
@@ -2432,7 +2432,7 @@ static void sh_update_paging_modes(struct vcpu *v)
         v->arch.paging.mode->shadow.detach_old_tables(v);
 
 #ifdef CONFIG_HVM
-    if ( !is_pv_domain(d) )
+    if ( is_hvm_domain(d) )
     {
         const struct paging_mode *old_mode = v->arch.paging.mode;
 
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 5e33f6d3db..ae65da439f 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -667,8 +667,8 @@ _sh_propagate(struct vcpu *v,
     // PV guests in 64-bit mode use two different page tables for user vs
     // supervisor permissions, making the guest's _PAGE_USER bit irrelevant.
     // It is always shadowed as present...
-    if ( (GUEST_PAGING_LEVELS == 4) && !is_pv_32bit_domain(d)
-         && is_pv_domain(d) )
+    if ( (GUEST_PAGING_LEVELS == 4) && !is_hvm_domain(d) &&
+         !is_pv_32bit_domain(d) )
     {
         sflags |= _PAGE_USER;
     }
@@ -1120,7 +1120,7 @@ static shadow_l2e_t * shadow_get_and_create_l2e(struct vcpu *v,
         unsigned int t = SH_type_l2_shadow;
 
         /* Tag compat L2 containing hypervisor (m2p) mappings */
-        if ( is_pv_32bit_vcpu(v) &&
+        if ( is_pv_32bit_domain(d) &&
              guest_l4_table_offset(gw->va) == 0 &&
              guest_l3_table_offset(gw->va) == 3 )
             t = SH_type_l2h_shadow;
@@ -2314,7 +2314,7 @@ static int sh_page_fault(struct vcpu *v,
         return 0;
     }
 
-    cpl = is_pv_vcpu(v) ? (regs->ss & 3) : hvm_get_cpl(v);
+    cpl = is_hvm_domain(d) ? hvm_get_cpl(v) : (regs->ss & 3);
 
  rewalk:
 
@@ -3237,7 +3237,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 #endif
 
     /* Don't do anything on an uninitialised vcpu */
-    if ( is_pv_domain(d) && !v->is_initialised )
+    if ( !is_hvm_domain(d) && !v->is_initialised )
     {
         ASSERT(v->arch.cr3 == 0);
         return;
diff --git a/xen/arch/x86/mm/shadow/none.c b/xen/arch/x86/mm/shadow/none.c
index 691269a59e..67745074c4 100644
--- a/xen/arch/x86/mm/shadow/none.c
+++ b/xen/arch/x86/mm/shadow/none.c
@@ -27,7 +27,7 @@ int shadow_domain_init(struct domain *d)
     };
 
     paging_log_dirty_init(d, &sh_none_ops);
-    return is_pv_domain(d) ? 0 : -EOPNOTSUPP;
+    return is_hvm_domain(d) ? -EOPNOTSUPP : 0;
 }
 
 static int _page_fault(struct vcpu *v, unsigned long va,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:55:21 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:55:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110783.211610 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjjV-0005aS-QF; Wed, 14 Apr 2021 17:55:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110783.211610; Wed, 14 Apr 2021 17:55:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjjV-0005aK-NG; Wed, 14 Apr 2021 17:55:21 +0000
Received: by outflank-mailman (input) for mailman id 110783;
 Wed, 14 Apr 2021 17:55:20 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjjU-0005a8-9U
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:55:20 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjjU-0007GA-8i
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:55:20 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjjU-0006ue-82
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:55:20 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ejic0mSMIrfhzkI9487p/aAz7cnICkORx9qtQH4+VEU=; b=YFTbVe4QNlkvs98rKybhFhuQWp
	Ug7fFKMsl2ooeorKhb9PHqnlext0+taAaRDFFvSzmdb1+CGfs04KTtWeehrLi3Ol+45r7usXcpYR7
	GepfkEgyDLj9M1F1/3tg3kbXHI9YYF/UdOASV7JTBJSCMEFLiznd3vELlVxMB873xF88=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: improve save/restore of registers across S3
Message-Id: <E1lWjjU-0006ue-82@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:55:20 +0000

commit 27713fa2aa2166407bb962e80a39480f7ca5cee2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 13 10:14:23 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 13 10:14:23 2021 +0200

    VT-d: improve save/restore of registers across S3
    
    The static allocation of the save space is not only very inefficient
    (most of the array slots won't ever get used), but is also the sole
    reason for a build-time upper bound on the number of IOMMUs. Introduce
    a structure containing just the one needed field we can't (easily)
    restore from other in-memory state, and allocate the respective
    array dynamically.
    
    Take the opportunity and make the FEUADDR write dependent upon
    x2apic_enabled, like is already the case in dma_msi_set_affinity().
    
    Also alter properties of nr_iommus: static, unsigned, and __initdata.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 46 +++++++++++++++----------------------
 xen/drivers/passthrough/vtd/iommu.h |  2 --
 xen/include/asm-x86/iommu.h         |  1 -
 3 files changed, 19 insertions(+), 30 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 6428c8fe3e..10c71132db 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -57,7 +57,7 @@ bool __read_mostly iommu_qinval = true;
 bool __read_mostly iommu_snoop = true;
 #endif
 
-int nr_iommus;
+static unsigned int __initdata nr_iommus;
 
 static struct iommu_ops vtd_ops;
 static struct tasklet vtd_fault_tasklet;
@@ -1165,13 +1165,6 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
     unsigned long sagaw, nr_dom;
     int agaw;
 
-    if ( nr_iommus >= MAX_IOMMUS )
-    {
-        dprintk(XENLOG_ERR VTDPREFIX,
-                "IOMMU: nr_iommus %d > MAX_IOMMUS\n", nr_iommus + 1);
-        return -ENOMEM;
-    }
-
     iommu = xzalloc(struct vtd_iommu);
     if ( iommu == NULL )
         return -ENOMEM;
@@ -2226,6 +2219,10 @@ static void __hwdom_init setup_hwdom_rmrr(struct domain *d)
     pcidevs_unlock();
 }
 
+static struct iommu_state {
+    uint32_t fectl;
+} *__read_mostly iommu_state;
+
 static int __init vtd_setup(void)
 {
     struct acpi_drhd_unit *drhd;
@@ -2251,6 +2248,13 @@ static int __init vtd_setup(void)
         goto error;
     }
 
+    iommu_state = xmalloc_array(struct iommu_state, nr_iommus);
+    if ( !iommu_state )
+    {
+        ret = -ENOMEM;
+        goto error;
+    }
+
     /* We enable the following features only if they are supported by all VT-d
      * engines: Snoop Control, DMA passthrough, Queued Invalidation, Interrupt
      * Remapping, and Posted Interrupt
@@ -2508,8 +2512,6 @@ static int intel_iommu_group_id(u16 seg, u8 bus, u8 devfn)
         return PCI_BDF2(bus, devfn);
 }
 
-static u32 iommu_state[MAX_IOMMUS][MAX_IOMMU_REGS];
-
 static int __must_check vtd_suspend(void)
 {
     struct acpi_drhd_unit *drhd;
@@ -2534,14 +2536,7 @@ static int __must_check vtd_suspend(void)
         iommu = drhd->iommu;
         i = iommu->index;
 
-        iommu_state[i][DMAR_FECTL_REG] =
-            (u32) dmar_readl(iommu->reg, DMAR_FECTL_REG);
-        iommu_state[i][DMAR_FEDATA_REG] =
-            (u32) dmar_readl(iommu->reg, DMAR_FEDATA_REG);
-        iommu_state[i][DMAR_FEADDR_REG] =
-            (u32) dmar_readl(iommu->reg, DMAR_FEADDR_REG);
-        iommu_state[i][DMAR_FEUADDR_REG] =
-            (u32) dmar_readl(iommu->reg, DMAR_FEUADDR_REG);
+        iommu_state[i].fectl = dmar_readl(iommu->reg, DMAR_FECTL_REG);
 
         /* don't disable VT-d engine when force_iommu is set. */
         if ( force_iommu )
@@ -2594,15 +2589,13 @@ static void vtd_resume(void)
     for_each_drhd_unit ( drhd )
     {
         iommu = drhd->iommu;
-        i = iommu->index;
 
         spin_lock_irqsave(&iommu->register_lock, flags);
-        dmar_writel(iommu->reg, DMAR_FEDATA_REG,
-                    iommu_state[i][DMAR_FEDATA_REG]);
-        dmar_writel(iommu->reg, DMAR_FEADDR_REG,
-                    iommu_state[i][DMAR_FEADDR_REG]);
-        dmar_writel(iommu->reg, DMAR_FEUADDR_REG,
-                    iommu_state[i][DMAR_FEUADDR_REG]);
+        dmar_writel(iommu->reg, DMAR_FEDATA_REG, iommu->msi.msg.data);
+        dmar_writel(iommu->reg, DMAR_FEADDR_REG, iommu->msi.msg.address_lo);
+        if ( x2apic_enabled )
+            dmar_writel(iommu->reg, DMAR_FEUADDR_REG,
+                        iommu->msi.msg.address_hi);
         spin_unlock_irqrestore(&iommu->register_lock, flags);
     }
 
@@ -2615,8 +2608,7 @@ static void vtd_resume(void)
         i = iommu->index;
 
         spin_lock_irqsave(&iommu->register_lock, flags);
-        dmar_writel(iommu->reg, DMAR_FECTL_REG,
-                    (u32) iommu_state[i][DMAR_FECTL_REG]);
+        dmar_writel(iommu->reg, DMAR_FECTL_REG, iommu_state[i].fectl);
         spin_unlock_irqrestore(&iommu->register_lock, flags);
 
         iommu_enable_translation(drhd);
diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h
index 216791b3d6..6f41068c09 100644
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -499,8 +499,6 @@ struct qinval_entry {
 #define VTD_PAGE_TABLE_LEVEL_3  3
 #define VTD_PAGE_TABLE_LEVEL_4  4
 
-#define MAX_IOMMU_REGS 0xc0
-
 extern struct list_head acpi_drhd_units;
 extern struct list_head acpi_rmrr_units;
 extern struct list_head acpi_ioapic_units;
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 970eb06ffa..65a0b02f60 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -22,7 +22,6 @@
 #include <asm/hvm/vmx/vmcs.h>
 
 #define DEFAULT_DOMAIN_ADDRESS_WIDTH 48
-#define MAX_IOMMUS 32
 
 struct g2m_ioport {
     struct list_head list;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:55:31 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:55:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110784.211614 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjjf-0005bi-Rj; Wed, 14 Apr 2021 17:55:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110784.211614; Wed, 14 Apr 2021 17:55:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjjf-0005ba-Og; Wed, 14 Apr 2021 17:55:31 +0000
Received: by outflank-mailman (input) for mailman id 110784;
 Wed, 14 Apr 2021 17:55:30 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjje-0005bO-CQ
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:55:30 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjje-0007Ga-Bg
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:55:30 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjje-0006vS-B6
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:55:30 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/JH0VLNUYX6lBR1pfkFQbdEUzKw4TYYGof74t2hX61U=; b=Nej/Rvax/JYjqYf2yBbx2W58/6
	4tYAvNe5YTFMFTzKJphB5NnfQROJMsBRGmbIbGAZ8VvAexxQpY4G/HgiSMDTAnGdimWAU59zgYU0J
	EuiETWSjntZe7C2azU0gE7XmjU4TbEEvVMs9TztB7hk5xKZWha9YyS+FYuJBjX+Nc3ZI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: don't open-code dmar_readl()
Message-Id: <E1lWjje-0006vS-B6@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:55:30 +0000

commit 1ea7f6353405a59fea8d11f2ec1ca08ba3b299d0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 13 10:15:08 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 13 10:15:08 2021 +0200

    VT-d: don't open-code dmar_readl()
    
    While at it also drop the unnecessary use of a local variable there.
    
    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, 1 insertion(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 10c71132db..b2ca152e1f 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -990,8 +990,7 @@ static void __do_iommu_page_fault(struct vtd_iommu *iommu)
     }
 clear_overflow:
     /* clear primary fault overflow */
-    fault_status = readl(iommu->reg + DMAR_FSTS_REG);
-    if ( fault_status & DMA_FSTS_PFO )
+    if ( dmar_readl(iommu->reg, DMAR_FSTS_REG) & DMA_FSTS_PFO )
     {
         spin_lock_irqsave(&iommu->register_lock, flags);
         dmar_writel(iommu->reg, DMAR_FSTS_REG, DMA_FSTS_PFO);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:55:41 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:55:41 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110785.211618 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjjp-0005d4-TI; Wed, 14 Apr 2021 17:55:41 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110785.211618; Wed, 14 Apr 2021 17:55:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjjp-0005cw-QJ; Wed, 14 Apr 2021 17:55:41 +0000
Received: by outflank-mailman (input) for mailman id 110785;
 Wed, 14 Apr 2021 17:55:40 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjjo-0005cn-FR
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:55:40 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjjo-0007Gp-Ea
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:55:40 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjjo-0006wK-Dx
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:55:40 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xMEZB9xdxpI1mOEmsPJJxGScb50RLzBA5lMuKsP+2Qo=; b=wVjFVAW74KsZgtdbNPaytiuZ4N
	6UTksZ642oMsElz94mrwWucu6Wrn+Hsr8yQpXIgTg70mL1cimmS/tBSpScDbzLk+LHbi5+bywfy7O
	tZXcqJ4m8/LR3jwU+PHxYDU2RqxogJhEgr4nf8CvkMR7bKOmcyH0Vshtq0W/EQO6/otw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: bring print_qi_regs() in line with print_iommu_regs()
Message-Id: <E1lWjjo-0006wK-Dx@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:55:40 +0000

commit d8b05ce83fd17920752d608ab3a0ff31027472d1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 13 10:15:41 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 13 10:15:41 2021 +0200

    VT-d: bring print_qi_regs() in line with print_iommu_regs()
    
    Shorten the names printed. There's also no need to go through a local
    variable.
    
    While at it also constify the function's parameter.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/qinval.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c
index 764ef9f0fc..6100e778f3 100644
--- a/xen/drivers/passthrough/vtd/qinval.c
+++ b/xen/drivers/passthrough/vtd/qinval.c
@@ -33,18 +33,11 @@
 
 static int __must_check invalidate_sync(struct vtd_iommu *iommu);
 
-static void print_qi_regs(struct vtd_iommu *iommu)
+static void print_qi_regs(const struct vtd_iommu *iommu)
 {
-    u64 val;
-
-    val = dmar_readq(iommu->reg, DMAR_IQA_REG);
-    printk("DMAR_IQA_REG = %"PRIx64"\n", val);
-
-    val = dmar_readq(iommu->reg, DMAR_IQH_REG);
-    printk("DMAR_IQH_REG = %"PRIx64"\n", val);
-
-    val = dmar_readq(iommu->reg, DMAR_IQT_REG);
-    printk("DMAR_IQT_REG = %"PRIx64"\n", val);
+    printk(" IQA = %"PRIx64"\n", dmar_readq(iommu->reg, DMAR_IQA_REG));
+    printk(" IQH = %"PRIx64"\n", dmar_readq(iommu->reg, DMAR_IQH_REG));
+    printk(" IQT = %"PRIx64"\n", dmar_readq(iommu->reg, DMAR_IQT_REG));
 }
 
 static unsigned int qinval_next_index(struct vtd_iommu *iommu)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:55:51 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:55:51 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110786.211622 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjjz-0005eD-VM; Wed, 14 Apr 2021 17:55:51 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110786.211622; Wed, 14 Apr 2021 17:55:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjjz-0005e4-Rs; Wed, 14 Apr 2021 17:55:51 +0000
Received: by outflank-mailman (input) for mailman id 110786;
 Wed, 14 Apr 2021 17:55:50 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjjy-0005dx-Jq
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:55:50 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjjy-0007Gx-Iz
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:55:50 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjjy-0006xA-H4
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:55:50 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yP2t4Fr1Vgu6tl4i2xznQhCty6g5OeYAbljAl1JdMGQ=; b=z4BRJh3ueR/zeQ54V5AzTOuREL
	iGFeitmJIQ370zNQ9pZ/AaBrYxedRxS1CBL0xUGh0SJI46xKGsFEHZU8/LnrzeMQYtda3a6nsmJVy
	es4Vqv6AvhyR/vaXon9sFH8sAmIe0KgVZgnenlD30q4UCdykKOt3NnbKhAxvblC+ZUPA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: qinval indexes are only up to 19 bits wide
Message-Id: <E1lWjjy-0006xA-H4@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:55:50 +0000

commit 1b5d913fa0b3e4b9a8bba10c1db83082193bcc7a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 13 10:16:06 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 13 10:16:06 2021 +0200

    VT-d: qinval indexes are only up to 19 bits wide
    
    There's no need for 64-bit accesses to these registers (outside of
    initial setup and dumping).
    
    Also remove some stray blanks.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/qinval.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c
index 6100e778f3..c0ea19d4bd 100644
--- a/xen/drivers/passthrough/vtd/qinval.c
+++ b/xen/drivers/passthrough/vtd/qinval.c
@@ -42,14 +42,13 @@ static void print_qi_regs(const struct vtd_iommu *iommu)
 
 static unsigned int qinval_next_index(struct vtd_iommu *iommu)
 {
-    u64 tail;
+    unsigned int tail = dmar_readl(iommu->reg, DMAR_IQT_REG);
 
-    tail = dmar_readq(iommu->reg, DMAR_IQT_REG);
     tail >>= QINVAL_INDEX_SHIFT;
 
     /* (tail+1 == head) indicates a full queue, wait for HW */
-    while ( ( tail + 1 ) % QINVAL_ENTRY_NR ==
-            ( dmar_readq(iommu->reg, DMAR_IQH_REG) >> QINVAL_INDEX_SHIFT ) )
+    while ( (tail + 1) % QINVAL_ENTRY_NR ==
+            (dmar_readl(iommu->reg, DMAR_IQH_REG) >> QINVAL_INDEX_SHIFT) )
         cpu_relax();
 
     return tail;
@@ -57,12 +56,12 @@ static unsigned int qinval_next_index(struct vtd_iommu *iommu)
 
 static void qinval_update_qtail(struct vtd_iommu *iommu, unsigned int index)
 {
-    u64 val;
+    unsigned int val;
 
     /* Need hold register lock when update tail */
     ASSERT( spin_is_locked(&iommu->register_lock) );
     val = (index + 1) % QINVAL_ENTRY_NR;
-    dmar_writeq(iommu->reg, DMAR_IQT_REG, (val << QINVAL_INDEX_SHIFT));
+    dmar_writel(iommu->reg, DMAR_IQT_REG, val << QINVAL_INDEX_SHIFT);
 }
 
 static int __must_check queue_invalidate_context_sync(struct vtd_iommu *iommu,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:56:02 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:56:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110787.211626 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjkA-0005fU-0q; Wed, 14 Apr 2021 17:56:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110787.211626; Wed, 14 Apr 2021 17:56:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjk9-0005fM-Td; Wed, 14 Apr 2021 17:56:01 +0000
Received: by outflank-mailman (input) for mailman id 110787;
 Wed, 14 Apr 2021 17:56:00 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjk8-0005fA-Ne
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:56:00 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjk8-0007H7-Mp
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:56:00 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjk8-0006xv-LO
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:56:00 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aBgWuETDzEK+7QmZ4y0dNFt4nTf/2pwyDcLRBj0IhbE=; b=0IjZpxcIrG7s84zJw5+9WcaGlr
	MmzleQYInsrShlISrKMM2k9Q5GGZ0s8J7E3y7u7tTP0Z2LzbDSG018UKLQ+DwAvWDmzAgLsTQ9Uq6
	cIaKt0k2WxA6Cjd1yv82DtnWhWoav7BRfEKOaUw4rZPueZCUNcJl0Ry2L3piu8JRVBKw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: avoid pointless use of 64-bit constants
Message-Id: <E1lWjk8-0006xv-LO@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:56:00 +0000

commit ab7625a05e8329a8c7a34f7942e8240aafbc9742
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 13 10:16:28 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 13 10:16:28 2021 +0200

    VT-d: avoid pointless use of 64-bit constants
    
    When the respective registers are just 32 bits wide there's no point in
    making corresponding constants 64-bit ones.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.h | 62 +++++++++++++++++++------------------
 1 file changed, 32 insertions(+), 30 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h
index 6f41068c09..6804e3d58c 100644
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -121,30 +121,30 @@
 #define DMA_TLB_IVA_HINT(x) ((((u64)x) & 1) << 6)
 
 /* GCMD_REG */
-#define DMA_GCMD_TE     (((u64)1) << 31)
-#define DMA_GCMD_SRTP   (((u64)1) << 30)
-#define DMA_GCMD_SFL    (((u64)1) << 29)
-#define DMA_GCMD_EAFL   (((u64)1) << 28)
-#define DMA_GCMD_WBF    (((u64)1) << 27)
-#define DMA_GCMD_QIE    (((u64)1) << 26)
-#define DMA_GCMD_IRE    (((u64)1) << 25)
-#define DMA_GCMD_SIRTP  (((u64)1) << 24)
-#define DMA_GCMD_CFI    (((u64)1) << 23)
+#define DMA_GCMD_TE     (1u << 31)
+#define DMA_GCMD_SRTP   (1u << 30)
+#define DMA_GCMD_SFL    (1u << 29)
+#define DMA_GCMD_EAFL   (1u << 28)
+#define DMA_GCMD_WBF    (1u << 27)
+#define DMA_GCMD_QIE    (1u << 26)
+#define DMA_GCMD_IRE    (1u << 25)
+#define DMA_GCMD_SIRTP  (1u << 24)
+#define DMA_GCMD_CFI    (1u << 23)
 
 /* GSTS_REG */
-#define DMA_GSTS_TES    (((u64)1) << 31)
-#define DMA_GSTS_RTPS   (((u64)1) << 30)
-#define DMA_GSTS_FLS    (((u64)1) << 29)
-#define DMA_GSTS_AFLS   (((u64)1) << 28)
-#define DMA_GSTS_WBFS   (((u64)1) << 27)
-#define DMA_GSTS_QIES   (((u64)1) <<26)
-#define DMA_GSTS_IRES   (((u64)1) <<25)
-#define DMA_GSTS_SIRTPS (((u64)1) << 24)
-#define DMA_GSTS_CFIS   (((u64)1) <<23)
+#define DMA_GSTS_TES    (1u << 31)
+#define DMA_GSTS_RTPS   (1u << 30)
+#define DMA_GSTS_FLS    (1u << 29)
+#define DMA_GSTS_AFLS   (1u << 28)
+#define DMA_GSTS_WBFS   (1u << 27)
+#define DMA_GSTS_QIES   (1u << 26)
+#define DMA_GSTS_IRES   (1u << 25)
+#define DMA_GSTS_SIRTPS (1u << 24)
+#define DMA_GSTS_CFIS   (1u << 23)
 
 /* PMEN_REG */
-#define DMA_PMEN_EPM    (((u32)1) << 31)
-#define DMA_PMEN_PRS    (((u32)1) << 0)
+#define DMA_PMEN_EPM    (1u << 31)
+#define DMA_PMEN_PRS    (1u <<  0)
 
 /* CCMD_REG */
 #define DMA_CCMD_INVL_GRANU_OFFSET  61
@@ -164,21 +164,23 @@
 #define DMA_CCMD_CAIG_MASK(x) (((u64)x) & ((u64) 0x3 << 59))
 
 /* FECTL_REG */
-#define DMA_FECTL_IM (((u64)1) << 31)
+#define DMA_FECTL_IM (1u << 31)
 
 /* FSTS_REG */
-#define DMA_FSTS_PFO ((u64)1 << 0)
-#define DMA_FSTS_PPF ((u64)1 << 1)
-#define DMA_FSTS_AFO ((u64)1 << 2)
-#define DMA_FSTS_APF ((u64)1 << 3)
-#define DMA_FSTS_IQE ((u64)1 << 4)
-#define DMA_FSTS_ICE ((u64)1 << 5)
-#define DMA_FSTS_ITE ((u64)1 << 6)
-#define DMA_FSTS_FAULTS    DMA_FSTS_PFO | DMA_FSTS_PPF | DMA_FSTS_AFO | DMA_FSTS_APF | DMA_FSTS_IQE | DMA_FSTS_ICE | DMA_FSTS_ITE
+#define DMA_FSTS_PFO (1u << 0)
+#define DMA_FSTS_PPF (1u << 1)
+#define DMA_FSTS_AFO (1u << 2)
+#define DMA_FSTS_APF (1u << 3)
+#define DMA_FSTS_IQE (1u << 4)
+#define DMA_FSTS_ICE (1u << 5)
+#define DMA_FSTS_ITE (1u << 6)
+#define DMA_FSTS_FAULTS (DMA_FSTS_PFO | DMA_FSTS_PPF | DMA_FSTS_AFO | \
+                         DMA_FSTS_APF | DMA_FSTS_IQE | DMA_FSTS_ICE | \
+                         DMA_FSTS_ITE)
 #define dma_fsts_fault_record_index(s) (((s) >> 8) & 0xff)
 
 /* FRCD_REG, 32 bits access */
-#define DMA_FRCD_F (((u64)1) << 31)
+#define DMA_FRCD_F (1u << 31)
 #define dma_frcd_type(d) ((d >> 30) & 1)
 #define dma_frcd_fault_reason(c) (c & 0xff)
 #define dma_frcd_source_id(c) (c & 0xffff)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:56:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:56:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110788.211630 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjkK-0005gz-4h; Wed, 14 Apr 2021 17:56:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110788.211630; Wed, 14 Apr 2021 17:56: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 1lWjkK-0005gs-1H; Wed, 14 Apr 2021 17:56:12 +0000
Received: by outflank-mailman (input) for mailman id 110788;
 Wed, 14 Apr 2021 17:56:10 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjkI-0005gj-Rf
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:56:10 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjkI-0007Ix-Q7
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:56:10 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjkI-0006z4-PH
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:56:10 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4pr1mkhDowGG0EHqsGr+gPw7ZKqzuNlh2JDDUKIUZMI=; b=Xt9yGxD6WkG/NjLTE8W9KRiY7F
	7YW2mnCbhZT+0r/N6keFPlrvd5j18zmsLXrLN1fNGUpLCZ83IWJhBBK0eyHRY12XNldMzON0A8y0S
	6tiY5cmdiyVkxJbyiUnSgpYSEey3CRE+PSZ5QZ6oV/R5gfP+0exVKM0XjHii4N5x9ucQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: drop unused #define-s
Message-Id: <E1lWjkI-0006z4-PH@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:56:10 +0000

commit de7853ed741267435a5a86e0505288ccd5c6aaed
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 13 10:16:50 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 13 10:16:50 2021 +0200

    VT-d: drop unused #define-s
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.h | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h
index 6804e3d58c..aaf9e864ff 100644
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -471,26 +471,12 @@ struct qinval_entry {
 /* Queue invalidation head/tail shift */
 #define QINVAL_INDEX_SHIFT 4
 
-#define qinval_present(v) ((v).lo & 1)
-#define qinval_fault_disable(v) (((v).lo >> 1) & 1)
-
-#define qinval_set_present(v) do {(v).lo |= 1;} while(0)
-#define qinval_clear_present(v) do {(v).lo &= ~1;} while(0)
-
-#define RESERVED_VAL        0
-
 #define TYPE_INVAL_CONTEXT      0x1
 #define TYPE_INVAL_IOTLB        0x2
 #define TYPE_INVAL_DEVICE_IOTLB 0x3
 #define TYPE_INVAL_IEC          0x4
 #define TYPE_INVAL_WAIT         0x5
 
-#define NOTIFY_TYPE_POLL        1
-#define NOTIFY_TYPE_INTR        1
-#define INTERRUTP_FLAG          1
-#define STATUS_WRITE            1
-#define FENCE_FLAG              1
-
 #define IEC_GLOBAL_INVL         0
 #define IEC_INDEX_INVL          1
 #define IRTA_EIME               (((u64)1) << 11)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:56:22 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:56:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110789.211634 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjkU-0005iO-61; Wed, 14 Apr 2021 17:56:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110789.211634; Wed, 14 Apr 2021 17:56: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 1lWjkU-0005iG-32; Wed, 14 Apr 2021 17:56:22 +0000
Received: by outflank-mailman (input) for mailman id 110789;
 Wed, 14 Apr 2021 17:56:20 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjkS-0005i7-UH
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:56:20 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjkS-0007J5-TX
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:56:20 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjkS-0006zv-Sk
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:56:20 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Vn0FeHKPRocM4dKa0QyoahQdjmomKk+JPifyapxH0fU=; b=mL0hwgkHzv1T8vIXqSpjMCAQ9O
	VYLQ7djYTi0/BAVDbOx210ec6Pkn/R7CE+/gMwKEefSoMsB28AWF7BkEVpwN+Wv/FiOZ/9KbMhCyV
	igVJbo4n/JF6z5kS35bUPD056xBvwtCOArRYPuRssiL71GwpPkGW6+4quoFTGF47ywb8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] iommu: remove read_msi_from_ire hook
Message-Id: <E1lWjkS-0006zv-Sk@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:56:20 +0000

commit d1de2d02cae568c3b81e6104d877a76d9570189d
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Apr 13 10:17:15 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 13 10:17:15 2021 +0200

    iommu: remove read_msi_from_ire hook
    
    It's now unused after commit 28fb8cf323dd93f59a9c851c93ba9b79de8b1c4e.
    
    Fixes: 28fb8cf323d ('x86/iommu: remove code to fetch MSI message from remap table')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/iommu.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index d59ed7cbad..ea0cd0f1a2 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -244,7 +244,6 @@ struct iommu_ops {
 #ifdef CONFIG_HAS_PCI
     int (*get_device_group_id)(u16 seg, u8 bus, u8 devfn);
     int (*update_ire_from_msi)(struct msi_desc *msi_desc, struct msi_msg *msg);
-    void (*read_msi_from_ire)(struct msi_desc *msi_desc, struct msi_msg *msg);
 #endif /* HAS_PCI */
 
     void (*teardown)(struct domain *d);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:56:32 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:56:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110790.211638 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjke-0005jj-7k; Wed, 14 Apr 2021 17:56:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110790.211638; Wed, 14 Apr 2021 17:56: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 1lWjke-0005jb-4d; Wed, 14 Apr 2021 17:56:32 +0000
Received: by outflank-mailman (input) for mailman id 110790;
 Wed, 14 Apr 2021 17:56: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 1lWjkd-0005jQ-2i
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:56: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 1lWjkd-0007JU-0X
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:56:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjkc-00070s-W3
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:56:30 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WWFvA/EAbWG2JUoQDuZrXvz8Oir/ZLbtohB7UjaYKug=; b=XfSc6CGrZ67rqw4IcnBEOznWi8
	I8Y8HeYeIbxqraoHukSjA9O1nUCqEIKFXW4FrMFkKqm6erjTJKP79Xf8lyhHuGOkzFXwEh+I7gRnA
	m1Ba83Tw33ShbQq2SvHe2QORui2S7+Sl+ZZwfRKhOqnLPaqVOeDiR6zXhZi7zge+2u00=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/EPT: minor local variable adjustment in ept_set_entry()
Message-Id: <E1lWjkc-00070s-W3@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:56:30 +0000

commit 0faa6ef54af330867d836e99d34e8dc1e622b54f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 13 10:18:08 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 13 10:18:08 2021 +0200

    x86/EPT: minor local variable adjustment in ept_set_entry()
    
    Not having direct_mmio (used only once anyway) as a local variable gets
    the epte_get_entry_emt() invocation here in better sync with the other
    ones. While at it also reduce ipat's scope.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/mm/p2m-ept.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 23d411f01d..a3beaf91e2 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -677,8 +677,6 @@ ept_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
     unsigned long fn_mask = !mfn_eq(mfn, INVALID_MFN) ? (gfn | mfn_x(mfn)) : gfn;
     int ret, rc = 0;
     bool_t entry_written = 0;
-    bool_t direct_mmio = (p2mt == p2m_mmio_direct);
-    uint8_t ipat = 0;
     bool_t need_modify_vtd_table = 1;
     bool_t vtd_pte_present = 0;
     unsigned int iommu_flags = p2m_get_iommu_flags(p2mt, mfn);
@@ -790,8 +788,10 @@ ept_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
 
     if ( mfn_valid(mfn) || p2m_allows_invalid_mfn(p2mt) )
     {
+        uint8_t ipat = 0;
         int emt = epte_get_entry_emt(p2m->domain, gfn, mfn,
-                                     i * EPT_TABLE_ORDER, &ipat, direct_mmio);
+                                     i * EPT_TABLE_ORDER, &ipat,
+                                     p2mt == p2m_mmio_direct);
 
         if ( emt >= 0 )
             new_entry.emt = emt;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:56:42 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:56:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110791.211642 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjko-0005kx-9O; Wed, 14 Apr 2021 17:56:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110791.211642; Wed, 14 Apr 2021 17:56:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjko-0005kq-6F; Wed, 14 Apr 2021 17:56:42 +0000
Received: by outflank-mailman (input) for mailman id 110791;
 Wed, 14 Apr 2021 17:56:41 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjkn-0005ki-5P
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:56:41 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjkn-0007Jb-4b
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:56:41 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjkn-00071s-37
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:56:41 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=y9SQ8kodJQ7JqfIgoPCJ3FyP7hTM9ULYjHo7rAXRfo0=; b=1KKYS5fGa8+d4P+NDgquY2Bmua
	Or2sBQyeD49Wc9IdwRdfyLDcXnlXG3JVIMjDzqxLclyBV9V9DhagpU4XTYWyvNzOIVtdinCVuCAvL
	y772qQNelrsAfN7ryWsdn2/JTmJIS0XFWMfdwDYK4l4yRycRUQyLZJOxwTgbciDczjZU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: move is_s3_suspended field
Message-Id: <E1lWjkn-00071s-37@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:56:41 +0000

commit 3ccd796952deda179cb148606f7f7b3d6bea74b7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 13 10:18:34 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 13 10:18:34 2021 +0200

    x86/HVM: move is_s3_suspended field
    
    Put it next to another boolean, so they will "share" the subsequent
    padding hole.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/asm-x86/hvm/domain.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-x86/hvm/domain.h
index 7b60e9125f..698455444e 100644
--- a/xen/include/asm-x86/hvm/domain.h
+++ b/xen/include/asm-x86/hvm/domain.h
@@ -113,15 +113,15 @@ struct hvm_domain {
      * mtrr/pat between vcpus is not the same, set is_in_uc_mode
      */
     spinlock_t             uc_lock;
-    bool_t                 is_in_uc_mode;
+    bool                   is_in_uc_mode;
+
+    bool                   is_s3_suspended;
 
     /* hypervisor intercepted msix table */
     struct list_head       msixtbl_list;
 
     struct viridian_domain *viridian;
 
-    bool_t                 is_s3_suspended;
-
     /*
      * TSC value that VCPUs use to calculate their tsc_offset value.
      * Used during initialization and save/restore.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:56:52 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:56:52 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110792.211646 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjky-0005mE-BS; Wed, 14 Apr 2021 17:56:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110792.211646; Wed, 14 Apr 2021 17:56:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjky-0005m3-83; Wed, 14 Apr 2021 17:56:52 +0000
Received: by outflank-mailman (input) for mailman id 110792;
 Wed, 14 Apr 2021 17:56:51 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjkx-0005lv-8n
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:56:51 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjkx-0007Jo-81
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:56:51 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjkx-00072l-7E
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:56:51 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WwTzNU8ySNpJXBgC+WVxHt1PzhUy6+AjbGp+DJmpQxc=; b=e2FG8DfapeRRofn1Ocw0s5zK+4
	A14c52/EjAY0XOBVjqxe+DKjSc03yBOKxWz+LQ+AsAm4yF88/E2fjfRujIKaxpClWBU8AgCb688EH
	0Oa8P4aY2YdaAc4f/I6Lbj4gy9T8H56rRnZUV1N2UhMBLqW4FG8Oyw012djT8BIBQ/MQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/cpuid: Advertise no-lmsl unilaterally to hvm guests
Message-Id: <E1lWjkx-00072l-7E@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:56:51 +0000

commit 23ccf530431561268b0190f0f1b740b618771b7b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Apr 2 14:10:25 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Apr 13 15:11:55 2021 +0100

    x86/cpuid: Advertise no-lmsl unilaterally to hvm guests
    
    While part of the original AMD64 spec, Long Mode Segment Limit was a feature
    not picked up by Intel, and therefore didn't see much adoption in software.
    AMD have finally dropped the feature from hardware, and allocated a CPUID bit
    to indicate its absence.
    
    Xen has never supported the feature for guests, even when running on capable
    hardware, so advertise the feature's absence unilaterally.
    
    There is nothing specifically wrong with exposing this bit to PV guests, but
    the PV ABI doesn't include a working concept of MSR_EFER in the first place,
    so exposing it to PV guests would be out-of-place.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/libs/light/libxl_cpuid.c              | 1 +
 tools/misc/xen-cpuid.c                      | 1 +
 xen/arch/x86/cpuid.c                        | 6 ++++++
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 xen/tools/gen-cpuid.py                      | 4 +++-
 5 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 289c59c742..aee28b0430 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -270,6 +270,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"rstr-fp-err-ptrs", 0x80000008, NA, CPUID_REG_EBX, 2, 1},
         {"wbnoinvd",     0x80000008, NA, CPUID_REG_EBX,  9,  1},
         {"ibpb",         0x80000008, NA, CPUID_REG_EBX, 12,  1},
+        {"no-lmsl",      0x80000008, NA, CPUID_REG_EBX, 20,  1},
         {"ppin",         0x80000008, NA, CPUID_REG_EBX, 23,  1},
 
         {"nc",           0x80000008, NA, CPUID_REG_ECX,  0,  8},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 2d04162d8d..628e8f5aa2 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -152,6 +152,7 @@ static const char *const str_e8b[32] =
 
     [12] = "ibpb",
 
+    [20] = "no-lmsl",
     /* [22] */                 [23] = "ppin",
 };
 
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 18b08d9b87..050cd5713e 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -455,6 +455,12 @@ static void __init calculate_hvm_max_policy(void)
     __set_bit(X86_FEATURE_APIC, hvm_featureset);
     __set_bit(X86_FEATURE_X2APIC, hvm_featureset);
 
+    /*
+     * We don't support EFER.LMSLE at all.  AMD has dropped the feature from
+     * hardware and allocated a CPUID bit to indicate its absence.
+     */
+    __set_bit(X86_FEATURE_NO_LMSL, hvm_featureset);
+
     /*
      * On AMD, PV guests are entirely unable to use SYSENTER as Xen runs in
      * long mode (and init_amd() has cleared it out of host capabilities), but
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index a501479820..42bc8d4279 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -255,6 +255,7 @@ XEN_CPUFEATURE(CLZERO,        8*32+ 0) /*A  CLZERO instruction */
 XEN_CPUFEATURE(RSTR_FP_ERR_PTRS, 8*32+ 2) /*A  (F)X{SAVE,RSTOR} always saves/restores FPU Error pointers */
 XEN_CPUFEATURE(WBNOINVD,      8*32+ 9) /*   WBNOINVD instruction */
 XEN_CPUFEATURE(IBPB,          8*32+12) /*A  IBPB support only (no IBRS, used by AMD) */
+XEN_CPUFEATURE(NO_LMSL,       8*32+20) /*S  EFER.LMSLE no longer supported. */
 XEN_CPUFEATURE(AMD_PPIN,      8*32+23) /*   Protected Processor Inventory Number */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:0.edx, word 9 */
diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 36f67750e5..b953648b65 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -242,7 +242,9 @@ def crunch_numbers(state):
         # CX16 is only encodable in Long Mode.  LAHF_LM indicates that the
         # SAHF/LAHF instructions are reintroduced in Long Mode.  1GB
         # superpages, PCID and PKU are only available in 4 level paging.
-        LM: [CX16, PCID, LAHF_LM, PAGE1GB, PKU],
+        # NO_LMSL indicates the absense of Long Mode Segment Limits, which
+        # have been dropped in hardware.
+        LM: [CX16, PCID, LAHF_LM, PAGE1GB, PKU, NO_LMSL],
 
         # AMD K6-2+ and K6-III processors shipped with 3DNow+, beyond the
         # standard 3DNow in the earlier K6 processors.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:57:02 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:57:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110793.211650 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjl8-0005nQ-D7; Wed, 14 Apr 2021 17:57:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110793.211650; Wed, 14 Apr 2021 17:57: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 1lWjl8-0005nI-9i; Wed, 14 Apr 2021 17:57:02 +0000
Received: by outflank-mailman (input) for mailman id 110793;
 Wed, 14 Apr 2021 17:57: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 1lWjl7-0005nA-DC
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:57: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 1lWjl7-0007Jz-CN
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:57:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjl7-00073W-Ag
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:57: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=+AeI0MMTDvPkW4Pjfm4YfFKFyIkY5ckPGlrfez7Ol8U=; b=TXBSwr4wloAYw4kEg1BW8FjBsx
	88aLgC9N4MSSP0NzaweOGSLK+AV0ch+guimdpajlzqsJyrl3hrIB73ShUBXltGUtGaZMTbRnMvKl8
	96lNQrRgoAFtVyuiWU8Ss5zT97bUXB8znDnsq0yLcGCQ8y0vgiNAXP+gUFNUmb4TehTA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: User defined max_maptrack_frames in a stub domain
Message-Id: <E1lWjl7-00073W-Ag@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:57:01 +0000

commit 80714e55042b2242cd82eccfb7405d671ecbebda
Author:     Dmitry Fedorov <d.fedorov@tabit.pro>
AuthorDate: Tue Apr 13 15:17:29 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Apr 13 15:17:29 2021 +0100

    libxl: User defined max_maptrack_frames in a stub domain
    
    Implementing qrexec+usbip+qemu in Linux-based stub domain leads me to
    an issue where a device model stub domain doesn't have maptrack entries.
    
    Signed-off-by: Dmitry Fedorov <d.fedorov@tabit.pro>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/light/libxl_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 5309496c58..3599a82ef0 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -2311,7 +2311,7 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
     dm_config->b_info.target_memkb = dm_config->b_info.max_memkb;
 
     dm_config->b_info.max_grant_frames = guest_config->b_info.max_grant_frames;
-    dm_config->b_info.max_maptrack_frames = 0;
+    dm_config->b_info.max_maptrack_frames = guest_config->b_info.max_maptrack_frames;
 
     dm_config->b_info.u.pv.features = "";
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:57:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:57:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110794.211654 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjlI-0005oh-EF; Wed, 14 Apr 2021 17:57:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110794.211654; Wed, 14 Apr 2021 17:57: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 1lWjlI-0005oZ-BN; Wed, 14 Apr 2021 17:57:12 +0000
Received: by outflank-mailman (input) for mailman id 110794;
 Wed, 14 Apr 2021 17:57: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 1lWjlH-0005oR-H1
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:57: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 1lWjlH-0007KN-GD
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:57:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjlH-00074T-Et
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:57: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=EIbDB+91dH0CdoMaNnTrHLUqphp7e1s32wDiIHBUY+Q=; b=hHdw3vNtXFnJXyoDcAT9rhYdqP
	17nUULsL9kgFwGAz9YW38RNd5UCicLkDBhe9AjbmPpfq4ECFucjDwHL4xHIkq/JX97KTlLEQuN70R
	mdqsU6YQik18OgKW43Okn5qW24O5a4jNWlN4XLRrak7/xjGUm7FRLFWav3rkzLuPEetw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Revert "xen/arm: mm: flush_page_to_ram() only need to clean to PoC"
Message-Id: <E1lWjlH-00074T-Et@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:57:11 +0000

commit a33ad60cc3c2a107b43f9c368b1718eda3282760
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Apr 13 17:15:39 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 13 17:15:39 2021 +0100

    Revert "xen/arm: mm: flush_page_to_ram() only need to clean to PoC"
    
    Some callers of flush_page_to_ram() expect the memory to be
    invalidated. Reverts commit 9617d5f9c19d1d157629e1e436791509526e0ce5
    to unblock OssTest.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 2f11d214e1..59f8a3f15f 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -529,7 +529,7 @@ void flush_page_to_ram(unsigned long mfn, bool sync_icache)
 {
     void *v = map_domain_page(_mfn(mfn));
 
-    clean_dcache_va_range(v, PAGE_SIZE);
+    clean_and_invalidate_dcache_va_range(v, PAGE_SIZE);
     unmap_domain_page(v);
 
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 14 17:57:22 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Apr 2021 17:57:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110795.211658 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWjlS-0005q9-G6; Wed, 14 Apr 2021 17:57:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110795.211658; Wed, 14 Apr 2021 17:57: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 1lWjlS-0005q1-Ct; Wed, 14 Apr 2021 17:57:22 +0000
Received: by outflank-mailman (input) for mailman id 110795;
 Wed, 14 Apr 2021 17:57: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 1lWjlR-0005pu-K4
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:57: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 1lWjlR-0007KU-JI
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:57:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWjlR-00075E-Ie
 for xen-changelog@lists.xenproject.org; Wed, 14 Apr 2021 17:57: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=sqO29VVOXiyncnd2gn/xI6JlzN0cTrMIMe9LScqEJPY=; b=Q0i2V9RIp36wMOl6MRNEujRZNU
	C6cqCPvLzW0fLLPWby7RBzy86c9kXaZcSqJnmF4VcLkYhwXs5k9Tci6hUTd5liJXh1TvQJs8Wb0Bl
	qjDsE3VdR9VQERca6NLHZXta8ieWfCcW3vnKG35MEyX8sm3CDhQw7rwyQ84m4peV/DdI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/iommu: smmu: Silence clang in arm_smmu_device_dt_probe()
Message-Id: <E1lWjlR-00075E-Ie@xenbits.xenproject.org>
Date: Wed, 14 Apr 2021 17:57:21 +0000

commit 264aa183ad85b2779b27d1312724a291259ccc9f
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Apr 2 16:51:06 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 13 18:57:59 2021 +0100

    xen/iommu: smmu: Silence clang in arm_smmu_device_dt_probe()
    
    Clang 11 will throw the following error:
    
    smmu.c:2284:18: error: cast to smaller integer type 'enum arm_smmu_arch_version' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
            smmu->version = (enum arm_smmu_arch_version)of_id->data;
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    The error can be prevented by initially casting to (uintptr_t) and then
    enum.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/drivers/passthrough/arm/smmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index 20ac672e91..fab7be8b48 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -2382,7 +2382,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
 	smmu->dev = dev;
 
 	of_id = of_match_node(arm_smmu_of_match, dev->of_node);
-	smmu->version = (enum arm_smmu_arch_version)of_id->data;
+	smmu->version = (enum arm_smmu_arch_version)(uintptr_t)of_id->data;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	smmu->base = devm_ioremap_resource(dev, res);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Apr 15 00:11:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Apr 2021 00:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.110863.211810 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lWpb9-0007ts-C8; Thu, 15 Apr 2021 00:11:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 110863.211810; Thu, 15 Apr 2021 00: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 1lWpb9-0007tk-8i; Thu, 15 Apr 2021 00:11:07 +0000
Received: by outflank-mailman (input) for mailman id 110863;
 Thu, 15 Apr 2021 00:11:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWpb7-0007tf-Hw
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 00:11:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWpb7-0005h9-Eq
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 00:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lWpb7-00020b-Cy
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 00:11:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6w59XVRMVIL3HDniycLEKrhDFNLebVICKHHw3QGlxXw=; b=LJc10zkyegrvRfrOqdr4HZT829
	FGQBZHo5FA1USxkIJF/4QUq5G9cuDSjMX52slihfhvabsYTyISMRvP+SBKHhpYro8OOGgdeQTObqj
	GvJre1mZRo/2y1HXqeb0KiMc37iNa1j2L3m2b4bff+Q0J2LHIZMvr1QXZLX4WD3zJ0gw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: remove allow_failure from Alpine Linux jobs
Message-Id: <E1lWpb7-00020b-Cy@xenbits.xenproject.org>
Date: Thu, 15 Apr 2021 00:11:05 +0000

commit ed3ea7e95b0d94cc92a0fcf6c57e784ddfb24c97
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Fri Mar 12 13:05:26 2021 -0800
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Wed Apr 14 17:07:57 2021 -0700

    automation: remove allow_failure from Alpine Linux jobs
    
    Now that the Alpine Linux build jobs complete successfully on staging we
    can remove the "allow_failure: true" tag.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 automation/gitlab-ci/build.yaml | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 23ab81d892..cca2c310e2 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -434,25 +434,21 @@ alpine-3.12-gcc:
   extends: .gcc-x86-64-build
   variables:
     CONTAINER: alpine:3.12
-  allow_failure: true
 
 alpine-3.12-gcc-debug:
   extends: .gcc-x86-64-build-debug
   variables:
     CONTAINER: alpine:3.12
-  allow_failure: true
 
 alpine-3.12-clang:
   extends: .clang-x86-64-build
   variables:
     CONTAINER: alpine:3.12
-  allow_failure: true
 
 alpine-3.12-clang-debug:
   extends: .clang-x86-64-build-debug
   variables:
     CONTAINER: alpine:3.12
-  allow_failure: true
 
 
 # Arm builds
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 15 11:55:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Apr 2021 11:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111076.212335 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX0aR-0007P7-9X; Thu, 15 Apr 2021 11:55:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111076.212335; Thu, 15 Apr 2021 11:55:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX0aR-0007Oz-6S; Thu, 15 Apr 2021 11:55:07 +0000
Received: by outflank-mailman (input) for mailman id 111076;
 Thu, 15 Apr 2021 11:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX0aP-0007Ou-R0
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 11:55:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX0aP-0007F2-O1
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 11:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX0aP-0001kg-N9
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 11:55:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ncOypJILqh0L846LNl0dRKRsCRrkRpOJmilg3t1n0DY=; b=CSujOpLqfHtV6w3DJQu/AYSv/C
	A4myKgov4uMtRdrDUy2pbtmgKLe3gNPFuAv5LGksuO1tH0aXS8k9JleAbJ4wdDTGVmNwlC7LhJ1Hb
	E88Izz34QdPaVnTkG7HcOXg8x1tu5WLSVz+BiR9lsKvLeUOWHZbahyaeYyFO8ByHYQWM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: don't build unused entry code when !PV32
Message-Id: <E1lX0aP-0001kg-N9@xenbits.xenproject.org>
Date: Thu, 15 Apr 2021 11:55:05 +0000

commit 9cc6bd43addb8c043774b6fc59ae9a0d14371eab
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 15 13:34:29 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 15 13:34:29 2021 +0200

    x86: don't build unused entry code when !PV32
    
    Except for the initial part of cstar_enter compat/entry.S is all dead
    code in this case. Further, along the lines of the PV conditionals we
    already have in entry.S, make code PV32-conditional there too (to a
    fair part because this code actually references compat/entry.S).
    
    This has the side effect of moving the tail part (now at compat_syscall)
    of the code out of .text.entry (in line with e.g. compat_sysenter).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Wei Liu <wl@xen.org>
---
 xen/arch/x86/x86_64/Makefile       |  2 +-
 xen/arch/x86/x86_64/asm-offsets.c  | 14 ++++----
 xen/arch/x86/x86_64/compat/entry.S | 44 +----------------------
 xen/arch/x86/x86_64/entry.S        | 71 +++++++++++++++++++++++++++++++++++---
 xen/include/asm-x86/asm_defns.h    |  2 +-
 5 files changed, 78 insertions(+), 55 deletions(-)

diff --git a/xen/arch/x86/x86_64/Makefile b/xen/arch/x86/x86_64/Makefile
index 2bb1eb0a81..2ea536fa71 100644
--- a/xen/arch/x86/x86_64/Makefile
+++ b/xen/arch/x86/x86_64/Makefile
@@ -1,4 +1,4 @@
-obj-$(CONFIG_PV) += compat/
+obj-$(CONFIG_PV32) += compat/
 
 obj-bin-y += entry.o
 obj-y += traps.o
diff --git a/xen/arch/x86/x86_64/asm-offsets.c b/xen/arch/x86/x86_64/asm-offsets.c
index ce030b124f..649892643f 100644
--- a/xen/arch/x86/x86_64/asm-offsets.c
+++ b/xen/arch/x86/x86_64/asm-offsets.c
@@ -9,7 +9,7 @@
 #include <xen/perfc.h>
 #endif
 #include <xen/sched.h>
-#ifdef CONFIG_PV
+#ifdef CONFIG_PV32
 #include <compat/xen.h>
 #endif
 #include <asm/hardirq.h>
@@ -102,19 +102,21 @@ void __dummy__(void)
     BLANK();
 #endif
 
-#ifdef CONFIG_PV
+#ifdef CONFIG_PV32
     OFFSET(DOMAIN_is_32bit_pv, struct domain, arch.pv.is_32bit);
     BLANK();
 
-    OFFSET(VCPUINFO_upcall_pending, struct vcpu_info, evtchn_upcall_pending);
-    OFFSET(VCPUINFO_upcall_mask, struct vcpu_info, evtchn_upcall_mask);
-    BLANK();
-
     OFFSET(COMPAT_VCPUINFO_upcall_pending, struct compat_vcpu_info, evtchn_upcall_pending);
     OFFSET(COMPAT_VCPUINFO_upcall_mask, struct compat_vcpu_info, evtchn_upcall_mask);
     BLANK();
 #endif
 
+#ifdef CONFIG_PV
+    OFFSET(VCPUINFO_upcall_pending, struct vcpu_info, evtchn_upcall_pending);
+    OFFSET(VCPUINFO_upcall_mask, struct vcpu_info, evtchn_upcall_mask);
+    BLANK();
+#endif
+
     OFFSET(CPUINFO_guest_cpu_user_regs, struct cpu_info, guest_cpu_user_regs);
     OFFSET(CPUINFO_verw_sel, struct cpu_info, verw_sel);
     OFFSET(CPUINFO_current_vcpu, struct cpu_info, current_vcpu);
diff --git a/xen/arch/x86/x86_64/compat/entry.S b/xen/arch/x86/x86_64/compat/entry.S
index c2c73cc732..c84ff7ea64 100644
--- a/xen/arch/x86/x86_64/compat/entry.S
+++ b/xen/arch/x86/x86_64/compat/entry.S
@@ -11,8 +11,6 @@
 #include <public/xen.h>
 #include <irq_vectors.h>
 
-#ifdef CONFIG_PV32
-
 ENTRY(entry_int82)
         ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP
         pushq $0
@@ -29,8 +27,6 @@ ENTRY(entry_int82)
         mov   %rsp, %rdi
         call  do_entry_int82
 
-#endif /* CONFIG_PV32 */
-
 /* %rbx: struct vcpu */
 ENTRY(compat_test_all_events)
         ASSERT_NOT_IN_ATOMIC
@@ -197,43 +193,7 @@ ENTRY(cr4_pv32_restore)
         xor   %eax, %eax
         ret
 
-        .section .text.entry, "ax", @progbits
-
-/* See lstar_enter for entry register state. */
-ENTRY(cstar_enter)
-#ifdef CONFIG_XEN_SHSTK
-        ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK
-#endif
-        /* sti could live here when we don't switch page tables below. */
-        CR4_PV32_RESTORE
-        movq  8(%rsp),%rax /* Restore %rax. */
-        movq  $FLAT_USER_SS32, 8(%rsp) /* Assume a 64bit domain.  Compat handled lower. */
-        pushq %r11
-        pushq $FLAT_USER_CS32
-        pushq %rcx
-        pushq $0
-        movl  $TRAP_syscall, 4(%rsp)
-        SAVE_ALL
-
-        SPEC_CTRL_ENTRY_FROM_PV /* Req: %rsp=regs/cpuinfo, Clob: acd */
-        /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
-
-        GET_STACK_END(bx)
-        mov   STACK_CPUINFO_FIELD(xen_cr3)(%rbx), %rcx
-        test  %rcx, %rcx
-        jz    .Lcstar_cr3_okay
-        movb  $0, STACK_CPUINFO_FIELD(use_pv_cr3)(%rbx)
-        mov   %rcx, %cr3
-        /* %r12 is still zero at this point. */
-        mov   %r12, STACK_CPUINFO_FIELD(xen_cr3)(%rbx)
-.Lcstar_cr3_okay:
-        sti
-
-        movq  STACK_CPUINFO_FIELD(current_vcpu)(%rbx), %rbx
-        movq  VCPU_domain(%rbx),%rcx
-        cmpb  $0,DOMAIN_is_32bit_pv(%rcx)
-        je    switch_to_kernel
-
+ENTRY(compat_syscall)
         /* Fix up reported %cs/%ss for compat domains. */
         movl  $FLAT_COMPAT_USER_SS, UREGS_ss(%rsp)
         movl  $FLAT_COMPAT_USER_CS, UREGS_cs(%rsp)
@@ -262,8 +222,6 @@ UNLIKELY_END(compat_syscall_gpf)
         movb  %cl,TRAPBOUNCE_flags(%rdx)
         jmp   .Lcompat_bounce_exception
 
-        .text
-
 ENTRY(compat_sysenter)
         CR4_PV32_RESTORE
         movq  VCPU_trap_ctxt(%rbx),%rcx
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index e2ff4a9018..d5998acf88 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -24,7 +24,7 @@
 
 #ifdef CONFIG_PV
 /* %rbx: struct vcpu */
-ENTRY(switch_to_kernel)
+switch_to_kernel:
         leaq  VCPU_trap_bounce(%rbx),%rdx
 
         /* TB_eip = 32-bit syscall ? syscall32_addr : syscall_addr */
@@ -283,6 +283,45 @@ ENTRY(lstar_enter)
         call  pv_hypercall
         jmp   test_all_events
 
+/* See lstar_enter for entry register state. */
+ENTRY(cstar_enter)
+#ifdef CONFIG_XEN_SHSTK
+        ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK
+#endif
+        /* sti could live here when we don't switch page tables below. */
+        CR4_PV32_RESTORE
+        movq  8(%rsp), %rax /* Restore %rax. */
+        movq  $FLAT_USER_SS32, 8(%rsp) /* Assume a 64bit domain.  Compat handled lower. */
+        pushq %r11
+        pushq $FLAT_USER_CS32
+        pushq %rcx
+        pushq $0
+        movl  $TRAP_syscall, 4(%rsp)
+        SAVE_ALL
+
+        SPEC_CTRL_ENTRY_FROM_PV /* Req: %rsp=regs/cpuinfo, Clob: acd */
+        /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
+
+        GET_STACK_END(bx)
+        mov   STACK_CPUINFO_FIELD(xen_cr3)(%rbx), %rcx
+        test  %rcx, %rcx
+        jz    .Lcstar_cr3_okay
+        movb  $0, STACK_CPUINFO_FIELD(use_pv_cr3)(%rbx)
+        mov   %rcx, %cr3
+        /* %r12 is still zero at this point. */
+        mov   %r12, STACK_CPUINFO_FIELD(xen_cr3)(%rbx)
+.Lcstar_cr3_okay:
+        sti
+
+        movq  STACK_CPUINFO_FIELD(current_vcpu)(%rbx), %rbx
+
+#ifdef CONFIG_PV32
+        movq  VCPU_domain(%rbx), %rcx
+        cmpb  $0, DOMAIN_is_32bit_pv(%rcx)
+        jne   compat_syscall
+#endif
+        jmp   switch_to_kernel
+
 ENTRY(sysenter_entry)
 #ifdef CONFIG_XEN_SHSTK
         ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK
@@ -340,8 +379,10 @@ UNLIKELY_END(sysenter_gpf)
         movq  VCPU_domain(%rbx),%rdi
         movq  %rax,TRAPBOUNCE_eip(%rdx)
         movb  %cl,TRAPBOUNCE_flags(%rdx)
+#ifdef CONFIG_PV32
         cmpb  $0, DOMAIN_is_32bit_pv(%rdi)
         jne   compat_sysenter
+#endif
         jmp   .Lbounce_exception
 
 ENTRY(int80_direct_trap)
@@ -382,6 +423,7 @@ UNLIKELY_END(msi_check)
         mov    0x80 * TRAPINFO_sizeof + TRAPINFO_eip(%rsi), %rdi
         movzwl 0x80 * TRAPINFO_sizeof + TRAPINFO_cs (%rsi), %ecx
 
+#ifdef CONFIG_PV32
         mov   %ecx, %edx
         and   $~3, %edx
 
@@ -390,6 +432,10 @@ UNLIKELY_END(msi_check)
 
         test  %rdx, %rdx
         jz    int80_slow_path
+#else
+        test  %rdi, %rdi
+        jz    int80_slow_path
+#endif
 
         /* Construct trap_bounce from trap_ctxt[0x80]. */
         lea   VCPU_trap_bounce(%rbx), %rdx
@@ -402,8 +448,10 @@ UNLIKELY_END(msi_check)
         lea   (, %rcx, TBF_INTERRUPT), %ecx
         mov   %cl, TRAPBOUNCE_flags(%rdx)
 
+#ifdef CONFIG_PV32
         cmpb  $0, DOMAIN_is_32bit_pv(%rax)
         jne   compat_int80_direct_trap
+#endif
 
         call  create_bounce_frame
         jmp   test_all_events
@@ -555,12 +603,16 @@ ENTRY(dom_crash_sync_extable)
         GET_STACK_END(ax)
         leaq  STACK_CPUINFO_FIELD(guest_cpu_user_regs)(%rax),%rsp
         # create_bounce_frame() temporarily clobbers CS.RPL. Fix up.
+#ifdef CONFIG_PV32
         movq  STACK_CPUINFO_FIELD(current_vcpu)(%rax), %rax
         movq  VCPU_domain(%rax),%rax
         cmpb  $0, DOMAIN_is_32bit_pv(%rax)
         sete  %al
         leal  (%rax,%rax,2),%eax
         orb   %al,UREGS_cs(%rsp)
+#else
+        orb   $3, UREGS_cs(%rsp)
+#endif
         xorl  %edi,%edi
         jmp   asm_domain_crash_synchronous /* Does not return */
         .popsection
@@ -578,10 +630,14 @@ ret_from_intr:
         GET_CURRENT(bx)
         testb $3, UREGS_cs(%rsp)
         jz    restore_all_xen
+#ifdef CONFIG_PV32
         movq  VCPU_domain(%rbx), %rax
         cmpb  $0, DOMAIN_is_32bit_pv(%rax)
         je    test_all_events
         jmp   compat_test_all_events
+#else
+        jmp   test_all_events
+#endif
 #else
 ret_from_intr:
         ASSERT_CONTEXT_IS_XEN
@@ -671,7 +727,7 @@ handle_exception_saved:
         testb $X86_EFLAGS_IF>>8,UREGS_eflags+1(%rsp)
         jz    exception_with_ints_disabled
 
-#ifdef CONFIG_PV
+#if defined(CONFIG_PV32)
         ALTERNATIVE_2 "jmp .Lcr4_pv32_done", \
             __stringify(mov VCPU_domain(%rbx), %rax), X86_FEATURE_XEN_SMEP, \
             __stringify(mov VCPU_domain(%rbx), %rax), X86_FEATURE_XEN_SMAP
@@ -711,7 +767,7 @@ handle_exception_saved:
         test  $~(PFEC_write_access|PFEC_insn_fetch),%eax
         jz    compat_test_all_events
 .Lcr4_pv32_done:
-#else
+#elif !defined(CONFIG_PV)
         ASSERT_CONTEXT_IS_XEN
 #endif /* CONFIG_PV */
         sti
@@ -730,9 +786,11 @@ handle_exception_saved:
 #ifdef CONFIG_PV
         testb $3,UREGS_cs(%rsp)
         jz    restore_all_xen
+#ifdef CONFIG_PV32
         movq  VCPU_domain(%rbx),%rax
         cmpb  $0, DOMAIN_is_32bit_pv(%rax)
         jne   compat_test_all_events
+#endif
         jmp   test_all_events
 #else
         ASSERT_CONTEXT_IS_XEN
@@ -968,10 +1026,15 @@ handle_ist_exception:
         je    1f
         movl  $EVENT_CHECK_VECTOR,%edi
         call  send_IPI_self
-1:      movq  VCPU_domain(%rbx),%rax
+1:
+#ifdef CONFIG_PV32
+        movq  VCPU_domain(%rbx),%rax
         cmpb  $0,DOMAIN_is_32bit_pv(%rax)
         je    restore_all_guest
         jmp   compat_restore_all_guest
+#else
+        jmp   restore_all_guest
+#endif
 #else
         ASSERT_CONTEXT_IS_XEN
         jmp   restore_all_xen
diff --git a/xen/include/asm-x86/asm_defns.h b/xen/include/asm-x86/asm_defns.h
index d480a4461b..d9431180cf 100644
--- a/xen/include/asm-x86/asm_defns.h
+++ b/xen/include/asm-x86/asm_defns.h
@@ -305,7 +305,7 @@ static always_inline void stac(void)
         subq  $-(UREGS_error_code-UREGS_r15+\adj), %rsp
 .endm
 
-#ifdef CONFIG_PV
+#ifdef CONFIG_PV32
 #define CR4_PV32_RESTORE                               \
     ALTERNATIVE_2 "",                                  \
         "call cr4_pv32_restore", X86_FEATURE_XEN_SMEP, \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 15 11:55:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Apr 2021 11:55:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111077.212339 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX0ab-0007Q6-B9; Thu, 15 Apr 2021 11:55:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111077.212339; Thu, 15 Apr 2021 11:55:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX0ab-0007Py-8A; Thu, 15 Apr 2021 11:55:17 +0000
Received: by outflank-mailman (input) for mailman id 111077;
 Thu, 15 Apr 2021 11:55:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX0aZ-0007Pp-SP
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 11:55:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX0aZ-0007F5-Rh
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 11:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX0aZ-0001lU-Qt
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 11:55:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uYLdpbcyFrywV2ZcmAdj/rb6f0KLmI1dNQQ0XgtyhmE=; b=iZxVXb4HOVsEGsH/GW4LBBrCKo
	26D3HO5GPgOxvRst4beoiW7TVKfRR2GepBYH3JlujMwH2kBChwrHlpEfkT2JKZofxOWG9Yl/PrIc9
	TSvBO2D2gL+UCOfXZnFwwDHN+e1Or/LP5kDvsTwdUt0rOkb8ZxcE+su4PVpWHLvt6Rq0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: slim down hypercall handling when !PV32
Message-Id: <E1lX0aZ-0001lU-Qt@xenbits.xenproject.org>
Date: Thu, 15 Apr 2021 11:55:15 +0000

commit 527922008bcedb53f01cf91428303d650fb67360
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 15 13:35:32 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 15 13:35:32 2021 +0200

    x86: slim down hypercall handling when !PV32
    
    In such a build various of the compat handlers aren't needed. Don't
    reference them from the hypercall table, and compile out those which
    aren't needed for HVM. Also compile out switch_compat(), which has no
    purpose in such a build.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Wei Liu <wl@xen.org>
---
 xen/arch/x86/Makefile               |  3 ++-
 xen/arch/x86/hvm/hypercall.c        |  4 +++-
 xen/arch/x86/mm.c                   |  4 +++-
 xen/arch/x86/pv/callback.c          | 14 ++++++++++++--
 xen/arch/x86/pv/descriptor-tables.c | 24 ++++++++++++++----------
 xen/arch/x86/pv/domain.c            |  2 ++
 xen/arch/x86/pv/hypercall.c         | 10 +++++++++-
 xen/arch/x86/pv/iret.c              |  2 ++
 xen/arch/x86/pv/shim.c              | 10 +++++++---
 xen/include/asm-x86/compat.h        |  8 ++++++++
 xen/include/asm-x86/hypercall.h     |  5 ++++-
 xen/include/xen/compat.h            |  3 ---
 12 files changed, 66 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index b6567c4127..399ee508c2 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -17,7 +17,8 @@ obj-bin-y += bzimage.init.o
 obj-bin-y += clear_page.o
 obj-bin-y += copy_page.o
 obj-y += cpuid.o
-obj-$(CONFIG_PV) += compat.o x86_64/compat.o
+obj-$(CONFIG_PV) += compat.o
+obj-$(CONFIG_PV32) += x86_64/compat.o
 obj-$(CONFIG_KEXEC) += crash.o
 obj-$(CONFIG_GDBSX) += debug.o
 obj-y += delay.o
diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index b084afcbce..2d27fcbd2c 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -121,7 +121,9 @@ static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
 #define do_arch_1             paging_domctl_continuation
 
-static const hypercall_table_t hvm_hypercall_table[] = {
+static const struct {
+    hypercall_fn_t *native, *compat;
+} hvm_hypercall_table[] = {
     HVM_CALL(memory_op),
 #ifdef CONFIG_GRANT_TABLE
     HVM_CALL(grant_table_op),
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 69d04ad809..b7a10bbdd4 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4512,7 +4512,9 @@ long do_update_va_mapping_otherdomain(unsigned long va, u64 val64,
 
     return rc;
 }
+#endif /* CONFIG_PV */
 
+#ifdef CONFIG_PV32
 int compat_update_va_mapping(unsigned int va, uint32_t lo, uint32_t hi,
                              unsigned int flags)
 {
@@ -4547,7 +4549,7 @@ int compat_update_va_mapping_otherdomain(unsigned int va,
 
     return rc;
 }
-#endif /* CONFIG_PV */
+#endif /* CONFIG_PV32 */
 
 typedef struct e820entry e820entry_t;
 DEFINE_XEN_GUEST_HANDLE(e820entry_t);
diff --git a/xen/arch/x86/pv/callback.c b/xen/arch/x86/pv/callback.c
index 97242cd3d4..42a6aa0831 100644
--- a/xen/arch/x86/pv/callback.c
+++ b/xen/arch/x86/pv/callback.c
@@ -19,12 +19,11 @@
 #include <xen/event.h>
 #include <xen/hypercall.h>
 #include <xen/guest_access.h>
-#include <compat/callback.h>
-#include <compat/nmi.h>
 
 #include <asm/shared.h>
 
 #include <public/callback.h>
+#include <public/nmi.h>
 
 static int register_guest_nmi_callback(unsigned long address)
 {
@@ -203,6 +202,11 @@ long do_set_callbacks(unsigned long event_address,
     return 0;
 }
 
+#ifdef CONFIG_PV32
+
+#include <compat/callback.h>
+#include <compat/nmi.h>
+
 static long compat_register_guest_callback(struct compat_callback_register *reg)
 {
     long ret = 0;
@@ -343,6 +347,8 @@ long compat_set_callbacks(unsigned long event_selector,
     return 0;
 }
 
+#endif /* CONFIG_PV32 */
+
 long do_set_trap_table(XEN_GUEST_HANDLE_PARAM(const_trap_info_t) traps)
 {
     struct trap_info cur;
@@ -388,6 +394,7 @@ long do_set_trap_table(XEN_GUEST_HANDLE_PARAM(const_trap_info_t) traps)
     return rc;
 }
 
+#ifdef CONFIG_PV32
 int compat_set_trap_table(XEN_GUEST_HANDLE(trap_info_compat_t) traps)
 {
     struct vcpu *curr = current;
@@ -429,6 +436,7 @@ int compat_set_trap_table(XEN_GUEST_HANDLE(trap_info_compat_t) traps)
 
     return rc;
 }
+#endif
 
 long do_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
@@ -455,6 +463,7 @@ long do_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     return rc;
 }
 
+#ifdef CONFIG_PV32
 int compat_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
     struct compat_nmi_callback cb;
@@ -479,6 +488,7 @@ int compat_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
     return rc;
 }
+#endif
 
 /*
  * Local variables:
diff --git a/xen/arch/x86/pv/descriptor-tables.c b/xen/arch/x86/pv/descriptor-tables.c
index 39c1a2311a..5e84704400 100644
--- a/xen/arch/x86/pv/descriptor-tables.c
+++ b/xen/arch/x86/pv/descriptor-tables.c
@@ -149,6 +149,8 @@ long do_set_gdt(XEN_GUEST_HANDLE_PARAM(xen_ulong_t) frame_list,
     return ret;
 }
 
+#ifdef CONFIG_PV32
+
 int compat_set_gdt(XEN_GUEST_HANDLE_PARAM(uint) frame_list,
                    unsigned int entries)
 {
@@ -185,6 +187,18 @@ int compat_set_gdt(XEN_GUEST_HANDLE_PARAM(uint) frame_list,
     return ret;
 }
 
+int compat_update_descriptor(uint32_t pa_lo, uint32_t pa_hi,
+                             uint32_t desc_lo, uint32_t desc_hi)
+{
+    seg_desc_t d;
+
+    d.raw = ((uint64_t)desc_hi << 32) | desc_lo;
+
+    return do_update_descriptor(pa_lo | ((uint64_t)pa_hi << 32), d);
+}
+
+#endif /* CONFIG_PV32 */
+
 static bool check_descriptor(const struct domain *dom, seg_desc_t *d)
 {
     unsigned int a = d->a, b = d->b, cs, dpl;
@@ -334,16 +348,6 @@ long do_update_descriptor(uint64_t gaddr, seg_desc_t d)
     return ret;
 }
 
-int compat_update_descriptor(uint32_t pa_lo, uint32_t pa_hi,
-                             uint32_t desc_lo, uint32_t desc_hi)
-{
-    seg_desc_t d;
-
-    d.raw = ((uint64_t)desc_hi << 32) | desc_lo;
-
-    return do_update_descriptor(pa_lo | ((uint64_t)pa_hi << 32), d);
-}
-
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index 23d6009143..f1cb92585e 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -212,6 +212,7 @@ unsigned long pv_make_cr4(const struct vcpu *v)
     return cr4;
 }
 
+#ifdef CONFIG_PV32
 int switch_compat(struct domain *d)
 {
     struct vcpu *v;
@@ -256,6 +257,7 @@ int switch_compat(struct domain *d)
 
     return rc;
 }
+#endif
 
 static int pv_create_gdt_ldt_l1tab(struct vcpu *v)
 {
diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c
index 20795b4b57..5d02eebc8d 100644
--- a/xen/arch/x86/pv/hypercall.c
+++ b/xen/arch/x86/pv/hypercall.c
@@ -25,12 +25,18 @@
 #include <xen/trace.h>
 #include <irq_vectors.h>
 
+#ifdef CONFIG_PV32
 #define HYPERCALL(x)                                                \
     [ __HYPERVISOR_ ## x ] = { (hypercall_fn_t *) do_ ## x,         \
                                (hypercall_fn_t *) do_ ## x }
 #define COMPAT_CALL(x)                                              \
     [ __HYPERVISOR_ ## x ] = { (hypercall_fn_t *) do_ ## x,         \
                                (hypercall_fn_t *) compat_ ## x }
+#else
+#define HYPERCALL(x)                                                \
+    [ __HYPERVISOR_ ## x ] = { (hypercall_fn_t *) do_ ## x }
+#define COMPAT_CALL(x) HYPERCALL(x)
+#endif
 
 #define do_arch_1             paging_domctl_continuation
 
@@ -176,6 +182,7 @@ void pv_hypercall(struct cpu_user_regs *regs)
         }
 #endif
     }
+#ifdef CONFIG_PV32
     else
     {
         unsigned int ebx = regs->ebx;
@@ -225,6 +232,7 @@ void pv_hypercall(struct cpu_user_regs *regs)
         }
 #endif
     }
+#endif /* CONFIG_PV32 */
 
     /*
      * PV guests use SYSCALL or INT $0x82 to make a hypercall, both of which
@@ -255,7 +263,7 @@ enum mc_disposition arch_do_multicall_call(struct mc_state *state)
         else
             call->result = -ENOSYS;
     }
-#ifdef CONFIG_COMPAT
+#ifdef CONFIG_PV32
     else
     {
         struct compat_multicall_entry *call = &state->compat_call;
diff --git a/xen/arch/x86/pv/iret.c b/xen/arch/x86/pv/iret.c
index b508dc17b7..29a2f7cc45 100644
--- a/xen/arch/x86/pv/iret.c
+++ b/xen/arch/x86/pv/iret.c
@@ -104,6 +104,7 @@ unsigned long do_iret(void)
     return 0;
 }
 
+#ifdef CONFIG_PV32
 unsigned int compat_iret(void)
 {
     struct cpu_user_regs *regs = guest_cpu_user_regs();
@@ -223,6 +224,7 @@ unsigned int compat_iret(void)
      */
     return regs->eax;
 }
+#endif
 
 /*
  * Local variables:
diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index b4e83e0778..92cb1adeed 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -255,13 +255,17 @@ void __init pv_shim_setup_dom(struct domain *d, l4_pgentry_t *l4start,
      */
     rw_pv_hypercall_table = __va(__pa(pv_hypercall_table));
     rw_pv_hypercall_table[__HYPERVISOR_event_channel_op].native =
-        rw_pv_hypercall_table[__HYPERVISOR_event_channel_op].compat =
         (hypercall_fn_t *)pv_shim_event_channel_op;
-
     rw_pv_hypercall_table[__HYPERVISOR_grant_table_op].native =
-        rw_pv_hypercall_table[__HYPERVISOR_grant_table_op].compat =
         (hypercall_fn_t *)pv_shim_grant_table_op;
 
+#ifdef CONFIG_PV32
+    rw_pv_hypercall_table[__HYPERVISOR_event_channel_op].compat =
+        (hypercall_fn_t *)pv_shim_event_channel_op;
+    rw_pv_hypercall_table[__HYPERVISOR_grant_table_op].compat =
+        (hypercall_fn_t *)pv_shim_grant_table_op;
+#endif
+
     guest = d;
 
     /*
diff --git a/xen/include/asm-x86/compat.h b/xen/include/asm-x86/compat.h
index f9df74ece8..0c8719f9b0 100644
--- a/xen/include/asm-x86/compat.h
+++ b/xen/include/asm-x86/compat.h
@@ -6,3 +6,11 @@
 
 typedef uint32_t compat_ptr_t;
 typedef unsigned long full_ptr_t;
+
+struct domain;
+#ifdef CONFIG_PV32
+int switch_compat(struct domain *);
+#else
+#include <xen/errno.h>
+static inline int switch_compat(struct domain *d) { return -EOPNOTSUPP; }
+#endif
diff --git a/xen/include/asm-x86/hypercall.h b/xen/include/asm-x86/hypercall.h
index 1cd8046464..686f3a3803 100644
--- a/xen/include/asm-x86/hypercall.h
+++ b/xen/include/asm-x86/hypercall.h
@@ -16,7 +16,10 @@ typedef unsigned long hypercall_fn_t(
     unsigned long, unsigned long, unsigned long);
 
 typedef struct {
-    hypercall_fn_t *native, *compat;
+    hypercall_fn_t *native;
+#ifdef CONFIG_PV32
+    hypercall_fn_t *compat;
+#endif
 } hypercall_table_t;
 
 typedef struct {
diff --git a/xen/include/xen/compat.h b/xen/include/xen/compat.h
index 895e2ff68d..91db042963 100644
--- a/xen/include/xen/compat.h
+++ b/xen/include/xen/compat.h
@@ -227,9 +227,6 @@ void xlat_start_info(struct start_info *, enum XLAT_start_info_console);
 struct vcpu_runstate_info;
 void xlat_vcpu_runstate_info(struct vcpu_runstate_info *);
 
-struct domain;
-int switch_compat(struct domain *);
-
 #else
 
 #define compat_handle_is_null(hnd) 0
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 15 11:55:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Apr 2021 11:55:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111078.212343 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX0al-0007Rb-Ci; Thu, 15 Apr 2021 11:55:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111078.212343; Thu, 15 Apr 2021 11:55:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX0al-0007RT-9h; Thu, 15 Apr 2021 11:55:27 +0000
Received: by outflank-mailman (input) for mailman id 111078;
 Thu, 15 Apr 2021 11:55:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX0ak-0007RF-2Y
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 11:55:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX0ak-0007FG-1o
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 11:55:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX0aj-0001mT-Uj
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 11:55:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=chKVK3iD10VKueMa3hmpm2Wgt5MR3CDUE36qs1jKEmI=; b=kBqSW6FdybAjZLwnTemEH0UxsV
	Sozq81fxkojrylanNkFDjPtAUX1IFbTG3rs6ta7QToxCqSvVQzDRvDf+VolzIR+D3syNXPuEM9z8e
	Lia9jiqDXgV556TvRC/nfdjwe/1ins7Ey/4YZVFNxmeCRAS2QePwDG75LxmUCYY50VvA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: avoid building COMPAT code when !HVM && !PV32
Message-Id: <E1lX0aj-0001mT-Uj@xenbits.xenproject.org>
Date: Thu, 15 Apr 2021 11:55:25 +0000

commit d23d792478db4fd2984fb0b70611a2e97eceaa8c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 15 13:43:51 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 15 13:43:51 2021 +0200

    x86: avoid building COMPAT code when !HVM && !PV32
    
    It was probably a mistake to, over time, drop various CONFIG_COMPAT
    conditionals from x86-specific code, as we now have a build
    configuration again where we'd prefer this to be unset. Arrange for
    CONFIG_COMPAT to actually be off in this case, dealing with fallout.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Wei Liu <wl@xen.org>
---
 xen/arch/x86/Kconfig              |  4 +++-
 xen/arch/x86/Makefile             |  6 ++++--
 xen/arch/x86/cpu/mcheck/mce.c     | 11 +++++++++++
 xen/arch/x86/cpu/vpmu.c           |  6 ++++++
 xen/arch/x86/domain.c             | 28 +++++++++++++++++++++++++++-
 xen/arch/x86/domctl.c             | 12 ++++++++++++
 xen/arch/x86/efi/Makefile         |  9 +++++----
 xen/arch/x86/hypercall.c          |  9 +++++++++
 xen/arch/x86/oprofile/backtrace.c |  4 +++-
 xen/arch/x86/oprofile/xenoprof.c  |  5 ++++-
 xen/arch/x86/pv/dom0_build.c      |  2 ++
 xen/arch/x86/setup.c              |  4 ++++
 xen/arch/x86/x86_64/Makefile      |  6 +++---
 xen/arch/x86/x86_64/mm.c          |  2 ++
 xen/common/Kconfig                |  3 +++
 xen/common/time.c                 |  2 +-
 xen/include/asm-x86/compat.h      |  4 ++++
 xen/include/asm-x86/hypercall.h   |  5 ++++-
 xen/include/asm-x86/shared.h      | 30 ++++++++++++++++++++++++++++++
 xen/include/xen/compat.h          |  7 +++++--
 xen/include/xen/sched.h           |  3 +--
 21 files changed, 143 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index f79e6634db..cb401fa2e5 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -6,9 +6,9 @@ config X86
 	select ACPI
 	select ACPI_LEGACY_TABLES_LOOKUP
 	select ARCH_SUPPORTS_INT128
-	select COMPAT
 	select CORE_PARKING
 	select HAS_ALTERNATIVE
+	select HAS_COMPAT
 	select HAS_CPUFREQ
 	select HAS_EHCI
 	select HAS_EX_TABLE
@@ -57,6 +57,7 @@ config PV32
 	bool "Support for 32bit PV guests"
 	depends on PV
 	default y
+	select COMPAT
 	---help---
 	  The 32bit PV ABI uses Ring1, an area of the x86 architecture which
 	  was deprecated and mostly removed in the AMD64 spec.  As a result,
@@ -91,6 +92,7 @@ config PV_LINEAR_PT
 
 config HVM
 	def_bool !PV_SHIM_EXCLUSIVE
+	select COMPAT
 	select IOREQ_SERVER
 	prompt "HVM support"
 	---help---
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 399ee508c2..053206e4f0 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -50,7 +50,8 @@ obj-y += nmi.o
 obj-y += numa.o
 obj-y += pci.o
 obj-y += percpu.o
-obj-y += physdev.o x86_64/physdev.o
+obj-y += physdev.o
+obj-$(CONFIG_COMPAT) += x86_64/physdev.o
 obj-y += psr.o
 obj-y += setup.o
 obj-y += shutdown.o
@@ -72,7 +73,8 @@ obj-y += xstate.o
 
 ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
 obj-y += domctl.o
-obj-y += platform_hypercall.o x86_64/platform_hypercall.o
+obj-y += platform_hypercall.o
+obj-$(CONFIG_COMPAT) += x86_64/platform_hypercall.o
 obj-y += sysctl.o
 endif
 
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 3a92e9db4e..7f433343bc 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -1291,6 +1291,8 @@ static void x86_mc_mceinject(void *data)
 #error BITS_PER_LONG definition absent
 #endif
 
+# ifdef CONFIG_COMPAT
+
 # include <compat/arch-x86/xen-mca.h>
 
 # define xen_mcinfo_msr              mcinfo_msr
@@ -1343,6 +1345,11 @@ CHECK_mcinfo_recovery;
 # undef xen_page_offline_action
 # undef xen_mcinfo_recovery
 
+# else
+#  define compat_handle_is_null(h) true
+#  define copy_to_compat(h, p, n)  true /* really (-EFAULT), but gcc chokes */
+# endif /* CONFIG_COMPAT */
+
 /* Machine Check Architecture Hypercall */
 long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc)
 {
@@ -1351,11 +1358,15 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc)
     struct vcpu *v = current;
     union {
         struct xen_mc_fetch *nat;
+#ifdef CONFIG_COMPAT
         struct compat_mc_fetch *cmp;
+#endif
     } mc_fetch;
     union {
         struct xen_mc_physcpuinfo *nat;
+#ifdef CONFIG_COMPAT
         struct compat_mc_physcpuinfo *cmp;
+#endif
     } mc_physcpuinfo;
     uint32_t flags, cmdflags;
     int nlcpu;
diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c
index ab667361d3..d8659c63f8 100644
--- a/xen/arch/x86/cpu/vpmu.c
+++ b/xen/arch/x86/cpu/vpmu.c
@@ -39,10 +39,12 @@
 #include <public/pmu.h>
 #include <xsm/xsm.h>
 
+#ifdef CONFIG_COMPAT
 #include <compat/pmu.h>
 CHECK_pmu_cntr_pair;
 CHECK_pmu_data;
 CHECK_pmu_params;
+#endif
 
 static unsigned int __read_mostly opt_vpmu_enabled;
 unsigned int __read_mostly vpmu_mode = XENPMU_MODE_OFF;
@@ -232,6 +234,7 @@ void vpmu_do_interrupt(struct cpu_user_regs *regs)
             domid = sampled->domain->domain_id;
 
         /* Store appropriate registers in xenpmu_data */
+#ifdef CONFIG_COMPAT
         /* FIXME: 32-bit PVH should go here as well */
         if ( is_pv_32bit_vcpu(sampling) )
         {
@@ -254,6 +257,7 @@ void vpmu_do_interrupt(struct cpu_user_regs *regs)
                 *flags |= PMU_SAMPLE_USER;
         }
         else
+#endif
         {
             struct xen_pmu_regs *r = &vpmu->xenpmu_data->pmu.r.regs;
 
@@ -448,7 +452,9 @@ static int vpmu_arch_initialise(struct vcpu *v)
     BUILD_BUG_ON(sizeof(struct xen_pmu_intel_ctxt) > XENPMU_CTXT_PAD_SZ);
     BUILD_BUG_ON(sizeof(struct xen_pmu_amd_ctxt) > XENPMU_CTXT_PAD_SZ);
     BUILD_BUG_ON(sizeof(struct xen_pmu_regs) > XENPMU_REGS_PAD_SZ);
+#ifdef CONFIG_COMPAT
     BUILD_BUG_ON(sizeof(struct compat_pmu_regs) > XENPMU_REGS_PAD_SZ);
+#endif
 
     ASSERT(!(vpmu->flags & ~VPMU_AVAILABLE) && !vpmu->context);
 
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index b212729880..40e8ce7544 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -64,7 +64,9 @@
 #include <asm/amd.h>
 #include <xen/numa.h>
 #include <xen/iommu.h>
+#ifdef CONFIG_COMPAT
 #include <compat/vcpu.h>
+#endif
 #include <asm/psr.h>
 #include <asm/pv/domain.h>
 #include <asm/pv/mm.h>
@@ -1020,11 +1022,13 @@ void arch_domain_creation_finished(struct domain *d)
         hvm_domain_creation_finished(d);
 }
 
+#ifdef CONFIG_COMPAT
 #define xen_vcpu_guest_context vcpu_guest_context
 #define fpu_ctxt fpu_ctxt.x
 CHECK_FIELD_(struct, vcpu_guest_context, fpu_ctxt);
 #undef fpu_ctxt
 #undef xen_vcpu_guest_context
+#endif
 
 /* Called by XEN_DOMCTL_setvcpucontext and VCPUOP_initialise. */
 int arch_set_info_guest(
@@ -1045,7 +1049,11 @@ int arch_set_info_guest(
      * we expect the tools to DTRT even in compat-mode callers. */
     compat = is_pv_32bit_domain(d);
 
+#ifdef CONFIG_COMPAT
 #define c(fld) (compat ? (c.cmp->fld) : (c.nat->fld))
+#else
+#define c(fld) (c.nat->fld)
+#endif
     flags = c(flags);
 
     if ( is_pv_domain(d) )
@@ -1078,6 +1086,7 @@ int arch_set_info_guest(
             if ( !__addr_ok(c.nat->ldt_base) )
                 return -EINVAL;
         }
+#ifdef CONFIG_COMPAT
         else
         {
             fixup_guest_stack_selector(d, c.cmp->user_regs.ss);
@@ -1089,6 +1098,7 @@ int arch_set_info_guest(
             for ( i = 0; i < ARRAY_SIZE(c.cmp->trap_ctxt); i++ )
                 fixup_guest_code_selector(d, c.cmp->trap_ctxt[i].cs);
         }
+#endif
 
         /* LDT safety checks. */
         if ( ((c(ldt_base) & (PAGE_SIZE - 1)) != 0) ||
@@ -1119,6 +1129,7 @@ int arch_set_info_guest(
             memcpy(v->arch.pv.trap_ctxt, c.nat->trap_ctxt,
                    sizeof(c.nat->trap_ctxt));
     }
+#ifdef CONFIG_COMPAT
     else
     {
         XLAT_cpu_user_regs(&v->arch.user_regs, &c.cmp->user_regs);
@@ -1129,6 +1140,7 @@ int arch_set_info_guest(
                                c.cmp->trap_ctxt + i);
         }
     }
+#endif
 
     if ( v->vcpu_id == 0 && (c(vm_assist) & ~arch_vm_assist_valid_mask(d)) )
         return -EINVAL;
@@ -1184,13 +1196,17 @@ int arch_set_info_guest(
                 pfn = pagetable_get_pfn(v->arch.guest_table_user);
                 fail |= xen_pfn_to_cr3(pfn) != c.nat->ctrlreg[1];
             }
-        } else {
+        }
+#ifdef CONFIG_COMPAT
+        else
+        {
             l4_pgentry_t *l4tab = map_domain_page(_mfn(pfn));
 
             pfn = l4e_get_pfn(*l4tab);
             unmap_domain_page(l4tab);
             fail = compat_pfn_to_cr3(pfn) != c.cmp->ctrlreg[3];
         }
+#endif
 
         fail |= v->arch.pv.gdt_ents != c(gdt_ents);
         for ( i = 0; !fail && i < nr_gdt_frames; ++i )
@@ -1293,6 +1309,7 @@ int arch_set_info_guest(
 
     if ( !compat )
         rc = pv_set_gdt(v, c.nat->gdt_frames, c.nat->gdt_ents);
+#ifdef CONFIG_COMPAT
     else
     {
         unsigned long gdt_frames[ARRAY_SIZE(v->arch.pv.gdt_frames)];
@@ -1302,6 +1319,7 @@ int arch_set_info_guest(
 
         rc = pv_set_gdt(v, gdt_frames, c.cmp->gdt_ents);
     }
+#endif
     if ( rc != 0 )
         return rc;
 
@@ -1309,8 +1327,10 @@ int arch_set_info_guest(
 
     if ( !compat )
         cr3_mfn = _mfn(xen_cr3_to_pfn(c.nat->ctrlreg[3]));
+#ifdef CONFIG_COMPAT
     else
         cr3_mfn = _mfn(compat_cr3_to_pfn(c.cmp->ctrlreg[3]));
+#endif
     cr3_page = get_page_from_mfn(cr3_mfn, d);
 
     if ( !cr3_page )
@@ -1817,9 +1837,13 @@ bool update_runstate_area(struct vcpu *v)
 
     if ( VM_ASSIST(v->domain, runstate_update_flag) )
     {
+#ifdef CONFIG_COMPAT
         guest_handle = has_32bit_shinfo(v->domain)
             ? &v->runstate_guest.compat.p->state_entry_time + 1
             : &v->runstate_guest.native.p->state_entry_time + 1;
+#else
+        guest_handle = &v->runstate_guest.p->state_entry_time + 1;
+#endif
         guest_handle--;
         runstate.state_entry_time |= XEN_RUNSTATE_UPDATE;
         __raw_copy_to_guest(guest_handle,
@@ -1827,6 +1851,7 @@ bool update_runstate_area(struct vcpu *v)
         smp_wmb();
     }
 
+#ifdef CONFIG_COMPAT
     if ( has_32bit_shinfo(v->domain) )
     {
         struct compat_vcpu_runstate_info info;
@@ -1836,6 +1861,7 @@ bool update_runstate_area(struct vcpu *v)
         rc = true;
     }
     else
+#endif
         rc = __copy_to_guest(runstate_guest(v), &runstate, 1) !=
              sizeof(runstate);
 
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 2aea5b6e9a..e440bd021e 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1386,18 +1386,24 @@ long arch_do_domctl(
     return ret;
 }
 
+#ifdef CONFIG_COMPAT
 #define xen_vcpu_guest_context vcpu_guest_context
 #define fpu_ctxt fpu_ctxt.x
 CHECK_FIELD_(struct, vcpu_guest_context, fpu_ctxt);
 #undef fpu_ctxt
 #undef xen_vcpu_guest_context
+#endif
 
 void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
 {
     unsigned int i;
     const struct domain *d = v->domain;
     bool compat = is_pv_32bit_domain(d);
+#ifdef CONFIG_COMPAT
 #define c(fld) (!compat ? (c.nat->fld) : (c.cmp->fld))
+#else
+#define c(fld) (c.nat->fld)
+#endif
 
     memcpy(&c.nat->fpu_ctxt, v->arch.fpu_ctxt, sizeof(c.nat->fpu_ctxt));
     if ( is_pv_domain(d) )
@@ -1415,6 +1421,7 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
             memcpy(c.nat->trap_ctxt, v->arch.pv.trap_ctxt,
                    sizeof(c.nat->trap_ctxt));
     }
+#ifdef CONFIG_COMPAT
     else
     {
         XLAT_cpu_user_regs(&c.cmp->user_regs, &v->arch.user_regs);
@@ -1425,6 +1432,7 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
                                v->arch.pv.trap_ctxt + i);
         }
     }
+#endif
 
     for ( i = 0; i < ARRAY_SIZE(v->arch.dr); ++i )
         c(debugreg[i] = v->arch.dr[i]);
@@ -1470,8 +1478,10 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
         c(ldt_ents = v->arch.pv.ldt_ents);
         for ( i = 0; i < ARRAY_SIZE(v->arch.pv.gdt_frames); ++i )
             c(gdt_frames[i] = v->arch.pv.gdt_frames[i]);
+#ifdef CONFIG_COMPAT
         BUILD_BUG_ON(ARRAY_SIZE(c.nat->gdt_frames) !=
                      ARRAY_SIZE(c.cmp->gdt_frames));
+#endif
         for ( ; i < ARRAY_SIZE(c.nat->gdt_frames); ++i )
             c(gdt_frames[i] = 0);
         c(gdt_ents = v->arch.pv.gdt_ents);
@@ -1506,6 +1516,7 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
                 pagetable_is_null(v->arch.guest_table_user) ? 0
                 : xen_pfn_to_cr3(pagetable_get_pfn(v->arch.guest_table_user));
         }
+#ifdef CONFIG_COMPAT
         else
         {
             const l4_pgentry_t *l4e =
@@ -1514,6 +1525,7 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
             c.cmp->ctrlreg[3] = compat_pfn_to_cr3(l4e_get_pfn(*l4e));
             unmap_domain_page(l4e);
         }
+#endif
 
         if ( guest_kernel_mode(v, &v->arch.user_regs) )
             c(flags |= VGCF_in_kernel);
diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile
index e857c0f2cc..87b927ed86 100644
--- a/xen/arch/x86/efi/Makefile
+++ b/xen/arch/x86/efi/Makefile
@@ -8,13 +8,14 @@ cmd_objcopy_o_ihex = $(OBJCOPY) -I ihex -O binary $< $@
 
 boot.init.o: buildid.o
 
-EFIOBJ := boot.init.o pe.init.o ebmalloc.o compat.o runtime.o
+EFIOBJ-y := boot.init.o pe.init.o ebmalloc.o runtime.o
+EFIOBJ-$(CONFIG_COMPAT) += compat.o
 
 $(call cc-option-add,cflags-stack-boundary,CC,-mpreferred-stack-boundary=4)
-$(EFIOBJ): CFLAGS-stack-boundary := $(cflags-stack-boundary)
+$(EFIOBJ-y): CFLAGS-stack-boundary := $(cflags-stack-boundary)
 
 obj-y := stub.o
-obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ))
-obj-bin-$(XEN_BUILD_EFI) := $(filter %.init.o,$(EFIOBJ))
+obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ-y))
+obj-bin-$(XEN_BUILD_EFI) := $(filter %.init.o,$(EFIOBJ-y))
 extra-$(XEN_BUILD_EFI) += buildid.o relocs-dummy.o
 nocov-$(XEN_BUILD_EFI) += stub.o
diff --git a/xen/arch/x86/hypercall.c b/xen/arch/x86/hypercall.c
index 14da9bc4ad..73c1bcb147 100644
--- a/xen/arch/x86/hypercall.c
+++ b/xen/arch/x86/hypercall.c
@@ -21,10 +21,15 @@
 
 #include <xen/hypercall.h>
 
+#ifdef CONFIG_COMPAT
 #define ARGS(x, n)                              \
     [ __HYPERVISOR_ ## x ] = { n, n }
 #define COMP(x, n, c)                           \
     [ __HYPERVISOR_ ## x ] = { n, c }
+#else
+#define ARGS(x, n)    [ __HYPERVISOR_ ## x ] = { n }
+#define COMP(x, n, c) ARGS(x, n)
+#endif
 
 const hypercall_args_t hypercall_args_table[NR_hypercalls] =
 {
@@ -113,7 +118,11 @@ unsigned long hypercall_create_continuation(
 
         regs->rax = op;
 
+#ifdef CONFIG_COMPAT
         if ( !curr->hcall_compat )
+#else
+        if ( true )
+#endif
         {
             for ( i = 0; *p != '\0'; i++ )
             {
diff --git a/xen/arch/x86/oprofile/backtrace.c b/xen/arch/x86/oprofile/backtrace.c
index 8233d87caa..929bf51a40 100644
--- a/xen/arch/x86/oprofile/backtrace.c
+++ b/xen/arch/x86/oprofile/backtrace.c
@@ -27,7 +27,6 @@ struct __packed frame_head_32bit {
     uint32_t ret;
 };
 typedef struct frame_head_32bit frame_head32_t;
-DEFINE_COMPAT_HANDLE(frame_head32_t);
 
 static struct frame_head *
 dump_hypervisor_backtrace(struct vcpu *vcpu, const struct frame_head *head,
@@ -58,8 +57,10 @@ dump_guest_backtrace(struct vcpu *vcpu, const struct frame_head *head,
 {
     frame_head_t bufhead;
 
+#ifdef CONFIG_COMPAT
     if ( is_32bit_vcpu(vcpu) )
     {
+        DEFINE_COMPAT_HANDLE(frame_head32_t);
         __compat_handle_const_frame_head32_t guest_head =
             { .c = (unsigned long)head };
         frame_head32_t bufhead32;
@@ -73,6 +74,7 @@ dump_guest_backtrace(struct vcpu *vcpu, const struct frame_head *head,
         bufhead.ret = bufhead32.ret;
     }
     else
+#endif
     {
         XEN_GUEST_HANDLE_PARAM(const_frame_head_t) guest_head =
             const_guest_handle_from_ptr(head, frame_head_t);
diff --git a/xen/arch/x86/oprofile/xenoprof.c b/xen/arch/x86/oprofile/xenoprof.c
index cca759b54f..b20f26bbe5 100644
--- a/xen/arch/x86/oprofile/xenoprof.c
+++ b/xen/arch/x86/oprofile/xenoprof.c
@@ -12,7 +12,6 @@
 #include <xen/sched.h>
 #include <xen/xenoprof.h>
 #include <public/xenoprof.h>
-#include <compat/xenoprof.h>
 #include <asm/hvm/support.h>
 
 #include "op_counter.h"
@@ -54,6 +53,9 @@ int xenoprof_arch_ibs_counter(XEN_GUEST_HANDLE_PARAM(void) arg)
     return 0;
 }
 
+#ifdef CONFIG_COMPAT
+#include <compat/xenoprof.h>
+
 int compat_oprof_arch_counter(XEN_GUEST_HANDLE_PARAM(void) arg)
 {
     struct compat_oprof_counter counter;
@@ -73,6 +75,7 @@ int compat_oprof_arch_counter(XEN_GUEST_HANDLE_PARAM(void) arg)
 
     return 0;
 }
+#endif
 
 int xenoprofile_get_mode(struct vcpu *curr, const struct cpu_user_regs *regs)
 {
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index f7165309a2..265f56a3f8 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -877,9 +877,11 @@ int __init dom0_construct_pv(struct domain *d,
         pv_shim_setup_dom(d, l4start, v_start, vxenstore_start, vconsole_start,
                           vphysmap_start, si);
 
+#ifdef CONFIG_COMPAT
     if ( is_pv_32bit_domain(d) )
         xlat_start_info(si, pv_shim ? XLAT_start_info_console_domU
                                     : XLAT_start_info_console_dom0);
+#endif
 
     /* Return to idle domain's page tables. */
     mapcache_override_current(NULL);
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 68454df8ed..a6658d9769 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -27,8 +27,10 @@
 #include <xen/virtual_region.h>
 #include <xen/watchdog.h>
 #include <public/version.h>
+#ifdef CONFIG_COMPAT
 #include <compat/platform.h>
 #include <compat/xen.h>
+#endif
 #include <xen/bitops.h>
 #include <asm/smp.h>
 #include <asm/processor.h>
@@ -1615,10 +1617,12 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     BUILD_BUG_ON(sizeof(shared_info_t) > PAGE_SIZE);
     BUILD_BUG_ON(sizeof(struct vcpu_info) != 64);
 
+#ifdef CONFIG_COMPAT
     BUILD_BUG_ON(sizeof_field(struct compat_platform_op, u) !=
                  sizeof_field(struct compat_platform_op, u.pad));
     BUILD_BUG_ON(sizeof(start_info_compat_t) > PAGE_SIZE);
     BUILD_BUG_ON(sizeof(struct compat_vcpu_info) != 64);
+#endif
 
     /* Check definitions in public headers match internal defs. */
     BUILD_BUG_ON(__HYPERVISOR_VIRT_START != HYPERVISOR_VIRT_START);
diff --git a/xen/arch/x86/x86_64/Makefile b/xen/arch/x86/x86_64/Makefile
index 2ea536fa71..213b789c42 100644
--- a/xen/arch/x86/x86_64/Makefile
+++ b/xen/arch/x86/x86_64/Makefile
@@ -8,9 +8,9 @@ obj-y += acpi_mmcfg.o
 obj-y += mmconf-fam10h.o
 obj-y += mmconfig_64.o
 obj-y += mmconfig-shared.o
-obj-y += domain.o
-obj-y += cpu_idle.o
-obj-y += cpufreq.o
+obj-$(CONFIG_COMPAT) += domain.o
+obj-$(CONFIG_COMPAT) += cpu_idle.o
+obj-$(CONFIG_COMPAT) += cpufreq.o
 obj-bin-$(CONFIG_KEXEC) += kexec_reloc.o
 
 obj-$(CONFIG_CRASH_DEBUG)   += gdbstub.o
diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index bce1561e1a..d7e67311fa 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -1347,7 +1347,9 @@ void set_gpfn_from_mfn(unsigned long mfn, unsigned long pfn)
     machine_to_phys_mapping[mfn] = entry;
 }
 
+#ifdef CONFIG_COMPAT
 #include "compat/mm.c"
+#endif
 
 /*
  * Local variables:
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index a1755cd380..3064bf6b89 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -25,6 +25,9 @@ config GRANT_TABLE
 config HAS_ALTERNATIVE
 	bool
 
+config HAS_COMPAT
+	bool
+
 config HAS_DEVICE_TREE
 	bool
 
diff --git a/xen/common/time.c b/xen/common/time.c
index 82336e2d5a..22379f4ae2 100644
--- a/xen/common/time.c
+++ b/xen/common/time.c
@@ -108,7 +108,7 @@ void update_domain_wallclock_time(struct domain *d)
     sec = wc_sec + d->time_offset.seconds;
     shared_info(d, wc_sec)    = sec;
     shared_info(d, wc_nsec)   = wc_nsec;
-#ifdef CONFIG_X86
+#if defined(CONFIG_X86) && defined(CONFIG_COMPAT)
     if ( likely(!has_32bit_shinfo(d)) )
         d->shared_info->native.wc_sec_hi = sec >> 32;
     else
diff --git a/xen/include/asm-x86/compat.h b/xen/include/asm-x86/compat.h
index 0c8719f9b0..818cad87db 100644
--- a/xen/include/asm-x86/compat.h
+++ b/xen/include/asm-x86/compat.h
@@ -2,11 +2,15 @@
  * compat.h
  */
 
+#ifdef CONFIG_COMPAT
+
 #define COMPAT_BITS_PER_LONG 32
 
 typedef uint32_t compat_ptr_t;
 typedef unsigned long full_ptr_t;
 
+#endif
+
 struct domain;
 #ifdef CONFIG_PV32
 int switch_compat(struct domain *);
diff --git a/xen/include/asm-x86/hypercall.h b/xen/include/asm-x86/hypercall.h
index 686f3a3803..39e7ab7022 100644
--- a/xen/include/asm-x86/hypercall.h
+++ b/xen/include/asm-x86/hypercall.h
@@ -23,7 +23,10 @@ typedef struct {
 } hypercall_table_t;
 
 typedef struct {
-    uint8_t native, compat;
+    uint8_t native;
+#ifdef CONFIG_COMPAT
+    uint8_t compat;
+#endif
 } hypercall_args_t;
 
 extern const hypercall_args_t hypercall_args_table[NR_hypercalls];
diff --git a/xen/include/asm-x86/shared.h b/xen/include/asm-x86/shared.h
index af5d959d04..dd3ae8c263 100644
--- a/xen/include/asm-x86/shared.h
+++ b/xen/include/asm-x86/shared.h
@@ -1,6 +1,8 @@
 #ifndef __XEN_X86_SHARED_H__
 #define __XEN_X86_SHARED_H__
 
+#ifdef CONFIG_COMPAT
+
 #define nmi_reason(d) (!has_32bit_shinfo(d) ?                             \
                        (u32 *)&(d)->shared_info->native.arch.nmi_reason : \
                        (u32 *)&(d)->shared_info->compat.arch.nmi_reason)
@@ -37,6 +39,34 @@ static inline void arch_set_##field(struct vcpu *v,             \
         v->vcpu_info->compat.arch.field = val;                  \
 }
 
+#else
+
+#define nmi_reason(d) (&(d)->shared_info->arch.nmi_reason)
+
+#define GET_SET_SHARED(type, field)                         \
+static inline type arch_get_##field(const struct domain *d) \
+{                                                           \
+    return d->shared_info->arch.field;                      \
+}                                                           \
+static inline void arch_set_##field(struct domain *d,       \
+                                    type val)               \
+{                                                           \
+    d->shared_info->arch.field = val;                       \
+}
+
+#define GET_SET_VCPU(type, field)                           \
+static inline type arch_get_##field(const struct vcpu *v)   \
+{                                                           \
+    return v->vcpu_info->arch.field;                        \
+}                                                           \
+static inline void arch_set_##field(struct vcpu *v,         \
+                                    type val)               \
+{                                                           \
+    v->vcpu_info->arch.field = val;                         \
+}
+
+#endif
+
 GET_SET_SHARED(unsigned long, max_pfn)
 GET_SET_SHARED(xen_pfn_t, pfn_to_mfn_frame_list_list)
 GET_SET_SHARED(unsigned long, nmi_reason)
diff --git a/xen/include/xen/compat.h b/xen/include/xen/compat.h
index 91db042963..f2ce5bb358 100644
--- a/xen/include/xen/compat.h
+++ b/xen/include/xen/compat.h
@@ -5,10 +5,13 @@
 #ifndef __XEN_COMPAT_H__
 #define __XEN_COMPAT_H__
 
-#ifdef CONFIG_COMPAT
-
 #include <xen/types.h>
+#ifdef CONFIG_HAS_COMPAT
 #include <asm/compat.h>
+#endif
+
+#ifdef CONFIG_COMPAT
+
 #include <compat/xlat.h>
 
 #define __DEFINE_COMPAT_HANDLE(name, type) \
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 5485d08afb..cc633fdc07 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -1047,7 +1047,6 @@ static always_inline bool is_pv_vcpu(const struct vcpu *v)
     return is_pv_domain(v->domain);
 }
 
-#ifdef CONFIG_COMPAT
 static always_inline bool is_pv_32bit_domain(const struct domain *d)
 {
 #ifdef CONFIG_PV32
@@ -1078,7 +1077,7 @@ static always_inline bool is_pv_64bit_vcpu(const struct vcpu *v)
 {
     return is_pv_64bit_domain(v->domain);
 }
-#endif
+
 static always_inline bool is_hvm_domain(const struct domain *d)
 {
     return IS_ENABLED(CONFIG_HVM) &&
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 15 11:55:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Apr 2021 11:55:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111079.212347 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX0av-0007TK-Fm; Thu, 15 Apr 2021 11:55:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111079.212347; Thu, 15 Apr 2021 11:55:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX0av-0007TC-Cm; Thu, 15 Apr 2021 11:55:37 +0000
Received: by outflank-mailman (input) for mailman id 111079;
 Thu, 15 Apr 2021 11:55:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX0au-0007T4-7R
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 11:55:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX0au-0007Fj-4u
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 11:55:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX0au-0001nE-40
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 11:55:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uRIzn3M6fd5KuX2OWwBLrA321F4afTsJr+sydiHY+dY=; b=nADcpc4exlxjQDEV2db2/nA7UV
	xL7JUG0nTEMSlK8OHfUM/OKJ6KXarW9QylHRAH0oBI0r98TOFk3qv9URmfQ2dWw9pIELZOLESwyQt
	YbFeZFbR0cOBLuKC92STS/80gucRMtTDZSIkpBFJtyXR0toVKHTbYuLIQNJqyDxLs318=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/amd: split LFENCE dispatch serializing setup logic into helper
Message-Id: <E1lX0au-0001nE-40@xenbits.xenproject.org>
Date: Thu, 15 Apr 2021 11:55:36 +0000

commit 3e9460ec93341fa6a80ecf99832aa5d9975339c9
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Apr 15 13:45:09 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 15 13:45:09 2021 +0200

    x86/amd: split LFENCE dispatch serializing setup logic into helper
    
    Split the logic to attempt to setup LFENCE to be dispatch serializing
    on AMD into a helper, so it can be shared with Hygon.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu/amd.c   | 62 ++++++++++++++++++++++++++----------------------
 xen/arch/x86/cpu/cpu.h   |  1 +
 xen/arch/x86/cpu/hygon.c | 27 +--------------------
 3 files changed, 36 insertions(+), 54 deletions(-)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 8bc51bec10..9c8dcd91ee 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -642,6 +642,38 @@ void early_init_amd(struct cpuinfo_x86 *c)
 	ctxt_switch_levelling(NULL);
 }
 
+void amd_init_lfence(struct cpuinfo_x86 *c)
+{
+	uint64_t value;
+
+	/*
+	 * Attempt to set lfence to be Dispatch Serialising.  This MSR almost
+	 * certainly isn't virtualised (and Xen at least will leak the real
+	 * value in but silently discard writes), as well as being per-core
+	 * rather than per-thread, so do a full safe read/write/readback cycle
+	 * in the worst case.
+	 */
+	if (rdmsr_safe(MSR_AMD64_DE_CFG, value))
+		/* Unable to read.  Assume the safer default. */
+		__clear_bit(X86_FEATURE_LFENCE_DISPATCH,
+			    c->x86_capability);
+	else if (value & AMD64_DE_CFG_LFENCE_SERIALISE)
+		/* Already dispatch serialising. */
+		__set_bit(X86_FEATURE_LFENCE_DISPATCH,
+			  c->x86_capability);
+	else if (wrmsr_safe(MSR_AMD64_DE_CFG,
+			    value | AMD64_DE_CFG_LFENCE_SERIALISE) ||
+		 rdmsr_safe(MSR_AMD64_DE_CFG, value) ||
+		 !(value & AMD64_DE_CFG_LFENCE_SERIALISE))
+		/* Attempt to set failed.  Assume the safer default. */
+		__clear_bit(X86_FEATURE_LFENCE_DISPATCH,
+			    c->x86_capability);
+	else
+		/* Successfully enabled! */
+		__set_bit(X86_FEATURE_LFENCE_DISPATCH,
+			  c->x86_capability);
+}
+
 static void init_amd(struct cpuinfo_x86 *c)
 {
 	u32 l, h;
@@ -686,37 +718,11 @@ static void init_amd(struct cpuinfo_x86 *c)
 	if (c == &boot_cpu_data && !cpu_has(c, X86_FEATURE_RSTR_FP_ERR_PTRS))
 		setup_force_cpu_cap(X86_BUG_FPU_PTRS);
 
-	/*
-	 * Attempt to set lfence to be Dispatch Serialising.  This MSR almost
-	 * certainly isn't virtualised (and Xen at least will leak the real
-	 * value in but silently discard writes), as well as being per-core
-	 * rather than per-thread, so do a full safe read/write/readback cycle
-	 * in the worst case.
-	 */
 	if (c->x86 == 0x0f || c->x86 == 0x11)
 		/* Always dispatch serialising on this hardare. */
 		__set_bit(X86_FEATURE_LFENCE_DISPATCH, c->x86_capability);
-	else /* Implicily "== 0x10 || >= 0x12" by being 64bit. */ {
-		if (rdmsr_safe(MSR_AMD64_DE_CFG, value))
-			/* Unable to read.  Assume the safer default. */
-			__clear_bit(X86_FEATURE_LFENCE_DISPATCH,
-				    c->x86_capability);
-		else if (value & AMD64_DE_CFG_LFENCE_SERIALISE)
-			/* Already dispatch serialising. */
-			__set_bit(X86_FEATURE_LFENCE_DISPATCH,
-				  c->x86_capability);
-		else if (wrmsr_safe(MSR_AMD64_DE_CFG,
-				    value | AMD64_DE_CFG_LFENCE_SERIALISE) ||
-			 rdmsr_safe(MSR_AMD64_DE_CFG, value) ||
-			 !(value & AMD64_DE_CFG_LFENCE_SERIALISE))
-			/* Attempt to set failed.  Assume the safer default. */
-			__clear_bit(X86_FEATURE_LFENCE_DISPATCH,
-				    c->x86_capability);
-		else
-			/* Successfully enabled! */
-			__set_bit(X86_FEATURE_LFENCE_DISPATCH,
-				  c->x86_capability);
-	}
+	else /* Implicily "== 0x10 || >= 0x12" by being 64bit. */
+		amd_init_lfence(c);
 
 	/*
 	 * If the user has explicitly chosen to disable Memory Disambiguation
diff --git a/xen/arch/x86/cpu/cpu.h b/xen/arch/x86/cpu/cpu.h
index 1992596d1b..1ac3b2867a 100644
--- a/xen/arch/x86/cpu/cpu.h
+++ b/xen/arch/x86/cpu/cpu.h
@@ -20,3 +20,4 @@ extern bool detect_extended_topology(struct cpuinfo_x86 *c);
 
 void early_init_amd(struct cpuinfo_x86 *c);
 void amd_log_freq(const struct cpuinfo_x86 *c);
+void amd_init_lfence(struct cpuinfo_x86 *c);
diff --git a/xen/arch/x86/cpu/hygon.c b/xen/arch/x86/cpu/hygon.c
index 46293f1f36..2272e1113f 100644
--- a/xen/arch/x86/cpu/hygon.c
+++ b/xen/arch/x86/cpu/hygon.c
@@ -32,32 +32,7 @@ static void init_hygon(struct cpuinfo_x86 *c)
 {
 	unsigned long long value;
 
-	/*
-	 * Attempt to set lfence to be Dispatch Serialising.  This MSR almost
-	 * certainly isn't virtualised (and Xen at least will leak the real
-	 * value in but silently discard writes), as well as being per-core
-	 * rather than per-thread, so do a full safe read/write/readback cycle
-	 * in the worst case.
-	 */
-	if (rdmsr_safe(MSR_AMD64_DE_CFG, value))
-		/* Unable to read.  Assume the safer default. */
-		__clear_bit(X86_FEATURE_LFENCE_DISPATCH,
-			    c->x86_capability);
-	else if (value & AMD64_DE_CFG_LFENCE_SERIALISE)
-		/* Already dispatch serialising. */
-		__set_bit(X86_FEATURE_LFENCE_DISPATCH,
-			  c->x86_capability);
-	else if (wrmsr_safe(MSR_AMD64_DE_CFG,
-			    value | AMD64_DE_CFG_LFENCE_SERIALISE) ||
-		 rdmsr_safe(MSR_AMD64_DE_CFG, value) ||
-		 !(value & AMD64_DE_CFG_LFENCE_SERIALISE))
-		/* Attempt to set failed.  Assume the safer default. */
-		__clear_bit(X86_FEATURE_LFENCE_DISPATCH,
-			    c->x86_capability);
-	else
-		/* Successfully enabled! */
-		__set_bit(X86_FEATURE_LFENCE_DISPATCH,
-			  c->x86_capability);
+	amd_init_lfence(c);
 
 	/*
 	 * If the user has explicitly chosen to disable Memory Disambiguation
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 15 17:22:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Apr 2021 17:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111448.213164 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX5gu-0003RL-1T; Thu, 15 Apr 2021 17:22:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111448.213164; Thu, 15 Apr 2021 17:22:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX5gt-0003RD-UY; Thu, 15 Apr 2021 17:22:07 +0000
Received: by outflank-mailman (input) for mailman id 111448;
 Thu, 15 Apr 2021 17:22:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5gs-0003R8-SC
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:22:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5gs-0005Kl-RG
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:22:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5gs-0008GC-P9
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:22:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=n2LZIM5hjyh59OyPPD4FGz/Sdq4ZYgCW2hfFjQ7r6oA=; b=Pe48v+/7h/MfXk/VFhnRLqD3Jp
	V1B85MUgJvmx1ooypDw1wHLWq9gfs6Vt/TB21jiSlH3cDFN1qDwpmpTI1lt2HMsoPvtyKG0FXQWcX
	Vd6okroXWoJ7ZdP86QVZc6v/5qvjhFY6PcETsXwNtPbLfaESsEXTNOUXyzSD6rpFeXes=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Move dom0 creation in domain_build.c
Message-Id: <E1lX5gs-0008GC-P9@xenbits.xenproject.org>
Date: Thu, 15 Apr 2021 17:22:06 +0000

commit 7af57aefe38571cb3f5a6f06e87ebc2b6ed30293
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Apr 14 10:14:01 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 15 18:06:02 2021 +0100

    xen/arm: Move dom0 creation in domain_build.c
    
    Move dom0 create and start from setup.c to a dedicated
    function in domain_build.c.
    
    With this change, the function construct_dom0() is not
    used outside of domain_build.c anymore.
    So it is now a static function.
    
    No functional changes intended.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/domain_build.c | 38 +++++++++++++++++++++++++++++++++++++-
 xen/arch/arm/setup.c        | 29 +----------------------------
 xen/include/asm-arm/setup.h |  2 +-
 3 files changed, 39 insertions(+), 30 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 374bf655ee..359957dc1b 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -21,6 +21,7 @@
 #include <asm/device.h>
 #include <asm/kernel.h>
 #include <asm/setup.h>
+#include <asm/tee/tee.h>
 #include <asm/platform.h>
 #include <asm/psci.h>
 #include <asm/setup.h>
@@ -2520,7 +2521,7 @@ void __init create_domUs(void)
     }
 }
 
-int __init construct_dom0(struct domain *d)
+static int __init construct_dom0(struct domain *d)
 {
     struct kernel_info kinfo = {};
     int rc;
@@ -2578,6 +2579,41 @@ int __init construct_dom0(struct domain *d)
     return construct_domain(d, &kinfo);
 }
 
+struct domain* __init create_dom0(void)
+{
+    struct domain *dom0;
+    struct xen_domctl_createdomain dom0_cfg = {
+        .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap,
+        .max_evtchn_port = -1,
+        .max_grant_frames = gnttab_dom0_frames(),
+        .max_maptrack_frames = -1,
+    };
+
+    /* The vGIC for DOM0 is exactly emulating the hardware GIC */
+    dom0_cfg.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
+    /*
+     * Xen vGIC supports a maximum of 992 interrupt lines.
+     * 32 are substracted to cover local IRQs.
+     */
+    dom0_cfg.arch.nr_spis = min(gic_number_lines(), (unsigned int) 992) - 32;
+    if ( gic_number_lines() > 992 )
+        printk(XENLOG_WARNING "Maximum number of vGIC IRQs exceeded.\n");
+    dom0_cfg.arch.tee_type = tee_get_type();
+    dom0_cfg.max_vcpus = dom0_max_vcpus();
+
+    if ( iommu_enabled )
+        dom0_cfg.flags |= XEN_DOMCTL_CDF_iommu;
+
+    dom0 = domain_create(0, &dom0_cfg, true);
+    if ( IS_ERR(dom0) || (alloc_dom0_vcpu0(dom0) == NULL) )
+        panic("Error creating domain 0\n");
+
+    if ( construct_dom0(dom0) != 0)
+        panic("Could not set up DOM0 guest OS\n");
+
+    return dom0;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 9ba2f267f6..70a719cbaf 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -51,7 +51,6 @@
 #include <asm/platform.h>
 #include <asm/procinfo.h>
 #include <asm/setup.h>
-#include <asm/tee/tee.h>
 #include <xsm/xsm.h>
 #include <asm/acpi.h>
 
@@ -806,12 +805,6 @@ void __init start_xen(unsigned long boot_phys_offset,
     const char *cmdline;
     struct bootmodule *xen_bootmodule;
     struct domain *dom0;
-    struct xen_domctl_createdomain dom0_cfg = {
-        .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap,
-        .max_evtchn_port = -1,
-        .max_grant_frames = gnttab_dom0_frames(),
-        .max_maptrack_frames = -1,
-    };
     int rc;
 
     dcache_line_bytes = read_dcache_line_bytes();
@@ -966,27 +959,7 @@ void __init start_xen(unsigned long boot_phys_offset,
     enable_errata_workarounds();
 
     /* Create initial domain 0. */
-    /* The vGIC for DOM0 is exactly emulating the hardware GIC */
-    dom0_cfg.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
-    /*
-     * Xen vGIC supports a maximum of 992 interrupt lines.
-     * 32 are substracted to cover local IRQs.
-     */
-    dom0_cfg.arch.nr_spis = min(gic_number_lines(), (unsigned int) 992) - 32;
-    if ( gic_number_lines() > 992 )
-        printk(XENLOG_WARNING "Maximum number of vGIC IRQs exceeded.\n");
-    dom0_cfg.arch.tee_type = tee_get_type();
-    dom0_cfg.max_vcpus = dom0_max_vcpus();
-
-    if ( iommu_enabled )
-        dom0_cfg.flags |= XEN_DOMCTL_CDF_iommu;
-
-    dom0 = domain_create(0, &dom0_cfg, true);
-    if ( IS_ERR(dom0) || (alloc_dom0_vcpu0(dom0) == NULL) )
-        panic("Error creating domain 0\n");
-
-    if ( construct_dom0(dom0) != 0)
-        panic("Could not set up DOM0 guest OS\n");
+    dom0 = create_dom0();
 
     heap_init_late();
 
diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h
index 28bf622aa1..5283244015 100644
--- a/xen/include/asm-arm/setup.h
+++ b/xen/include/asm-arm/setup.h
@@ -93,8 +93,8 @@ void acpi_create_efi_mmap_table(struct domain *d,
 
 int acpi_make_efi_nodes(void *fdt, struct membank tbl_add[]);
 
-int construct_dom0(struct domain *d);
 void create_domUs(void);
+struct domain* create_dom0(void);
 
 void discard_initial_modules(void);
 void fw_unreserved_regions(paddr_t s, paddr_t e,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 15 17:22:18 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Apr 2021 17:22:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111449.213168 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX5h4-0003S8-2w; Thu, 15 Apr 2021 17:22:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111449.213168; Thu, 15 Apr 2021 17:22:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX5h3-0003S0-WC; Thu, 15 Apr 2021 17:22:17 +0000
Received: by outflank-mailman (input) for mailman id 111449;
 Thu, 15 Apr 2021 17:22:17 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5h3-0003Ru-3x
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:22:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5h2-0005Ko-Vu
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:22:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5h2-0008Hj-UF
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:22:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gnt9VLvtT96ebDPXJI5yODP7BLoOyesx4SoimklUuR0=; b=LlfLqQ6nZbNweMxhy5kubymXEn
	6SqB6vitpfgtYnrCan8eYyfKr5bAuHmXYH2emJXhDWugY8pl8uV2yaEezAdmn0GtVXnr0B5lAIZpl
	wiOTfFI6Ip2/ljtcFNT/ugAL75J1TNPLxoYY9wd1vGIo6LCQfSYmjTnykegNAn6wG/L0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: xen/arm: Reinforce use of is_hardware_domain
Message-Id: <E1lX5h2-0008Hj-UF@xenbits.xenproject.org>
Date: Thu, 15 Apr 2021 17:22:16 +0000

commit 784d70d68342d20074d88ee8d8bab41b9210505f
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Apr 14 10:14:02 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 15 18:06:21 2021 +0100

    xen/arm: xen/arm: Reinforce use of is_hardware_domain
    
    There are a few places on Arm where we use pretty much an open-coded
    version of is_hardware_domain(). The main difference, is the helper
    will also block speculation (not yet implemented on Arm).
    
    The existing users are not in hot path, so blocking speculation
    would not hurt when it is implemented. So remove the open-coded
    version within the arm codebase.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    [julieng: Rework the commit message]
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/irq.c                       | 2 +-
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 2 +-
 xen/drivers/passthrough/arm/smmu-v3.c    | 2 +-
 xen/drivers/passthrough/arm/smmu.c       | 2 +-
 xen/include/asm-arm/domain.h             | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index b71b099e6f..b761d90c40 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -412,7 +412,7 @@ bool is_assignable_irq(unsigned int irq)
  */
 bool irq_type_set_by_domain(const struct domain *d)
 {
-    return (d == hardware_domain);
+    return is_hardware_domain(d);
 }
 
 /*
diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index aef358d880..8b8e3a00ba 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -1168,7 +1168,7 @@ static int ipmmu_reassign_device(struct domain *s, struct domain *t,
     int ret = 0;
 
     /* Don't allow remapping on other domain than hwdom */
-    if ( t && t != hardware_domain )
+    if ( t && !is_hardware_domain(t) )
         return -EPERM;
 
     if ( t == s )
diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c
index 53d150cdb6..d115df7320 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.c
+++ b/xen/drivers/passthrough/arm/smmu-v3.c
@@ -3366,7 +3366,7 @@ static int arm_smmu_reassign_dev(struct domain *s, struct domain *t,
 	int ret = 0;
 
 	/* Don't allow remapping on other domain than hwdom */
-	if (t && t != hardware_domain)
+	if ( t && !is_hardware_domain(t) )
 		return -EPERM;
 
 	if (t == s)
diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index fab7be8b48..24ac4f3a80 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -2771,7 +2771,7 @@ static int arm_smmu_reassign_dev(struct domain *s, struct domain *t,
 	int ret = 0;
 
 	/* Don't allow remapping on other domain than hwdom */
-	if (t && t != hardware_domain)
+	if ( t && !is_hardware_domain(t) )
 		return -EPERM;
 
 	if (t == s)
diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index 1da90f207d..0a74df9931 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -30,7 +30,7 @@ enum domain_type {
 #endif
 
 /* The hardware domain has always its memory direct mapped. */
-#define is_domain_direct_mapped(d) ((d) == hardware_domain)
+#define is_domain_direct_mapped(d) is_hardware_domain(d)
 
 struct vtimer {
     struct vcpu *v;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 15 17:22:28 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Apr 2021 17:22:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111450.213171 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX5hE-0003TZ-4V; Thu, 15 Apr 2021 17:22:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111450.213171; Thu, 15 Apr 2021 17:22:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX5hE-0003TR-1P; Thu, 15 Apr 2021 17:22:28 +0000
Received: by outflank-mailman (input) for mailman id 111450;
 Thu, 15 Apr 2021 17:22:27 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5hD-0003TG-6B
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:22:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5hD-0005Kw-4B
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:22:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5hD-0008IX-2c
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:22:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vK6H5m08GGEf4y+FP7hgmXAuwBHAAgQeR117Mfe9Rrw=; b=14GGWyt1YPaIG5vZlwptepjOmh
	bIUq7J3xTPT8f/XWG0m6zAIZuTfPUJ1dnuK9y7dWVs/mzDQuOXkJtPfTeLzufRuoR4yodQYLjh3pa
	HfD7rMoSWtCc2zqTPGfAa9Tmda7+TPYabEvLBQn25jxWuCd0Xu+FU/5WSZ57aVU2Ezng=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Clarify how the domid is decided in create_domUs()
Message-Id: <E1lX5hD-0008IX-2c@xenbits.xenproject.org>
Date: Thu, 15 Apr 2021 17:22:27 +0000

commit b3d1f523c8de3a6657b11456a56bd8f5e67e247b
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Apr 14 10:14:03 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 15 18:08:29 2021 +0100

    xen/arm: Clarify how the domid is decided in create_domUs()
    
    This patch adds a comment in create_domUs() right before
    domain_create() to explain the importance of the pre-increment
    operator on the variable max_init_domid, to ensure that the
    domid 0 is allocated only during start_xen() function by the
    create_dom0() and not on any other possible code path to the
    domain_create() function.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain_build.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 359957dc1b..b1d7b9849f 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2508,6 +2508,11 @@ void __init create_domUs(void)
                                          GUEST_VPL011_SPI - 32 + 1);
         }
 
+        /*
+         * The variable max_init_domid is initialized with zero, so here it's
+         * very important to use the pre-increment operator to call
+         * domain_create() with a domid > 0. (domid == 0 is reserved for Dom0)
+         */
         d = domain_create(++max_init_domid, &d_cfg, false);
         if ( IS_ERR(d) )
             panic("Error creating domain %s\n", dt_node_name(node));
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 15 17:22:38 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Apr 2021 17:22:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111451.213175 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX5hO-0003VF-61; Thu, 15 Apr 2021 17:22:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111451.213175; Thu, 15 Apr 2021 17:22:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX5hO-0003V7-33; Thu, 15 Apr 2021 17:22:38 +0000
Received: by outflank-mailman (input) for mailman id 111451;
 Thu, 15 Apr 2021 17:22:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5hN-0003V0-AL
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:22:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5hN-0005L8-7o
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:22:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5hN-0008Jf-6u
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:22:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9yIRA7WJAb6I/p3IKgqz+bmZLvD0YWlYZ4Z156ReX/M=; b=RFuKbj1+6N9+Ulhnb5F3pjfFJV
	7l3W1DHIaTTo5+SdvcN09Vy9YCwLzK1W4HELuK0T/w1tKWhSCCReNLGYAKImcst0pJ+BRkhTAS32J
	CgugjUjKJqN9+KAHmC76eGpgnO9Iy2VYAOfssyJGAWPoaIHp5wtyzMnoPH5Zsqxdu2AI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Prevent Dom0 to be loaded when using dom0less
Message-Id: <E1lX5hN-0008Jf-6u@xenbits.xenproject.org>
Date: Thu, 15 Apr 2021 17:22:37 +0000

commit fcb97d1f19ab294df091249399e515117350c228
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Apr 14 10:14:04 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 15 18:08:57 2021 +0100

    xen/arm: Prevent Dom0 to be loaded when using dom0less
    
    This patch prevents the dom0 to be loaded skipping its
    building and going forward to build domUs when the dom0
    kernel is not found and at least one domU is present.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/features/dom0less.pandoc |  7 ++++---
 xen/arch/arm/setup.c          | 42 +++++++++++++++++++++++++++++++++++++++---
 2 files changed, 43 insertions(+), 6 deletions(-)

diff --git a/docs/features/dom0less.pandoc b/docs/features/dom0less.pandoc
index d798596cdf..c9edb529e1 100644
--- a/docs/features/dom0less.pandoc
+++ b/docs/features/dom0less.pandoc
@@ -16,9 +16,10 @@ Multiboot specification has been extended to allow for multiple domains
 to be passed to Xen. See docs/misc/arm/device-tree/booting.txt for more
 information about the Multiboot specification and how to use it.
 
-Currently, a control domain ("dom0") is still required, but in the
-future it will become unnecessary when all domains are created
-directly from Xen. Instead of waiting for the control domain to be fully
+Currently, a control domain ("dom0") is still required to manage the DomU
+domains, but the system can start also without dom0 if the Device Tree
+doesn't specify the dom0 kernel and it declares one or more domUs.
+Instead of waiting for the control domain (when declared) to be fully
 booted and the Xen tools to become available, domains created by Xen
 this way are started right away in parallel. Hence, their boot time is
 typically much shorter.
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 70a719cbaf..00aad1c194 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -794,6 +794,38 @@ static void __init setup_mm(void)
 }
 #endif
 
+static bool __init is_dom0less_mode(void)
+{
+    struct bootmodules *mods = &bootinfo.modules;
+    struct bootmodule *mod;
+    unsigned int i;
+    bool dom0found = false;
+    bool domUfound = false;
+
+    /* Look into the bootmodules */
+    for ( i = 0 ; i < mods->nr_mods ; i++ )
+    {
+        mod = &mods->module[i];
+        /* Find if dom0 and domU kernels are present */
+        if ( mod->kind == BOOTMOD_KERNEL )
+        {
+            if ( mod->domU == false )
+            {
+                dom0found = true;
+                break;
+            }
+            else
+                domUfound = true;
+        }
+    }
+
+    /*
+     * If there is no dom0 kernel but at least one domU, then we are in
+     * dom0less mode
+     */
+    return ( !dom0found && domUfound );
+}
+
 size_t __read_mostly dcache_line_bytes;
 
 /* C entry point for boot CPU */
@@ -804,7 +836,7 @@ void __init start_xen(unsigned long boot_phys_offset,
     int cpus, i;
     const char *cmdline;
     struct bootmodule *xen_bootmodule;
-    struct domain *dom0;
+    struct domain *dom0 = NULL;
     int rc;
 
     dcache_line_bytes = read_dcache_line_bytes();
@@ -959,7 +991,10 @@ void __init start_xen(unsigned long boot_phys_offset,
     enable_errata_workarounds();
 
     /* Create initial domain 0. */
-    dom0 = create_dom0();
+    if ( !is_dom0less_mode() )
+        dom0 = create_dom0();
+    else
+        printk(XENLOG_INFO "Xen dom0less mode detected\n");
 
     heap_init_late();
 
@@ -977,7 +1012,8 @@ void __init start_xen(unsigned long boot_phys_offset,
     if ( acpi_disabled )
         create_domUs();
 
-    domain_unpause_by_systemcontroller(dom0);
+    if ( dom0 )
+        domain_unpause_by_systemcontroller(dom0);
 
     /* Switch on to the dynamically allocated stack for the idle vcpu
      * since the static one we're running on is about to be freed. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 15 17:33:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Apr 2021 17:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111453.213180 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX5rY-0004RG-Vi; Thu, 15 Apr 2021 17:33:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111453.213180; Thu, 15 Apr 2021 17:33: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 1lX5rY-0004R8-So; Thu, 15 Apr 2021 17:33:08 +0000
Received: by outflank-mailman (input) for mailman id 111453;
 Thu, 15 Apr 2021 17:33:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5rY-0004R3-2R
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:33:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5rX-0005VH-Ui
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:33:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5rX-0000nj-Rd
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:33:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oxmtdH6k5srTAt7UOeGZWRq6mzgEWMxAwrsLPcVIy4I=; b=aumAbL47/1pw6YLYEa8UOxPf5n
	Ao82ZBjDEzNyDmbLf0afAh0ld06jH4rPx4YJiMBsTl7Rny81aOVUtomgjZGW4wsF+OW6YMXbFsCzi
	eswoIOalG/tKtsP0bvjkYJHg3lsV9VxHAb7Bub33PYSH5+vDAwN1Qqr1FhhoHyarWYiw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Revert "x86/HPET: don't enable legacy replacement mode unconditionally"
Message-Id: <E1lX5rX-0000nj-Rd@xenbits.xenproject.org>
Date: Thu, 15 Apr 2021 17:33:07 +0000

commit 2b05d427a09e108589dc57f54b517d0ffdf973ef
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 15 16:19:01 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 15 18:25:40 2021 +0100

    Revert "x86/HPET: don't enable legacy replacement mode unconditionally"
    
    This reverts commit e680cc48b7184d3489873d6776f84ba1fc238ced.
    
    It was committed despite multiple objections.  The agreed upon fix is a
    different variation of the same original patch, and the delta between the two
    is far from clear.
    
    By reverting this commit first, the fixes are clear and coherent as individual
    patches, and in the appropriate form for backport to the older trees.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/misc/xen-command-line.pandoc | 17 -----------------
 xen/arch/x86/hpet.c               | 37 ++++++-------------------------------
 2 files changed, 6 insertions(+), 48 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index deef6d0b4c..a0601ff838 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1274,26 +1274,9 @@ supported. See docs/misc/arm/big.LITTLE.txt for more information.
 When the hmp-unsafe option is disabled (default), CPUs that are not
 identical to the boot CPU will be parked and not used by Xen.
 
-### hpet (x86)
-> `= List of [ <boolean> | broadcast | legacy-replacement ]`
-
-> Default : `true`, `no-broadcast`, 'no-legacy-replacement`
-
-Controls Xen's use of the system's High Precision Event Timer.  The boolean
-allows to turn off use altogether.
-
-`broadcast` forces Xen to keep using the broadcast for CPUs in deep C-states
-even when an RTC interrupt got enabled.
-
-`legacy-replacement` is intended to be used on platforms where the timer
-interrupt doesn't get raised by the legacy PIT.  This then also affects
-raising of the RTC interrupt.
-
 ### hpetbroadcast (x86)
 > `= <boolean>`
 
-Deprecated alternative of `hpet=broadcast`.
-
 ### hvm_debug (x86)
 > `= <integer>`
 
diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 76d9ef2c02..1ff005fb4a 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -52,8 +52,6 @@ static unsigned int __read_mostly num_hpets_used;
 DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel);
 
 unsigned long __initdata hpet_address;
-static bool __initdata opt_hpet = true;
-static bool __initdata opt_legacy_replacement;
 u8 __initdata hpet_blockid;
 u8 __initdata hpet_flags;
 
@@ -65,32 +63,6 @@ u8 __initdata hpet_flags;
 static bool __initdata force_hpet_broadcast;
 boolean_param("hpetbroadcast", force_hpet_broadcast);
 
-static int __init parse_hpet_param(const char *s)
-{
-    const char *ss;
-    int val, rc = 0;
-
-    do {
-        ss = strchr(s, ',');
-        if ( !ss )
-            ss = strchr(s, '\0');
-
-        if ( (val = parse_bool(s, ss)) >= 0 )
-            opt_hpet = val;
-        else if ( (val = parse_boolean("broadcast", s, ss)) >= 0 )
-            force_hpet_broadcast = val;
-        else if ( (val = parse_boolean("legacy-replacement", s, ss)) >= 0 )
-            opt_legacy_replacement = val;
-        else
-            rc = -EINVAL;
-
-        s = ss + 1;
-    } while ( *ss );
-
-    return rc;
-}
-custom_param("hpet", parse_hpet_param);
-
 /*
  * Calculate a multiplication factor for scaled math, which is used to convert
  * nanoseconds based values to clock ticks:
@@ -789,9 +761,12 @@ u64 __init hpet_setup(void)
     unsigned int hpet_id, hpet_period, hpet_cfg;
     unsigned int last, rem;
 
-    if ( hpet_rate || !hpet_address || !opt_hpet )
+    if ( hpet_rate )
         return hpet_rate;
 
+    if ( hpet_address == 0 )
+        return 0;
+
     set_fixmap_nocache(FIX_HPET_BASE, hpet_address);
 
     hpet_id = hpet_read32(HPET_ID);
@@ -828,9 +803,9 @@ u64 __init hpet_setup(void)
      * IRQ routing is configured.
      *
      * Reconfigure the HPET into legacy mode to re-establish the timer
-     * interrupt, if available and if so requested.
+     * interrupt.
      */
-    if ( opt_legacy_replacement && (hpet_id & HPET_ID_LEGSUP) &&
+    if ( hpet_id & HPET_ID_LEGSUP &&
          !((hpet_cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
     {
         unsigned int c0_cfg, ticks, count;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 15 17:33:19 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Apr 2021 17:33:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111454.213183 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX5rj-0004Ry-17; Thu, 15 Apr 2021 17:33:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111454.213183; Thu, 15 Apr 2021 17:33: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 1lX5ri-0004Rq-UK; Thu, 15 Apr 2021 17:33:18 +0000
Received: by outflank-mailman (input) for mailman id 111454;
 Thu, 15 Apr 2021 17:33:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5ri-0004Rl-4k
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:33:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5ri-0005VQ-33
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:33:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5ri-0000qM-18
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:33:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yfwq/+rnksjmNOejex83vWj+qK2cG37X7ajlYTt1Smc=; b=jnyx6i1RCNdnG+SxpjDS2S34Tg
	rSdP1KRDQBrOayOgv9HSYjm0eBAnlCIgw/6qevTuR8yhO3QzywYi3T/G0gn9CpE0V7o4YgpkmK08/
	u+n8U5HLK88DyGdtVBN+dx0tMn9LD+PUAjsJuXrBTTEkE/PqCCj0i8LSnqFQG8MVwLvk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hpet: Factor hpet_enable_legacy_replacement_mode() out of hpet_setup()
Message-Id: <E1lX5ri-0000qM-18@xenbits.xenproject.org>
Date: Thu, 15 Apr 2021 17:33:18 +0000

commit 238168b5bcd27fec97704f6295fa5bf7a442eb6f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Mar 24 14:33:04 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 15 18:25:40 2021 +0100

    x86/hpet: Factor hpet_enable_legacy_replacement_mode() out of hpet_setup()
    
    ... in preparation to introduce a second caller.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Frédéric Pierret <frederic.pierret@qubes-os.org>
---
 xen/arch/x86/hpet.c        | 116 ++++++++++++++++++++++++---------------------
 xen/include/asm-x86/hpet.h |   6 +++
 2 files changed, 68 insertions(+), 54 deletions(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 1ff005fb4a..c1d04f184f 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -754,11 +754,70 @@ int hpet_legacy_irq_tick(void)
 }
 
 static u32 *hpet_boot_cfg;
+static uint64_t __initdata hpet_rate;
+
+bool __init hpet_enable_legacy_replacement_mode(void)
+{
+    unsigned int cfg, c0_cfg, ticks, count;
+
+    if ( !hpet_rate ||
+         !(hpet_read32(HPET_ID) & HPET_ID_LEGSUP) ||
+         ((cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
+        return false;
+
+    /* Stop the main counter. */
+    hpet_write32(cfg & ~HPET_CFG_ENABLE, HPET_CFG);
+
+    /* Reconfigure channel 0 to be 32bit periodic. */
+    c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+    c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
+               HPET_TN_32BIT);
+    hpet_write32(c0_cfg, HPET_Tn_CFG(0));
+
+    /*
+     * The exact period doesn't have to match a legacy PIT.  All we need
+     * is an interrupt queued up via the IO-APIC to check routing.
+     *
+     * Use HZ as the frequency.
+     */
+    ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
+
+    count = hpet_read32(HPET_COUNTER);
+
+    /*
+     * HPET_TN_SETVAL above is atrociously documented in the spec.
+     *
+     * Periodic HPET channels have a main comparator register, and
+     * separate "accumulator" register.  Despite being named accumulator
+     * in the spec, this is not an accurate description of its behaviour
+     * or purpose.
+     *
+     * Each time an interrupt is generated, the "accumulator" register is
+     * re-added to the comparator set up the new period.
+     *
+     * Normally, writes to the CMP register update both registers.
+     * However, under these semantics, it is impossible to set up a
+     * periodic timer correctly without the main HPET counter being at 0.
+     *
+     * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
+     * use for periodic timers to mean that the second write to CMP
+     * updates the accumulator only, and not the absolute comparator
+     * value.
+     *
+     * This lets us set a period when the main counter isn't at 0.
+     */
+    hpet_write32(count + ticks, HPET_Tn_CMP(0));
+    hpet_write32(ticks,         HPET_Tn_CMP(0));
+
+    /* Restart the main counter, and legacy mode. */
+    hpet_write32(cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
+
+    return true;
+}
 
 u64 __init hpet_setup(void)
 {
-    static u64 __initdata hpet_rate;
-    unsigned int hpet_id, hpet_period, hpet_cfg;
+    unsigned int hpet_id, hpet_period;
     unsigned int last, rem;
 
     if ( hpet_rate )
@@ -805,58 +864,7 @@ u64 __init hpet_setup(void)
      * Reconfigure the HPET into legacy mode to re-establish the timer
      * interrupt.
      */
-    if ( hpet_id & HPET_ID_LEGSUP &&
-         !((hpet_cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
-    {
-        unsigned int c0_cfg, ticks, count;
-
-        /* Stop the main counter. */
-        hpet_write32(hpet_cfg & ~HPET_CFG_ENABLE, HPET_CFG);
-
-        /* Reconfigure channel 0 to be 32bit periodic. */
-        c0_cfg = hpet_read32(HPET_Tn_CFG(0));
-        c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
-                   HPET_TN_32BIT);
-        hpet_write32(c0_cfg, HPET_Tn_CFG(0));
-
-        /*
-         * The exact period doesn't have to match a legacy PIT.  All we need
-         * is an interrupt queued up via the IO-APIC to check routing.
-         *
-         * Use HZ as the frequency.
-         */
-        ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
-
-        count = hpet_read32(HPET_COUNTER);
-
-        /*
-         * HPET_TN_SETVAL above is atrociously documented in the spec.
-         *
-         * Periodic HPET channels have a main comparator register, and
-         * separate "accumulator" register.  Despite being named accumulator
-         * in the spec, this is not an accurate description of its behaviour
-         * or purpose.
-         *
-         * Each time an interrupt is generated, the "accumulator" register is
-         * re-added to the comparator set up the new period.
-         *
-         * Normally, writes to the CMP register update both registers.
-         * However, under these semantics, it is impossible to set up a
-         * periodic timer correctly without the main HPET counter being at 0.
-         *
-         * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
-         * use for periodic timers to mean that the second write to CMP
-         * updates the accumulator only, and not the absolute comparator
-         * value.
-         *
-         * This lets us set a period when the main counter isn't at 0.
-         */
-        hpet_write32(count + ticks, HPET_Tn_CMP(0));
-        hpet_write32(ticks,         HPET_Tn_CMP(0));
-
-        /* Restart the main counter, and legacy mode. */
-        hpet_write32(hpet_cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
-    }
+    hpet_enable_legacy_replacement_mode();
 
     return hpet_rate;
 }
diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h
index fb6bf05065..50176de3d2 100644
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -72,6 +72,12 @@ void hpet_disable(void);
  */
 int hpet_legacy_irq_tick(void);
 
+/*
+ * Try to enable HPET Legacy Replacement mode.  Returns a boolean indicating
+ * whether the HPET configuration was changed.
+ */
+bool hpet_enable_legacy_replacement_mode(void);
+
 /*
  * Temporarily use an HPET event counter for timer interrupt handling,
  * rather than using the LAPIC timer. Used for Cx state entry.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 15 17:33:30 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Apr 2021 17:33:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111455.213188 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX5ru-0004TM-58; Thu, 15 Apr 2021 17:33:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111455.213188; Thu, 15 Apr 2021 17:33:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lX5ru-0004TE-1z; Thu, 15 Apr 2021 17:33:30 +0000
Received: by outflank-mailman (input) for mailman id 111455;
 Thu, 15 Apr 2021 17:33:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5rs-0004T4-8K
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:33:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5rs-0005VX-7T
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:33:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lX5rs-0000r7-64
 for xen-changelog@lists.xenproject.org; Thu, 15 Apr 2021 17:33:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GUML7oXMFN7oblr4b+PnmEdkj71bNlnsxvUkhBukVqw=; b=cYAbljTxRLkVeHz5fx+kV1/oaK
	Hss1TDQZ2/do9xUHDnpG8qduifeLtVFccVKPzQFJJvGbt8CchTFe0T5G+RwqdOCez+TbB79iiCPoC
	wC7IVCa2d7R2Wd/ASwxmiYi6RYNXJVwelCJyLyzz66pvwAb1CDh18XT2GRvbZllaI20g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hpet: Don't enable legacy replacement mode unconditionally
Message-Id: <E1lX5rs-0000r7-64@xenbits.xenproject.org>
Date: Thu, 15 Apr 2021 17:33:28 +0000

commit b53173e7cdafb7a318a239d557478fd73734a86a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 24 11:34:32 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 15 18:25:40 2021 +0100

    x86/hpet: Don't enable legacy replacement mode unconditionally
    
    Commit e1de4c196a2e ("x86/timer: Fix boot on Intel systems using ITSSPRC
    static PIT clock gating") was reported to cause boot failures on certain
    AMD Ryzen systems.
    
    Refine the fix to do nothing in the default case, and only attempt to
    configure legacy replacement mode if IRQ0 is found to not be working.  If
    legacy replacement mode doesn't help, undo it before falling back to other IRQ
    routing configurations.
    
    In addition, introduce a "hpet" command line option so this heuristic
    can be overridden.  Since it makes little sense to introduce just
    "hpet=legacy-replacement", also allow for a boolean argument as well as
    "broadcast" to replace the separate "hpetbroadcast" option.
    
    Reported-by: Frédéric Pierret frederic.pierret@qubes-os.org
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Frédéric Pierret <frederic.pierret@qubes-os.org>
---
 docs/misc/xen-command-line.pandoc | 33 +++++++++++++++++
 xen/arch/x86/hpet.c               | 75 +++++++++++++++++++++++++++++----------
 xen/arch/x86/io_apic.c            | 31 ++++++++++++++++
 xen/include/asm-x86/hpet.h        |  7 ++++
 4 files changed, 128 insertions(+), 18 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index a0601ff838..a4bd3f12c5 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1274,9 +1274,42 @@ supported. See docs/misc/arm/big.LITTLE.txt for more information.
 When the hmp-unsafe option is disabled (default), CPUs that are not
 identical to the boot CPU will be parked and not used by Xen.
 
+### hpet
+    = List of [ <bool> | broadcast=<bool> | legacy-replacement=<bool> ]
+
+    Applicability: x86
+
+Controls Xen's use of the system's High Precision Event Timer.  By default,
+Xen will use an HPET when available and not subject to errata.  Use of the
+HPET can be disabled by specifying `hpet=0`.
+
+ * The `broadcast` boolean is disabled by default, but forces Xen to keep
+   using the broadcast for CPUs in deep C-states even when an RTC interrupt is
+   enabled.  This then also affects raising of the RTC interrupt.
+
+ * The `legacy-replacement` boolean allows for control over whether Legacy
+   Replacement mode is enabled.
+
+   Legacy Replacement mode is intended for hardware which does not have an
+   8254 PIT, and allows the HPET to be configured into a compatible mode.
+   Intel chipsets from Skylake/ApolloLake onwards can turn the PIT off for
+   power saving reasons, and there is no platform-agnostic mechanism for
+   discovering this.
+
+   By default, Xen will not change hardware configuration, unless the PIT
+   appears to be absent, at which point Xen will try to enable Legacy
+   Replacement mode before falling back to pre-IO-APIC interrupt routing
+   options.
+
+   This behaviour can be inhibited by specifying `legacy-replacement=0`.
+   Alternatively, this mode can be enabled unconditionally (if available) by
+   specifying `legacy-replacement=1`.
+
 ### hpetbroadcast (x86)
 > `= <boolean>`
 
+Deprecated alternative of `hpet=broadcast`.
+
 ### hvm_debug (x86)
 > `= <integer>`
 
diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index c1d04f184f..afe104dc93 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -52,6 +52,8 @@ static unsigned int __read_mostly num_hpets_used;
 DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel);
 
 unsigned long __initdata hpet_address;
+int8_t __initdata opt_hpet_legacy_replacement = -1;
+static bool __initdata opt_hpet = true;
 u8 __initdata hpet_blockid;
 u8 __initdata hpet_flags;
 
@@ -63,6 +65,32 @@ u8 __initdata hpet_flags;
 static bool __initdata force_hpet_broadcast;
 boolean_param("hpetbroadcast", force_hpet_broadcast);
 
+static int __init parse_hpet_param(const char *s)
+{
+    const char *ss;
+    int val, rc = 0;
+
+    do {
+        ss = strchr(s, ',');
+        if ( !ss )
+            ss = strchr(s, '\0');
+
+        if ( (val = parse_bool(s, ss)) >= 0 )
+            opt_hpet = val;
+        else if ( (val = parse_boolean("broadcast", s, ss)) >= 0 )
+            force_hpet_broadcast = val;
+        else if ( (val = parse_boolean("legacy-replacement", s, ss)) >= 0 )
+            opt_hpet_legacy_replacement = val;
+        else
+            rc = -EINVAL;
+
+        s = ss + 1;
+    } while ( *ss );
+
+    return rc;
+}
+custom_param("hpet", parse_hpet_param);
+
 /*
  * Calculate a multiplication factor for scaled math, which is used to convert
  * nanoseconds based values to clock ticks:
@@ -755,6 +783,9 @@ int hpet_legacy_irq_tick(void)
 
 static u32 *hpet_boot_cfg;
 static uint64_t __initdata hpet_rate;
+static __initdata struct {
+    uint32_t cmp, cfg;
+} pre_legacy_c0;
 
 bool __init hpet_enable_legacy_replacement_mode(void)
 {
@@ -768,8 +799,11 @@ bool __init hpet_enable_legacy_replacement_mode(void)
     /* Stop the main counter. */
     hpet_write32(cfg & ~HPET_CFG_ENABLE, HPET_CFG);
 
+    /* Stash channel 0's old CFG/CMP incase we need to undo. */
+    pre_legacy_c0.cfg = c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+    pre_legacy_c0.cmp = hpet_read32(HPET_Tn_CMP(0));
+
     /* Reconfigure channel 0 to be 32bit periodic. */
-    c0_cfg = hpet_read32(HPET_Tn_CFG(0));
     c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
                HPET_TN_32BIT);
     hpet_write32(c0_cfg, HPET_Tn_CFG(0));
@@ -815,17 +849,33 @@ bool __init hpet_enable_legacy_replacement_mode(void)
     return true;
 }
 
+void __init hpet_disable_legacy_replacement_mode(void)
+{
+    unsigned int cfg = hpet_read32(HPET_CFG);
+
+    ASSERT(hpet_rate);
+
+    cfg &= ~(HPET_CFG_LEGACY | HPET_CFG_ENABLE);
+
+    /* Stop the main counter and disable legacy mode. */
+    hpet_write32(cfg, HPET_CFG);
+
+    /* Restore pre-Legacy Replacement Mode settings. */
+    hpet_write32(pre_legacy_c0.cfg, HPET_Tn_CFG(0));
+    hpet_write32(pre_legacy_c0.cmp, HPET_Tn_CMP(0));
+
+    /* Restart the main counter. */
+    hpet_write32(cfg | HPET_CFG_ENABLE, HPET_CFG);
+}
+
 u64 __init hpet_setup(void)
 {
     unsigned int hpet_id, hpet_period;
     unsigned int last, rem;
 
-    if ( hpet_rate )
+    if ( hpet_rate || !hpet_address || !opt_hpet )
         return hpet_rate;
 
-    if ( hpet_address == 0 )
-        return 0;
-
     set_fixmap_nocache(FIX_HPET_BASE, hpet_address);
 
     hpet_id = hpet_read32(HPET_ID);
@@ -852,19 +902,8 @@ u64 __init hpet_setup(void)
     if ( (rem * 2) > hpet_period )
         hpet_rate++;
 
-    /*
-     * Intel chipsets from Skylake/ApolloLake onwards can statically clock
-     * gate the 8259 PIT.  This option is enabled by default in slightly later
-     * systems, as turning the PIT off is a prerequisite to entering the C11
-     * power saving state.
-     *
-     * Xen currently depends on the legacy timer interrupt being active while
-     * IRQ routing is configured.
-     *
-     * Reconfigure the HPET into legacy mode to re-establish the timer
-     * interrupt.
-     */
-    hpet_enable_legacy_replacement_mode();
+    if ( opt_hpet_legacy_replacement > 0 )
+        hpet_enable_legacy_replacement_mode();
 
     return hpet_rate;
 }
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index e93265f379..58b26d962c 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -29,6 +29,8 @@
 #include <xen/acpi.h>
 #include <xen/keyhandler.h>
 #include <xen/softirq.h>
+
+#include <asm/hpet.h>
 #include <asm/mc146818rtc.h>
 #include <asm/smp.h>
 #include <asm/desc.h>
@@ -1930,6 +1932,35 @@ static void __init check_timer(void)
             local_irq_restore(flags);
             return;
         }
+
+        /*
+         * Intel chipsets from Skylake/ApolloLake onwards can statically clock
+         * gate the 8254 PIT.  This option is enabled by default in slightly
+         * later systems, as turning the PIT off is a prerequisite to entering
+         * the C11 power saving state.
+         *
+         * Xen currently depends on the legacy timer interrupt being active
+         * while IRQ routing is configured.
+         *
+         * If the user hasn't made an explicit choice, attempt to reconfigure
+         * the HPET into legacy mode to re-establish the timer interrupt.
+         */
+        if ( opt_hpet_legacy_replacement < 0 &&
+             hpet_enable_legacy_replacement_mode() )
+        {
+            printk(XENLOG_ERR "..no 8254 timer found - trying HPET Legacy Replacement Mode\n");
+
+            if ( timer_irq_works() )
+            {
+                local_irq_restore(flags);
+                return;
+            }
+
+            /* Legacy Replacement mode hasn't helped.  Undo it. */
+            printk(XENLOG_ERR "..no HPET timer found - reverting Legacy Replacement Mode\n");
+            hpet_disable_legacy_replacement_mode();
+        }
+
         clear_IO_APIC_pin(apic1, pin1);
         printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to "
                "IO-APIC\n");
diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h
index 50176de3d2..8f9725a95e 100644
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -53,6 +53,7 @@
 extern unsigned long hpet_address;
 extern u8 hpet_blockid;
 extern u8 hpet_flags;
+extern int8_t opt_hpet_legacy_replacement;
 
 /*
  * Detect and initialise HPET hardware: return counter update frequency.
@@ -78,6 +79,12 @@ int hpet_legacy_irq_tick(void);
  */
 bool hpet_enable_legacy_replacement_mode(void);
 
+/*
+ * Undo the effects of hpet_disable_legacy_replacement_mode().  Must not be
+ * called unless enable() returned true.
+ */
+void hpet_disable_legacy_replacement_mode(void);
+
 /*
  * Temporarily use an HPET event counter for timer interrupt handling,
  * rather than using the LAPIC timer. Used for Cx state entry.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 16 08:33:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Apr 2021 08:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111614.213486 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXJuR-0005WF-JD; Fri, 16 Apr 2021 08:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111614.213486; Fri, 16 Apr 2021 08: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 1lXJuR-0005W7-GC; Fri, 16 Apr 2021 08:33:03 +0000
Received: by outflank-mailman (input) for mailman id 111614;
 Fri, 16 Apr 2021 08: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 1lXJuQ-0005W2-E8
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 08: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 1lXJuQ-00029m-8x
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 08:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXJuQ-0004YL-80
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 08: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=wZa9JeGdlb3H4yiRggQ/cKbiJdo3DwQ/vF5PfTumEfQ=; b=jUEKaulSWoLUFjlDHt6RgZpEoo
	7ZZoM3NeXBt3PzjPuZ+C84pOGFQKLOZ6yh33SOpQe1aV27mPdxjJ5zr1HWE5xpCKBGk1FkmD/13QU
	WUrG4ov3YGNcaeR681/OimF0Bsm5BOF8fkDTmNDrmEGH8f4JeRGS0FbhGG/iqMNmZ5sc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: remove allow_failure from Alpine Linux jobs
Message-Id: <E1lXJuQ-0004YL-80@xenbits.xenproject.org>
Date: Fri, 16 Apr 2021 08:33:02 +0000

commit ed3ea7e95b0d94cc92a0fcf6c57e784ddfb24c97
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Fri Mar 12 13:05:26 2021 -0800
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Wed Apr 14 17:07:57 2021 -0700

    automation: remove allow_failure from Alpine Linux jobs
    
    Now that the Alpine Linux build jobs complete successfully on staging we
    can remove the "allow_failure: true" tag.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 automation/gitlab-ci/build.yaml | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 23ab81d892..cca2c310e2 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -434,25 +434,21 @@ alpine-3.12-gcc:
   extends: .gcc-x86-64-build
   variables:
     CONTAINER: alpine:3.12
-  allow_failure: true
 
 alpine-3.12-gcc-debug:
   extends: .gcc-x86-64-build-debug
   variables:
     CONTAINER: alpine:3.12
-  allow_failure: true
 
 alpine-3.12-clang:
   extends: .clang-x86-64-build
   variables:
     CONTAINER: alpine:3.12
-  allow_failure: true
 
 alpine-3.12-clang-debug:
   extends: .clang-x86-64-build-debug
   variables:
     CONTAINER: alpine:3.12
-  allow_failure: true
 
 
 # Arm builds
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 16 08:33:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Apr 2021 08:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111615.213490 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXJub-0005X7-LD; Fri, 16 Apr 2021 08:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111615.213490; Fri, 16 Apr 2021 08: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 1lXJub-0005X0-Hr; Fri, 16 Apr 2021 08:33:13 +0000
Received: by outflank-mailman (input) for mailman id 111615;
 Fri, 16 Apr 2021 08: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 1lXJua-0005Ws-Dk
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 08: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 1lXJua-00029q-Cp
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 08:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXJua-0004ZB-BX
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 08: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=lHR7WDrFGpzWePQoaXyu84IipnTOHPmO+CuudbpYd24=; b=s15lCY2W98kEFytQbtTzs6SIfJ
	d6QTBqbsq0G+HGCNEmDk/E8vYPG1TwPqjAqRICyNJNrF/sxU2iun5gWINrXMKnko0yIVc+mEqjZHb
	NAC6Mlj45wP0mXLdKXZZbBvSO2suCEPCRKBTpyhdakMozFBSUQ+6duLz5faMdNTTXvtA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: don't build unused entry code when !PV32
Message-Id: <E1lXJua-0004ZB-BX@xenbits.xenproject.org>
Date: Fri, 16 Apr 2021 08:33:12 +0000

commit 9cc6bd43addb8c043774b6fc59ae9a0d14371eab
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 15 13:34:29 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 15 13:34:29 2021 +0200

    x86: don't build unused entry code when !PV32
    
    Except for the initial part of cstar_enter compat/entry.S is all dead
    code in this case. Further, along the lines of the PV conditionals we
    already have in entry.S, make code PV32-conditional there too (to a
    fair part because this code actually references compat/entry.S).
    
    This has the side effect of moving the tail part (now at compat_syscall)
    of the code out of .text.entry (in line with e.g. compat_sysenter).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Wei Liu <wl@xen.org>
---
 xen/arch/x86/x86_64/Makefile       |  2 +-
 xen/arch/x86/x86_64/asm-offsets.c  | 14 ++++----
 xen/arch/x86/x86_64/compat/entry.S | 44 +----------------------
 xen/arch/x86/x86_64/entry.S        | 71 +++++++++++++++++++++++++++++++++++---
 xen/include/asm-x86/asm_defns.h    |  2 +-
 5 files changed, 78 insertions(+), 55 deletions(-)

diff --git a/xen/arch/x86/x86_64/Makefile b/xen/arch/x86/x86_64/Makefile
index 2bb1eb0a81..2ea536fa71 100644
--- a/xen/arch/x86/x86_64/Makefile
+++ b/xen/arch/x86/x86_64/Makefile
@@ -1,4 +1,4 @@
-obj-$(CONFIG_PV) += compat/
+obj-$(CONFIG_PV32) += compat/
 
 obj-bin-y += entry.o
 obj-y += traps.o
diff --git a/xen/arch/x86/x86_64/asm-offsets.c b/xen/arch/x86/x86_64/asm-offsets.c
index ce030b124f..649892643f 100644
--- a/xen/arch/x86/x86_64/asm-offsets.c
+++ b/xen/arch/x86/x86_64/asm-offsets.c
@@ -9,7 +9,7 @@
 #include <xen/perfc.h>
 #endif
 #include <xen/sched.h>
-#ifdef CONFIG_PV
+#ifdef CONFIG_PV32
 #include <compat/xen.h>
 #endif
 #include <asm/hardirq.h>
@@ -102,19 +102,21 @@ void __dummy__(void)
     BLANK();
 #endif
 
-#ifdef CONFIG_PV
+#ifdef CONFIG_PV32
     OFFSET(DOMAIN_is_32bit_pv, struct domain, arch.pv.is_32bit);
     BLANK();
 
-    OFFSET(VCPUINFO_upcall_pending, struct vcpu_info, evtchn_upcall_pending);
-    OFFSET(VCPUINFO_upcall_mask, struct vcpu_info, evtchn_upcall_mask);
-    BLANK();
-
     OFFSET(COMPAT_VCPUINFO_upcall_pending, struct compat_vcpu_info, evtchn_upcall_pending);
     OFFSET(COMPAT_VCPUINFO_upcall_mask, struct compat_vcpu_info, evtchn_upcall_mask);
     BLANK();
 #endif
 
+#ifdef CONFIG_PV
+    OFFSET(VCPUINFO_upcall_pending, struct vcpu_info, evtchn_upcall_pending);
+    OFFSET(VCPUINFO_upcall_mask, struct vcpu_info, evtchn_upcall_mask);
+    BLANK();
+#endif
+
     OFFSET(CPUINFO_guest_cpu_user_regs, struct cpu_info, guest_cpu_user_regs);
     OFFSET(CPUINFO_verw_sel, struct cpu_info, verw_sel);
     OFFSET(CPUINFO_current_vcpu, struct cpu_info, current_vcpu);
diff --git a/xen/arch/x86/x86_64/compat/entry.S b/xen/arch/x86/x86_64/compat/entry.S
index c2c73cc732..c84ff7ea64 100644
--- a/xen/arch/x86/x86_64/compat/entry.S
+++ b/xen/arch/x86/x86_64/compat/entry.S
@@ -11,8 +11,6 @@
 #include <public/xen.h>
 #include <irq_vectors.h>
 
-#ifdef CONFIG_PV32
-
 ENTRY(entry_int82)
         ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP
         pushq $0
@@ -29,8 +27,6 @@ ENTRY(entry_int82)
         mov   %rsp, %rdi
         call  do_entry_int82
 
-#endif /* CONFIG_PV32 */
-
 /* %rbx: struct vcpu */
 ENTRY(compat_test_all_events)
         ASSERT_NOT_IN_ATOMIC
@@ -197,43 +193,7 @@ ENTRY(cr4_pv32_restore)
         xor   %eax, %eax
         ret
 
-        .section .text.entry, "ax", @progbits
-
-/* See lstar_enter for entry register state. */
-ENTRY(cstar_enter)
-#ifdef CONFIG_XEN_SHSTK
-        ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK
-#endif
-        /* sti could live here when we don't switch page tables below. */
-        CR4_PV32_RESTORE
-        movq  8(%rsp),%rax /* Restore %rax. */
-        movq  $FLAT_USER_SS32, 8(%rsp) /* Assume a 64bit domain.  Compat handled lower. */
-        pushq %r11
-        pushq $FLAT_USER_CS32
-        pushq %rcx
-        pushq $0
-        movl  $TRAP_syscall, 4(%rsp)
-        SAVE_ALL
-
-        SPEC_CTRL_ENTRY_FROM_PV /* Req: %rsp=regs/cpuinfo, Clob: acd */
-        /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
-
-        GET_STACK_END(bx)
-        mov   STACK_CPUINFO_FIELD(xen_cr3)(%rbx), %rcx
-        test  %rcx, %rcx
-        jz    .Lcstar_cr3_okay
-        movb  $0, STACK_CPUINFO_FIELD(use_pv_cr3)(%rbx)
-        mov   %rcx, %cr3
-        /* %r12 is still zero at this point. */
-        mov   %r12, STACK_CPUINFO_FIELD(xen_cr3)(%rbx)
-.Lcstar_cr3_okay:
-        sti
-
-        movq  STACK_CPUINFO_FIELD(current_vcpu)(%rbx), %rbx
-        movq  VCPU_domain(%rbx),%rcx
-        cmpb  $0,DOMAIN_is_32bit_pv(%rcx)
-        je    switch_to_kernel
-
+ENTRY(compat_syscall)
         /* Fix up reported %cs/%ss for compat domains. */
         movl  $FLAT_COMPAT_USER_SS, UREGS_ss(%rsp)
         movl  $FLAT_COMPAT_USER_CS, UREGS_cs(%rsp)
@@ -262,8 +222,6 @@ UNLIKELY_END(compat_syscall_gpf)
         movb  %cl,TRAPBOUNCE_flags(%rdx)
         jmp   .Lcompat_bounce_exception
 
-        .text
-
 ENTRY(compat_sysenter)
         CR4_PV32_RESTORE
         movq  VCPU_trap_ctxt(%rbx),%rcx
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index e2ff4a9018..d5998acf88 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -24,7 +24,7 @@
 
 #ifdef CONFIG_PV
 /* %rbx: struct vcpu */
-ENTRY(switch_to_kernel)
+switch_to_kernel:
         leaq  VCPU_trap_bounce(%rbx),%rdx
 
         /* TB_eip = 32-bit syscall ? syscall32_addr : syscall_addr */
@@ -283,6 +283,45 @@ ENTRY(lstar_enter)
         call  pv_hypercall
         jmp   test_all_events
 
+/* See lstar_enter for entry register state. */
+ENTRY(cstar_enter)
+#ifdef CONFIG_XEN_SHSTK
+        ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK
+#endif
+        /* sti could live here when we don't switch page tables below. */
+        CR4_PV32_RESTORE
+        movq  8(%rsp), %rax /* Restore %rax. */
+        movq  $FLAT_USER_SS32, 8(%rsp) /* Assume a 64bit domain.  Compat handled lower. */
+        pushq %r11
+        pushq $FLAT_USER_CS32
+        pushq %rcx
+        pushq $0
+        movl  $TRAP_syscall, 4(%rsp)
+        SAVE_ALL
+
+        SPEC_CTRL_ENTRY_FROM_PV /* Req: %rsp=regs/cpuinfo, Clob: acd */
+        /* WARNING! `ret`, `call *`, `jmp *` not safe before this point. */
+
+        GET_STACK_END(bx)
+        mov   STACK_CPUINFO_FIELD(xen_cr3)(%rbx), %rcx
+        test  %rcx, %rcx
+        jz    .Lcstar_cr3_okay
+        movb  $0, STACK_CPUINFO_FIELD(use_pv_cr3)(%rbx)
+        mov   %rcx, %cr3
+        /* %r12 is still zero at this point. */
+        mov   %r12, STACK_CPUINFO_FIELD(xen_cr3)(%rbx)
+.Lcstar_cr3_okay:
+        sti
+
+        movq  STACK_CPUINFO_FIELD(current_vcpu)(%rbx), %rbx
+
+#ifdef CONFIG_PV32
+        movq  VCPU_domain(%rbx), %rcx
+        cmpb  $0, DOMAIN_is_32bit_pv(%rcx)
+        jne   compat_syscall
+#endif
+        jmp   switch_to_kernel
+
 ENTRY(sysenter_entry)
 #ifdef CONFIG_XEN_SHSTK
         ALTERNATIVE "", "setssbsy", X86_FEATURE_XEN_SHSTK
@@ -340,8 +379,10 @@ UNLIKELY_END(sysenter_gpf)
         movq  VCPU_domain(%rbx),%rdi
         movq  %rax,TRAPBOUNCE_eip(%rdx)
         movb  %cl,TRAPBOUNCE_flags(%rdx)
+#ifdef CONFIG_PV32
         cmpb  $0, DOMAIN_is_32bit_pv(%rdi)
         jne   compat_sysenter
+#endif
         jmp   .Lbounce_exception
 
 ENTRY(int80_direct_trap)
@@ -382,6 +423,7 @@ UNLIKELY_END(msi_check)
         mov    0x80 * TRAPINFO_sizeof + TRAPINFO_eip(%rsi), %rdi
         movzwl 0x80 * TRAPINFO_sizeof + TRAPINFO_cs (%rsi), %ecx
 
+#ifdef CONFIG_PV32
         mov   %ecx, %edx
         and   $~3, %edx
 
@@ -390,6 +432,10 @@ UNLIKELY_END(msi_check)
 
         test  %rdx, %rdx
         jz    int80_slow_path
+#else
+        test  %rdi, %rdi
+        jz    int80_slow_path
+#endif
 
         /* Construct trap_bounce from trap_ctxt[0x80]. */
         lea   VCPU_trap_bounce(%rbx), %rdx
@@ -402,8 +448,10 @@ UNLIKELY_END(msi_check)
         lea   (, %rcx, TBF_INTERRUPT), %ecx
         mov   %cl, TRAPBOUNCE_flags(%rdx)
 
+#ifdef CONFIG_PV32
         cmpb  $0, DOMAIN_is_32bit_pv(%rax)
         jne   compat_int80_direct_trap
+#endif
 
         call  create_bounce_frame
         jmp   test_all_events
@@ -555,12 +603,16 @@ ENTRY(dom_crash_sync_extable)
         GET_STACK_END(ax)
         leaq  STACK_CPUINFO_FIELD(guest_cpu_user_regs)(%rax),%rsp
         # create_bounce_frame() temporarily clobbers CS.RPL. Fix up.
+#ifdef CONFIG_PV32
         movq  STACK_CPUINFO_FIELD(current_vcpu)(%rax), %rax
         movq  VCPU_domain(%rax),%rax
         cmpb  $0, DOMAIN_is_32bit_pv(%rax)
         sete  %al
         leal  (%rax,%rax,2),%eax
         orb   %al,UREGS_cs(%rsp)
+#else
+        orb   $3, UREGS_cs(%rsp)
+#endif
         xorl  %edi,%edi
         jmp   asm_domain_crash_synchronous /* Does not return */
         .popsection
@@ -578,10 +630,14 @@ ret_from_intr:
         GET_CURRENT(bx)
         testb $3, UREGS_cs(%rsp)
         jz    restore_all_xen
+#ifdef CONFIG_PV32
         movq  VCPU_domain(%rbx), %rax
         cmpb  $0, DOMAIN_is_32bit_pv(%rax)
         je    test_all_events
         jmp   compat_test_all_events
+#else
+        jmp   test_all_events
+#endif
 #else
 ret_from_intr:
         ASSERT_CONTEXT_IS_XEN
@@ -671,7 +727,7 @@ handle_exception_saved:
         testb $X86_EFLAGS_IF>>8,UREGS_eflags+1(%rsp)
         jz    exception_with_ints_disabled
 
-#ifdef CONFIG_PV
+#if defined(CONFIG_PV32)
         ALTERNATIVE_2 "jmp .Lcr4_pv32_done", \
             __stringify(mov VCPU_domain(%rbx), %rax), X86_FEATURE_XEN_SMEP, \
             __stringify(mov VCPU_domain(%rbx), %rax), X86_FEATURE_XEN_SMAP
@@ -711,7 +767,7 @@ handle_exception_saved:
         test  $~(PFEC_write_access|PFEC_insn_fetch),%eax
         jz    compat_test_all_events
 .Lcr4_pv32_done:
-#else
+#elif !defined(CONFIG_PV)
         ASSERT_CONTEXT_IS_XEN
 #endif /* CONFIG_PV */
         sti
@@ -730,9 +786,11 @@ handle_exception_saved:
 #ifdef CONFIG_PV
         testb $3,UREGS_cs(%rsp)
         jz    restore_all_xen
+#ifdef CONFIG_PV32
         movq  VCPU_domain(%rbx),%rax
         cmpb  $0, DOMAIN_is_32bit_pv(%rax)
         jne   compat_test_all_events
+#endif
         jmp   test_all_events
 #else
         ASSERT_CONTEXT_IS_XEN
@@ -968,10 +1026,15 @@ handle_ist_exception:
         je    1f
         movl  $EVENT_CHECK_VECTOR,%edi
         call  send_IPI_self
-1:      movq  VCPU_domain(%rbx),%rax
+1:
+#ifdef CONFIG_PV32
+        movq  VCPU_domain(%rbx),%rax
         cmpb  $0,DOMAIN_is_32bit_pv(%rax)
         je    restore_all_guest
         jmp   compat_restore_all_guest
+#else
+        jmp   restore_all_guest
+#endif
 #else
         ASSERT_CONTEXT_IS_XEN
         jmp   restore_all_xen
diff --git a/xen/include/asm-x86/asm_defns.h b/xen/include/asm-x86/asm_defns.h
index d480a4461b..d9431180cf 100644
--- a/xen/include/asm-x86/asm_defns.h
+++ b/xen/include/asm-x86/asm_defns.h
@@ -305,7 +305,7 @@ static always_inline void stac(void)
         subq  $-(UREGS_error_code-UREGS_r15+\adj), %rsp
 .endm
 
-#ifdef CONFIG_PV
+#ifdef CONFIG_PV32
 #define CR4_PV32_RESTORE                               \
     ALTERNATIVE_2 "",                                  \
         "call cr4_pv32_restore", X86_FEATURE_XEN_SMEP, \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 16 08:33:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Apr 2021 08:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111616.213496 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXJul-0005YL-OW; Fri, 16 Apr 2021 08:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111616.213496; Fri, 16 Apr 2021 08: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 1lXJul-0005YD-JY; Fri, 16 Apr 2021 08:33:23 +0000
Received: by outflank-mailman (input) for mailman id 111616;
 Fri, 16 Apr 2021 08: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 1lXJuk-0005Y3-J0
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 08: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 1lXJuk-00029z-HO
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 08:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXJuk-0004bT-Fi
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 08: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=6CgXFNbLC+lSwyOl7zY+a2ieO8Oac0eTuVYvJXizExw=; b=XK6S61qbNgtgIpS8jgZrcfvdPF
	kH/jmnUEUIHFKOT17DSClIYbGs4O7t27w2k/uXy6YWr48kNBQZycbuPI644S1YhSSOS0zhl3oS2pg
	XogwxBexCS3KLMyVhkqv52aBPfA2HhOy++hT+lpqPqO0O744786jzPjnJ48sZ6OrtplQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: slim down hypercall handling when !PV32
Message-Id: <E1lXJuk-0004bT-Fi@xenbits.xenproject.org>
Date: Fri, 16 Apr 2021 08:33:22 +0000

commit 527922008bcedb53f01cf91428303d650fb67360
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 15 13:35:32 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 15 13:35:32 2021 +0200

    x86: slim down hypercall handling when !PV32
    
    In such a build various of the compat handlers aren't needed. Don't
    reference them from the hypercall table, and compile out those which
    aren't needed for HVM. Also compile out switch_compat(), which has no
    purpose in such a build.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Wei Liu <wl@xen.org>
---
 xen/arch/x86/Makefile               |  3 ++-
 xen/arch/x86/hvm/hypercall.c        |  4 +++-
 xen/arch/x86/mm.c                   |  4 +++-
 xen/arch/x86/pv/callback.c          | 14 ++++++++++++--
 xen/arch/x86/pv/descriptor-tables.c | 24 ++++++++++++++----------
 xen/arch/x86/pv/domain.c            |  2 ++
 xen/arch/x86/pv/hypercall.c         | 10 +++++++++-
 xen/arch/x86/pv/iret.c              |  2 ++
 xen/arch/x86/pv/shim.c              | 10 +++++++---
 xen/include/asm-x86/compat.h        |  8 ++++++++
 xen/include/asm-x86/hypercall.h     |  5 ++++-
 xen/include/xen/compat.h            |  3 ---
 12 files changed, 66 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index b6567c4127..399ee508c2 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -17,7 +17,8 @@ obj-bin-y += bzimage.init.o
 obj-bin-y += clear_page.o
 obj-bin-y += copy_page.o
 obj-y += cpuid.o
-obj-$(CONFIG_PV) += compat.o x86_64/compat.o
+obj-$(CONFIG_PV) += compat.o
+obj-$(CONFIG_PV32) += x86_64/compat.o
 obj-$(CONFIG_KEXEC) += crash.o
 obj-$(CONFIG_GDBSX) += debug.o
 obj-y += delay.o
diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index b084afcbce..2d27fcbd2c 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -121,7 +121,9 @@ static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
 #define do_arch_1             paging_domctl_continuation
 
-static const hypercall_table_t hvm_hypercall_table[] = {
+static const struct {
+    hypercall_fn_t *native, *compat;
+} hvm_hypercall_table[] = {
     HVM_CALL(memory_op),
 #ifdef CONFIG_GRANT_TABLE
     HVM_CALL(grant_table_op),
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 69d04ad809..b7a10bbdd4 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4512,7 +4512,9 @@ long do_update_va_mapping_otherdomain(unsigned long va, u64 val64,
 
     return rc;
 }
+#endif /* CONFIG_PV */
 
+#ifdef CONFIG_PV32
 int compat_update_va_mapping(unsigned int va, uint32_t lo, uint32_t hi,
                              unsigned int flags)
 {
@@ -4547,7 +4549,7 @@ int compat_update_va_mapping_otherdomain(unsigned int va,
 
     return rc;
 }
-#endif /* CONFIG_PV */
+#endif /* CONFIG_PV32 */
 
 typedef struct e820entry e820entry_t;
 DEFINE_XEN_GUEST_HANDLE(e820entry_t);
diff --git a/xen/arch/x86/pv/callback.c b/xen/arch/x86/pv/callback.c
index 97242cd3d4..42a6aa0831 100644
--- a/xen/arch/x86/pv/callback.c
+++ b/xen/arch/x86/pv/callback.c
@@ -19,12 +19,11 @@
 #include <xen/event.h>
 #include <xen/hypercall.h>
 #include <xen/guest_access.h>
-#include <compat/callback.h>
-#include <compat/nmi.h>
 
 #include <asm/shared.h>
 
 #include <public/callback.h>
+#include <public/nmi.h>
 
 static int register_guest_nmi_callback(unsigned long address)
 {
@@ -203,6 +202,11 @@ long do_set_callbacks(unsigned long event_address,
     return 0;
 }
 
+#ifdef CONFIG_PV32
+
+#include <compat/callback.h>
+#include <compat/nmi.h>
+
 static long compat_register_guest_callback(struct compat_callback_register *reg)
 {
     long ret = 0;
@@ -343,6 +347,8 @@ long compat_set_callbacks(unsigned long event_selector,
     return 0;
 }
 
+#endif /* CONFIG_PV32 */
+
 long do_set_trap_table(XEN_GUEST_HANDLE_PARAM(const_trap_info_t) traps)
 {
     struct trap_info cur;
@@ -388,6 +394,7 @@ long do_set_trap_table(XEN_GUEST_HANDLE_PARAM(const_trap_info_t) traps)
     return rc;
 }
 
+#ifdef CONFIG_PV32
 int compat_set_trap_table(XEN_GUEST_HANDLE(trap_info_compat_t) traps)
 {
     struct vcpu *curr = current;
@@ -429,6 +436,7 @@ int compat_set_trap_table(XEN_GUEST_HANDLE(trap_info_compat_t) traps)
 
     return rc;
 }
+#endif
 
 long do_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
@@ -455,6 +463,7 @@ long do_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     return rc;
 }
 
+#ifdef CONFIG_PV32
 int compat_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
     struct compat_nmi_callback cb;
@@ -479,6 +488,7 @@ int compat_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
     return rc;
 }
+#endif
 
 /*
  * Local variables:
diff --git a/xen/arch/x86/pv/descriptor-tables.c b/xen/arch/x86/pv/descriptor-tables.c
index 39c1a2311a..5e84704400 100644
--- a/xen/arch/x86/pv/descriptor-tables.c
+++ b/xen/arch/x86/pv/descriptor-tables.c
@@ -149,6 +149,8 @@ long do_set_gdt(XEN_GUEST_HANDLE_PARAM(xen_ulong_t) frame_list,
     return ret;
 }
 
+#ifdef CONFIG_PV32
+
 int compat_set_gdt(XEN_GUEST_HANDLE_PARAM(uint) frame_list,
                    unsigned int entries)
 {
@@ -185,6 +187,18 @@ int compat_set_gdt(XEN_GUEST_HANDLE_PARAM(uint) frame_list,
     return ret;
 }
 
+int compat_update_descriptor(uint32_t pa_lo, uint32_t pa_hi,
+                             uint32_t desc_lo, uint32_t desc_hi)
+{
+    seg_desc_t d;
+
+    d.raw = ((uint64_t)desc_hi << 32) | desc_lo;
+
+    return do_update_descriptor(pa_lo | ((uint64_t)pa_hi << 32), d);
+}
+
+#endif /* CONFIG_PV32 */
+
 static bool check_descriptor(const struct domain *dom, seg_desc_t *d)
 {
     unsigned int a = d->a, b = d->b, cs, dpl;
@@ -334,16 +348,6 @@ long do_update_descriptor(uint64_t gaddr, seg_desc_t d)
     return ret;
 }
 
-int compat_update_descriptor(uint32_t pa_lo, uint32_t pa_hi,
-                             uint32_t desc_lo, uint32_t desc_hi)
-{
-    seg_desc_t d;
-
-    d.raw = ((uint64_t)desc_hi << 32) | desc_lo;
-
-    return do_update_descriptor(pa_lo | ((uint64_t)pa_hi << 32), d);
-}
-
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index 23d6009143..f1cb92585e 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -212,6 +212,7 @@ unsigned long pv_make_cr4(const struct vcpu *v)
     return cr4;
 }
 
+#ifdef CONFIG_PV32
 int switch_compat(struct domain *d)
 {
     struct vcpu *v;
@@ -256,6 +257,7 @@ int switch_compat(struct domain *d)
 
     return rc;
 }
+#endif
 
 static int pv_create_gdt_ldt_l1tab(struct vcpu *v)
 {
diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c
index 20795b4b57..5d02eebc8d 100644
--- a/xen/arch/x86/pv/hypercall.c
+++ b/xen/arch/x86/pv/hypercall.c
@@ -25,12 +25,18 @@
 #include <xen/trace.h>
 #include <irq_vectors.h>
 
+#ifdef CONFIG_PV32
 #define HYPERCALL(x)                                                \
     [ __HYPERVISOR_ ## x ] = { (hypercall_fn_t *) do_ ## x,         \
                                (hypercall_fn_t *) do_ ## x }
 #define COMPAT_CALL(x)                                              \
     [ __HYPERVISOR_ ## x ] = { (hypercall_fn_t *) do_ ## x,         \
                                (hypercall_fn_t *) compat_ ## x }
+#else
+#define HYPERCALL(x)                                                \
+    [ __HYPERVISOR_ ## x ] = { (hypercall_fn_t *) do_ ## x }
+#define COMPAT_CALL(x) HYPERCALL(x)
+#endif
 
 #define do_arch_1             paging_domctl_continuation
 
@@ -176,6 +182,7 @@ void pv_hypercall(struct cpu_user_regs *regs)
         }
 #endif
     }
+#ifdef CONFIG_PV32
     else
     {
         unsigned int ebx = regs->ebx;
@@ -225,6 +232,7 @@ void pv_hypercall(struct cpu_user_regs *regs)
         }
 #endif
     }
+#endif /* CONFIG_PV32 */
 
     /*
      * PV guests use SYSCALL or INT $0x82 to make a hypercall, both of which
@@ -255,7 +263,7 @@ enum mc_disposition arch_do_multicall_call(struct mc_state *state)
         else
             call->result = -ENOSYS;
     }
-#ifdef CONFIG_COMPAT
+#ifdef CONFIG_PV32
     else
     {
         struct compat_multicall_entry *call = &state->compat_call;
diff --git a/xen/arch/x86/pv/iret.c b/xen/arch/x86/pv/iret.c
index b508dc17b7..29a2f7cc45 100644
--- a/xen/arch/x86/pv/iret.c
+++ b/xen/arch/x86/pv/iret.c
@@ -104,6 +104,7 @@ unsigned long do_iret(void)
     return 0;
 }
 
+#ifdef CONFIG_PV32
 unsigned int compat_iret(void)
 {
     struct cpu_user_regs *regs = guest_cpu_user_regs();
@@ -223,6 +224,7 @@ unsigned int compat_iret(void)
      */
     return regs->eax;
 }
+#endif
 
 /*
  * Local variables:
diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index b4e83e0778..92cb1adeed 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -255,13 +255,17 @@ void __init pv_shim_setup_dom(struct domain *d, l4_pgentry_t *l4start,
      */
     rw_pv_hypercall_table = __va(__pa(pv_hypercall_table));
     rw_pv_hypercall_table[__HYPERVISOR_event_channel_op].native =
-        rw_pv_hypercall_table[__HYPERVISOR_event_channel_op].compat =
         (hypercall_fn_t *)pv_shim_event_channel_op;
-
     rw_pv_hypercall_table[__HYPERVISOR_grant_table_op].native =
-        rw_pv_hypercall_table[__HYPERVISOR_grant_table_op].compat =
         (hypercall_fn_t *)pv_shim_grant_table_op;
 
+#ifdef CONFIG_PV32
+    rw_pv_hypercall_table[__HYPERVISOR_event_channel_op].compat =
+        (hypercall_fn_t *)pv_shim_event_channel_op;
+    rw_pv_hypercall_table[__HYPERVISOR_grant_table_op].compat =
+        (hypercall_fn_t *)pv_shim_grant_table_op;
+#endif
+
     guest = d;
 
     /*
diff --git a/xen/include/asm-x86/compat.h b/xen/include/asm-x86/compat.h
index f9df74ece8..0c8719f9b0 100644
--- a/xen/include/asm-x86/compat.h
+++ b/xen/include/asm-x86/compat.h
@@ -6,3 +6,11 @@
 
 typedef uint32_t compat_ptr_t;
 typedef unsigned long full_ptr_t;
+
+struct domain;
+#ifdef CONFIG_PV32
+int switch_compat(struct domain *);
+#else
+#include <xen/errno.h>
+static inline int switch_compat(struct domain *d) { return -EOPNOTSUPP; }
+#endif
diff --git a/xen/include/asm-x86/hypercall.h b/xen/include/asm-x86/hypercall.h
index 1cd8046464..686f3a3803 100644
--- a/xen/include/asm-x86/hypercall.h
+++ b/xen/include/asm-x86/hypercall.h
@@ -16,7 +16,10 @@ typedef unsigned long hypercall_fn_t(
     unsigned long, unsigned long, unsigned long);
 
 typedef struct {
-    hypercall_fn_t *native, *compat;
+    hypercall_fn_t *native;
+#ifdef CONFIG_PV32
+    hypercall_fn_t *compat;
+#endif
 } hypercall_table_t;
 
 typedef struct {
diff --git a/xen/include/xen/compat.h b/xen/include/xen/compat.h
index 895e2ff68d..91db042963 100644
--- a/xen/include/xen/compat.h
+++ b/xen/include/xen/compat.h
@@ -227,9 +227,6 @@ void xlat_start_info(struct start_info *, enum XLAT_start_info_console);
 struct vcpu_runstate_info;
 void xlat_vcpu_runstate_info(struct vcpu_runstate_info *);
 
-struct domain;
-int switch_compat(struct domain *);
-
 #else
 
 #define compat_handle_is_null(hnd) 0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 16 08:33:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Apr 2021 08:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111617.213498 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXJuv-0005aJ-Qi; Fri, 16 Apr 2021 08:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111617.213498; Fri, 16 Apr 2021 08: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 1lXJuv-0005aB-Ng; Fri, 16 Apr 2021 08:33:33 +0000
Received: by outflank-mailman (input) for mailman id 111617;
 Fri, 16 Apr 2021 08: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 1lXJuu-0005a0-Pm
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 08: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 1lXJuu-0002A6-Os
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 08:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXJuu-0004cS-KU
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 08: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=0APAZs04Dsastr/3/4Jj7FOqFXXWDNfZjmv7Bv5JQqc=; b=pEhjchwetjgV4yw+tgWKoT1+iW
	sREF4ajyD4/w1Ls2DtUvCV21wmDeTHRGOGX0Hvb4hsHj+V1kyTf4hxNgkaYmxmm9fxI1wJRhs6K8C
	yOqsQQP9pUfzq3m1KojvqBquWnu5i8rJx0FairZh1+spDUC1M6EwagvGBnnWfqypQm7E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: avoid building COMPAT code when !HVM && !PV32
Message-Id: <E1lXJuu-0004cS-KU@xenbits.xenproject.org>
Date: Fri, 16 Apr 2021 08:33:32 +0000

commit d23d792478db4fd2984fb0b70611a2e97eceaa8c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 15 13:43:51 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 15 13:43:51 2021 +0200

    x86: avoid building COMPAT code when !HVM && !PV32
    
    It was probably a mistake to, over time, drop various CONFIG_COMPAT
    conditionals from x86-specific code, as we now have a build
    configuration again where we'd prefer this to be unset. Arrange for
    CONFIG_COMPAT to actually be off in this case, dealing with fallout.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Wei Liu <wl@xen.org>
---
 xen/arch/x86/Kconfig              |  4 +++-
 xen/arch/x86/Makefile             |  6 ++++--
 xen/arch/x86/cpu/mcheck/mce.c     | 11 +++++++++++
 xen/arch/x86/cpu/vpmu.c           |  6 ++++++
 xen/arch/x86/domain.c             | 28 +++++++++++++++++++++++++++-
 xen/arch/x86/domctl.c             | 12 ++++++++++++
 xen/arch/x86/efi/Makefile         |  9 +++++----
 xen/arch/x86/hypercall.c          |  9 +++++++++
 xen/arch/x86/oprofile/backtrace.c |  4 +++-
 xen/arch/x86/oprofile/xenoprof.c  |  5 ++++-
 xen/arch/x86/pv/dom0_build.c      |  2 ++
 xen/arch/x86/setup.c              |  4 ++++
 xen/arch/x86/x86_64/Makefile      |  6 +++---
 xen/arch/x86/x86_64/mm.c          |  2 ++
 xen/common/Kconfig                |  3 +++
 xen/common/time.c                 |  2 +-
 xen/include/asm-x86/compat.h      |  4 ++++
 xen/include/asm-x86/hypercall.h   |  5 ++++-
 xen/include/asm-x86/shared.h      | 30 ++++++++++++++++++++++++++++++
 xen/include/xen/compat.h          |  7 +++++--
 xen/include/xen/sched.h           |  3 +--
 21 files changed, 143 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index f79e6634db..cb401fa2e5 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -6,9 +6,9 @@ config X86
 	select ACPI
 	select ACPI_LEGACY_TABLES_LOOKUP
 	select ARCH_SUPPORTS_INT128
-	select COMPAT
 	select CORE_PARKING
 	select HAS_ALTERNATIVE
+	select HAS_COMPAT
 	select HAS_CPUFREQ
 	select HAS_EHCI
 	select HAS_EX_TABLE
@@ -57,6 +57,7 @@ config PV32
 	bool "Support for 32bit PV guests"
 	depends on PV
 	default y
+	select COMPAT
 	---help---
 	  The 32bit PV ABI uses Ring1, an area of the x86 architecture which
 	  was deprecated and mostly removed in the AMD64 spec.  As a result,
@@ -91,6 +92,7 @@ config PV_LINEAR_PT
 
 config HVM
 	def_bool !PV_SHIM_EXCLUSIVE
+	select COMPAT
 	select IOREQ_SERVER
 	prompt "HVM support"
 	---help---
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 399ee508c2..053206e4f0 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -50,7 +50,8 @@ obj-y += nmi.o
 obj-y += numa.o
 obj-y += pci.o
 obj-y += percpu.o
-obj-y += physdev.o x86_64/physdev.o
+obj-y += physdev.o
+obj-$(CONFIG_COMPAT) += x86_64/physdev.o
 obj-y += psr.o
 obj-y += setup.o
 obj-y += shutdown.o
@@ -72,7 +73,8 @@ obj-y += xstate.o
 
 ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
 obj-y += domctl.o
-obj-y += platform_hypercall.o x86_64/platform_hypercall.o
+obj-y += platform_hypercall.o
+obj-$(CONFIG_COMPAT) += x86_64/platform_hypercall.o
 obj-y += sysctl.o
 endif
 
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 3a92e9db4e..7f433343bc 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -1291,6 +1291,8 @@ static void x86_mc_mceinject(void *data)
 #error BITS_PER_LONG definition absent
 #endif
 
+# ifdef CONFIG_COMPAT
+
 # include <compat/arch-x86/xen-mca.h>
 
 # define xen_mcinfo_msr              mcinfo_msr
@@ -1343,6 +1345,11 @@ CHECK_mcinfo_recovery;
 # undef xen_page_offline_action
 # undef xen_mcinfo_recovery
 
+# else
+#  define compat_handle_is_null(h) true
+#  define copy_to_compat(h, p, n)  true /* really (-EFAULT), but gcc chokes */
+# endif /* CONFIG_COMPAT */
+
 /* Machine Check Architecture Hypercall */
 long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc)
 {
@@ -1351,11 +1358,15 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc)
     struct vcpu *v = current;
     union {
         struct xen_mc_fetch *nat;
+#ifdef CONFIG_COMPAT
         struct compat_mc_fetch *cmp;
+#endif
     } mc_fetch;
     union {
         struct xen_mc_physcpuinfo *nat;
+#ifdef CONFIG_COMPAT
         struct compat_mc_physcpuinfo *cmp;
+#endif
     } mc_physcpuinfo;
     uint32_t flags, cmdflags;
     int nlcpu;
diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c
index ab667361d3..d8659c63f8 100644
--- a/xen/arch/x86/cpu/vpmu.c
+++ b/xen/arch/x86/cpu/vpmu.c
@@ -39,10 +39,12 @@
 #include <public/pmu.h>
 #include <xsm/xsm.h>
 
+#ifdef CONFIG_COMPAT
 #include <compat/pmu.h>
 CHECK_pmu_cntr_pair;
 CHECK_pmu_data;
 CHECK_pmu_params;
+#endif
 
 static unsigned int __read_mostly opt_vpmu_enabled;
 unsigned int __read_mostly vpmu_mode = XENPMU_MODE_OFF;
@@ -232,6 +234,7 @@ void vpmu_do_interrupt(struct cpu_user_regs *regs)
             domid = sampled->domain->domain_id;
 
         /* Store appropriate registers in xenpmu_data */
+#ifdef CONFIG_COMPAT
         /* FIXME: 32-bit PVH should go here as well */
         if ( is_pv_32bit_vcpu(sampling) )
         {
@@ -254,6 +257,7 @@ void vpmu_do_interrupt(struct cpu_user_regs *regs)
                 *flags |= PMU_SAMPLE_USER;
         }
         else
+#endif
         {
             struct xen_pmu_regs *r = &vpmu->xenpmu_data->pmu.r.regs;
 
@@ -448,7 +452,9 @@ static int vpmu_arch_initialise(struct vcpu *v)
     BUILD_BUG_ON(sizeof(struct xen_pmu_intel_ctxt) > XENPMU_CTXT_PAD_SZ);
     BUILD_BUG_ON(sizeof(struct xen_pmu_amd_ctxt) > XENPMU_CTXT_PAD_SZ);
     BUILD_BUG_ON(sizeof(struct xen_pmu_regs) > XENPMU_REGS_PAD_SZ);
+#ifdef CONFIG_COMPAT
     BUILD_BUG_ON(sizeof(struct compat_pmu_regs) > XENPMU_REGS_PAD_SZ);
+#endif
 
     ASSERT(!(vpmu->flags & ~VPMU_AVAILABLE) && !vpmu->context);
 
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index b212729880..40e8ce7544 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -64,7 +64,9 @@
 #include <asm/amd.h>
 #include <xen/numa.h>
 #include <xen/iommu.h>
+#ifdef CONFIG_COMPAT
 #include <compat/vcpu.h>
+#endif
 #include <asm/psr.h>
 #include <asm/pv/domain.h>
 #include <asm/pv/mm.h>
@@ -1020,11 +1022,13 @@ void arch_domain_creation_finished(struct domain *d)
         hvm_domain_creation_finished(d);
 }
 
+#ifdef CONFIG_COMPAT
 #define xen_vcpu_guest_context vcpu_guest_context
 #define fpu_ctxt fpu_ctxt.x
 CHECK_FIELD_(struct, vcpu_guest_context, fpu_ctxt);
 #undef fpu_ctxt
 #undef xen_vcpu_guest_context
+#endif
 
 /* Called by XEN_DOMCTL_setvcpucontext and VCPUOP_initialise. */
 int arch_set_info_guest(
@@ -1045,7 +1049,11 @@ int arch_set_info_guest(
      * we expect the tools to DTRT even in compat-mode callers. */
     compat = is_pv_32bit_domain(d);
 
+#ifdef CONFIG_COMPAT
 #define c(fld) (compat ? (c.cmp->fld) : (c.nat->fld))
+#else
+#define c(fld) (c.nat->fld)
+#endif
     flags = c(flags);
 
     if ( is_pv_domain(d) )
@@ -1078,6 +1086,7 @@ int arch_set_info_guest(
             if ( !__addr_ok(c.nat->ldt_base) )
                 return -EINVAL;
         }
+#ifdef CONFIG_COMPAT
         else
         {
             fixup_guest_stack_selector(d, c.cmp->user_regs.ss);
@@ -1089,6 +1098,7 @@ int arch_set_info_guest(
             for ( i = 0; i < ARRAY_SIZE(c.cmp->trap_ctxt); i++ )
                 fixup_guest_code_selector(d, c.cmp->trap_ctxt[i].cs);
         }
+#endif
 
         /* LDT safety checks. */
         if ( ((c(ldt_base) & (PAGE_SIZE - 1)) != 0) ||
@@ -1119,6 +1129,7 @@ int arch_set_info_guest(
             memcpy(v->arch.pv.trap_ctxt, c.nat->trap_ctxt,
                    sizeof(c.nat->trap_ctxt));
     }
+#ifdef CONFIG_COMPAT
     else
     {
         XLAT_cpu_user_regs(&v->arch.user_regs, &c.cmp->user_regs);
@@ -1129,6 +1140,7 @@ int arch_set_info_guest(
                                c.cmp->trap_ctxt + i);
         }
     }
+#endif
 
     if ( v->vcpu_id == 0 && (c(vm_assist) & ~arch_vm_assist_valid_mask(d)) )
         return -EINVAL;
@@ -1184,13 +1196,17 @@ int arch_set_info_guest(
                 pfn = pagetable_get_pfn(v->arch.guest_table_user);
                 fail |= xen_pfn_to_cr3(pfn) != c.nat->ctrlreg[1];
             }
-        } else {
+        }
+#ifdef CONFIG_COMPAT
+        else
+        {
             l4_pgentry_t *l4tab = map_domain_page(_mfn(pfn));
 
             pfn = l4e_get_pfn(*l4tab);
             unmap_domain_page(l4tab);
             fail = compat_pfn_to_cr3(pfn) != c.cmp->ctrlreg[3];
         }
+#endif
 
         fail |= v->arch.pv.gdt_ents != c(gdt_ents);
         for ( i = 0; !fail && i < nr_gdt_frames; ++i )
@@ -1293,6 +1309,7 @@ int arch_set_info_guest(
 
     if ( !compat )
         rc = pv_set_gdt(v, c.nat->gdt_frames, c.nat->gdt_ents);
+#ifdef CONFIG_COMPAT
     else
     {
         unsigned long gdt_frames[ARRAY_SIZE(v->arch.pv.gdt_frames)];
@@ -1302,6 +1319,7 @@ int arch_set_info_guest(
 
         rc = pv_set_gdt(v, gdt_frames, c.cmp->gdt_ents);
     }
+#endif
     if ( rc != 0 )
         return rc;
 
@@ -1309,8 +1327,10 @@ int arch_set_info_guest(
 
     if ( !compat )
         cr3_mfn = _mfn(xen_cr3_to_pfn(c.nat->ctrlreg[3]));
+#ifdef CONFIG_COMPAT
     else
         cr3_mfn = _mfn(compat_cr3_to_pfn(c.cmp->ctrlreg[3]));
+#endif
     cr3_page = get_page_from_mfn(cr3_mfn, d);
 
     if ( !cr3_page )
@@ -1817,9 +1837,13 @@ bool update_runstate_area(struct vcpu *v)
 
     if ( VM_ASSIST(v->domain, runstate_update_flag) )
     {
+#ifdef CONFIG_COMPAT
         guest_handle = has_32bit_shinfo(v->domain)
             ? &v->runstate_guest.compat.p->state_entry_time + 1
             : &v->runstate_guest.native.p->state_entry_time + 1;
+#else
+        guest_handle = &v->runstate_guest.p->state_entry_time + 1;
+#endif
         guest_handle--;
         runstate.state_entry_time |= XEN_RUNSTATE_UPDATE;
         __raw_copy_to_guest(guest_handle,
@@ -1827,6 +1851,7 @@ bool update_runstate_area(struct vcpu *v)
         smp_wmb();
     }
 
+#ifdef CONFIG_COMPAT
     if ( has_32bit_shinfo(v->domain) )
     {
         struct compat_vcpu_runstate_info info;
@@ -1836,6 +1861,7 @@ bool update_runstate_area(struct vcpu *v)
         rc = true;
     }
     else
+#endif
         rc = __copy_to_guest(runstate_guest(v), &runstate, 1) !=
              sizeof(runstate);
 
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 2aea5b6e9a..e440bd021e 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1386,18 +1386,24 @@ long arch_do_domctl(
     return ret;
 }
 
+#ifdef CONFIG_COMPAT
 #define xen_vcpu_guest_context vcpu_guest_context
 #define fpu_ctxt fpu_ctxt.x
 CHECK_FIELD_(struct, vcpu_guest_context, fpu_ctxt);
 #undef fpu_ctxt
 #undef xen_vcpu_guest_context
+#endif
 
 void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
 {
     unsigned int i;
     const struct domain *d = v->domain;
     bool compat = is_pv_32bit_domain(d);
+#ifdef CONFIG_COMPAT
 #define c(fld) (!compat ? (c.nat->fld) : (c.cmp->fld))
+#else
+#define c(fld) (c.nat->fld)
+#endif
 
     memcpy(&c.nat->fpu_ctxt, v->arch.fpu_ctxt, sizeof(c.nat->fpu_ctxt));
     if ( is_pv_domain(d) )
@@ -1415,6 +1421,7 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
             memcpy(c.nat->trap_ctxt, v->arch.pv.trap_ctxt,
                    sizeof(c.nat->trap_ctxt));
     }
+#ifdef CONFIG_COMPAT
     else
     {
         XLAT_cpu_user_regs(&c.cmp->user_regs, &v->arch.user_regs);
@@ -1425,6 +1432,7 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
                                v->arch.pv.trap_ctxt + i);
         }
     }
+#endif
 
     for ( i = 0; i < ARRAY_SIZE(v->arch.dr); ++i )
         c(debugreg[i] = v->arch.dr[i]);
@@ -1470,8 +1478,10 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
         c(ldt_ents = v->arch.pv.ldt_ents);
         for ( i = 0; i < ARRAY_SIZE(v->arch.pv.gdt_frames); ++i )
             c(gdt_frames[i] = v->arch.pv.gdt_frames[i]);
+#ifdef CONFIG_COMPAT
         BUILD_BUG_ON(ARRAY_SIZE(c.nat->gdt_frames) !=
                      ARRAY_SIZE(c.cmp->gdt_frames));
+#endif
         for ( ; i < ARRAY_SIZE(c.nat->gdt_frames); ++i )
             c(gdt_frames[i] = 0);
         c(gdt_ents = v->arch.pv.gdt_ents);
@@ -1506,6 +1516,7 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
                 pagetable_is_null(v->arch.guest_table_user) ? 0
                 : xen_pfn_to_cr3(pagetable_get_pfn(v->arch.guest_table_user));
         }
+#ifdef CONFIG_COMPAT
         else
         {
             const l4_pgentry_t *l4e =
@@ -1514,6 +1525,7 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
             c.cmp->ctrlreg[3] = compat_pfn_to_cr3(l4e_get_pfn(*l4e));
             unmap_domain_page(l4e);
         }
+#endif
 
         if ( guest_kernel_mode(v, &v->arch.user_regs) )
             c(flags |= VGCF_in_kernel);
diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile
index e857c0f2cc..87b927ed86 100644
--- a/xen/arch/x86/efi/Makefile
+++ b/xen/arch/x86/efi/Makefile
@@ -8,13 +8,14 @@ cmd_objcopy_o_ihex = $(OBJCOPY) -I ihex -O binary $< $@
 
 boot.init.o: buildid.o
 
-EFIOBJ := boot.init.o pe.init.o ebmalloc.o compat.o runtime.o
+EFIOBJ-y := boot.init.o pe.init.o ebmalloc.o runtime.o
+EFIOBJ-$(CONFIG_COMPAT) += compat.o
 
 $(call cc-option-add,cflags-stack-boundary,CC,-mpreferred-stack-boundary=4)
-$(EFIOBJ): CFLAGS-stack-boundary := $(cflags-stack-boundary)
+$(EFIOBJ-y): CFLAGS-stack-boundary := $(cflags-stack-boundary)
 
 obj-y := stub.o
-obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ))
-obj-bin-$(XEN_BUILD_EFI) := $(filter %.init.o,$(EFIOBJ))
+obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ-y))
+obj-bin-$(XEN_BUILD_EFI) := $(filter %.init.o,$(EFIOBJ-y))
 extra-$(XEN_BUILD_EFI) += buildid.o relocs-dummy.o
 nocov-$(XEN_BUILD_EFI) += stub.o
diff --git a/xen/arch/x86/hypercall.c b/xen/arch/x86/hypercall.c
index 14da9bc4ad..73c1bcb147 100644
--- a/xen/arch/x86/hypercall.c
+++ b/xen/arch/x86/hypercall.c
@@ -21,10 +21,15 @@
 
 #include <xen/hypercall.h>
 
+#ifdef CONFIG_COMPAT
 #define ARGS(x, n)                              \
     [ __HYPERVISOR_ ## x ] = { n, n }
 #define COMP(x, n, c)                           \
     [ __HYPERVISOR_ ## x ] = { n, c }
+#else
+#define ARGS(x, n)    [ __HYPERVISOR_ ## x ] = { n }
+#define COMP(x, n, c) ARGS(x, n)
+#endif
 
 const hypercall_args_t hypercall_args_table[NR_hypercalls] =
 {
@@ -113,7 +118,11 @@ unsigned long hypercall_create_continuation(
 
         regs->rax = op;
 
+#ifdef CONFIG_COMPAT
         if ( !curr->hcall_compat )
+#else
+        if ( true )
+#endif
         {
             for ( i = 0; *p != '\0'; i++ )
             {
diff --git a/xen/arch/x86/oprofile/backtrace.c b/xen/arch/x86/oprofile/backtrace.c
index 8233d87caa..929bf51a40 100644
--- a/xen/arch/x86/oprofile/backtrace.c
+++ b/xen/arch/x86/oprofile/backtrace.c
@@ -27,7 +27,6 @@ struct __packed frame_head_32bit {
     uint32_t ret;
 };
 typedef struct frame_head_32bit frame_head32_t;
-DEFINE_COMPAT_HANDLE(frame_head32_t);
 
 static struct frame_head *
 dump_hypervisor_backtrace(struct vcpu *vcpu, const struct frame_head *head,
@@ -58,8 +57,10 @@ dump_guest_backtrace(struct vcpu *vcpu, const struct frame_head *head,
 {
     frame_head_t bufhead;
 
+#ifdef CONFIG_COMPAT
     if ( is_32bit_vcpu(vcpu) )
     {
+        DEFINE_COMPAT_HANDLE(frame_head32_t);
         __compat_handle_const_frame_head32_t guest_head =
             { .c = (unsigned long)head };
         frame_head32_t bufhead32;
@@ -73,6 +74,7 @@ dump_guest_backtrace(struct vcpu *vcpu, const struct frame_head *head,
         bufhead.ret = bufhead32.ret;
     }
     else
+#endif
     {
         XEN_GUEST_HANDLE_PARAM(const_frame_head_t) guest_head =
             const_guest_handle_from_ptr(head, frame_head_t);
diff --git a/xen/arch/x86/oprofile/xenoprof.c b/xen/arch/x86/oprofile/xenoprof.c
index cca759b54f..b20f26bbe5 100644
--- a/xen/arch/x86/oprofile/xenoprof.c
+++ b/xen/arch/x86/oprofile/xenoprof.c
@@ -12,7 +12,6 @@
 #include <xen/sched.h>
 #include <xen/xenoprof.h>
 #include <public/xenoprof.h>
-#include <compat/xenoprof.h>
 #include <asm/hvm/support.h>
 
 #include "op_counter.h"
@@ -54,6 +53,9 @@ int xenoprof_arch_ibs_counter(XEN_GUEST_HANDLE_PARAM(void) arg)
     return 0;
 }
 
+#ifdef CONFIG_COMPAT
+#include <compat/xenoprof.h>
+
 int compat_oprof_arch_counter(XEN_GUEST_HANDLE_PARAM(void) arg)
 {
     struct compat_oprof_counter counter;
@@ -73,6 +75,7 @@ int compat_oprof_arch_counter(XEN_GUEST_HANDLE_PARAM(void) arg)
 
     return 0;
 }
+#endif
 
 int xenoprofile_get_mode(struct vcpu *curr, const struct cpu_user_regs *regs)
 {
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index f7165309a2..265f56a3f8 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -877,9 +877,11 @@ int __init dom0_construct_pv(struct domain *d,
         pv_shim_setup_dom(d, l4start, v_start, vxenstore_start, vconsole_start,
                           vphysmap_start, si);
 
+#ifdef CONFIG_COMPAT
     if ( is_pv_32bit_domain(d) )
         xlat_start_info(si, pv_shim ? XLAT_start_info_console_domU
                                     : XLAT_start_info_console_dom0);
+#endif
 
     /* Return to idle domain's page tables. */
     mapcache_override_current(NULL);
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 68454df8ed..a6658d9769 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -27,8 +27,10 @@
 #include <xen/virtual_region.h>
 #include <xen/watchdog.h>
 #include <public/version.h>
+#ifdef CONFIG_COMPAT
 #include <compat/platform.h>
 #include <compat/xen.h>
+#endif
 #include <xen/bitops.h>
 #include <asm/smp.h>
 #include <asm/processor.h>
@@ -1615,10 +1617,12 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     BUILD_BUG_ON(sizeof(shared_info_t) > PAGE_SIZE);
     BUILD_BUG_ON(sizeof(struct vcpu_info) != 64);
 
+#ifdef CONFIG_COMPAT
     BUILD_BUG_ON(sizeof_field(struct compat_platform_op, u) !=
                  sizeof_field(struct compat_platform_op, u.pad));
     BUILD_BUG_ON(sizeof(start_info_compat_t) > PAGE_SIZE);
     BUILD_BUG_ON(sizeof(struct compat_vcpu_info) != 64);
+#endif
 
     /* Check definitions in public headers match internal defs. */
     BUILD_BUG_ON(__HYPERVISOR_VIRT_START != HYPERVISOR_VIRT_START);
diff --git a/xen/arch/x86/x86_64/Makefile b/xen/arch/x86/x86_64/Makefile
index 2ea536fa71..213b789c42 100644
--- a/xen/arch/x86/x86_64/Makefile
+++ b/xen/arch/x86/x86_64/Makefile
@@ -8,9 +8,9 @@ obj-y += acpi_mmcfg.o
 obj-y += mmconf-fam10h.o
 obj-y += mmconfig_64.o
 obj-y += mmconfig-shared.o
-obj-y += domain.o
-obj-y += cpu_idle.o
-obj-y += cpufreq.o
+obj-$(CONFIG_COMPAT) += domain.o
+obj-$(CONFIG_COMPAT) += cpu_idle.o
+obj-$(CONFIG_COMPAT) += cpufreq.o
 obj-bin-$(CONFIG_KEXEC) += kexec_reloc.o
 
 obj-$(CONFIG_CRASH_DEBUG)   += gdbstub.o
diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index bce1561e1a..d7e67311fa 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -1347,7 +1347,9 @@ void set_gpfn_from_mfn(unsigned long mfn, unsigned long pfn)
     machine_to_phys_mapping[mfn] = entry;
 }
 
+#ifdef CONFIG_COMPAT
 #include "compat/mm.c"
+#endif
 
 /*
  * Local variables:
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index a1755cd380..3064bf6b89 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -25,6 +25,9 @@ config GRANT_TABLE
 config HAS_ALTERNATIVE
 	bool
 
+config HAS_COMPAT
+	bool
+
 config HAS_DEVICE_TREE
 	bool
 
diff --git a/xen/common/time.c b/xen/common/time.c
index 82336e2d5a..22379f4ae2 100644
--- a/xen/common/time.c
+++ b/xen/common/time.c
@@ -108,7 +108,7 @@ void update_domain_wallclock_time(struct domain *d)
     sec = wc_sec + d->time_offset.seconds;
     shared_info(d, wc_sec)    = sec;
     shared_info(d, wc_nsec)   = wc_nsec;
-#ifdef CONFIG_X86
+#if defined(CONFIG_X86) && defined(CONFIG_COMPAT)
     if ( likely(!has_32bit_shinfo(d)) )
         d->shared_info->native.wc_sec_hi = sec >> 32;
     else
diff --git a/xen/include/asm-x86/compat.h b/xen/include/asm-x86/compat.h
index 0c8719f9b0..818cad87db 100644
--- a/xen/include/asm-x86/compat.h
+++ b/xen/include/asm-x86/compat.h
@@ -2,11 +2,15 @@
  * compat.h
  */
 
+#ifdef CONFIG_COMPAT
+
 #define COMPAT_BITS_PER_LONG 32
 
 typedef uint32_t compat_ptr_t;
 typedef unsigned long full_ptr_t;
 
+#endif
+
 struct domain;
 #ifdef CONFIG_PV32
 int switch_compat(struct domain *);
diff --git a/xen/include/asm-x86/hypercall.h b/xen/include/asm-x86/hypercall.h
index 686f3a3803..39e7ab7022 100644
--- a/xen/include/asm-x86/hypercall.h
+++ b/xen/include/asm-x86/hypercall.h
@@ -23,7 +23,10 @@ typedef struct {
 } hypercall_table_t;
 
 typedef struct {
-    uint8_t native, compat;
+    uint8_t native;
+#ifdef CONFIG_COMPAT
+    uint8_t compat;
+#endif
 } hypercall_args_t;
 
 extern const hypercall_args_t hypercall_args_table[NR_hypercalls];
diff --git a/xen/include/asm-x86/shared.h b/xen/include/asm-x86/shared.h
index af5d959d04..dd3ae8c263 100644
--- a/xen/include/asm-x86/shared.h
+++ b/xen/include/asm-x86/shared.h
@@ -1,6 +1,8 @@
 #ifndef __XEN_X86_SHARED_H__
 #define __XEN_X86_SHARED_H__
 
+#ifdef CONFIG_COMPAT
+
 #define nmi_reason(d) (!has_32bit_shinfo(d) ?                             \
                        (u32 *)&(d)->shared_info->native.arch.nmi_reason : \
                        (u32 *)&(d)->shared_info->compat.arch.nmi_reason)
@@ -37,6 +39,34 @@ static inline void arch_set_##field(struct vcpu *v,             \
         v->vcpu_info->compat.arch.field = val;                  \
 }
 
+#else
+
+#define nmi_reason(d) (&(d)->shared_info->arch.nmi_reason)
+
+#define GET_SET_SHARED(type, field)                         \
+static inline type arch_get_##field(const struct domain *d) \
+{                                                           \
+    return d->shared_info->arch.field;                      \
+}                                                           \
+static inline void arch_set_##field(struct domain *d,       \
+                                    type val)               \
+{                                                           \
+    d->shared_info->arch.field = val;                       \
+}
+
+#define GET_SET_VCPU(type, field)                           \
+static inline type arch_get_##field(const struct vcpu *v)   \
+{                                                           \
+    return v->vcpu_info->arch.field;                        \
+}                                                           \
+static inline void arch_set_##field(struct vcpu *v,         \
+                                    type val)               \
+{                                                           \
+    v->vcpu_info->arch.field = val;                         \
+}
+
+#endif
+
 GET_SET_SHARED(unsigned long, max_pfn)
 GET_SET_SHARED(xen_pfn_t, pfn_to_mfn_frame_list_list)
 GET_SET_SHARED(unsigned long, nmi_reason)
diff --git a/xen/include/xen/compat.h b/xen/include/xen/compat.h
index 91db042963..f2ce5bb358 100644
--- a/xen/include/xen/compat.h
+++ b/xen/include/xen/compat.h
@@ -5,10 +5,13 @@
 #ifndef __XEN_COMPAT_H__
 #define __XEN_COMPAT_H__
 
-#ifdef CONFIG_COMPAT
-
 #include <xen/types.h>
+#ifdef CONFIG_HAS_COMPAT
 #include <asm/compat.h>
+#endif
+
+#ifdef CONFIG_COMPAT
+
 #include <compat/xlat.h>
 
 #define __DEFINE_COMPAT_HANDLE(name, type) \
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 5485d08afb..cc633fdc07 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -1047,7 +1047,6 @@ static always_inline bool is_pv_vcpu(const struct vcpu *v)
     return is_pv_domain(v->domain);
 }
 
-#ifdef CONFIG_COMPAT
 static always_inline bool is_pv_32bit_domain(const struct domain *d)
 {
 #ifdef CONFIG_PV32
@@ -1078,7 +1077,7 @@ static always_inline bool is_pv_64bit_vcpu(const struct vcpu *v)
 {
     return is_pv_64bit_domain(v->domain);
 }
-#endif
+
 static always_inline bool is_hvm_domain(const struct domain *d)
 {
     return IS_ENABLED(CONFIG_HVM) &&
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 16 08:33:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Apr 2021 08:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111618.213504 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXJv5-0005br-U5; Fri, 16 Apr 2021 08:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111618.213504; Fri, 16 Apr 2021 08:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXJv5-0005bf-PR; Fri, 16 Apr 2021 08:33:43 +0000
Received: by outflank-mailman (input) for mailman id 111618;
 Fri, 16 Apr 2021 08:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXJv4-0005bY-Tb
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 08:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXJv4-0002AD-Ru
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 08:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXJv4-0004dA-R6
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 08:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3xFjDuQCDRO/NIq4h8oeUCpDFm/sq6BNxKcnAc4QYJw=; b=Xr8L7MNc7qVUsa7W9iPUl0tZsl
	D4YQBY+0HeD2dM4O/1py5zNIfII+pcYQH8pDXghkPru253Vvrd3YPpztDsLtvwnJZdhaWLyvU+Qdy
	+9pp365aH0OsORcn2AGxY0dZJdz5Y915ZQQ60JyUrLCPmQjCb2HlE5aBHgf9ZtMunXp8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/amd: split LFENCE dispatch serializing setup logic into helper
Message-Id: <E1lXJv4-0004dA-R6@xenbits.xenproject.org>
Date: Fri, 16 Apr 2021 08:33:42 +0000

commit 3e9460ec93341fa6a80ecf99832aa5d9975339c9
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Apr 15 13:45:09 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 15 13:45:09 2021 +0200

    x86/amd: split LFENCE dispatch serializing setup logic into helper
    
    Split the logic to attempt to setup LFENCE to be dispatch serializing
    on AMD into a helper, so it can be shared with Hygon.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu/amd.c   | 62 ++++++++++++++++++++++++++----------------------
 xen/arch/x86/cpu/cpu.h   |  1 +
 xen/arch/x86/cpu/hygon.c | 27 +--------------------
 3 files changed, 36 insertions(+), 54 deletions(-)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 8bc51bec10..9c8dcd91ee 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -642,6 +642,38 @@ void early_init_amd(struct cpuinfo_x86 *c)
 	ctxt_switch_levelling(NULL);
 }
 
+void amd_init_lfence(struct cpuinfo_x86 *c)
+{
+	uint64_t value;
+
+	/*
+	 * Attempt to set lfence to be Dispatch Serialising.  This MSR almost
+	 * certainly isn't virtualised (and Xen at least will leak the real
+	 * value in but silently discard writes), as well as being per-core
+	 * rather than per-thread, so do a full safe read/write/readback cycle
+	 * in the worst case.
+	 */
+	if (rdmsr_safe(MSR_AMD64_DE_CFG, value))
+		/* Unable to read.  Assume the safer default. */
+		__clear_bit(X86_FEATURE_LFENCE_DISPATCH,
+			    c->x86_capability);
+	else if (value & AMD64_DE_CFG_LFENCE_SERIALISE)
+		/* Already dispatch serialising. */
+		__set_bit(X86_FEATURE_LFENCE_DISPATCH,
+			  c->x86_capability);
+	else if (wrmsr_safe(MSR_AMD64_DE_CFG,
+			    value | AMD64_DE_CFG_LFENCE_SERIALISE) ||
+		 rdmsr_safe(MSR_AMD64_DE_CFG, value) ||
+		 !(value & AMD64_DE_CFG_LFENCE_SERIALISE))
+		/* Attempt to set failed.  Assume the safer default. */
+		__clear_bit(X86_FEATURE_LFENCE_DISPATCH,
+			    c->x86_capability);
+	else
+		/* Successfully enabled! */
+		__set_bit(X86_FEATURE_LFENCE_DISPATCH,
+			  c->x86_capability);
+}
+
 static void init_amd(struct cpuinfo_x86 *c)
 {
 	u32 l, h;
@@ -686,37 +718,11 @@ static void init_amd(struct cpuinfo_x86 *c)
 	if (c == &boot_cpu_data && !cpu_has(c, X86_FEATURE_RSTR_FP_ERR_PTRS))
 		setup_force_cpu_cap(X86_BUG_FPU_PTRS);
 
-	/*
-	 * Attempt to set lfence to be Dispatch Serialising.  This MSR almost
-	 * certainly isn't virtualised (and Xen at least will leak the real
-	 * value in but silently discard writes), as well as being per-core
-	 * rather than per-thread, so do a full safe read/write/readback cycle
-	 * in the worst case.
-	 */
 	if (c->x86 == 0x0f || c->x86 == 0x11)
 		/* Always dispatch serialising on this hardare. */
 		__set_bit(X86_FEATURE_LFENCE_DISPATCH, c->x86_capability);
-	else /* Implicily "== 0x10 || >= 0x12" by being 64bit. */ {
-		if (rdmsr_safe(MSR_AMD64_DE_CFG, value))
-			/* Unable to read.  Assume the safer default. */
-			__clear_bit(X86_FEATURE_LFENCE_DISPATCH,
-				    c->x86_capability);
-		else if (value & AMD64_DE_CFG_LFENCE_SERIALISE)
-			/* Already dispatch serialising. */
-			__set_bit(X86_FEATURE_LFENCE_DISPATCH,
-				  c->x86_capability);
-		else if (wrmsr_safe(MSR_AMD64_DE_CFG,
-				    value | AMD64_DE_CFG_LFENCE_SERIALISE) ||
-			 rdmsr_safe(MSR_AMD64_DE_CFG, value) ||
-			 !(value & AMD64_DE_CFG_LFENCE_SERIALISE))
-			/* Attempt to set failed.  Assume the safer default. */
-			__clear_bit(X86_FEATURE_LFENCE_DISPATCH,
-				    c->x86_capability);
-		else
-			/* Successfully enabled! */
-			__set_bit(X86_FEATURE_LFENCE_DISPATCH,
-				  c->x86_capability);
-	}
+	else /* Implicily "== 0x10 || >= 0x12" by being 64bit. */
+		amd_init_lfence(c);
 
 	/*
 	 * If the user has explicitly chosen to disable Memory Disambiguation
diff --git a/xen/arch/x86/cpu/cpu.h b/xen/arch/x86/cpu/cpu.h
index 1992596d1b..1ac3b2867a 100644
--- a/xen/arch/x86/cpu/cpu.h
+++ b/xen/arch/x86/cpu/cpu.h
@@ -20,3 +20,4 @@ extern bool detect_extended_topology(struct cpuinfo_x86 *c);
 
 void early_init_amd(struct cpuinfo_x86 *c);
 void amd_log_freq(const struct cpuinfo_x86 *c);
+void amd_init_lfence(struct cpuinfo_x86 *c);
diff --git a/xen/arch/x86/cpu/hygon.c b/xen/arch/x86/cpu/hygon.c
index 46293f1f36..2272e1113f 100644
--- a/xen/arch/x86/cpu/hygon.c
+++ b/xen/arch/x86/cpu/hygon.c
@@ -32,32 +32,7 @@ static void init_hygon(struct cpuinfo_x86 *c)
 {
 	unsigned long long value;
 
-	/*
-	 * Attempt to set lfence to be Dispatch Serialising.  This MSR almost
-	 * certainly isn't virtualised (and Xen at least will leak the real
-	 * value in but silently discard writes), as well as being per-core
-	 * rather than per-thread, so do a full safe read/write/readback cycle
-	 * in the worst case.
-	 */
-	if (rdmsr_safe(MSR_AMD64_DE_CFG, value))
-		/* Unable to read.  Assume the safer default. */
-		__clear_bit(X86_FEATURE_LFENCE_DISPATCH,
-			    c->x86_capability);
-	else if (value & AMD64_DE_CFG_LFENCE_SERIALISE)
-		/* Already dispatch serialising. */
-		__set_bit(X86_FEATURE_LFENCE_DISPATCH,
-			  c->x86_capability);
-	else if (wrmsr_safe(MSR_AMD64_DE_CFG,
-			    value | AMD64_DE_CFG_LFENCE_SERIALISE) ||
-		 rdmsr_safe(MSR_AMD64_DE_CFG, value) ||
-		 !(value & AMD64_DE_CFG_LFENCE_SERIALISE))
-		/* Attempt to set failed.  Assume the safer default. */
-		__clear_bit(X86_FEATURE_LFENCE_DISPATCH,
-			    c->x86_capability);
-	else
-		/* Successfully enabled! */
-		__set_bit(X86_FEATURE_LFENCE_DISPATCH,
-			  c->x86_capability);
+	amd_init_lfence(c);
 
 	/*
 	 * If the user has explicitly chosen to disable Memory Disambiguation
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 16 12:55:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Apr 2021 12:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111719.213647 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXO02-0005pj-UU; Fri, 16 Apr 2021 12:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111719.213647; Fri, 16 Apr 2021 12:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXO02-0005pb-RQ; Fri, 16 Apr 2021 12:55:06 +0000
Received: by outflank-mailman (input) for mailman id 111719;
 Fri, 16 Apr 2021 12:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO01-0005pW-St
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:55:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO01-0006Ta-PF
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO01-0008Of-N4
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:55:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ysNn7s0ITlzafCibLZhDxMX/CvIXX03Pw2R94dObZkU=; b=0B8tnN0VcwIZ7z1ZDeBoYNvXGL
	jmslcT+lr3Iqwlk13G6xsIV718sX7FmCoNk9eSJEU1ovdeyBhMHpv0/3f4KswciMinWmF10NV3zbZ
	ZL0eidUb70w+HLoiojFATCUKEqrorvZogJ2qG1IRcR/LPVJvlOikUVjyjwkNkiCm+NYA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] bunzip: replace INIT
Message-Id: <E1lXO01-0008Of-N4@xenbits.xenproject.org>
Date: Fri, 16 Apr 2021 12:55:05 +0000

commit 3df14c917230df45b30009b5980955f62925a50d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 16 14:37:36 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 16 14:37:36 2021 +0200

    bunzip: replace INIT
    
    While tools/libs/guest/xg_private.h has its own (non-conflicting for our
    purposes) __init, which hence needs to be #undef-ed, there's no other
    need for this abstraction.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/bunzip2.c    | 22 +++++++++++-----------
 xen/common/decompress.h |  4 ++++
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/xen/common/bunzip2.c b/xen/common/bunzip2.c
index 6aeac79f1a..2087cfbbed 100644
--- a/xen/common/bunzip2.c
+++ b/xen/common/bunzip2.c
@@ -104,7 +104,7 @@ struct bunzip_data {
 
 /* Return the next nnn bits of input.  All reads from the compressed input
    are done through this function.  All reads are big endian */
-static unsigned int INIT get_bits(struct bunzip_data *bd, char bits_wanted)
+static unsigned int __init get_bits(struct bunzip_data *bd, char bits_wanted)
 {
 	unsigned int bits = 0;
 
@@ -144,7 +144,7 @@ static unsigned int INIT get_bits(struct bunzip_data *bd, char bits_wanted)
 
 /* Unpacks the next block and sets up for the inverse burrows-wheeler step. */
 
-static int INIT get_next_block(struct bunzip_data *bd)
+static int __init get_next_block(struct bunzip_data *bd)
 {
 	struct group_data *hufGroup = NULL;
 	int *base = NULL;
@@ -509,7 +509,7 @@ got_huff_bits:
    are ignored, data is written to out_fd and return is RETVAL_OK or error.
 */
 
-static int INIT read_bunzip(struct bunzip_data *bd, unsigned char *outbuf, int len)
+static int __init read_bunzip(struct bunzip_data *bd, unsigned char *outbuf, int len)
 {
 	const unsigned int *dbuf;
 	int pos, xcurrent, previous, gotcount;
@@ -607,7 +607,7 @@ decode_next_byte:
 	goto decode_next_byte;
 }
 
-static int INIT nofill(void *buf, unsigned int len)
+static int __init nofill(void *buf, unsigned int len)
 {
 	return -1;
 }
@@ -615,8 +615,8 @@ static int INIT nofill(void *buf, unsigned int len)
 /* Allocate the structure, read file header.  If in_fd ==-1, inbuf must contain
    a complete bunzip file (len bytes long).  If in_fd!=-1, inbuf and len are
    ignored, and data is read from file handle into temporary buffer. */
-static int INIT start_bunzip(struct bunzip_data **bdp, void *inbuf, int len,
-			     int (*fill)(void*, unsigned int))
+static int __init start_bunzip(struct bunzip_data **bdp, void *inbuf, int len,
+			       int (*fill)(void*, unsigned int))
 {
 	struct bunzip_data *bd;
 	unsigned int i, j, c;
@@ -665,11 +665,11 @@ static int INIT start_bunzip(struct bunzip_data **bdp, void *inbuf, int len,
 
 /* Example usage: decompress src_fd to dst_fd.  (Stops at end of bzip2 data,
    not end of file.) */
-int INIT bunzip2(unsigned char *buf, unsigned int len,
-		 int(*fill)(void*, unsigned int),
-		 int(*flush)(void*, unsigned int),
-		 unsigned char *outbuf, unsigned int *pos,
-		 void(*error)(const char *x))
+int __init bunzip2(unsigned char *buf, unsigned int len,
+		   int(*fill)(void*, unsigned int),
+		   int(*flush)(void*, unsigned int),
+		   unsigned char *outbuf, unsigned int *pos,
+		   void(*error)(const char *x))
 {
 	struct bunzip_data *bd;
 	int i = -1;
diff --git a/xen/common/decompress.h b/xen/common/decompress.h
index d740a80eeb..9491ba581d 100644
--- a/xen/common/decompress.h
+++ b/xen/common/decompress.h
@@ -23,6 +23,10 @@
 #define INIT
 #define INITDATA
 
+#undef __init /* tools/libs/guest/xg_private.h has its own one */
+#define __init
+#define __initdata
+
 #define large_malloc malloc
 #define large_free free
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 16 12:55:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Apr 2021 12:55:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111720.213651 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXO0C-0005qY-W3; Fri, 16 Apr 2021 12:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111720.213651; Fri, 16 Apr 2021 12:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXO0C-0005qQ-T2; Fri, 16 Apr 2021 12:55:16 +0000
Received: by outflank-mailman (input) for mailman id 111720;
 Fri, 16 Apr 2021 12:55:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO0B-0005qI-Ub
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:55:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO0B-0006Td-Tb
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO0B-0008Pj-Ri
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:55:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=22Utdp3gVJIO9Ycctp7s7NUqpGkQrbGL9gJNbxusYFc=; b=yvWY0zYOx7urHqzCGnYvyCJDGU
	ODFhk2aE039dftuKbztesUYLkfbn8d/YqhQ/pqnqvFlpUluKovpbtpCcCjCAPX6qoxxwAaxJLArtm
	4V1UQbbVuc20IqVtk8uGxmTlzWJhCh52q10qLSoz/T56RgNbYd/8276DL7UVyp2D2hhU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] unlzo: replace INIT
Message-Id: <E1lXO0B-0008Pj-Ri@xenbits.xenproject.org>
Date: Fri, 16 Apr 2021 12:55:15 +0000

commit 4e4bcd7deed0a7dba71d459b335de5a4f985073d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 16 14:38:26 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 16 14:38:26 2021 +0200

    unlzo: replace INIT
    
    There's no need for this abstraction.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/lzo.c   |  4 ++--
 xen/common/unlzo.c | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/common/lzo.c b/xen/common/lzo.c
index e4841794f4..a87c76dded 100644
--- a/xen/common/lzo.c
+++ b/xen/common/lzo.c
@@ -135,8 +135,8 @@
  */
 #define MAX_255_COUNT      ((((size_t)~0) / 255) - 2)
 
-int INIT lzo1x_decompress_safe(const unsigned char *in, size_t in_len,
-                               unsigned char *out, size_t *out_len)
+int __init lzo1x_decompress_safe(const unsigned char *in, size_t in_len,
+                                 unsigned char *out, size_t *out_len)
 {
     unsigned char *op;
     const unsigned char *ip;
diff --git a/xen/common/unlzo.c b/xen/common/unlzo.c
index df7e53db14..74056778eb 100644
--- a/xen/common/unlzo.c
+++ b/xen/common/unlzo.c
@@ -57,7 +57,7 @@ static const unsigned char lzop_magic[] = {
 #define HEADER_SIZE_MIN       (9 + 7     + 4 + 8     + 1       + 4)
 #define HEADER_SIZE_MAX       (9 + 7 + 1 + 8 + 8 + 4 + 1 + 255 + 4)
 
-static int INIT parse_header(u8 *input, int *skip, int in_len)
+static int __init parse_header(u8 *input, int *skip, int in_len)
 {
 	int l;
 	u8 *parse = input;
@@ -114,11 +114,11 @@ static int INIT parse_header(u8 *input, int *skip, int in_len)
 	return 1;
 }
 
-int INIT unlzo(unsigned char *input, unsigned int in_len,
-	       int (*fill) (void *, unsigned int),
-	       int (*flush) (void *, unsigned int),
-	       unsigned char *output, unsigned int *posp,
-	       void (*error) (const char *x))
+int __init unlzo(unsigned char *input, unsigned int in_len,
+		 int (*fill) (void *, unsigned int),
+		 int (*flush) (void *, unsigned int),
+		 unsigned char *output, unsigned int *posp,
+		 void (*error) (const char *x))
 {
 	u8 r = 0;
 	int skip = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 16 12:55:28 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Apr 2021 12:55:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111721.213655 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXO0O-0005rx-1p; Fri, 16 Apr 2021 12:55:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111721.213655; Fri, 16 Apr 2021 12:55: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 1lXO0N-0005rp-Uf; Fri, 16 Apr 2021 12:55:27 +0000
Received: by outflank-mailman (input) for mailman id 111721;
 Fri, 16 Apr 2021 12:55:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO0M-0005rc-3Z
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:55:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO0M-0006Tl-1N
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:55:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO0L-0008Ql-Vy
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:55:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=l8vfRNn6ngX1Bepx6Nk9O2szkq/k+O/VM0cDNhnwrOo=; b=bPMjYeMjDSTY8zbwFCnINA19ox
	zViz3BPfK/hkG1a3YwE5cuf5tk2mIpk/qL6UL7FKsXOqElSGCL4WU45ookRspI7heN8d/1ImdjkAc
	ppdEk2kQjO7xtxFMC2iLKm6IKtX3GSvAPSOeRHJxRDQRPPvtsFAzO/DB5AVbICcMe87Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] unlzma: replace INIT
Message-Id: <E1lXO0L-0008Ql-Vy@xenbits.xenproject.org>
Date: Fri, 16 Apr 2021 12:55:25 +0000

commit 0d8e20de1a9963d1f0c3954400d8f582dd05ee43
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 16 14:38:50 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 16 14:38:50 2021 +0200

    unlzma: replace INIT
    
    There's no need for this abstraction.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/unlzma.c | 68 ++++++++++++++++++++++++++---------------------------
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/xen/common/unlzma.c b/xen/common/unlzma.c
index ea5ab41738..d0ef78eef0 100644
--- a/xen/common/unlzma.c
+++ b/xen/common/unlzma.c
@@ -30,7 +30,7 @@
 
 #include "decompress.h"
 
-static long long INIT read_int(unsigned char *ptr, int size)
+static long long __init read_int(unsigned char *ptr, int size)
 {
 	int i;
 	long long ret = 0;
@@ -76,13 +76,13 @@ struct rc {
 #define RC_MODEL_TOTAL_BITS 11
 
 
-static int INIT nofill(void *buffer, unsigned int len)
+static int __init nofill(void *buffer, unsigned int len)
 {
 	return -1;
 }
 
 /* Called twice: once at startup and once in rc_normalize() */
-static void INIT rc_read(struct rc *rc)
+static void __init rc_read(struct rc *rc)
 {
 	rc->buffer_size = rc->fill((char *)rc->buffer, LZMA_IOBUF_SIZE);
 	if (rc->buffer_size <= 0)
@@ -92,9 +92,9 @@ static void INIT rc_read(struct rc *rc)
 }
 
 /* Called once */
-static inline void INIT rc_init(struct rc *rc,
-				       int (*fill)(void*, unsigned int),
-				       unsigned char *buffer, int buffer_size)
+static inline void __init rc_init(struct rc *rc,
+				  int (*fill)(void*, unsigned int),
+				  unsigned char *buffer, int buffer_size)
 {
 	if (fill)
 		rc->fill = fill;
@@ -109,7 +109,7 @@ static inline void INIT rc_init(struct rc *rc,
 	rc->range = 0xFFFFFFFF;
 }
 
-static inline void INIT rc_init_code(struct rc *rc)
+static inline void __init rc_init_code(struct rc *rc)
 {
 	int i;
 
@@ -122,14 +122,14 @@ static inline void INIT rc_init_code(struct rc *rc)
 
 
 /* Called twice, but one callsite is in inline'd rc_is_bit_0_helper() */
-static void INIT rc_do_normalize(struct rc *rc)
+static void __init rc_do_normalize(struct rc *rc)
 {
 	if (rc->ptr >= rc->buffer_end)
 		rc_read(rc);
 	rc->range <<= 8;
 	rc->code = (rc->code << 8) | *rc->ptr++;
 }
-static inline void INIT rc_normalize(struct rc *rc)
+static inline void __init rc_normalize(struct rc *rc)
 {
 	if (rc->range < (1 << RC_TOP_BITS))
 		rc_do_normalize(rc);
@@ -139,20 +139,20 @@ static inline void INIT rc_normalize(struct rc *rc)
 /* Why rc_is_bit_0_helper exists?
  *Because we want to always expose (rc->code < rc->bound) to optimizer
  */
-static inline uint32_t INIT rc_is_bit_0_helper(struct rc *rc, uint16_t *p)
+static inline uint32_t __init rc_is_bit_0_helper(struct rc *rc, uint16_t *p)
 {
 	rc_normalize(rc);
 	rc->bound = *p * (rc->range >> RC_MODEL_TOTAL_BITS);
 	return rc->bound;
 }
-static inline int INIT rc_is_bit_0(struct rc *rc, uint16_t *p)
+static inline int __init rc_is_bit_0(struct rc *rc, uint16_t *p)
 {
 	uint32_t t = rc_is_bit_0_helper(rc, p);
 	return rc->code < t;
 }
 
 /* Called ~10 times, but very small, thus inlined */
-static inline void INIT rc_update_bit_0(struct rc *rc, uint16_t *p)
+static inline void __init rc_update_bit_0(struct rc *rc, uint16_t *p)
 {
 	rc->range = rc->bound;
 	*p += ((1 << RC_MODEL_TOTAL_BITS) - *p) >> RC_MOVE_BITS;
@@ -165,7 +165,7 @@ static inline void rc_update_bit_1(struct rc *rc, uint16_t *p)
 }
 
 /* Called 4 times in unlzma loop */
-static int INIT rc_get_bit(struct rc *rc, uint16_t *p, int *symbol)
+static int __init rc_get_bit(struct rc *rc, uint16_t *p, int *symbol)
 {
 	if (rc_is_bit_0(rc, p)) {
 		rc_update_bit_0(rc, p);
@@ -179,7 +179,7 @@ static int INIT rc_get_bit(struct rc *rc, uint16_t *p, int *symbol)
 }
 
 /* Called once */
-static inline int INIT rc_direct_bit(struct rc *rc)
+static inline int __init rc_direct_bit(struct rc *rc)
 {
 	rc_normalize(rc);
 	rc->range >>= 1;
@@ -191,7 +191,7 @@ static inline int INIT rc_direct_bit(struct rc *rc)
 }
 
 /* Called twice */
-static inline void INIT
+static inline void __init
 rc_bit_tree_decode(struct rc *rc, uint16_t *p, int num_levels, int *symbol)
 {
 	int i = num_levels;
@@ -283,14 +283,14 @@ struct cstate {
 	uint32_t rep0, rep1, rep2, rep3;
 };
 
-static inline size_t INIT get_pos(struct writer *wr)
+static inline size_t __init get_pos(struct writer *wr)
 {
 	return
 		wr->global_pos + wr->buffer_pos;
 }
 
-static inline uint8_t INIT peek_old_byte(struct writer *wr,
-						uint32_t offs)
+static inline uint8_t __init peek_old_byte(struct writer *wr,
+					   uint32_t offs)
 {
 	if (!wr->flush) {
 		int32_t pos;
@@ -307,7 +307,7 @@ static inline uint8_t INIT peek_old_byte(struct writer *wr,
 
 }
 
-static inline int INIT write_byte(struct writer *wr, uint8_t byte)
+static inline int __init write_byte(struct writer *wr, uint8_t byte)
 {
 	wr->buffer[wr->buffer_pos++] = wr->previous_byte = byte;
 	if (wr->flush && wr->buffer_pos == wr->header->dict_size) {
@@ -321,13 +321,13 @@ static inline int INIT write_byte(struct writer *wr, uint8_t byte)
 }
 
 
-static inline int INIT copy_byte(struct writer *wr, uint32_t offs)
+static inline int __init copy_byte(struct writer *wr, uint32_t offs)
 {
 	return write_byte(wr, peek_old_byte(wr, offs));
 }
 
-static inline int INIT copy_bytes(struct writer *wr,
-					 uint32_t rep0, int len)
+static inline int __init copy_bytes(struct writer *wr,
+				    uint32_t rep0, int len)
 {
 	do {
 		if (copy_byte(wr, rep0))
@@ -338,10 +338,10 @@ static inline int INIT copy_bytes(struct writer *wr,
 	return len;
 }
 
-static inline int INIT process_bit0(struct writer *wr, struct rc *rc,
-				     struct cstate *cst, uint16_t *p,
-				     int pos_state, uint16_t *prob,
-				     int lc, uint32_t literal_pos_mask) {
+static inline int __init process_bit0(struct writer *wr, struct rc *rc,
+				      struct cstate *cst, uint16_t *p,
+				      int pos_state, uint16_t *prob,
+				      int lc, uint32_t literal_pos_mask) {
 	int mi = 1;
 	rc_update_bit_0(rc, prob);
 	prob = (p + LZMA_LITERAL +
@@ -382,9 +382,9 @@ static inline int INIT process_bit0(struct writer *wr, struct rc *rc,
 	return write_byte(wr, mi);
 }
 
-static inline int INIT process_bit1(struct writer *wr, struct rc *rc,
-					    struct cstate *cst, uint16_t *p,
-					    int pos_state, uint16_t *prob) {
+static inline int __init process_bit1(struct writer *wr, struct rc *rc,
+				      struct cstate *cst, uint16_t *p,
+				      int pos_state, uint16_t *prob) {
   int offset;
 	uint16_t *prob_len;
 	int num_bits;
@@ -528,11 +528,11 @@ static inline int INIT process_bit1(struct writer *wr, struct rc *rc,
 
 
 
-int INIT unlzma(unsigned char *buf, unsigned int in_len,
-	        int(*fill)(void*, unsigned int),
-	        int(*flush)(void*, unsigned int),
-	        unsigned char *output, unsigned int *posp,
-	        void(*error)(const char *x))
+int __init unlzma(unsigned char *buf, unsigned int in_len,
+		  int(*fill)(void*, unsigned int),
+		  int(*flush)(void*, unsigned int),
+		  unsigned char *output, unsigned int *posp,
+		  void(*error)(const char *x))
 {
 	struct lzma_header header;
 	int lc, pb, lp;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 16 12:55:38 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Apr 2021 12:55:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111722.213659 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXO0Y-0005tK-37; Fri, 16 Apr 2021 12:55:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111722.213659; Fri, 16 Apr 2021 12:55: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 1lXO0Y-0005tC-09; Fri, 16 Apr 2021 12:55:38 +0000
Received: by outflank-mailman (input) for mailman id 111722;
 Fri, 16 Apr 2021 12:55:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO0W-0005sz-5U
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:55:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO0W-0006Ts-4n
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:55:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO0W-0008Ry-3o
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:55:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6UCh/G5lRHkma+Hfi2WlBCcwgmy5QH3sVKEtOZ2AtjA=; b=DYuJdnYbg0hJdrRmi3piKGqDGQ
	5kR/xUGa7Zk0uQzr5cNInFUW9CJkieoWLozxS5r5BTdP93wwdK9qraMUxJ0FRDQOnMb9LHwhgHcvk
	zjtHaL3BowgEVf1WiZeF3834WAcTlbozfR9yCJvGXEXO3+bfenZcyFA7dTJciZyghtNU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] unlz4: replace INIT
Message-Id: <E1lXO0W-0008Ry-3o@xenbits.xenproject.org>
Date: Fri, 16 Apr 2021 12:55:36 +0000

commit d9b1620aa4dae26964415e9f05f3b4000198e18f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 16 14:39:25 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 16 14:39:25 2021 +0200

    unlz4: replace INIT
    
    There's no need for this abstraction.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/lz4/decompress.c |  8 ++++----
 xen/common/unlz4.c          | 10 +++++-----
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/common/lz4/decompress.c b/xen/common/lz4/decompress.c
index 3caedb3d5d..876906fac1 100644
--- a/xen/common/lz4/decompress.c
+++ b/xen/common/lz4/decompress.c
@@ -46,8 +46,8 @@ static const int8_t dec64table[] = {0, 0, 0, -1, 0, 1, 2, 3};
 
 #if defined(__XEN__) || defined(__MINIOS__)
 
-static int INIT lz4_uncompress(const unsigned char *source, unsigned char *dest,
-			       int osize)
+static int __init lz4_uncompress(const unsigned char *source, unsigned char *dest,
+				 int osize)
 {
 	const BYTE *ip = (const BYTE *) source;
 	const BYTE *ref;
@@ -302,8 +302,8 @@ _output_error:
 
 #if defined(__XEN__) || defined(__MINIOS__)
 
-int INIT lz4_decompress(const unsigned char *src, size_t *src_len,
-		unsigned char *dest, size_t actual_dest_len)
+int __init lz4_decompress(const unsigned char *src, size_t *src_len,
+			  unsigned char *dest, size_t actual_dest_len)
 {
 	int ret = -1;
 	int input_len = 0;
diff --git a/xen/common/unlz4.c b/xen/common/unlz4.c
index 4a8fc55ccb..2096b98f36 100644
--- a/xen/common/unlz4.c
+++ b/xen/common/unlz4.c
@@ -22,11 +22,11 @@
 #define LZ4_DEFAULT_UNCOMPRESSED_CHUNK_SIZE (8 << 20)
 #define ARCHIVE_MAGICNUMBER 0x184C2102
 
-int INIT unlz4(unsigned char *input, unsigned int in_len,
-	       int (*fill)(void *, unsigned int),
-	       int (*flush)(void *, unsigned int),
-	       unsigned char *output, unsigned int *posp,
-	       void (*error)(const char *x))
+int __init unlz4(unsigned char *input, unsigned int in_len,
+		 int (*fill)(void *, unsigned int),
+		 int (*flush)(void *, unsigned int),
+		 unsigned char *output, unsigned int *posp,
+		 void (*error)(const char *x))
 {
 	int ret = -1;
 	size_t chunksize = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 16 12:55:48 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Apr 2021 12:55:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111723.213664 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXO0i-0005uW-5t; Fri, 16 Apr 2021 12:55:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111723.213664; Fri, 16 Apr 2021 12:55: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 1lXO0i-0005uO-1f; Fri, 16 Apr 2021 12:55:48 +0000
Received: by outflank-mailman (input) for mailman id 111723;
 Fri, 16 Apr 2021 12:55:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO0g-0005uD-9n
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:55:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO0g-0006UA-93
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:55:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO0g-0008T2-81
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:55:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vPMVCI/3p0MBQ49KWCm5L0ByR4ZKG2eIoHIfwLjYDuM=; b=jgG0OzEO0qk8zZLGNFUBR2iFJY
	XOY8OJt3qhdm/u0D9L50q7vIT+A3NBR4Kk3oljZYdSBhXbvYmvYZFZnCV5mkfbTvgNUi4za8sh8t7
	TY7DIj0NfFTXrBcjocQxptFTI7T/z5QKMVNMdFJevXrLqEhyA3x85mwVtoI1hq4cgXFQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] unxz: replace INIT{,DATA} and STATIC
Message-Id: <E1lXO0g-0008T2-81@xenbits.xenproject.org>
Date: Fri, 16 Apr 2021 12:55:46 +0000

commit a24d072ec8936937306073904c85da3849dd2f58
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 16 14:40:15 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 16 14:40:15 2021 +0200

    unxz: replace INIT{,DATA} and STATIC
    
    With xen/common/decompress.h now agreeing in both build modes about
    what STATIC expands to, there's no need for these abstractions anymore.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/decompress.h    |  2 --
 xen/common/unxz.c          | 12 +++++-----
 xen/common/xz/crc32.c      |  6 ++---
 xen/common/xz/dec_bcj.c    | 30 +++++++++++------------
 xen/common/xz/dec_lzma2.c  | 60 +++++++++++++++++++++++-----------------------
 xen/common/xz/dec_stream.c | 32 ++++++++++++-------------
 xen/common/xz/lzma2.h      | 12 +++++-----
 7 files changed, 76 insertions(+), 78 deletions(-)

diff --git a/xen/common/decompress.h b/xen/common/decompress.h
index 9491ba581d..7144fb46ce 100644
--- a/xen/common/decompress.h
+++ b/xen/common/decompress.h
@@ -9,7 +9,6 @@
 
 #define STATIC static
 #define INIT __init
-#define INITDATA __initdata
 
 #define malloc xmalloc_bytes
 #define free xfree
@@ -21,7 +20,6 @@
 
 #define STATIC static
 #define INIT
-#define INITDATA
 
 #undef __init /* tools/libs/guest/xg_private.h has its own one */
 #define __init
diff --git a/xen/common/unxz.c b/xen/common/unxz.c
index 15806f4469..7bfe23f422 100644
--- a/xen/common/unxz.c
+++ b/xen/common/unxz.c
@@ -95,7 +95,7 @@
 
 #include "decompress.h"
 
-#define XZ_EXTERN STATIC
+#define XZ_EXTERN static
 
 /*
  * For boot time use, we enable only the BCJ filter of the current
@@ -157,11 +157,11 @@
  * both input and output buffers are available as a single chunk, i.e. when
  * fill() and flush() won't be used.
  */
-int INIT unxz(unsigned char *in, unsigned int in_size,
-	      int (*fill)(void *dest, unsigned int size),
-	      int (*flush)(void *src, unsigned int size),
-	      unsigned char *out, unsigned int *in_used,
-	      void (*error)(const char *x))
+int __init unxz(unsigned char *in, unsigned int in_size,
+		int (*fill)(void *dest, unsigned int size),
+		int (*flush)(void *src, unsigned int size),
+		unsigned char *out, unsigned int *in_used,
+		void (*error)(const char *x))
 {
 	struct xz_buf b;
 	struct xz_dec *s;
diff --git a/xen/common/xz/crc32.c b/xen/common/xz/crc32.c
index 0708b61638..092a74fbab 100644
--- a/xen/common/xz/crc32.c
+++ b/xen/common/xz/crc32.c
@@ -15,9 +15,9 @@
  * but they are bigger and use more memory for the lookup table.
  */
 
-XZ_EXTERN uint32_t INITDATA xz_crc32_table[256];
+XZ_EXTERN uint32_t __initdata xz_crc32_table[256];
 
-XZ_EXTERN void INIT xz_crc32_init(void)
+XZ_EXTERN void __init xz_crc32_init(void)
 {
 	const uint32_t poly = 0xEDB88320;
 
@@ -36,7 +36,7 @@ XZ_EXTERN void INIT xz_crc32_init(void)
 	return;
 }
 
-XZ_EXTERN uint32_t INIT xz_crc32(const uint8_t *buf, size_t size, uint32_t crc)
+XZ_EXTERN uint32_t __init xz_crc32(const uint8_t *buf, size_t size, uint32_t crc)
 {
 	crc = ~crc;
 
diff --git a/xen/common/xz/dec_bcj.c b/xen/common/xz/dec_bcj.c
index 86c1192199..970d3d89ee 100644
--- a/xen/common/xz/dec_bcj.c
+++ b/xen/common/xz/dec_bcj.c
@@ -80,12 +80,12 @@ struct xz_dec_bcj {
  * This is used to test the most significant byte of a memory address
  * in an x86 instruction.
  */
-static inline int INIT bcj_x86_test_msbyte(uint8_t b)
+static inline int __init bcj_x86_test_msbyte(uint8_t b)
 {
 	return b == 0x00 || b == 0xFF;
 }
 
-static size_t INIT bcj_x86(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
+static size_t __init bcj_x86(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 {
 	static const bool_t mask_to_allowed_status[8]
 		= { true, true, true, false, true, false, false, false };
@@ -157,7 +157,7 @@ static size_t INIT bcj_x86(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 #endif
 
 #ifdef XZ_DEC_POWERPC
-static size_t INIT bcj_powerpc(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
+static size_t __init bcj_powerpc(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 {
 	size_t i;
 	uint32_t instr;
@@ -178,7 +178,7 @@ static size_t INIT bcj_powerpc(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 #endif
 
 #ifdef XZ_DEC_IA64
-static size_t INIT bcj_ia64(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
+static size_t __init bcj_ia64(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 {
 	static const uint8_t branch_table[32] = {
 		0, 0, 0, 0, 0, 0, 0, 0,
@@ -262,7 +262,7 @@ static size_t INIT bcj_ia64(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 #endif
 
 #ifdef XZ_DEC_ARM
-static size_t INIT bcj_arm(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
+static size_t __init bcj_arm(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 {
 	size_t i;
 	uint32_t addr;
@@ -285,7 +285,7 @@ static size_t INIT bcj_arm(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 #endif
 
 #ifdef XZ_DEC_ARMTHUMB
-static size_t INIT bcj_armthumb(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
+static size_t __init bcj_armthumb(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 {
 	size_t i;
 	uint32_t addr;
@@ -313,7 +313,7 @@ static size_t INIT bcj_armthumb(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 #endif
 
 #ifdef XZ_DEC_SPARC
-static size_t INIT bcj_sparc(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
+static size_t __init bcj_sparc(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 {
 	size_t i;
 	uint32_t instr;
@@ -342,8 +342,8 @@ static size_t INIT bcj_sparc(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
  * pointers, which could be problematic in the kernel boot code, which must
  * avoid pointers to static data (at least on x86).
  */
-static void INIT bcj_apply(struct xz_dec_bcj *s,
-			   uint8_t *buf, size_t *pos, size_t size)
+static void __init bcj_apply(struct xz_dec_bcj *s,
+			     uint8_t *buf, size_t *pos, size_t size)
 {
 	size_t filtered;
 
@@ -396,7 +396,7 @@ static void INIT bcj_apply(struct xz_dec_bcj *s,
  * Move the remaining mixture of possibly filtered and unfiltered
  * data to the beginning of temp.
  */
-static void INIT bcj_flush(struct xz_dec_bcj *s, struct xz_buf *b)
+static void __init bcj_flush(struct xz_dec_bcj *s, struct xz_buf *b)
 {
 	size_t copy_size;
 
@@ -414,9 +414,9 @@ static void INIT bcj_flush(struct xz_dec_bcj *s, struct xz_buf *b)
  * data in chunks of 1-16 bytes. To hide this issue, this function does
  * some buffering.
  */
-XZ_EXTERN enum xz_ret INIT xz_dec_bcj_run(struct xz_dec_bcj *s,
-					  struct xz_dec_lzma2 *lzma2,
-					  struct xz_buf *b)
+XZ_EXTERN enum xz_ret __init xz_dec_bcj_run(struct xz_dec_bcj *s,
+					    struct xz_dec_lzma2 *lzma2,
+					    struct xz_buf *b)
 {
 	size_t out_start;
 
@@ -524,7 +524,7 @@ XZ_EXTERN enum xz_ret INIT xz_dec_bcj_run(struct xz_dec_bcj *s,
 	return s->ret;
 }
 
-XZ_EXTERN struct xz_dec_bcj *INIT xz_dec_bcj_create(bool_t single_call)
+XZ_EXTERN struct xz_dec_bcj *__init xz_dec_bcj_create(bool_t single_call)
 {
 	struct xz_dec_bcj *s = malloc(sizeof(*s));
 	if (s != NULL)
@@ -533,7 +533,7 @@ XZ_EXTERN struct xz_dec_bcj *INIT xz_dec_bcj_create(bool_t single_call)
 	return s;
 }
 
-XZ_EXTERN enum xz_ret INIT xz_dec_bcj_reset(struct xz_dec_bcj *s, uint8_t id)
+XZ_EXTERN enum xz_ret __init xz_dec_bcj_reset(struct xz_dec_bcj *s, uint8_t id)
 {
 	switch (id) {
 #ifdef XZ_DEC_X86
diff --git a/xen/common/xz/dec_lzma2.c b/xen/common/xz/dec_lzma2.c
index 44fe79bc30..6b07722e3c 100644
--- a/xen/common/xz/dec_lzma2.c
+++ b/xen/common/xz/dec_lzma2.c
@@ -283,7 +283,7 @@ struct xz_dec_lzma2 {
  * Reset the dictionary state. When in single-call mode, set up the beginning
  * of the dictionary to point to the actual output buffer.
  */
-static void INIT dict_reset(struct dictionary *dict, struct xz_buf *b)
+static void __init dict_reset(struct dictionary *dict, struct xz_buf *b)
 {
 	if (DEC_IS_SINGLE(dict->mode)) {
 		dict->buf = b->out + b->out_pos;
@@ -297,7 +297,7 @@ static void INIT dict_reset(struct dictionary *dict, struct xz_buf *b)
 }
 
 /* Set dictionary write limit */
-static void INIT dict_limit(struct dictionary *dict, size_t out_max)
+static void __init dict_limit(struct dictionary *dict, size_t out_max)
 {
 	if (dict->end - dict->pos <= out_max)
 		dict->limit = dict->end;
@@ -306,7 +306,7 @@ static void INIT dict_limit(struct dictionary *dict, size_t out_max)
 }
 
 /* Return true if at least one byte can be written into the dictionary. */
-static inline bool_t INIT dict_has_space(const struct dictionary *dict)
+static inline bool_t __init dict_has_space(const struct dictionary *dict)
 {
 	return dict->pos < dict->limit;
 }
@@ -317,7 +317,7 @@ static inline bool_t INIT dict_has_space(const struct dictionary *dict)
  * still empty. This special case is needed for single-call decoding to
  * avoid writing a '\0' to the end of the destination buffer.
  */
-static inline uint32_t INIT dict_get(const struct dictionary *dict, uint32_t dist)
+static inline uint32_t __init dict_get(const struct dictionary *dict, uint32_t dist)
 {
 	size_t offset = dict->pos - dist - 1;
 
@@ -330,7 +330,7 @@ static inline uint32_t INIT dict_get(const struct dictionary *dict, uint32_t dis
 /*
  * Put one byte into the dictionary. It is assumed that there is space for it.
  */
-static inline void INIT dict_put(struct dictionary *dict, uint8_t byte)
+static inline void __init dict_put(struct dictionary *dict, uint8_t byte)
 {
 	dict->buf[dict->pos++] = byte;
 
@@ -343,7 +343,7 @@ static inline void INIT dict_put(struct dictionary *dict, uint8_t byte)
  * invalid, false is returned. On success, true is returned and *len is
  * updated to indicate how many bytes were left to be repeated.
  */
-static bool_t INIT dict_repeat(struct dictionary *dict, uint32_t *len, uint32_t dist)
+static bool_t __init dict_repeat(struct dictionary *dict, uint32_t *len, uint32_t dist)
 {
 	size_t back;
 	uint32_t left;
@@ -371,8 +371,8 @@ static bool_t INIT dict_repeat(struct dictionary *dict, uint32_t *len, uint32_t
 }
 
 /* Copy uncompressed data as is from input to dictionary and output buffers. */
-static void INIT dict_uncompressed(struct dictionary *dict, struct xz_buf *b,
-				   uint32_t *left)
+static void __init dict_uncompressed(struct dictionary *dict, struct xz_buf *b,
+				     uint32_t *left)
 {
 	size_t copy_size;
 
@@ -413,7 +413,7 @@ static void INIT dict_uncompressed(struct dictionary *dict, struct xz_buf *b,
  * enough space in b->out. This is guaranteed because caller uses dict_limit()
  * before decoding data into the dictionary.
  */
-static uint32_t INIT dict_flush(struct dictionary *dict, struct xz_buf *b)
+static uint32_t __init dict_flush(struct dictionary *dict, struct xz_buf *b)
 {
 	size_t copy_size = dict->pos - dict->start;
 
@@ -435,7 +435,7 @@ static uint32_t INIT dict_flush(struct dictionary *dict, struct xz_buf *b)
  *****************/
 
 /* Reset the range decoder. */
-static void INIT rc_reset(struct rc_dec *rc)
+static void __init rc_reset(struct rc_dec *rc)
 {
 	rc->range = (uint32_t)-1;
 	rc->code = 0;
@@ -446,7 +446,7 @@ static void INIT rc_reset(struct rc_dec *rc)
  * Read the first five initial bytes into rc->code if they haven't been
  * read already. (Yes, the first byte gets completely ignored.)
  */
-static bool_t INIT rc_read_init(struct rc_dec *rc, struct xz_buf *b)
+static bool_t __init rc_read_init(struct rc_dec *rc, struct xz_buf *b)
 {
 	while (rc->init_bytes_left > 0) {
 		if (b->in_pos == b->in_size)
@@ -460,7 +460,7 @@ static bool_t INIT rc_read_init(struct rc_dec *rc, struct xz_buf *b)
 }
 
 /* Return true if there may not be enough input for the next decoding loop. */
-static inline bool_t INIT rc_limit_exceeded(const struct rc_dec *rc)
+static inline bool_t __init rc_limit_exceeded(const struct rc_dec *rc)
 {
 	return rc->in_pos > rc->in_limit;
 }
@@ -469,7 +469,7 @@ static inline bool_t INIT rc_limit_exceeded(const struct rc_dec *rc)
  * Return true if it is possible (from point of view of range decoder) that
  * we have reached the end of the LZMA chunk.
  */
-static inline bool_t INIT rc_is_finished(const struct rc_dec *rc)
+static inline bool_t __init rc_is_finished(const struct rc_dec *rc)
 {
 	return rc->code == 0;
 }
@@ -550,7 +550,7 @@ static always_inline void rc_bittree_reverse(struct rc_dec *rc,
 }
 
 /* Decode direct bits (fixed fifty-fifty probability) */
-static inline void INIT rc_direct(struct rc_dec *rc, uint32_t *dest, uint32_t limit)
+static inline void __init rc_direct(struct rc_dec *rc, uint32_t *dest, uint32_t limit)
 {
 	uint32_t mask;
 
@@ -569,7 +569,7 @@ static inline void INIT rc_direct(struct rc_dec *rc, uint32_t *dest, uint32_t li
  ********/
 
 /* Get pointer to literal coder probability array. */
-static uint16_t *INIT lzma_literal_probs(struct xz_dec_lzma2 *s)
+static uint16_t *__init lzma_literal_probs(struct xz_dec_lzma2 *s)
 {
 	uint32_t prev_byte = dict_get(&s->dict, 0);
 	uint32_t low = prev_byte >> (8 - s->lzma.lc);
@@ -578,7 +578,7 @@ static uint16_t *INIT lzma_literal_probs(struct xz_dec_lzma2 *s)
 }
 
 /* Decode a literal (one 8-bit byte) */
-static void INIT lzma_literal(struct xz_dec_lzma2 *s)
+static void __init lzma_literal(struct xz_dec_lzma2 *s)
 {
 	uint16_t *probs;
 	uint32_t symbol;
@@ -616,8 +616,8 @@ static void INIT lzma_literal(struct xz_dec_lzma2 *s)
 }
 
 /* Decode the length of the match into s->lzma.len. */
-static void INIT lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l,
-			  uint32_t pos_state)
+static void __init lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l,
+			    uint32_t pos_state)
 {
 	uint16_t *probs;
 	uint32_t limit;
@@ -643,7 +643,7 @@ static void INIT lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l,
 }
 
 /* Decode a match. The distance will be stored in s->lzma.rep0. */
-static void INIT lzma_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
+static void __init lzma_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
 {
 	uint16_t *probs;
 	uint32_t dist_slot;
@@ -685,7 +685,7 @@ static void INIT lzma_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
  * Decode a repeated match. The distance is one of the four most recently
  * seen matches. The distance will be stored in s->lzma.rep0.
  */
-static void INIT lzma_rep_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
+static void __init lzma_rep_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
 {
 	uint32_t tmp;
 
@@ -719,7 +719,7 @@ static void INIT lzma_rep_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
 }
 
 /* LZMA decoder core */
-static bool_t INIT lzma_main(struct xz_dec_lzma2 *s)
+static bool_t __init lzma_main(struct xz_dec_lzma2 *s)
 {
 	uint32_t pos_state;
 
@@ -764,7 +764,7 @@ static bool_t INIT lzma_main(struct xz_dec_lzma2 *s)
  * Reset the LZMA decoder and range decoder state. Dictionary is nore reset
  * here, because LZMA state may be reset without resetting the dictionary.
  */
-static void INIT lzma_reset(struct xz_dec_lzma2 *s)
+static void __init lzma_reset(struct xz_dec_lzma2 *s)
 {
 	uint16_t *probs;
 	size_t i;
@@ -796,7 +796,7 @@ static void INIT lzma_reset(struct xz_dec_lzma2 *s)
  * from the decoded lp and pb values. On success, the LZMA decoder state is
  * reset and true is returned.
  */
-static bool_t INIT lzma_props(struct xz_dec_lzma2 *s, uint8_t props)
+static bool_t __init lzma_props(struct xz_dec_lzma2 *s, uint8_t props)
 {
 	if (props > (4 * 5 + 4) * 9 + 8)
 		return false;
@@ -843,7 +843,7 @@ static bool_t INIT lzma_props(struct xz_dec_lzma2 *s, uint8_t props)
  * function. We decode a few bytes from the temporary buffer so that we can
  * continue decoding from the caller-supplied input buffer again.
  */
-static bool_t INIT lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b)
+static bool_t __init lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b)
 {
 	size_t in_avail;
 	uint32_t tmp;
@@ -928,8 +928,8 @@ static bool_t INIT lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b)
  * Take care of the LZMA2 control layer, and forward the job of actual LZMA
  * decoding or copying of uncompressed chunks to other functions.
  */
-XZ_EXTERN enum xz_ret INIT xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
-					    struct xz_buf *b)
+XZ_EXTERN enum xz_ret __init xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
+					      struct xz_buf *b)
 {
 	uint32_t tmp;
 
@@ -1105,8 +1105,8 @@ XZ_EXTERN enum xz_ret INIT xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
 	return XZ_OK;
 }
 
-XZ_EXTERN struct xz_dec_lzma2 *INIT xz_dec_lzma2_create(enum xz_mode mode,
-						   uint32_t dict_max)
+XZ_EXTERN struct xz_dec_lzma2 *__init xz_dec_lzma2_create(enum xz_mode mode,
+							  uint32_t dict_max)
 {
 	struct xz_dec_lzma2 *s = malloc(sizeof(*s));
 	if (s == NULL)
@@ -1129,7 +1129,7 @@ XZ_EXTERN struct xz_dec_lzma2 *INIT xz_dec_lzma2_create(enum xz_mode mode,
 	return s;
 }
 
-XZ_EXTERN enum xz_ret INIT xz_dec_lzma2_reset(struct xz_dec_lzma2 *s, uint8_t props)
+XZ_EXTERN enum xz_ret __init xz_dec_lzma2_reset(struct xz_dec_lzma2 *s, uint8_t props)
 {
 	/* This limits dictionary size to 3 GiB to keep parsing simpler. */
 	if (props > 39)
@@ -1166,7 +1166,7 @@ XZ_EXTERN enum xz_ret INIT xz_dec_lzma2_reset(struct xz_dec_lzma2 *s, uint8_t pr
 	return XZ_OK;
 }
 
-XZ_EXTERN void INIT xz_dec_lzma2_end(struct xz_dec_lzma2 *s)
+XZ_EXTERN void __init xz_dec_lzma2_end(struct xz_dec_lzma2 *s)
 {
 	if (DEC_IS_MULTI(s->dict.mode))
 		large_free(s->dict.buf);
diff --git a/xen/common/xz/dec_stream.c b/xen/common/xz/dec_stream.c
index b8b566307c..b7a8c15c5b 100644
--- a/xen/common/xz/dec_stream.c
+++ b/xen/common/xz/dec_stream.c
@@ -154,7 +154,7 @@ static const uint8_t check_sizes[16] = {
  * to copy into s->temp.buf. Return true once s->temp.pos has reached
  * s->temp.size.
  */
-static bool_t INIT fill_temp(struct xz_dec *s, struct xz_buf *b)
+static bool_t __init fill_temp(struct xz_dec *s, struct xz_buf *b)
 {
 	size_t copy_size = min_t(size_t,
 			b->in_size - b->in_pos, s->temp.size - s->temp.pos);
@@ -172,8 +172,8 @@ static bool_t INIT fill_temp(struct xz_dec *s, struct xz_buf *b)
 }
 
 /* Decode a variable-length integer (little-endian base-128 encoding) */
-static enum xz_ret INIT dec_vli(struct xz_dec *s, const uint8_t *in,
-				size_t *in_pos, size_t in_size)
+static enum xz_ret __init dec_vli(struct xz_dec *s, const uint8_t *in,
+				  size_t *in_pos, size_t in_size)
 {
 	uint8_t byte;
 
@@ -215,7 +215,7 @@ static enum xz_ret INIT dec_vli(struct xz_dec *s, const uint8_t *in,
  * the sizes possibly stored in the Block Header. Update the hash and
  * Block count, which are later used to validate the Index field.
  */
-static enum xz_ret INIT dec_block(struct xz_dec *s, struct xz_buf *b)
+static enum xz_ret __init dec_block(struct xz_dec *s, struct xz_buf *b)
 {
 	enum xz_ret ret;
 
@@ -278,7 +278,7 @@ static enum xz_ret INIT dec_block(struct xz_dec *s, struct xz_buf *b)
 }
 
 /* Update the Index size and the CRC32 value. */
-static void INIT index_update(struct xz_dec *s, const struct xz_buf *b)
+static void __init index_update(struct xz_dec *s, const struct xz_buf *b)
 {
 	size_t in_used = b->in_pos - s->in_start;
 	s->index.size += in_used;
@@ -293,7 +293,7 @@ static void INIT index_update(struct xz_dec *s, const struct xz_buf *b)
  * This can return XZ_OK (more input needed), XZ_STREAM_END (everything
  * successfully decoded), or XZ_DATA_ERROR (input is corrupt).
  */
-static enum xz_ret INIT dec_index(struct xz_dec *s, struct xz_buf *b)
+static enum xz_ret __init dec_index(struct xz_dec *s, struct xz_buf *b)
 {
 	enum xz_ret ret;
 
@@ -343,7 +343,7 @@ static enum xz_ret INIT dec_index(struct xz_dec *s, struct xz_buf *b)
  * Validate that the next four input bytes match the value of s->crc32.
  * s->pos must be zero when starting to validate the first byte.
  */
-static enum xz_ret INIT crc32_validate(struct xz_dec *s, struct xz_buf *b)
+static enum xz_ret __init crc32_validate(struct xz_dec *s, struct xz_buf *b)
 {
 	do {
 		if (b->in_pos == b->in_size)
@@ -367,7 +367,7 @@ static enum xz_ret INIT crc32_validate(struct xz_dec *s, struct xz_buf *b)
  * Skip over the Check field when the Check ID is not supported.
  * Returns true once the whole Check field has been skipped over.
  */
-static bool_t INIT check_skip(struct xz_dec *s, struct xz_buf *b)
+static bool_t __init check_skip(struct xz_dec *s, struct xz_buf *b)
 {
 	while (s->pos < check_sizes[s->check_type]) {
 		if (b->in_pos == b->in_size)
@@ -384,7 +384,7 @@ static bool_t INIT check_skip(struct xz_dec *s, struct xz_buf *b)
 #endif
 
 /* Decode the Stream Header field (the first 12 bytes of the .xz Stream). */
-static enum xz_ret INIT dec_stream_header(struct xz_dec *s)
+static enum xz_ret __init dec_stream_header(struct xz_dec *s)
 {
 	if (!memeq(s->temp.buf, HEADER_MAGIC, HEADER_MAGIC_SIZE))
 		return XZ_FORMAT_ERROR;
@@ -419,7 +419,7 @@ static enum xz_ret INIT dec_stream_header(struct xz_dec *s)
 }
 
 /* Decode the Stream Footer field (the last 12 bytes of the .xz Stream) */
-static enum xz_ret INIT dec_stream_footer(struct xz_dec *s)
+static enum xz_ret __init dec_stream_footer(struct xz_dec *s)
 {
 	if (!memeq(s->temp.buf + 10, FOOTER_MAGIC, FOOTER_MAGIC_SIZE))
 		return XZ_DATA_ERROR;
@@ -446,7 +446,7 @@ static enum xz_ret INIT dec_stream_footer(struct xz_dec *s)
 }
 
 /* Decode the Block Header and initialize the filter chain. */
-static enum xz_ret INIT dec_block_header(struct xz_dec *s)
+static enum xz_ret __init dec_block_header(struct xz_dec *s)
 {
 	enum xz_ret ret;
 
@@ -546,7 +546,7 @@ static enum xz_ret INIT dec_block_header(struct xz_dec *s)
 	return XZ_OK;
 }
 
-static enum xz_ret INIT dec_main(struct xz_dec *s, struct xz_buf *b)
+static enum xz_ret __init dec_main(struct xz_dec *s, struct xz_buf *b)
 {
 	enum xz_ret ret;
 
@@ -706,7 +706,7 @@ static enum xz_ret INIT dec_main(struct xz_dec *s, struct xz_buf *b)
 	/* Never reached */
 }
 
-XZ_EXTERN void INIT xz_dec_reset(struct xz_dec *s)
+XZ_EXTERN void __init xz_dec_reset(struct xz_dec *s)
 {
 	s->sequence = SEQ_STREAM_HEADER;
 	s->allow_buf_error = false;
@@ -743,7 +743,7 @@ XZ_EXTERN void INIT xz_dec_reset(struct xz_dec *s)
  * actually succeeds (that's the price to pay of using the output buffer as
  * the workspace).
  */
-XZ_EXTERN enum xz_ret INIT xz_dec_run(struct xz_dec *s, struct xz_buf *b)
+XZ_EXTERN enum xz_ret __init xz_dec_run(struct xz_dec *s, struct xz_buf *b)
 {
 	size_t in_start;
 	size_t out_start;
@@ -779,7 +779,7 @@ XZ_EXTERN enum xz_ret INIT xz_dec_run(struct xz_dec *s, struct xz_buf *b)
 	return ret;
 }
 
-XZ_EXTERN struct xz_dec *INIT xz_dec_init(enum xz_mode mode, uint32_t dict_max)
+XZ_EXTERN struct xz_dec *__init xz_dec_init(enum xz_mode mode, uint32_t dict_max)
 {
 	struct xz_dec *s = malloc(sizeof(*s));
 	if (s == NULL)
@@ -809,7 +809,7 @@ error_bcj:
 	return NULL;
 }
 
-XZ_EXTERN void INIT xz_dec_end(struct xz_dec *s)
+XZ_EXTERN void __init xz_dec_end(struct xz_dec *s)
 {
 	if (s != NULL) {
 		xz_dec_lzma2_end(s->lzma2);
diff --git a/xen/common/xz/lzma2.h b/xen/common/xz/lzma2.h
index 7df5f8ba68..e0ef42e880 100644
--- a/xen/common/xz/lzma2.h
+++ b/xen/common/xz/lzma2.h
@@ -61,7 +61,7 @@ enum lzma_state {
 #define LIT_STATES 7
 
 /* Indicate that the latest symbol was a literal. */
-static inline void INIT lzma_state_literal(enum lzma_state *state)
+static inline void __init lzma_state_literal(enum lzma_state *state)
 {
 	if (*state <= STATE_SHORTREP_LIT_LIT)
 		*state = STATE_LIT_LIT;
@@ -72,25 +72,25 @@ static inline void INIT lzma_state_literal(enum lzma_state *state)
 }
 
 /* Indicate that the latest symbol was a match. */
-static inline void INIT lzma_state_match(enum lzma_state *state)
+static inline void __init lzma_state_match(enum lzma_state *state)
 {
 	*state = *state < LIT_STATES ? STATE_LIT_MATCH : STATE_NONLIT_MATCH;
 }
 
 /* Indicate that the latest state was a long repeated match. */
-static inline void INIT lzma_state_long_rep(enum lzma_state *state)
+static inline void __init lzma_state_long_rep(enum lzma_state *state)
 {
 	*state = *state < LIT_STATES ? STATE_LIT_LONGREP : STATE_NONLIT_REP;
 }
 
 /* Indicate that the latest symbol was a short match. */
-static inline void INIT lzma_state_short_rep(enum lzma_state *state)
+static inline void __init lzma_state_short_rep(enum lzma_state *state)
 {
 	*state = *state < LIT_STATES ? STATE_LIT_SHORTREP : STATE_NONLIT_REP;
 }
 
 /* Test if the previous symbol was a literal. */
-static inline bool_t INIT lzma_state_is_literal(enum lzma_state state)
+static inline bool_t __init lzma_state_is_literal(enum lzma_state state)
 {
 	return state < LIT_STATES;
 }
@@ -144,7 +144,7 @@ static inline bool_t INIT lzma_state_is_literal(enum lzma_state state)
  * Get the index of the appropriate probability array for decoding
  * the distance slot.
  */
-static inline uint32_t INIT lzma_get_dist_state(uint32_t len)
+static inline uint32_t __init lzma_get_dist_state(uint32_t len)
 {
 	return len < DIST_STATES + MATCH_LEN_MIN
 			? len - MATCH_LEN_MIN : DIST_STATES - 1;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 16 12:55:58 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Apr 2021 12:55:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111724.213667 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXO0s-0005wA-7z; Fri, 16 Apr 2021 12:55:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111724.213667; Fri, 16 Apr 2021 12:55: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 1lXO0s-0005w2-51; Fri, 16 Apr 2021 12:55:58 +0000
Received: by outflank-mailman (input) for mailman id 111724;
 Fri, 16 Apr 2021 12:55:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO0q-0005vu-E0
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:55: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 1lXO0q-0006Uc-DG
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:55:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO0q-0008U6-C7
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:55: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=5acsFKztQZSwJNLxKL4hMDb97+IhKsqBhOww3smxXMA=; b=e0087MIRZn0HmvNjaQCbqhZWi4
	/kEwNLz44yj1XIfJO05m4ibb1cHb+tl80UoIs+TYHwUIaZnKuE75fdhGFdum/uM3SlZKECCfSM3SA
	lnyxx+JrXUpTdPtPAUWVqtrJ2ai5VJhymP9MRX6s/x/w2JZlNwUOe7ubyS3H+eDS/mx8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move muldiv64()
Message-Id: <E1lXO0q-0008U6-C7@xenbits.xenproject.org>
Date: Fri, 16 Apr 2021 12:55:56 +0000

commit b3de22dda782af06e625b513cc3cccb98c1635c6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 16 14:41:48 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 16 14:41:48 2021 +0200

    lib: move muldiv64()
    
    Make this a separate archive member under lib/. While doing so, don't
    move latently broken x86 assembly though: Fix the constraints, such
    that properly extending inputs to 64-bit won't just be a side effect of
    needing to copy registers, and such that we won't fail to clobber %rdx.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/common/lib.c   | 29 -----------------------------
 xen/lib/Makefile   |  1 +
 xen/lib/muldiv64.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 29 deletions(-)

diff --git a/xen/common/lib.c b/xen/common/lib.c
index f5ca179a0a..5b8f49153d 100644
--- a/xen/common/lib.c
+++ b/xen/common/lib.c
@@ -393,35 +393,6 @@ s64 __ldivmod_helper(s64 a, s64 b, s64 *r)
 }
 #endif /* BITS_PER_LONG == 32 */
 
-/* Compute with 96 bit intermediate result: (a*b)/c */
-uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c)
-{
-#ifdef CONFIG_X86
-    asm ( "mul %%rdx; div %%rcx" : "=a" (a) : "0" (a), "d" (b), "c" (c) );
-    return a;
-#else
-    union {
-        uint64_t ll;
-        struct {
-#ifdef WORDS_BIGENDIAN
-            uint32_t high, low;
-#else
-            uint32_t low, high;
-#endif            
-        } l;
-    } u, res;
-    uint64_t rl, rh;
-
-    u.ll = a;
-    rl = (uint64_t)u.l.low * (uint64_t)b;
-    rh = (uint64_t)u.l.high * (uint64_t)b;
-    rh += (rl >> 32);
-    res.l.high = rh / c;
-    res.l.low = (((rh % c) << 32) + (rl & 0xffffffff)) / c;
-    return res.ll;
-#endif
-}
-
 /*
  * Local variables:
  * mode: C
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 1c2227cbfc..0b274583ef 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -4,6 +4,7 @@ lib-y += bsearch.o
 lib-y += ctors.o
 lib-y += ctype.o
 lib-y += list-sort.o
+lib-y += muldiv64.o
 lib-y += parse-size.o
 lib-y += rbtree.o
 lib-y += sort.o
diff --git a/xen/lib/muldiv64.c b/xen/lib/muldiv64.c
new file mode 100644
index 0000000000..78177ce616
--- /dev/null
+++ b/xen/lib/muldiv64.c
@@ -0,0 +1,44 @@
+#include <xen/lib.h>
+
+/* Compute with 96 bit intermediate result: (a*b)/c */
+uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c)
+{
+#ifdef CONFIG_X86
+    asm ( "mulq %1; divq %2" : "+a" (a)
+                             : "rm" ((uint64_t)b), "rm" ((uint64_t)c)
+                             : "rdx" );
+
+    return a;
+#else
+    union {
+        uint64_t ll;
+        struct {
+#ifdef WORDS_BIGENDIAN
+            uint32_t high, low;
+#else
+            uint32_t low, high;
+#endif
+        } l;
+    } u, res;
+    uint64_t rl, rh;
+
+    u.ll = a;
+    rl = (uint64_t)u.l.low * (uint64_t)b;
+    rh = (uint64_t)u.l.high * (uint64_t)b;
+    rh += (rl >> 32);
+    res.l.high = rh / c;
+    res.l.low = (((rh % c) << 32) + (rl & 0xffffffff)) / c;
+
+    return res.ll;
+#endif
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 16 12:56:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Apr 2021 12:56:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111725.213672 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXO12-0005xa-Ah; Fri, 16 Apr 2021 12:56:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111725.213672; Fri, 16 Apr 2021 12:56: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 1lXO12-0005xS-6Z; Fri, 16 Apr 2021 12:56:08 +0000
Received: by outflank-mailman (input) for mailman id 111725;
 Fri, 16 Apr 2021 12:56: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 1lXO10-0005xH-Hs
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:56: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 1lXO10-0006WW-H3
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:56:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO10-0008V6-GD
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:56: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=Ed692plECd6sQ1Z6OTprxJwnF5isq5wvhXHwLsj5nCg=; b=eaW2VT//xcXRxpikPCLfQ2ceEY
	0dmTPbfWF8JbgWZ8G4aXQf0vLMMEbNeaIBu8AUXFQpwDDebUA1i/DOqAs0eREx3XxnCTWA4ySXnPV
	sZgMpetCZ6fNM0m5YpLAKy6s/rYp1S5wVzJFMmlghEb/+EDAt4GgKjS265xzZI01AINE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move 64-bit div/mod compiler helpers
Message-Id: <E1lXO10-0008V6-GD@xenbits.xenproject.org>
Date: Fri, 16 Apr 2021 12:56:06 +0000

commit 849db4945b8b166085751681ac8b4f5b7cefece0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 16 14:43:10 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 16 14:43:10 2021 +0200

    lib: move 64-bit div/mod compiler helpers
    
    These were built for 32-bit architectures only (the same code could,
    with some tweaking, sensibly be used to provide TI-mode helpers on
    64-bit arch-es) - retain this property, while still avoiding to have
    a CU without any contents at all. For this, Arm's CONFIG_64BIT gets
    generalized.
    
    Note that we imply "32-bit arch" to be the same as BITS_PER_LONG == 32,
    i.e. we aren't (not just here) prepared to have a 64-bit arch with
    BITS_PER_LONG == 32. Yet even if we supported such, likely the compiler
    would get away there without invoking these helpers, so the code would
    remain unused in practice.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/Kconfig     |   2 +
 xen/arch/arm/Kconfig |  12 +-
 xen/arch/x86/Kconfig |   1 +
 xen/common/Makefile  |   1 -
 xen/common/lib.c     | 404 ---------------------------------------------------
 xen/lib/Makefile     |   4 +
 xen/lib/divmod.c     | 402 ++++++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 412 insertions(+), 414 deletions(-)

diff --git a/xen/arch/Kconfig b/xen/arch/Kconfig
index d144d4c8d3..f16eb0df43 100644
--- a/xen/arch/Kconfig
+++ b/xen/arch/Kconfig
@@ -1,3 +1,5 @@
+config 64BIT
+	bool
 
 config NR_CPUS
 	int "Maximum number of CPUs"
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 330bbf6232..ecfa6822e4 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -1,17 +1,11 @@
-config 64BIT
-	bool
-	default "$(ARCH)" != "arm32"
-	help
-	  Say yes to build a 64-bit Xen
-	  Say no to build a 32-bit Xen
-
 config ARM_32
 	def_bool y
-	depends on !64BIT
+	depends on "$(ARCH)" = "arm32"
 
 config ARM_64
 	def_bool y
-	depends on 64BIT
+	depends on !ARM_32
+	select 64BIT
 	select HAS_FAST_MULTIPLY
 
 config ARM
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index cb401fa2e5..57776d5106 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -1,5 +1,6 @@
 config X86_64
 	def_bool y
+	select 64BIT
 
 config X86
 	def_bool y
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 71c1d466bd..e2a7e62d14 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -21,7 +21,6 @@ obj-y += kernel.o
 obj-y += keyhandler.o
 obj-$(CONFIG_KEXEC) += kexec.o
 obj-$(CONFIG_KEXEC) += kimage.o
-obj-y += lib.o
 obj-$(CONFIG_LIVEPATCH) += livepatch.o livepatch_elf.o
 obj-$(CONFIG_MEM_ACCESS) += mem_access.o
 obj-y += memory.o
diff --git a/xen/common/lib.c b/xen/common/lib.c
deleted file mode 100644
index 5b8f49153d..0000000000
--- a/xen/common/lib.c
+++ /dev/null
@@ -1,404 +0,0 @@
-#include <xen/lib.h>
-#include <xen/types.h>
-#include <asm/byteorder.h>
-
-/*
- * A couple of 64 bit operations ported from FreeBSD.
- * The code within the '#if BITS_PER_LONG == 32' block below, and no other
- * code in this file, is distributed under the following licensing terms
- * This is the modified '3-clause' BSD license with the obnoxious
- * advertising clause removed, as permitted by University of California.
- *
- * Copyright (c) 1992, 1993
- * The Regents of the University of California.  All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#if BITS_PER_LONG == 32
-
-/*
- * Depending on the desired operation, we view a `long long' (aka quad_t) in
- * one or more of the following formats.
- */
-union uu {
-    s64            q;              /* as a (signed) quad */
-    s64            uq;             /* as an unsigned quad */
-    long           sl[2];          /* as two signed longs */
-    unsigned long  ul[2];          /* as two unsigned longs */
-};
-
-#ifdef __BIG_ENDIAN
-#define _QUAD_HIGHWORD 0
-#define _QUAD_LOWWORD 1
-#else /* __LITTLE_ENDIAN */
-#define _QUAD_HIGHWORD 1
-#define _QUAD_LOWWORD 0
-#endif
-
-/*
- * Define high and low longwords.
- */
-#define H               _QUAD_HIGHWORD
-#define L               _QUAD_LOWWORD
-
-/*
- * Total number of bits in a quad_t and in the pieces that make it up.
- * These are used for shifting, and also below for halfword extraction
- * and assembly.
- */
-#define CHAR_BIT        8               /* number of bits in a char */
-#define QUAD_BITS       (sizeof(s64) * CHAR_BIT)
-#define LONG_BITS       (sizeof(long) * CHAR_BIT)
-#define HALF_BITS       (sizeof(long) * CHAR_BIT / 2)
-
-/*
- * Extract high and low shortwords from longword, and move low shortword of
- * longword to upper half of long, i.e., produce the upper longword of
- * ((quad_t)(x) << (number_of_bits_in_long/2)).  (`x' must actually be
- * unsigned long.)
- *
- * These are used in the multiply code, to split a longword into upper
- * and lower halves, and to reassemble a product as a quad_t, shifted left
- * (sizeof(long)*CHAR_BIT/2).
- */
-#define HHALF(x)        ((x) >> HALF_BITS)
-#define LHALF(x)        ((x) & ((1 << HALF_BITS) - 1))
-#define LHUP(x)         ((x) << HALF_BITS)
-
-/*
- * Multiprecision divide.  This algorithm is from Knuth vol. 2 (2nd ed),
- * section 4.3.1, pp. 257--259.
- */
-#define B (1 << HALF_BITS) /* digit base */
-
-/* Combine two `digits' to make a single two-digit number. */
-#define COMBINE(a, b) (((unsigned long)(a) << HALF_BITS) | (b))
-
-/* select a type for digits in base B */
-typedef unsigned long digit;
-
-/*
- * Shift p[0]..p[len] left `sh' bits, ignoring any bits that
- * `fall out' the left (there never will be any such anyway).
- * We may assume len >= 0.  NOTE THAT THIS WRITES len+1 DIGITS.
- */
-static void shl(register digit *p, register int len, register int sh)
-{
-    register int i;
-
-    for (i = 0; i < len; i++)
-        p[i] = LHALF(p[i] << sh) | (p[i + 1] >> (HALF_BITS - sh));
-    p[i] = LHALF(p[i] << sh);
-}
-
-/*
- * __qdivrem(u, v, rem) returns u/v and, optionally, sets *rem to u%v.
- *
- * We do this in base 2-sup-HALF_BITS, so that all intermediate products
- * fit within unsigned long.  As a consequence, the maximum length dividend
- * and divisor are 4 `digits' in this base (they are shorter if they have
- * leading zeros).
- */
-u64 __qdivrem(u64 uq, u64 vq, u64 *arq)
-{
-    union uu tmp;
-    digit *u, *v, *q;
-    register digit v1, v2;
-    unsigned long qhat, rhat, t;
-    int m, n, d, j, i;
-    digit uspace[5], vspace[5], qspace[5];
-
-    /*
-     * Take care of special cases: divide by zero, and u < v.
-     */
-    if (vq == 0) {
-        /* divide by zero. */
-        static volatile const unsigned int zero = 0;
-
-        tmp.ul[H] = tmp.ul[L] = 1 / zero;
-        if (arq)
-            *arq = uq;
-        return (tmp.q);
-    }
-    if (uq < vq) {
-        if (arq)
-            *arq = uq;
-        return (0);
-    }
-    u = &uspace[0];
-    v = &vspace[0];
-    q = &qspace[0];
-
-    /*
-     * Break dividend and divisor into digits in base B, then
-     * count leading zeros to determine m and n.  When done, we
-     * will have:
-     * u = (u[1]u[2]...u[m+n]) sub B
-     * v = (v[1]v[2]...v[n]) sub B
-     * v[1] != 0
-     * 1 < n <= 4 (if n = 1, we use a different division algorithm)
-     * m >= 0 (otherwise u < v, which we already checked)
-     * m + n = 4
-     * and thus
-     * m = 4 - n <= 2
-     */
-    tmp.uq = uq;
-    u[0] = 0;
-    u[1] = HHALF(tmp.ul[H]);
-    u[2] = LHALF(tmp.ul[H]);
-    u[3] = HHALF(tmp.ul[L]);
-    u[4] = LHALF(tmp.ul[L]);
-    tmp.uq = vq;
-    v[1] = HHALF(tmp.ul[H]);
-    v[2] = LHALF(tmp.ul[H]);
-    v[3] = HHALF(tmp.ul[L]);
-    v[4] = LHALF(tmp.ul[L]);
-    for (n = 4; v[1] == 0; v++) {
-        if (--n == 1) {
-            unsigned long rbj; /* r*B+u[j] (not root boy jim) */
-            digit q1, q2, q3, q4;
-
-            /*
-             * Change of plan, per exercise 16.
-             * r = 0;
-             * for j = 1..4:
-             *  q[j] = floor((r*B + u[j]) / v),
-             *  r = (r*B + u[j]) % v;
-             * We unroll this completely here.
-             */
-            t = v[2]; /* nonzero, by definition */
-            q1 = u[1] / t;
-            rbj = COMBINE(u[1] % t, u[2]);
-            q2 = rbj / t;
-            rbj = COMBINE(rbj % t, u[3]);
-            q3 = rbj / t;
-            rbj = COMBINE(rbj % t, u[4]);
-            q4 = rbj / t;
-            if (arq)
-                *arq = rbj % t;
-            tmp.ul[H] = COMBINE(q1, q2);
-            tmp.ul[L] = COMBINE(q3, q4);
-            return (tmp.q);
-        }
-    }
-
-    /*
-     * By adjusting q once we determine m, we can guarantee that
-     * there is a complete four-digit quotient at &qspace[1] when
-     * we finally stop.
-     */
-    for (m = 4 - n; u[1] == 0; u++)
-        m--;
-    for (i = 4 - m; --i >= 0;)
-        q[i] = 0;
-    q += 4 - m;
-
-    /*
-     * Here we run Program D, translated from MIX to C and acquiring
-     * a few minor changes.
-     *
-     * D1: choose multiplier 1 << d to ensure v[1] >= B/2.
-     */
-    d = 0;
-    for (t = v[1]; t < B / 2; t <<= 1)
-        d++;
-    if (d > 0) {
-        shl(&u[0], m + n, d);  /* u <<= d */
-        shl(&v[1], n - 1, d);  /* v <<= d */
-    }
-    /*
-     * D2: j = 0.
-     */
-    j = 0;
-    v1 = v[1]; /* for D3 -- note that v[1..n] are constant */
-    v2 = v[2]; /* for D3 */
-    do {
-        register digit uj0, uj1, uj2;
-
-        /*
-         * D3: Calculate qhat (\^q, in TeX notation).
-         * Let qhat = min((u[j]*B + u[j+1])/v[1], B-1), and
-         * let rhat = (u[j]*B + u[j+1]) mod v[1].
-         * While rhat < B and v[2]*qhat > rhat*B+u[j+2],
-         * decrement qhat and increase rhat correspondingly.
-         * Note that if rhat >= B, v[2]*qhat < rhat*B.
-         */
-        uj0 = u[j + 0]; /* for D3 only -- note that u[j+...] change */
-        uj1 = u[j + 1]; /* for D3 only */
-        uj2 = u[j + 2]; /* for D3 only */
-        if (uj0 == v1) {
-            qhat = B;
-            rhat = uj1;
-            goto qhat_too_big;
-        } else {
-            unsigned long nn = COMBINE(uj0, uj1);
-
-            qhat = nn / v1;
-            rhat = nn % v1;
-        }
-        while (v2 * qhat > COMBINE(rhat, uj2)) {
-        qhat_too_big:
-            qhat--;
-            if ((rhat += v1) >= B)
-                break;
-        }
-        /*
-         * D4: Multiply and subtract.
-         * The variable `t' holds any borrows across the loop.
-         * We split this up so that we do not require v[0] = 0,
-         * and to eliminate a final special case.
-         */
-        for (t = 0, i = n; i > 0; i--) {
-            t = u[i + j] - v[i] * qhat - t;
-            u[i + j] = LHALF(t);
-            t = (B - HHALF(t)) & (B - 1);
-        }
-        t = u[j] - t;
-        u[j] = LHALF(t);
-        /*
-         * D5: test remainder.
-         * There is a borrow if and only if HHALF(t) is nonzero;
-         * in that (rare) case, qhat was too large (by exactly 1).
-         * Fix it by adding v[1..n] to u[j..j+n].
-         */
-        if (HHALF(t)) {
-            qhat--;
-            for (t = 0, i = n; i > 0; i--) { /* D6: add back. */
-                t += u[i + j] + v[i];
-                u[i + j] = LHALF(t);
-                t = HHALF(t);
-            }
-            u[j] = LHALF(u[j] + t);
-        }
-        q[j] = qhat;
-    } while (++j <= m);  /* D7: loop on j. */
-
-    /*
-     * If caller wants the remainder, we have to calculate it as
-     * u[m..m+n] >> d (this is at most n digits and thus fits in
-     * u[m+1..m+n], but we may need more source digits).
-     */
-    if (arq) {
-        if (d) {
-            for (i = m + n; i > m; --i)
-                u[i] = (u[i] >> d) |
-                    LHALF(u[i - 1] << (HALF_BITS - d));
-            u[i] = 0;
-        }
-        tmp.ul[H] = COMBINE(uspace[1], uspace[2]);
-        tmp.ul[L] = COMBINE(uspace[3], uspace[4]);
-        *arq = tmp.q;
-    }
-
-    tmp.ul[H] = COMBINE(qspace[1], qspace[2]);
-    tmp.ul[L] = COMBINE(qspace[3], qspace[4]);
-    return (tmp.q);
-}
-
-/*
- * Divide two signed quads.
- * Truncates towards zero, as required by C99.
- */
-s64 __divdi3(s64 a, s64 b)
-{
-    u64 ua, ub, uq;
-    int neg = (a < 0) ^ (b < 0);
-    ua = (a < 0) ? -(u64)a : a;
-    ub = (b < 0) ? -(u64)b : b;
-    uq = __qdivrem(ua, ub, (u64 *)0);
-    return (neg ? -uq : uq);
-}
-
-
-/*
- * Divide two unsigned quads.
- */
-u64 __udivdi3(u64 a, u64 b)
-{
-    return __qdivrem(a, b, (u64 *)0);
-}
-
-/*
- * Remainder of unsigned quad division
- */
-u64 __umoddi3(u64 a, u64 b)
-{
-    u64 rem;
-    __qdivrem(a, b, &rem);
-    return rem;
-}
-
-/*
- * Remainder of signed quad division.
- * Truncates towards zero, as required by C99:
- *  11 %  5 =  1
- * -11 %  5 = -1
- *  11 % -5 =  1
- * -11 % -5 = -1
- */
-s64 __moddi3(s64 a, s64 b)
-{
-    u64 ua, ub, urem;
-    int neg = (a < 0);
-    ua = neg ? -(u64)a : a;
-    ub = (b < 0) ? -(u64)b : b;
-    __qdivrem(ua, ub, &urem);
-    return (neg ? -urem : urem);
-}
-
-/*
- * Quotient and remainder of unsigned long long division
- */
-s64 __ldivmod_helper(s64 a, s64 b, s64 *r)
-{
-    u64 ua, ub, rem, quot;
-
-    ua = ABS(a);
-    ub = ABS(b);
-    quot = __qdivrem(ua, ub, &rem);
-    if ( a < 0 )
-        *r = -rem;
-    else
-        *r = rem;
-    if ( (a < 0) ^ (b < 0) )
-        return -quot;
-    else
-        return quot;
-}
-#endif /* BITS_PER_LONG == 32 */
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 0b274583ef..a5dc1442a4 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -10,3 +10,7 @@ lib-y += rbtree.o
 lib-y += sort.o
 lib-$(CONFIG_X86) += xxhash32.o
 lib-$(CONFIG_X86) += xxhash64.o
+
+lib32-y := divmod.o
+lib32-$(CONFIG_64BIT) :=
+lib-y += $(lib32-y)
diff --git a/xen/lib/divmod.c b/xen/lib/divmod.c
new file mode 100644
index 0000000000..0be6ccc700
--- /dev/null
+++ b/xen/lib/divmod.c
@@ -0,0 +1,402 @@
+#include <xen/lib.h>
+#include <xen/types.h>
+#include <asm/byteorder.h>
+
+/*
+ * A couple of 64 bit operations ported from FreeBSD.
+ * The code within the '#if BITS_PER_LONG == 32' block below, and no other
+ * code in this file, is distributed under the following licensing terms
+ * This is the modified '3-clause' BSD license with the obnoxious
+ * advertising clause removed, as permitted by University of California.
+ *
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California.  All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Depending on the desired operation, we view a `long long' (aka quad_t) in
+ * one or more of the following formats.
+ */
+union uu {
+    s64            q;              /* as a (signed) quad */
+    s64            uq;             /* as an unsigned quad */
+    long           sl[2];          /* as two signed longs */
+    unsigned long  ul[2];          /* as two unsigned longs */
+};
+
+#ifdef __BIG_ENDIAN
+#define _QUAD_HIGHWORD 0
+#define _QUAD_LOWWORD 1
+#else /* __LITTLE_ENDIAN */
+#define _QUAD_HIGHWORD 1
+#define _QUAD_LOWWORD 0
+#endif
+
+/*
+ * Define high and low longwords.
+ */
+#define H               _QUAD_HIGHWORD
+#define L               _QUAD_LOWWORD
+
+/*
+ * Total number of bits in a quad_t and in the pieces that make it up.
+ * These are used for shifting, and also below for halfword extraction
+ * and assembly.
+ */
+#define CHAR_BIT        8               /* number of bits in a char */
+#define QUAD_BITS       (sizeof(s64) * CHAR_BIT)
+#define LONG_BITS       (sizeof(long) * CHAR_BIT)
+#define HALF_BITS       (sizeof(long) * CHAR_BIT / 2)
+
+/*
+ * Extract high and low shortwords from longword, and move low shortword of
+ * longword to upper half of long, i.e., produce the upper longword of
+ * ((quad_t)(x) << (number_of_bits_in_long/2)).  (`x' must actually be
+ * unsigned long.)
+ *
+ * These are used in the multiply code, to split a longword into upper
+ * and lower halves, and to reassemble a product as a quad_t, shifted left
+ * (sizeof(long)*CHAR_BIT/2).
+ */
+#define HHALF(x)        ((x) >> HALF_BITS)
+#define LHALF(x)        ((x) & ((1 << HALF_BITS) - 1))
+#define LHUP(x)         ((x) << HALF_BITS)
+
+/*
+ * Multiprecision divide.  This algorithm is from Knuth vol. 2 (2nd ed),
+ * section 4.3.1, pp. 257--259.
+ */
+#define B (1 << HALF_BITS) /* digit base */
+
+/* Combine two `digits' to make a single two-digit number. */
+#define COMBINE(a, b) (((unsigned long)(a) << HALF_BITS) | (b))
+
+/* select a type for digits in base B */
+typedef unsigned long digit;
+
+/*
+ * Shift p[0]..p[len] left `sh' bits, ignoring any bits that
+ * `fall out' the left (there never will be any such anyway).
+ * We may assume len >= 0.  NOTE THAT THIS WRITES len+1 DIGITS.
+ */
+static void shl(register digit *p, register int len, register int sh)
+{
+    register int i;
+
+    for (i = 0; i < len; i++)
+        p[i] = LHALF(p[i] << sh) | (p[i + 1] >> (HALF_BITS - sh));
+    p[i] = LHALF(p[i] << sh);
+}
+
+/*
+ * __qdivrem(u, v, rem) returns u/v and, optionally, sets *rem to u%v.
+ *
+ * We do this in base 2-sup-HALF_BITS, so that all intermediate products
+ * fit within unsigned long.  As a consequence, the maximum length dividend
+ * and divisor are 4 `digits' in this base (they are shorter if they have
+ * leading zeros).
+ */
+u64 __qdivrem(u64 uq, u64 vq, u64 *arq)
+{
+    union uu tmp;
+    digit *u, *v, *q;
+    register digit v1, v2;
+    unsigned long qhat, rhat, t;
+    int m, n, d, j, i;
+    digit uspace[5], vspace[5], qspace[5];
+
+    /*
+     * Take care of special cases: divide by zero, and u < v.
+     */
+    if (vq == 0) {
+        /* divide by zero. */
+        static volatile const unsigned int zero = 0;
+
+        tmp.ul[H] = tmp.ul[L] = 1 / zero;
+        if (arq)
+            *arq = uq;
+        return (tmp.q);
+    }
+    if (uq < vq) {
+        if (arq)
+            *arq = uq;
+        return (0);
+    }
+    u = &uspace[0];
+    v = &vspace[0];
+    q = &qspace[0];
+
+    /*
+     * Break dividend and divisor into digits in base B, then
+     * count leading zeros to determine m and n.  When done, we
+     * will have:
+     * u = (u[1]u[2]...u[m+n]) sub B
+     * v = (v[1]v[2]...v[n]) sub B
+     * v[1] != 0
+     * 1 < n <= 4 (if n = 1, we use a different division algorithm)
+     * m >= 0 (otherwise u < v, which we already checked)
+     * m + n = 4
+     * and thus
+     * m = 4 - n <= 2
+     */
+    tmp.uq = uq;
+    u[0] = 0;
+    u[1] = HHALF(tmp.ul[H]);
+    u[2] = LHALF(tmp.ul[H]);
+    u[3] = HHALF(tmp.ul[L]);
+    u[4] = LHALF(tmp.ul[L]);
+    tmp.uq = vq;
+    v[1] = HHALF(tmp.ul[H]);
+    v[2] = LHALF(tmp.ul[H]);
+    v[3] = HHALF(tmp.ul[L]);
+    v[4] = LHALF(tmp.ul[L]);
+    for (n = 4; v[1] == 0; v++) {
+        if (--n == 1) {
+            unsigned long rbj; /* r*B+u[j] (not root boy jim) */
+            digit q1, q2, q3, q4;
+
+            /*
+             * Change of plan, per exercise 16.
+             * r = 0;
+             * for j = 1..4:
+             *  q[j] = floor((r*B + u[j]) / v),
+             *  r = (r*B + u[j]) % v;
+             * We unroll this completely here.
+             */
+            t = v[2]; /* nonzero, by definition */
+            q1 = u[1] / t;
+            rbj = COMBINE(u[1] % t, u[2]);
+            q2 = rbj / t;
+            rbj = COMBINE(rbj % t, u[3]);
+            q3 = rbj / t;
+            rbj = COMBINE(rbj % t, u[4]);
+            q4 = rbj / t;
+            if (arq)
+                *arq = rbj % t;
+            tmp.ul[H] = COMBINE(q1, q2);
+            tmp.ul[L] = COMBINE(q3, q4);
+            return (tmp.q);
+        }
+    }
+
+    /*
+     * By adjusting q once we determine m, we can guarantee that
+     * there is a complete four-digit quotient at &qspace[1] when
+     * we finally stop.
+     */
+    for (m = 4 - n; u[1] == 0; u++)
+        m--;
+    for (i = 4 - m; --i >= 0;)
+        q[i] = 0;
+    q += 4 - m;
+
+    /*
+     * Here we run Program D, translated from MIX to C and acquiring
+     * a few minor changes.
+     *
+     * D1: choose multiplier 1 << d to ensure v[1] >= B/2.
+     */
+    d = 0;
+    for (t = v[1]; t < B / 2; t <<= 1)
+        d++;
+    if (d > 0) {
+        shl(&u[0], m + n, d);  /* u <<= d */
+        shl(&v[1], n - 1, d);  /* v <<= d */
+    }
+    /*
+     * D2: j = 0.
+     */
+    j = 0;
+    v1 = v[1]; /* for D3 -- note that v[1..n] are constant */
+    v2 = v[2]; /* for D3 */
+    do {
+        register digit uj0, uj1, uj2;
+
+        /*
+         * D3: Calculate qhat (\^q, in TeX notation).
+         * Let qhat = min((u[j]*B + u[j+1])/v[1], B-1), and
+         * let rhat = (u[j]*B + u[j+1]) mod v[1].
+         * While rhat < B and v[2]*qhat > rhat*B+u[j+2],
+         * decrement qhat and increase rhat correspondingly.
+         * Note that if rhat >= B, v[2]*qhat < rhat*B.
+         */
+        uj0 = u[j + 0]; /* for D3 only -- note that u[j+...] change */
+        uj1 = u[j + 1]; /* for D3 only */
+        uj2 = u[j + 2]; /* for D3 only */
+        if (uj0 == v1) {
+            qhat = B;
+            rhat = uj1;
+            goto qhat_too_big;
+        } else {
+            unsigned long nn = COMBINE(uj0, uj1);
+
+            qhat = nn / v1;
+            rhat = nn % v1;
+        }
+        while (v2 * qhat > COMBINE(rhat, uj2)) {
+        qhat_too_big:
+            qhat--;
+            if ((rhat += v1) >= B)
+                break;
+        }
+        /*
+         * D4: Multiply and subtract.
+         * The variable `t' holds any borrows across the loop.
+         * We split this up so that we do not require v[0] = 0,
+         * and to eliminate a final special case.
+         */
+        for (t = 0, i = n; i > 0; i--) {
+            t = u[i + j] - v[i] * qhat - t;
+            u[i + j] = LHALF(t);
+            t = (B - HHALF(t)) & (B - 1);
+        }
+        t = u[j] - t;
+        u[j] = LHALF(t);
+        /*
+         * D5: test remainder.
+         * There is a borrow if and only if HHALF(t) is nonzero;
+         * in that (rare) case, qhat was too large (by exactly 1).
+         * Fix it by adding v[1..n] to u[j..j+n].
+         */
+        if (HHALF(t)) {
+            qhat--;
+            for (t = 0, i = n; i > 0; i--) { /* D6: add back. */
+                t += u[i + j] + v[i];
+                u[i + j] = LHALF(t);
+                t = HHALF(t);
+            }
+            u[j] = LHALF(u[j] + t);
+        }
+        q[j] = qhat;
+    } while (++j <= m);  /* D7: loop on j. */
+
+    /*
+     * If caller wants the remainder, we have to calculate it as
+     * u[m..m+n] >> d (this is at most n digits and thus fits in
+     * u[m+1..m+n], but we may need more source digits).
+     */
+    if (arq) {
+        if (d) {
+            for (i = m + n; i > m; --i)
+                u[i] = (u[i] >> d) |
+                    LHALF(u[i - 1] << (HALF_BITS - d));
+            u[i] = 0;
+        }
+        tmp.ul[H] = COMBINE(uspace[1], uspace[2]);
+        tmp.ul[L] = COMBINE(uspace[3], uspace[4]);
+        *arq = tmp.q;
+    }
+
+    tmp.ul[H] = COMBINE(qspace[1], qspace[2]);
+    tmp.ul[L] = COMBINE(qspace[3], qspace[4]);
+    return (tmp.q);
+}
+
+/*
+ * Divide two signed quads.
+ * Truncates towards zero, as required by C99.
+ */
+s64 __divdi3(s64 a, s64 b)
+{
+    u64 ua, ub, uq;
+    int neg = (a < 0) ^ (b < 0);
+    ua = (a < 0) ? -(u64)a : a;
+    ub = (b < 0) ? -(u64)b : b;
+    uq = __qdivrem(ua, ub, (u64 *)0);
+    return (neg ? -uq : uq);
+}
+
+
+/*
+ * Divide two unsigned quads.
+ */
+u64 __udivdi3(u64 a, u64 b)
+{
+    return __qdivrem(a, b, (u64 *)0);
+}
+
+/*
+ * Remainder of unsigned quad division
+ */
+u64 __umoddi3(u64 a, u64 b)
+{
+    u64 rem;
+    __qdivrem(a, b, &rem);
+    return rem;
+}
+
+/*
+ * Remainder of signed quad division.
+ * Truncates towards zero, as required by C99:
+ *  11 %  5 =  1
+ * -11 %  5 = -1
+ *  11 % -5 =  1
+ * -11 % -5 = -1
+ */
+s64 __moddi3(s64 a, s64 b)
+{
+    u64 ua, ub, urem;
+    int neg = (a < 0);
+    ua = neg ? -(u64)a : a;
+    ub = (b < 0) ? -(u64)b : b;
+    __qdivrem(ua, ub, &urem);
+    return (neg ? -urem : urem);
+}
+
+/*
+ * Quotient and remainder of unsigned long long division
+ */
+s64 __ldivmod_helper(s64 a, s64 b, s64 *r)
+{
+    u64 ua, ub, rem, quot;
+
+    ua = ABS(a);
+    ub = ABS(b);
+    quot = __qdivrem(ua, ub, &rem);
+    if ( a < 0 )
+        *r = -rem;
+    else
+        *r = rem;
+    if ( (a < 0) ^ (b < 0) )
+        return -quot;
+    else
+        return quot;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 16 12:56:18 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Apr 2021 12:56:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111726.213675 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXO1C-0005ys-D0; Fri, 16 Apr 2021 12:56:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111726.213675; Fri, 16 Apr 2021 12:56: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 1lXO1C-0005yk-9z; Fri, 16 Apr 2021 12:56:18 +0000
Received: by outflank-mailman (input) for mailman id 111726;
 Fri, 16 Apr 2021 12:56: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 1lXO1A-0005yc-LN
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:56: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 1lXO1A-0006WZ-KU
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:56:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXO1A-0008Vy-Je
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 12:56: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=N4P3kmajGkv8EKeKmQ4y71FxmPIqhQaLcukvW5r5q+8=; b=KG1YQDuTSFSvn2B86L0K2GU8O1
	eiZbC9tO8yLWLCe7NwX/J3eYYJOwG/GaChXeSIW+VXSJ+tExHt4fDgUhTEf/tMvmf0P0jXWJLEEWl
	F6FTIGU7cgssQPIvZElDt840JAbBuScouILLdv+9rIxd+lJsxODdnblAmfWaBwmoMTnw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] string: drop redundant declarations
Message-Id: <E1lXO1A-0008Vy-Je@xenbits.xenproject.org>
Date: Fri, 16 Apr 2021 12:56:16 +0000

commit 9b47be876f2a9521bb1f247d855603c00bc99465
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 16 14:44:01 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 16 14:44:01 2021 +0200

    string: drop redundant declarations
    
    These standard functions shouldn't need custom declarations. The only
    case where redundancy might be needed is if there were inline functions
    there. But we don't have any here (anymore). Prune the per-arch headers
    of duplicate declarations while moving the asm/string.h inclusion past
    the declarations.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/include/asm-arm/string.h | 20 --------------
 xen/include/asm-x86/string.h |  3 --
 xen/include/xen/string.h     | 66 ++++++++++++++------------------------------
 3 files changed, 21 insertions(+), 68 deletions(-)

diff --git a/xen/include/asm-arm/string.h b/xen/include/asm-arm/string.h
index 1804c3c0bc..b485e49044 100644
--- a/xen/include/asm-arm/string.h
+++ b/xen/include/asm-arm/string.h
@@ -8,41 +8,21 @@
  */
 
 #define __HAVE_ARCH_STRRCHR
-char *strrchr(const char *s, int c);
-
 #define __HAVE_ARCH_STRCHR
-char *strchr(const char *s, int c);
-
 #if defined(CONFIG_ARM_64)
 #define __HAVE_ARCH_STRCMP
-int strcmp(const char *, const char *);
-
 #define __HAVE_ARCH_STRNCMP
-int strncmp(const char *, const char *, size_t);
-
 #define __HAVE_ARCH_STRLEN
-size_t strlen(const char *);
-
 #define __HAVE_ARCH_STRNLEN
-size_t strnlen(const char *, size_t);
 #endif
 
 #define __HAVE_ARCH_MEMCPY
-void *memcpy(void *, const void *, size_t);
-
 #if defined(CONFIG_ARM_64)
 #define __HAVE_ARCH_MEMCMP
-int memcmp(const void *, const void *, size_t);
 #endif
-
 #define __HAVE_ARCH_MEMMOVE
-void *memmove(void *dest, const void *src, size_t n);
-
 #define __HAVE_ARCH_MEMSET
-void *memset(void *, int, size_t);
-
 #define __HAVE_ARCH_MEMCHR
-void *memchr(const void *, int, size_t);
 
 #if defined(CONFIG_ARM_32)
 
diff --git a/xen/include/asm-x86/string.h b/xen/include/asm-x86/string.h
index 6f3c960f05..4f1e1d4daf 100644
--- a/xen/include/asm-x86/string.h
+++ b/xen/include/asm-x86/string.h
@@ -2,15 +2,12 @@
 #define __X86_STRING_H__
 
 #define __HAVE_ARCH_MEMCPY
-void *memcpy(void *dest, const void *src, size_t n);
 #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
 
 #define __HAVE_ARCH_MEMMOVE
-void *memmove(void *dest, const void *src, size_t n);
 #define memmove(d, s, n) __builtin_memmove(d, s, n)
 
 #define __HAVE_ARCH_MEMSET
-void *memset(void *dest, int c, size_t n);
 #define memset(s, c, n) __builtin_memset(s, c, n)
 
 #endif /* __X86_STRING_H__ */
diff --git a/xen/include/xen/string.h b/xen/include/xen/string.h
index 4b3b57e74f..4f438b018a 100644
--- a/xen/include/xen/string.h
+++ b/xen/include/xen/string.h
@@ -3,11 +3,6 @@
 
 #include <xen/types.h>	/* for size_t */
 
-/*
- * Include machine specific inline routines
- */
-#include <asm/string.h>
-
 /*
  * These string functions are considered too dangerous for normal use.
  * Use safe_strcpy(), safe_strcat(), strlcpy(), strlcat() as appropriate.
@@ -17,97 +12,78 @@
 #define strncpy __xen_has_no_strncpy__
 #define strncat __xen_has_no_strncat__
 
-#ifndef __HAVE_ARCH_STRLCPY
 size_t strlcpy(char *, const char *, size_t);
-#endif
-
-#ifndef __HAVE_ARCH_STRLCAT
 size_t strlcat(char *, const char *, size_t);
-#endif
+int strcmp(const char *, const char *);
+int strncmp(const char *, const char *, size_t);
+int strnicmp(const char *, const char *, size_t);
+int strcasecmp(const char *, const char *);
+char *strchr(const char *, int);
+char *strrchr(const char *, int);
+char *strstr(const char *, const char *);
+size_t strlen(const char *);
+size_t strnlen(const char *, size_t);
+char *strpbrk(const char *, const char *);
+char *strsep(char **, const char *);
+size_t strspn(const char *, const char *);
+
+void *memset(void *, int, size_t);
+void *memcpy(void *, const void *, size_t);
+void *memmove(void *, const void *, size_t);
+int memcmp(const void *, const void *, size_t);
+void *memchr(const void *, int, size_t);
+void *memchr_inv(const void *, int, size_t);
+
+#include <asm/string.h>
 
 #ifndef __HAVE_ARCH_STRCMP
-int strcmp(const char *, const char *);
 #define strcmp(s1, s2) __builtin_strcmp(s1, s2)
 #endif
 
 #ifndef __HAVE_ARCH_STRNCMP
-int strncmp(const char *, const char *, size_t);
 #define strncmp(s1, s2, n) __builtin_strncmp(s1, s2, n)
 #endif
 
-#ifndef __HAVE_ARCH_STRNICMP
-int strnicmp(const char *, const char *, size_t);
-#endif
-
 #ifndef __HAVE_ARCH_STRCASECMP
-int strcasecmp(const char *, const char *);
 #define strcasecmp(s1, s2) __builtin_strcasecmp(s1, s2)
 #endif
 
 #ifndef __HAVE_ARCH_STRCHR
-char *strchr(const char *, int);
 #define strchr(s1, c) __builtin_strchr(s1, c)
 #endif
 
 #ifndef __HAVE_ARCH_STRRCHR
-char *strrchr(const char *, int);
 #define strrchr(s1, c) __builtin_strrchr(s1, c)
 #endif
 
 #ifndef __HAVE_ARCH_STRSTR
-char *strstr(const char *, const char *);
 #define strstr(s1, s2) __builtin_strstr(s1, s2)
 #endif
 
 #ifndef __HAVE_ARCH_STRLEN
-size_t strlen(const char *);
 #define strlen(s1) __builtin_strlen(s1)
 #endif
 
-#ifndef __HAVE_ARCH_STRNLEN
-size_t strnlen(const char *, size_t);
-#endif
-
-#ifndef __HAVE_ARCH_STRPBRK
-char *strpbrk(const char *, const char *);
-#endif
-
-#ifndef __HAVE_ARCH_STRSEP
-char *strsep(char **, const char *);
-#endif
-
-#ifndef __HAVE_ARCH_STRSPN
-size_t strspn(const char *, const char *);
-#endif
-
-
 #ifndef __HAVE_ARCH_MEMSET
-void *memset(void *, int, size_t);
 #define memset(s, c, n) __builtin_memset(s, c, n)
 #endif
 
 #ifndef __HAVE_ARCH_MEMCPY
-void *memcpy(void *, const void *, size_t);
 #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
 #endif
 
 #ifndef __HAVE_ARCH_MEMMOVE
-void *memmove(void *, const void *, size_t);
 #define memmove(d, s, n) __builtin_memmove(d, s, n)
 #endif
 
 #ifndef __HAVE_ARCH_MEMCMP
-int memcmp(const void *, const void *, size_t);
 #define memcmp(s1, s2, n) __builtin_memcmp(s1, s2, n)
 #endif
 
 #ifndef __HAVE_ARCH_MEMCHR
-void *memchr(const void *, int, size_t);
 #define memchr(s, c, n) __builtin_memchr(s, c, n)
 #endif
 
-void *memchr_inv(const void *, int, size_t);
-
 #define is_char_array(x) __builtin_types_compatible_p(typeof(x), char[])
 
 /* safe_xxx always NUL-terminates and returns !=0 if result is truncated. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 16 13:55:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Apr 2021 13:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111767.213757 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXOw7-0003my-Br; Fri, 16 Apr 2021 13:55:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111767.213757; Fri, 16 Apr 2021 13:55:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXOw7-0003mq-8o; Fri, 16 Apr 2021 13:55:07 +0000
Received: by outflank-mailman (input) for mailman id 111767;
 Fri, 16 Apr 2021 13:55:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXOw6-0003ml-7B
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 13:55:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXOw6-0007Us-2K
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 13:55:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXOw6-0004wx-0S
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 13:55:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QPLchrjJ30iWfQatfaall0tI7SmGkeATdO/4HYy37nw=; b=tpTJlyq24FPP+8gQKUtMaor04r
	B7IUn1DCxoiJ2yiD3xXwrpBIxmvJhIXv6oX/l4z4wBoVPgvvfT+kDFqxu4B7Yf71MEbdG+mlEE7+H
	UUED0Nb6VVhwBxCxvVbF3bjLFM2m7prieJ//opEdfncBEHDJyE63XA5lSitXxJ5krzeI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pv: Improve dom0_update_physmap() with CONFIG_SPECULATIVE_HARDEN_BRANCH
Message-Id: <E1lXOw6-0004wx-0S@xenbits.xenproject.org>
Date: Fri, 16 Apr 2021 13:55:06 +0000

commit 97f9861b8f22aaa28cb1f4588f2e6fc9b173ec90
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 29 19:53:28 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Apr 16 14:43:28 2021 +0100

    x86/pv: Improve dom0_update_physmap() with CONFIG_SPECULATIVE_HARDEN_BRANCH
    
    dom0_update_physmap() is mostly called in two tight loops, where the lfences
    hidden in is_pv_32bit_domain() have a substantial impact.
    
    None of the boot time construction needs protection against malicious
    speculation, so use a local variable and calculate is_pv_32bit_domain() just
    once.
    
    Reformat the some of the code for legibility, now that the volume has reduced,
    and removal of some gratuitous negations.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/dom0_build.c     | 52 +++++++++++++++++++---------------------
 xen/arch/x86/pv/shim.c           |  6 +++--
 xen/include/asm-x86/dom0_build.h |  2 +-
 3 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 265f56a3f8..e0801a9e6d 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -31,10 +31,10 @@
 #define L3_PROT (BASE_PROT|_PAGE_DIRTY)
 #define L4_PROT (BASE_PROT|_PAGE_DIRTY)
 
-void __init dom0_update_physmap(struct domain *d, unsigned long pfn,
+void __init dom0_update_physmap(bool compat, unsigned long pfn,
                                 unsigned long mfn, unsigned long vphysmap_s)
 {
-    if ( !is_pv_32bit_domain(d) )
+    if ( !compat )
         ((unsigned long *)vphysmap_s)[pfn] = mfn;
     else
         ((unsigned int *)vphysmap_s)[pfn] = mfn;
@@ -289,7 +289,7 @@ int __init dom0_construct_pv(struct domain *d,
                              char *cmdline)
 {
     int i, rc, order, machine;
-    bool compatible;
+    bool compatible, compat;
     struct cpu_user_regs *regs;
     unsigned long pfn, mfn;
     unsigned long nr_pages;
@@ -380,6 +380,8 @@ int __init dom0_construct_pv(struct domain *d,
     }
 #endif
 
+    compat = is_pv_32bit_domain(d);
+
     if ( elf_64bit(&elf) && machine == EM_X86_64 )
         compatible = true;
 
@@ -463,9 +465,9 @@ int __init dom0_construct_pv(struct domain *d,
         vinitrd_end    = vinitrd_start + initrd_len;
         vphysmap_start = round_pgup(vinitrd_end);
     }
-    vphysmap_end     = vphysmap_start + (nr_pages * (!is_pv_32bit_domain(d) ?
-                                                     sizeof(unsigned long) :
-                                                     sizeof(unsigned int)));
+
+    vphysmap_end = vphysmap_start +
+        (nr_pages * (compat ? sizeof(unsigned int) : sizeof(unsigned long)));
     if ( parms.p2m_base != UNSET_ADDR )
         vphysmap_end = vphysmap_start;
     vstartinfo_start = round_pgup(vphysmap_end);
@@ -496,9 +498,9 @@ int __init dom0_construct_pv(struct domain *d,
 #define NR(_l,_h,_s) \
     (((((_h) + ((1UL<<(_s))-1)) & ~((1UL<<(_s))-1)) - \
        ((_l) & ~((1UL<<(_s))-1))) >> (_s))
-        if ( (!is_pv_32bit_domain(d) + /* # L4 */
+        if ( (!compat + /* # L4 */
               NR(v_start, v_end, L4_PAGETABLE_SHIFT) + /* # L3 */
-              (!is_pv_32bit_domain(d) ?
+              (!compat ?
                NR(v_start, v_end, L3_PAGETABLE_SHIFT) : /* # L2 */
                4) + /* # compat L2 */
               NR(v_start, v_end, L2_PAGETABLE_SHIFT))  /* # L1 */
@@ -600,23 +602,22 @@ int __init dom0_construct_pv(struct domain *d,
         mpt_alloc -= PAGE_ALIGN(initrd_len);
 
     /* Overlap with Xen protected area? */
-    if ( !is_pv_32bit_domain(d) ?
-         ((v_start < HYPERVISOR_VIRT_END) &&
-          (v_end > HYPERVISOR_VIRT_START)) :
-         (v_end > HYPERVISOR_COMPAT_VIRT_START(d)) )
+    if ( compat
+         ? v_end > HYPERVISOR_COMPAT_VIRT_START(d)
+         : (v_start < HYPERVISOR_VIRT_END) && (v_end > HYPERVISOR_VIRT_START) )
     {
         printk("DOM0 image overlaps with Xen private area.\n");
         rc = -EINVAL;
         goto out;
     }
 
-    if ( is_pv_32bit_domain(d) )
+    if ( compat )
     {
         v->arch.pv.failsafe_callback_cs = FLAT_COMPAT_KERNEL_CS;
         v->arch.pv.event_callback_cs    = FLAT_COMPAT_KERNEL_CS;
     }
 
-    if ( !is_pv_32bit_domain(d) )
+    if ( !compat )
     {
         maddr_to_page(mpt_alloc)->u.inuse.type_info = PGT_l4_page_table;
         l4start = l4tab = __va(mpt_alloc); mpt_alloc += PAGE_SIZE;
@@ -677,8 +678,7 @@ int __init dom0_construct_pv(struct domain *d,
             mfn = pfn++;
         else
             mfn = initrd_mfn++;
-        *l1tab = l1e_from_pfn(mfn, (!is_pv_32bit_domain(d) ?
-                                    L1_PROT : COMPAT_L1_PROT));
+        *l1tab = l1e_from_pfn(mfn, compat ? COMPAT_L1_PROT : L1_PROT);
         l1tab++;
 
         page = mfn_to_page(_mfn(mfn));
@@ -687,7 +687,7 @@ int __init dom0_construct_pv(struct domain *d,
             BUG();
     }
 
-    if ( is_pv_32bit_domain(d) )
+    if ( compat )
     {
         l2_pgentry_t *l2t;
 
@@ -806,7 +806,7 @@ int __init dom0_construct_pv(struct domain *d,
         if ( pfn > REVERSE_START && (vinitrd_start || pfn < initrd_pfn) )
             mfn = alloc_epfn - (pfn - REVERSE_START);
 #endif
-        dom0_update_physmap(d, pfn, mfn, vphysmap_start);
+        dom0_update_physmap(compat, pfn, mfn, vphysmap_start);
         if ( !(pfn & 0xfffff) )
             process_pending_softirqs();
     }
@@ -818,12 +818,12 @@ int __init dom0_construct_pv(struct domain *d,
         BUG_ON(SHARED_M2P(get_gpfn_from_mfn(mfn)));
         if ( get_gpfn_from_mfn(mfn) >= count )
         {
-            BUG_ON(is_pv_32bit_domain(d));
+            BUG_ON(compat);
             if ( !page->u.inuse.type_info &&
                  !get_page_and_type(page, d, PGT_writable_page) )
                 BUG();
 
-            dom0_update_physmap(d, pfn, mfn, vphysmap_start);
+            dom0_update_physmap(compat, pfn, mfn, vphysmap_start);
             ++pfn;
             if ( !(pfn & 0xfffff) )
                 process_pending_softirqs();
@@ -843,7 +843,7 @@ int __init dom0_construct_pv(struct domain *d,
 #ifndef NDEBUG
 #define pfn (nr_pages - 1 - (pfn - (alloc_epfn - alloc_spfn)))
 #endif
-            dom0_update_physmap(d, pfn, mfn, vphysmap_start);
+            dom0_update_physmap(compat, pfn, mfn, vphysmap_start);
 #undef pfn
             page++; pfn++;
             if ( !(pfn & 0xfffff) )
@@ -878,7 +878,7 @@ int __init dom0_construct_pv(struct domain *d,
                           vphysmap_start, si);
 
 #ifdef CONFIG_COMPAT
-    if ( is_pv_32bit_domain(d) )
+    if ( compat )
         xlat_start_info(si, pv_shim ? XLAT_start_info_console_domU
                                     : XLAT_start_info_console_dom0);
 #endif
@@ -899,11 +899,9 @@ int __init dom0_construct_pv(struct domain *d,
      */
     regs = &v->arch.user_regs;
     regs->ds = regs->es = regs->fs = regs->gs =
-        !is_pv_32bit_domain(d) ? FLAT_KERNEL_DS : FLAT_COMPAT_KERNEL_DS;
-    regs->ss = (!is_pv_32bit_domain(d) ?
-                FLAT_KERNEL_SS : FLAT_COMPAT_KERNEL_SS);
-    regs->cs = (!is_pv_32bit_domain(d) ?
-                FLAT_KERNEL_CS : FLAT_COMPAT_KERNEL_CS);
+               (compat ? FLAT_COMPAT_KERNEL_DS : FLAT_KERNEL_DS);
+    regs->ss = (compat ? FLAT_COMPAT_KERNEL_SS : FLAT_KERNEL_SS);
+    regs->cs = (compat ? FLAT_COMPAT_KERNEL_CS : FLAT_KERNEL_CS);
     regs->rip = parms.virt_entry;
     regs->rsp = vstack_end;
     regs->rsi = vstartinfo_start;
diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index 92cb1adeed..1b86fc247e 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -204,6 +204,7 @@ void __init pv_shim_setup_dom(struct domain *d, l4_pgentry_t *l4start,
                               unsigned long console_va, unsigned long vphysmap,
                               start_info_t *si)
 {
+    bool compat = is_pv_32bit_domain(d);
     hypercall_table_t *rw_pv_hypercall_table;
     uint64_t param = 0;
     long rc;
@@ -217,7 +218,8 @@ void __init pv_shim_setup_dom(struct domain *d, l4_pgentry_t *l4start,
     {                                                                          \
         share_xen_page_with_guest(mfn_to_page(_mfn(param)), d, SHARE_rw);      \
         replace_va_mapping(d, l4start, va, _mfn(param));                       \
-        dom0_update_physmap(d, PFN_DOWN((va) - va_start), param, vphysmap);    \
+        dom0_update_physmap(compat,                                            \
+                            PFN_DOWN((va) - va_start), param, vphysmap);       \
     }                                                                          \
     else                                                                       \
     {                                                                          \
@@ -244,7 +246,7 @@ void __init pv_shim_setup_dom(struct domain *d, l4_pgentry_t *l4start,
         si->console.domU.mfn = mfn_x(console_mfn);
         share_xen_page_with_guest(mfn_to_page(console_mfn), d, SHARE_rw);
         replace_va_mapping(d, l4start, console_va, console_mfn);
-        dom0_update_physmap(d, (console_va - va_start) >> PAGE_SHIFT,
+        dom0_update_physmap(compat, (console_va - va_start) >> PAGE_SHIFT,
                             mfn_x(console_mfn), vphysmap);
         consoled_set_ring_addr(page);
     }
diff --git a/xen/include/asm-x86/dom0_build.h b/xen/include/asm-x86/dom0_build.h
index 0b797b5806..a5f8c9e67f 100644
--- a/xen/include/asm-x86/dom0_build.h
+++ b/xen/include/asm-x86/dom0_build.h
@@ -26,7 +26,7 @@ int dom0_construct_pvh(struct domain *d, const module_t *image,
 unsigned long dom0_paging_pages(const struct domain *d,
                                 unsigned long nr_pages);
 
-void dom0_update_physmap(struct domain *d, unsigned long pfn,
+void dom0_update_physmap(bool compat, unsigned long pfn,
                          unsigned long mfn, unsigned long vphysmap_s);
 
 #endif	/* _DOM0_BUILD_H_ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 16 13:55:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Apr 2021 13:55:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111768.213761 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXOwH-0003nx-DW; Fri, 16 Apr 2021 13:55:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111768.213761; Fri, 16 Apr 2021 13:55:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXOwH-0003nl-AM; Fri, 16 Apr 2021 13:55:17 +0000
Received: by outflank-mailman (input) for mailman id 111768;
 Fri, 16 Apr 2021 13:55:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXOwG-0003nd-80
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 13:55:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXOwG-0007Uy-72
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 13:55:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXOwG-0004xp-5A
 for xen-changelog@lists.xenproject.org; Fri, 16 Apr 2021 13:55:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WoBnYjNMHgNBgSQ4jruztBBmVF+d1mi/CoDuy6dEQrM=; b=LyMqchEGycFq39upEwh/VR39zK
	zbvsovYenifBgL0BCkpgfYTlcfB9Bn9zt0/Vp0BOCGZW5iC6fsscGTBOJ8RcChcxHW7Uavpl11Oqx
	sk8TWY3wzBwwdTw7rN+bLVXYxxhnbmKGlJizoRneU2xdyPmnbFwIKV+9QN2/tFinTMxE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pv: Rename hypercall_table_t to pv_hypercall_table_t
Message-Id: <E1lXOwG-0004xp-5A@xenbits.xenproject.org>
Date: Fri, 16 Apr 2021 13:55:16 +0000

commit dd22a64de7e02b48312839a15179528c8f7db5c6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 15 13:27:45 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Apr 16 14:52:06 2021 +0100

    x86/pv: Rename hypercall_table_t to pv_hypercall_table_t
    
    The type is no longer appropriate for anything other than PV, and therefore
    should not retain its generic name.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/hypercall.c     | 2 +-
 xen/arch/x86/pv/shim.c          | 2 +-
 xen/include/asm-x86/hypercall.h | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c
index 5d02eebc8d..e30c59b628 100644
--- a/xen/arch/x86/pv/hypercall.c
+++ b/xen/arch/x86/pv/hypercall.c
@@ -40,7 +40,7 @@
 
 #define do_arch_1             paging_domctl_continuation
 
-const hypercall_table_t pv_hypercall_table[] = {
+const pv_hypercall_table_t pv_hypercall_table[] = {
     COMPAT_CALL(set_trap_table),
     HYPERCALL(mmu_update),
     COMPAT_CALL(set_gdt),
diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index 1b86fc247e..d16c0048c0 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -205,7 +205,7 @@ void __init pv_shim_setup_dom(struct domain *d, l4_pgentry_t *l4start,
                               start_info_t *si)
 {
     bool compat = is_pv_32bit_domain(d);
-    hypercall_table_t *rw_pv_hypercall_table;
+    pv_hypercall_table_t *rw_pv_hypercall_table;
     uint64_t param = 0;
     long rc;
 
diff --git a/xen/include/asm-x86/hypercall.h b/xen/include/asm-x86/hypercall.h
index 39e7ab7022..0ae3b8b043 100644
--- a/xen/include/asm-x86/hypercall.h
+++ b/xen/include/asm-x86/hypercall.h
@@ -20,7 +20,7 @@ typedef struct {
 #ifdef CONFIG_PV32
     hypercall_fn_t *compat;
 #endif
-} hypercall_table_t;
+} pv_hypercall_table_t;
 
 typedef struct {
     uint8_t native;
@@ -32,7 +32,7 @@ typedef struct {
 extern const hypercall_args_t hypercall_args_table[NR_hypercalls];
 
 #ifdef CONFIG_PV
-extern const hypercall_table_t pv_hypercall_table[];
+extern const pv_hypercall_table_t pv_hypercall_table[];
 void pv_hypercall(struct cpu_user_regs *regs);
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Apr 17 01:33:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Apr 2021 01:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111987.214132 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXZpY-0001wK-Pr; Sat, 17 Apr 2021 01:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111987.214132; Sat, 17 Apr 2021 01:33:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXZpY-0001w4-Kg; Sat, 17 Apr 2021 01:33:04 +0000
Received: by outflank-mailman (input) for mailman id 111987;
 Sat, 17 Apr 2021 01: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 1lXZpW-0001vv-OG
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZpW-00004r-NO
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZpW-0000kf-M9
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4W+yaj2Thevdm6zz5AAHi1HpMfkhq7IKFTzzD5W5D+A=; b=rruSq3i7ncm3MK6GqZKFDklqyn
	U7EQ7K4kxRAXaXI/LWvGwQEpqKF3Yvskr69ErPTDMBJV+bWVppL4jyw6b9O7buN8X8Ai3EhelRikG
	c38r/GcFR+DPpb8pum2Lh9/bEZg4QPmIK5ZHSeW3mdOqRyePKlvqcqExty5oP9kT7nFA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Move dom0 creation in domain_build.c
Message-Id: <E1lXZpW-0000kf-M9@xenbits.xenproject.org>
Date: Sat, 17 Apr 2021 01:33:02 +0000

commit 7af57aefe38571cb3f5a6f06e87ebc2b6ed30293
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Apr 14 10:14:01 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 15 18:06:02 2021 +0100

    xen/arm: Move dom0 creation in domain_build.c
    
    Move dom0 create and start from setup.c to a dedicated
    function in domain_build.c.
    
    With this change, the function construct_dom0() is not
    used outside of domain_build.c anymore.
    So it is now a static function.
    
    No functional changes intended.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/domain_build.c | 38 +++++++++++++++++++++++++++++++++++++-
 xen/arch/arm/setup.c        | 29 +----------------------------
 xen/include/asm-arm/setup.h |  2 +-
 3 files changed, 39 insertions(+), 30 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 374bf655ee..359957dc1b 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -21,6 +21,7 @@
 #include <asm/device.h>
 #include <asm/kernel.h>
 #include <asm/setup.h>
+#include <asm/tee/tee.h>
 #include <asm/platform.h>
 #include <asm/psci.h>
 #include <asm/setup.h>
@@ -2520,7 +2521,7 @@ void __init create_domUs(void)
     }
 }
 
-int __init construct_dom0(struct domain *d)
+static int __init construct_dom0(struct domain *d)
 {
     struct kernel_info kinfo = {};
     int rc;
@@ -2578,6 +2579,41 @@ int __init construct_dom0(struct domain *d)
     return construct_domain(d, &kinfo);
 }
 
+struct domain* __init create_dom0(void)
+{
+    struct domain *dom0;
+    struct xen_domctl_createdomain dom0_cfg = {
+        .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap,
+        .max_evtchn_port = -1,
+        .max_grant_frames = gnttab_dom0_frames(),
+        .max_maptrack_frames = -1,
+    };
+
+    /* The vGIC for DOM0 is exactly emulating the hardware GIC */
+    dom0_cfg.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
+    /*
+     * Xen vGIC supports a maximum of 992 interrupt lines.
+     * 32 are substracted to cover local IRQs.
+     */
+    dom0_cfg.arch.nr_spis = min(gic_number_lines(), (unsigned int) 992) - 32;
+    if ( gic_number_lines() > 992 )
+        printk(XENLOG_WARNING "Maximum number of vGIC IRQs exceeded.\n");
+    dom0_cfg.arch.tee_type = tee_get_type();
+    dom0_cfg.max_vcpus = dom0_max_vcpus();
+
+    if ( iommu_enabled )
+        dom0_cfg.flags |= XEN_DOMCTL_CDF_iommu;
+
+    dom0 = domain_create(0, &dom0_cfg, true);
+    if ( IS_ERR(dom0) || (alloc_dom0_vcpu0(dom0) == NULL) )
+        panic("Error creating domain 0\n");
+
+    if ( construct_dom0(dom0) != 0)
+        panic("Could not set up DOM0 guest OS\n");
+
+    return dom0;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 9ba2f267f6..70a719cbaf 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -51,7 +51,6 @@
 #include <asm/platform.h>
 #include <asm/procinfo.h>
 #include <asm/setup.h>
-#include <asm/tee/tee.h>
 #include <xsm/xsm.h>
 #include <asm/acpi.h>
 
@@ -806,12 +805,6 @@ void __init start_xen(unsigned long boot_phys_offset,
     const char *cmdline;
     struct bootmodule *xen_bootmodule;
     struct domain *dom0;
-    struct xen_domctl_createdomain dom0_cfg = {
-        .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap,
-        .max_evtchn_port = -1,
-        .max_grant_frames = gnttab_dom0_frames(),
-        .max_maptrack_frames = -1,
-    };
     int rc;
 
     dcache_line_bytes = read_dcache_line_bytes();
@@ -966,27 +959,7 @@ void __init start_xen(unsigned long boot_phys_offset,
     enable_errata_workarounds();
 
     /* Create initial domain 0. */
-    /* The vGIC for DOM0 is exactly emulating the hardware GIC */
-    dom0_cfg.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
-    /*
-     * Xen vGIC supports a maximum of 992 interrupt lines.
-     * 32 are substracted to cover local IRQs.
-     */
-    dom0_cfg.arch.nr_spis = min(gic_number_lines(), (unsigned int) 992) - 32;
-    if ( gic_number_lines() > 992 )
-        printk(XENLOG_WARNING "Maximum number of vGIC IRQs exceeded.\n");
-    dom0_cfg.arch.tee_type = tee_get_type();
-    dom0_cfg.max_vcpus = dom0_max_vcpus();
-
-    if ( iommu_enabled )
-        dom0_cfg.flags |= XEN_DOMCTL_CDF_iommu;
-
-    dom0 = domain_create(0, &dom0_cfg, true);
-    if ( IS_ERR(dom0) || (alloc_dom0_vcpu0(dom0) == NULL) )
-        panic("Error creating domain 0\n");
-
-    if ( construct_dom0(dom0) != 0)
-        panic("Could not set up DOM0 guest OS\n");
+    dom0 = create_dom0();
 
     heap_init_late();
 
diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h
index 28bf622aa1..5283244015 100644
--- a/xen/include/asm-arm/setup.h
+++ b/xen/include/asm-arm/setup.h
@@ -93,8 +93,8 @@ void acpi_create_efi_mmap_table(struct domain *d,
 
 int acpi_make_efi_nodes(void *fdt, struct membank tbl_add[]);
 
-int construct_dom0(struct domain *d);
 void create_domUs(void);
+struct domain* create_dom0(void);
 
 void discard_initial_modules(void);
 void fw_unreserved_regions(paddr_t s, paddr_t e,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 17 01:33:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Apr 2021 01:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111988.214135 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXZpi-0001xY-Rt; Sat, 17 Apr 2021 01:33:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111988.214135; Sat, 17 Apr 2021 01:33:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXZpi-0001xO-Nu; Sat, 17 Apr 2021 01:33:14 +0000
Received: by outflank-mailman (input) for mailman id 111988;
 Sat, 17 Apr 2021 01:33:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZph-0001xB-39
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:33:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZph-00004v-2J
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:33:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZph-0000lw-0Q
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:33:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; 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+uBsGLq6tuctHAn9BQnP7hPA+JUkZCeuDVHKHNc5CA=; b=3EwaE9bJy0WQDjbwjsdTK1FER7
	Q3bNMOXLjYZT3dcaM0wulriw+8RW57fG0q3goTA6Mf4m2xkA3JlQ5Foq8xLo6gnWABPoh+qUqhyRh
	PH3OXfAC7RXGHM5ykbOGewrOt1lJ7SE6tJrVSsJzi/2diBcDFL0iDjOzVAcbDnyBb1xU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: xen/arm: Reinforce use of is_hardware_domain
Message-Id: <E1lXZph-0000lw-0Q@xenbits.xenproject.org>
Date: Sat, 17 Apr 2021 01:33:13 +0000

commit 784d70d68342d20074d88ee8d8bab41b9210505f
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Apr 14 10:14:02 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 15 18:06:21 2021 +0100

    xen/arm: xen/arm: Reinforce use of is_hardware_domain
    
    There are a few places on Arm where we use pretty much an open-coded
    version of is_hardware_domain(). The main difference, is the helper
    will also block speculation (not yet implemented on Arm).
    
    The existing users are not in hot path, so blocking speculation
    would not hurt when it is implemented. So remove the open-coded
    version within the arm codebase.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    [julieng: Rework the commit message]
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/irq.c                       | 2 +-
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 2 +-
 xen/drivers/passthrough/arm/smmu-v3.c    | 2 +-
 xen/drivers/passthrough/arm/smmu.c       | 2 +-
 xen/include/asm-arm/domain.h             | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index b71b099e6f..b761d90c40 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -412,7 +412,7 @@ bool is_assignable_irq(unsigned int irq)
  */
 bool irq_type_set_by_domain(const struct domain *d)
 {
-    return (d == hardware_domain);
+    return is_hardware_domain(d);
 }
 
 /*
diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
index aef358d880..8b8e3a00ba 100644
--- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
+++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
@@ -1168,7 +1168,7 @@ static int ipmmu_reassign_device(struct domain *s, struct domain *t,
     int ret = 0;
 
     /* Don't allow remapping on other domain than hwdom */
-    if ( t && t != hardware_domain )
+    if ( t && !is_hardware_domain(t) )
         return -EPERM;
 
     if ( t == s )
diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c
index 53d150cdb6..d115df7320 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.c
+++ b/xen/drivers/passthrough/arm/smmu-v3.c
@@ -3366,7 +3366,7 @@ static int arm_smmu_reassign_dev(struct domain *s, struct domain *t,
 	int ret = 0;
 
 	/* Don't allow remapping on other domain than hwdom */
-	if (t && t != hardware_domain)
+	if ( t && !is_hardware_domain(t) )
 		return -EPERM;
 
 	if (t == s)
diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index fab7be8b48..24ac4f3a80 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -2771,7 +2771,7 @@ static int arm_smmu_reassign_dev(struct domain *s, struct domain *t,
 	int ret = 0;
 
 	/* Don't allow remapping on other domain than hwdom */
-	if (t && t != hardware_domain)
+	if ( t && !is_hardware_domain(t) )
 		return -EPERM;
 
 	if (t == s)
diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index 1da90f207d..0a74df9931 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -30,7 +30,7 @@ enum domain_type {
 #endif
 
 /* The hardware domain has always its memory direct mapped. */
-#define is_domain_direct_mapped(d) ((d) == hardware_domain)
+#define is_domain_direct_mapped(d) is_hardware_domain(d)
 
 struct vtimer {
     struct vcpu *v;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 17 01:33:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Apr 2021 01:33:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111989.214140 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXZps-0001yq-Tn; Sat, 17 Apr 2021 01:33:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111989.214140; Sat, 17 Apr 2021 01:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXZps-0001yj-Pd; Sat, 17 Apr 2021 01:33:24 +0000
Received: by outflank-mailman (input) for mailman id 111989;
 Sat, 17 Apr 2021 01:33:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZpr-0001yP-Da
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:33:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZpr-00005F-Bm
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:33:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZpr-0000oZ-9R
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:33:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cVXa0xlpOf9a1oh+Tqr19n/aOkve8yscWxiTP2wRwtc=; b=vVj+lk2EWzpak7+L/V1VjmA3vz
	Vmm6GoArzXgJ04SMXACWKBJ8IDaXgmuQOY2+xqZBw4s6RcTLNFD8X9M52SUgxIRbwsQGbk8p2IxNr
	07qj1fqR3LZzD2wKUDUTARmUIrmNnU9cvEAV00//QPT8uvfhHBGNdUdsE3SGyWYYKvQY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Clarify how the domid is decided in create_domUs()
Message-Id: <E1lXZpr-0000oZ-9R@xenbits.xenproject.org>
Date: Sat, 17 Apr 2021 01:33:23 +0000

commit b3d1f523c8de3a6657b11456a56bd8f5e67e247b
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Apr 14 10:14:03 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 15 18:08:29 2021 +0100

    xen/arm: Clarify how the domid is decided in create_domUs()
    
    This patch adds a comment in create_domUs() right before
    domain_create() to explain the importance of the pre-increment
    operator on the variable max_init_domid, to ensure that the
    domid 0 is allocated only during start_xen() function by the
    create_dom0() and not on any other possible code path to the
    domain_create() function.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain_build.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 359957dc1b..b1d7b9849f 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2508,6 +2508,11 @@ void __init create_domUs(void)
                                          GUEST_VPL011_SPI - 32 + 1);
         }
 
+        /*
+         * The variable max_init_domid is initialized with zero, so here it's
+         * very important to use the pre-increment operator to call
+         * domain_create() with a domid > 0. (domid == 0 is reserved for Dom0)
+         */
         d = domain_create(++max_init_domid, &d_cfg, false);
         if ( IS_ERR(d) )
             panic("Error creating domain %s\n", dt_node_name(node));
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 17 01:33:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Apr 2021 01:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111990.214142 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXZq2-00020C-Um; Sat, 17 Apr 2021 01:33:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111990.214142; Sat, 17 Apr 2021 01:33:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXZq2-000205-R3; Sat, 17 Apr 2021 01:33:34 +0000
Received: by outflank-mailman (input) for mailman id 111990;
 Sat, 17 Apr 2021 01:33:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZq1-0001zu-HB
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:33:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZq1-00005Q-GO
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:33:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZq1-0000pc-FM
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:33:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=x9FgiKNhGLMOg3LA+JhZZpJgub2GKmJQUkDYV1DV9DY=; b=Qf7/eHH/JIAeFmtRspB/zIA/7x
	3OYesyIkjE67YvQrxEullK4PoSW0RhJptcfQA57XDSaXP8Jk7rvAKCmwftS32J82G02SCsNg5/cU2
	S2HJQtkFsjIivHh1yxnP2Tk/rw4TYhOPHCvLe+v3Ro750I/Lmfg+/W2meGt0NwkfGk6g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Prevent Dom0 to be loaded when using dom0less
Message-Id: <E1lXZq1-0000pc-FM@xenbits.xenproject.org>
Date: Sat, 17 Apr 2021 01:33:33 +0000

commit fcb97d1f19ab294df091249399e515117350c228
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Wed Apr 14 10:14:04 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Apr 15 18:08:57 2021 +0100

    xen/arm: Prevent Dom0 to be loaded when using dom0less
    
    This patch prevents the dom0 to be loaded skipping its
    building and going forward to build domUs when the dom0
    kernel is not found and at least one domU is present.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/features/dom0less.pandoc |  7 ++++---
 xen/arch/arm/setup.c          | 42 +++++++++++++++++++++++++++++++++++++++---
 2 files changed, 43 insertions(+), 6 deletions(-)

diff --git a/docs/features/dom0less.pandoc b/docs/features/dom0less.pandoc
index d798596cdf..c9edb529e1 100644
--- a/docs/features/dom0less.pandoc
+++ b/docs/features/dom0less.pandoc
@@ -16,9 +16,10 @@ Multiboot specification has been extended to allow for multiple domains
 to be passed to Xen. See docs/misc/arm/device-tree/booting.txt for more
 information about the Multiboot specification and how to use it.
 
-Currently, a control domain ("dom0") is still required, but in the
-future it will become unnecessary when all domains are created
-directly from Xen. Instead of waiting for the control domain to be fully
+Currently, a control domain ("dom0") is still required to manage the DomU
+domains, but the system can start also without dom0 if the Device Tree
+doesn't specify the dom0 kernel and it declares one or more domUs.
+Instead of waiting for the control domain (when declared) to be fully
 booted and the Xen tools to become available, domains created by Xen
 this way are started right away in parallel. Hence, their boot time is
 typically much shorter.
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 70a719cbaf..00aad1c194 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -794,6 +794,38 @@ static void __init setup_mm(void)
 }
 #endif
 
+static bool __init is_dom0less_mode(void)
+{
+    struct bootmodules *mods = &bootinfo.modules;
+    struct bootmodule *mod;
+    unsigned int i;
+    bool dom0found = false;
+    bool domUfound = false;
+
+    /* Look into the bootmodules */
+    for ( i = 0 ; i < mods->nr_mods ; i++ )
+    {
+        mod = &mods->module[i];
+        /* Find if dom0 and domU kernels are present */
+        if ( mod->kind == BOOTMOD_KERNEL )
+        {
+            if ( mod->domU == false )
+            {
+                dom0found = true;
+                break;
+            }
+            else
+                domUfound = true;
+        }
+    }
+
+    /*
+     * If there is no dom0 kernel but at least one domU, then we are in
+     * dom0less mode
+     */
+    return ( !dom0found && domUfound );
+}
+
 size_t __read_mostly dcache_line_bytes;
 
 /* C entry point for boot CPU */
@@ -804,7 +836,7 @@ void __init start_xen(unsigned long boot_phys_offset,
     int cpus, i;
     const char *cmdline;
     struct bootmodule *xen_bootmodule;
-    struct domain *dom0;
+    struct domain *dom0 = NULL;
     int rc;
 
     dcache_line_bytes = read_dcache_line_bytes();
@@ -959,7 +991,10 @@ void __init start_xen(unsigned long boot_phys_offset,
     enable_errata_workarounds();
 
     /* Create initial domain 0. */
-    dom0 = create_dom0();
+    if ( !is_dom0less_mode() )
+        dom0 = create_dom0();
+    else
+        printk(XENLOG_INFO "Xen dom0less mode detected\n");
 
     heap_init_late();
 
@@ -977,7 +1012,8 @@ void __init start_xen(unsigned long boot_phys_offset,
     if ( acpi_disabled )
         create_domUs();
 
-    domain_unpause_by_systemcontroller(dom0);
+    if ( dom0 )
+        domain_unpause_by_systemcontroller(dom0);
 
     /* Switch on to the dynamically allocated stack for the idle vcpu
      * since the static one we're running on is about to be freed. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 17 01:33:45 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Apr 2021 01:33:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111991.214146 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXZqD-00021f-0R; Sat, 17 Apr 2021 01:33:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111991.214146; Sat, 17 Apr 2021 01:33:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXZqC-00021Y-St; Sat, 17 Apr 2021 01:33:44 +0000
Received: by outflank-mailman (input) for mailman id 111991;
 Sat, 17 Apr 2021 01:33:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZqB-00021P-LY
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:33:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZqB-00005Z-Ko
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:33:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZqB-0000qj-Jd
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:33:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ba7Di05y99M9mSRD/aBinYd+fqctVZINPiVscCoRmF8=; b=58FGUrRFeAr5UAJLkD8hGi8tP6
	m/+Xr0uQUWF9iF67oXXB0UD5W80u7U3v+G2u/0WGvmCKNZfYXuRGd8ACep5x4LINvNLnnMgujKU9w
	O4yfCAHlOuM0OboSbR9tftMSvf2uoxUIv6QLOTWGDZOSj3P8diNMvSDgW87F8CNrqAnA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Revert "x86/HPET: don't enable legacy replacement mode unconditionally"
Message-Id: <E1lXZqB-0000qj-Jd@xenbits.xenproject.org>
Date: Sat, 17 Apr 2021 01:33:43 +0000

commit 2b05d427a09e108589dc57f54b517d0ffdf973ef
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 15 16:19:01 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 15 18:25:40 2021 +0100

    Revert "x86/HPET: don't enable legacy replacement mode unconditionally"
    
    This reverts commit e680cc48b7184d3489873d6776f84ba1fc238ced.
    
    It was committed despite multiple objections.  The agreed upon fix is a
    different variation of the same original patch, and the delta between the two
    is far from clear.
    
    By reverting this commit first, the fixes are clear and coherent as individual
    patches, and in the appropriate form for backport to the older trees.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/misc/xen-command-line.pandoc | 17 -----------------
 xen/arch/x86/hpet.c               | 37 ++++++-------------------------------
 2 files changed, 6 insertions(+), 48 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index deef6d0b4c..a0601ff838 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1274,26 +1274,9 @@ supported. See docs/misc/arm/big.LITTLE.txt for more information.
 When the hmp-unsafe option is disabled (default), CPUs that are not
 identical to the boot CPU will be parked and not used by Xen.
 
-### hpet (x86)
-> `= List of [ <boolean> | broadcast | legacy-replacement ]`
-
-> Default : `true`, `no-broadcast`, 'no-legacy-replacement`
-
-Controls Xen's use of the system's High Precision Event Timer.  The boolean
-allows to turn off use altogether.
-
-`broadcast` forces Xen to keep using the broadcast for CPUs in deep C-states
-even when an RTC interrupt got enabled.
-
-`legacy-replacement` is intended to be used on platforms where the timer
-interrupt doesn't get raised by the legacy PIT.  This then also affects
-raising of the RTC interrupt.
-
 ### hpetbroadcast (x86)
 > `= <boolean>`
 
-Deprecated alternative of `hpet=broadcast`.
-
 ### hvm_debug (x86)
 > `= <integer>`
 
diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 76d9ef2c02..1ff005fb4a 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -52,8 +52,6 @@ static unsigned int __read_mostly num_hpets_used;
 DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel);
 
 unsigned long __initdata hpet_address;
-static bool __initdata opt_hpet = true;
-static bool __initdata opt_legacy_replacement;
 u8 __initdata hpet_blockid;
 u8 __initdata hpet_flags;
 
@@ -65,32 +63,6 @@ u8 __initdata hpet_flags;
 static bool __initdata force_hpet_broadcast;
 boolean_param("hpetbroadcast", force_hpet_broadcast);
 
-static int __init parse_hpet_param(const char *s)
-{
-    const char *ss;
-    int val, rc = 0;
-
-    do {
-        ss = strchr(s, ',');
-        if ( !ss )
-            ss = strchr(s, '\0');
-
-        if ( (val = parse_bool(s, ss)) >= 0 )
-            opt_hpet = val;
-        else if ( (val = parse_boolean("broadcast", s, ss)) >= 0 )
-            force_hpet_broadcast = val;
-        else if ( (val = parse_boolean("legacy-replacement", s, ss)) >= 0 )
-            opt_legacy_replacement = val;
-        else
-            rc = -EINVAL;
-
-        s = ss + 1;
-    } while ( *ss );
-
-    return rc;
-}
-custom_param("hpet", parse_hpet_param);
-
 /*
  * Calculate a multiplication factor for scaled math, which is used to convert
  * nanoseconds based values to clock ticks:
@@ -789,9 +761,12 @@ u64 __init hpet_setup(void)
     unsigned int hpet_id, hpet_period, hpet_cfg;
     unsigned int last, rem;
 
-    if ( hpet_rate || !hpet_address || !opt_hpet )
+    if ( hpet_rate )
         return hpet_rate;
 
+    if ( hpet_address == 0 )
+        return 0;
+
     set_fixmap_nocache(FIX_HPET_BASE, hpet_address);
 
     hpet_id = hpet_read32(HPET_ID);
@@ -828,9 +803,9 @@ u64 __init hpet_setup(void)
      * IRQ routing is configured.
      *
      * Reconfigure the HPET into legacy mode to re-establish the timer
-     * interrupt, if available and if so requested.
+     * interrupt.
      */
-    if ( opt_legacy_replacement && (hpet_id & HPET_ID_LEGSUP) &&
+    if ( hpet_id & HPET_ID_LEGSUP &&
          !((hpet_cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
     {
         unsigned int c0_cfg, ticks, count;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 17 01:33:56 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Apr 2021 01:33:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111992.214150 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXZqO-00024Q-3K; Sat, 17 Apr 2021 01:33:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111992.214150; Sat, 17 Apr 2021 01:33:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXZqN-00024B-Ue; Sat, 17 Apr 2021 01:33:55 +0000
Received: by outflank-mailman (input) for mailman id 111992;
 Sat, 17 Apr 2021 01:33:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZqL-00022b-Q2
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:33:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZqL-00005g-PM
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:33:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZqL-0000rS-Na
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:33:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gLLb2Ntx/u/1ai5qjGgdmQxsYWNQI18RRBRQTgd6ujo=; b=nDdkpOzFY7w3qg+UsUH0j6Frfv
	qUcHL4XTFbaCF1Ne/13A5MFdLH7aG+vGg/VKGw8B8lYEdFKJWILU8KBeRQLcXEOw2ITHTjyZLHUTJ
	nWVttpaAqX7+XQfZbmM6p9rQyBCXMtQgjFiTf6pEMDm/JdUA10cY3LK3zEi3FQY4sUR0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hpet: Factor hpet_enable_legacy_replacement_mode() out of hpet_setup()
Message-Id: <E1lXZqL-0000rS-Na@xenbits.xenproject.org>
Date: Sat, 17 Apr 2021 01:33:53 +0000

commit 238168b5bcd27fec97704f6295fa5bf7a442eb6f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Mar 24 14:33:04 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 15 18:25:40 2021 +0100

    x86/hpet: Factor hpet_enable_legacy_replacement_mode() out of hpet_setup()
    
    ... in preparation to introduce a second caller.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Frédéric Pierret <frederic.pierret@qubes-os.org>
---
 xen/arch/x86/hpet.c        | 116 ++++++++++++++++++++++++---------------------
 xen/include/asm-x86/hpet.h |   6 +++
 2 files changed, 68 insertions(+), 54 deletions(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 1ff005fb4a..c1d04f184f 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -754,11 +754,70 @@ int hpet_legacy_irq_tick(void)
 }
 
 static u32 *hpet_boot_cfg;
+static uint64_t __initdata hpet_rate;
+
+bool __init hpet_enable_legacy_replacement_mode(void)
+{
+    unsigned int cfg, c0_cfg, ticks, count;
+
+    if ( !hpet_rate ||
+         !(hpet_read32(HPET_ID) & HPET_ID_LEGSUP) ||
+         ((cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
+        return false;
+
+    /* Stop the main counter. */
+    hpet_write32(cfg & ~HPET_CFG_ENABLE, HPET_CFG);
+
+    /* Reconfigure channel 0 to be 32bit periodic. */
+    c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+    c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
+               HPET_TN_32BIT);
+    hpet_write32(c0_cfg, HPET_Tn_CFG(0));
+
+    /*
+     * The exact period doesn't have to match a legacy PIT.  All we need
+     * is an interrupt queued up via the IO-APIC to check routing.
+     *
+     * Use HZ as the frequency.
+     */
+    ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
+
+    count = hpet_read32(HPET_COUNTER);
+
+    /*
+     * HPET_TN_SETVAL above is atrociously documented in the spec.
+     *
+     * Periodic HPET channels have a main comparator register, and
+     * separate "accumulator" register.  Despite being named accumulator
+     * in the spec, this is not an accurate description of its behaviour
+     * or purpose.
+     *
+     * Each time an interrupt is generated, the "accumulator" register is
+     * re-added to the comparator set up the new period.
+     *
+     * Normally, writes to the CMP register update both registers.
+     * However, under these semantics, it is impossible to set up a
+     * periodic timer correctly without the main HPET counter being at 0.
+     *
+     * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
+     * use for periodic timers to mean that the second write to CMP
+     * updates the accumulator only, and not the absolute comparator
+     * value.
+     *
+     * This lets us set a period when the main counter isn't at 0.
+     */
+    hpet_write32(count + ticks, HPET_Tn_CMP(0));
+    hpet_write32(ticks,         HPET_Tn_CMP(0));
+
+    /* Restart the main counter, and legacy mode. */
+    hpet_write32(cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
+
+    return true;
+}
 
 u64 __init hpet_setup(void)
 {
-    static u64 __initdata hpet_rate;
-    unsigned int hpet_id, hpet_period, hpet_cfg;
+    unsigned int hpet_id, hpet_period;
     unsigned int last, rem;
 
     if ( hpet_rate )
@@ -805,58 +864,7 @@ u64 __init hpet_setup(void)
      * Reconfigure the HPET into legacy mode to re-establish the timer
      * interrupt.
      */
-    if ( hpet_id & HPET_ID_LEGSUP &&
-         !((hpet_cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
-    {
-        unsigned int c0_cfg, ticks, count;
-
-        /* Stop the main counter. */
-        hpet_write32(hpet_cfg & ~HPET_CFG_ENABLE, HPET_CFG);
-
-        /* Reconfigure channel 0 to be 32bit periodic. */
-        c0_cfg = hpet_read32(HPET_Tn_CFG(0));
-        c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
-                   HPET_TN_32BIT);
-        hpet_write32(c0_cfg, HPET_Tn_CFG(0));
-
-        /*
-         * The exact period doesn't have to match a legacy PIT.  All we need
-         * is an interrupt queued up via the IO-APIC to check routing.
-         *
-         * Use HZ as the frequency.
-         */
-        ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
-
-        count = hpet_read32(HPET_COUNTER);
-
-        /*
-         * HPET_TN_SETVAL above is atrociously documented in the spec.
-         *
-         * Periodic HPET channels have a main comparator register, and
-         * separate "accumulator" register.  Despite being named accumulator
-         * in the spec, this is not an accurate description of its behaviour
-         * or purpose.
-         *
-         * Each time an interrupt is generated, the "accumulator" register is
-         * re-added to the comparator set up the new period.
-         *
-         * Normally, writes to the CMP register update both registers.
-         * However, under these semantics, it is impossible to set up a
-         * periodic timer correctly without the main HPET counter being at 0.
-         *
-         * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
-         * use for periodic timers to mean that the second write to CMP
-         * updates the accumulator only, and not the absolute comparator
-         * value.
-         *
-         * This lets us set a period when the main counter isn't at 0.
-         */
-        hpet_write32(count + ticks, HPET_Tn_CMP(0));
-        hpet_write32(ticks,         HPET_Tn_CMP(0));
-
-        /* Restart the main counter, and legacy mode. */
-        hpet_write32(hpet_cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
-    }
+    hpet_enable_legacy_replacement_mode();
 
     return hpet_rate;
 }
diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h
index fb6bf05065..50176de3d2 100644
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -72,6 +72,12 @@ void hpet_disable(void);
  */
 int hpet_legacy_irq_tick(void);
 
+/*
+ * Try to enable HPET Legacy Replacement mode.  Returns a boolean indicating
+ * whether the HPET configuration was changed.
+ */
+bool hpet_enable_legacy_replacement_mode(void);
+
 /*
  * Temporarily use an HPET event counter for timer interrupt handling,
  * rather than using the LAPIC timer. Used for Cx state entry.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 17 01:34:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Apr 2021 01:34:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.111993.214153 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXZqX-000265-5l; Sat, 17 Apr 2021 01:34:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 111993.214153; Sat, 17 Apr 2021 01:34:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXZqX-00025x-23; Sat, 17 Apr 2021 01:34:05 +0000
Received: by outflank-mailman (input) for mailman id 111993;
 Sat, 17 Apr 2021 01:34: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 1lXZqV-00025q-Un
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:34:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZqV-00006R-Tv
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:34:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXZqV-0000sV-Sn
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 01:34:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xXqm2HHbFVnZgc3I8yy+flCv7P9jDBqPgvW0RG3NUIs=; b=Mf9K2SL6ewxhpn5GHeDTz/Nry1
	QFslbdAGz81FbXjlFMOa908QMMQwb1ECAukC114BdiuAO8yksCVVVP8jOwUlscYuHxCFg08rf6fCi
	5MQk0m4LWxrvo38f+RkGdSXrIEcyg9SrUv31UczUGQfmmA8kwKtHNJllIZBsmLdRf49s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hpet: Don't enable legacy replacement mode unconditionally
Message-Id: <E1lXZqV-0000sV-Sn@xenbits.xenproject.org>
Date: Sat, 17 Apr 2021 01:34:03 +0000

commit b53173e7cdafb7a318a239d557478fd73734a86a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Mar 24 11:34:32 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 15 18:25:40 2021 +0100

    x86/hpet: Don't enable legacy replacement mode unconditionally
    
    Commit e1de4c196a2e ("x86/timer: Fix boot on Intel systems using ITSSPRC
    static PIT clock gating") was reported to cause boot failures on certain
    AMD Ryzen systems.
    
    Refine the fix to do nothing in the default case, and only attempt to
    configure legacy replacement mode if IRQ0 is found to not be working.  If
    legacy replacement mode doesn't help, undo it before falling back to other IRQ
    routing configurations.
    
    In addition, introduce a "hpet" command line option so this heuristic
    can be overridden.  Since it makes little sense to introduce just
    "hpet=legacy-replacement", also allow for a boolean argument as well as
    "broadcast" to replace the separate "hpetbroadcast" option.
    
    Reported-by: Frédéric Pierret frederic.pierret@qubes-os.org
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Frédéric Pierret <frederic.pierret@qubes-os.org>
---
 docs/misc/xen-command-line.pandoc | 33 +++++++++++++++++
 xen/arch/x86/hpet.c               | 75 +++++++++++++++++++++++++++++----------
 xen/arch/x86/io_apic.c            | 31 ++++++++++++++++
 xen/include/asm-x86/hpet.h        |  7 ++++
 4 files changed, 128 insertions(+), 18 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index a0601ff838..a4bd3f12c5 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1274,9 +1274,42 @@ supported. See docs/misc/arm/big.LITTLE.txt for more information.
 When the hmp-unsafe option is disabled (default), CPUs that are not
 identical to the boot CPU will be parked and not used by Xen.
 
+### hpet
+    = List of [ <bool> | broadcast=<bool> | legacy-replacement=<bool> ]
+
+    Applicability: x86
+
+Controls Xen's use of the system's High Precision Event Timer.  By default,
+Xen will use an HPET when available and not subject to errata.  Use of the
+HPET can be disabled by specifying `hpet=0`.
+
+ * The `broadcast` boolean is disabled by default, but forces Xen to keep
+   using the broadcast for CPUs in deep C-states even when an RTC interrupt is
+   enabled.  This then also affects raising of the RTC interrupt.
+
+ * The `legacy-replacement` boolean allows for control over whether Legacy
+   Replacement mode is enabled.
+
+   Legacy Replacement mode is intended for hardware which does not have an
+   8254 PIT, and allows the HPET to be configured into a compatible mode.
+   Intel chipsets from Skylake/ApolloLake onwards can turn the PIT off for
+   power saving reasons, and there is no platform-agnostic mechanism for
+   discovering this.
+
+   By default, Xen will not change hardware configuration, unless the PIT
+   appears to be absent, at which point Xen will try to enable Legacy
+   Replacement mode before falling back to pre-IO-APIC interrupt routing
+   options.
+
+   This behaviour can be inhibited by specifying `legacy-replacement=0`.
+   Alternatively, this mode can be enabled unconditionally (if available) by
+   specifying `legacy-replacement=1`.
+
 ### hpetbroadcast (x86)
 > `= <boolean>`
 
+Deprecated alternative of `hpet=broadcast`.
+
 ### hvm_debug (x86)
 > `= <integer>`
 
diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index c1d04f184f..afe104dc93 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -52,6 +52,8 @@ static unsigned int __read_mostly num_hpets_used;
 DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel);
 
 unsigned long __initdata hpet_address;
+int8_t __initdata opt_hpet_legacy_replacement = -1;
+static bool __initdata opt_hpet = true;
 u8 __initdata hpet_blockid;
 u8 __initdata hpet_flags;
 
@@ -63,6 +65,32 @@ u8 __initdata hpet_flags;
 static bool __initdata force_hpet_broadcast;
 boolean_param("hpetbroadcast", force_hpet_broadcast);
 
+static int __init parse_hpet_param(const char *s)
+{
+    const char *ss;
+    int val, rc = 0;
+
+    do {
+        ss = strchr(s, ',');
+        if ( !ss )
+            ss = strchr(s, '\0');
+
+        if ( (val = parse_bool(s, ss)) >= 0 )
+            opt_hpet = val;
+        else if ( (val = parse_boolean("broadcast", s, ss)) >= 0 )
+            force_hpet_broadcast = val;
+        else if ( (val = parse_boolean("legacy-replacement", s, ss)) >= 0 )
+            opt_hpet_legacy_replacement = val;
+        else
+            rc = -EINVAL;
+
+        s = ss + 1;
+    } while ( *ss );
+
+    return rc;
+}
+custom_param("hpet", parse_hpet_param);
+
 /*
  * Calculate a multiplication factor for scaled math, which is used to convert
  * nanoseconds based values to clock ticks:
@@ -755,6 +783,9 @@ int hpet_legacy_irq_tick(void)
 
 static u32 *hpet_boot_cfg;
 static uint64_t __initdata hpet_rate;
+static __initdata struct {
+    uint32_t cmp, cfg;
+} pre_legacy_c0;
 
 bool __init hpet_enable_legacy_replacement_mode(void)
 {
@@ -768,8 +799,11 @@ bool __init hpet_enable_legacy_replacement_mode(void)
     /* Stop the main counter. */
     hpet_write32(cfg & ~HPET_CFG_ENABLE, HPET_CFG);
 
+    /* Stash channel 0's old CFG/CMP incase we need to undo. */
+    pre_legacy_c0.cfg = c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+    pre_legacy_c0.cmp = hpet_read32(HPET_Tn_CMP(0));
+
     /* Reconfigure channel 0 to be 32bit periodic. */
-    c0_cfg = hpet_read32(HPET_Tn_CFG(0));
     c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
                HPET_TN_32BIT);
     hpet_write32(c0_cfg, HPET_Tn_CFG(0));
@@ -815,17 +849,33 @@ bool __init hpet_enable_legacy_replacement_mode(void)
     return true;
 }
 
+void __init hpet_disable_legacy_replacement_mode(void)
+{
+    unsigned int cfg = hpet_read32(HPET_CFG);
+
+    ASSERT(hpet_rate);
+
+    cfg &= ~(HPET_CFG_LEGACY | HPET_CFG_ENABLE);
+
+    /* Stop the main counter and disable legacy mode. */
+    hpet_write32(cfg, HPET_CFG);
+
+    /* Restore pre-Legacy Replacement Mode settings. */
+    hpet_write32(pre_legacy_c0.cfg, HPET_Tn_CFG(0));
+    hpet_write32(pre_legacy_c0.cmp, HPET_Tn_CMP(0));
+
+    /* Restart the main counter. */
+    hpet_write32(cfg | HPET_CFG_ENABLE, HPET_CFG);
+}
+
 u64 __init hpet_setup(void)
 {
     unsigned int hpet_id, hpet_period;
     unsigned int last, rem;
 
-    if ( hpet_rate )
+    if ( hpet_rate || !hpet_address || !opt_hpet )
         return hpet_rate;
 
-    if ( hpet_address == 0 )
-        return 0;
-
     set_fixmap_nocache(FIX_HPET_BASE, hpet_address);
 
     hpet_id = hpet_read32(HPET_ID);
@@ -852,19 +902,8 @@ u64 __init hpet_setup(void)
     if ( (rem * 2) > hpet_period )
         hpet_rate++;
 
-    /*
-     * Intel chipsets from Skylake/ApolloLake onwards can statically clock
-     * gate the 8259 PIT.  This option is enabled by default in slightly later
-     * systems, as turning the PIT off is a prerequisite to entering the C11
-     * power saving state.
-     *
-     * Xen currently depends on the legacy timer interrupt being active while
-     * IRQ routing is configured.
-     *
-     * Reconfigure the HPET into legacy mode to re-establish the timer
-     * interrupt.
-     */
-    hpet_enable_legacy_replacement_mode();
+    if ( opt_hpet_legacy_replacement > 0 )
+        hpet_enable_legacy_replacement_mode();
 
     return hpet_rate;
 }
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index e93265f379..58b26d962c 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -29,6 +29,8 @@
 #include <xen/acpi.h>
 #include <xen/keyhandler.h>
 #include <xen/softirq.h>
+
+#include <asm/hpet.h>
 #include <asm/mc146818rtc.h>
 #include <asm/smp.h>
 #include <asm/desc.h>
@@ -1930,6 +1932,35 @@ static void __init check_timer(void)
             local_irq_restore(flags);
             return;
         }
+
+        /*
+         * Intel chipsets from Skylake/ApolloLake onwards can statically clock
+         * gate the 8254 PIT.  This option is enabled by default in slightly
+         * later systems, as turning the PIT off is a prerequisite to entering
+         * the C11 power saving state.
+         *
+         * Xen currently depends on the legacy timer interrupt being active
+         * while IRQ routing is configured.
+         *
+         * If the user hasn't made an explicit choice, attempt to reconfigure
+         * the HPET into legacy mode to re-establish the timer interrupt.
+         */
+        if ( opt_hpet_legacy_replacement < 0 &&
+             hpet_enable_legacy_replacement_mode() )
+        {
+            printk(XENLOG_ERR "..no 8254 timer found - trying HPET Legacy Replacement Mode\n");
+
+            if ( timer_irq_works() )
+            {
+                local_irq_restore(flags);
+                return;
+            }
+
+            /* Legacy Replacement mode hasn't helped.  Undo it. */
+            printk(XENLOG_ERR "..no HPET timer found - reverting Legacy Replacement Mode\n");
+            hpet_disable_legacy_replacement_mode();
+        }
+
         clear_IO_APIC_pin(apic1, pin1);
         printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to "
                "IO-APIC\n");
diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h
index 50176de3d2..8f9725a95e 100644
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -53,6 +53,7 @@
 extern unsigned long hpet_address;
 extern u8 hpet_blockid;
 extern u8 hpet_flags;
+extern int8_t opt_hpet_legacy_replacement;
 
 /*
  * Detect and initialise HPET hardware: return counter update frequency.
@@ -78,6 +79,12 @@ int hpet_legacy_irq_tick(void);
  */
 bool hpet_enable_legacy_replacement_mode(void);
 
+/*
+ * Undo the effects of hpet_disable_legacy_replacement_mode().  Must not be
+ * called unless enable() returned true.
+ */
+void hpet_disable_legacy_replacement_mode(void);
+
 /*
  * Temporarily use an HPET event counter for timer interrupt handling,
  * rather than using the LAPIC timer. Used for Cx state entry.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 17 22:33:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Apr 2021 22:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.112284.214398 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtUu-0001uf-Ng; Sat, 17 Apr 2021 22:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 112284.214398; Sat, 17 Apr 2021 22:33:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtUu-0001uX-KP; Sat, 17 Apr 2021 22:33:04 +0000
Received: by outflank-mailman (input) for mailman id 112284;
 Sat, 17 Apr 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 1lXtUs-0001uQ-Pe
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 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 1lXtUs-0005cH-KY
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 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 1lXtUs-0002hO-IJ
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 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=evq0SUS0HxOGcF/daDy9P0Fv8Y+xX7JMYV0DfhbaYnY=; b=XlumkWC0JxC06+ro7BNYSHMRQZ
	LK+MSqcVudCCbPq4IFhTAuPLdQ9SpFy/6T3aawsGci9z9DUZWcSia/fLSKg5WYlHOzvvpZ0dJzbs4
	STAQk0q9bS2PW2JDDwwsl1VGLSNXWsNPsiJF0q2soZGfCS3dynYSTkBX5GHk7c0iFtzA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] bunzip: replace INIT
Message-Id: <E1lXtUs-0002hO-IJ@xenbits.xenproject.org>
Date: Sat, 17 Apr 2021 22:33:02 +0000

commit 3df14c917230df45b30009b5980955f62925a50d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 16 14:37:36 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 16 14:37:36 2021 +0200

    bunzip: replace INIT
    
    While tools/libs/guest/xg_private.h has its own (non-conflicting for our
    purposes) __init, which hence needs to be #undef-ed, there's no other
    need for this abstraction.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/bunzip2.c    | 22 +++++++++++-----------
 xen/common/decompress.h |  4 ++++
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/xen/common/bunzip2.c b/xen/common/bunzip2.c
index 6aeac79f1a..2087cfbbed 100644
--- a/xen/common/bunzip2.c
+++ b/xen/common/bunzip2.c
@@ -104,7 +104,7 @@ struct bunzip_data {
 
 /* Return the next nnn bits of input.  All reads from the compressed input
    are done through this function.  All reads are big endian */
-static unsigned int INIT get_bits(struct bunzip_data *bd, char bits_wanted)
+static unsigned int __init get_bits(struct bunzip_data *bd, char bits_wanted)
 {
 	unsigned int bits = 0;
 
@@ -144,7 +144,7 @@ static unsigned int INIT get_bits(struct bunzip_data *bd, char bits_wanted)
 
 /* Unpacks the next block and sets up for the inverse burrows-wheeler step. */
 
-static int INIT get_next_block(struct bunzip_data *bd)
+static int __init get_next_block(struct bunzip_data *bd)
 {
 	struct group_data *hufGroup = NULL;
 	int *base = NULL;
@@ -509,7 +509,7 @@ got_huff_bits:
    are ignored, data is written to out_fd and return is RETVAL_OK or error.
 */
 
-static int INIT read_bunzip(struct bunzip_data *bd, unsigned char *outbuf, int len)
+static int __init read_bunzip(struct bunzip_data *bd, unsigned char *outbuf, int len)
 {
 	const unsigned int *dbuf;
 	int pos, xcurrent, previous, gotcount;
@@ -607,7 +607,7 @@ decode_next_byte:
 	goto decode_next_byte;
 }
 
-static int INIT nofill(void *buf, unsigned int len)
+static int __init nofill(void *buf, unsigned int len)
 {
 	return -1;
 }
@@ -615,8 +615,8 @@ static int INIT nofill(void *buf, unsigned int len)
 /* Allocate the structure, read file header.  If in_fd ==-1, inbuf must contain
    a complete bunzip file (len bytes long).  If in_fd!=-1, inbuf and len are
    ignored, and data is read from file handle into temporary buffer. */
-static int INIT start_bunzip(struct bunzip_data **bdp, void *inbuf, int len,
-			     int (*fill)(void*, unsigned int))
+static int __init start_bunzip(struct bunzip_data **bdp, void *inbuf, int len,
+			       int (*fill)(void*, unsigned int))
 {
 	struct bunzip_data *bd;
 	unsigned int i, j, c;
@@ -665,11 +665,11 @@ static int INIT start_bunzip(struct bunzip_data **bdp, void *inbuf, int len,
 
 /* Example usage: decompress src_fd to dst_fd.  (Stops at end of bzip2 data,
    not end of file.) */
-int INIT bunzip2(unsigned char *buf, unsigned int len,
-		 int(*fill)(void*, unsigned int),
-		 int(*flush)(void*, unsigned int),
-		 unsigned char *outbuf, unsigned int *pos,
-		 void(*error)(const char *x))
+int __init bunzip2(unsigned char *buf, unsigned int len,
+		   int(*fill)(void*, unsigned int),
+		   int(*flush)(void*, unsigned int),
+		   unsigned char *outbuf, unsigned int *pos,
+		   void(*error)(const char *x))
 {
 	struct bunzip_data *bd;
 	int i = -1;
diff --git a/xen/common/decompress.h b/xen/common/decompress.h
index d740a80eeb..9491ba581d 100644
--- a/xen/common/decompress.h
+++ b/xen/common/decompress.h
@@ -23,6 +23,10 @@
 #define INIT
 #define INITDATA
 
+#undef __init /* tools/libs/guest/xg_private.h has its own one */
+#define __init
+#define __initdata
+
 #define large_malloc malloc
 #define large_free free
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 17 22:33:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Apr 2021 22:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.112285.214402 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtV4-0001vb-P1; Sat, 17 Apr 2021 22:33:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 112285.214402; Sat, 17 Apr 2021 22:33:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtV4-0001vT-Lz; Sat, 17 Apr 2021 22:33:14 +0000
Received: by outflank-mailman (input) for mailman id 112285;
 Sat, 17 Apr 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 1lXtV2-0001vO-SZ
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 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 1lXtV2-0005cN-Q5
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 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 1lXtV2-0002iQ-ND
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 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=si+FqcXDvsvb7ijK1Uvj+JyHx4muF/f0s/1qB2PxoSM=; b=phgqvqGKycfmYouiQX/XHrul8s
	x3ngHwJkH8ozWPiFmkHWEODrJ7P2wwe8GgOyr/IaoGhtTzThL5oKpLcKYBOUhBEuxLsBJ4iqnYlHd
	EH86lR1RzFGzCp2gXIzDo3Ed4mGGw1Ncifq8O3CjsHwPql3YaDAmcFgDadoo9sYnzauw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] unlzo: replace INIT
Message-Id: <E1lXtV2-0002iQ-ND@xenbits.xenproject.org>
Date: Sat, 17 Apr 2021 22:33:12 +0000

commit 4e4bcd7deed0a7dba71d459b335de5a4f985073d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 16 14:38:26 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 16 14:38:26 2021 +0200

    unlzo: replace INIT
    
    There's no need for this abstraction.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/lzo.c   |  4 ++--
 xen/common/unlzo.c | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/common/lzo.c b/xen/common/lzo.c
index e4841794f4..a87c76dded 100644
--- a/xen/common/lzo.c
+++ b/xen/common/lzo.c
@@ -135,8 +135,8 @@
  */
 #define MAX_255_COUNT      ((((size_t)~0) / 255) - 2)
 
-int INIT lzo1x_decompress_safe(const unsigned char *in, size_t in_len,
-                               unsigned char *out, size_t *out_len)
+int __init lzo1x_decompress_safe(const unsigned char *in, size_t in_len,
+                                 unsigned char *out, size_t *out_len)
 {
     unsigned char *op;
     const unsigned char *ip;
diff --git a/xen/common/unlzo.c b/xen/common/unlzo.c
index df7e53db14..74056778eb 100644
--- a/xen/common/unlzo.c
+++ b/xen/common/unlzo.c
@@ -57,7 +57,7 @@ static const unsigned char lzop_magic[] = {
 #define HEADER_SIZE_MIN       (9 + 7     + 4 + 8     + 1       + 4)
 #define HEADER_SIZE_MAX       (9 + 7 + 1 + 8 + 8 + 4 + 1 + 255 + 4)
 
-static int INIT parse_header(u8 *input, int *skip, int in_len)
+static int __init parse_header(u8 *input, int *skip, int in_len)
 {
 	int l;
 	u8 *parse = input;
@@ -114,11 +114,11 @@ static int INIT parse_header(u8 *input, int *skip, int in_len)
 	return 1;
 }
 
-int INIT unlzo(unsigned char *input, unsigned int in_len,
-	       int (*fill) (void *, unsigned int),
-	       int (*flush) (void *, unsigned int),
-	       unsigned char *output, unsigned int *posp,
-	       void (*error) (const char *x))
+int __init unlzo(unsigned char *input, unsigned int in_len,
+		 int (*fill) (void *, unsigned int),
+		 int (*flush) (void *, unsigned int),
+		 unsigned char *output, unsigned int *posp,
+		 void (*error) (const char *x))
 {
 	u8 r = 0;
 	int skip = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 17 22:33:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Apr 2021 22:33:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.112286.214407 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtVE-0001wb-RR; Sat, 17 Apr 2021 22:33:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 112286.214407; Sat, 17 Apr 2021 22:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtVE-0001wT-NX; Sat, 17 Apr 2021 22:33:24 +0000
Received: by outflank-mailman (input) for mailman id 112286;
 Sat, 17 Apr 2021 22:33:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtVC-0001wM-Vk
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 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 1lXtVC-0005cm-Uv
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 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 1lXtVC-0002ko-SP
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 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=gxwUnwXBjT3JJhmeyfQqizngLMwz30ed3IzuNf13q3I=; b=rvdpk33wzCTbrkJbjRDqsrTDt5
	qtNIfYzZdvctKbsYZAX6uK/a16d1Y18iPOuGU/7yg4EwsykKH0chR4dkTzrGCx6yfiMmf0ILSXtdC
	OdS8zoDPSqaNcPjjsTo23b60W0IafR6I6CYOzBDCPxIay0GxkpEqARkapoYQN92igUWw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] unlzma: replace INIT
Message-Id: <E1lXtVC-0002ko-SP@xenbits.xenproject.org>
Date: Sat, 17 Apr 2021 22:33:22 +0000

commit 0d8e20de1a9963d1f0c3954400d8f582dd05ee43
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 16 14:38:50 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 16 14:38:50 2021 +0200

    unlzma: replace INIT
    
    There's no need for this abstraction.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/unlzma.c | 68 ++++++++++++++++++++++++++---------------------------
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/xen/common/unlzma.c b/xen/common/unlzma.c
index ea5ab41738..d0ef78eef0 100644
--- a/xen/common/unlzma.c
+++ b/xen/common/unlzma.c
@@ -30,7 +30,7 @@
 
 #include "decompress.h"
 
-static long long INIT read_int(unsigned char *ptr, int size)
+static long long __init read_int(unsigned char *ptr, int size)
 {
 	int i;
 	long long ret = 0;
@@ -76,13 +76,13 @@ struct rc {
 #define RC_MODEL_TOTAL_BITS 11
 
 
-static int INIT nofill(void *buffer, unsigned int len)
+static int __init nofill(void *buffer, unsigned int len)
 {
 	return -1;
 }
 
 /* Called twice: once at startup and once in rc_normalize() */
-static void INIT rc_read(struct rc *rc)
+static void __init rc_read(struct rc *rc)
 {
 	rc->buffer_size = rc->fill((char *)rc->buffer, LZMA_IOBUF_SIZE);
 	if (rc->buffer_size <= 0)
@@ -92,9 +92,9 @@ static void INIT rc_read(struct rc *rc)
 }
 
 /* Called once */
-static inline void INIT rc_init(struct rc *rc,
-				       int (*fill)(void*, unsigned int),
-				       unsigned char *buffer, int buffer_size)
+static inline void __init rc_init(struct rc *rc,
+				  int (*fill)(void*, unsigned int),
+				  unsigned char *buffer, int buffer_size)
 {
 	if (fill)
 		rc->fill = fill;
@@ -109,7 +109,7 @@ static inline void INIT rc_init(struct rc *rc,
 	rc->range = 0xFFFFFFFF;
 }
 
-static inline void INIT rc_init_code(struct rc *rc)
+static inline void __init rc_init_code(struct rc *rc)
 {
 	int i;
 
@@ -122,14 +122,14 @@ static inline void INIT rc_init_code(struct rc *rc)
 
 
 /* Called twice, but one callsite is in inline'd rc_is_bit_0_helper() */
-static void INIT rc_do_normalize(struct rc *rc)
+static void __init rc_do_normalize(struct rc *rc)
 {
 	if (rc->ptr >= rc->buffer_end)
 		rc_read(rc);
 	rc->range <<= 8;
 	rc->code = (rc->code << 8) | *rc->ptr++;
 }
-static inline void INIT rc_normalize(struct rc *rc)
+static inline void __init rc_normalize(struct rc *rc)
 {
 	if (rc->range < (1 << RC_TOP_BITS))
 		rc_do_normalize(rc);
@@ -139,20 +139,20 @@ static inline void INIT rc_normalize(struct rc *rc)
 /* Why rc_is_bit_0_helper exists?
  *Because we want to always expose (rc->code < rc->bound) to optimizer
  */
-static inline uint32_t INIT rc_is_bit_0_helper(struct rc *rc, uint16_t *p)
+static inline uint32_t __init rc_is_bit_0_helper(struct rc *rc, uint16_t *p)
 {
 	rc_normalize(rc);
 	rc->bound = *p * (rc->range >> RC_MODEL_TOTAL_BITS);
 	return rc->bound;
 }
-static inline int INIT rc_is_bit_0(struct rc *rc, uint16_t *p)
+static inline int __init rc_is_bit_0(struct rc *rc, uint16_t *p)
 {
 	uint32_t t = rc_is_bit_0_helper(rc, p);
 	return rc->code < t;
 }
 
 /* Called ~10 times, but very small, thus inlined */
-static inline void INIT rc_update_bit_0(struct rc *rc, uint16_t *p)
+static inline void __init rc_update_bit_0(struct rc *rc, uint16_t *p)
 {
 	rc->range = rc->bound;
 	*p += ((1 << RC_MODEL_TOTAL_BITS) - *p) >> RC_MOVE_BITS;
@@ -165,7 +165,7 @@ static inline void rc_update_bit_1(struct rc *rc, uint16_t *p)
 }
 
 /* Called 4 times in unlzma loop */
-static int INIT rc_get_bit(struct rc *rc, uint16_t *p, int *symbol)
+static int __init rc_get_bit(struct rc *rc, uint16_t *p, int *symbol)
 {
 	if (rc_is_bit_0(rc, p)) {
 		rc_update_bit_0(rc, p);
@@ -179,7 +179,7 @@ static int INIT rc_get_bit(struct rc *rc, uint16_t *p, int *symbol)
 }
 
 /* Called once */
-static inline int INIT rc_direct_bit(struct rc *rc)
+static inline int __init rc_direct_bit(struct rc *rc)
 {
 	rc_normalize(rc);
 	rc->range >>= 1;
@@ -191,7 +191,7 @@ static inline int INIT rc_direct_bit(struct rc *rc)
 }
 
 /* Called twice */
-static inline void INIT
+static inline void __init
 rc_bit_tree_decode(struct rc *rc, uint16_t *p, int num_levels, int *symbol)
 {
 	int i = num_levels;
@@ -283,14 +283,14 @@ struct cstate {
 	uint32_t rep0, rep1, rep2, rep3;
 };
 
-static inline size_t INIT get_pos(struct writer *wr)
+static inline size_t __init get_pos(struct writer *wr)
 {
 	return
 		wr->global_pos + wr->buffer_pos;
 }
 
-static inline uint8_t INIT peek_old_byte(struct writer *wr,
-						uint32_t offs)
+static inline uint8_t __init peek_old_byte(struct writer *wr,
+					   uint32_t offs)
 {
 	if (!wr->flush) {
 		int32_t pos;
@@ -307,7 +307,7 @@ static inline uint8_t INIT peek_old_byte(struct writer *wr,
 
 }
 
-static inline int INIT write_byte(struct writer *wr, uint8_t byte)
+static inline int __init write_byte(struct writer *wr, uint8_t byte)
 {
 	wr->buffer[wr->buffer_pos++] = wr->previous_byte = byte;
 	if (wr->flush && wr->buffer_pos == wr->header->dict_size) {
@@ -321,13 +321,13 @@ static inline int INIT write_byte(struct writer *wr, uint8_t byte)
 }
 
 
-static inline int INIT copy_byte(struct writer *wr, uint32_t offs)
+static inline int __init copy_byte(struct writer *wr, uint32_t offs)
 {
 	return write_byte(wr, peek_old_byte(wr, offs));
 }
 
-static inline int INIT copy_bytes(struct writer *wr,
-					 uint32_t rep0, int len)
+static inline int __init copy_bytes(struct writer *wr,
+				    uint32_t rep0, int len)
 {
 	do {
 		if (copy_byte(wr, rep0))
@@ -338,10 +338,10 @@ static inline int INIT copy_bytes(struct writer *wr,
 	return len;
 }
 
-static inline int INIT process_bit0(struct writer *wr, struct rc *rc,
-				     struct cstate *cst, uint16_t *p,
-				     int pos_state, uint16_t *prob,
-				     int lc, uint32_t literal_pos_mask) {
+static inline int __init process_bit0(struct writer *wr, struct rc *rc,
+				      struct cstate *cst, uint16_t *p,
+				      int pos_state, uint16_t *prob,
+				      int lc, uint32_t literal_pos_mask) {
 	int mi = 1;
 	rc_update_bit_0(rc, prob);
 	prob = (p + LZMA_LITERAL +
@@ -382,9 +382,9 @@ static inline int INIT process_bit0(struct writer *wr, struct rc *rc,
 	return write_byte(wr, mi);
 }
 
-static inline int INIT process_bit1(struct writer *wr, struct rc *rc,
-					    struct cstate *cst, uint16_t *p,
-					    int pos_state, uint16_t *prob) {
+static inline int __init process_bit1(struct writer *wr, struct rc *rc,
+				      struct cstate *cst, uint16_t *p,
+				      int pos_state, uint16_t *prob) {
   int offset;
 	uint16_t *prob_len;
 	int num_bits;
@@ -528,11 +528,11 @@ static inline int INIT process_bit1(struct writer *wr, struct rc *rc,
 
 
 
-int INIT unlzma(unsigned char *buf, unsigned int in_len,
-	        int(*fill)(void*, unsigned int),
-	        int(*flush)(void*, unsigned int),
-	        unsigned char *output, unsigned int *posp,
-	        void(*error)(const char *x))
+int __init unlzma(unsigned char *buf, unsigned int in_len,
+		  int(*fill)(void*, unsigned int),
+		  int(*flush)(void*, unsigned int),
+		  unsigned char *output, unsigned int *posp,
+		  void(*error)(const char *x))
 {
 	struct lzma_header header;
 	int lc, pb, lp;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 17 22:33:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Apr 2021 22:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.112287.214409 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtVO-0001yQ-S0; Sat, 17 Apr 2021 22:33:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 112287.214409; Sat, 17 Apr 2021 22:33:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtVO-0001yI-P3; Sat, 17 Apr 2021 22:33:34 +0000
Received: by outflank-mailman (input) for mailman id 112287;
 Sat, 17 Apr 2021 22:33:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtVN-0001y3-2c
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:33:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtVN-0005ct-1n
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:33:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtVN-0002lj-0y
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:33:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lmQdCdRdhTH2vP3ETfZyjOnI3pBLCEACuyA8+3e/u5k=; b=Y+AtTjR1yeAFEHCKrSvnTfbYwM
	KMTPDnf3BjvKt/m+WjfB6pvPCyTdy9I26cqXsx8ZA4d1ufk8Wsos7MMj1p3m/o6/3RPDFQHshQ0A+
	ldKGH0YaJ5OeoG9aN9hFEUNf9zhgNHndFIL4AVeTfDzX/tUbtj1YbSNKf1oRmAiRnG3k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] unlz4: replace INIT
Message-Id: <E1lXtVN-0002lj-0y@xenbits.xenproject.org>
Date: Sat, 17 Apr 2021 22:33:33 +0000

commit d9b1620aa4dae26964415e9f05f3b4000198e18f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 16 14:39:25 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 16 14:39:25 2021 +0200

    unlz4: replace INIT
    
    There's no need for this abstraction.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/lz4/decompress.c |  8 ++++----
 xen/common/unlz4.c          | 10 +++++-----
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/common/lz4/decompress.c b/xen/common/lz4/decompress.c
index 3caedb3d5d..876906fac1 100644
--- a/xen/common/lz4/decompress.c
+++ b/xen/common/lz4/decompress.c
@@ -46,8 +46,8 @@ static const int8_t dec64table[] = {0, 0, 0, -1, 0, 1, 2, 3};
 
 #if defined(__XEN__) || defined(__MINIOS__)
 
-static int INIT lz4_uncompress(const unsigned char *source, unsigned char *dest,
-			       int osize)
+static int __init lz4_uncompress(const unsigned char *source, unsigned char *dest,
+				 int osize)
 {
 	const BYTE *ip = (const BYTE *) source;
 	const BYTE *ref;
@@ -302,8 +302,8 @@ _output_error:
 
 #if defined(__XEN__) || defined(__MINIOS__)
 
-int INIT lz4_decompress(const unsigned char *src, size_t *src_len,
-		unsigned char *dest, size_t actual_dest_len)
+int __init lz4_decompress(const unsigned char *src, size_t *src_len,
+			  unsigned char *dest, size_t actual_dest_len)
 {
 	int ret = -1;
 	int input_len = 0;
diff --git a/xen/common/unlz4.c b/xen/common/unlz4.c
index 4a8fc55ccb..2096b98f36 100644
--- a/xen/common/unlz4.c
+++ b/xen/common/unlz4.c
@@ -22,11 +22,11 @@
 #define LZ4_DEFAULT_UNCOMPRESSED_CHUNK_SIZE (8 << 20)
 #define ARCHIVE_MAGICNUMBER 0x184C2102
 
-int INIT unlz4(unsigned char *input, unsigned int in_len,
-	       int (*fill)(void *, unsigned int),
-	       int (*flush)(void *, unsigned int),
-	       unsigned char *output, unsigned int *posp,
-	       void (*error)(const char *x))
+int __init unlz4(unsigned char *input, unsigned int in_len,
+		 int (*fill)(void *, unsigned int),
+		 int (*flush)(void *, unsigned int),
+		 unsigned char *output, unsigned int *posp,
+		 void (*error)(const char *x))
 {
 	int ret = -1;
 	size_t chunksize = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 17 22:33:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Apr 2021 22:33:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.112288.214414 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtVY-0001zp-Ue; Sat, 17 Apr 2021 22:33:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 112288.214414; Sat, 17 Apr 2021 22:33:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtVY-0001zj-Qe; Sat, 17 Apr 2021 22:33:44 +0000
Received: by outflank-mailman (input) for mailman id 112288;
 Sat, 17 Apr 2021 22:33:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtVX-0001zV-6I
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:33:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtVX-0005d5-5T
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:33:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtVX-0002mh-4X
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:33:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZBWyS4lUVGplbuzZwrbKSvr2TiHLFgM+0BTk/DtwYUk=; b=JifDxobC1OstVzAvDj9XT4lrvB
	YcTy+X6UUX4+qyeFvPLQbe5q2h7ihjjLLLBoeaoD2K/i6JICHIZZwMUox/QcmJnOxMK7F+8VFNYO1
	qcffOJj2P7xzUOma6s0QGDWRqacTkfwGAzW7kKT9RDe+buPvuV35JPowYZ4jNltUn6Bs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] unxz: replace INIT{,DATA} and STATIC
Message-Id: <E1lXtVX-0002mh-4X@xenbits.xenproject.org>
Date: Sat, 17 Apr 2021 22:33:43 +0000

commit a24d072ec8936937306073904c85da3849dd2f58
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 16 14:40:15 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 16 14:40:15 2021 +0200

    unxz: replace INIT{,DATA} and STATIC
    
    With xen/common/decompress.h now agreeing in both build modes about
    what STATIC expands to, there's no need for these abstractions anymore.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/decompress.h    |  2 --
 xen/common/unxz.c          | 12 +++++-----
 xen/common/xz/crc32.c      |  6 ++---
 xen/common/xz/dec_bcj.c    | 30 +++++++++++------------
 xen/common/xz/dec_lzma2.c  | 60 +++++++++++++++++++++++-----------------------
 xen/common/xz/dec_stream.c | 32 ++++++++++++-------------
 xen/common/xz/lzma2.h      | 12 +++++-----
 7 files changed, 76 insertions(+), 78 deletions(-)

diff --git a/xen/common/decompress.h b/xen/common/decompress.h
index 9491ba581d..7144fb46ce 100644
--- a/xen/common/decompress.h
+++ b/xen/common/decompress.h
@@ -9,7 +9,6 @@
 
 #define STATIC static
 #define INIT __init
-#define INITDATA __initdata
 
 #define malloc xmalloc_bytes
 #define free xfree
@@ -21,7 +20,6 @@
 
 #define STATIC static
 #define INIT
-#define INITDATA
 
 #undef __init /* tools/libs/guest/xg_private.h has its own one */
 #define __init
diff --git a/xen/common/unxz.c b/xen/common/unxz.c
index 15806f4469..7bfe23f422 100644
--- a/xen/common/unxz.c
+++ b/xen/common/unxz.c
@@ -95,7 +95,7 @@
 
 #include "decompress.h"
 
-#define XZ_EXTERN STATIC
+#define XZ_EXTERN static
 
 /*
  * For boot time use, we enable only the BCJ filter of the current
@@ -157,11 +157,11 @@
  * both input and output buffers are available as a single chunk, i.e. when
  * fill() and flush() won't be used.
  */
-int INIT unxz(unsigned char *in, unsigned int in_size,
-	      int (*fill)(void *dest, unsigned int size),
-	      int (*flush)(void *src, unsigned int size),
-	      unsigned char *out, unsigned int *in_used,
-	      void (*error)(const char *x))
+int __init unxz(unsigned char *in, unsigned int in_size,
+		int (*fill)(void *dest, unsigned int size),
+		int (*flush)(void *src, unsigned int size),
+		unsigned char *out, unsigned int *in_used,
+		void (*error)(const char *x))
 {
 	struct xz_buf b;
 	struct xz_dec *s;
diff --git a/xen/common/xz/crc32.c b/xen/common/xz/crc32.c
index 0708b61638..092a74fbab 100644
--- a/xen/common/xz/crc32.c
+++ b/xen/common/xz/crc32.c
@@ -15,9 +15,9 @@
  * but they are bigger and use more memory for the lookup table.
  */
 
-XZ_EXTERN uint32_t INITDATA xz_crc32_table[256];
+XZ_EXTERN uint32_t __initdata xz_crc32_table[256];
 
-XZ_EXTERN void INIT xz_crc32_init(void)
+XZ_EXTERN void __init xz_crc32_init(void)
 {
 	const uint32_t poly = 0xEDB88320;
 
@@ -36,7 +36,7 @@ XZ_EXTERN void INIT xz_crc32_init(void)
 	return;
 }
 
-XZ_EXTERN uint32_t INIT xz_crc32(const uint8_t *buf, size_t size, uint32_t crc)
+XZ_EXTERN uint32_t __init xz_crc32(const uint8_t *buf, size_t size, uint32_t crc)
 {
 	crc = ~crc;
 
diff --git a/xen/common/xz/dec_bcj.c b/xen/common/xz/dec_bcj.c
index 86c1192199..970d3d89ee 100644
--- a/xen/common/xz/dec_bcj.c
+++ b/xen/common/xz/dec_bcj.c
@@ -80,12 +80,12 @@ struct xz_dec_bcj {
  * This is used to test the most significant byte of a memory address
  * in an x86 instruction.
  */
-static inline int INIT bcj_x86_test_msbyte(uint8_t b)
+static inline int __init bcj_x86_test_msbyte(uint8_t b)
 {
 	return b == 0x00 || b == 0xFF;
 }
 
-static size_t INIT bcj_x86(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
+static size_t __init bcj_x86(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 {
 	static const bool_t mask_to_allowed_status[8]
 		= { true, true, true, false, true, false, false, false };
@@ -157,7 +157,7 @@ static size_t INIT bcj_x86(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 #endif
 
 #ifdef XZ_DEC_POWERPC
-static size_t INIT bcj_powerpc(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
+static size_t __init bcj_powerpc(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 {
 	size_t i;
 	uint32_t instr;
@@ -178,7 +178,7 @@ static size_t INIT bcj_powerpc(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 #endif
 
 #ifdef XZ_DEC_IA64
-static size_t INIT bcj_ia64(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
+static size_t __init bcj_ia64(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 {
 	static const uint8_t branch_table[32] = {
 		0, 0, 0, 0, 0, 0, 0, 0,
@@ -262,7 +262,7 @@ static size_t INIT bcj_ia64(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 #endif
 
 #ifdef XZ_DEC_ARM
-static size_t INIT bcj_arm(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
+static size_t __init bcj_arm(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 {
 	size_t i;
 	uint32_t addr;
@@ -285,7 +285,7 @@ static size_t INIT bcj_arm(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 #endif
 
 #ifdef XZ_DEC_ARMTHUMB
-static size_t INIT bcj_armthumb(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
+static size_t __init bcj_armthumb(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 {
 	size_t i;
 	uint32_t addr;
@@ -313,7 +313,7 @@ static size_t INIT bcj_armthumb(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 #endif
 
 #ifdef XZ_DEC_SPARC
-static size_t INIT bcj_sparc(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
+static size_t __init bcj_sparc(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
 {
 	size_t i;
 	uint32_t instr;
@@ -342,8 +342,8 @@ static size_t INIT bcj_sparc(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
  * pointers, which could be problematic in the kernel boot code, which must
  * avoid pointers to static data (at least on x86).
  */
-static void INIT bcj_apply(struct xz_dec_bcj *s,
-			   uint8_t *buf, size_t *pos, size_t size)
+static void __init bcj_apply(struct xz_dec_bcj *s,
+			     uint8_t *buf, size_t *pos, size_t size)
 {
 	size_t filtered;
 
@@ -396,7 +396,7 @@ static void INIT bcj_apply(struct xz_dec_bcj *s,
  * Move the remaining mixture of possibly filtered and unfiltered
  * data to the beginning of temp.
  */
-static void INIT bcj_flush(struct xz_dec_bcj *s, struct xz_buf *b)
+static void __init bcj_flush(struct xz_dec_bcj *s, struct xz_buf *b)
 {
 	size_t copy_size;
 
@@ -414,9 +414,9 @@ static void INIT bcj_flush(struct xz_dec_bcj *s, struct xz_buf *b)
  * data in chunks of 1-16 bytes. To hide this issue, this function does
  * some buffering.
  */
-XZ_EXTERN enum xz_ret INIT xz_dec_bcj_run(struct xz_dec_bcj *s,
-					  struct xz_dec_lzma2 *lzma2,
-					  struct xz_buf *b)
+XZ_EXTERN enum xz_ret __init xz_dec_bcj_run(struct xz_dec_bcj *s,
+					    struct xz_dec_lzma2 *lzma2,
+					    struct xz_buf *b)
 {
 	size_t out_start;
 
@@ -524,7 +524,7 @@ XZ_EXTERN enum xz_ret INIT xz_dec_bcj_run(struct xz_dec_bcj *s,
 	return s->ret;
 }
 
-XZ_EXTERN struct xz_dec_bcj *INIT xz_dec_bcj_create(bool_t single_call)
+XZ_EXTERN struct xz_dec_bcj *__init xz_dec_bcj_create(bool_t single_call)
 {
 	struct xz_dec_bcj *s = malloc(sizeof(*s));
 	if (s != NULL)
@@ -533,7 +533,7 @@ XZ_EXTERN struct xz_dec_bcj *INIT xz_dec_bcj_create(bool_t single_call)
 	return s;
 }
 
-XZ_EXTERN enum xz_ret INIT xz_dec_bcj_reset(struct xz_dec_bcj *s, uint8_t id)
+XZ_EXTERN enum xz_ret __init xz_dec_bcj_reset(struct xz_dec_bcj *s, uint8_t id)
 {
 	switch (id) {
 #ifdef XZ_DEC_X86
diff --git a/xen/common/xz/dec_lzma2.c b/xen/common/xz/dec_lzma2.c
index 44fe79bc30..6b07722e3c 100644
--- a/xen/common/xz/dec_lzma2.c
+++ b/xen/common/xz/dec_lzma2.c
@@ -283,7 +283,7 @@ struct xz_dec_lzma2 {
  * Reset the dictionary state. When in single-call mode, set up the beginning
  * of the dictionary to point to the actual output buffer.
  */
-static void INIT dict_reset(struct dictionary *dict, struct xz_buf *b)
+static void __init dict_reset(struct dictionary *dict, struct xz_buf *b)
 {
 	if (DEC_IS_SINGLE(dict->mode)) {
 		dict->buf = b->out + b->out_pos;
@@ -297,7 +297,7 @@ static void INIT dict_reset(struct dictionary *dict, struct xz_buf *b)
 }
 
 /* Set dictionary write limit */
-static void INIT dict_limit(struct dictionary *dict, size_t out_max)
+static void __init dict_limit(struct dictionary *dict, size_t out_max)
 {
 	if (dict->end - dict->pos <= out_max)
 		dict->limit = dict->end;
@@ -306,7 +306,7 @@ static void INIT dict_limit(struct dictionary *dict, size_t out_max)
 }
 
 /* Return true if at least one byte can be written into the dictionary. */
-static inline bool_t INIT dict_has_space(const struct dictionary *dict)
+static inline bool_t __init dict_has_space(const struct dictionary *dict)
 {
 	return dict->pos < dict->limit;
 }
@@ -317,7 +317,7 @@ static inline bool_t INIT dict_has_space(const struct dictionary *dict)
  * still empty. This special case is needed for single-call decoding to
  * avoid writing a '\0' to the end of the destination buffer.
  */
-static inline uint32_t INIT dict_get(const struct dictionary *dict, uint32_t dist)
+static inline uint32_t __init dict_get(const struct dictionary *dict, uint32_t dist)
 {
 	size_t offset = dict->pos - dist - 1;
 
@@ -330,7 +330,7 @@ static inline uint32_t INIT dict_get(const struct dictionary *dict, uint32_t dis
 /*
  * Put one byte into the dictionary. It is assumed that there is space for it.
  */
-static inline void INIT dict_put(struct dictionary *dict, uint8_t byte)
+static inline void __init dict_put(struct dictionary *dict, uint8_t byte)
 {
 	dict->buf[dict->pos++] = byte;
 
@@ -343,7 +343,7 @@ static inline void INIT dict_put(struct dictionary *dict, uint8_t byte)
  * invalid, false is returned. On success, true is returned and *len is
  * updated to indicate how many bytes were left to be repeated.
  */
-static bool_t INIT dict_repeat(struct dictionary *dict, uint32_t *len, uint32_t dist)
+static bool_t __init dict_repeat(struct dictionary *dict, uint32_t *len, uint32_t dist)
 {
 	size_t back;
 	uint32_t left;
@@ -371,8 +371,8 @@ static bool_t INIT dict_repeat(struct dictionary *dict, uint32_t *len, uint32_t
 }
 
 /* Copy uncompressed data as is from input to dictionary and output buffers. */
-static void INIT dict_uncompressed(struct dictionary *dict, struct xz_buf *b,
-				   uint32_t *left)
+static void __init dict_uncompressed(struct dictionary *dict, struct xz_buf *b,
+				     uint32_t *left)
 {
 	size_t copy_size;
 
@@ -413,7 +413,7 @@ static void INIT dict_uncompressed(struct dictionary *dict, struct xz_buf *b,
  * enough space in b->out. This is guaranteed because caller uses dict_limit()
  * before decoding data into the dictionary.
  */
-static uint32_t INIT dict_flush(struct dictionary *dict, struct xz_buf *b)
+static uint32_t __init dict_flush(struct dictionary *dict, struct xz_buf *b)
 {
 	size_t copy_size = dict->pos - dict->start;
 
@@ -435,7 +435,7 @@ static uint32_t INIT dict_flush(struct dictionary *dict, struct xz_buf *b)
  *****************/
 
 /* Reset the range decoder. */
-static void INIT rc_reset(struct rc_dec *rc)
+static void __init rc_reset(struct rc_dec *rc)
 {
 	rc->range = (uint32_t)-1;
 	rc->code = 0;
@@ -446,7 +446,7 @@ static void INIT rc_reset(struct rc_dec *rc)
  * Read the first five initial bytes into rc->code if they haven't been
  * read already. (Yes, the first byte gets completely ignored.)
  */
-static bool_t INIT rc_read_init(struct rc_dec *rc, struct xz_buf *b)
+static bool_t __init rc_read_init(struct rc_dec *rc, struct xz_buf *b)
 {
 	while (rc->init_bytes_left > 0) {
 		if (b->in_pos == b->in_size)
@@ -460,7 +460,7 @@ static bool_t INIT rc_read_init(struct rc_dec *rc, struct xz_buf *b)
 }
 
 /* Return true if there may not be enough input for the next decoding loop. */
-static inline bool_t INIT rc_limit_exceeded(const struct rc_dec *rc)
+static inline bool_t __init rc_limit_exceeded(const struct rc_dec *rc)
 {
 	return rc->in_pos > rc->in_limit;
 }
@@ -469,7 +469,7 @@ static inline bool_t INIT rc_limit_exceeded(const struct rc_dec *rc)
  * Return true if it is possible (from point of view of range decoder) that
  * we have reached the end of the LZMA chunk.
  */
-static inline bool_t INIT rc_is_finished(const struct rc_dec *rc)
+static inline bool_t __init rc_is_finished(const struct rc_dec *rc)
 {
 	return rc->code == 0;
 }
@@ -550,7 +550,7 @@ static always_inline void rc_bittree_reverse(struct rc_dec *rc,
 }
 
 /* Decode direct bits (fixed fifty-fifty probability) */
-static inline void INIT rc_direct(struct rc_dec *rc, uint32_t *dest, uint32_t limit)
+static inline void __init rc_direct(struct rc_dec *rc, uint32_t *dest, uint32_t limit)
 {
 	uint32_t mask;
 
@@ -569,7 +569,7 @@ static inline void INIT rc_direct(struct rc_dec *rc, uint32_t *dest, uint32_t li
  ********/
 
 /* Get pointer to literal coder probability array. */
-static uint16_t *INIT lzma_literal_probs(struct xz_dec_lzma2 *s)
+static uint16_t *__init lzma_literal_probs(struct xz_dec_lzma2 *s)
 {
 	uint32_t prev_byte = dict_get(&s->dict, 0);
 	uint32_t low = prev_byte >> (8 - s->lzma.lc);
@@ -578,7 +578,7 @@ static uint16_t *INIT lzma_literal_probs(struct xz_dec_lzma2 *s)
 }
 
 /* Decode a literal (one 8-bit byte) */
-static void INIT lzma_literal(struct xz_dec_lzma2 *s)
+static void __init lzma_literal(struct xz_dec_lzma2 *s)
 {
 	uint16_t *probs;
 	uint32_t symbol;
@@ -616,8 +616,8 @@ static void INIT lzma_literal(struct xz_dec_lzma2 *s)
 }
 
 /* Decode the length of the match into s->lzma.len. */
-static void INIT lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l,
-			  uint32_t pos_state)
+static void __init lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l,
+			    uint32_t pos_state)
 {
 	uint16_t *probs;
 	uint32_t limit;
@@ -643,7 +643,7 @@ static void INIT lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l,
 }
 
 /* Decode a match. The distance will be stored in s->lzma.rep0. */
-static void INIT lzma_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
+static void __init lzma_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
 {
 	uint16_t *probs;
 	uint32_t dist_slot;
@@ -685,7 +685,7 @@ static void INIT lzma_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
  * Decode a repeated match. The distance is one of the four most recently
  * seen matches. The distance will be stored in s->lzma.rep0.
  */
-static void INIT lzma_rep_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
+static void __init lzma_rep_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
 {
 	uint32_t tmp;
 
@@ -719,7 +719,7 @@ static void INIT lzma_rep_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
 }
 
 /* LZMA decoder core */
-static bool_t INIT lzma_main(struct xz_dec_lzma2 *s)
+static bool_t __init lzma_main(struct xz_dec_lzma2 *s)
 {
 	uint32_t pos_state;
 
@@ -764,7 +764,7 @@ static bool_t INIT lzma_main(struct xz_dec_lzma2 *s)
  * Reset the LZMA decoder and range decoder state. Dictionary is nore reset
  * here, because LZMA state may be reset without resetting the dictionary.
  */
-static void INIT lzma_reset(struct xz_dec_lzma2 *s)
+static void __init lzma_reset(struct xz_dec_lzma2 *s)
 {
 	uint16_t *probs;
 	size_t i;
@@ -796,7 +796,7 @@ static void INIT lzma_reset(struct xz_dec_lzma2 *s)
  * from the decoded lp and pb values. On success, the LZMA decoder state is
  * reset and true is returned.
  */
-static bool_t INIT lzma_props(struct xz_dec_lzma2 *s, uint8_t props)
+static bool_t __init lzma_props(struct xz_dec_lzma2 *s, uint8_t props)
 {
 	if (props > (4 * 5 + 4) * 9 + 8)
 		return false;
@@ -843,7 +843,7 @@ static bool_t INIT lzma_props(struct xz_dec_lzma2 *s, uint8_t props)
  * function. We decode a few bytes from the temporary buffer so that we can
  * continue decoding from the caller-supplied input buffer again.
  */
-static bool_t INIT lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b)
+static bool_t __init lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b)
 {
 	size_t in_avail;
 	uint32_t tmp;
@@ -928,8 +928,8 @@ static bool_t INIT lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b)
  * Take care of the LZMA2 control layer, and forward the job of actual LZMA
  * decoding or copying of uncompressed chunks to other functions.
  */
-XZ_EXTERN enum xz_ret INIT xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
-					    struct xz_buf *b)
+XZ_EXTERN enum xz_ret __init xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
+					      struct xz_buf *b)
 {
 	uint32_t tmp;
 
@@ -1105,8 +1105,8 @@ XZ_EXTERN enum xz_ret INIT xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
 	return XZ_OK;
 }
 
-XZ_EXTERN struct xz_dec_lzma2 *INIT xz_dec_lzma2_create(enum xz_mode mode,
-						   uint32_t dict_max)
+XZ_EXTERN struct xz_dec_lzma2 *__init xz_dec_lzma2_create(enum xz_mode mode,
+							  uint32_t dict_max)
 {
 	struct xz_dec_lzma2 *s = malloc(sizeof(*s));
 	if (s == NULL)
@@ -1129,7 +1129,7 @@ XZ_EXTERN struct xz_dec_lzma2 *INIT xz_dec_lzma2_create(enum xz_mode mode,
 	return s;
 }
 
-XZ_EXTERN enum xz_ret INIT xz_dec_lzma2_reset(struct xz_dec_lzma2 *s, uint8_t props)
+XZ_EXTERN enum xz_ret __init xz_dec_lzma2_reset(struct xz_dec_lzma2 *s, uint8_t props)
 {
 	/* This limits dictionary size to 3 GiB to keep parsing simpler. */
 	if (props > 39)
@@ -1166,7 +1166,7 @@ XZ_EXTERN enum xz_ret INIT xz_dec_lzma2_reset(struct xz_dec_lzma2 *s, uint8_t pr
 	return XZ_OK;
 }
 
-XZ_EXTERN void INIT xz_dec_lzma2_end(struct xz_dec_lzma2 *s)
+XZ_EXTERN void __init xz_dec_lzma2_end(struct xz_dec_lzma2 *s)
 {
 	if (DEC_IS_MULTI(s->dict.mode))
 		large_free(s->dict.buf);
diff --git a/xen/common/xz/dec_stream.c b/xen/common/xz/dec_stream.c
index b8b566307c..b7a8c15c5b 100644
--- a/xen/common/xz/dec_stream.c
+++ b/xen/common/xz/dec_stream.c
@@ -154,7 +154,7 @@ static const uint8_t check_sizes[16] = {
  * to copy into s->temp.buf. Return true once s->temp.pos has reached
  * s->temp.size.
  */
-static bool_t INIT fill_temp(struct xz_dec *s, struct xz_buf *b)
+static bool_t __init fill_temp(struct xz_dec *s, struct xz_buf *b)
 {
 	size_t copy_size = min_t(size_t,
 			b->in_size - b->in_pos, s->temp.size - s->temp.pos);
@@ -172,8 +172,8 @@ static bool_t INIT fill_temp(struct xz_dec *s, struct xz_buf *b)
 }
 
 /* Decode a variable-length integer (little-endian base-128 encoding) */
-static enum xz_ret INIT dec_vli(struct xz_dec *s, const uint8_t *in,
-				size_t *in_pos, size_t in_size)
+static enum xz_ret __init dec_vli(struct xz_dec *s, const uint8_t *in,
+				  size_t *in_pos, size_t in_size)
 {
 	uint8_t byte;
 
@@ -215,7 +215,7 @@ static enum xz_ret INIT dec_vli(struct xz_dec *s, const uint8_t *in,
  * the sizes possibly stored in the Block Header. Update the hash and
  * Block count, which are later used to validate the Index field.
  */
-static enum xz_ret INIT dec_block(struct xz_dec *s, struct xz_buf *b)
+static enum xz_ret __init dec_block(struct xz_dec *s, struct xz_buf *b)
 {
 	enum xz_ret ret;
 
@@ -278,7 +278,7 @@ static enum xz_ret INIT dec_block(struct xz_dec *s, struct xz_buf *b)
 }
 
 /* Update the Index size and the CRC32 value. */
-static void INIT index_update(struct xz_dec *s, const struct xz_buf *b)
+static void __init index_update(struct xz_dec *s, const struct xz_buf *b)
 {
 	size_t in_used = b->in_pos - s->in_start;
 	s->index.size += in_used;
@@ -293,7 +293,7 @@ static void INIT index_update(struct xz_dec *s, const struct xz_buf *b)
  * This can return XZ_OK (more input needed), XZ_STREAM_END (everything
  * successfully decoded), or XZ_DATA_ERROR (input is corrupt).
  */
-static enum xz_ret INIT dec_index(struct xz_dec *s, struct xz_buf *b)
+static enum xz_ret __init dec_index(struct xz_dec *s, struct xz_buf *b)
 {
 	enum xz_ret ret;
 
@@ -343,7 +343,7 @@ static enum xz_ret INIT dec_index(struct xz_dec *s, struct xz_buf *b)
  * Validate that the next four input bytes match the value of s->crc32.
  * s->pos must be zero when starting to validate the first byte.
  */
-static enum xz_ret INIT crc32_validate(struct xz_dec *s, struct xz_buf *b)
+static enum xz_ret __init crc32_validate(struct xz_dec *s, struct xz_buf *b)
 {
 	do {
 		if (b->in_pos == b->in_size)
@@ -367,7 +367,7 @@ static enum xz_ret INIT crc32_validate(struct xz_dec *s, struct xz_buf *b)
  * Skip over the Check field when the Check ID is not supported.
  * Returns true once the whole Check field has been skipped over.
  */
-static bool_t INIT check_skip(struct xz_dec *s, struct xz_buf *b)
+static bool_t __init check_skip(struct xz_dec *s, struct xz_buf *b)
 {
 	while (s->pos < check_sizes[s->check_type]) {
 		if (b->in_pos == b->in_size)
@@ -384,7 +384,7 @@ static bool_t INIT check_skip(struct xz_dec *s, struct xz_buf *b)
 #endif
 
 /* Decode the Stream Header field (the first 12 bytes of the .xz Stream). */
-static enum xz_ret INIT dec_stream_header(struct xz_dec *s)
+static enum xz_ret __init dec_stream_header(struct xz_dec *s)
 {
 	if (!memeq(s->temp.buf, HEADER_MAGIC, HEADER_MAGIC_SIZE))
 		return XZ_FORMAT_ERROR;
@@ -419,7 +419,7 @@ static enum xz_ret INIT dec_stream_header(struct xz_dec *s)
 }
 
 /* Decode the Stream Footer field (the last 12 bytes of the .xz Stream) */
-static enum xz_ret INIT dec_stream_footer(struct xz_dec *s)
+static enum xz_ret __init dec_stream_footer(struct xz_dec *s)
 {
 	if (!memeq(s->temp.buf + 10, FOOTER_MAGIC, FOOTER_MAGIC_SIZE))
 		return XZ_DATA_ERROR;
@@ -446,7 +446,7 @@ static enum xz_ret INIT dec_stream_footer(struct xz_dec *s)
 }
 
 /* Decode the Block Header and initialize the filter chain. */
-static enum xz_ret INIT dec_block_header(struct xz_dec *s)
+static enum xz_ret __init dec_block_header(struct xz_dec *s)
 {
 	enum xz_ret ret;
 
@@ -546,7 +546,7 @@ static enum xz_ret INIT dec_block_header(struct xz_dec *s)
 	return XZ_OK;
 }
 
-static enum xz_ret INIT dec_main(struct xz_dec *s, struct xz_buf *b)
+static enum xz_ret __init dec_main(struct xz_dec *s, struct xz_buf *b)
 {
 	enum xz_ret ret;
 
@@ -706,7 +706,7 @@ static enum xz_ret INIT dec_main(struct xz_dec *s, struct xz_buf *b)
 	/* Never reached */
 }
 
-XZ_EXTERN void INIT xz_dec_reset(struct xz_dec *s)
+XZ_EXTERN void __init xz_dec_reset(struct xz_dec *s)
 {
 	s->sequence = SEQ_STREAM_HEADER;
 	s->allow_buf_error = false;
@@ -743,7 +743,7 @@ XZ_EXTERN void INIT xz_dec_reset(struct xz_dec *s)
  * actually succeeds (that's the price to pay of using the output buffer as
  * the workspace).
  */
-XZ_EXTERN enum xz_ret INIT xz_dec_run(struct xz_dec *s, struct xz_buf *b)
+XZ_EXTERN enum xz_ret __init xz_dec_run(struct xz_dec *s, struct xz_buf *b)
 {
 	size_t in_start;
 	size_t out_start;
@@ -779,7 +779,7 @@ XZ_EXTERN enum xz_ret INIT xz_dec_run(struct xz_dec *s, struct xz_buf *b)
 	return ret;
 }
 
-XZ_EXTERN struct xz_dec *INIT xz_dec_init(enum xz_mode mode, uint32_t dict_max)
+XZ_EXTERN struct xz_dec *__init xz_dec_init(enum xz_mode mode, uint32_t dict_max)
 {
 	struct xz_dec *s = malloc(sizeof(*s));
 	if (s == NULL)
@@ -809,7 +809,7 @@ error_bcj:
 	return NULL;
 }
 
-XZ_EXTERN void INIT xz_dec_end(struct xz_dec *s)
+XZ_EXTERN void __init xz_dec_end(struct xz_dec *s)
 {
 	if (s != NULL) {
 		xz_dec_lzma2_end(s->lzma2);
diff --git a/xen/common/xz/lzma2.h b/xen/common/xz/lzma2.h
index 7df5f8ba68..e0ef42e880 100644
--- a/xen/common/xz/lzma2.h
+++ b/xen/common/xz/lzma2.h
@@ -61,7 +61,7 @@ enum lzma_state {
 #define LIT_STATES 7
 
 /* Indicate that the latest symbol was a literal. */
-static inline void INIT lzma_state_literal(enum lzma_state *state)
+static inline void __init lzma_state_literal(enum lzma_state *state)
 {
 	if (*state <= STATE_SHORTREP_LIT_LIT)
 		*state = STATE_LIT_LIT;
@@ -72,25 +72,25 @@ static inline void INIT lzma_state_literal(enum lzma_state *state)
 }
 
 /* Indicate that the latest symbol was a match. */
-static inline void INIT lzma_state_match(enum lzma_state *state)
+static inline void __init lzma_state_match(enum lzma_state *state)
 {
 	*state = *state < LIT_STATES ? STATE_LIT_MATCH : STATE_NONLIT_MATCH;
 }
 
 /* Indicate that the latest state was a long repeated match. */
-static inline void INIT lzma_state_long_rep(enum lzma_state *state)
+static inline void __init lzma_state_long_rep(enum lzma_state *state)
 {
 	*state = *state < LIT_STATES ? STATE_LIT_LONGREP : STATE_NONLIT_REP;
 }
 
 /* Indicate that the latest symbol was a short match. */
-static inline void INIT lzma_state_short_rep(enum lzma_state *state)
+static inline void __init lzma_state_short_rep(enum lzma_state *state)
 {
 	*state = *state < LIT_STATES ? STATE_LIT_SHORTREP : STATE_NONLIT_REP;
 }
 
 /* Test if the previous symbol was a literal. */
-static inline bool_t INIT lzma_state_is_literal(enum lzma_state state)
+static inline bool_t __init lzma_state_is_literal(enum lzma_state state)
 {
 	return state < LIT_STATES;
 }
@@ -144,7 +144,7 @@ static inline bool_t INIT lzma_state_is_literal(enum lzma_state state)
  * Get the index of the appropriate probability array for decoding
  * the distance slot.
  */
-static inline uint32_t INIT lzma_get_dist_state(uint32_t len)
+static inline uint32_t __init lzma_get_dist_state(uint32_t len)
 {
 	return len < DIST_STATES + MATCH_LEN_MIN
 			? len - MATCH_LEN_MIN : DIST_STATES - 1;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 17 22:33:55 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Apr 2021 22:33:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.112289.214418 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtVj-00021C-1R; Sat, 17 Apr 2021 22:33:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 112289.214418; Sat, 17 Apr 2021 22:33: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 1lXtVi-000214-Um; Sat, 17 Apr 2021 22:33:54 +0000
Received: by outflank-mailman (input) for mailman id 112289;
 Sat, 17 Apr 2021 22:33:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtVh-00020t-9k
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:33:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtVh-0005dF-8w
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:33:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtVh-0002nU-7t
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:33:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MmpcaQdolMDvKRAgxkHKqONA4T3Ih7QBDOm4XlB4OmM=; b=J13Yrcmr9JHLSeq01jEzypA4iN
	aAHRnDroMVEi4+unNGpZTO/nqj3kKftB6n7R7W4mCJt1BhIxEaXqZt80+q9+hof5RVJsrcsDarncN
	5No+ZGQD1KYlXEBK6ufdH0tnefM6NzEeFQdzPdRWVSCFQBI4UXWLmGyG/6d2NI0404AU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move muldiv64()
Message-Id: <E1lXtVh-0002nU-7t@xenbits.xenproject.org>
Date: Sat, 17 Apr 2021 22:33:53 +0000

commit b3de22dda782af06e625b513cc3cccb98c1635c6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 16 14:41:48 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 16 14:41:48 2021 +0200

    lib: move muldiv64()
    
    Make this a separate archive member under lib/. While doing so, don't
    move latently broken x86 assembly though: Fix the constraints, such
    that properly extending inputs to 64-bit won't just be a side effect of
    needing to copy registers, and such that we won't fail to clobber %rdx.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/common/lib.c   | 29 -----------------------------
 xen/lib/Makefile   |  1 +
 xen/lib/muldiv64.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 29 deletions(-)

diff --git a/xen/common/lib.c b/xen/common/lib.c
index f5ca179a0a..5b8f49153d 100644
--- a/xen/common/lib.c
+++ b/xen/common/lib.c
@@ -393,35 +393,6 @@ s64 __ldivmod_helper(s64 a, s64 b, s64 *r)
 }
 #endif /* BITS_PER_LONG == 32 */
 
-/* Compute with 96 bit intermediate result: (a*b)/c */
-uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c)
-{
-#ifdef CONFIG_X86
-    asm ( "mul %%rdx; div %%rcx" : "=a" (a) : "0" (a), "d" (b), "c" (c) );
-    return a;
-#else
-    union {
-        uint64_t ll;
-        struct {
-#ifdef WORDS_BIGENDIAN
-            uint32_t high, low;
-#else
-            uint32_t low, high;
-#endif            
-        } l;
-    } u, res;
-    uint64_t rl, rh;
-
-    u.ll = a;
-    rl = (uint64_t)u.l.low * (uint64_t)b;
-    rh = (uint64_t)u.l.high * (uint64_t)b;
-    rh += (rl >> 32);
-    res.l.high = rh / c;
-    res.l.low = (((rh % c) << 32) + (rl & 0xffffffff)) / c;
-    return res.ll;
-#endif
-}
-
 /*
  * Local variables:
  * mode: C
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 1c2227cbfc..0b274583ef 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -4,6 +4,7 @@ lib-y += bsearch.o
 lib-y += ctors.o
 lib-y += ctype.o
 lib-y += list-sort.o
+lib-y += muldiv64.o
 lib-y += parse-size.o
 lib-y += rbtree.o
 lib-y += sort.o
diff --git a/xen/lib/muldiv64.c b/xen/lib/muldiv64.c
new file mode 100644
index 0000000000..78177ce616
--- /dev/null
+++ b/xen/lib/muldiv64.c
@@ -0,0 +1,44 @@
+#include <xen/lib.h>
+
+/* Compute with 96 bit intermediate result: (a*b)/c */
+uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c)
+{
+#ifdef CONFIG_X86
+    asm ( "mulq %1; divq %2" : "+a" (a)
+                             : "rm" ((uint64_t)b), "rm" ((uint64_t)c)
+                             : "rdx" );
+
+    return a;
+#else
+    union {
+        uint64_t ll;
+        struct {
+#ifdef WORDS_BIGENDIAN
+            uint32_t high, low;
+#else
+            uint32_t low, high;
+#endif
+        } l;
+    } u, res;
+    uint64_t rl, rh;
+
+    u.ll = a;
+    rl = (uint64_t)u.l.low * (uint64_t)b;
+    rh = (uint64_t)u.l.high * (uint64_t)b;
+    rh += (rl >> 32);
+    res.l.high = rh / c;
+    res.l.low = (((rh % c) << 32) + (rl & 0xffffffff)) / c;
+
+    return res.ll;
+#endif
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 17 22:34:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Apr 2021 22:34:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.112290.214421 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtVt-00022c-3H; Sat, 17 Apr 2021 22:34:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 112290.214421; Sat, 17 Apr 2021 22:34:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtVt-00022U-03; Sat, 17 Apr 2021 22:34:05 +0000
Received: by outflank-mailman (input) for mailman id 112290;
 Sat, 17 Apr 2021 22:34:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtVr-00022H-DC
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:34:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtVr-0005df-CH
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:34:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtVr-0002oT-BR
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:34:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=t/7IhtOg6CAeEgJ5hUeoHB9gPzwiFpfK/kzmOTLwrqs=; b=VKd0z0TttTeJNPiivZhh/sGy1L
	xqZjihJ7Zp0Vizd5sh0MkITZl8UqbOOAej9vxjBjW4g+NnUzxlfrFqi4xGflmrcTpcoJmFfq6Z3zN
	cbSEQIqkarUQYOA5/TycsuPMPJ39gKaPSoPxuB16wQZtEccDKASbcVH0rcfCqSAM4YJM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move 64-bit div/mod compiler helpers
Message-Id: <E1lXtVr-0002oT-BR@xenbits.xenproject.org>
Date: Sat, 17 Apr 2021 22:34:03 +0000

commit 849db4945b8b166085751681ac8b4f5b7cefece0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 16 14:43:10 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 16 14:43:10 2021 +0200

    lib: move 64-bit div/mod compiler helpers
    
    These were built for 32-bit architectures only (the same code could,
    with some tweaking, sensibly be used to provide TI-mode helpers on
    64-bit arch-es) - retain this property, while still avoiding to have
    a CU without any contents at all. For this, Arm's CONFIG_64BIT gets
    generalized.
    
    Note that we imply "32-bit arch" to be the same as BITS_PER_LONG == 32,
    i.e. we aren't (not just here) prepared to have a 64-bit arch with
    BITS_PER_LONG == 32. Yet even if we supported such, likely the compiler
    would get away there without invoking these helpers, so the code would
    remain unused in practice.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/Kconfig     |   2 +
 xen/arch/arm/Kconfig |  12 +-
 xen/arch/x86/Kconfig |   1 +
 xen/common/Makefile  |   1 -
 xen/common/lib.c     | 404 ---------------------------------------------------
 xen/lib/Makefile     |   4 +
 xen/lib/divmod.c     | 402 ++++++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 412 insertions(+), 414 deletions(-)

diff --git a/xen/arch/Kconfig b/xen/arch/Kconfig
index d144d4c8d3..f16eb0df43 100644
--- a/xen/arch/Kconfig
+++ b/xen/arch/Kconfig
@@ -1,3 +1,5 @@
+config 64BIT
+	bool
 
 config NR_CPUS
 	int "Maximum number of CPUs"
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 330bbf6232..ecfa6822e4 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -1,17 +1,11 @@
-config 64BIT
-	bool
-	default "$(ARCH)" != "arm32"
-	help
-	  Say yes to build a 64-bit Xen
-	  Say no to build a 32-bit Xen
-
 config ARM_32
 	def_bool y
-	depends on !64BIT
+	depends on "$(ARCH)" = "arm32"
 
 config ARM_64
 	def_bool y
-	depends on 64BIT
+	depends on !ARM_32
+	select 64BIT
 	select HAS_FAST_MULTIPLY
 
 config ARM
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index cb401fa2e5..57776d5106 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -1,5 +1,6 @@
 config X86_64
 	def_bool y
+	select 64BIT
 
 config X86
 	def_bool y
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 71c1d466bd..e2a7e62d14 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -21,7 +21,6 @@ obj-y += kernel.o
 obj-y += keyhandler.o
 obj-$(CONFIG_KEXEC) += kexec.o
 obj-$(CONFIG_KEXEC) += kimage.o
-obj-y += lib.o
 obj-$(CONFIG_LIVEPATCH) += livepatch.o livepatch_elf.o
 obj-$(CONFIG_MEM_ACCESS) += mem_access.o
 obj-y += memory.o
diff --git a/xen/common/lib.c b/xen/common/lib.c
deleted file mode 100644
index 5b8f49153d..0000000000
--- a/xen/common/lib.c
+++ /dev/null
@@ -1,404 +0,0 @@
-#include <xen/lib.h>
-#include <xen/types.h>
-#include <asm/byteorder.h>
-
-/*
- * A couple of 64 bit operations ported from FreeBSD.
- * The code within the '#if BITS_PER_LONG == 32' block below, and no other
- * code in this file, is distributed under the following licensing terms
- * This is the modified '3-clause' BSD license with the obnoxious
- * advertising clause removed, as permitted by University of California.
- *
- * Copyright (c) 1992, 1993
- * The Regents of the University of California.  All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#if BITS_PER_LONG == 32
-
-/*
- * Depending on the desired operation, we view a `long long' (aka quad_t) in
- * one or more of the following formats.
- */
-union uu {
-    s64            q;              /* as a (signed) quad */
-    s64            uq;             /* as an unsigned quad */
-    long           sl[2];          /* as two signed longs */
-    unsigned long  ul[2];          /* as two unsigned longs */
-};
-
-#ifdef __BIG_ENDIAN
-#define _QUAD_HIGHWORD 0
-#define _QUAD_LOWWORD 1
-#else /* __LITTLE_ENDIAN */
-#define _QUAD_HIGHWORD 1
-#define _QUAD_LOWWORD 0
-#endif
-
-/*
- * Define high and low longwords.
- */
-#define H               _QUAD_HIGHWORD
-#define L               _QUAD_LOWWORD
-
-/*
- * Total number of bits in a quad_t and in the pieces that make it up.
- * These are used for shifting, and also below for halfword extraction
- * and assembly.
- */
-#define CHAR_BIT        8               /* number of bits in a char */
-#define QUAD_BITS       (sizeof(s64) * CHAR_BIT)
-#define LONG_BITS       (sizeof(long) * CHAR_BIT)
-#define HALF_BITS       (sizeof(long) * CHAR_BIT / 2)
-
-/*
- * Extract high and low shortwords from longword, and move low shortword of
- * longword to upper half of long, i.e., produce the upper longword of
- * ((quad_t)(x) << (number_of_bits_in_long/2)).  (`x' must actually be
- * unsigned long.)
- *
- * These are used in the multiply code, to split a longword into upper
- * and lower halves, and to reassemble a product as a quad_t, shifted left
- * (sizeof(long)*CHAR_BIT/2).
- */
-#define HHALF(x)        ((x) >> HALF_BITS)
-#define LHALF(x)        ((x) & ((1 << HALF_BITS) - 1))
-#define LHUP(x)         ((x) << HALF_BITS)
-
-/*
- * Multiprecision divide.  This algorithm is from Knuth vol. 2 (2nd ed),
- * section 4.3.1, pp. 257--259.
- */
-#define B (1 << HALF_BITS) /* digit base */
-
-/* Combine two `digits' to make a single two-digit number. */
-#define COMBINE(a, b) (((unsigned long)(a) << HALF_BITS) | (b))
-
-/* select a type for digits in base B */
-typedef unsigned long digit;
-
-/*
- * Shift p[0]..p[len] left `sh' bits, ignoring any bits that
- * `fall out' the left (there never will be any such anyway).
- * We may assume len >= 0.  NOTE THAT THIS WRITES len+1 DIGITS.
- */
-static void shl(register digit *p, register int len, register int sh)
-{
-    register int i;
-
-    for (i = 0; i < len; i++)
-        p[i] = LHALF(p[i] << sh) | (p[i + 1] >> (HALF_BITS - sh));
-    p[i] = LHALF(p[i] << sh);
-}
-
-/*
- * __qdivrem(u, v, rem) returns u/v and, optionally, sets *rem to u%v.
- *
- * We do this in base 2-sup-HALF_BITS, so that all intermediate products
- * fit within unsigned long.  As a consequence, the maximum length dividend
- * and divisor are 4 `digits' in this base (they are shorter if they have
- * leading zeros).
- */
-u64 __qdivrem(u64 uq, u64 vq, u64 *arq)
-{
-    union uu tmp;
-    digit *u, *v, *q;
-    register digit v1, v2;
-    unsigned long qhat, rhat, t;
-    int m, n, d, j, i;
-    digit uspace[5], vspace[5], qspace[5];
-
-    /*
-     * Take care of special cases: divide by zero, and u < v.
-     */
-    if (vq == 0) {
-        /* divide by zero. */
-        static volatile const unsigned int zero = 0;
-
-        tmp.ul[H] = tmp.ul[L] = 1 / zero;
-        if (arq)
-            *arq = uq;
-        return (tmp.q);
-    }
-    if (uq < vq) {
-        if (arq)
-            *arq = uq;
-        return (0);
-    }
-    u = &uspace[0];
-    v = &vspace[0];
-    q = &qspace[0];
-
-    /*
-     * Break dividend and divisor into digits in base B, then
-     * count leading zeros to determine m and n.  When done, we
-     * will have:
-     * u = (u[1]u[2]...u[m+n]) sub B
-     * v = (v[1]v[2]...v[n]) sub B
-     * v[1] != 0
-     * 1 < n <= 4 (if n = 1, we use a different division algorithm)
-     * m >= 0 (otherwise u < v, which we already checked)
-     * m + n = 4
-     * and thus
-     * m = 4 - n <= 2
-     */
-    tmp.uq = uq;
-    u[0] = 0;
-    u[1] = HHALF(tmp.ul[H]);
-    u[2] = LHALF(tmp.ul[H]);
-    u[3] = HHALF(tmp.ul[L]);
-    u[4] = LHALF(tmp.ul[L]);
-    tmp.uq = vq;
-    v[1] = HHALF(tmp.ul[H]);
-    v[2] = LHALF(tmp.ul[H]);
-    v[3] = HHALF(tmp.ul[L]);
-    v[4] = LHALF(tmp.ul[L]);
-    for (n = 4; v[1] == 0; v++) {
-        if (--n == 1) {
-            unsigned long rbj; /* r*B+u[j] (not root boy jim) */
-            digit q1, q2, q3, q4;
-
-            /*
-             * Change of plan, per exercise 16.
-             * r = 0;
-             * for j = 1..4:
-             *  q[j] = floor((r*B + u[j]) / v),
-             *  r = (r*B + u[j]) % v;
-             * We unroll this completely here.
-             */
-            t = v[2]; /* nonzero, by definition */
-            q1 = u[1] / t;
-            rbj = COMBINE(u[1] % t, u[2]);
-            q2 = rbj / t;
-            rbj = COMBINE(rbj % t, u[3]);
-            q3 = rbj / t;
-            rbj = COMBINE(rbj % t, u[4]);
-            q4 = rbj / t;
-            if (arq)
-                *arq = rbj % t;
-            tmp.ul[H] = COMBINE(q1, q2);
-            tmp.ul[L] = COMBINE(q3, q4);
-            return (tmp.q);
-        }
-    }
-
-    /*
-     * By adjusting q once we determine m, we can guarantee that
-     * there is a complete four-digit quotient at &qspace[1] when
-     * we finally stop.
-     */
-    for (m = 4 - n; u[1] == 0; u++)
-        m--;
-    for (i = 4 - m; --i >= 0;)
-        q[i] = 0;
-    q += 4 - m;
-
-    /*
-     * Here we run Program D, translated from MIX to C and acquiring
-     * a few minor changes.
-     *
-     * D1: choose multiplier 1 << d to ensure v[1] >= B/2.
-     */
-    d = 0;
-    for (t = v[1]; t < B / 2; t <<= 1)
-        d++;
-    if (d > 0) {
-        shl(&u[0], m + n, d);  /* u <<= d */
-        shl(&v[1], n - 1, d);  /* v <<= d */
-    }
-    /*
-     * D2: j = 0.
-     */
-    j = 0;
-    v1 = v[1]; /* for D3 -- note that v[1..n] are constant */
-    v2 = v[2]; /* for D3 */
-    do {
-        register digit uj0, uj1, uj2;
-
-        /*
-         * D3: Calculate qhat (\^q, in TeX notation).
-         * Let qhat = min((u[j]*B + u[j+1])/v[1], B-1), and
-         * let rhat = (u[j]*B + u[j+1]) mod v[1].
-         * While rhat < B and v[2]*qhat > rhat*B+u[j+2],
-         * decrement qhat and increase rhat correspondingly.
-         * Note that if rhat >= B, v[2]*qhat < rhat*B.
-         */
-        uj0 = u[j + 0]; /* for D3 only -- note that u[j+...] change */
-        uj1 = u[j + 1]; /* for D3 only */
-        uj2 = u[j + 2]; /* for D3 only */
-        if (uj0 == v1) {
-            qhat = B;
-            rhat = uj1;
-            goto qhat_too_big;
-        } else {
-            unsigned long nn = COMBINE(uj0, uj1);
-
-            qhat = nn / v1;
-            rhat = nn % v1;
-        }
-        while (v2 * qhat > COMBINE(rhat, uj2)) {
-        qhat_too_big:
-            qhat--;
-            if ((rhat += v1) >= B)
-                break;
-        }
-        /*
-         * D4: Multiply and subtract.
-         * The variable `t' holds any borrows across the loop.
-         * We split this up so that we do not require v[0] = 0,
-         * and to eliminate a final special case.
-         */
-        for (t = 0, i = n; i > 0; i--) {
-            t = u[i + j] - v[i] * qhat - t;
-            u[i + j] = LHALF(t);
-            t = (B - HHALF(t)) & (B - 1);
-        }
-        t = u[j] - t;
-        u[j] = LHALF(t);
-        /*
-         * D5: test remainder.
-         * There is a borrow if and only if HHALF(t) is nonzero;
-         * in that (rare) case, qhat was too large (by exactly 1).
-         * Fix it by adding v[1..n] to u[j..j+n].
-         */
-        if (HHALF(t)) {
-            qhat--;
-            for (t = 0, i = n; i > 0; i--) { /* D6: add back. */
-                t += u[i + j] + v[i];
-                u[i + j] = LHALF(t);
-                t = HHALF(t);
-            }
-            u[j] = LHALF(u[j] + t);
-        }
-        q[j] = qhat;
-    } while (++j <= m);  /* D7: loop on j. */
-
-    /*
-     * If caller wants the remainder, we have to calculate it as
-     * u[m..m+n] >> d (this is at most n digits and thus fits in
-     * u[m+1..m+n], but we may need more source digits).
-     */
-    if (arq) {
-        if (d) {
-            for (i = m + n; i > m; --i)
-                u[i] = (u[i] >> d) |
-                    LHALF(u[i - 1] << (HALF_BITS - d));
-            u[i] = 0;
-        }
-        tmp.ul[H] = COMBINE(uspace[1], uspace[2]);
-        tmp.ul[L] = COMBINE(uspace[3], uspace[4]);
-        *arq = tmp.q;
-    }
-
-    tmp.ul[H] = COMBINE(qspace[1], qspace[2]);
-    tmp.ul[L] = COMBINE(qspace[3], qspace[4]);
-    return (tmp.q);
-}
-
-/*
- * Divide two signed quads.
- * Truncates towards zero, as required by C99.
- */
-s64 __divdi3(s64 a, s64 b)
-{
-    u64 ua, ub, uq;
-    int neg = (a < 0) ^ (b < 0);
-    ua = (a < 0) ? -(u64)a : a;
-    ub = (b < 0) ? -(u64)b : b;
-    uq = __qdivrem(ua, ub, (u64 *)0);
-    return (neg ? -uq : uq);
-}
-
-
-/*
- * Divide two unsigned quads.
- */
-u64 __udivdi3(u64 a, u64 b)
-{
-    return __qdivrem(a, b, (u64 *)0);
-}
-
-/*
- * Remainder of unsigned quad division
- */
-u64 __umoddi3(u64 a, u64 b)
-{
-    u64 rem;
-    __qdivrem(a, b, &rem);
-    return rem;
-}
-
-/*
- * Remainder of signed quad division.
- * Truncates towards zero, as required by C99:
- *  11 %  5 =  1
- * -11 %  5 = -1
- *  11 % -5 =  1
- * -11 % -5 = -1
- */
-s64 __moddi3(s64 a, s64 b)
-{
-    u64 ua, ub, urem;
-    int neg = (a < 0);
-    ua = neg ? -(u64)a : a;
-    ub = (b < 0) ? -(u64)b : b;
-    __qdivrem(ua, ub, &urem);
-    return (neg ? -urem : urem);
-}
-
-/*
- * Quotient and remainder of unsigned long long division
- */
-s64 __ldivmod_helper(s64 a, s64 b, s64 *r)
-{
-    u64 ua, ub, rem, quot;
-
-    ua = ABS(a);
-    ub = ABS(b);
-    quot = __qdivrem(ua, ub, &rem);
-    if ( a < 0 )
-        *r = -rem;
-    else
-        *r = rem;
-    if ( (a < 0) ^ (b < 0) )
-        return -quot;
-    else
-        return quot;
-}
-#endif /* BITS_PER_LONG == 32 */
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 0b274583ef..a5dc1442a4 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -10,3 +10,7 @@ lib-y += rbtree.o
 lib-y += sort.o
 lib-$(CONFIG_X86) += xxhash32.o
 lib-$(CONFIG_X86) += xxhash64.o
+
+lib32-y := divmod.o
+lib32-$(CONFIG_64BIT) :=
+lib-y += $(lib32-y)
diff --git a/xen/lib/divmod.c b/xen/lib/divmod.c
new file mode 100644
index 0000000000..0be6ccc700
--- /dev/null
+++ b/xen/lib/divmod.c
@@ -0,0 +1,402 @@
+#include <xen/lib.h>
+#include <xen/types.h>
+#include <asm/byteorder.h>
+
+/*
+ * A couple of 64 bit operations ported from FreeBSD.
+ * The code within the '#if BITS_PER_LONG == 32' block below, and no other
+ * code in this file, is distributed under the following licensing terms
+ * This is the modified '3-clause' BSD license with the obnoxious
+ * advertising clause removed, as permitted by University of California.
+ *
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California.  All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Depending on the desired operation, we view a `long long' (aka quad_t) in
+ * one or more of the following formats.
+ */
+union uu {
+    s64            q;              /* as a (signed) quad */
+    s64            uq;             /* as an unsigned quad */
+    long           sl[2];          /* as two signed longs */
+    unsigned long  ul[2];          /* as two unsigned longs */
+};
+
+#ifdef __BIG_ENDIAN
+#define _QUAD_HIGHWORD 0
+#define _QUAD_LOWWORD 1
+#else /* __LITTLE_ENDIAN */
+#define _QUAD_HIGHWORD 1
+#define _QUAD_LOWWORD 0
+#endif
+
+/*
+ * Define high and low longwords.
+ */
+#define H               _QUAD_HIGHWORD
+#define L               _QUAD_LOWWORD
+
+/*
+ * Total number of bits in a quad_t and in the pieces that make it up.
+ * These are used for shifting, and also below for halfword extraction
+ * and assembly.
+ */
+#define CHAR_BIT        8               /* number of bits in a char */
+#define QUAD_BITS       (sizeof(s64) * CHAR_BIT)
+#define LONG_BITS       (sizeof(long) * CHAR_BIT)
+#define HALF_BITS       (sizeof(long) * CHAR_BIT / 2)
+
+/*
+ * Extract high and low shortwords from longword, and move low shortword of
+ * longword to upper half of long, i.e., produce the upper longword of
+ * ((quad_t)(x) << (number_of_bits_in_long/2)).  (`x' must actually be
+ * unsigned long.)
+ *
+ * These are used in the multiply code, to split a longword into upper
+ * and lower halves, and to reassemble a product as a quad_t, shifted left
+ * (sizeof(long)*CHAR_BIT/2).
+ */
+#define HHALF(x)        ((x) >> HALF_BITS)
+#define LHALF(x)        ((x) & ((1 << HALF_BITS) - 1))
+#define LHUP(x)         ((x) << HALF_BITS)
+
+/*
+ * Multiprecision divide.  This algorithm is from Knuth vol. 2 (2nd ed),
+ * section 4.3.1, pp. 257--259.
+ */
+#define B (1 << HALF_BITS) /* digit base */
+
+/* Combine two `digits' to make a single two-digit number. */
+#define COMBINE(a, b) (((unsigned long)(a) << HALF_BITS) | (b))
+
+/* select a type for digits in base B */
+typedef unsigned long digit;
+
+/*
+ * Shift p[0]..p[len] left `sh' bits, ignoring any bits that
+ * `fall out' the left (there never will be any such anyway).
+ * We may assume len >= 0.  NOTE THAT THIS WRITES len+1 DIGITS.
+ */
+static void shl(register digit *p, register int len, register int sh)
+{
+    register int i;
+
+    for (i = 0; i < len; i++)
+        p[i] = LHALF(p[i] << sh) | (p[i + 1] >> (HALF_BITS - sh));
+    p[i] = LHALF(p[i] << sh);
+}
+
+/*
+ * __qdivrem(u, v, rem) returns u/v and, optionally, sets *rem to u%v.
+ *
+ * We do this in base 2-sup-HALF_BITS, so that all intermediate products
+ * fit within unsigned long.  As a consequence, the maximum length dividend
+ * and divisor are 4 `digits' in this base (they are shorter if they have
+ * leading zeros).
+ */
+u64 __qdivrem(u64 uq, u64 vq, u64 *arq)
+{
+    union uu tmp;
+    digit *u, *v, *q;
+    register digit v1, v2;
+    unsigned long qhat, rhat, t;
+    int m, n, d, j, i;
+    digit uspace[5], vspace[5], qspace[5];
+
+    /*
+     * Take care of special cases: divide by zero, and u < v.
+     */
+    if (vq == 0) {
+        /* divide by zero. */
+        static volatile const unsigned int zero = 0;
+
+        tmp.ul[H] = tmp.ul[L] = 1 / zero;
+        if (arq)
+            *arq = uq;
+        return (tmp.q);
+    }
+    if (uq < vq) {
+        if (arq)
+            *arq = uq;
+        return (0);
+    }
+    u = &uspace[0];
+    v = &vspace[0];
+    q = &qspace[0];
+
+    /*
+     * Break dividend and divisor into digits in base B, then
+     * count leading zeros to determine m and n.  When done, we
+     * will have:
+     * u = (u[1]u[2]...u[m+n]) sub B
+     * v = (v[1]v[2]...v[n]) sub B
+     * v[1] != 0
+     * 1 < n <= 4 (if n = 1, we use a different division algorithm)
+     * m >= 0 (otherwise u < v, which we already checked)
+     * m + n = 4
+     * and thus
+     * m = 4 - n <= 2
+     */
+    tmp.uq = uq;
+    u[0] = 0;
+    u[1] = HHALF(tmp.ul[H]);
+    u[2] = LHALF(tmp.ul[H]);
+    u[3] = HHALF(tmp.ul[L]);
+    u[4] = LHALF(tmp.ul[L]);
+    tmp.uq = vq;
+    v[1] = HHALF(tmp.ul[H]);
+    v[2] = LHALF(tmp.ul[H]);
+    v[3] = HHALF(tmp.ul[L]);
+    v[4] = LHALF(tmp.ul[L]);
+    for (n = 4; v[1] == 0; v++) {
+        if (--n == 1) {
+            unsigned long rbj; /* r*B+u[j] (not root boy jim) */
+            digit q1, q2, q3, q4;
+
+            /*
+             * Change of plan, per exercise 16.
+             * r = 0;
+             * for j = 1..4:
+             *  q[j] = floor((r*B + u[j]) / v),
+             *  r = (r*B + u[j]) % v;
+             * We unroll this completely here.
+             */
+            t = v[2]; /* nonzero, by definition */
+            q1 = u[1] / t;
+            rbj = COMBINE(u[1] % t, u[2]);
+            q2 = rbj / t;
+            rbj = COMBINE(rbj % t, u[3]);
+            q3 = rbj / t;
+            rbj = COMBINE(rbj % t, u[4]);
+            q4 = rbj / t;
+            if (arq)
+                *arq = rbj % t;
+            tmp.ul[H] = COMBINE(q1, q2);
+            tmp.ul[L] = COMBINE(q3, q4);
+            return (tmp.q);
+        }
+    }
+
+    /*
+     * By adjusting q once we determine m, we can guarantee that
+     * there is a complete four-digit quotient at &qspace[1] when
+     * we finally stop.
+     */
+    for (m = 4 - n; u[1] == 0; u++)
+        m--;
+    for (i = 4 - m; --i >= 0;)
+        q[i] = 0;
+    q += 4 - m;
+
+    /*
+     * Here we run Program D, translated from MIX to C and acquiring
+     * a few minor changes.
+     *
+     * D1: choose multiplier 1 << d to ensure v[1] >= B/2.
+     */
+    d = 0;
+    for (t = v[1]; t < B / 2; t <<= 1)
+        d++;
+    if (d > 0) {
+        shl(&u[0], m + n, d);  /* u <<= d */
+        shl(&v[1], n - 1, d);  /* v <<= d */
+    }
+    /*
+     * D2: j = 0.
+     */
+    j = 0;
+    v1 = v[1]; /* for D3 -- note that v[1..n] are constant */
+    v2 = v[2]; /* for D3 */
+    do {
+        register digit uj0, uj1, uj2;
+
+        /*
+         * D3: Calculate qhat (\^q, in TeX notation).
+         * Let qhat = min((u[j]*B + u[j+1])/v[1], B-1), and
+         * let rhat = (u[j]*B + u[j+1]) mod v[1].
+         * While rhat < B and v[2]*qhat > rhat*B+u[j+2],
+         * decrement qhat and increase rhat correspondingly.
+         * Note that if rhat >= B, v[2]*qhat < rhat*B.
+         */
+        uj0 = u[j + 0]; /* for D3 only -- note that u[j+...] change */
+        uj1 = u[j + 1]; /* for D3 only */
+        uj2 = u[j + 2]; /* for D3 only */
+        if (uj0 == v1) {
+            qhat = B;
+            rhat = uj1;
+            goto qhat_too_big;
+        } else {
+            unsigned long nn = COMBINE(uj0, uj1);
+
+            qhat = nn / v1;
+            rhat = nn % v1;
+        }
+        while (v2 * qhat > COMBINE(rhat, uj2)) {
+        qhat_too_big:
+            qhat--;
+            if ((rhat += v1) >= B)
+                break;
+        }
+        /*
+         * D4: Multiply and subtract.
+         * The variable `t' holds any borrows across the loop.
+         * We split this up so that we do not require v[0] = 0,
+         * and to eliminate a final special case.
+         */
+        for (t = 0, i = n; i > 0; i--) {
+            t = u[i + j] - v[i] * qhat - t;
+            u[i + j] = LHALF(t);
+            t = (B - HHALF(t)) & (B - 1);
+        }
+        t = u[j] - t;
+        u[j] = LHALF(t);
+        /*
+         * D5: test remainder.
+         * There is a borrow if and only if HHALF(t) is nonzero;
+         * in that (rare) case, qhat was too large (by exactly 1).
+         * Fix it by adding v[1..n] to u[j..j+n].
+         */
+        if (HHALF(t)) {
+            qhat--;
+            for (t = 0, i = n; i > 0; i--) { /* D6: add back. */
+                t += u[i + j] + v[i];
+                u[i + j] = LHALF(t);
+                t = HHALF(t);
+            }
+            u[j] = LHALF(u[j] + t);
+        }
+        q[j] = qhat;
+    } while (++j <= m);  /* D7: loop on j. */
+
+    /*
+     * If caller wants the remainder, we have to calculate it as
+     * u[m..m+n] >> d (this is at most n digits and thus fits in
+     * u[m+1..m+n], but we may need more source digits).
+     */
+    if (arq) {
+        if (d) {
+            for (i = m + n; i > m; --i)
+                u[i] = (u[i] >> d) |
+                    LHALF(u[i - 1] << (HALF_BITS - d));
+            u[i] = 0;
+        }
+        tmp.ul[H] = COMBINE(uspace[1], uspace[2]);
+        tmp.ul[L] = COMBINE(uspace[3], uspace[4]);
+        *arq = tmp.q;
+    }
+
+    tmp.ul[H] = COMBINE(qspace[1], qspace[2]);
+    tmp.ul[L] = COMBINE(qspace[3], qspace[4]);
+    return (tmp.q);
+}
+
+/*
+ * Divide two signed quads.
+ * Truncates towards zero, as required by C99.
+ */
+s64 __divdi3(s64 a, s64 b)
+{
+    u64 ua, ub, uq;
+    int neg = (a < 0) ^ (b < 0);
+    ua = (a < 0) ? -(u64)a : a;
+    ub = (b < 0) ? -(u64)b : b;
+    uq = __qdivrem(ua, ub, (u64 *)0);
+    return (neg ? -uq : uq);
+}
+
+
+/*
+ * Divide two unsigned quads.
+ */
+u64 __udivdi3(u64 a, u64 b)
+{
+    return __qdivrem(a, b, (u64 *)0);
+}
+
+/*
+ * Remainder of unsigned quad division
+ */
+u64 __umoddi3(u64 a, u64 b)
+{
+    u64 rem;
+    __qdivrem(a, b, &rem);
+    return rem;
+}
+
+/*
+ * Remainder of signed quad division.
+ * Truncates towards zero, as required by C99:
+ *  11 %  5 =  1
+ * -11 %  5 = -1
+ *  11 % -5 =  1
+ * -11 % -5 = -1
+ */
+s64 __moddi3(s64 a, s64 b)
+{
+    u64 ua, ub, urem;
+    int neg = (a < 0);
+    ua = neg ? -(u64)a : a;
+    ub = (b < 0) ? -(u64)b : b;
+    __qdivrem(ua, ub, &urem);
+    return (neg ? -urem : urem);
+}
+
+/*
+ * Quotient and remainder of unsigned long long division
+ */
+s64 __ldivmod_helper(s64 a, s64 b, s64 *r)
+{
+    u64 ua, ub, rem, quot;
+
+    ua = ABS(a);
+    ub = ABS(b);
+    quot = __qdivrem(ua, ub, &rem);
+    if ( a < 0 )
+        *r = -rem;
+    else
+        *r = rem;
+    if ( (a < 0) ^ (b < 0) )
+        return -quot;
+    else
+        return quot;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 17 22:34:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Apr 2021 22:34:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.112291.214425 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtW2-00024A-6U; Sat, 17 Apr 2021 22:34:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 112291.214425; Sat, 17 Apr 2021 22:34:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtW2-000242-3V; Sat, 17 Apr 2021 22:34:14 +0000
Received: by outflank-mailman (input) for mailman id 112291;
 Sat, 17 Apr 2021 22:34:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtW1-00023x-Ht
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:34:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtW1-0005dl-GU
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:34:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtW1-0002pe-Eo
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:34:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fR46AVipPp5UF7Pd1ggI0CS+meJWco/YnhvmVxdxkR4=; b=RhTsWDvear7/q7MwzwCrK0tkd7
	3cvF5+DSFwNknT9ghUEwmBbiufx6n2/FY6YCr1dB+sjs1FUy2+/GBjfWLQSnCJkETmoxB89uI7TM9
	EDiazIpG53umx2WXg2JgF72TF1VsqiSzqP8UoelejOm+7v2rpt60j68oDvUjisp25DqM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] string: drop redundant declarations
Message-Id: <E1lXtW1-0002pe-Eo@xenbits.xenproject.org>
Date: Sat, 17 Apr 2021 22:34:13 +0000

commit 9b47be876f2a9521bb1f247d855603c00bc99465
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 16 14:44:01 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 16 14:44:01 2021 +0200

    string: drop redundant declarations
    
    These standard functions shouldn't need custom declarations. The only
    case where redundancy might be needed is if there were inline functions
    there. But we don't have any here (anymore). Prune the per-arch headers
    of duplicate declarations while moving the asm/string.h inclusion past
    the declarations.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/include/asm-arm/string.h | 20 --------------
 xen/include/asm-x86/string.h |  3 --
 xen/include/xen/string.h     | 66 ++++++++++++++------------------------------
 3 files changed, 21 insertions(+), 68 deletions(-)

diff --git a/xen/include/asm-arm/string.h b/xen/include/asm-arm/string.h
index 1804c3c0bc..b485e49044 100644
--- a/xen/include/asm-arm/string.h
+++ b/xen/include/asm-arm/string.h
@@ -8,41 +8,21 @@
  */
 
 #define __HAVE_ARCH_STRRCHR
-char *strrchr(const char *s, int c);
-
 #define __HAVE_ARCH_STRCHR
-char *strchr(const char *s, int c);
-
 #if defined(CONFIG_ARM_64)
 #define __HAVE_ARCH_STRCMP
-int strcmp(const char *, const char *);
-
 #define __HAVE_ARCH_STRNCMP
-int strncmp(const char *, const char *, size_t);
-
 #define __HAVE_ARCH_STRLEN
-size_t strlen(const char *);
-
 #define __HAVE_ARCH_STRNLEN
-size_t strnlen(const char *, size_t);
 #endif
 
 #define __HAVE_ARCH_MEMCPY
-void *memcpy(void *, const void *, size_t);
-
 #if defined(CONFIG_ARM_64)
 #define __HAVE_ARCH_MEMCMP
-int memcmp(const void *, const void *, size_t);
 #endif
-
 #define __HAVE_ARCH_MEMMOVE
-void *memmove(void *dest, const void *src, size_t n);
-
 #define __HAVE_ARCH_MEMSET
-void *memset(void *, int, size_t);
-
 #define __HAVE_ARCH_MEMCHR
-void *memchr(const void *, int, size_t);
 
 #if defined(CONFIG_ARM_32)
 
diff --git a/xen/include/asm-x86/string.h b/xen/include/asm-x86/string.h
index 6f3c960f05..4f1e1d4daf 100644
--- a/xen/include/asm-x86/string.h
+++ b/xen/include/asm-x86/string.h
@@ -2,15 +2,12 @@
 #define __X86_STRING_H__
 
 #define __HAVE_ARCH_MEMCPY
-void *memcpy(void *dest, const void *src, size_t n);
 #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
 
 #define __HAVE_ARCH_MEMMOVE
-void *memmove(void *dest, const void *src, size_t n);
 #define memmove(d, s, n) __builtin_memmove(d, s, n)
 
 #define __HAVE_ARCH_MEMSET
-void *memset(void *dest, int c, size_t n);
 #define memset(s, c, n) __builtin_memset(s, c, n)
 
 #endif /* __X86_STRING_H__ */
diff --git a/xen/include/xen/string.h b/xen/include/xen/string.h
index 4b3b57e74f..4f438b018a 100644
--- a/xen/include/xen/string.h
+++ b/xen/include/xen/string.h
@@ -3,11 +3,6 @@
 
 #include <xen/types.h>	/* for size_t */
 
-/*
- * Include machine specific inline routines
- */
-#include <asm/string.h>
-
 /*
  * These string functions are considered too dangerous for normal use.
  * Use safe_strcpy(), safe_strcat(), strlcpy(), strlcat() as appropriate.
@@ -17,97 +12,78 @@
 #define strncpy __xen_has_no_strncpy__
 #define strncat __xen_has_no_strncat__
 
-#ifndef __HAVE_ARCH_STRLCPY
 size_t strlcpy(char *, const char *, size_t);
-#endif
-
-#ifndef __HAVE_ARCH_STRLCAT
 size_t strlcat(char *, const char *, size_t);
-#endif
+int strcmp(const char *, const char *);
+int strncmp(const char *, const char *, size_t);
+int strnicmp(const char *, const char *, size_t);
+int strcasecmp(const char *, const char *);
+char *strchr(const char *, int);
+char *strrchr(const char *, int);
+char *strstr(const char *, const char *);
+size_t strlen(const char *);
+size_t strnlen(const char *, size_t);
+char *strpbrk(const char *, const char *);
+char *strsep(char **, const char *);
+size_t strspn(const char *, const char *);
+
+void *memset(void *, int, size_t);
+void *memcpy(void *, const void *, size_t);
+void *memmove(void *, const void *, size_t);
+int memcmp(const void *, const void *, size_t);
+void *memchr(const void *, int, size_t);
+void *memchr_inv(const void *, int, size_t);
+
+#include <asm/string.h>
 
 #ifndef __HAVE_ARCH_STRCMP
-int strcmp(const char *, const char *);
 #define strcmp(s1, s2) __builtin_strcmp(s1, s2)
 #endif
 
 #ifndef __HAVE_ARCH_STRNCMP
-int strncmp(const char *, const char *, size_t);
 #define strncmp(s1, s2, n) __builtin_strncmp(s1, s2, n)
 #endif
 
-#ifndef __HAVE_ARCH_STRNICMP
-int strnicmp(const char *, const char *, size_t);
-#endif
-
 #ifndef __HAVE_ARCH_STRCASECMP
-int strcasecmp(const char *, const char *);
 #define strcasecmp(s1, s2) __builtin_strcasecmp(s1, s2)
 #endif
 
 #ifndef __HAVE_ARCH_STRCHR
-char *strchr(const char *, int);
 #define strchr(s1, c) __builtin_strchr(s1, c)
 #endif
 
 #ifndef __HAVE_ARCH_STRRCHR
-char *strrchr(const char *, int);
 #define strrchr(s1, c) __builtin_strrchr(s1, c)
 #endif
 
 #ifndef __HAVE_ARCH_STRSTR
-char *strstr(const char *, const char *);
 #define strstr(s1, s2) __builtin_strstr(s1, s2)
 #endif
 
 #ifndef __HAVE_ARCH_STRLEN
-size_t strlen(const char *);
 #define strlen(s1) __builtin_strlen(s1)
 #endif
 
-#ifndef __HAVE_ARCH_STRNLEN
-size_t strnlen(const char *, size_t);
-#endif
-
-#ifndef __HAVE_ARCH_STRPBRK
-char *strpbrk(const char *, const char *);
-#endif
-
-#ifndef __HAVE_ARCH_STRSEP
-char *strsep(char **, const char *);
-#endif
-
-#ifndef __HAVE_ARCH_STRSPN
-size_t strspn(const char *, const char *);
-#endif
-
-
 #ifndef __HAVE_ARCH_MEMSET
-void *memset(void *, int, size_t);
 #define memset(s, c, n) __builtin_memset(s, c, n)
 #endif
 
 #ifndef __HAVE_ARCH_MEMCPY
-void *memcpy(void *, const void *, size_t);
 #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
 #endif
 
 #ifndef __HAVE_ARCH_MEMMOVE
-void *memmove(void *, const void *, size_t);
 #define memmove(d, s, n) __builtin_memmove(d, s, n)
 #endif
 
 #ifndef __HAVE_ARCH_MEMCMP
-int memcmp(const void *, const void *, size_t);
 #define memcmp(s1, s2, n) __builtin_memcmp(s1, s2, n)
 #endif
 
 #ifndef __HAVE_ARCH_MEMCHR
-void *memchr(const void *, int, size_t);
 #define memchr(s, c, n) __builtin_memchr(s, c, n)
 #endif
 
-void *memchr_inv(const void *, int, size_t);
-
 #define is_char_array(x) __builtin_types_compatible_p(typeof(x), char[])
 
 /* safe_xxx always NUL-terminates and returns !=0 if result is truncated. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 17 22:34:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Apr 2021 22:34:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.112292.214430 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtWC-00025b-85; Sat, 17 Apr 2021 22:34:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 112292.214430; Sat, 17 Apr 2021 22:34:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtWC-00025T-52; Sat, 17 Apr 2021 22:34:24 +0000
Received: by outflank-mailman (input) for mailman id 112292;
 Sat, 17 Apr 2021 22:34:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtWB-00025M-Kl
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:34:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtWB-0005eE-Jr
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:34:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtWB-0002qm-J0
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:34:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7CnDwoKvHWnQxvK96esyCFMFbz1N8BRGekFp1How904=; b=PmQvH4nit965hftFKETt/39gfF
	1JmEkRSZDg65ErIKQluIDjR4tHMbS56BhmTlZwHNfHRlY4Rdh1UBGgRaglKBMWGKFn4IeAUDMRH2o
	S3QN0siM8wszXbxvidxmURiqAUotizuaf1TNkmMXLuU2HQ95IpAbBVo9TWDyi1o0kLaU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pv: Improve dom0_update_physmap() with CONFIG_SPECULATIVE_HARDEN_BRANCH
Message-Id: <E1lXtWB-0002qm-J0@xenbits.xenproject.org>
Date: Sat, 17 Apr 2021 22:34:23 +0000

commit 97f9861b8f22aaa28cb1f4588f2e6fc9b173ec90
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 29 19:53:28 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Apr 16 14:43:28 2021 +0100

    x86/pv: Improve dom0_update_physmap() with CONFIG_SPECULATIVE_HARDEN_BRANCH
    
    dom0_update_physmap() is mostly called in two tight loops, where the lfences
    hidden in is_pv_32bit_domain() have a substantial impact.
    
    None of the boot time construction needs protection against malicious
    speculation, so use a local variable and calculate is_pv_32bit_domain() just
    once.
    
    Reformat the some of the code for legibility, now that the volume has reduced,
    and removal of some gratuitous negations.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/dom0_build.c     | 52 +++++++++++++++++++---------------------
 xen/arch/x86/pv/shim.c           |  6 +++--
 xen/include/asm-x86/dom0_build.h |  2 +-
 3 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 265f56a3f8..e0801a9e6d 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -31,10 +31,10 @@
 #define L3_PROT (BASE_PROT|_PAGE_DIRTY)
 #define L4_PROT (BASE_PROT|_PAGE_DIRTY)
 
-void __init dom0_update_physmap(struct domain *d, unsigned long pfn,
+void __init dom0_update_physmap(bool compat, unsigned long pfn,
                                 unsigned long mfn, unsigned long vphysmap_s)
 {
-    if ( !is_pv_32bit_domain(d) )
+    if ( !compat )
         ((unsigned long *)vphysmap_s)[pfn] = mfn;
     else
         ((unsigned int *)vphysmap_s)[pfn] = mfn;
@@ -289,7 +289,7 @@ int __init dom0_construct_pv(struct domain *d,
                              char *cmdline)
 {
     int i, rc, order, machine;
-    bool compatible;
+    bool compatible, compat;
     struct cpu_user_regs *regs;
     unsigned long pfn, mfn;
     unsigned long nr_pages;
@@ -380,6 +380,8 @@ int __init dom0_construct_pv(struct domain *d,
     }
 #endif
 
+    compat = is_pv_32bit_domain(d);
+
     if ( elf_64bit(&elf) && machine == EM_X86_64 )
         compatible = true;
 
@@ -463,9 +465,9 @@ int __init dom0_construct_pv(struct domain *d,
         vinitrd_end    = vinitrd_start + initrd_len;
         vphysmap_start = round_pgup(vinitrd_end);
     }
-    vphysmap_end     = vphysmap_start + (nr_pages * (!is_pv_32bit_domain(d) ?
-                                                     sizeof(unsigned long) :
-                                                     sizeof(unsigned int)));
+
+    vphysmap_end = vphysmap_start +
+        (nr_pages * (compat ? sizeof(unsigned int) : sizeof(unsigned long)));
     if ( parms.p2m_base != UNSET_ADDR )
         vphysmap_end = vphysmap_start;
     vstartinfo_start = round_pgup(vphysmap_end);
@@ -496,9 +498,9 @@ int __init dom0_construct_pv(struct domain *d,
 #define NR(_l,_h,_s) \
     (((((_h) + ((1UL<<(_s))-1)) & ~((1UL<<(_s))-1)) - \
        ((_l) & ~((1UL<<(_s))-1))) >> (_s))
-        if ( (!is_pv_32bit_domain(d) + /* # L4 */
+        if ( (!compat + /* # L4 */
               NR(v_start, v_end, L4_PAGETABLE_SHIFT) + /* # L3 */
-              (!is_pv_32bit_domain(d) ?
+              (!compat ?
                NR(v_start, v_end, L3_PAGETABLE_SHIFT) : /* # L2 */
                4) + /* # compat L2 */
               NR(v_start, v_end, L2_PAGETABLE_SHIFT))  /* # L1 */
@@ -600,23 +602,22 @@ int __init dom0_construct_pv(struct domain *d,
         mpt_alloc -= PAGE_ALIGN(initrd_len);
 
     /* Overlap with Xen protected area? */
-    if ( !is_pv_32bit_domain(d) ?
-         ((v_start < HYPERVISOR_VIRT_END) &&
-          (v_end > HYPERVISOR_VIRT_START)) :
-         (v_end > HYPERVISOR_COMPAT_VIRT_START(d)) )
+    if ( compat
+         ? v_end > HYPERVISOR_COMPAT_VIRT_START(d)
+         : (v_start < HYPERVISOR_VIRT_END) && (v_end > HYPERVISOR_VIRT_START) )
     {
         printk("DOM0 image overlaps with Xen private area.\n");
         rc = -EINVAL;
         goto out;
     }
 
-    if ( is_pv_32bit_domain(d) )
+    if ( compat )
     {
         v->arch.pv.failsafe_callback_cs = FLAT_COMPAT_KERNEL_CS;
         v->arch.pv.event_callback_cs    = FLAT_COMPAT_KERNEL_CS;
     }
 
-    if ( !is_pv_32bit_domain(d) )
+    if ( !compat )
     {
         maddr_to_page(mpt_alloc)->u.inuse.type_info = PGT_l4_page_table;
         l4start = l4tab = __va(mpt_alloc); mpt_alloc += PAGE_SIZE;
@@ -677,8 +678,7 @@ int __init dom0_construct_pv(struct domain *d,
             mfn = pfn++;
         else
             mfn = initrd_mfn++;
-        *l1tab = l1e_from_pfn(mfn, (!is_pv_32bit_domain(d) ?
-                                    L1_PROT : COMPAT_L1_PROT));
+        *l1tab = l1e_from_pfn(mfn, compat ? COMPAT_L1_PROT : L1_PROT);
         l1tab++;
 
         page = mfn_to_page(_mfn(mfn));
@@ -687,7 +687,7 @@ int __init dom0_construct_pv(struct domain *d,
             BUG();
     }
 
-    if ( is_pv_32bit_domain(d) )
+    if ( compat )
     {
         l2_pgentry_t *l2t;
 
@@ -806,7 +806,7 @@ int __init dom0_construct_pv(struct domain *d,
         if ( pfn > REVERSE_START && (vinitrd_start || pfn < initrd_pfn) )
             mfn = alloc_epfn - (pfn - REVERSE_START);
 #endif
-        dom0_update_physmap(d, pfn, mfn, vphysmap_start);
+        dom0_update_physmap(compat, pfn, mfn, vphysmap_start);
         if ( !(pfn & 0xfffff) )
             process_pending_softirqs();
     }
@@ -818,12 +818,12 @@ int __init dom0_construct_pv(struct domain *d,
         BUG_ON(SHARED_M2P(get_gpfn_from_mfn(mfn)));
         if ( get_gpfn_from_mfn(mfn) >= count )
         {
-            BUG_ON(is_pv_32bit_domain(d));
+            BUG_ON(compat);
             if ( !page->u.inuse.type_info &&
                  !get_page_and_type(page, d, PGT_writable_page) )
                 BUG();
 
-            dom0_update_physmap(d, pfn, mfn, vphysmap_start);
+            dom0_update_physmap(compat, pfn, mfn, vphysmap_start);
             ++pfn;
             if ( !(pfn & 0xfffff) )
                 process_pending_softirqs();
@@ -843,7 +843,7 @@ int __init dom0_construct_pv(struct domain *d,
 #ifndef NDEBUG
 #define pfn (nr_pages - 1 - (pfn - (alloc_epfn - alloc_spfn)))
 #endif
-            dom0_update_physmap(d, pfn, mfn, vphysmap_start);
+            dom0_update_physmap(compat, pfn, mfn, vphysmap_start);
 #undef pfn
             page++; pfn++;
             if ( !(pfn & 0xfffff) )
@@ -878,7 +878,7 @@ int __init dom0_construct_pv(struct domain *d,
                           vphysmap_start, si);
 
 #ifdef CONFIG_COMPAT
-    if ( is_pv_32bit_domain(d) )
+    if ( compat )
         xlat_start_info(si, pv_shim ? XLAT_start_info_console_domU
                                     : XLAT_start_info_console_dom0);
 #endif
@@ -899,11 +899,9 @@ int __init dom0_construct_pv(struct domain *d,
      */
     regs = &v->arch.user_regs;
     regs->ds = regs->es = regs->fs = regs->gs =
-        !is_pv_32bit_domain(d) ? FLAT_KERNEL_DS : FLAT_COMPAT_KERNEL_DS;
-    regs->ss = (!is_pv_32bit_domain(d) ?
-                FLAT_KERNEL_SS : FLAT_COMPAT_KERNEL_SS);
-    regs->cs = (!is_pv_32bit_domain(d) ?
-                FLAT_KERNEL_CS : FLAT_COMPAT_KERNEL_CS);
+               (compat ? FLAT_COMPAT_KERNEL_DS : FLAT_KERNEL_DS);
+    regs->ss = (compat ? FLAT_COMPAT_KERNEL_SS : FLAT_KERNEL_SS);
+    regs->cs = (compat ? FLAT_COMPAT_KERNEL_CS : FLAT_KERNEL_CS);
     regs->rip = parms.virt_entry;
     regs->rsp = vstack_end;
     regs->rsi = vstartinfo_start;
diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index 92cb1adeed..1b86fc247e 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -204,6 +204,7 @@ void __init pv_shim_setup_dom(struct domain *d, l4_pgentry_t *l4start,
                               unsigned long console_va, unsigned long vphysmap,
                               start_info_t *si)
 {
+    bool compat = is_pv_32bit_domain(d);
     hypercall_table_t *rw_pv_hypercall_table;
     uint64_t param = 0;
     long rc;
@@ -217,7 +218,8 @@ void __init pv_shim_setup_dom(struct domain *d, l4_pgentry_t *l4start,
     {                                                                          \
         share_xen_page_with_guest(mfn_to_page(_mfn(param)), d, SHARE_rw);      \
         replace_va_mapping(d, l4start, va, _mfn(param));                       \
-        dom0_update_physmap(d, PFN_DOWN((va) - va_start), param, vphysmap);    \
+        dom0_update_physmap(compat,                                            \
+                            PFN_DOWN((va) - va_start), param, vphysmap);       \
     }                                                                          \
     else                                                                       \
     {                                                                          \
@@ -244,7 +246,7 @@ void __init pv_shim_setup_dom(struct domain *d, l4_pgentry_t *l4start,
         si->console.domU.mfn = mfn_x(console_mfn);
         share_xen_page_with_guest(mfn_to_page(console_mfn), d, SHARE_rw);
         replace_va_mapping(d, l4start, console_va, console_mfn);
-        dom0_update_physmap(d, (console_va - va_start) >> PAGE_SHIFT,
+        dom0_update_physmap(compat, (console_va - va_start) >> PAGE_SHIFT,
                             mfn_x(console_mfn), vphysmap);
         consoled_set_ring_addr(page);
     }
diff --git a/xen/include/asm-x86/dom0_build.h b/xen/include/asm-x86/dom0_build.h
index 0b797b5806..a5f8c9e67f 100644
--- a/xen/include/asm-x86/dom0_build.h
+++ b/xen/include/asm-x86/dom0_build.h
@@ -26,7 +26,7 @@ int dom0_construct_pvh(struct domain *d, const module_t *image,
 unsigned long dom0_paging_pages(const struct domain *d,
                                 unsigned long nr_pages);
 
-void dom0_update_physmap(struct domain *d, unsigned long pfn,
+void dom0_update_physmap(bool compat, unsigned long pfn,
                          unsigned long mfn, unsigned long vphysmap_s);
 
 #endif	/* _DOM0_BUILD_H_ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 17 22:34:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Apr 2021 22:34:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.112293.214434 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtWM-00026x-9m; Sat, 17 Apr 2021 22:34:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 112293.214434; Sat, 17 Apr 2021 22:34:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lXtWM-00026n-6d; Sat, 17 Apr 2021 22:34:34 +0000
Received: by outflank-mailman (input) for mailman id 112293;
 Sat, 17 Apr 2021 22:34:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtWL-00026f-O3
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:34:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtWL-0005eM-NC
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lXtWL-0002s1-MR
 for xen-changelog@lists.xenproject.org; Sat, 17 Apr 2021 22:34:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SJF7ZchX/sm4B2RA3Daxz83MnT9tWjLhf7DvajgQcfs=; b=yS6S/m1WwwZajtZqTQnEvTZUL8
	SAdspjpxOrFb+m8OlAJSJ1aOtdf+O3Nd2c+YQfdCjs2GrsXc40IH1hl9TtMlj6lCZ1ulufFvIHd58
	0nIZjANpGplgFPWNlxnB+oUcFx66Bnf2PLO1ziD9/tE/kRfCPatcjlkmZeDrL6cNZd54=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pv: Rename hypercall_table_t to pv_hypercall_table_t
Message-Id: <E1lXtWL-0002s1-MR@xenbits.xenproject.org>
Date: Sat, 17 Apr 2021 22:34:33 +0000

commit dd22a64de7e02b48312839a15179528c8f7db5c6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 15 13:27:45 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Apr 16 14:52:06 2021 +0100

    x86/pv: Rename hypercall_table_t to pv_hypercall_table_t
    
    The type is no longer appropriate for anything other than PV, and therefore
    should not retain its generic name.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/hypercall.c     | 2 +-
 xen/arch/x86/pv/shim.c          | 2 +-
 xen/include/asm-x86/hypercall.h | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c
index 5d02eebc8d..e30c59b628 100644
--- a/xen/arch/x86/pv/hypercall.c
+++ b/xen/arch/x86/pv/hypercall.c
@@ -40,7 +40,7 @@
 
 #define do_arch_1             paging_domctl_continuation
 
-const hypercall_table_t pv_hypercall_table[] = {
+const pv_hypercall_table_t pv_hypercall_table[] = {
     COMPAT_CALL(set_trap_table),
     HYPERCALL(mmu_update),
     COMPAT_CALL(set_gdt),
diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index 1b86fc247e..d16c0048c0 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -205,7 +205,7 @@ void __init pv_shim_setup_dom(struct domain *d, l4_pgentry_t *l4start,
                               start_info_t *si)
 {
     bool compat = is_pv_32bit_domain(d);
-    hypercall_table_t *rw_pv_hypercall_table;
+    pv_hypercall_table_t *rw_pv_hypercall_table;
     uint64_t param = 0;
     long rc;
 
diff --git a/xen/include/asm-x86/hypercall.h b/xen/include/asm-x86/hypercall.h
index 39e7ab7022..0ae3b8b043 100644
--- a/xen/include/asm-x86/hypercall.h
+++ b/xen/include/asm-x86/hypercall.h
@@ -20,7 +20,7 @@ typedef struct {
 #ifdef CONFIG_PV32
     hypercall_fn_t *compat;
 #endif
-} hypercall_table_t;
+} pv_hypercall_table_t;
 
 typedef struct {
     uint8_t native;
@@ -32,7 +32,7 @@ typedef struct {
 extern const hypercall_args_t hypercall_args_table[NR_hypercalls];
 
 #ifdef CONFIG_PV
-extern const hypercall_table_t pv_hypercall_table[];
+extern const pv_hypercall_table_t pv_hypercall_table[];
 void pv_hypercall(struct cpu_user_regs *regs);
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Apr 18 18:11:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 18 Apr 2021 18:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.112533.214698 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYBsx-0006zS-Bw; Sun, 18 Apr 2021 18:11:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 112533.214698; Sun, 18 Apr 2021 18: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 1lYBsx-0006zK-8s; Sun, 18 Apr 2021 18:11:07 +0000
Received: by outflank-mailman (input) for mailman id 112533;
 Sun, 18 Apr 2021 18:11:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYBsv-0006zF-OY
 for xen-changelog@lists.xenproject.org; Sun, 18 Apr 2021 18:11:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYBsv-0007gV-L2
 for xen-changelog@lists.xenproject.org; Sun, 18 Apr 2021 18:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYBsv-00036C-Ii
 for xen-changelog@lists.xenproject.org; Sun, 18 Apr 2021 18:11:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=flrwa5AItzilMsr+vWJAPupFpAcV7Re9y09ItK7/STc=; b=UIu+Xf99jwYAPrUOMuCKcjIWSy
	Dfuij4ISqRjV5vVB4NgeByQm4P5BwqIFb2BsJxAoMBC6Pfy6G/JPC7ZhXWIYFjmiS4XUxU7ISf7nn
	NgSnH4vvy6J7u4aEO/kHWRqMffYPsUnLIW66iYA093W4ZbabB2KcisqRZRnPX30fAio4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Include asm/asm-offsets.h and asm/macros.h on every assembly files
Message-Id: <E1lYBsv-00036C-Ii@xenbits.xenproject.org>
Date: Sun, 18 Apr 2021 18:11:05 +0000

commit 8d1ca2ac8d5763e72350b4f1ff34ae3276d99e4a
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sat Jan 23 17:48:45 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Sun Apr 18 18:59:54 2021 +0100

    xen/arm: Include asm/asm-offsets.h and asm/macros.h on every assembly files
    
    In a follow-up patch we may want to automatically replace some
    mnemonics (such as ret) with a different sequence.
    
    To ensure all the assembly files will include asm/macros.h it is best to
    automatically include it on single assembly. This can be done via
    config.h.
    
    It was necessary to include a few more headers as dependency:
      - <asm/asm_defns.h> to define sizeof_*
      - <xen/page-size.h> which is already a latent issue given STACK_ORDER
      rely on PAGE_SIZE.
    
    Unfortunately the build system will use -D__ASSEMBLY__ when generating
    the linker script. A new option -D__LINKER__ is introduceed and used for
    the linker script to avoid including headers (such as asm/macros.h) that
    may not be compatible with the syntax.
    
    Lastly, take the opportunity to remove both asm/asm-offsets.h and
    asm/macros.h from the various assembly files as they are now
    automagically included.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/Makefile                | 2 +-
 xen/arch/arm/arm32/entry.S           | 1 -
 xen/arch/arm/arm32/head.S            | 1 -
 xen/arch/arm/arm32/proc-v7.S         | 1 -
 xen/arch/arm/arm64/debug-cadence.inc | 1 -
 xen/arch/arm/arm64/debug-pl011.inc   | 2 --
 xen/arch/arm/arm64/entry.S           | 2 --
 xen/arch/arm/arm64/head.S            | 2 --
 xen/arch/arm/arm64/smc.S             | 3 ---
 xen/include/asm-arm/config.h         | 6 ++++++
 10 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 46e6a95fec..ca75f1040d 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -134,7 +134,7 @@ asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
 	$(CC) $(filter-out -flto,$(c_flags)) -S -o $@ $<
 
 xen.lds: xen.lds.S
-	$(CPP) -P $(a_flags) -MQ $@ -o $@ $<
+	$(CPP) -P $(a_flags) -D__LINKER__ -MQ $@ -o $@ $<
 
 dtb.o: $(patsubst "%",%,$(CONFIG_DTB_FILE))
 
diff --git a/xen/arch/arm/arm32/entry.S b/xen/arch/arm/arm32/entry.S
index b228d44b19..f2f1bc7a31 100644
--- a/xen/arch/arm/arm32/entry.S
+++ b/xen/arch/arm/arm32/entry.S
@@ -1,4 +1,3 @@
-#include <asm/asm_defns.h>
 #include <asm/sysregs.h>
 #include <asm/regs.h>
 #include <asm/alternative.h>
diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index 50f019ed98..7178865f48 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -18,7 +18,6 @@
  */
 
 #include <asm/page.h>
-#include <asm/asm_defns.h>
 #include <asm/early_printk.h>
 
 #define ZIMAGE_MAGIC_NUMBER 0x016f2818
diff --git a/xen/arch/arm/arm32/proc-v7.S b/xen/arch/arm/arm32/proc-v7.S
index 46bfc7a907..1efde2d72d 100644
--- a/xen/arch/arm/arm32/proc-v7.S
+++ b/xen/arch/arm/arm32/proc-v7.S
@@ -17,7 +17,6 @@
  * GNU General Public License for more details.
  */
 
-#include <asm/asm_defns.h>
 #include <asm/arm32/processor.h>
 #include <asm/sysregs.h>
 
diff --git a/xen/arch/arm/arm64/debug-cadence.inc b/xen/arch/arm/arm64/debug-cadence.inc
index 7df0abe475..0b6f2e094e 100644
--- a/xen/arch/arm/arm64/debug-cadence.inc
+++ b/xen/arch/arm/arm64/debug-cadence.inc
@@ -17,7 +17,6 @@
  * GNU General Public License for more details.
  */
 
-#include <asm/asm_defns.h>
 #include <asm/cadence-uart.h>
 
 /*
diff --git a/xen/arch/arm/arm64/debug-pl011.inc b/xen/arch/arm/arm64/debug-pl011.inc
index 385deff49b..1928a2e3ff 100644
--- a/xen/arch/arm/arm64/debug-pl011.inc
+++ b/xen/arch/arm/arm64/debug-pl011.inc
@@ -16,8 +16,6 @@
  * GNU General Public License for more details.
  */
 
-#include <asm/asm_defns.h>
-
 /*
  * PL011 UART initialization
  * xb: register which containts the UART base address
diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S
index 175ea2981e..ab9a65fc14 100644
--- a/xen/arch/arm/arm64/entry.S
+++ b/xen/arch/arm/arm64/entry.S
@@ -1,6 +1,4 @@
-#include <asm/asm_defns.h>
 #include <asm/current.h>
-#include <asm/macros.h>
 #include <asm/regs.h>
 #include <asm/alternative.h>
 #include <asm/smccc.h>
diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index f38a8dfca7..aa1f88c764 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -21,11 +21,9 @@
  */
 
 #include <asm/page.h>
-#include <asm/asm_defns.h>
 #include <asm/early_printk.h>
 #include <efi/efierr.h>
 #include <asm/arm64/efibind.h>
-#include <asm/arm64/macros.h>
 
 #define PT_PT     0xf7f /* nG=1 AF=1 SH=11 AP=01 NS=1 ATTR=111 T=1 P=1 */
 #define PT_MEM    0xf7d /* nG=1 AF=1 SH=11 AP=01 NS=1 ATTR=111 T=0 P=1 */
diff --git a/xen/arch/arm/arm64/smc.S b/xen/arch/arm/arm64/smc.S
index b0752be57e..91bae62dd4 100644
--- a/xen/arch/arm/arm64/smc.S
+++ b/xen/arch/arm/arm64/smc.S
@@ -13,9 +13,6 @@
  * GNU General Public License for more details.
  */
 
-#include <asm/asm_defns.h>
-#include <asm/macros.h>
-
 /*
  * void __arm_smccc_1_0_smc(register_t a0, register_t a1, register_t a2,
  *                          register_t a3, register_t a4, register_t a5,
diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h
index 5c10c755db..c7b7791201 100644
--- a/xen/include/asm-arm/config.h
+++ b/xen/include/asm-arm/config.h
@@ -69,6 +69,7 @@
 #endif
 
 #include <xen/const.h>
+#include <xen/page-size.h>
 
 /*
  * Common ARM32 and ARM64 layout:
@@ -190,6 +191,11 @@ extern unsigned long frametable_virt_end;
 #define watchdog_disable() ((void)0)
 #define watchdog_enable()  ((void)0)
 
+#if defined(__ASSEMBLY__) && !defined(__LINKER__)
+#include <asm/asm_defns.h>
+#include <asm/macros.h>
+#endif
+
 #endif /* __ARM_CONFIG_H__ */
 /*
  * Local variables:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sun Apr 18 18:22:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 18 Apr 2021 18:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.112543.214715 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYC3b-000800-Ep; Sun, 18 Apr 2021 18:22:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 112543.214715; Sun, 18 Apr 2021 18:22: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 1lYC3b-0007zs-Bn; Sun, 18 Apr 2021 18:22:07 +0000
Received: by outflank-mailman (input) for mailman id 112543;
 Sun, 18 Apr 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 1lYC3Z-0007zn-K2
 for xen-changelog@lists.xenproject.org; Sun, 18 Apr 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 1lYC3Z-0007r1-HY
 for xen-changelog@lists.xenproject.org; Sun, 18 Apr 2021 18:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYC3Z-0003n3-FC
 for xen-changelog@lists.xenproject.org; Sun, 18 Apr 2021 18: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=GfJFCoIUlYk6hJUoLeoaJUJ3g0tW1bLxs03xyoBQdO0=; b=edwNqc8qKTyMzTZQ0CR3IsmGNn
	dLSs6m9cPMyec/Hoiac3rdRQ736OSsrpZF/2TA0Dl7Q2vS8KJej3t7wvDFKfdf5koVkckPQQkFRBV
	k9PQkn4ojhCRAeK0/T5QyMZeShIGyD5oRBT6kJrLfDAqQ8SYCYPySVH0UheVgQZTBe7s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: guest_walk: Only generate necessary offsets/masks
Message-Id: <E1lYC3Z-0003n3-FC@xenbits.xenproject.org>
Date: Sun, 18 Apr 2021 18:22:05 +0000

commit 05031fa87357fad155f659cfc2dcce6614834684
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sun Apr 18 19:11:15 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Sun Apr 18 19:11:15 2021 +0100

    xen/arm: guest_walk: Only generate necessary offsets/masks
    
    At the moment, we are computing offsets/masks for each level and
    granularity. This is a bit of waste given that we only need to
    know the offsets/masks for the granularity used by the guest.
    
    All the LPAE information can easily be inferred with just the
    page shift for a given granularity and the level.
    
    So rather than providing a set of helpers per granularity, we can
    provide a single set that takes the granularity and the level in
    parameters.
    
    With the new helpers in place, we can rework guest_walk_ld() to
    only compute necessary information.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Tested-by: Bertrand Marquish <bertrand.marquis@arm.com>
---
 xen/arch/arm/guest_walk.c  | 37 ++-------------------
 xen/include/asm-arm/lpae.h | 82 +++++++++++++++-------------------------------
 2 files changed, 30 insertions(+), 89 deletions(-)

diff --git a/xen/arch/arm/guest_walk.c b/xen/arch/arm/guest_walk.c
index b4496c4c86..87de40d0cb 100644
--- a/xen/arch/arm/guest_walk.c
+++ b/xen/arch/arm/guest_walk.c
@@ -372,38 +372,6 @@ static bool guest_walk_ld(const struct vcpu *v,
     register_t tcr = READ_SYSREG(TCR_EL1);
     struct domain *d = v->domain;
 
-#define OFFSETS(gva, gran)              \
-{                                       \
-    zeroeth_table_offset_##gran(gva),   \
-    first_table_offset_##gran(gva),     \
-    second_table_offset_##gran(gva),    \
-    third_table_offset_##gran(gva)      \
-}
-
-    const paddr_t offsets[3][4] = {
-        OFFSETS(gva, 4K),
-        OFFSETS(gva, 16K),
-        OFFSETS(gva, 64K)
-    };
-
-#undef OFFSETS
-
-#define MASKS(gran)                     \
-{                                       \
-    zeroeth_size(gran) - 1,             \
-    first_size(gran) - 1,               \
-    second_size(gran) - 1,              \
-    third_size(gran) - 1                \
-}
-
-    static const paddr_t masks[3][4] = {
-        MASKS(4K),
-        MASKS(16K),
-        MASKS(64K)
-    };
-
-#undef MASKS
-
     static const unsigned int grainsizes[3] = {
         PAGE_SHIFT_4K,
         PAGE_SHIFT_16K,
@@ -519,7 +487,7 @@ static bool guest_walk_ld(const struct vcpu *v,
          * Add offset given by the GVA to the translation table base address.
          * Shift the offset by 3 as it is 8-byte aligned.
          */
-        paddr |= offsets[gran][level] << 3;
+        paddr |= LPAE_TABLE_INDEX_GS(grainsizes[gran], level, gva) << 3;
 
         /* Access the guest's memory to read only one PTE. */
         ret = access_guest_memory_by_ipa(d, paddr, &pte, sizeof(lpae_t), false);
@@ -572,7 +540,8 @@ static bool guest_walk_ld(const struct vcpu *v,
 
     /* Make sure that the lower bits of the PTE's base address are zero. */
     mask = GENMASK_ULL(47, grainsizes[gran]);
-    *ipa = (pfn_to_paddr(pte.walk.base) & mask) | (gva & masks[gran][level]);
+    *ipa = (pfn_to_paddr(pte.walk.base) & mask) |
+        (gva & (LEVEL_SIZE_GS(grainsizes[gran], level) - 1));
 
     /*
      * Set permissions so that the caller can check the flags by herself. Note
diff --git a/xen/include/asm-arm/lpae.h b/xen/include/asm-arm/lpae.h
index 4797f9cee4..e94de2e7d8 100644
--- a/xen/include/asm-arm/lpae.h
+++ b/xen/include/asm-arm/lpae.h
@@ -160,63 +160,35 @@ static inline bool lpae_is_superpage(lpae_t pte, unsigned int level)
 #define lpae_set_mfn(pte, mfn)  ((pte).walk.base = mfn_x(mfn))
 
 /*
- * AArch64 supports pages with different sizes (4K, 16K, and 64K). To enable
- * page table walks for various configurations, the following helpers enable
- * walking the translation table with varying page size granularities.
+ * AArch64 supports pages with different sizes (4K, 16K, and 64K).
+ * Provide a set of generic helpers that will compute various
+ * information based on the page granularity.
+ *
+ * Note the parameter 'gs' is the page shift of the granularity used.
+ * Some macro will evaluate 'gs' twice rather than storing in a
+ * variable. This is to allow using the macros in assembly.
+ */
+
+/*
+ * Granularity | PAGE_SHIFT | LPAE_SHIFT
+ * -------------------------------------
+ * 4K          | 12         | 9
+ * 16K         | 14         | 11
+ * 64K         | 16         | 13
+ *
+ * This is equivalent to LPAE_SHIFT = PAGE_SHIFT - 3
  */
+#define LPAE_SHIFT_GS(gs)         ((gs) - 3)
+#define LPAE_ENTRIES_GS(gs)       (_AC(1, U) << LPAE_SHIFT_GS(gs))
+#define LPAE_ENTRIES_MASK_GS(gs)  (LPAE_ENTRIES_GS(gs) - 1)
+
+#define LEVEL_ORDER_GS(gs, lvl)   ((3 - (lvl)) * LPAE_SHIFT_GS(gs))
+#define LEVEL_SHIFT_GS(gs, lvl)   (LEVEL_ORDER_GS(gs, lvl) + (gs))
+#define LEVEL_SIZE_GS(gs, lvl)    (_AT(paddr_t, 1) << LEVEL_SHIFT_GS(gs, lvl))
 
-#define LPAE_SHIFT_4K           (9)
-#define LPAE_SHIFT_16K          (11)
-#define LPAE_SHIFT_64K          (13)
-
-#define lpae_entries(gran)      (_AC(1,U) << LPAE_SHIFT_##gran)
-#define lpae_entry_mask(gran)   (lpae_entries(gran) - 1)
-
-#define third_shift(gran)       (PAGE_SHIFT_##gran)
-#define third_size(gran)        ((paddr_t)1 << third_shift(gran))
-
-#define second_shift(gran)      (third_shift(gran) + LPAE_SHIFT_##gran)
-#define second_size(gran)       ((paddr_t)1 << second_shift(gran))
-
-#define first_shift(gran)       (second_shift(gran) + LPAE_SHIFT_##gran)
-#define first_size(gran)        ((paddr_t)1 << first_shift(gran))
-
-/* Note that there is no zeroeth lookup level with a 64K granule size. */
-#define zeroeth_shift(gran)     (first_shift(gran) + LPAE_SHIFT_##gran)
-#define zeroeth_size(gran)      ((paddr_t)1 << zeroeth_shift(gran))
-
-#define TABLE_OFFSET(offs, gran)      (offs & lpae_entry_mask(gran))
-#define TABLE_OFFSET_HELPERS(gran)                                          \
-static inline paddr_t third_table_offset_##gran##K(paddr_t va)              \
-{                                                                           \
-    return TABLE_OFFSET((va >> third_shift(gran##K)), gran##K);             \
-}                                                                           \
-                                                                            \
-static inline paddr_t second_table_offset_##gran##K(paddr_t va)             \
-{                                                                           \
-    return TABLE_OFFSET((va >> second_shift(gran##K)), gran##K);            \
-}                                                                           \
-                                                                            \
-static inline paddr_t first_table_offset_##gran##K(paddr_t va)              \
-{                                                                           \
-    return TABLE_OFFSET((va >> first_shift(gran##K)), gran##K);             \
-}                                                                           \
-                                                                            \
-static inline paddr_t zeroeth_table_offset_##gran##K(paddr_t va)            \
-{                                                                           \
-    /* Note that there is no zeroeth lookup level with 64K granule sizes. */\
-    if ( gran == 64 )                                                       \
-        return 0;                                                           \
-    else                                                                    \
-        return TABLE_OFFSET((va >> zeroeth_shift(gran##K)), gran##K);       \
-}                                                                           \
-
-TABLE_OFFSET_HELPERS(4);
-TABLE_OFFSET_HELPERS(16);
-TABLE_OFFSET_HELPERS(64);
-
-#undef TABLE_OFFSET
-#undef TABLE_OFFSET_HELPERS
+/* Offset in the table at level 'lvl' */
+#define LPAE_TABLE_INDEX_GS(gs, lvl, addr)   \
+    (((addr) >> LEVEL_SHIFT_GS(gs, lvl)) & LPAE_ENTRIES_MASK_GS(gs))
 
 /* Generate an array @var containing the offset for each level from @addr */
 #define DECLARE_OFFSETS(var, addr)          \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 19 10:44:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 19 Apr 2021 10:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.112801.215098 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYRNu-0003kA-0z; Mon, 19 Apr 2021 10:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 112801.215098; Mon, 19 Apr 2021 10:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYRNt-0003k2-U2; Mon, 19 Apr 2021 10:44:05 +0000
Received: by outflank-mailman (input) for mailman id 112801;
 Mon, 19 Apr 2021 10:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYRNs-0003jx-Ni
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 10:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYRNs-0006te-Lk
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 10:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYRNs-0004jb-KF
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 10:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=COtpNoTolxI4gNSHVhGSy5qSy6dwcucRdQ758LarF6Y=; b=fpEuKbrh6Wb3kAjMM9nDqqJ6mG
	fm+KeMoH71HUBRB+eSid8fWqPY8ycW1vHY9IYlt2uGbuFo7XSP4P2wpI18G0olJg6kxns7kpFGVJy
	6CbMUYk7IjFh1UstJPSrLaq2/LK4+ZyZgayuqTHpDnZ0jXihux4HNzJaqYF4RbchKnSw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: Drop XGETTEXT from Tools.mk.in
Message-Id: <E1lYRNs-0004jb-KF@xenbits.xenproject.org>
Date: Mon, 19 Apr 2021 10:44:04 +0000

commit b5b93627dd1c398a90b832af765b4720fc71814e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Apr 16 16:56:57 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Apr 19 11:38:10 2021 +0100

    tools: Drop XGETTEXT from Tools.mk.in
    
    This hunk was missing from the work to drop gettext as a build dependency.
    
    Fixes: e21a6a4f96 ("tools: Drop gettext as a build dependency")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 config/Tools.mk.in | 1 -
 1 file changed, 1 deletion(-)

diff --git a/config/Tools.mk.in b/config/Tools.mk.in
index d47936686b..934d899967 100644
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -12,7 +12,6 @@ PYTHON              := @PYTHON@
 PYTHON_PATH         := @PYTHONPATH@
 PY_NOOPT_CFLAGS     := @PY_NOOPT_CFLAGS@
 PERL                := @PERL@
-XGETTTEXT           := @XGETTEXT@
 AS86                := @AS86@
 LD86                := @LD86@
 BCC                 := @BCC@
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 19 13:33:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 19 Apr 2021 13:33:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.112920.215258 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYU1U-0003F7-QT; Mon, 19 Apr 2021 13:33:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 112920.215258; Mon, 19 Apr 2021 13:33: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 1lYU1U-0003Eu-N2; Mon, 19 Apr 2021 13:33:08 +0000
Received: by outflank-mailman (input) for mailman id 112920;
 Mon, 19 Apr 2021 13:33:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYU1S-0003E4-OS
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 13:33:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYU1S-0001W6-Jj
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 13:33:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYU1S-0002Wt-GI
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 13:33:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ipK9oTW4RGlq2nVXFI3gcaLr/0DTKYa+6zygP6cYbzI=; b=K5mJXYQygV5ObqGUqsiBOQMw8N
	KhskipDkPIoTbO9f7LW7DpQY1i38uGblTfpxVSzj0wuWBHEvIQktOMW/Kiogs5+AgvFIuY+RlT2ng
	uVwU0gF0RjhscggEscSczI0WoSo6XLbXZF25w1BdxXyMrI1DW5E83GBnopcpvEOZEchU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: adjust callback arrays
Message-Id: <E1lYU1S-0002Wt-GI@xenbits.xenproject.org>
Date: Mon, 19 Apr 2021 13:33:06 +0000

commit 17eaf4429cb86fe0795b38293891cc05e56ce177
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 19 15:26:22 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 19 15:26:22 2021 +0200

    x86/shadow: adjust callback arrays
    
    Some of them have entries with stale comments. Rather than correcting
    these comments, re-arrange how these arrays get populated: Use dedicated
    element initializers, serving the purpose of what the comments did so
    far. This then also makes these arrays independent of the actual
    ordering of the individual SH_type_*.
    
    While tightening respective ASSERT()s in hash_{vcpu,domain}_foreach(),
    also tighten related ones in shadow_hash_{insert,delete}().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c | 142 +++++++++++++---------------------------
 1 file changed, 44 insertions(+), 98 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index b99ca14e71..72d3816fcc 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -1565,7 +1565,7 @@ void shadow_hash_insert(struct domain *d, unsigned long n, unsigned int t,
 
     ASSERT(paging_locked_by_me(d));
     ASSERT(d->arch.paging.shadow.hash_table);
-    ASSERT(t);
+    ASSERT(t >= SH_type_min_shadow && t <= SH_type_max_shadow);
 
     sh_hash_audit(d);
 
@@ -1590,7 +1590,7 @@ void shadow_hash_delete(struct domain *d, unsigned long n, unsigned int t,
 
     ASSERT(paging_locked_by_me(d));
     ASSERT(d->arch.paging.shadow.hash_table);
-    ASSERT(t);
+    ASSERT(t >= SH_type_min_shadow && t <= SH_type_max_shadow);
 
     sh_hash_audit(d);
 
@@ -1668,7 +1668,7 @@ static void hash_vcpu_foreach(struct vcpu *v, unsigned int callback_mask,
         {
             if ( callback_mask & (1 << x->u.sh.type) )
             {
-                ASSERT(x->u.sh.type < SH_type_unused);
+                ASSERT(x->u.sh.type <= SH_type_max_shadow);
                 ASSERT(callbacks[x->u.sh.type] != NULL);
                 done = callbacks[x->u.sh.type](v, page_to_mfn(x),
                                                callback_mfn);
@@ -1715,7 +1715,7 @@ static void hash_domain_foreach(struct domain *d,
         {
             if ( callback_mask & (1 << x->u.sh.type) )
             {
-                ASSERT(x->u.sh.type < SH_type_unused);
+                ASSERT(x->u.sh.type <= SH_type_max_shadow);
                 ASSERT(callbacks[x->u.sh.type] != NULL);
                 done = callbacks[x->u.sh.type](d, page_to_mfn(x),
                                                callback_mfn);
@@ -1820,25 +1820,15 @@ int sh_remove_write_access(struct domain *d, mfn_t gmfn,
 {
     /* Dispatch table for getting per-type functions */
     static const hash_domain_callback_t callbacks[SH_type_unused] = {
-        NULL, /* none    */
 #ifdef CONFIG_HVM
-        SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 2), /* l1_32   */
-        SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 2), /* fl1_32  */
-        NULL, /* l2_32   */
-        SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 3), /* l1_pae  */
-        SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 3), /* fl1_pae */
-        NULL, /* l2_pae  */
+        [SH_type_l1_32_shadow] = SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 2),
+        [SH_type_fl1_32_shadow] = SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 2),
+        [SH_type_l1_pae_shadow] = SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 3),
+        [SH_type_fl1_pae_shadow] = SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 3),
 #endif
-        SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 4), /* l1_64   */
-        SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 4), /* fl1_64  */
-        NULL, /* l2_64   */
-        NULL, /* l2h_64  */
-        NULL, /* l3_64   */
-        NULL, /* l4_64   */
-        NULL, /* p2m     */
-        NULL  /* unused  */
+        [SH_type_l1_64_shadow] = SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 4),
+        [SH_type_fl1_64_shadow] = SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 4),
     };
-
     static const unsigned int callback_mask = SHF_L1_ANY | SHF_FL1_ANY;
     struct page_info *pg = mfn_to_page(gmfn);
 #if SHADOW_OPTIMIZATIONS & SHOPT_WRITABLE_HEURISTIC
@@ -2045,25 +2035,15 @@ int sh_remove_all_mappings(struct domain *d, mfn_t gmfn, gfn_t gfn)
 
     /* Dispatch table for getting per-type functions */
     static const hash_domain_callback_t callbacks[SH_type_unused] = {
-        NULL, /* none    */
 #ifdef CONFIG_HVM
-        SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 2), /* l1_32   */
-        SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 2), /* fl1_32  */
-        NULL, /* l2_32   */
-        SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3), /* l1_pae  */
-        SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3), /* fl1_pae */
-        NULL, /* l2_pae  */
+        [SH_type_l1_32_shadow] = SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 2),
+        [SH_type_fl1_32_shadow] = SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 2),
+        [SH_type_l1_pae_shadow] = SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3),
+        [SH_type_fl1_pae_shadow] = SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3),
 #endif
-        SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 4), /* l1_64   */
-        SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 4), /* fl1_64  */
-        NULL, /* l2_64   */
-        NULL, /* l2h_64  */
-        NULL, /* l3_64   */
-        NULL, /* l4_64   */
-        NULL, /* p2m     */
-        NULL  /* unused  */
+        [SH_type_l1_64_shadow] = SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 4),
+        [SH_type_fl1_64_shadow] = SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 4),
     };
-
     static const unsigned int callback_mask = SHF_L1_ANY | SHF_FL1_ANY;
 
     perfc_incr(shadow_mappings);
@@ -2190,44 +2170,26 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
     /* Dispatch table for getting per-type functions: each level must
      * be called with the function to remove a lower-level shadow. */
     static const hash_domain_callback_t callbacks[SH_type_unused] = {
-        NULL, /* none    */
 #ifdef CONFIG_HVM
-        NULL, /* l1_32   */
-        NULL, /* fl1_32  */
-        SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 2), /* l2_32   */
-        NULL, /* l1_pae  */
-        NULL, /* fl1_pae */
-        SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 3), /* l2_pae  */
+        [SH_type_l2_32_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 2),
+        [SH_type_l2_pae_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 3),
 #endif
-        NULL, /* l1_64   */
-        NULL, /* fl1_64  */
-        SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 4), /* l2_64   */
-        SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 4), /* l2h_64  */
-        SHADOW_INTERNAL_NAME(sh_remove_l2_shadow, 4), /* l3_64   */
-        SHADOW_INTERNAL_NAME(sh_remove_l3_shadow, 4), /* l4_64   */
-        NULL, /* p2m     */
-        NULL  /* unused  */
+        [SH_type_l2_64_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 4),
+        [SH_type_l2h_64_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 4),
+        [SH_type_l3_64_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l2_shadow, 4),
+        [SH_type_l4_64_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l3_shadow, 4),
     };
 
     /* Another lookup table, for choosing which mask to use */
     static const unsigned int masks[SH_type_unused] = {
-        0, /* none    */
 #ifdef CONFIG_HVM
-        SHF_L2_32, /* l1_32   */
-        0, /* fl1_32  */
-        0, /* l2_32   */
-        SHF_L2_PAE, /* l1_pae  */
-        0, /* fl1_pae */
-        0, /* l2_pae  */
+        [SH_type_l1_32_shadow] = SHF_L2_32,
+        [SH_type_l1_pae_shadow] = SHF_L2_PAE,
 #endif
-        SHF_L2H_64 | SHF_L2_64, /* l1_64   */
-        0, /* fl1_64  */
-        SHF_L3_64, /* l2_64   */
-        SHF_L3_64, /* l2h_64  */
-        SHF_L4_64, /* l3_64   */
-        0, /* l4_64   */
-        0, /* p2m     */
-        0  /* unused  */
+        [SH_type_l1_64_shadow] = SHF_L2H_64 | SHF_L2_64,
+        [SH_type_l2_64_shadow] = SHF_L3_64,
+        [SH_type_l2h_64_shadow] = SHF_L3_64,
+        [SH_type_l3_64_shadow] = SHF_L4_64,
     };
 
     ASSERT(!(all && fast));
@@ -2357,23 +2319,7 @@ static int sh_clear_up_pointer(struct vcpu *v, mfn_t smfn, mfn_t unused)
 void sh_reset_l3_up_pointers(struct vcpu *v)
 {
     static const hash_vcpu_callback_t callbacks[SH_type_unused] = {
-        NULL, /* none    */
-#ifdef CONFIG_HVM
-        NULL, /* l1_32   */
-        NULL, /* fl1_32  */
-        NULL, /* l2_32   */
-        NULL, /* l1_pae  */
-        NULL, /* fl1_pae */
-        NULL, /* l2_pae  */
-#endif
-        NULL, /* l1_64   */
-        NULL, /* fl1_64  */
-        NULL, /* l2_64   */
-        NULL, /* l2h_64  */
-        sh_clear_up_pointer, /* l3_64   */
-        NULL, /* l4_64   */
-        NULL, /* p2m     */
-        NULL  /* unused  */
+        [SH_type_l3_64_shadow] = sh_clear_up_pointer,
     };
     static const unsigned int callback_mask = SHF_L3_64;
 
@@ -3382,24 +3328,22 @@ void shadow_audit_tables(struct vcpu *v)
 {
     /* Dispatch table for getting per-type functions */
     static const hash_vcpu_callback_t callbacks[SH_type_unused] = {
-        NULL, /* none    */
 #if SHADOW_AUDIT & (SHADOW_AUDIT_ENTRIES | SHADOW_AUDIT_ENTRIES_FULL)
 # ifdef CONFIG_HVM
-        SHADOW_INTERNAL_NAME(sh_audit_l1_table, 2),  /* l1_32   */
-        SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 2), /* fl1_32  */
-        SHADOW_INTERNAL_NAME(sh_audit_l2_table, 2),  /* l2_32   */
-        SHADOW_INTERNAL_NAME(sh_audit_l1_table, 3),  /* l1_pae  */
-        SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 3), /* fl1_pae */
-        SHADOW_INTERNAL_NAME(sh_audit_l2_table, 3),  /* l2_pae  */
+        [SH_type_l1_32_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l1_table, 2),
+        [SH_type_fl1_32_shadow] = SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 2),
+        [SH_type_l2_32_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l2_table, 2),
+        [SH_type_l1_pae_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l1_table, 3),
+        [SH_type_fl1_pae_shadow] = SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 3),
+        [SH_type_l2_pae_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l2_table, 3),
 # endif
-        SHADOW_INTERNAL_NAME(sh_audit_l1_table, 4),  /* l1_64   */
-        SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 4), /* fl1_64  */
-        SHADOW_INTERNAL_NAME(sh_audit_l2_table, 4),  /* l2_64   */
-        SHADOW_INTERNAL_NAME(sh_audit_l2_table, 4),  /* l2h_64   */
-        SHADOW_INTERNAL_NAME(sh_audit_l3_table, 4),  /* l3_64   */
-        SHADOW_INTERNAL_NAME(sh_audit_l4_table, 4),  /* l4_64   */
+        [SH_type_l1_64_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l1_table, 4),
+        [SH_type_fl1_64_shadow] = SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 4),
+        [SH_type_l2_64_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l2_table, 4),
+        [SH_type_l2h_64_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l2_table, 4),
+        [SH_type_l3_64_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l3_table, 4),
+        [SH_type_l4_64_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l4_table, 4),
 #endif
-        NULL  /* All the rest */
     };
     unsigned int mask;
 
@@ -3427,7 +3371,9 @@ void shadow_audit_tables(struct vcpu *v)
         }
     }
 
-    HASH_CALLBACKS_CHECK(SHF_page_type_mask);
+    HASH_CALLBACKS_CHECK(SHADOW_AUDIT & (SHADOW_AUDIT_ENTRIES |
+                                         SHADOW_AUDIT_ENTRIES_FULL)
+                         ? SHF_page_type_mask : 0);
     hash_vcpu_foreach(v, mask, callbacks, INVALID_MFN);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 19 13:33:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 19 Apr 2021 13:33:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.112921.215262 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYU1d-0003GY-RW; Mon, 19 Apr 2021 13:33:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 112921.215262; Mon, 19 Apr 2021 13:33:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYU1d-0003GQ-Oe; Mon, 19 Apr 2021 13:33:17 +0000
Received: by outflank-mailman (input) for mailman id 112921;
 Mon, 19 Apr 2021 13:33:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYU1c-0003GK-Ot
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 13:33:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYU1c-0001W9-NF
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 13:33:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYU1c-0002YO-M7
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 13:33:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LPeBHo8Tdmlllh2ZNgGvwToWat5xrtZ2IuAbj5fAzX8=; b=McDHukMjkoXurX+fs1KLGNIebm
	AZNl6yVafxT7rQkB5frAYuS+yYSsnMCZ5bpBrKA1HHpc0RrV/t5b+Pkb1iD/q8KYzitG7aXlmxowr
	4+mQW0FUKi1gVyPGGyJ/1IEyW68OxET+5raL6HhJ1Fj1bsi4hvFqHmlfnAPlf5g2bMR0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: mem-access is HVM-only
Message-Id: <E1lYU1c-0002YO-M7@xenbits.xenproject.org>
Date: Mon, 19 Apr 2021 13:33:16 +0000

commit 99192701e34e2e82276289efe4fd450fb91a703b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 19 15:28:00 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 19 15:28:00 2021 +0200

    x86: mem-access is HVM-only
    
    By excluding the file from being built for !HVM, #ifdef-ary can be
    removed from it.
    
    The new HVM dependency on the Kconfig option is benign for Arm.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
    Reviewed-by: Alexandru Isaila <aisaila@bitdefender.com>
---
 xen/arch/x86/Kconfig         |  2 +-
 xen/arch/x86/mm/mem_access.c | 20 --------------------
 xen/arch/x86/vm_event.c      |  2 ++
 xen/common/Kconfig           |  1 +
 4 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 57776d5106..db0de0a9ec 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -16,7 +16,6 @@ config X86
 	select HAS_FAST_MULTIPLY
 	select HAS_IOPORTS
 	select HAS_KEXEC
-	select MEM_ACCESS_ALWAYS_ON
 	select HAS_MEM_PAGING
 	select HAS_NS16550
 	select HAS_PASSTHROUGH
@@ -95,6 +94,7 @@ config HVM
 	def_bool !PV_SHIM_EXCLUSIVE
 	select COMPAT
 	select IOREQ_SERVER
+	select MEM_ACCESS_ALWAYS_ON
 	prompt "HVM support"
 	---help---
 	  Interfaces to support HVM domains.  HVM domains require hardware
diff --git a/xen/arch/x86/mm/mem_access.c b/xen/arch/x86/mm/mem_access.c
index ede774fb50..7750b81cd4 100644
--- a/xen/arch/x86/mm/mem_access.c
+++ b/xen/arch/x86/mm/mem_access.c
@@ -139,7 +139,6 @@ bool p2m_mem_access_emulate_check(struct vcpu *v,
     return violation;
 }
 
-#ifdef CONFIG_HVM
 bool p2m_mem_access_check(paddr_t gpa, unsigned long gla,
                           struct npfec npfec,
                           vm_event_request_t **req_ptr)
@@ -282,7 +281,6 @@ int p2m_set_altp2m_mem_access(struct domain *d, struct p2m_domain *hp2m,
      */
     return ap2m->set_entry(ap2m, gfn, mfn, PAGE_ORDER_4K, t, a, -1);
 }
-#endif
 
 static int set_mem_access(struct domain *d, struct p2m_domain *p2m,
                           struct p2m_domain *ap2m, p2m_access_t a,
@@ -290,7 +288,6 @@ static int set_mem_access(struct domain *d, struct p2m_domain *p2m,
 {
     int rc = 0;
 
-#ifdef CONFIG_HVM
     if ( ap2m )
     {
         rc = p2m_set_altp2m_mem_access(d, p2m, ap2m, a, gfn);
@@ -299,9 +296,6 @@ static int set_mem_access(struct domain *d, struct p2m_domain *p2m,
             rc = 0;
     }
     else
-#else
-    ASSERT(!ap2m);
-#endif
     {
         p2m_access_t _a;
         p2m_type_t t;
@@ -362,7 +356,6 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr,
     long rc = 0;
 
     /* altp2m view 0 is treated as the hostp2m */
-#ifdef CONFIG_HVM
     if ( altp2m_idx )
     {
         if ( altp2m_idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) ||
@@ -372,9 +365,6 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr,
 
         ap2m = array_access_nospec(d->arch.altp2m_p2m, altp2m_idx);
     }
-#else
-    ASSERT(!altp2m_idx);
-#endif
 
     if ( !xenmem_access_to_p2m_access(p2m, access, &a) )
         return -EINVAL;
@@ -422,7 +412,6 @@ long p2m_set_mem_access_multi(struct domain *d,
     long rc = 0;
 
     /* altp2m view 0 is treated as the hostp2m */
-#ifdef CONFIG_HVM
     if ( altp2m_idx )
     {
         if ( altp2m_idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) ||
@@ -432,9 +421,6 @@ long p2m_set_mem_access_multi(struct domain *d,
 
         ap2m = array_access_nospec(d->arch.altp2m_p2m, altp2m_idx);
     }
-#else
-    ASSERT(!altp2m_idx);
-#endif
 
     p2m_lock(p2m);
     if ( ap2m )
@@ -484,7 +470,6 @@ int p2m_get_mem_access(struct domain *d, gfn_t gfn, xenmem_access_t *access,
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
 
-#ifdef CONFIG_HVM
     if ( !altp2m_active(d) )
     {
         if ( altp2m_idx )
@@ -499,9 +484,6 @@ int p2m_get_mem_access(struct domain *d, gfn_t gfn, xenmem_access_t *access,
 
         p2m = array_access_nospec(d->arch.altp2m_p2m, altp2m_idx);
     }
-#else
-    ASSERT(!altp2m_idx);
-#endif
 
     return _p2m_get_mem_access(p2m, gfn, access);
 }
@@ -512,7 +494,6 @@ void arch_p2m_set_access_required(struct domain *d, bool access_required)
 
     p2m_get_hostp2m(d)->access_required = access_required;
 
-#ifdef CONFIG_HVM
     if ( altp2m_active(d) )
     {
         unsigned int i;
@@ -524,7 +505,6 @@ void arch_p2m_set_access_required(struct domain *d, bool access_required)
                 p2m->access_required = access_required;
         }
     }
-#endif
 }
 
 bool p2m_mem_access_sanity_check(const struct domain *d)
diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c
index 8f73a73e2e..ffcc64c40b 100644
--- a/xen/arch/x86/vm_event.c
+++ b/xen/arch/x86/vm_event.c
@@ -265,6 +265,7 @@ void vm_event_emulate_check(struct vcpu *v, vm_event_response_t *rsp)
         return;
     }
 
+#ifdef CONFIG_HVM
     switch ( rsp->reason )
     {
     case VM_EVENT_REASON_MEM_ACCESS:
@@ -298,6 +299,7 @@ void vm_event_emulate_check(struct vcpu *v, vm_event_response_t *rsp)
     default:
         break;
     };
+#endif
 }
 
 void vm_event_reset_vmtrace(struct vcpu *v)
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 3064bf6b89..b6c9827a7b 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -61,6 +61,7 @@ config MEM_ACCESS_ALWAYS_ON
 config MEM_ACCESS
 	def_bool MEM_ACCESS_ALWAYS_ON
 	prompt "Memory Access and VM events" if !MEM_ACCESS_ALWAYS_ON
+	depends on HVM
 	---help---
 
 	  Framework to configure memory access types for guests and receive
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 19 13:33:28 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 19 Apr 2021 13:33:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.112922.215268 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYU1o-0003Hg-Tv; Mon, 19 Apr 2021 13:33:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 112922.215268; Mon, 19 Apr 2021 13:33: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 1lYU1o-0003HY-QI; Mon, 19 Apr 2021 13:33:28 +0000
Received: by outflank-mailman (input) for mailman id 112922;
 Mon, 19 Apr 2021 13:33:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYU1m-0003HN-Rz
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 13:33:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYU1m-0001WP-R4
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 13:33:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYU1m-0002a7-Pn
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 13:33:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7f1BOAO31EPqvcYt96UHtH2rIJ3xaMOJ+s/n1auUJFY=; b=bUhpwvr7UhLF/PH2VSVbEE8pUx
	F4GeXKKg1M0Ni13UW4lcLP8qiykh3a4oHH2+Raomq0bDOblEJj4KW2nPNcFI6njf79MU22Fi+OioG
	XmBv1iJ6xeV8tr2C3zrjzPisJ69Blz3qbdSZWm3wtumv2KRq2DnGr/YVTLLXmrKPt3rM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: use is_pv_64bit_domain() to avoid double evaluate_nospec()
Message-Id: <E1lYU1m-0002a7-Pn@xenbits.xenproject.org>
Date: Mon, 19 Apr 2021 13:33:26 +0000

commit a49d1087e2c0cd940c9b93ded29c576bbae292f5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 19 15:29:06 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 19 15:29:06 2021 +0200

    x86: use is_pv_64bit_domain() to avoid double evaluate_nospec()
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/domain.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 40e8ce7544..4dc27f798e 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1115,7 +1115,7 @@ int arch_set_info_guest(
           * update_cr3(), sh_update_cr3(), sh_walk_guest_tables(), and
           * shadow_one_bit_disable() for why that is.
           */
-         !is_hvm_domain(d) && !is_pv_32bit_domain(d) )
+         is_pv_64bit_domain(d) )
         v->arch.flags &= ~TF_kernel_mode;
 
     vcpu_setup_fpu(v, v->arch.xsave_area,
@@ -1267,7 +1267,7 @@ int arch_set_info_guest(
          * correct initial RO_MPT_VIRT_{START,END} L4 entry).
          */
         if ( d != current->domain && !VM_ASSIST(d, m2p_strict) &&
-             is_pv_domain(d) && !is_pv_32bit_domain(d) &&
+             is_pv_64bit_domain(d) &&
              test_bit(VMASST_TYPE_m2p_strict, &c.nat->vm_assist) &&
              atomic_read(&d->arch.pv.nr_l4_pages) )
         {
@@ -2002,8 +2002,7 @@ static void __context_switch(void)
 
 #if defined(CONFIG_PV) && defined(CONFIG_HVM)
     /* Prefetch the VMCB if we expect to use it later in the context switch */
-    if ( cpu_has_svm && is_pv_domain(nd) && !is_pv_32bit_domain(nd) &&
-         !is_idle_domain(nd) )
+    if ( cpu_has_svm && is_pv_64bit_domain(nd) && !is_idle_domain(nd) )
         svm_load_segs_prefetch();
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 19 13:33:38 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 19 Apr 2021 13:33:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.112923.215270 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYU1y-0003JD-VO; Mon, 19 Apr 2021 13:33:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 112923.215270; Mon, 19 Apr 2021 13:33: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 1lYU1y-0003J5-Rr; Mon, 19 Apr 2021 13:33:38 +0000
Received: by outflank-mailman (input) for mailman id 112923;
 Mon, 19 Apr 2021 13:33: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 1lYU1w-0003IY-Vw
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 13:33:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYU1w-0001WX-V9
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 13:33:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYU1w-0002bK-UB
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 13:33:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lbt85YJL1cwnXqbcWnPHUft6sN7J9CgED/AVjMH45F8=; b=gZoRLtyC9Typ/0vviyr0EI6T63
	6SktTErWZfP7LsPONHfJ0a+rLdT8lXNFem36DLoH/f7e5NwtgXFntx5NaW7BMnYbeR9sk6YXFcqSM
	LQKIlz9Z/Rq2pasXFChdbVs1rXQdfCF+q+gF/iq36GpHYROOXm156bzxt+kUQ2QnRLdY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/CPUID: add further "fast repeated string ops" feature flags
Message-Id: <E1lYU1w-0002bK-UB@xenbits.xenproject.org>
Date: Mon, 19 Apr 2021 13:33:36 +0000

commit a8c532be6a44c7faa54ac777a717f4aa65e3a806
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 19 15:29:39 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 19 15:29:39 2021 +0200

    x86/CPUID: add further "fast repeated string ops" feature flags
    
    Like ERMS this can always be exposed to guests, but I guess once we
    introduce full validation we want to make sure we don't reject incoming
    policies with any of these set when in the raw/host policies they're
    clear.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/light/libxl_cpuid.c              | 4 ++++
 tools/misc/xen-cpuid.c                      | 3 +++
 xen/include/public/arch-x86/cpufeatureset.h | 4 ++++
 3 files changed, 11 insertions(+)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index aee28b0430..943a343239 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -215,6 +215,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
 
         {"avx512-4vnniw",0x00000007,  0, CPUID_REG_EDX,  2,  1},
         {"avx512-4fmaps",0x00000007,  0, CPUID_REG_EDX,  3,  1},
+        {"fsrm",         0x00000007,  0, CPUID_REG_EDX,  4,  1},
         {"avx512-vp2intersect",0x00000007,0,CPUID_REG_EDX,8, 1},
         {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
@@ -229,6 +230,9 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
 
         {"avx-vnni",     0x00000007,  1, CPUID_REG_EAX,  4,  1},
         {"avx512-bf16",  0x00000007,  1, CPUID_REG_EAX,  5,  1},
+        {"fzrm",         0x00000007,  1, CPUID_REG_EAX, 10,  1},
+        {"fsrs",         0x00000007,  1, CPUID_REG_EAX, 11,  1},
+        {"fsrcs",        0x00000007,  1, CPUID_REG_EAX, 12,  1},
 
         {"lahfsahf",     0x80000001, NA, CPUID_REG_ECX,  0,  1},
         {"cmplegacy",    0x80000001, NA, CPUID_REG_ECX,  1,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 628e8f5aa2..b4229d1126 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -177,6 +177,9 @@ static const char *const str_7d0[32] =
 static const char *const str_7a1[32] =
 {
     [ 4] = "avx-vnni",      [ 5] = "avx512-bf16",
+
+    [10] = "fzrm",          [11] = "fsrs",
+    [12] = "fsrcs",
 };
 
 static const struct {
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 42bc8d4279..7cdd08d551 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -261,6 +261,7 @@ XEN_CPUFEATURE(AMD_PPIN,      8*32+23) /*   Protected Processor Inventory Number
 /* Intel-defined CPU features, CPUID level 0x00000007:0.edx, word 9 */
 XEN_CPUFEATURE(AVX512_4VNNIW, 9*32+ 2) /*A  AVX512 Neural Network Instructions */
 XEN_CPUFEATURE(AVX512_4FMAPS, 9*32+ 3) /*A  AVX512 Multiply Accumulation Single Precision */
+XEN_CPUFEATURE(FSRM,          9*32+ 4) /*A  Fast Short REP MOVS */
 XEN_CPUFEATURE(AVX512_VP2INTERSECT, 9*32+8) /*a  VP2INTERSECT{D,Q} insns */
 XEN_CPUFEATURE(SRBDS_CTRL,    9*32+ 9) /*   MSR_MCU_OPT_CTRL and RNGDS_MITG_DIS. */
 XEN_CPUFEATURE(MD_CLEAR,      9*32+10) /*A  VERW clears microarchitectural buffers */
@@ -277,6 +278,9 @@ XEN_CPUFEATURE(SSBD,          9*32+31) /*A  MSR_SPEC_CTRL.SSBD available */
 /* Intel-defined CPU features, CPUID level 0x00000007:1.eax, word 10 */
 XEN_CPUFEATURE(AVX_VNNI,     10*32+ 4) /*A  AVX-VNNI Instructions */
 XEN_CPUFEATURE(AVX512_BF16,  10*32+ 5) /*A  AVX512 BFloat16 Instructions */
+XEN_CPUFEATURE(FZRM,         10*32+10) /*A  Fast Zero-length REP MOVSB */
+XEN_CPUFEATURE(FSRS,         10*32+11) /*A  Fast Short REP STOSB */
+XEN_CPUFEATURE(FSRCS,        10*32+12) /*A  Fast Short REP CMPSB/SCASB */
 
 #endif /* XEN_CPUFEATURE */
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 19 16:55:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 19 Apr 2021 16:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113123.215552 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYXAu-00074G-1a; Mon, 19 Apr 2021 16:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113123.215552; Mon, 19 Apr 2021 16:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYXAt-000748-Us; Mon, 19 Apr 2021 16:55:03 +0000
Received: by outflank-mailman (input) for mailman id 113123;
 Mon, 19 Apr 2021 16:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYXAs-000743-NR
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 16:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYXAs-0005zB-KY
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 16:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYXAs-0006jd-JB
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 16: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=jsbrxI/Xp5yTYZ0Tzv1TGnzlidRGIHdadq4EFeas3Dc=; b=n8VRiOZiYsT11YCgF1jrwy+/+f
	+rPBt8lwsXgEZ5qNjAWOD+0pqrXYTSE5bENH7ENT0m2xutsyfPgH8WyL76jHt0ZFlw6EKP4f6vDH8
	TbVl0lGe2FuIuWLvELGIE5CG+67Tz+0a6WKecjqoHB3kd03PBTtDhxouIByvdkzlRtKs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Include asm/asm-offsets.h and asm/macros.h on every assembly files
Message-Id: <E1lYXAs-0006jd-JB@xenbits.xenproject.org>
Date: Mon, 19 Apr 2021 16:55:02 +0000

commit 8d1ca2ac8d5763e72350b4f1ff34ae3276d99e4a
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sat Jan 23 17:48:45 2021 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Sun Apr 18 18:59:54 2021 +0100

    xen/arm: Include asm/asm-offsets.h and asm/macros.h on every assembly files
    
    In a follow-up patch we may want to automatically replace some
    mnemonics (such as ret) with a different sequence.
    
    To ensure all the assembly files will include asm/macros.h it is best to
    automatically include it on single assembly. This can be done via
    config.h.
    
    It was necessary to include a few more headers as dependency:
      - <asm/asm_defns.h> to define sizeof_*
      - <xen/page-size.h> which is already a latent issue given STACK_ORDER
      rely on PAGE_SIZE.
    
    Unfortunately the build system will use -D__ASSEMBLY__ when generating
    the linker script. A new option -D__LINKER__ is introduceed and used for
    the linker script to avoid including headers (such as asm/macros.h) that
    may not be compatible with the syntax.
    
    Lastly, take the opportunity to remove both asm/asm-offsets.h and
    asm/macros.h from the various assembly files as they are now
    automagically included.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/Makefile                | 2 +-
 xen/arch/arm/arm32/entry.S           | 1 -
 xen/arch/arm/arm32/head.S            | 1 -
 xen/arch/arm/arm32/proc-v7.S         | 1 -
 xen/arch/arm/arm64/debug-cadence.inc | 1 -
 xen/arch/arm/arm64/debug-pl011.inc   | 2 --
 xen/arch/arm/arm64/entry.S           | 2 --
 xen/arch/arm/arm64/head.S            | 2 --
 xen/arch/arm/arm64/smc.S             | 3 ---
 xen/include/asm-arm/config.h         | 6 ++++++
 10 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 46e6a95fec..ca75f1040d 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -134,7 +134,7 @@ asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c
 	$(CC) $(filter-out -flto,$(c_flags)) -S -o $@ $<
 
 xen.lds: xen.lds.S
-	$(CPP) -P $(a_flags) -MQ $@ -o $@ $<
+	$(CPP) -P $(a_flags) -D__LINKER__ -MQ $@ -o $@ $<
 
 dtb.o: $(patsubst "%",%,$(CONFIG_DTB_FILE))
 
diff --git a/xen/arch/arm/arm32/entry.S b/xen/arch/arm/arm32/entry.S
index b228d44b19..f2f1bc7a31 100644
--- a/xen/arch/arm/arm32/entry.S
+++ b/xen/arch/arm/arm32/entry.S
@@ -1,4 +1,3 @@
-#include <asm/asm_defns.h>
 #include <asm/sysregs.h>
 #include <asm/regs.h>
 #include <asm/alternative.h>
diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index 50f019ed98..7178865f48 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -18,7 +18,6 @@
  */
 
 #include <asm/page.h>
-#include <asm/asm_defns.h>
 #include <asm/early_printk.h>
 
 #define ZIMAGE_MAGIC_NUMBER 0x016f2818
diff --git a/xen/arch/arm/arm32/proc-v7.S b/xen/arch/arm/arm32/proc-v7.S
index 46bfc7a907..1efde2d72d 100644
--- a/xen/arch/arm/arm32/proc-v7.S
+++ b/xen/arch/arm/arm32/proc-v7.S
@@ -17,7 +17,6 @@
  * GNU General Public License for more details.
  */
 
-#include <asm/asm_defns.h>
 #include <asm/arm32/processor.h>
 #include <asm/sysregs.h>
 
diff --git a/xen/arch/arm/arm64/debug-cadence.inc b/xen/arch/arm/arm64/debug-cadence.inc
index 7df0abe475..0b6f2e094e 100644
--- a/xen/arch/arm/arm64/debug-cadence.inc
+++ b/xen/arch/arm/arm64/debug-cadence.inc
@@ -17,7 +17,6 @@
  * GNU General Public License for more details.
  */
 
-#include <asm/asm_defns.h>
 #include <asm/cadence-uart.h>
 
 /*
diff --git a/xen/arch/arm/arm64/debug-pl011.inc b/xen/arch/arm/arm64/debug-pl011.inc
index 385deff49b..1928a2e3ff 100644
--- a/xen/arch/arm/arm64/debug-pl011.inc
+++ b/xen/arch/arm/arm64/debug-pl011.inc
@@ -16,8 +16,6 @@
  * GNU General Public License for more details.
  */
 
-#include <asm/asm_defns.h>
-
 /*
  * PL011 UART initialization
  * xb: register which containts the UART base address
diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S
index 175ea2981e..ab9a65fc14 100644
--- a/xen/arch/arm/arm64/entry.S
+++ b/xen/arch/arm/arm64/entry.S
@@ -1,6 +1,4 @@
-#include <asm/asm_defns.h>
 #include <asm/current.h>
-#include <asm/macros.h>
 #include <asm/regs.h>
 #include <asm/alternative.h>
 #include <asm/smccc.h>
diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index f38a8dfca7..aa1f88c764 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -21,11 +21,9 @@
  */
 
 #include <asm/page.h>
-#include <asm/asm_defns.h>
 #include <asm/early_printk.h>
 #include <efi/efierr.h>
 #include <asm/arm64/efibind.h>
-#include <asm/arm64/macros.h>
 
 #define PT_PT     0xf7f /* nG=1 AF=1 SH=11 AP=01 NS=1 ATTR=111 T=1 P=1 */
 #define PT_MEM    0xf7d /* nG=1 AF=1 SH=11 AP=01 NS=1 ATTR=111 T=0 P=1 */
diff --git a/xen/arch/arm/arm64/smc.S b/xen/arch/arm/arm64/smc.S
index b0752be57e..91bae62dd4 100644
--- a/xen/arch/arm/arm64/smc.S
+++ b/xen/arch/arm/arm64/smc.S
@@ -13,9 +13,6 @@
  * GNU General Public License for more details.
  */
 
-#include <asm/asm_defns.h>
-#include <asm/macros.h>
-
 /*
  * void __arm_smccc_1_0_smc(register_t a0, register_t a1, register_t a2,
  *                          register_t a3, register_t a4, register_t a5,
diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h
index 5c10c755db..c7b7791201 100644
--- a/xen/include/asm-arm/config.h
+++ b/xen/include/asm-arm/config.h
@@ -69,6 +69,7 @@
 #endif
 
 #include <xen/const.h>
+#include <xen/page-size.h>
 
 /*
  * Common ARM32 and ARM64 layout:
@@ -190,6 +191,11 @@ extern unsigned long frametable_virt_end;
 #define watchdog_disable() ((void)0)
 #define watchdog_enable()  ((void)0)
 
+#if defined(__ASSEMBLY__) && !defined(__LINKER__)
+#include <asm/asm_defns.h>
+#include <asm/macros.h>
+#endif
+
 #endif /* __ARM_CONFIG_H__ */
 /*
  * Local variables:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Apr 19 16:55:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 19 Apr 2021 16:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113124.215558 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYXB4-00075J-3X; Mon, 19 Apr 2021 16:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113124.215558; Mon, 19 Apr 2021 16:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYXB4-000758-0C; Mon, 19 Apr 2021 16:55:14 +0000
Received: by outflank-mailman (input) for mailman id 113124;
 Mon, 19 Apr 2021 16: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 1lYXB2-00074x-Pg
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 16: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 1lYXB2-0005zH-Ow
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 16:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYXB2-0006nd-Mz
 for xen-changelog@lists.xenproject.org; Mon, 19 Apr 2021 16: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=d8vpWHi7fi0SSl1VRZCf+cQXNkWo/yLTTVYUVrN7pI4=; b=N6n2rhPrm6G/eXHTFoxfLOPm4y
	BS5gn7fViOFhxMMcN8GKfnJzvw1bCYLJq36qZgYzc0bwavD7F7C7TwhmTm7le6Otx8OBY4Jv14TrN
	omS8QK4iY2dnZHB+ub5tSK78AOQUDt2WKn5oN6zjjbVjSGEcjj9f7SOu6UdqLW4bZGMA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: guest_walk: Only generate necessary offsets/masks
Message-Id: <E1lYXB2-0006nd-Mz@xenbits.xenproject.org>
Date: Mon, 19 Apr 2021 16:55:12 +0000

commit 05031fa87357fad155f659cfc2dcce6614834684
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sun Apr 18 19:11:15 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Sun Apr 18 19:11:15 2021 +0100

    xen/arm: guest_walk: Only generate necessary offsets/masks
    
    At the moment, we are computing offsets/masks for each level and
    granularity. This is a bit of waste given that we only need to
    know the offsets/masks for the granularity used by the guest.
    
    All the LPAE information can easily be inferred with just the
    page shift for a given granularity and the level.
    
    So rather than providing a set of helpers per granularity, we can
    provide a single set that takes the granularity and the level in
    parameters.
    
    With the new helpers in place, we can rework guest_walk_ld() to
    only compute necessary information.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Tested-by: Bertrand Marquish <bertrand.marquis@arm.com>
---
 xen/arch/arm/guest_walk.c  | 37 ++-------------------
 xen/include/asm-arm/lpae.h | 82 +++++++++++++++-------------------------------
 2 files changed, 30 insertions(+), 89 deletions(-)

diff --git a/xen/arch/arm/guest_walk.c b/xen/arch/arm/guest_walk.c
index b4496c4c86..87de40d0cb 100644
--- a/xen/arch/arm/guest_walk.c
+++ b/xen/arch/arm/guest_walk.c
@@ -372,38 +372,6 @@ static bool guest_walk_ld(const struct vcpu *v,
     register_t tcr = READ_SYSREG(TCR_EL1);
     struct domain *d = v->domain;
 
-#define OFFSETS(gva, gran)              \
-{                                       \
-    zeroeth_table_offset_##gran(gva),   \
-    first_table_offset_##gran(gva),     \
-    second_table_offset_##gran(gva),    \
-    third_table_offset_##gran(gva)      \
-}
-
-    const paddr_t offsets[3][4] = {
-        OFFSETS(gva, 4K),
-        OFFSETS(gva, 16K),
-        OFFSETS(gva, 64K)
-    };
-
-#undef OFFSETS
-
-#define MASKS(gran)                     \
-{                                       \
-    zeroeth_size(gran) - 1,             \
-    first_size(gran) - 1,               \
-    second_size(gran) - 1,              \
-    third_size(gran) - 1                \
-}
-
-    static const paddr_t masks[3][4] = {
-        MASKS(4K),
-        MASKS(16K),
-        MASKS(64K)
-    };
-
-#undef MASKS
-
     static const unsigned int grainsizes[3] = {
         PAGE_SHIFT_4K,
         PAGE_SHIFT_16K,
@@ -519,7 +487,7 @@ static bool guest_walk_ld(const struct vcpu *v,
          * Add offset given by the GVA to the translation table base address.
          * Shift the offset by 3 as it is 8-byte aligned.
          */
-        paddr |= offsets[gran][level] << 3;
+        paddr |= LPAE_TABLE_INDEX_GS(grainsizes[gran], level, gva) << 3;
 
         /* Access the guest's memory to read only one PTE. */
         ret = access_guest_memory_by_ipa(d, paddr, &pte, sizeof(lpae_t), false);
@@ -572,7 +540,8 @@ static bool guest_walk_ld(const struct vcpu *v,
 
     /* Make sure that the lower bits of the PTE's base address are zero. */
     mask = GENMASK_ULL(47, grainsizes[gran]);
-    *ipa = (pfn_to_paddr(pte.walk.base) & mask) | (gva & masks[gran][level]);
+    *ipa = (pfn_to_paddr(pte.walk.base) & mask) |
+        (gva & (LEVEL_SIZE_GS(grainsizes[gran], level) - 1));
 
     /*
      * Set permissions so that the caller can check the flags by herself. Note
diff --git a/xen/include/asm-arm/lpae.h b/xen/include/asm-arm/lpae.h
index 4797f9cee4..e94de2e7d8 100644
--- a/xen/include/asm-arm/lpae.h
+++ b/xen/include/asm-arm/lpae.h
@@ -160,63 +160,35 @@ static inline bool lpae_is_superpage(lpae_t pte, unsigned int level)
 #define lpae_set_mfn(pte, mfn)  ((pte).walk.base = mfn_x(mfn))
 
 /*
- * AArch64 supports pages with different sizes (4K, 16K, and 64K). To enable
- * page table walks for various configurations, the following helpers enable
- * walking the translation table with varying page size granularities.
+ * AArch64 supports pages with different sizes (4K, 16K, and 64K).
+ * Provide a set of generic helpers that will compute various
+ * information based on the page granularity.
+ *
+ * Note the parameter 'gs' is the page shift of the granularity used.
+ * Some macro will evaluate 'gs' twice rather than storing in a
+ * variable. This is to allow using the macros in assembly.
+ */
+
+/*
+ * Granularity | PAGE_SHIFT | LPAE_SHIFT
+ * -------------------------------------
+ * 4K          | 12         | 9
+ * 16K         | 14         | 11
+ * 64K         | 16         | 13
+ *
+ * This is equivalent to LPAE_SHIFT = PAGE_SHIFT - 3
  */
+#define LPAE_SHIFT_GS(gs)         ((gs) - 3)
+#define LPAE_ENTRIES_GS(gs)       (_AC(1, U) << LPAE_SHIFT_GS(gs))
+#define LPAE_ENTRIES_MASK_GS(gs)  (LPAE_ENTRIES_GS(gs) - 1)
+
+#define LEVEL_ORDER_GS(gs, lvl)   ((3 - (lvl)) * LPAE_SHIFT_GS(gs))
+#define LEVEL_SHIFT_GS(gs, lvl)   (LEVEL_ORDER_GS(gs, lvl) + (gs))
+#define LEVEL_SIZE_GS(gs, lvl)    (_AT(paddr_t, 1) << LEVEL_SHIFT_GS(gs, lvl))
 
-#define LPAE_SHIFT_4K           (9)
-#define LPAE_SHIFT_16K          (11)
-#define LPAE_SHIFT_64K          (13)
-
-#define lpae_entries(gran)      (_AC(1,U) << LPAE_SHIFT_##gran)
-#define lpae_entry_mask(gran)   (lpae_entries(gran) - 1)
-
-#define third_shift(gran)       (PAGE_SHIFT_##gran)
-#define third_size(gran)        ((paddr_t)1 << third_shift(gran))
-
-#define second_shift(gran)      (third_shift(gran) + LPAE_SHIFT_##gran)
-#define second_size(gran)       ((paddr_t)1 << second_shift(gran))
-
-#define first_shift(gran)       (second_shift(gran) + LPAE_SHIFT_##gran)
-#define first_size(gran)        ((paddr_t)1 << first_shift(gran))
-
-/* Note that there is no zeroeth lookup level with a 64K granule size. */
-#define zeroeth_shift(gran)     (first_shift(gran) + LPAE_SHIFT_##gran)
-#define zeroeth_size(gran)      ((paddr_t)1 << zeroeth_shift(gran))
-
-#define TABLE_OFFSET(offs, gran)      (offs & lpae_entry_mask(gran))
-#define TABLE_OFFSET_HELPERS(gran)                                          \
-static inline paddr_t third_table_offset_##gran##K(paddr_t va)              \
-{                                                                           \
-    return TABLE_OFFSET((va >> third_shift(gran##K)), gran##K);             \
-}                                                                           \
-                                                                            \
-static inline paddr_t second_table_offset_##gran##K(paddr_t va)             \
-{                                                                           \
-    return TABLE_OFFSET((va >> second_shift(gran##K)), gran##K);            \
-}                                                                           \
-                                                                            \
-static inline paddr_t first_table_offset_##gran##K(paddr_t va)              \
-{                                                                           \
-    return TABLE_OFFSET((va >> first_shift(gran##K)), gran##K);             \
-}                                                                           \
-                                                                            \
-static inline paddr_t zeroeth_table_offset_##gran##K(paddr_t va)            \
-{                                                                           \
-    /* Note that there is no zeroeth lookup level with 64K granule sizes. */\
-    if ( gran == 64 )                                                       \
-        return 0;                                                           \
-    else                                                                    \
-        return TABLE_OFFSET((va >> zeroeth_shift(gran##K)), gran##K);       \
-}                                                                           \
-
-TABLE_OFFSET_HELPERS(4);
-TABLE_OFFSET_HELPERS(16);
-TABLE_OFFSET_HELPERS(64);
-
-#undef TABLE_OFFSET
-#undef TABLE_OFFSET_HELPERS
+/* Offset in the table at level 'lvl' */
+#define LPAE_TABLE_INDEX_GS(gs, lvl, addr)   \
+    (((addr) >> LEVEL_SHIFT_GS(gs, lvl)) & LPAE_ENTRIES_MASK_GS(gs))
 
 /* Generate an array @var containing the offset for each level from @addr */
 #define DECLARE_OFFSETS(var, addr)          \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 08:11:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 08:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113373.216016 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYlTM-0005sL-B2; Tue, 20 Apr 2021 08:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113373.216016; Tue, 20 Apr 2021 08:11: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 1lYlTM-0005sC-7w; Tue, 20 Apr 2021 08:11:04 +0000
Received: by outflank-mailman (input) for mailman id 113373;
 Tue, 20 Apr 2021 08:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYlTK-0005s7-DQ
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 08:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYlTK-0004a2-9c
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 08:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYlTK-0001A8-7p
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 08:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UqZXTr0EjSCV5fvLRQS2i2WcoZ/WdJ433eDRwkIaLMA=; b=4hxWwHEJ8CfkwnVQMC0dKhWXPs
	KorKDoOLq29EgBHjfjgs+2aown6qONH1LIhfaEMV9YuOVgSRPNVyAM0s+YVxi4/DttC4f7uoEaHzR
	2l9VqLRHdQGTgKdv5IQJsJKwaZasU92gEuYd7ZshEmpy1/DVWCA+Ejb+4lOBljHCiPrg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Drop XGETTEXT from Tools.mk.in
Message-Id: <E1lYlTK-0001A8-7p@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 08:11:02 +0000

commit b5b93627dd1c398a90b832af765b4720fc71814e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Apr 16 16:56:57 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Apr 19 11:38:10 2021 +0100

    tools: Drop XGETTEXT from Tools.mk.in
    
    This hunk was missing from the work to drop gettext as a build dependency.
    
    Fixes: e21a6a4f96 ("tools: Drop gettext as a build dependency")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 config/Tools.mk.in | 1 -
 1 file changed, 1 deletion(-)

diff --git a/config/Tools.mk.in b/config/Tools.mk.in
index d47936686b..934d899967 100644
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -12,7 +12,6 @@ PYTHON              := @PYTHON@
 PYTHON_PATH         := @PYTHONPATH@
 PY_NOOPT_CFLAGS     := @PY_NOOPT_CFLAGS@
 PERL                := @PERL@
-XGETTTEXT           := @XGETTEXT@
 AS86                := @AS86@
 LD86                := @LD86@
 BCC                 := @BCC@
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 09:44:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 09:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113448.216165 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYmvN-0006ZL-Kb; Tue, 20 Apr 2021 09:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113448.216165; Tue, 20 Apr 2021 09:44:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYmvN-0006ZD-Hk; Tue, 20 Apr 2021 09:44:05 +0000
Received: by outflank-mailman (input) for mailman id 113448;
 Tue, 20 Apr 2021 09:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYmvM-0006Z8-JG
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 09:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYmvM-00067u-HO
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 09:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYmvM-0007nr-GQ
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 09:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=x3czAnD65Ky/t5V3y6bl+W0I6G9oENmpRxnT43K+B5E=; b=o/7q1QHa7urDi900dHjcqA/Mkz
	YqO2n6fQ6zRbcbigqOn6ClxnVm33kWZiVdNmaYBsG+tZJDtztN3AyC9UiUVBP2qVw1jUs+bg6Ctsj
	lQ6PVLVJfF7tH4OpxJSxVxLvZlLZ/qu0Az7LTdRzEkTEyRMWJm1KLjcBOcqCnrtFuSCw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vpic: force int output to low when in init mode
Message-Id: <E1lYmvM-0007nr-GQ@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 09:44:04 +0000

commit 1ca901c527d21c083ceb706839db2cdac102926c
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Apr 20 11:34:53 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:34:53 2021 +0200

    x86/vpic: force int output to low when in init mode
    
    When the PIC is on the init sequence prevent interrupt delivery. The
    state of the registers is in the process of being set during the init
    phase, so it makes sense to prevent any int line changes during that
    process.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vpic.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/vpic.c b/xen/arch/x86/hvm/vpic.c
index c1c1de7fd0..9195155ff0 100644
--- a/xen/arch/x86/hvm/vpic.c
+++ b/xen/arch/x86/hvm/vpic.c
@@ -101,11 +101,14 @@ static void vpic_update_int_output(struct hvm_hw_vpic *vpic)
     irq = vpic_get_highest_priority_irq(vpic);
     TRACE_3D(TRC_HVM_EMUL_PIC_INT_OUTPUT, vpic->int_output, vpic->is_master,
              irq);
-    if ( vpic->int_output == (irq >= 0) )
+    if ( vpic->int_output == (!vpic->init_state && irq >= 0) )
         return;
 
-    /* INT line transition L->H or H->L. */
-    vpic->int_output = !vpic->int_output;
+    /*
+     * INT line transition L->H or H->L.
+     * Force line status to L when in init mode.
+     */
+    vpic->int_output = !vpic->init_state && !vpic->int_output;
 
     if ( vpic->int_output )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 09:44:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 09:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113449.216169 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYmvX-0006aG-MC; Tue, 20 Apr 2021 09:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113449.216169; Tue, 20 Apr 2021 09: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 1lYmvX-0006a8-JN; Tue, 20 Apr 2021 09:44:15 +0000
Received: by outflank-mailman (input) for mailman id 113449;
 Tue, 20 Apr 2021 09: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 1lYmvW-0006a1-M9
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 09: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 1lYmvW-000680-LM
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 09:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYmvW-0007oi-Jd
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 09: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=xiXZGMFBTzT/B/aGewd/JaJ/EWZxAC3NjjRA3U4/1uc=; b=5olOSf/5BqitJWut2K4hr9wx52
	+6/5iFKPxna12KXS78u5I8iVXEgLsC9O9ne4yxGVT6aEHbqHsmatQav4gllZfZBCtH7ILx+wzSGaF
	/K5uV9+43/wh4x2r+5mB4oyqf7WCNWqBwS/o8L+ZbPlPWk7Oqa2ZoHaCqMTnMTbtYRBQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vpic: don't trigger unmask event until end of init
Message-Id: <E1lYmvW-0007oi-Jd@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 09:44:14 +0000

commit 192f7479f21ef63dad8d8acbbda93cce0971fe66
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Apr 20 11:35:29 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:35:29 2021 +0200

    x86/vpic: don't trigger unmask event until end of init
    
    Wait until the end of the init sequence to trigger the unmask event.
    Note that it will be unconditionally triggered, but that's harmless if
    not unmask actually happened.
    
    While there change the variable type to bool.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vpic.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vpic.c b/xen/arch/x86/hvm/vpic.c
index 9195155ff0..795a76768d 100644
--- a/xen/arch/x86/hvm/vpic.c
+++ b/xen/arch/x86/hvm/vpic.c
@@ -188,7 +188,8 @@ static void vpic_ioport_write(
     struct hvm_hw_vpic *vpic, uint32_t addr, uint32_t val)
 {
     int priority, cmd;
-    uint8_t mask, unmasked = 0;
+    uint8_t mask;
+    bool unmasked = false;
 
     vpic_lock(vpic);
 
@@ -200,7 +201,6 @@ static void vpic_ioport_write(
             /* Clear edge-sensing logic. */
             vpic->irr &= vpic->elcr;
 
-            unmasked = vpic->imr;
             /* No interrupts masked or in service. */
             vpic->imr = vpic->isr = 0;
 
@@ -294,13 +294,17 @@ static void vpic_ioport_write(
             /* ICW3 */
             vpic->init_state++;
             if ( !(vpic->init_state & 4) )
+            {
                 vpic->init_state = 0; /* No ICW4: init done */
+                unmasked = true;
+            }
             break;
         case 3:
             /* ICW4 */
             vpic->special_fully_nested_mode = (val >> 4) & 1;
             vpic->auto_eoi = (val >> 1) & 1;
             vpic->init_state = 0;
+            unmasked = true;
             break;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 09:44:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 09:44:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113450.216173 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYmvh-0006ba-Nk; Tue, 20 Apr 2021 09:44:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113450.216173; Tue, 20 Apr 2021 09: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 1lYmvh-0006bS-Ku; Tue, 20 Apr 2021 09:44:25 +0000
Received: by outflank-mailman (input) for mailman id 113450;
 Tue, 20 Apr 2021 09: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 1lYmvg-0006bL-QB
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 09: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 1lYmvg-000687-PQ
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 09:44:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYmvg-0007pQ-Nd
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 09: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=AL9hGXn9nwplQ3PelCRf5VICAuEsM2+I49YfjPqOYeA=; b=Ds3yW0aVIxATxLmfg7BVYWcFzp
	6EYFMTZR7ynxZDJUkmO+aePX9GXBSE7SE/i27TQocc8Msuxz6EB60h2uA3zSFc69Stc4S4C2SDkmb
	sCwFng1YYBoed6SqtJG427kbPwZ5ZPpIsQL59VWhhhlyl71QZbKxuOpG5c+1DSRFBEIE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vpic: issue dpci EOI for cleared pins at ICW1
Message-Id: <E1lYmvg-0007pQ-Nd@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 09:44:24 +0000

commit 2d494f2198d7909a394085d079475bb099d7afe7
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Apr 20 11:36:09 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:36:09 2021 +0200

    x86/vpic: issue dpci EOI for cleared pins at ICW1
    
    When pins are cleared from either ISR or IRR as part of the
    initialization sequence forward the clearing of those pins to the dpci
    EOI handler, as it is equivalent to an EOI. Not doing so can bring the
    interrupt controller state out of sync with the dpci handling logic,
    that expects a notification when a pin has been EOI'ed.
    
    Fixes: 7b3cb5e5416 ('IRQ injection changes for HVM PCI passthru.')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vpic.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/xen/arch/x86/hvm/vpic.c b/xen/arch/x86/hvm/vpic.c
index 795a76768d..f465b7f997 100644
--- a/xen/arch/x86/hvm/vpic.c
+++ b/xen/arch/x86/hvm/vpic.c
@@ -197,6 +197,8 @@ static void vpic_ioport_write(
     {
         if ( val & 0x10 )
         {
+            unsigned int pending = vpic->isr | (vpic->irr & ~vpic->elcr);
+
             /* ICW1 */
             /* Clear edge-sensing logic. */
             vpic->irr &= vpic->elcr;
@@ -220,6 +222,24 @@ static void vpic_ioport_write(
             }
 
             vpic->init_state = ((val & 3) << 2) | 1;
+            vpic_update_int_output(vpic);
+            vpic_unlock(vpic);
+
+            /*
+             * Forward the EOI of any pending or in service interrupt that has
+             * been cleared from IRR or ISR, or else the dpci logic will get
+             * out of sync with the state of the interrupt controller.
+             */
+            while ( pending )
+            {
+                unsigned int pin = __scanbit(pending, 8);
+
+                ASSERT(pin < 8);
+                hvm_dpci_eoi(current->domain,
+                             hvm_isa_irq_to_gsi((addr >> 7) ? (pin | 8) : pin));
+                __clear_bit(pin, &pending);
+            }
+            return;
         }
         else if ( val & 0x08 )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 09:44:35 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 09:44:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113451.216177 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYmvr-0006d8-QR; Tue, 20 Apr 2021 09:44:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113451.216177; Tue, 20 Apr 2021 09: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 1lYmvr-0006d1-Ni; Tue, 20 Apr 2021 09:44:35 +0000
Received: by outflank-mailman (input) for mailman id 113451;
 Tue, 20 Apr 2021 09:44:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYmvq-0006ct-UB
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 09:44:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYmvq-00068H-TM
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 09:44:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYmvq-0007qJ-Rh
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 09: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=58uTSp5vpICH4d8nzII6IY+b5RsFDo1tjWUqsZu5PDQ=; b=WT/i6YRzYLa9+/seFQPv1EKA5B
	xUV5KaNWGtEtFC0dReTJhlwq7R0TcMVABHh4twFQs2aecAgSu7ZwqR8tjaX2i3OV0PuziU2LGxs6w
	vgd9MgbD2167IwSYWIKCtqapVvu3RixyS/FmoZs7jBsnFkHvX+SEwd/KaiZ/7h/+Ps5o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/dpci: remove the dpci EOI timer
Message-Id: <E1lYmvq-0007qJ-Rh@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 09:44:34 +0000

commit 730d0f6082e66eefae64f35bc62e51fc54d02d55
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Apr 20 11:36:54 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:36:54 2021 +0200

    x86/dpci: remove the dpci EOI timer
    
    Current interrupt pass though code will setup a timer for each
    interrupt injected to the guest that requires an EOI from the guest.
    Such timer would perform two actions if the guest doesn't EOI the
    interrupt before a given period of time. The first one is deasserting
    the virtual line, the second is perform an EOI of the physical
    interrupt source if it requires such.
    
    The deasserting of the guest virtual line is wrong, since it messes
    with the interrupt status of the guest. This seems to have been done
    in order to compensate for missing deasserts when certain interrupt
    controller actions are performed. The original motivation of the
    introduction of the timer was to fix issues when a GSI was shared
    between different guests. We believe that other changes in the
    interrupt handling code (ie: proper propagation of EOI related actions
    to dpci) will have fixed such errors now.
    
    Performing an EOI of the physical interrupt source is redundant, since
    there's already a timer that takes care of this for all interrupts,
    not just the HVM dpci ones, see irq_guest_action_t struct eoi_timer
    field.
    
    Since both of the actions performed by the dpci timer are not
    required, remove it altogether.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/vtd/x86/hvm.c |  3 --
 xen/drivers/passthrough/x86/hvm.c     | 95 +----------------------------------
 xen/include/asm-x86/hvm/irq.h         |  3 --
 xen/include/xen/iommu.h               |  5 --
 4 files changed, 2 insertions(+), 104 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/x86/hvm.c b/xen/drivers/passthrough/vtd/x86/hvm.c
index f77b35815c..b531fe907a 100644
--- a/xen/drivers/passthrough/vtd/x86/hvm.c
+++ b/xen/drivers/passthrough/vtd/x86/hvm.c
@@ -36,10 +36,7 @@ static int _hvm_dpci_isairq_eoi(struct domain *d,
         {
             hvm_pci_intx_deassert(d, digl->device, digl->intx);
             if ( --pirq_dpci->pending == 0 )
-            {
-                stop_timer(&pirq_dpci->timer);
                 pirq_guest_eoi(dpci_pirq(pirq_dpci));
-            }
         }
     }
 
diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index a6e2863c14..351daafdc9 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -136,77 +136,6 @@ static void pt_pirq_softirq_reset(struct hvm_pirq_dpci *pirq_dpci)
     pirq_dpci->masked = 0;
 }
 
-bool pt_irq_need_timer(uint32_t flags)
-{
-    return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE |
-                      HVM_IRQ_DPCI_NO_EOI));
-}
-
-static int pt_irq_guest_eoi(struct domain *d, struct hvm_pirq_dpci *pirq_dpci,
-                            void *arg)
-{
-    if ( __test_and_clear_bit(_HVM_IRQ_DPCI_EOI_LATCH_SHIFT,
-                              &pirq_dpci->flags) )
-    {
-        pirq_dpci->masked = 0;
-        pirq_dpci->pending = 0;
-        pirq_guest_eoi(dpci_pirq(pirq_dpci));
-    }
-
-    return 0;
-}
-
-static void pt_irq_time_out(void *data)
-{
-    struct hvm_pirq_dpci *irq_map = data;
-    const struct hvm_irq_dpci *dpci;
-    const struct dev_intx_gsi_link *digl;
-
-    spin_lock(&irq_map->dom->event_lock);
-
-    if ( irq_map->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
-    {
-        ASSERT(is_hardware_domain(irq_map->dom));
-        /*
-         * Identity mapped, no need to iterate over the guest GSI list to find
-         * other pirqs sharing the same guest GSI.
-         *
-         * In the identity mapped case the EOI can also be done now, this way
-         * the iteration over the list of domain pirqs is avoided.
-         */
-        hvm_gsi_deassert(irq_map->dom, dpci_pirq(irq_map)->pirq);
-        irq_map->flags |= HVM_IRQ_DPCI_EOI_LATCH;
-        pt_irq_guest_eoi(irq_map->dom, irq_map, NULL);
-        spin_unlock(&irq_map->dom->event_lock);
-        return;
-    }
-
-    dpci = domain_get_irq_dpci(irq_map->dom);
-    if ( unlikely(!dpci) )
-    {
-        ASSERT_UNREACHABLE();
-        spin_unlock(&irq_map->dom->event_lock);
-        return;
-    }
-    list_for_each_entry ( digl, &irq_map->digl_list, list )
-    {
-        unsigned int guest_gsi = hvm_pci_intx_gsi(digl->device, digl->intx);
-        const struct hvm_girq_dpci_mapping *girq;
-
-        list_for_each_entry ( girq, &dpci->girq[guest_gsi], list )
-        {
-            struct pirq *pirq = pirq_info(irq_map->dom, girq->machine_gsi);
-
-            pirq_dpci(pirq)->flags |= HVM_IRQ_DPCI_EOI_LATCH;
-        }
-        hvm_pci_intx_deassert(irq_map->dom, digl->device, digl->intx);
-    }
-
-    pt_pirq_iterate(irq_map->dom, pt_irq_guest_eoi, NULL);
-
-    spin_unlock(&irq_map->dom->event_lock);
-}
-
 struct hvm_irq_dpci *domain_get_irq_dpci(const struct domain *d)
 {
     if ( !d || !is_hvm_domain(d) )
@@ -568,15 +497,10 @@ int pt_irq_create_bind(
                 }
             }
 
-            /* Init timer before binding */
-            if ( pt_irq_need_timer(pirq_dpci->flags) )
-                init_timer(&pirq_dpci->timer, pt_irq_time_out, pirq_dpci, 0);
             /* Deal with gsi for legacy devices */
             rc = pirq_guest_bind(d->vcpu[0], info, share);
             if ( unlikely(rc) )
             {
-                if ( pt_irq_need_timer(pirq_dpci->flags) )
-                    kill_timer(&pirq_dpci->timer);
                 /*
                  * There is no path for __do_IRQ to schedule softirq as
                  * IRQ_GUEST is not set. As such we can reset 'dom' directly.
@@ -743,8 +667,6 @@ int pt_irq_destroy_bind(
     {
         pirq_guest_unbind(d, pirq);
         msixtbl_pt_unregister(d, pirq);
-        if ( pt_irq_need_timer(pirq_dpci->flags) )
-            kill_timer(&pirq_dpci->timer);
         pirq_dpci->flags = 0;
         /*
          * See comment in pt_irq_create_bind's PT_IRQ_TYPE_MSI before the
@@ -934,16 +856,6 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
             __msi_pirq_eoi(pirq_dpci);
             goto out;
         }
-
-        /*
-         * Set a timer to see if the guest can finish the interrupt or not. For
-         * example, the guest OS may unmask the PIC during boot, before the
-         * guest driver is loaded. hvm_pci_intx_assert() may succeed, but the
-         * guest will never deal with the irq, then the physical interrupt line
-         * will never be deasserted.
-         */
-        ASSERT(pt_irq_need_timer(pirq_dpci->flags));
-        set_timer(&pirq_dpci->timer, NOW() + PT_IRQ_TIME_OUT);
     }
 
  out:
@@ -967,10 +879,10 @@ static void hvm_pirq_eoi(struct pirq *pirq)
      * since interrupt is still not EOIed
      */
     if ( --pirq_dpci->pending ||
-         !pt_irq_need_timer(pirq_dpci->flags) )
+         /* When the interrupt source is MSI no Ack should be performed. */
+         (pirq_dpci->flags & HVM_IRQ_DPCI_TRANSLATE) )
         return;
 
-    stop_timer(&pirq_dpci->timer);
     pirq_guest_eoi(pirq);
 }
 
@@ -1042,9 +954,6 @@ static int pci_clean_dpci_irq(struct domain *d,
 
     pirq_guest_unbind(d, dpci_pirq(pirq_dpci));
 
-    if ( pt_irq_need_timer(pirq_dpci->flags) )
-        kill_timer(&pirq_dpci->timer);
-
     list_for_each_entry_safe ( digl, tmp, &pirq_dpci->digl_list, list )
     {
         list_del(&digl->list);
diff --git a/xen/include/asm-x86/hvm/irq.h b/xen/include/asm-x86/hvm/irq.h
index 717c2299de..c4369ceb7a 100644
--- a/xen/include/asm-x86/hvm/irq.h
+++ b/xen/include/asm-x86/hvm/irq.h
@@ -116,7 +116,6 @@ struct dev_intx_gsi_link {
 #define _HVM_IRQ_DPCI_MACH_PCI_SHIFT            0
 #define _HVM_IRQ_DPCI_MACH_MSI_SHIFT            1
 #define _HVM_IRQ_DPCI_MAPPED_SHIFT              2
-#define _HVM_IRQ_DPCI_EOI_LATCH_SHIFT           3
 #define _HVM_IRQ_DPCI_GUEST_PCI_SHIFT           4
 #define _HVM_IRQ_DPCI_GUEST_MSI_SHIFT           5
 #define _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT        6
@@ -125,7 +124,6 @@ struct dev_intx_gsi_link {
 #define HVM_IRQ_DPCI_MACH_PCI        (1u << _HVM_IRQ_DPCI_MACH_PCI_SHIFT)
 #define HVM_IRQ_DPCI_MACH_MSI        (1u << _HVM_IRQ_DPCI_MACH_MSI_SHIFT)
 #define HVM_IRQ_DPCI_MAPPED          (1u << _HVM_IRQ_DPCI_MAPPED_SHIFT)
-#define HVM_IRQ_DPCI_EOI_LATCH       (1u << _HVM_IRQ_DPCI_EOI_LATCH_SHIFT)
 #define HVM_IRQ_DPCI_GUEST_PCI       (1u << _HVM_IRQ_DPCI_GUEST_PCI_SHIFT)
 #define HVM_IRQ_DPCI_GUEST_MSI       (1u << _HVM_IRQ_DPCI_GUEST_MSI_SHIFT)
 #define HVM_IRQ_DPCI_IDENTITY_GSI    (1u << _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT)
@@ -170,7 +168,6 @@ struct hvm_pirq_dpci {
     struct list_head digl_list;
     struct domain *dom;
     struct hvm_gmsi_info gmsi;
-    struct timer timer;
     struct list_head softirq_list;
 };
 
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index ea0cd0f1a2..4f0e5ac622 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -183,11 +183,6 @@ int pt_irq_destroy_bind(struct domain *, const struct xen_domctl_bind_pt_irq *);
 void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq);
 struct hvm_irq_dpci *domain_get_irq_dpci(const struct domain *);
 void free_hvm_irq_dpci(struct hvm_irq_dpci *dpci);
-#ifdef CONFIG_HVM
-bool pt_irq_need_timer(uint32_t flags);
-#else
-static inline bool pt_irq_need_timer(unsigned int flags) { return false; }
-#endif
 
 struct msi_desc;
 struct msi_msg;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:00:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:00:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113471.216222 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnAs-0000Cm-1R; Tue, 20 Apr 2021 10:00:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113471.216222; Tue, 20 Apr 2021 10:00:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnAr-0000Ca-Se; Tue, 20 Apr 2021 10:00:05 +0000
Received: by outflank-mailman (input) for mailman id 113471;
 Tue, 20 Apr 2021 10: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 1lYnAr-00008k-Fl
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10: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 1lYnAr-0006WZ-Ev
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:00:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnAr-0001Cb-DQ
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10: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=3hkuYLlHnnfiI1+tqSFo59ZVYv5wIF91mh+t2/RjUM4=; b=TCzhg8GD/SxdUqzBeYQeId9ks+
	WtSNibPSzqrrW3M+OlBMN37veJae8ACn1/Dy0oO8o7UE/EP7sNxYo+moxssLlLccaS1gFE1RZgDVN
	nhSEr5WVIcRVAGGtGogQ2u8111svUUPRthJmYmyB5TZRRl6RoBUAUGQmovEQp98z8rQs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] VT-d: leave FECTL write to vtd_resume()
Message-Id: <E1lYnAr-0001Cb-DQ@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:00:05 +0000

commit baa6957c3a21283af1e2c3161ec8a2fe7970a89f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 11:54:34 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:54:34 2021 +0200

    VT-d: leave FECTL write to vtd_resume()
    
    We shouldn't blindly unmask the interrupt when resuming. vtd_resume()
    will restore the intended state.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 0d597e7bd1bd8a57619690d457f79769777a5834
    master date: 2021-03-30 14:39:23 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 44e407d19f..058f55f9a0 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2092,7 +2092,7 @@ static int adjust_vtd_irq_affinities(void)
 }
 __initcall(adjust_vtd_irq_affinities);
 
-static int __must_check init_vtd_hw(void)
+static int __must_check init_vtd_hw(bool resume)
 {
     struct acpi_drhd_unit *drhd;
     struct vtd_iommu *iommu;
@@ -2121,6 +2121,10 @@ static int __must_check init_vtd_hw(void)
             disable_qinval(iommu);
         }
 
+        if ( resume )
+            /* FECTL write done by vtd_resume(). */
+            continue;
+
         spin_lock_irqsave(&iommu->register_lock, flags);
         sts = dmar_readl(iommu->reg, DMAR_FECTL_REG);
         sts &= ~DMA_FECTL_IM;
@@ -2320,7 +2324,7 @@ static int __init vtd_setup(void)
     P(iommu_hap_pt_share, "Shared EPT tables");
 #undef P
 
-    ret = init_vtd_hw();
+    ret = init_vtd_hw(false);
     if ( ret )
         goto error;
 
@@ -2590,7 +2594,7 @@ static void vtd_resume(void)
     if ( !iommu_enabled )
         return;
 
-    if ( init_vtd_hw() != 0  && force_iommu )
+    if ( init_vtd_hw(true) != 0 && force_iommu )
          panic("IOMMU setup failed, crash Xen for security purpose\n");
 
     for_each_drhd_unit ( drhd )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:00:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:00:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113472.216224 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnB3-0000M5-0p; Tue, 20 Apr 2021 10:00:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113472.216224; Tue, 20 Apr 2021 10:00:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnB2-0000Lx-UA; Tue, 20 Apr 2021 10:00:16 +0000
Received: by outflank-mailman (input) for mailman id 113472;
 Tue, 20 Apr 2021 10:00:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnB1-0000Ln-JY
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:00:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnB1-0006Wh-Io
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:00:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnB1-0001Di-HC
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:00: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=ao/MTjxkc4w71NzdPD6ZhWgUY6o+hX1a9dlP2KNKEqI=; b=VE8W3fUwvlEuoCJlT2opR37MLh
	zyW3BEfZCXgZJPZHJ04tDyLI68ro/0AIK91RHhISXtKscwivYrrLUpGdKlYfTmtuFTMHthBiijMX4
	5uew8D6NMeKrV6ymriCVQdSolZFJriXlkEbkdu6xio43dxcC4JgBxY/17lBREPAEVl7A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] VT-d: re-order register restoring in vtd_resume()
Message-Id: <E1lYnB1-0001Di-HC@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:00:15 +0000

commit 92dd3b56a7b5b284cf4f0c82945c35cf8ee54cc9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 11:55:19 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:55:19 2021 +0200

    VT-d: re-order register restoring in vtd_resume()
    
    For one FECTL must be written last - the interrupt shouldn't be unmasked
    without first having written the data and address needed to actually
    deliver it. In the common case (when dma_msi_set_affinity() doesn't end
    up bailing early) this happens from init_vtd_hw(), but for this to
    actually have the intended effect we shouldn't subsequently overwrite
    what was written there - this is only benign when old and new settings
    match. Instead we should restore the registers ahead of calling
    init_vtd_hw(), just for the unlikely case of dma_msi_set_affinity()
    bailing early.
    
    In the moved code drop some stray casts as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 95e07f8c0e64889ee56015c7f99bdf5309e9e8ef
    master date: 2021-03-30 14:39:54 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 058f55f9a0..114f9512e9 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2594,6 +2594,21 @@ static void vtd_resume(void)
     if ( !iommu_enabled )
         return;
 
+    for_each_drhd_unit ( drhd )
+    {
+        iommu = drhd->iommu;
+        i = iommu->index;
+
+        spin_lock_irqsave(&iommu->register_lock, flags);
+        dmar_writel(iommu->reg, DMAR_FEDATA_REG,
+                    iommu_state[i][DMAR_FEDATA_REG]);
+        dmar_writel(iommu->reg, DMAR_FEADDR_REG,
+                    iommu_state[i][DMAR_FEADDR_REG]);
+        dmar_writel(iommu->reg, DMAR_FEUADDR_REG,
+                    iommu_state[i][DMAR_FEUADDR_REG]);
+        spin_unlock_irqrestore(&iommu->register_lock, flags);
+    }
+
     if ( init_vtd_hw(true) != 0 && force_iommu )
          panic("IOMMU setup failed, crash Xen for security purpose\n");
 
@@ -2605,12 +2620,6 @@ static void vtd_resume(void)
         spin_lock_irqsave(&iommu->register_lock, flags);
         dmar_writel(iommu->reg, DMAR_FECTL_REG,
                     (u32) iommu_state[i][DMAR_FECTL_REG]);
-        dmar_writel(iommu->reg, DMAR_FEDATA_REG,
-                    (u32) iommu_state[i][DMAR_FEDATA_REG]);
-        dmar_writel(iommu->reg, DMAR_FEADDR_REG,
-                    (u32) iommu_state[i][DMAR_FEADDR_REG]);
-        dmar_writel(iommu->reg, DMAR_FEUADDR_REG,
-                    (u32) iommu_state[i][DMAR_FEUADDR_REG]);
         spin_unlock_irqrestore(&iommu->register_lock, flags);
 
         iommu_enable_translation(drhd);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:00:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:00:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113473.216228 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnBD-0000Nd-2U; Tue, 20 Apr 2021 10:00:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113473.216228; Tue, 20 Apr 2021 10:00:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnBC-0000NV-Vd; Tue, 20 Apr 2021 10:00:26 +0000
Received: by outflank-mailman (input) for mailman id 113473;
 Tue, 20 Apr 2021 10:00:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnBB-0000NM-Q5
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:00:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnBB-0006Wr-M0
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:00:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnBB-0001ER-L7
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:00:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PtwKRqUzy3G2YjpMVUY52to+6ueNhiZybw+vSifz+xc=; b=S20ABmL+KRAAOIZh+lGOFl384I
	KUQxRmW/AkNg74RWlDKnAJSrUYf4zzqqljua5W1h9u7+NLOu4s1kXt3FJdGLNtlbrW6zTpdwoo1I5
	YbSCi0wsqvPqklX+TmJH0czhV/ZdKq+6chYi1n1QKKZx4qoiwZOGH7pBpLg2131zJFz8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] VT-d: restore flush hooks when disabling qinval
Message-Id: <E1lYnBB-0001ER-L7@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:00:25 +0000

commit bb071ce80d5536a5ae566d33d69a81cc62fdc1b3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 11:55:47 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:55:47 2021 +0200

    VT-d: restore flush hooks when disabling qinval
    
    Leaving the hooks untouched is at best a latent risk: There may well be
    cases where some flush is needed, which then needs carrying out the
    "register" way.
    
    Switch from u<N> to uint<N>_t while needing to touch the function
    headers anyway.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 9c39dba2b179c0f4c42c98e97ea0878119718530
    master date: 2021-03-30 14:40:24 +0200
---
 xen/drivers/passthrough/vtd/extern.h | 10 ++++++++++
 xen/drivers/passthrough/vtd/iommu.c  | 19 ++++++++-----------
 xen/drivers/passthrough/vtd/qinval.c |  3 +++
 3 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 19a908ab4f..156177bb3f 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -49,6 +49,16 @@ int iommu_flush_iec_global(struct vtd_iommu *iommu);
 int iommu_flush_iec_index(struct vtd_iommu *iommu, u8 im, u16 iidx);
 void clear_fault_bits(struct vtd_iommu *iommu);
 
+int __must_check vtd_flush_context_reg(struct vtd_iommu *iommu, uint16_t did,
+                                       uint16_t source_id,
+                                       uint8_t function_mask, uint64_t type,
+                                       bool flush_non_present_entry);
+int __must_check vtd_flush_iotlb_reg(struct vtd_iommu *iommu, uint16_t did,
+                                     uint64_t addr, unsigned int size_order,
+                                     uint64_t type,
+                                     bool flush_non_present_entry,
+                                     bool flush_dev_iotlb);
+
 struct vtd_iommu *ioapic_to_iommu(unsigned int apic_id);
 struct vtd_iommu *hpet_to_iommu(unsigned int hpet_id);
 struct acpi_drhd_unit *ioapic_to_drhd(unsigned int apic_id);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 114f9512e9..6428c8fe3e 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -380,10 +380,9 @@ static void iommu_flush_write_buffer(struct vtd_iommu *iommu)
 }
 
 /* return value determine if we need a write buffer flush */
-static int __must_check flush_context_reg(struct vtd_iommu *iommu, u16 did,
-                                          u16 source_id, u8 function_mask,
-                                          u64 type,
-                                          bool flush_non_present_entry)
+int vtd_flush_context_reg(struct vtd_iommu *iommu, uint16_t did,
+                          uint16_t source_id, uint8_t function_mask,
+                          uint64_t type, bool flush_non_present_entry)
 {
     u64 val = 0;
     unsigned long flags;
@@ -449,11 +448,9 @@ static int __must_check iommu_flush_context_device(struct vtd_iommu *iommu,
 }
 
 /* return value determine if we need a write buffer flush */
-static int __must_check flush_iotlb_reg(struct vtd_iommu *iommu, u16 did,
-                                        u64 addr,
-                                        unsigned int size_order, u64 type,
-                                        bool flush_non_present_entry,
-                                        bool flush_dev_iotlb)
+int vtd_flush_iotlb_reg(struct vtd_iommu *iommu, uint16_t did, uint64_t addr,
+                        unsigned int size_order, uint64_t type,
+                        bool flush_non_present_entry, bool flush_dev_iotlb)
 {
     int tlb_offset = ecap_iotlb_offset(iommu->ecap);
     u64 val = 0;
@@ -2144,8 +2141,8 @@ static int __must_check init_vtd_hw(bool resume)
          */
         if ( enable_qinval(iommu) != 0 )
         {
-            iommu->flush.context = flush_context_reg;
-            iommu->flush.iotlb   = flush_iotlb_reg;
+            iommu->flush.context = vtd_flush_context_reg;
+            iommu->flush.iotlb   = vtd_flush_iotlb_reg;
         }
     }
 
diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c
index 39b7abd009..764ef9f0fc 100644
--- a/xen/drivers/passthrough/vtd/qinval.c
+++ b/xen/drivers/passthrough/vtd/qinval.c
@@ -462,4 +462,7 @@ void disable_qinval(struct vtd_iommu *iommu)
                   !(sts & DMA_GSTS_QIES), sts);
 out:
     spin_unlock_irqrestore(&iommu->register_lock, flags);
+
+    iommu->flush.context = vtd_flush_context_reg;
+    iommu->flush.iotlb   = vtd_flush_iotlb_reg;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:00:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:00:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113474.216232 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnBN-0000Ow-3m; Tue, 20 Apr 2021 10:00:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113474.216232; Tue, 20 Apr 2021 10:00:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnBN-0000Oo-0q; Tue, 20 Apr 2021 10:00:37 +0000
Received: by outflank-mailman (input) for mailman id 113474;
 Tue, 20 Apr 2021 10:00:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnBL-0000Of-Pw
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:00:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnBL-0006X0-PD
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:00:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnBL-0001FM-OG
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:00:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Lj5awDwMYhVK2YZ3g7PX8TrOhmvO7/oEFb0NQ5jzqDw=; b=zAoq/SgqzFcU1aJ4YetGDzmmBX
	G9bwLz0KFRebDKg3U+FM5gGqBV5C1yMa8i8/ZfivkApjHuNt3Nzr/nf/xHZ1yJPKX6bJo/ktV03+h
	o+7/8fKEzR92aYzz6xL+8nKjW2oSSld1NWWfxTJtS8+qMQEgpSntK/wLHUEnz5NjbYbU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] fix for_each_cpu() again for NR_CPUS=1
Message-Id: <E1lYnBL-0001FM-OG@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:00:35 +0000

commit 5788a7e61145d0ad4f93d3ff22f7d6b5dfef7478
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 11:56:11 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:56:11 2021 +0200

    fix for_each_cpu() again for NR_CPUS=1
    
    Unfortunately aa50f45332f1 ("xen: fix for_each_cpu when NR_CPUS=1") has
    caused quite a bit of fallout with gcc10, e.g. (there are at least two
    more similar ones, and I didn't bother trying to find them all):
    
    In file included from .../xen/include/xen/config.h:13,
                     from <command-line>:
    core_parking.c: In function ‘core_parking_power’:
    .../xen/include/asm/percpu.h:12:51: error: array subscript 1 is above array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds]
       12 |     (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
    .../xen/include/xen/compiler.h:141:29: note: in definition of macro ‘RELOC_HIDE’
      141 |     (typeof(ptr)) (__ptr + (off)); })
          |                             ^~~
    core_parking.c:133:39: note: in expansion of macro ‘per_cpu’
      133 |             core_tmp = cpumask_weight(per_cpu(cpu_core_mask, cpu));
          |                                       ^~~~~~~
    In file included from .../xen/include/xen/percpu.h:4,
                     from .../xen/include/asm/msr.h:7,
                     from .../xen/include/asm/time.h:5,
                     from .../xen/include/xen/time.h:76,
                     from .../xen/include/xen/spinlock.h:4,
                     from .../xen/include/xen/cpu.h:5,
                     from core_parking.c:19:
    .../xen/include/asm/percpu.h:6:22: note: while referencing ‘__per_cpu_offset’
        6 | extern unsigned long __per_cpu_offset[NR_CPUS];
          |                      ^~~~~~~~~~~~~~~~
    
    One of the further errors even went as far as claiming that an array
    index (range) of [0, 0] was outside the bounds of a [1] array, so
    something fishy is pretty clearly going on there.
    
    The compiler apparently wants to be able to see that the loop isn't
    really a loop in order to avoid triggering such warnings, yet what
    exactly makes it consider the loop exit condition constant and within
    the [0, 1] range isn't obvious - using ((mask)->bits[0] & 1) instead of
    cpumask_test_cpu() for example did _not_ help.
    
    Re-instate a special form of for_each_cpu(), experimentally "proven" to
    avoid the diagnostics.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
    master commit: 625faf9f002bd6ff4b6457a016b8ff338223b659
    master date: 2021-04-07 12:24:45 +0200
---
 xen/include/xen/cpumask.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/xen/cpumask.h b/xen/include/xen/cpumask.h
index e69589fc08..9826707909 100644
--- a/xen/include/xen/cpumask.h
+++ b/xen/include/xen/cpumask.h
@@ -368,10 +368,15 @@ static inline void free_cpumask_var(cpumask_var_t mask)
 #define FREE_CPUMASK_VAR(m) free_cpumask_var(m)
 #endif
 
+#if NR_CPUS > 1
 #define for_each_cpu(cpu, mask)			\
 	for ((cpu) = cpumask_first(mask);	\
 	     (cpu) < nr_cpu_ids;		\
 	     (cpu) = cpumask_next(cpu, mask))
+#else /* NR_CPUS == 1 */
+#define for_each_cpu(cpu, mask)			\
+	for ((cpu) = 0; (cpu) < cpumask_test_cpu(0, mask); ++(cpu))
+#endif /* NR_CPUS */
 
 /*
  * The following particular system cpumasks and operations manage
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:00:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:00:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113475.216235 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnBX-0000QU-6N; Tue, 20 Apr 2021 10:00:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113475.216235; Tue, 20 Apr 2021 10:00:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnBX-0000QM-3W; Tue, 20 Apr 2021 10:00:47 +0000
Received: by outflank-mailman (input) for mailman id 113475;
 Tue, 20 Apr 2021 10:00: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 1lYnBV-0000QD-Tt
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:00: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 1lYnBV-0006XH-SF
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:00:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnBV-0001GS-RU
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:00: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=LkWQMmRRdAPdp6j5H8s6DhfHsPOF+2yHnMYAsxDs8dM=; b=7LOD795OlZBwiImJHMUyu1XqmG
	lp04NWMdpdwJso+ExIDF53Os8uEPkNvi9BAQLw5y7PbPs4rmVukb/GY5c4+oOAwxcqSmDqV8he9vx
	vOXsPkdw2TtRKWxNJqe80r3piY353sbqzXf3gKR3H1lz5FdeBJtv9OIi9cGxXads5w4A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/vpt: do not take pt_migrate rwlock in some cases
Message-Id: <E1lYnBV-0001GS-RU@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:00:45 +0000

commit e2e80ff86f76a898416be1a8b74edb9a64af8288
Author:     Boris Ostrovsky <boris.ostrovsky@oracle.com>
AuthorDate: Tue Apr 20 11:57:26 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:57:26 2021 +0200

    x86/vpt: do not take pt_migrate rwlock in some cases
    
    Commit 8e76aef72820 ("x86/vpt: fix race when migrating timers between
    vCPUs") addressed XSA-336 by introducing a per-domain rwlock that was
    intended to protect periodic timer during VCPU migration. Since such
    migration is an infrequent event no performance impact was expected.
    
    Unfortunately this turned out not to be the case: on a fairly large
    guest (92 VCPUs) we've observed as much as 40% TPCC performance
    regression with some guest kernels. Further investigation pointed to
    pt_migrate read lock taken in pt_update_irq() as the largest contributor
    to this regression. With large number of VCPUs and large number of VMEXITs
    (from where pt_update_irq() is always called) the update of an atomic in
    read_lock() is thought to be the main cause.
    
    Stephen Brennan analyzed locking pattern and classified lock users as
    follows:
    
    1. Functions which read (maybe write) all periodic_time instances attached
    to a particular vCPU. These are functions which use pt_vcpu_lock() such
    as pt_restore_timer(), pt_save_timer(), etc.
    2. Functions which want to modify a particular periodic_time object.
    These functions lock whichever vCPU the periodic_time is attached to, but
    since the vCPU could be modified without holding any lock, they are
    vulnerable to XSA-336. Functions in this group use pt_lock(), such as
    pt_timer_fn() or destroy_periodic_time().
    3. Functions which not only want to modify the periodic_time, but also
    would like to modify the =vcpu= fields. These are create_periodic_time()
    or pt_adjust_vcpu(). They create XSA-336 conditions for group 2, but we
    can't simply hold 2 vcpu locks due to the deadlock risk.
    
    Roger then pointed out that group 1 functions don't really need to hold
    the pt_migrate rwlock and that instead groups 2 and 3 should hold per-vcpu
    lock whenever they modify per-vcpu timer lists.
    
    Suggested-by: Stephen Brennan <stephen.s.brennan@oracle.com>
    Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Stephen Brennan <stephen.s.brennan@oracle.com>
    master commit: 1f3d87c7512975274cc45c40097b05550eba1ac9
    master date: 2021-04-09 09:21:27 +0200
---
 xen/arch/x86/hvm/vpt.c        | 44 ++++++++++++++++++++++++++++++++++---------
 xen/include/asm-x86/hvm/vpt.h | 18 ++++++++++++------
 2 files changed, 47 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 4c2afe2e91..560fab9cfc 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -153,32 +153,43 @@ static int pt_irq_masked(struct periodic_time *pt)
     return 1;
 }
 
+/*
+ * Functions which read (maybe write) all periodic_time instances
+ * attached to a particular vCPU use pt_vcpu_{un}lock locking helpers.
+ *
+ * Such users are explicitly forbidden from changing the value of the
+ * pt->vcpu field, because another thread holding the pt_migrate lock
+ * may already be spinning waiting for your vcpu lock.
+ */
 static void pt_vcpu_lock(struct vcpu *v)
 {
-    read_lock(&v->domain->arch.hvm.pl_time->pt_migrate);
     spin_lock(&v->arch.hvm.tm_lock);
 }
 
 static void pt_vcpu_unlock(struct vcpu *v)
 {
     spin_unlock(&v->arch.hvm.tm_lock);
-    read_unlock(&v->domain->arch.hvm.pl_time->pt_migrate);
 }
 
+/*
+ * Functions which want to modify a particular periodic_time object
+ * use pt_{un}lock locking helpers.
+ *
+ * These users lock whichever vCPU the periodic_time is attached to,
+ * but since the vCPU could be modified without holding any lock, they
+ * need to take an additional lock that protects against pt->vcpu
+ * changing.
+ */
 static void pt_lock(struct periodic_time *pt)
 {
-    /*
-     * We cannot use pt_vcpu_lock here, because we need to acquire the
-     * per-domain lock first and then (re-)fetch the value of pt->vcpu, or
-     * else we might be using a stale value of pt->vcpu.
-     */
     read_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
     spin_lock(&pt->vcpu->arch.hvm.tm_lock);
 }
 
 static void pt_unlock(struct periodic_time *pt)
 {
-    pt_vcpu_unlock(pt->vcpu);
+    spin_unlock(&pt->vcpu->arch.hvm.tm_lock);
+    read_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
 }
 
 static void pt_process_missed_ticks(struct periodic_time *pt)
@@ -543,8 +554,10 @@ void create_periodic_time(
     pt->cb = cb;
     pt->priv = data;
 
+    pt_vcpu_lock(v);
     pt->on_list = 1;
     list_add(&pt->list, &v->arch.hvm.tm_list);
+    pt_vcpu_unlock(v);
 
     init_timer(&pt->timer, pt_timer_fn, pt, v->processor);
     set_timer(&pt->timer, pt->scheduled);
@@ -580,13 +593,26 @@ static void pt_adjust_vcpu(struct periodic_time *pt, struct vcpu *v)
         return;
 
     write_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
+
+    if ( pt->vcpu == v )
+        goto out;
+
+    pt_vcpu_lock(pt->vcpu);
+    if ( pt->on_list )
+        list_del(&pt->list);
+    pt_vcpu_unlock(pt->vcpu);
+
     pt->vcpu = v;
+
+    pt_vcpu_lock(v);
     if ( pt->on_list )
     {
-        list_del(&pt->list);
         list_add(&pt->list, &v->arch.hvm.tm_list);
         migrate_timer(&pt->timer, v->processor);
     }
+    pt_vcpu_unlock(v);
+
+ out:
     write_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
 }
 
diff --git a/xen/include/asm-x86/hvm/vpt.h b/xen/include/asm-x86/hvm/vpt.h
index 39d26cbda4..74c0cedd11 100644
--- a/xen/include/asm-x86/hvm/vpt.h
+++ b/xen/include/asm-x86/hvm/vpt.h
@@ -128,12 +128,18 @@ struct pl_time {    /* platform time */
     struct RTCState  vrtc;
     struct HPETState vhpet;
     struct PMTState  vpmt;
-    /*
-     * rwlock to prevent periodic_time vCPU migration. Take the lock in read
-     * mode in order to prevent the vcpu field of periodic_time from changing.
-     * Lock must be taken in write mode when changes to the vcpu field are
-     * performed, as it allows exclusive access to all the timers of a domain.
-     */
+     /*
+      * Functions which want to modify the vcpu field of the vpt need
+      * to hold the global lock (pt_migrate) in write mode together
+      * with the per-vcpu locks of the lists being modified. Functions
+      * that want to lock a periodic_timer that's possibly on a
+      * different vCPU list need to take the lock in read mode first in
+      * order to prevent the vcpu field of periodic_timer from
+      * changing.
+      *
+      * Note that two vcpu locks cannot be held at the same time to
+      * avoid a deadlock.
+      */
     rwlock_t pt_migrate;
     /* guest_time = Xen sys time + stime_offset */
     int64_t stime_offset;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:00:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:00:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113476.216240 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnBh-0000Rx-8A; Tue, 20 Apr 2021 10:00:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113476.216240; Tue, 20 Apr 2021 10:00:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnBh-0000Rp-5A; Tue, 20 Apr 2021 10:00:57 +0000
Received: by outflank-mailman (input) for mailman id 113476;
 Tue, 20 Apr 2021 10:00:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnBf-0000Rh-W9
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:00: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 1lYnBf-0006Xh-VB
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:00:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnBf-0001H6-UR
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:00: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=Pw5pdjkqa1NIPHk2KYwUKSy64bOHGZoT1f7RETxm0qU=; b=YXjdxzuFZxWmhd3Z8jPxE4HIRt
	1j5ppJKLCCDSbId67d4IFhpHRiXVqTBQGA5ewELm+qAhJQlYZ3ZHaNrFXrk53bFkZarLNX7lfpinH
	na8PQXpR8bpr+5SrxDSx50tsgOTAnlAfnUbTmAkjh7qDA46Pp3qqnIknd8bTmmnd38HE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] Revert "x86/HPET: don't enable legacy replacement mode unconditionally"
Message-Id: <E1lYnBf-0001H6-UR@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:00:55 +0000

commit c129b5fd1430b50f4e6b275a070908d34dcef0dc
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Apr 20 11:58:06 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:58:06 2021 +0200

    Revert "x86/HPET: don't enable legacy replacement mode unconditionally"
    
    This reverts commit e680cc48b7184d3489873d6776f84ba1fc238ced.
    
    It was committed despite multiple objections.  The agreed upon fix is a
    different variation of the same original patch, and the delta between the two
    is far from clear.
    
    By reverting this commit first, the fixes are clear and coherent as individual
    patches, and in the appropriate form for backport to the older trees.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 2b05d427a09e108589dc57f54b517d0ffdf973ef
    master date: 2021-04-15 18:25:40 +0100
---
 docs/misc/xen-command-line.pandoc | 17 -----------------
 xen/arch/x86/hpet.c               | 37 ++++++-------------------------------
 2 files changed, 6 insertions(+), 48 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index deef6d0b4c..a0601ff838 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1274,26 +1274,9 @@ supported. See docs/misc/arm/big.LITTLE.txt for more information.
 When the hmp-unsafe option is disabled (default), CPUs that are not
 identical to the boot CPU will be parked and not used by Xen.
 
-### hpet (x86)
-> `= List of [ <boolean> | broadcast | legacy-replacement ]`
-
-> Default : `true`, `no-broadcast`, 'no-legacy-replacement`
-
-Controls Xen's use of the system's High Precision Event Timer.  The boolean
-allows to turn off use altogether.
-
-`broadcast` forces Xen to keep using the broadcast for CPUs in deep C-states
-even when an RTC interrupt got enabled.
-
-`legacy-replacement` is intended to be used on platforms where the timer
-interrupt doesn't get raised by the legacy PIT.  This then also affects
-raising of the RTC interrupt.
-
 ### hpetbroadcast (x86)
 > `= <boolean>`
 
-Deprecated alternative of `hpet=broadcast`.
-
 ### hvm_debug (x86)
 > `= <integer>`
 
diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 76d9ef2c02..1ff005fb4a 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -52,8 +52,6 @@ static unsigned int __read_mostly num_hpets_used;
 DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel);
 
 unsigned long __initdata hpet_address;
-static bool __initdata opt_hpet = true;
-static bool __initdata opt_legacy_replacement;
 u8 __initdata hpet_blockid;
 u8 __initdata hpet_flags;
 
@@ -65,32 +63,6 @@ u8 __initdata hpet_flags;
 static bool __initdata force_hpet_broadcast;
 boolean_param("hpetbroadcast", force_hpet_broadcast);
 
-static int __init parse_hpet_param(const char *s)
-{
-    const char *ss;
-    int val, rc = 0;
-
-    do {
-        ss = strchr(s, ',');
-        if ( !ss )
-            ss = strchr(s, '\0');
-
-        if ( (val = parse_bool(s, ss)) >= 0 )
-            opt_hpet = val;
-        else if ( (val = parse_boolean("broadcast", s, ss)) >= 0 )
-            force_hpet_broadcast = val;
-        else if ( (val = parse_boolean("legacy-replacement", s, ss)) >= 0 )
-            opt_legacy_replacement = val;
-        else
-            rc = -EINVAL;
-
-        s = ss + 1;
-    } while ( *ss );
-
-    return rc;
-}
-custom_param("hpet", parse_hpet_param);
-
 /*
  * Calculate a multiplication factor for scaled math, which is used to convert
  * nanoseconds based values to clock ticks:
@@ -789,9 +761,12 @@ u64 __init hpet_setup(void)
     unsigned int hpet_id, hpet_period, hpet_cfg;
     unsigned int last, rem;
 
-    if ( hpet_rate || !hpet_address || !opt_hpet )
+    if ( hpet_rate )
         return hpet_rate;
 
+    if ( hpet_address == 0 )
+        return 0;
+
     set_fixmap_nocache(FIX_HPET_BASE, hpet_address);
 
     hpet_id = hpet_read32(HPET_ID);
@@ -828,9 +803,9 @@ u64 __init hpet_setup(void)
      * IRQ routing is configured.
      *
      * Reconfigure the HPET into legacy mode to re-establish the timer
-     * interrupt, if available and if so requested.
+     * interrupt.
      */
-    if ( opt_legacy_replacement && (hpet_id & HPET_ID_LEGSUP) &&
+    if ( hpet_id & HPET_ID_LEGSUP &&
          !((hpet_cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
     {
         unsigned int c0_cfg, ticks, count;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:01:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:01:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113477.216244 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnBr-0000TP-9y; Tue, 20 Apr 2021 10:01:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113477.216244; Tue, 20 Apr 2021 10:01: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 1lYnBr-0000TE-6f; Tue, 20 Apr 2021 10:01:07 +0000
Received: by outflank-mailman (input) for mailman id 113477;
 Tue, 20 Apr 2021 10:01: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 1lYnBq-0000T3-2f
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:01:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnBq-0006ZZ-1s
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:01:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnBq-0001If-18
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:01:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=l4SBaOhSjpP6+Zf6IID9RTtBGWagLQcr8Ml00YJacZg=; b=2IyZg/rqOxd4e9UJeWz8ygG+4R
	UpnjewpB+efnjezDG7mLVhujm0k426zA1NpmjHQbsvYuEI5OB4tet2TBoz+glywaNRVrpr37cmSxF
	4QliUnJ/i+mqLHAm5uVrZ0nWFMOStfieYJyENYlMf4RAViVUqDA1ukTmEBet5NHfBSYk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/hpet: Factor hpet_enable_legacy_replacement_mode() out of hpet_setup()
Message-Id: <E1lYnBq-0001If-18@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:01:06 +0000

commit dfcce093f10eb4c3dc9b1cfccc5cfc622f04ac8c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Apr 20 11:58:31 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:58:31 2021 +0200

    x86/hpet: Factor hpet_enable_legacy_replacement_mode() out of hpet_setup()
    
    ... in preparation to introduce a second caller.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Frédéric Pierret <frederic.pierret@qubes-os.org>
    master commit: 238168b5bcd27fec97704f6295fa5bf7a442eb6f
    master date: 2021-04-15 18:25:40 +0100
---
 xen/arch/x86/hpet.c        | 116 ++++++++++++++++++++++++---------------------
 xen/include/asm-x86/hpet.h |   6 +++
 2 files changed, 68 insertions(+), 54 deletions(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 1ff005fb4a..c1d04f184f 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -754,11 +754,70 @@ int hpet_legacy_irq_tick(void)
 }
 
 static u32 *hpet_boot_cfg;
+static uint64_t __initdata hpet_rate;
+
+bool __init hpet_enable_legacy_replacement_mode(void)
+{
+    unsigned int cfg, c0_cfg, ticks, count;
+
+    if ( !hpet_rate ||
+         !(hpet_read32(HPET_ID) & HPET_ID_LEGSUP) ||
+         ((cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
+        return false;
+
+    /* Stop the main counter. */
+    hpet_write32(cfg & ~HPET_CFG_ENABLE, HPET_CFG);
+
+    /* Reconfigure channel 0 to be 32bit periodic. */
+    c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+    c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
+               HPET_TN_32BIT);
+    hpet_write32(c0_cfg, HPET_Tn_CFG(0));
+
+    /*
+     * The exact period doesn't have to match a legacy PIT.  All we need
+     * is an interrupt queued up via the IO-APIC to check routing.
+     *
+     * Use HZ as the frequency.
+     */
+    ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
+
+    count = hpet_read32(HPET_COUNTER);
+
+    /*
+     * HPET_TN_SETVAL above is atrociously documented in the spec.
+     *
+     * Periodic HPET channels have a main comparator register, and
+     * separate "accumulator" register.  Despite being named accumulator
+     * in the spec, this is not an accurate description of its behaviour
+     * or purpose.
+     *
+     * Each time an interrupt is generated, the "accumulator" register is
+     * re-added to the comparator set up the new period.
+     *
+     * Normally, writes to the CMP register update both registers.
+     * However, under these semantics, it is impossible to set up a
+     * periodic timer correctly without the main HPET counter being at 0.
+     *
+     * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
+     * use for periodic timers to mean that the second write to CMP
+     * updates the accumulator only, and not the absolute comparator
+     * value.
+     *
+     * This lets us set a period when the main counter isn't at 0.
+     */
+    hpet_write32(count + ticks, HPET_Tn_CMP(0));
+    hpet_write32(ticks,         HPET_Tn_CMP(0));
+
+    /* Restart the main counter, and legacy mode. */
+    hpet_write32(cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
+
+    return true;
+}
 
 u64 __init hpet_setup(void)
 {
-    static u64 __initdata hpet_rate;
-    unsigned int hpet_id, hpet_period, hpet_cfg;
+    unsigned int hpet_id, hpet_period;
     unsigned int last, rem;
 
     if ( hpet_rate )
@@ -805,58 +864,7 @@ u64 __init hpet_setup(void)
      * Reconfigure the HPET into legacy mode to re-establish the timer
      * interrupt.
      */
-    if ( hpet_id & HPET_ID_LEGSUP &&
-         !((hpet_cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
-    {
-        unsigned int c0_cfg, ticks, count;
-
-        /* Stop the main counter. */
-        hpet_write32(hpet_cfg & ~HPET_CFG_ENABLE, HPET_CFG);
-
-        /* Reconfigure channel 0 to be 32bit periodic. */
-        c0_cfg = hpet_read32(HPET_Tn_CFG(0));
-        c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
-                   HPET_TN_32BIT);
-        hpet_write32(c0_cfg, HPET_Tn_CFG(0));
-
-        /*
-         * The exact period doesn't have to match a legacy PIT.  All we need
-         * is an interrupt queued up via the IO-APIC to check routing.
-         *
-         * Use HZ as the frequency.
-         */
-        ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
-
-        count = hpet_read32(HPET_COUNTER);
-
-        /*
-         * HPET_TN_SETVAL above is atrociously documented in the spec.
-         *
-         * Periodic HPET channels have a main comparator register, and
-         * separate "accumulator" register.  Despite being named accumulator
-         * in the spec, this is not an accurate description of its behaviour
-         * or purpose.
-         *
-         * Each time an interrupt is generated, the "accumulator" register is
-         * re-added to the comparator set up the new period.
-         *
-         * Normally, writes to the CMP register update both registers.
-         * However, under these semantics, it is impossible to set up a
-         * periodic timer correctly without the main HPET counter being at 0.
-         *
-         * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
-         * use for periodic timers to mean that the second write to CMP
-         * updates the accumulator only, and not the absolute comparator
-         * value.
-         *
-         * This lets us set a period when the main counter isn't at 0.
-         */
-        hpet_write32(count + ticks, HPET_Tn_CMP(0));
-        hpet_write32(ticks,         HPET_Tn_CMP(0));
-
-        /* Restart the main counter, and legacy mode. */
-        hpet_write32(hpet_cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
-    }
+    hpet_enable_legacy_replacement_mode();
 
     return hpet_rate;
 }
diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h
index fb6bf05065..50176de3d2 100644
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -72,6 +72,12 @@ void hpet_disable(void);
  */
 int hpet_legacy_irq_tick(void);
 
+/*
+ * Try to enable HPET Legacy Replacement mode.  Returns a boolean indicating
+ * whether the HPET configuration was changed.
+ */
+bool hpet_enable_legacy_replacement_mode(void);
+
 /*
  * Temporarily use an HPET event counter for timer interrupt handling,
  * rather than using the LAPIC timer. Used for Cx state entry.
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:01:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:01:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113478.216247 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnC1-0000Ub-B2; Tue, 20 Apr 2021 10:01:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113478.216247; Tue, 20 Apr 2021 10:01: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 1lYnC1-0000UT-88; Tue, 20 Apr 2021 10:01:17 +0000
Received: by outflank-mailman (input) for mailman id 113478;
 Tue, 20 Apr 2021 10:01: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 1lYnC0-0000UK-6G
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:01: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 1lYnC0-0006Zj-5a
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:01:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnC0-0001Jp-4j
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:01: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=y6HKYUF9fv3uuMfK4sK/dPAyTAZkrHiiUfbVW98bUfs=; b=Spswjvek3d78srOjza1Uge/9g7
	Do+Sn0OZy0hWWjtC0Puv2gvhN8awdCDB0xSeq7CiVpL5GcnALMzAWvHzDqAUrCoK/KlX4d2+uecGK
	kxPHxkyouLAc0uaBPeHZALwELujf8kH8qz/xfhebC1nx8AEsG/+QTTIFNSE/YgtYC9WM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.15] x86/hpet: Don't enable legacy replacement mode unconditionally
Message-Id: <E1lYnC0-0001Jp-4j@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:01:16 +0000

commit eb1f325186be9e02c3e89619cd154eb57f202eba
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 11:59:01 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:59:01 2021 +0200

    x86/hpet: Don't enable legacy replacement mode unconditionally
    
    Commit e1de4c196a2e ("x86/timer: Fix boot on Intel systems using ITSSPRC
    static PIT clock gating") was reported to cause boot failures on certain
    AMD Ryzen systems.
    
    Refine the fix to do nothing in the default case, and only attempt to
    configure legacy replacement mode if IRQ0 is found to not be working.  If
    legacy replacement mode doesn't help, undo it before falling back to other IRQ
    routing configurations.
    
    In addition, introduce a "hpet" command line option so this heuristic
    can be overridden.  Since it makes little sense to introduce just
    "hpet=legacy-replacement", also allow for a boolean argument as well as
    "broadcast" to replace the separate "hpetbroadcast" option.
    
    Reported-by: Frédéric Pierret frederic.pierret@qubes-os.org
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Frédéric Pierret <frederic.pierret@qubes-os.org>
    master commit: b53173e7cdafb7a318a239d557478fd73734a86a
    master date: 2021-04-15 18:25:40 +0100
---
 docs/misc/xen-command-line.pandoc | 33 +++++++++++++++++
 xen/arch/x86/hpet.c               | 75 +++++++++++++++++++++++++++++----------
 xen/arch/x86/io_apic.c            | 31 ++++++++++++++++
 xen/include/asm-x86/hpet.h        |  7 ++++
 4 files changed, 128 insertions(+), 18 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index a0601ff838..a4bd3f12c5 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1274,9 +1274,42 @@ supported. See docs/misc/arm/big.LITTLE.txt for more information.
 When the hmp-unsafe option is disabled (default), CPUs that are not
 identical to the boot CPU will be parked and not used by Xen.
 
+### hpet
+    = List of [ <bool> | broadcast=<bool> | legacy-replacement=<bool> ]
+
+    Applicability: x86
+
+Controls Xen's use of the system's High Precision Event Timer.  By default,
+Xen will use an HPET when available and not subject to errata.  Use of the
+HPET can be disabled by specifying `hpet=0`.
+
+ * The `broadcast` boolean is disabled by default, but forces Xen to keep
+   using the broadcast for CPUs in deep C-states even when an RTC interrupt is
+   enabled.  This then also affects raising of the RTC interrupt.
+
+ * The `legacy-replacement` boolean allows for control over whether Legacy
+   Replacement mode is enabled.
+
+   Legacy Replacement mode is intended for hardware which does not have an
+   8254 PIT, and allows the HPET to be configured into a compatible mode.
+   Intel chipsets from Skylake/ApolloLake onwards can turn the PIT off for
+   power saving reasons, and there is no platform-agnostic mechanism for
+   discovering this.
+
+   By default, Xen will not change hardware configuration, unless the PIT
+   appears to be absent, at which point Xen will try to enable Legacy
+   Replacement mode before falling back to pre-IO-APIC interrupt routing
+   options.
+
+   This behaviour can be inhibited by specifying `legacy-replacement=0`.
+   Alternatively, this mode can be enabled unconditionally (if available) by
+   specifying `legacy-replacement=1`.
+
 ### hpetbroadcast (x86)
 > `= <boolean>`
 
+Deprecated alternative of `hpet=broadcast`.
+
 ### hvm_debug (x86)
 > `= <integer>`
 
diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index c1d04f184f..afe104dc93 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -52,6 +52,8 @@ static unsigned int __read_mostly num_hpets_used;
 DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel);
 
 unsigned long __initdata hpet_address;
+int8_t __initdata opt_hpet_legacy_replacement = -1;
+static bool __initdata opt_hpet = true;
 u8 __initdata hpet_blockid;
 u8 __initdata hpet_flags;
 
@@ -63,6 +65,32 @@ u8 __initdata hpet_flags;
 static bool __initdata force_hpet_broadcast;
 boolean_param("hpetbroadcast", force_hpet_broadcast);
 
+static int __init parse_hpet_param(const char *s)
+{
+    const char *ss;
+    int val, rc = 0;
+
+    do {
+        ss = strchr(s, ',');
+        if ( !ss )
+            ss = strchr(s, '\0');
+
+        if ( (val = parse_bool(s, ss)) >= 0 )
+            opt_hpet = val;
+        else if ( (val = parse_boolean("broadcast", s, ss)) >= 0 )
+            force_hpet_broadcast = val;
+        else if ( (val = parse_boolean("legacy-replacement", s, ss)) >= 0 )
+            opt_hpet_legacy_replacement = val;
+        else
+            rc = -EINVAL;
+
+        s = ss + 1;
+    } while ( *ss );
+
+    return rc;
+}
+custom_param("hpet", parse_hpet_param);
+
 /*
  * Calculate a multiplication factor for scaled math, which is used to convert
  * nanoseconds based values to clock ticks:
@@ -755,6 +783,9 @@ int hpet_legacy_irq_tick(void)
 
 static u32 *hpet_boot_cfg;
 static uint64_t __initdata hpet_rate;
+static __initdata struct {
+    uint32_t cmp, cfg;
+} pre_legacy_c0;
 
 bool __init hpet_enable_legacy_replacement_mode(void)
 {
@@ -768,8 +799,11 @@ bool __init hpet_enable_legacy_replacement_mode(void)
     /* Stop the main counter. */
     hpet_write32(cfg & ~HPET_CFG_ENABLE, HPET_CFG);
 
+    /* Stash channel 0's old CFG/CMP incase we need to undo. */
+    pre_legacy_c0.cfg = c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+    pre_legacy_c0.cmp = hpet_read32(HPET_Tn_CMP(0));
+
     /* Reconfigure channel 0 to be 32bit periodic. */
-    c0_cfg = hpet_read32(HPET_Tn_CFG(0));
     c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
                HPET_TN_32BIT);
     hpet_write32(c0_cfg, HPET_Tn_CFG(0));
@@ -815,17 +849,33 @@ bool __init hpet_enable_legacy_replacement_mode(void)
     return true;
 }
 
+void __init hpet_disable_legacy_replacement_mode(void)
+{
+    unsigned int cfg = hpet_read32(HPET_CFG);
+
+    ASSERT(hpet_rate);
+
+    cfg &= ~(HPET_CFG_LEGACY | HPET_CFG_ENABLE);
+
+    /* Stop the main counter and disable legacy mode. */
+    hpet_write32(cfg, HPET_CFG);
+
+    /* Restore pre-Legacy Replacement Mode settings. */
+    hpet_write32(pre_legacy_c0.cfg, HPET_Tn_CFG(0));
+    hpet_write32(pre_legacy_c0.cmp, HPET_Tn_CMP(0));
+
+    /* Restart the main counter. */
+    hpet_write32(cfg | HPET_CFG_ENABLE, HPET_CFG);
+}
+
 u64 __init hpet_setup(void)
 {
     unsigned int hpet_id, hpet_period;
     unsigned int last, rem;
 
-    if ( hpet_rate )
+    if ( hpet_rate || !hpet_address || !opt_hpet )
         return hpet_rate;
 
-    if ( hpet_address == 0 )
-        return 0;
-
     set_fixmap_nocache(FIX_HPET_BASE, hpet_address);
 
     hpet_id = hpet_read32(HPET_ID);
@@ -852,19 +902,8 @@ u64 __init hpet_setup(void)
     if ( (rem * 2) > hpet_period )
         hpet_rate++;
 
-    /*
-     * Intel chipsets from Skylake/ApolloLake onwards can statically clock
-     * gate the 8259 PIT.  This option is enabled by default in slightly later
-     * systems, as turning the PIT off is a prerequisite to entering the C11
-     * power saving state.
-     *
-     * Xen currently depends on the legacy timer interrupt being active while
-     * IRQ routing is configured.
-     *
-     * Reconfigure the HPET into legacy mode to re-establish the timer
-     * interrupt.
-     */
-    hpet_enable_legacy_replacement_mode();
+    if ( opt_hpet_legacy_replacement > 0 )
+        hpet_enable_legacy_replacement_mode();
 
     return hpet_rate;
 }
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index e93265f379..58b26d962c 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -29,6 +29,8 @@
 #include <xen/acpi.h>
 #include <xen/keyhandler.h>
 #include <xen/softirq.h>
+
+#include <asm/hpet.h>
 #include <asm/mc146818rtc.h>
 #include <asm/smp.h>
 #include <asm/desc.h>
@@ -1930,6 +1932,35 @@ static void __init check_timer(void)
             local_irq_restore(flags);
             return;
         }
+
+        /*
+         * Intel chipsets from Skylake/ApolloLake onwards can statically clock
+         * gate the 8254 PIT.  This option is enabled by default in slightly
+         * later systems, as turning the PIT off is a prerequisite to entering
+         * the C11 power saving state.
+         *
+         * Xen currently depends on the legacy timer interrupt being active
+         * while IRQ routing is configured.
+         *
+         * If the user hasn't made an explicit choice, attempt to reconfigure
+         * the HPET into legacy mode to re-establish the timer interrupt.
+         */
+        if ( opt_hpet_legacy_replacement < 0 &&
+             hpet_enable_legacy_replacement_mode() )
+        {
+            printk(XENLOG_ERR "..no 8254 timer found - trying HPET Legacy Replacement Mode\n");
+
+            if ( timer_irq_works() )
+            {
+                local_irq_restore(flags);
+                return;
+            }
+
+            /* Legacy Replacement mode hasn't helped.  Undo it. */
+            printk(XENLOG_ERR "..no HPET timer found - reverting Legacy Replacement Mode\n");
+            hpet_disable_legacy_replacement_mode();
+        }
+
         clear_IO_APIC_pin(apic1, pin1);
         printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to "
                "IO-APIC\n");
diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h
index 50176de3d2..8f9725a95e 100644
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -53,6 +53,7 @@
 extern unsigned long hpet_address;
 extern u8 hpet_blockid;
 extern u8 hpet_flags;
+extern int8_t opt_hpet_legacy_replacement;
 
 /*
  * Detect and initialise HPET hardware: return counter update frequency.
@@ -78,6 +79,12 @@ int hpet_legacy_irq_tick(void);
  */
 bool hpet_enable_legacy_replacement_mode(void);
 
+/*
+ * Undo the effects of hpet_disable_legacy_replacement_mode().  Must not be
+ * called unless enable() returned true.
+ */
+void hpet_disable_legacy_replacement_mode(void);
+
 /*
  * Temporarily use an HPET event counter for timer interrupt handling,
  * rather than using the LAPIC timer. Used for Cx state entry.
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.15


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:11:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113480.216252 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnLW-0001Ne-5C; Tue, 20 Apr 2021 10:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113480.216252; Tue, 20 Apr 2021 10: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 1lYnLW-0001NW-26; Tue, 20 Apr 2021 10:11:06 +0000
Received: by outflank-mailman (input) for mailman id 113480;
 Tue, 20 Apr 2021 10:11:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnLV-0001NR-08
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:11:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnLU-0006jO-Sj
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnLU-0002Ni-Q9
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10: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=8w77cTdqfs+Dy7NBwVhvaL616zD45eRh2EwmzdwGTF8=; b=PbW6ynG7Z6flFQ3Uhmgim2VeLb
	JYWrGd/UiOm3buZaSj/pZIHAYQtCXHYMDVPPhaAxJ2aCB1ygdUg6tA5KwNa6Nw90jKuT+hF5skOt0
	foYreKNIRC+nNRSPYiw2ufVCKKMV6Pt+xDy034NRbg5g7TOpm2pYS6luvdxX5wI4xswk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] VT-d: correct off-by-1 in number-of-IOMMUs check
Message-Id: <E1lYnLU-0002Ni-Q9@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:11:04 +0000

commit 0c4caea34a16173a14074327992122e895984cea
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:01:40 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:01:40 2021 +0200

    VT-d: correct off-by-1 in number-of-IOMMUs check
    
    Otherwise, if we really run on a system with this many IOMMUs,
    entering/leaving S3 would overrun iommu_state[].
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: b9b3082002cac68726fb303e0abd2ff0113d4657
    master date: 2021-03-23 17:01:30 +0100
---
 xen/drivers/passthrough/vtd/iommu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 58128be8b5..ca09cd515c 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1163,10 +1163,10 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
     unsigned long sagaw, nr_dom;
     int agaw;
 
-    if ( nr_iommus > MAX_IOMMUS )
+    if ( nr_iommus >= MAX_IOMMUS )
     {
         dprintk(XENLOG_ERR VTDPREFIX,
-                 "IOMMU: nr_iommus %d > MAX_IOMMUS\n", nr_iommus);
+                "IOMMU: nr_iommus %d > MAX_IOMMUS\n", nr_iommus + 1);
         return -ENOMEM;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:11:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113481.216258 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnLg-0001OU-8F; Tue, 20 Apr 2021 10:11:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113481.216258; Tue, 20 Apr 2021 10: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 1lYnLg-0001OM-3h; Tue, 20 Apr 2021 10:11:16 +0000
Received: by outflank-mailman (input) for mailman id 113481;
 Tue, 20 Apr 2021 10: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 1lYnLf-0001OE-1w
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:11:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnLf-0006jU-0M
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnLe-0002Om-VR
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:11:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Hz2BkKD7cmso1UadjITvwp/jUzd0JpnUvLU9DD+dsjo=; b=ORuSqCKFT3flRKSPy0JbI2UR1r
	ZGvidvjsm2Pf+s8gbqnmnLExYGyCFVbOxFIqi2QZF0kwyaFQ4kjW8afGZjLvWADn2WMld2LIQmA2Z
	+Y0LbmRw2un4Z5DCXrg9BhXeJaLXrpIJXneTlTxF/okauS8BIMig4YMkWnq3KL8FS6jg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] VT-d: leave FECTL write to vtd_resume()
Message-Id: <E1lYnLe-0002Om-VR@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:11:14 +0000

commit e9f10a9add1fb81475b5c6ef0fbc1b423dac3dad
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:02:11 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:02:11 2021 +0200

    VT-d: leave FECTL write to vtd_resume()
    
    We shouldn't blindly unmask the interrupt when resuming. vtd_resume()
    will restore the intended state.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 0d597e7bd1bd8a57619690d457f79769777a5834
    master date: 2021-03-30 14:39:23 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index ca09cd515c..db1171ce0c 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2112,7 +2112,7 @@ static int adjust_vtd_irq_affinities(void)
 }
 __initcall(adjust_vtd_irq_affinities);
 
-static int __must_check init_vtd_hw(void)
+static int __must_check init_vtd_hw(bool resume)
 {
     struct acpi_drhd_unit *drhd;
     struct vtd_iommu *iommu;
@@ -2141,6 +2141,10 @@ static int __must_check init_vtd_hw(void)
             disable_qinval(iommu);
         }
 
+        if ( resume )
+            /* FECTL write done by vtd_resume(). */
+            continue;
+
         spin_lock_irqsave(&iommu->register_lock, flags);
         sts = dmar_readl(iommu->reg, DMAR_FECTL_REG);
         sts &= ~DMA_FECTL_IM;
@@ -2340,7 +2344,7 @@ static int __init vtd_setup(void)
     P(iommu_hap_pt_share, "Shared EPT tables");
 #undef P
 
-    ret = init_vtd_hw();
+    ret = init_vtd_hw(false);
     if ( ret )
         goto error;
 
@@ -2611,7 +2615,7 @@ static void vtd_resume(void)
     if ( !iommu_enabled )
         return;
 
-    if ( init_vtd_hw() != 0  && force_iommu )
+    if ( init_vtd_hw(true) != 0 && force_iommu )
          panic("IOMMU setup failed, crash Xen for security purpose\n");
 
     for_each_drhd_unit ( drhd )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:11:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:11:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113482.216261 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnLq-0001RT-90; Tue, 20 Apr 2021 10:11:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113482.216261; Tue, 20 Apr 2021 10: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 1lYnLq-0001RL-5J; Tue, 20 Apr 2021 10:11:26 +0000
Received: by outflank-mailman (input) for mailman id 113482;
 Tue, 20 Apr 2021 10: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 1lYnLp-0001RC-64
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10: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 1lYnLp-0006jf-4Y
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnLp-0002Q5-2m
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10: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=jIWku2KT4ybLR5lAfubveS8X8m/im9mLTuJGtY9q3qk=; b=f3jaA+jczZVVKd1VIV34LTcJMe
	/buTDQFcBcd8bNZclpSSmcLsgWGYNKCnruS2UCuYD+5iWEuV0p5zcXCC/Em8RZYc5/SVj9RoCGW0L
	jBH5eZJM6PIsoS5VYotfjX08/5oIOoWPLPfagxJWyx7B52UTFawUe2MpQf3Ly1OB4atk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] VT-d: re-order register restoring in vtd_resume()
Message-Id: <E1lYnLp-0002Q5-2m@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:11:25 +0000

commit 732cf387c9bb343ac89ddd4a2e713880d62d2b5f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:02:35 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:02:35 2021 +0200

    VT-d: re-order register restoring in vtd_resume()
    
    For one FECTL must be written last - the interrupt shouldn't be unmasked
    without first having written the data and address needed to actually
    deliver it. In the common case (when dma_msi_set_affinity() doesn't end
    up bailing early) this happens from init_vtd_hw(), but for this to
    actually have the intended effect we shouldn't subsequently overwrite
    what was written there - this is only benign when old and new settings
    match. Instead we should restore the registers ahead of calling
    init_vtd_hw(), just for the unlikely case of dma_msi_set_affinity()
    bailing early.
    
    In the moved code drop some stray casts as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 95e07f8c0e64889ee56015c7f99bdf5309e9e8ef
    master date: 2021-03-30 14:39:54 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index db1171ce0c..cf49118035 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2615,6 +2615,21 @@ static void vtd_resume(void)
     if ( !iommu_enabled )
         return;
 
+    for_each_drhd_unit ( drhd )
+    {
+        iommu = drhd->iommu;
+        i = iommu->index;
+
+        spin_lock_irqsave(&iommu->register_lock, flags);
+        dmar_writel(iommu->reg, DMAR_FEDATA_REG,
+                    iommu_state[i][DMAR_FEDATA_REG]);
+        dmar_writel(iommu->reg, DMAR_FEADDR_REG,
+                    iommu_state[i][DMAR_FEADDR_REG]);
+        dmar_writel(iommu->reg, DMAR_FEUADDR_REG,
+                    iommu_state[i][DMAR_FEUADDR_REG]);
+        spin_unlock_irqrestore(&iommu->register_lock, flags);
+    }
+
     if ( init_vtd_hw(true) != 0 && force_iommu )
          panic("IOMMU setup failed, crash Xen for security purpose\n");
 
@@ -2626,12 +2641,6 @@ static void vtd_resume(void)
         spin_lock_irqsave(&iommu->register_lock, flags);
         dmar_writel(iommu->reg, DMAR_FECTL_REG,
                     (u32) iommu_state[i][DMAR_FECTL_REG]);
-        dmar_writel(iommu->reg, DMAR_FEDATA_REG,
-                    (u32) iommu_state[i][DMAR_FEDATA_REG]);
-        dmar_writel(iommu->reg, DMAR_FEADDR_REG,
-                    (u32) iommu_state[i][DMAR_FEADDR_REG]);
-        dmar_writel(iommu->reg, DMAR_FEUADDR_REG,
-                    (u32) iommu_state[i][DMAR_FEUADDR_REG]);
         spin_unlock_irqrestore(&iommu->register_lock, flags);
 
         iommu_enable_translation(drhd);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:11:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:11:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113483.216264 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnM0-0001T0-AG; Tue, 20 Apr 2021 10:11:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113483.216264; Tue, 20 Apr 2021 10:11:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnM0-0001So-6q; Tue, 20 Apr 2021 10:11:36 +0000
Received: by outflank-mailman (input) for mailman id 113483;
 Tue, 20 Apr 2021 10:11:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnLz-0001Sf-9q
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:11:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnLz-0006jp-8I
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:11:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnLz-0002R8-7M
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:11:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JrvHy3Wm0Oh/y07XvnblMfuAAwD1lqszUE3KeooqvFg=; b=sQk4HxQRc+P6iZGCqL29kyrLQ+
	HGQEQB2oAE/BWJHUKUr2CaMgdb2M77d3+MoyQNht30EGd9sx0Io46TDzZ6neM60jRMaMUlTajgjVV
	Tz4mBM744u7LD4v3al+btP83Mi/NwsVIXZVBXrG0zXj3VklR38VlEvUnmr3Tr9Lv+voU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] VT-d: restore flush hooks when disabling qinval
Message-Id: <E1lYnLz-0002R8-7M@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:11:35 +0000

commit da4733a23c02be224b2248f679cc0e35203e5a51
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:02:57 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:02:57 2021 +0200

    VT-d: restore flush hooks when disabling qinval
    
    Leaving the hooks untouched is at best a latent risk: There may well be
    cases where some flush is needed, which then needs carrying out the
    "register" way.
    
    Switch from u<N> to uint<N>_t while needing to touch the function
    headers anyway.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 9c39dba2b179c0f4c42c98e97ea0878119718530
    master date: 2021-03-30 14:40:24 +0200
---
 xen/drivers/passthrough/vtd/extern.h | 10 ++++++++++
 xen/drivers/passthrough/vtd/iommu.c  | 19 ++++++++-----------
 xen/drivers/passthrough/vtd/qinval.c |  3 +++
 3 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index f776feefe6..1cac22a02f 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -50,6 +50,16 @@ int iommu_flush_iec_global(struct vtd_iommu *iommu);
 int iommu_flush_iec_index(struct vtd_iommu *iommu, u8 im, u16 iidx);
 void clear_fault_bits(struct vtd_iommu *iommu);
 
+int __must_check vtd_flush_context_reg(struct vtd_iommu *iommu, uint16_t did,
+                                       uint16_t source_id,
+                                       uint8_t function_mask, uint64_t type,
+                                       bool flush_non_present_entry);
+int __must_check vtd_flush_iotlb_reg(struct vtd_iommu *iommu, uint16_t did,
+                                     uint64_t addr, unsigned int size_order,
+                                     uint64_t type,
+                                     bool flush_non_present_entry,
+                                     bool flush_dev_iotlb);
+
 struct vtd_iommu *ioapic_to_iommu(unsigned int apic_id);
 struct vtd_iommu *hpet_to_iommu(unsigned int hpet_id);
 struct acpi_drhd_unit *ioapic_to_drhd(unsigned int apic_id);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index cf49118035..74c7aca24b 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -333,10 +333,9 @@ static void iommu_flush_write_buffer(struct vtd_iommu *iommu)
 }
 
 /* return value determine if we need a write buffer flush */
-static int __must_check flush_context_reg(struct vtd_iommu *iommu, u16 did,
-                                          u16 source_id, u8 function_mask,
-                                          u64 type,
-                                          bool flush_non_present_entry)
+int vtd_flush_context_reg(struct vtd_iommu *iommu, uint16_t did,
+                          uint16_t source_id, uint8_t function_mask,
+                          uint64_t type, bool flush_non_present_entry)
 {
     u64 val = 0;
     unsigned long flags;
@@ -402,11 +401,9 @@ static int __must_check iommu_flush_context_device(struct vtd_iommu *iommu,
 }
 
 /* return value determine if we need a write buffer flush */
-static int __must_check flush_iotlb_reg(struct vtd_iommu *iommu, u16 did,
-                                        u64 addr,
-                                        unsigned int size_order, u64 type,
-                                        bool flush_non_present_entry,
-                                        bool flush_dev_iotlb)
+int vtd_flush_iotlb_reg(struct vtd_iommu *iommu, uint16_t did, uint64_t addr,
+                        unsigned int size_order, uint64_t type,
+                        bool flush_non_present_entry, bool flush_dev_iotlb)
 {
     int tlb_offset = ecap_iotlb_offset(iommu->ecap);
     u64 val = 0;
@@ -2164,8 +2161,8 @@ static int __must_check init_vtd_hw(bool resume)
          */
         if ( enable_qinval(iommu) != 0 )
         {
-            iommu->flush.context = flush_context_reg;
-            iommu->flush.iotlb   = flush_iotlb_reg;
+            iommu->flush.context = vtd_flush_context_reg;
+            iommu->flush.iotlb   = vtd_flush_iotlb_reg;
         }
     }
 
diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c
index 39b7abd009..764ef9f0fc 100644
--- a/xen/drivers/passthrough/vtd/qinval.c
+++ b/xen/drivers/passthrough/vtd/qinval.c
@@ -462,4 +462,7 @@ void disable_qinval(struct vtd_iommu *iommu)
                   !(sts & DMA_GSTS_QIES), sts);
 out:
     spin_unlock_irqrestore(&iommu->register_lock, flags);
+
+    iommu->flush.context = vtd_flush_context_reg;
+    iommu->flush.iotlb   = vtd_flush_iotlb_reg;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:11:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:11:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113484.216268 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnMA-0001UL-Bp; Tue, 20 Apr 2021 10:11:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113484.216268; Tue, 20 Apr 2021 10:11: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 1lYnMA-0001UC-8S; Tue, 20 Apr 2021 10:11:46 +0000
Received: by outflank-mailman (input) for mailman id 113484;
 Tue, 20 Apr 2021 10:11:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnM9-0001U4-C2
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:11:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnM9-0006jx-BA
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:11:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnM9-0002SK-AV
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:11:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=G0KC/DEd1tFhsl7VJizuQtFIQPSsLSwk1rot2b8fHgc=; b=Mk0kqCQT/hlcvnqVVNFx5KUL/R
	w0gUXQpt8NBKUrZricpgjwh145mdJLtBEcZUE6Dyf/D+3p8QASzSanB6lqzkrmE92lP2EtqQxLvcP
	3IBQNxL+zg75SixMXs4LgeZQ+0FnvepyZlfNMQ/pAdTTUU0I6vwlQklW+LsOO4s6BlkI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] fix for_each_cpu() again for NR_CPUS=1
Message-Id: <E1lYnM9-0002SK-AV@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:11:45 +0000

commit 2b5de808288da505cbe7b115c645989142577bcd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:03:29 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:03:29 2021 +0200

    fix for_each_cpu() again for NR_CPUS=1
    
    Unfortunately aa50f45332f1 ("xen: fix for_each_cpu when NR_CPUS=1") has
    caused quite a bit of fallout with gcc10, e.g. (there are at least two
    more similar ones, and I didn't bother trying to find them all):
    
    In file included from .../xen/include/xen/config.h:13,
                     from <command-line>:
    core_parking.c: In function ‘core_parking_power’:
    .../xen/include/asm/percpu.h:12:51: error: array subscript 1 is above array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds]
       12 |     (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
    .../xen/include/xen/compiler.h:141:29: note: in definition of macro ‘RELOC_HIDE’
      141 |     (typeof(ptr)) (__ptr + (off)); })
          |                             ^~~
    core_parking.c:133:39: note: in expansion of macro ‘per_cpu’
      133 |             core_tmp = cpumask_weight(per_cpu(cpu_core_mask, cpu));
          |                                       ^~~~~~~
    In file included from .../xen/include/xen/percpu.h:4,
                     from .../xen/include/asm/msr.h:7,
                     from .../xen/include/asm/time.h:5,
                     from .../xen/include/xen/time.h:76,
                     from .../xen/include/xen/spinlock.h:4,
                     from .../xen/include/xen/cpu.h:5,
                     from core_parking.c:19:
    .../xen/include/asm/percpu.h:6:22: note: while referencing ‘__per_cpu_offset’
        6 | extern unsigned long __per_cpu_offset[NR_CPUS];
          |                      ^~~~~~~~~~~~~~~~
    
    One of the further errors even went as far as claiming that an array
    index (range) of [0, 0] was outside the bounds of a [1] array, so
    something fishy is pretty clearly going on there.
    
    The compiler apparently wants to be able to see that the loop isn't
    really a loop in order to avoid triggering such warnings, yet what
    exactly makes it consider the loop exit condition constant and within
    the [0, 1] range isn't obvious - using ((mask)->bits[0] & 1) instead of
    cpumask_test_cpu() for example did _not_ help.
    
    Re-instate a special form of for_each_cpu(), experimentally "proven" to
    avoid the diagnostics.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
    master commit: 625faf9f002bd6ff4b6457a016b8ff338223b659
    master date: 2021-04-07 12:24:45 +0200
---
 xen/include/xen/cpumask.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/xen/cpumask.h b/xen/include/xen/cpumask.h
index e69589fc08..9826707909 100644
--- a/xen/include/xen/cpumask.h
+++ b/xen/include/xen/cpumask.h
@@ -368,10 +368,15 @@ static inline void free_cpumask_var(cpumask_var_t mask)
 #define FREE_CPUMASK_VAR(m) free_cpumask_var(m)
 #endif
 
+#if NR_CPUS > 1
 #define for_each_cpu(cpu, mask)			\
 	for ((cpu) = cpumask_first(mask);	\
 	     (cpu) < nr_cpu_ids;		\
 	     (cpu) = cpumask_next(cpu, mask))
+#else /* NR_CPUS == 1 */
+#define for_each_cpu(cpu, mask)			\
+	for ((cpu) = 0; (cpu) < cpumask_test_cpu(0, mask); ++(cpu))
+#endif /* NR_CPUS */
 
 /*
  * The following particular system cpumasks and operations manage
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:11:56 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:11:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113485.216272 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnMK-0001W0-DF; Tue, 20 Apr 2021 10:11:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113485.216272; Tue, 20 Apr 2021 10:11: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 1lYnMK-0001Vs-A6; Tue, 20 Apr 2021 10:11:56 +0000
Received: by outflank-mailman (input) for mailman id 113485;
 Tue, 20 Apr 2021 10:11: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 1lYnMJ-0001Vl-Hg
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:11: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 1lYnMJ-0006k7-Gl
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:11:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnMJ-0002UA-DN
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:11:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oIX58HnOHjfo0R1kH9K9Mgubyl8b9e81IkJHf2qKQQI=; b=GZ9IwhUvKZPnMNSeDqydJYiA2p
	Qe68FvJc+rflURj3xG/dAT36cGkXnJC7ZbHoa01jx4KryVicsQYhZkf9nVd9uTzwFkCr1xGOL2n9U
	KlyzxeOtZmINWbn7QuPuZQfWespFuPNX8T76fOuFqJCr4sAWBbJr8R5dWkPp18KKM2m8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/vpt: do not take pt_migrate rwlock in some cases
Message-Id: <E1lYnMJ-0002UA-DN@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:11:55 +0000

commit a67f981352a21e8e3ade9944c238fce30b23938f
Author:     Boris Ostrovsky <boris.ostrovsky@oracle.com>
AuthorDate: Tue Apr 20 12:04:16 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:04:16 2021 +0200

    x86/vpt: do not take pt_migrate rwlock in some cases
    
    Commit 8e76aef72820 ("x86/vpt: fix race when migrating timers between
    vCPUs") addressed XSA-336 by introducing a per-domain rwlock that was
    intended to protect periodic timer during VCPU migration. Since such
    migration is an infrequent event no performance impact was expected.
    
    Unfortunately this turned out not to be the case: on a fairly large
    guest (92 VCPUs) we've observed as much as 40% TPCC performance
    regression with some guest kernels. Further investigation pointed to
    pt_migrate read lock taken in pt_update_irq() as the largest contributor
    to this regression. With large number of VCPUs and large number of VMEXITs
    (from where pt_update_irq() is always called) the update of an atomic in
    read_lock() is thought to be the main cause.
    
    Stephen Brennan analyzed locking pattern and classified lock users as
    follows:
    
    1. Functions which read (maybe write) all periodic_time instances attached
    to a particular vCPU. These are functions which use pt_vcpu_lock() such
    as pt_restore_timer(), pt_save_timer(), etc.
    2. Functions which want to modify a particular periodic_time object.
    These functions lock whichever vCPU the periodic_time is attached to, but
    since the vCPU could be modified without holding any lock, they are
    vulnerable to XSA-336. Functions in this group use pt_lock(), such as
    pt_timer_fn() or destroy_periodic_time().
    3. Functions which not only want to modify the periodic_time, but also
    would like to modify the =vcpu= fields. These are create_periodic_time()
    or pt_adjust_vcpu(). They create XSA-336 conditions for group 2, but we
    can't simply hold 2 vcpu locks due to the deadlock risk.
    
    Roger then pointed out that group 1 functions don't really need to hold
    the pt_migrate rwlock and that instead groups 2 and 3 should hold per-vcpu
    lock whenever they modify per-vcpu timer lists.
    
    Suggested-by: Stephen Brennan <stephen.s.brennan@oracle.com>
    Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Stephen Brennan <stephen.s.brennan@oracle.com>
    master commit: 1f3d87c7512975274cc45c40097b05550eba1ac9
    master date: 2021-04-09 09:21:27 +0200
---
 xen/arch/x86/hvm/vpt.c        | 44 ++++++++++++++++++++++++++++++++++---------
 xen/include/asm-x86/hvm/vpt.h | 18 ++++++++++++------
 2 files changed, 47 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index ae7f715620..6a5458c8b7 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -153,32 +153,43 @@ static int pt_irq_masked(struct periodic_time *pt)
     return 1;
 }
 
+/*
+ * Functions which read (maybe write) all periodic_time instances
+ * attached to a particular vCPU use pt_vcpu_{un}lock locking helpers.
+ *
+ * Such users are explicitly forbidden from changing the value of the
+ * pt->vcpu field, because another thread holding the pt_migrate lock
+ * may already be spinning waiting for your vcpu lock.
+ */
 static void pt_vcpu_lock(struct vcpu *v)
 {
-    read_lock(&v->domain->arch.hvm.pl_time->pt_migrate);
     spin_lock(&v->arch.hvm.tm_lock);
 }
 
 static void pt_vcpu_unlock(struct vcpu *v)
 {
     spin_unlock(&v->arch.hvm.tm_lock);
-    read_unlock(&v->domain->arch.hvm.pl_time->pt_migrate);
 }
 
+/*
+ * Functions which want to modify a particular periodic_time object
+ * use pt_{un}lock locking helpers.
+ *
+ * These users lock whichever vCPU the periodic_time is attached to,
+ * but since the vCPU could be modified without holding any lock, they
+ * need to take an additional lock that protects against pt->vcpu
+ * changing.
+ */
 static void pt_lock(struct periodic_time *pt)
 {
-    /*
-     * We cannot use pt_vcpu_lock here, because we need to acquire the
-     * per-domain lock first and then (re-)fetch the value of pt->vcpu, or
-     * else we might be using a stale value of pt->vcpu.
-     */
     read_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
     spin_lock(&pt->vcpu->arch.hvm.tm_lock);
 }
 
 static void pt_unlock(struct periodic_time *pt)
 {
-    pt_vcpu_unlock(pt->vcpu);
+    spin_unlock(&pt->vcpu->arch.hvm.tm_lock);
+    read_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
 }
 
 static void pt_process_missed_ticks(struct periodic_time *pt)
@@ -543,8 +554,10 @@ void create_periodic_time(
     pt->cb = cb;
     pt->priv = data;
 
+    pt_vcpu_lock(v);
     pt->on_list = 1;
     list_add(&pt->list, &v->arch.hvm.tm_list);
+    pt_vcpu_unlock(v);
 
     init_timer(&pt->timer, pt_timer_fn, pt, v->processor);
     set_timer(&pt->timer, pt->scheduled);
@@ -580,13 +593,26 @@ static void pt_adjust_vcpu(struct periodic_time *pt, struct vcpu *v)
         return;
 
     write_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
+
+    if ( pt->vcpu == v )
+        goto out;
+
+    pt_vcpu_lock(pt->vcpu);
+    if ( pt->on_list )
+        list_del(&pt->list);
+    pt_vcpu_unlock(pt->vcpu);
+
     pt->vcpu = v;
+
+    pt_vcpu_lock(v);
     if ( pt->on_list )
     {
-        list_del(&pt->list);
         list_add(&pt->list, &v->arch.hvm.tm_list);
         migrate_timer(&pt->timer, v->processor);
     }
+    pt_vcpu_unlock(v);
+
+ out:
     write_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
 }
 
diff --git a/xen/include/asm-x86/hvm/vpt.h b/xen/include/asm-x86/hvm/vpt.h
index 39d26cbda4..74c0cedd11 100644
--- a/xen/include/asm-x86/hvm/vpt.h
+++ b/xen/include/asm-x86/hvm/vpt.h
@@ -128,12 +128,18 @@ struct pl_time {    /* platform time */
     struct RTCState  vrtc;
     struct HPETState vhpet;
     struct PMTState  vpmt;
-    /*
-     * rwlock to prevent periodic_time vCPU migration. Take the lock in read
-     * mode in order to prevent the vcpu field of periodic_time from changing.
-     * Lock must be taken in write mode when changes to the vcpu field are
-     * performed, as it allows exclusive access to all the timers of a domain.
-     */
+     /*
+      * Functions which want to modify the vcpu field of the vpt need
+      * to hold the global lock (pt_migrate) in write mode together
+      * with the per-vcpu locks of the lists being modified. Functions
+      * that want to lock a periodic_timer that's possibly on a
+      * different vCPU list need to take the lock in read mode first in
+      * order to prevent the vcpu field of periodic_timer from
+      * changing.
+      *
+      * Note that two vcpu locks cannot be held at the same time to
+      * avoid a deadlock.
+      */
     rwlock_t pt_migrate;
     /* guest_time = Xen sys time + stime_offset */
     int64_t stime_offset;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:12:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:12:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113486.216275 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnMV-0001XY-GT; Tue, 20 Apr 2021 10:12:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113486.216275; Tue, 20 Apr 2021 10:12:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnMV-0001XQ-DB; Tue, 20 Apr 2021 10:12:07 +0000
Received: by outflank-mailman (input) for mailman id 113486;
 Tue, 20 Apr 2021 10:12: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 1lYnMT-0001XD-Lq
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:12: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 1lYnMT-0006kl-KV
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:12:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnMT-0002V7-J9
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:12:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3RvASjnW/8f6WWPFJD4UgSqlD9MEfaT3UPtp8snV8Hs=; b=ew31JPu5y6HcS53/9dDn3ff885
	JYoWvREVpKZsui+BZD7t2qEHMpm6eUxgdmU+iZ8hctfQOUhekLTNDm0jLeUlq3y8wtztmav9J7QuH
	ReAtgc0E4D8EXnnUeVKZDEOlQwJIUKEXgPoL+lWnmPIdrc2GLuyAXlw+w8lgRaJaO2XU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/hpet: Factor hpet_enable_legacy_replacement_mode() out of hpet_setup()
Message-Id: <E1lYnMT-0002V7-J9@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:12:05 +0000

commit 440e6d402dc2c01a5051b68c2a60ffe1453656aa
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Apr 20 12:04:54 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:04:54 2021 +0200

    x86/hpet: Factor hpet_enable_legacy_replacement_mode() out of hpet_setup()
    
    ... in preparation to introduce a second caller.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Frédéric Pierret <frederic.pierret@qubes-os.org>
    master commit: 238168b5bcd27fec97704f6295fa5bf7a442eb6f
    master date: 2021-04-15 18:25:40 +0100
---
 xen/arch/x86/hpet.c        | 116 ++++++++++++++++++++++++---------------------
 xen/include/asm-x86/hpet.h |   6 +++
 2 files changed, 68 insertions(+), 54 deletions(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 59ad71592c..1edd255a20 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -764,11 +764,70 @@ int hpet_legacy_irq_tick(void)
 }
 
 static u32 *hpet_boot_cfg;
+static uint64_t __initdata hpet_rate;
+
+bool __init hpet_enable_legacy_replacement_mode(void)
+{
+    unsigned int cfg, c0_cfg, ticks, count;
+
+    if ( !hpet_rate ||
+         !(hpet_read32(HPET_ID) & HPET_ID_LEGSUP) ||
+         ((cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
+        return false;
+
+    /* Stop the main counter. */
+    hpet_write32(cfg & ~HPET_CFG_ENABLE, HPET_CFG);
+
+    /* Reconfigure channel 0 to be 32bit periodic. */
+    c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+    c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
+               HPET_TN_32BIT);
+    hpet_write32(c0_cfg, HPET_Tn_CFG(0));
+
+    /*
+     * The exact period doesn't have to match a legacy PIT.  All we need
+     * is an interrupt queued up via the IO-APIC to check routing.
+     *
+     * Use HZ as the frequency.
+     */
+    ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
+
+    count = hpet_read32(HPET_COUNTER);
+
+    /*
+     * HPET_TN_SETVAL above is atrociously documented in the spec.
+     *
+     * Periodic HPET channels have a main comparator register, and
+     * separate "accumulator" register.  Despite being named accumulator
+     * in the spec, this is not an accurate description of its behaviour
+     * or purpose.
+     *
+     * Each time an interrupt is generated, the "accumulator" register is
+     * re-added to the comparator set up the new period.
+     *
+     * Normally, writes to the CMP register update both registers.
+     * However, under these semantics, it is impossible to set up a
+     * periodic timer correctly without the main HPET counter being at 0.
+     *
+     * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
+     * use for periodic timers to mean that the second write to CMP
+     * updates the accumulator only, and not the absolute comparator
+     * value.
+     *
+     * This lets us set a period when the main counter isn't at 0.
+     */
+    hpet_write32(count + ticks, HPET_Tn_CMP(0));
+    hpet_write32(ticks,         HPET_Tn_CMP(0));
+
+    /* Restart the main counter, and legacy mode. */
+    hpet_write32(cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
+
+    return true;
+}
 
 u64 __init hpet_setup(void)
 {
-    static u64 __initdata hpet_rate;
-    unsigned int hpet_id, hpet_period, hpet_cfg;
+    unsigned int hpet_id, hpet_period;
     unsigned int last, rem;
 
     if ( hpet_rate )
@@ -815,58 +874,7 @@ u64 __init hpet_setup(void)
      * Reconfigure the HPET into legacy mode to re-establish the timer
      * interrupt.
      */
-    if ( hpet_id & HPET_ID_LEGSUP &&
-         !((hpet_cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
-    {
-        unsigned int c0_cfg, ticks, count;
-
-        /* Stop the main counter. */
-        hpet_write32(hpet_cfg & ~HPET_CFG_ENABLE, HPET_CFG);
-
-        /* Reconfigure channel 0 to be 32bit periodic. */
-        c0_cfg = hpet_read32(HPET_Tn_CFG(0));
-        c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
-                   HPET_TN_32BIT);
-        hpet_write32(c0_cfg, HPET_Tn_CFG(0));
-
-        /*
-         * The exact period doesn't have to match a legacy PIT.  All we need
-         * is an interrupt queued up via the IO-APIC to check routing.
-         *
-         * Use HZ as the frequency.
-         */
-        ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
-
-        count = hpet_read32(HPET_COUNTER);
-
-        /*
-         * HPET_TN_SETVAL above is atrociously documented in the spec.
-         *
-         * Periodic HPET channels have a main comparator register, and
-         * separate "accumulator" register.  Despite being named accumulator
-         * in the spec, this is not an accurate description of its behaviour
-         * or purpose.
-         *
-         * Each time an interrupt is generated, the "accumulator" register is
-         * re-added to the comparator set up the new period.
-         *
-         * Normally, writes to the CMP register update both registers.
-         * However, under these semantics, it is impossible to set up a
-         * periodic timer correctly without the main HPET counter being at 0.
-         *
-         * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
-         * use for periodic timers to mean that the second write to CMP
-         * updates the accumulator only, and not the absolute comparator
-         * value.
-         *
-         * This lets us set a period when the main counter isn't at 0.
-         */
-        hpet_write32(count + ticks, HPET_Tn_CMP(0));
-        hpet_write32(ticks,         HPET_Tn_CMP(0));
-
-        /* Restart the main counter, and legacy mode. */
-        hpet_write32(hpet_cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
-    }
+    hpet_enable_legacy_replacement_mode();
 
     return hpet_rate;
 }
diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h
index fb6bf05065..50176de3d2 100644
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -72,6 +72,12 @@ void hpet_disable(void);
  */
 int hpet_legacy_irq_tick(void);
 
+/*
+ * Try to enable HPET Legacy Replacement mode.  Returns a boolean indicating
+ * whether the HPET configuration was changed.
+ */
+bool hpet_enable_legacy_replacement_mode(void);
+
 /*
  * Temporarily use an HPET event counter for timer interrupt handling,
  * rather than using the LAPIC timer. Used for Cx state entry.
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:12:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:12:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113487.216280 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnMf-0001Yz-IX; Tue, 20 Apr 2021 10:12:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113487.216280; Tue, 20 Apr 2021 10:12:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnMf-0001Yr-F5; Tue, 20 Apr 2021 10:12:17 +0000
Received: by outflank-mailman (input) for mailman id 113487;
 Tue, 20 Apr 2021 10:12: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 1lYnMd-0001Ye-Qu
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:12: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 1lYnMd-0006kt-Q5
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:12:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnMd-0002W2-Ow
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:12:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RRV0N4T5CwTdi8KZ3PHYrxtJIv6B40aF91nptxGzX0o=; b=Vj7BtAjLJdKN4XqxnAX75VAhDR
	+AfddUUgywY/j/x1mvd9hGMUVYJiqHd3r8PW65vP61d6rvhgqKxX0BRiYjiib6e/7K+IUFysDJvM/
	Pm8p/RudWnQ67OqdKbvSG+saqzyr1LM4qqZWDIqx8GWU4g2eQ44+UmqtWlxzy+nxYx0Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] x86/hpet: Don't enable legacy replacement mode unconditionally
Message-Id: <E1lYnMd-0002W2-Ow@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:12:15 +0000

commit b14d8345e530a54710700ec5fcb0879c2e056d31
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:05:20 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:05:20 2021 +0200

    x86/hpet: Don't enable legacy replacement mode unconditionally
    
    Commit e1de4c196a2e ("x86/timer: Fix boot on Intel systems using ITSSPRC
    static PIT clock gating") was reported to cause boot failures on certain
    AMD Ryzen systems.
    
    Refine the fix to do nothing in the default case, and only attempt to
    configure legacy replacement mode if IRQ0 is found to not be working.  If
    legacy replacement mode doesn't help, undo it before falling back to other IRQ
    routing configurations.
    
    In addition, introduce a "hpet" command line option so this heuristic
    can be overridden.  Since it makes little sense to introduce just
    "hpet=legacy-replacement", also allow for a boolean argument as well as
    "broadcast" to replace the separate "hpetbroadcast" option.
    
    Reported-by: Frédéric Pierret frederic.pierret@qubes-os.org
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Frédéric Pierret <frederic.pierret@qubes-os.org>
    master commit: b53173e7cdafb7a318a239d557478fd73734a86a
    master date: 2021-04-15 18:25:40 +0100
---
 docs/misc/xen-command-line.pandoc | 33 +++++++++++++++++
 xen/arch/x86/hpet.c               | 75 +++++++++++++++++++++++++++++----------
 xen/arch/x86/io_apic.c            | 31 ++++++++++++++++
 xen/include/asm-x86/hpet.h        |  7 ++++
 4 files changed, 128 insertions(+), 18 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 4ae9391fcd..f63fe9680a 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1221,9 +1221,42 @@ supported. See docs/misc/arm/big.LITTLE.txt for more information.
 When the hmp-unsafe option is disabled (default), CPUs that are not
 identical to the boot CPU will be parked and not used by Xen.
 
+### hpet
+    = List of [ <bool> | broadcast=<bool> | legacy-replacement=<bool> ]
+
+    Applicability: x86
+
+Controls Xen's use of the system's High Precision Event Timer.  By default,
+Xen will use an HPET when available and not subject to errata.  Use of the
+HPET can be disabled by specifying `hpet=0`.
+
+ * The `broadcast` boolean is disabled by default, but forces Xen to keep
+   using the broadcast for CPUs in deep C-states even when an RTC interrupt is
+   enabled.  This then also affects raising of the RTC interrupt.
+
+ * The `legacy-replacement` boolean allows for control over whether Legacy
+   Replacement mode is enabled.
+
+   Legacy Replacement mode is intended for hardware which does not have an
+   8254 PIT, and allows the HPET to be configured into a compatible mode.
+   Intel chipsets from Skylake/ApolloLake onwards can turn the PIT off for
+   power saving reasons, and there is no platform-agnostic mechanism for
+   discovering this.
+
+   By default, Xen will not change hardware configuration, unless the PIT
+   appears to be absent, at which point Xen will try to enable Legacy
+   Replacement mode before falling back to pre-IO-APIC interrupt routing
+   options.
+
+   This behaviour can be inhibited by specifying `legacy-replacement=0`.
+   Alternatively, this mode can be enabled unconditionally (if available) by
+   specifying `legacy-replacement=1`.
+
 ### hpetbroadcast (x86)
 > `= <boolean>`
 
+Deprecated alternative of `hpet=broadcast`.
+
 ### hvm_debug (x86)
 > `= <integer>`
 
diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 1edd255a20..f15df77661 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -52,6 +52,8 @@ static unsigned int __read_mostly num_hpets_used;
 DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel);
 
 unsigned long __initdata hpet_address;
+int8_t __initdata opt_hpet_legacy_replacement = -1;
+static bool __initdata opt_hpet = true;
 u8 __initdata hpet_blockid;
 u8 __initdata hpet_flags;
 
@@ -63,6 +65,32 @@ u8 __initdata hpet_flags;
 static bool __initdata force_hpet_broadcast;
 boolean_param("hpetbroadcast", force_hpet_broadcast);
 
+static int __init parse_hpet_param(const char *s)
+{
+    const char *ss;
+    int val, rc = 0;
+
+    do {
+        ss = strchr(s, ',');
+        if ( !ss )
+            ss = strchr(s, '\0');
+
+        if ( (val = parse_bool(s, ss)) >= 0 )
+            opt_hpet = val;
+        else if ( (val = parse_boolean("broadcast", s, ss)) >= 0 )
+            force_hpet_broadcast = val;
+        else if ( (val = parse_boolean("legacy-replacement", s, ss)) >= 0 )
+            opt_hpet_legacy_replacement = val;
+        else
+            rc = -EINVAL;
+
+        s = ss + 1;
+    } while ( *ss );
+
+    return rc;
+}
+custom_param("hpet", parse_hpet_param);
+
 /*
  * Calculate a multiplication factor for scaled math, which is used to convert
  * nanoseconds based values to clock ticks:
@@ -765,6 +793,9 @@ int hpet_legacy_irq_tick(void)
 
 static u32 *hpet_boot_cfg;
 static uint64_t __initdata hpet_rate;
+static __initdata struct {
+    uint32_t cmp, cfg;
+} pre_legacy_c0;
 
 bool __init hpet_enable_legacy_replacement_mode(void)
 {
@@ -778,8 +809,11 @@ bool __init hpet_enable_legacy_replacement_mode(void)
     /* Stop the main counter. */
     hpet_write32(cfg & ~HPET_CFG_ENABLE, HPET_CFG);
 
+    /* Stash channel 0's old CFG/CMP incase we need to undo. */
+    pre_legacy_c0.cfg = c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+    pre_legacy_c0.cmp = hpet_read32(HPET_Tn_CMP(0));
+
     /* Reconfigure channel 0 to be 32bit periodic. */
-    c0_cfg = hpet_read32(HPET_Tn_CFG(0));
     c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
                HPET_TN_32BIT);
     hpet_write32(c0_cfg, HPET_Tn_CFG(0));
@@ -825,17 +859,33 @@ bool __init hpet_enable_legacy_replacement_mode(void)
     return true;
 }
 
+void __init hpet_disable_legacy_replacement_mode(void)
+{
+    unsigned int cfg = hpet_read32(HPET_CFG);
+
+    ASSERT(hpet_rate);
+
+    cfg &= ~(HPET_CFG_LEGACY | HPET_CFG_ENABLE);
+
+    /* Stop the main counter and disable legacy mode. */
+    hpet_write32(cfg, HPET_CFG);
+
+    /* Restore pre-Legacy Replacement Mode settings. */
+    hpet_write32(pre_legacy_c0.cfg, HPET_Tn_CFG(0));
+    hpet_write32(pre_legacy_c0.cmp, HPET_Tn_CMP(0));
+
+    /* Restart the main counter. */
+    hpet_write32(cfg | HPET_CFG_ENABLE, HPET_CFG);
+}
+
 u64 __init hpet_setup(void)
 {
     unsigned int hpet_id, hpet_period;
     unsigned int last, rem;
 
-    if ( hpet_rate )
+    if ( hpet_rate || !hpet_address || !opt_hpet )
         return hpet_rate;
 
-    if ( hpet_address == 0 )
-        return 0;
-
     set_fixmap_nocache(FIX_HPET_BASE, hpet_address);
 
     hpet_id = hpet_read32(HPET_ID);
@@ -862,19 +912,8 @@ u64 __init hpet_setup(void)
     if ( (rem * 2) > hpet_period )
         hpet_rate++;
 
-    /*
-     * Intel chipsets from Skylake/ApolloLake onwards can statically clock
-     * gate the 8259 PIT.  This option is enabled by default in slightly later
-     * systems, as turning the PIT off is a prerequisite to entering the C11
-     * power saving state.
-     *
-     * Xen currently depends on the legacy timer interrupt being active while
-     * IRQ routing is configured.
-     *
-     * Reconfigure the HPET into legacy mode to re-establish the timer
-     * interrupt.
-     */
-    hpet_enable_legacy_replacement_mode();
+    if ( opt_hpet_legacy_replacement > 0 )
+        hpet_enable_legacy_replacement_mode();
 
     return hpet_rate;
 }
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index e66fa99ec7..856cf58b26 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -29,6 +29,8 @@
 #include <xen/acpi.h>
 #include <xen/keyhandler.h>
 #include <xen/softirq.h>
+
+#include <asm/hpet.h>
 #include <asm/mc146818rtc.h>
 #include <asm/smp.h>
 #include <asm/desc.h>
@@ -1930,6 +1932,35 @@ static void __init check_timer(void)
             local_irq_restore(flags);
             return;
         }
+
+        /*
+         * Intel chipsets from Skylake/ApolloLake onwards can statically clock
+         * gate the 8254 PIT.  This option is enabled by default in slightly
+         * later systems, as turning the PIT off is a prerequisite to entering
+         * the C11 power saving state.
+         *
+         * Xen currently depends on the legacy timer interrupt being active
+         * while IRQ routing is configured.
+         *
+         * If the user hasn't made an explicit choice, attempt to reconfigure
+         * the HPET into legacy mode to re-establish the timer interrupt.
+         */
+        if ( opt_hpet_legacy_replacement < 0 &&
+             hpet_enable_legacy_replacement_mode() )
+        {
+            printk(XENLOG_ERR "..no 8254 timer found - trying HPET Legacy Replacement Mode\n");
+
+            if ( timer_irq_works() )
+            {
+                local_irq_restore(flags);
+                return;
+            }
+
+            /* Legacy Replacement mode hasn't helped.  Undo it. */
+            printk(XENLOG_ERR "..no HPET timer found - reverting Legacy Replacement Mode\n");
+            hpet_disable_legacy_replacement_mode();
+        }
+
         clear_IO_APIC_pin(apic1, pin1);
         printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to "
                "IO-APIC\n");
diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h
index 50176de3d2..8f9725a95e 100644
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -53,6 +53,7 @@
 extern unsigned long hpet_address;
 extern u8 hpet_blockid;
 extern u8 hpet_flags;
+extern int8_t opt_hpet_legacy_replacement;
 
 /*
  * Detect and initialise HPET hardware: return counter update frequency.
@@ -78,6 +79,12 @@ int hpet_legacy_irq_tick(void);
  */
 bool hpet_enable_legacy_replacement_mode(void);
 
+/*
+ * Undo the effects of hpet_disable_legacy_replacement_mode().  Must not be
+ * called unless enable() returned true.
+ */
+void hpet_disable_legacy_replacement_mode(void);
+
 /*
  * Temporarily use an HPET event counter for timer interrupt handling,
  * rather than using the LAPIC timer. Used for Cx state entry.
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:22:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113492.216284 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnWL-0002U2-Ai; Tue, 20 Apr 2021 10:22:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113492.216284; Tue, 20 Apr 2021 10:22: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 1lYnWL-0002Tu-7c; Tue, 20 Apr 2021 10:22:17 +0000
Received: by outflank-mailman (input) for mailman id 113492;
 Tue, 20 Apr 2021 10: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 1lYnWJ-0002Tp-H3
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10: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 1lYnWJ-0006uf-CM
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnWJ-0003c1-A8
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10: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=Eu3GRe/YDCdvYhGi+m6GsdteQerD7GaUJjlz823uHaY=; b=zA3LvzNk9/WRyFep5Y8gZbeh9c
	PMLwdKje/EOHMbG9LR4o2q2D75VDfzLQfvzArx8blhVzk0jj6asCIEpi6wJ6tZ+g1OZWZJl0h10+r
	DThdZolm/qmPUt9fhJbGXJSZB3cOQw1qAviYXnuqNBGqs7PYvqy3v0q6/AK6BomLkp6M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] update Xen version to 4.13.4-pre
Message-Id: <E1lYnWJ-0003c1-A8@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:22:15 +0000

commit e3bcd4db25f6dede60b6b7c1ba8479a4a1ba234b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:09:20 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:09:20 2021 +0200

    update Xen version to 4.13.4-pre
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 5dc4c51371..ef1d388efe 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    = 13
-export XEN_EXTRAVERSION ?= .3$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .4-pre$(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.13


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:22:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:22:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113493.216290 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnWV-0002Uq-DR; Tue, 20 Apr 2021 10:22:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113493.216290; Tue, 20 Apr 2021 10:22: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 1lYnWV-0002Uh-9I; Tue, 20 Apr 2021 10:22:27 +0000
Received: by outflank-mailman (input) for mailman id 113493;
 Tue, 20 Apr 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 1lYnWT-0002Ua-Qk
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 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 1lYnWT-0006un-Pr
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 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 1lYnWT-0003dN-Mg
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10: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=jBa3nSEUQG2FmSGDmu663f74dtYesY21JNEHXoxSCqs=; b=oM5MgZUWARWguMIELPOt/5g6gB
	BxjHdEHZ5jsmRZOtfqQWhDdBjbg1zgo6ho0t72khITQxmm9KBQnSNOpXIsjpBfAwZS4CmvN/op57D
	1TwQMepgvFNuWQgTGalvBVw1X8AeLHQESRxlxIL7O8fom0t1d7qAPmdfpQki9JAKE/ZE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] pci: cleanup MSI interrupts before removing device from IOMMU
Message-Id: <E1lYnWT-0003dN-Mg@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:22:25 +0000

commit 5de15582604f1470425aea95a07db28e71650dca
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Apr 20 12:10:24 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:10:24 2021 +0200

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

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


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:22:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:22:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113494.216292 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnWf-0002WH-EQ; Tue, 20 Apr 2021 10:22:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113494.216292; Tue, 20 Apr 2021 10:22: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 1lYnWf-0002W9-BC; Tue, 20 Apr 2021 10:22:37 +0000
Received: by outflank-mailman (input) for mailman id 113494;
 Tue, 20 Apr 2021 10:22: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 1lYnWe-0002Vw-1T
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:22: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 1lYnWe-0006v0-0e
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:22:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnWd-0003e8-Vx
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 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=nGL7ITLsEacck7ZyM+1XgAtmwRnYWsrnIbfbd58qHpM=; b=FMnV4rIksaA92CktjInwyrwtTj
	sXFiOAIQuI6gclGJpx83E8ggo4nnrdyM7yLqFisFrTNy0jR5Dr2mWOaO7iqPE6QMA7r146Sqk3XU/
	8uwAQ8teRtUwQ0ZH5ijleDsum8Zs2qFhOXqw9cDIDDuk3JKRHZ6oECN86qE+9WBNRT+0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] x86emul: fix PINSRW and adjust other {,V}PINSR*
Message-Id: <E1lYnWd-0003e8-Vx@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:22:35 +0000

commit 5aef2c59589fd84397a359c3561c0f3fdfe7baa0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:11:11 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:11:11 2021 +0200

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

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


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:22:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:22:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113495.216295 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnWp-0002Xt-IF; Tue, 20 Apr 2021 10:22:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113495.216295; Tue, 20 Apr 2021 10:22: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 1lYnWp-0002Xl-FN; Tue, 20 Apr 2021 10:22:47 +0000
Received: by outflank-mailman (input) for mailman id 113495;
 Tue, 20 Apr 2021 10:22: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 1lYnWo-0002Xa-60
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:22: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 1lYnWo-0006v8-4Q
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:22:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnWo-0003fF-2x
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:22: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=wvmsNFTpCnIArYYRCXDfdoTJ6PqjNRRmH7n1PRZXmes=; b=d7mzs6SeYjjvfc3XkKp8Z8XzR5
	bKsZjQTTZTbJWoprQTy23NAybuvMpwo+LkCWwTcGI9qnZZzLfgsvP1BsTP4I0KCQVWSIkAjoyzrxm
	9EheQ/lhk8vZTMw03fVd/zA4QVfbmKissNFpUxJn/ma+ecD0tekrxh4lXB9dCQcUKoUY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] x86/timer: Fix boot on Intel systems using ITSSPRC static PIT clock gating
Message-Id: <E1lYnWo-0003fF-2x@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:22:46 +0000

commit ca06bce94fa2cd2cdc42e0c161df9166626436e4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Apr 20 12:11:59 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:11:59 2021 +0200

    x86/timer: Fix boot on Intel systems using ITSSPRC static PIT clock gating
    
    Recent Intel client devices have disabled the legacy PIT for powersaving
    reasons, breaking compatibility with a traditional IBM PC.  Xen depends on a
    legacy timer interrupt to check that the IO-APIC/PIC routing is configured
    correctly, and fails to boot with:
    
      (XEN) *******************************
      (XEN) Panic on CPU 0:
      (XEN) IO-APIC + timer doesn't work!  Boot with apic_verbosity=debug and send report.  Then try booting with the `noapic` option
      (XEN) *******************************
    
    While this setting can be undone by Xen, the details of how to differ by
    chipset, and would be very short sighted for battery based devices.  See bit 2
    "8254 Static Clock Gating Enable" in:
    
      https://edc.intel.com/content/www/us/en/design/products-and-solutions/processors-and-chipsets/comet-lake-u/intel-400-series-chipset-on-package-platform-controller-hub-register-database/itss-power-reduction-control-itssprc-offset-3300/
    
    All impacted systems have an HPET, but there is no indication of the absence
    of PIT functionality, nor a suitable way to probe for its absence.  As a short
    term fix, reconfigure the HPET into legacy replacement mode.  A better
    longterm fix would be to avoid the reliance on the timer interrupt entirely.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: e1de4c196a2eb4fd5063c30a2e115adf144bdeef
    master date: 2021-01-27 19:15:19 +0000
---
 xen/arch/x86/hpet.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 66 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index e99d7116b6..86b4e88f9b 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -767,7 +767,7 @@ static u32 *hpet_boot_cfg;
 u64 __init hpet_setup(void)
 {
     static u64 __initdata hpet_rate;
-    u32 hpet_id, hpet_period;
+    unsigned int hpet_id, hpet_period, hpet_cfg;
     unsigned int last;
 
     if ( hpet_rate )
@@ -800,6 +800,71 @@ u64 __init hpet_setup(void)
     hpet_rate = 1000000000000000ULL; /* 10^15 */
     (void)do_div(hpet_rate, hpet_period);
 
+    /*
+     * Intel chipsets from Skylake/ApolloLake onwards can statically clock
+     * gate the 8259 PIT.  This option is enabled by default in slightly later
+     * systems, as turning the PIT off is a prerequisite to entering the C11
+     * power saving state.
+     *
+     * Xen currently depends on the legacy timer interrupt being active while
+     * IRQ routing is configured.
+     *
+     * Reconfigure the HPET into legacy mode to re-establish the timer
+     * interrupt.
+     */
+    if ( hpet_id & HPET_ID_LEGSUP &&
+         !((hpet_cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
+    {
+        unsigned int c0_cfg, ticks, count;
+
+        /* Stop the main counter. */
+        hpet_write32(hpet_cfg & ~HPET_CFG_ENABLE, HPET_CFG);
+
+        /* Reconfigure channel 0 to be 32bit periodic. */
+        c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+        c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
+                   HPET_TN_32BIT);
+        hpet_write32(c0_cfg, HPET_Tn_CFG(0));
+
+        /*
+         * The exact period doesn't have to match a legacy PIT.  All we need
+         * is an interrupt queued up via the IO-APIC to check routing.
+         *
+         * Use HZ as the frequency.
+         */
+        ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
+
+        count = hpet_read32(HPET_COUNTER);
+
+        /*
+         * HPET_TN_SETVAL above is atrociously documented in the spec.
+         *
+         * Periodic HPET channels have a main comparator register, and
+         * separate "accumulator" register.  Despite being named accumulator
+         * in the spec, this is not an accurate description of its behaviour
+         * or purpose.
+         *
+         * Each time an interrupt is generated, the "accumulator" register is
+         * re-added to the comparator set up the new period.
+         *
+         * Normally, writes to the CMP register update both registers.
+         * However, under these semantics, it is impossible to set up a
+         * periodic timer correctly without the main HPET counter being at 0.
+         *
+         * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
+         * use for periodic timers to mean that the second write to CMP
+         * updates the accumulator only, and not the absolute comparator
+         * value.
+         *
+         * This lets us set a period when the main counter isn't at 0.
+         */
+        hpet_write32(count + ticks, HPET_Tn_CMP(0));
+        hpet_write32(ticks,         HPET_Tn_CMP(0));
+
+        /* Restart the main counter, and legacy mode. */
+        hpet_write32(hpet_cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
+    }
+
     return hpet_rate;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:22:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:22:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113496.216300 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnWz-0002ZS-Ju; Tue, 20 Apr 2021 10:22:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113496.216300; Tue, 20 Apr 2021 10:22: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 1lYnWz-0002ZK-Gu; Tue, 20 Apr 2021 10:22:57 +0000
Received: by outflank-mailman (input) for mailman id 113496;
 Tue, 20 Apr 2021 10:22: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 1lYnWy-0002ZC-8k
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:22: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 1lYnWy-0006vZ-7w
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:22:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnWy-0003gB-6k
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:22: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=c2tPAql/qoDhlTugRdqG9cV1N1Gar5/hnDWZCT3T5Kc=; b=MtmAJ21ghB3NxbhPdRY7leIHLZ
	49CJWH5wwkz9wD+tElc4lnofGj/H+R75k4f2E9X7s0aFo2Qoba2iOuY+QYt9SE1eHyQ8S0ZCehH9S
	h6xH0+4ZPbm964E7Imr1shH6fhHz0/wmEiVjaXiqeQD2FNirLiEoTCS9x4lnfrTURxHs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] VT-d: correct off-by-1 in number-of-IOMMUs check
Message-Id: <E1lYnWy-0003gB-6k@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:22:56 +0000

commit 231237c12b1b5afc14ea9bbbf4e6470281b70fd4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:12:26 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:12:26 2021 +0200

    VT-d: correct off-by-1 in number-of-IOMMUs check
    
    Otherwise, if we really run on a system with this many IOMMUs,
    entering/leaving S3 would overrun iommu_state[].
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: b9b3082002cac68726fb303e0abd2ff0113d4657
    master date: 2021-03-23 17:01:30 +0100
---
 xen/drivers/passthrough/vtd/iommu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 61ba9b496b..a328239375 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1160,10 +1160,10 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
     unsigned long sagaw, nr_dom;
     int agaw;
 
-    if ( nr_iommus > MAX_IOMMUS )
+    if ( nr_iommus >= MAX_IOMMUS )
     {
         dprintk(XENLOG_ERR VTDPREFIX,
-                 "IOMMU: nr_iommus %d > MAX_IOMMUS\n", nr_iommus);
+                "IOMMU: nr_iommus %d > MAX_IOMMUS\n", nr_iommus + 1);
         return -ENOMEM;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:23:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:23:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113497.216304 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnX9-0002al-Lc; Tue, 20 Apr 2021 10:23:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113497.216304; Tue, 20 Apr 2021 10:23: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 1lYnX9-0002ac-IX; Tue, 20 Apr 2021 10:23:07 +0000
Received: by outflank-mailman (input) for mailman id 113497;
 Tue, 20 Apr 2021 10:23: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 1lYnX8-0002aS-Cc
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:23: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 1lYnX8-0006vy-Bh
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:23:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnX8-0003hJ-Ad
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:23: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=2NWNHou93ceuDH0v46FhI+DtfnQJkumL3D8MPoY/BKU=; b=UhHjWe0m1Y6oiINgo5xKZIbobf
	vEw7+Bb0f39UnXhTR3CyBlcZ6zsHxARpCEuWfi5A2Y7nnO8QspbAmn08xqlAqDKmcjyqjYqG/Gb/H
	wVUcggE6CZ7TQbftRf/iRSosWYy4DSpeD3tTYzCg99NzNhTcxOapWqwczjstnBYTR0dU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] VT-d: leave FECTL write to vtd_resume()
Message-Id: <E1lYnX8-0003hJ-Ad@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:23:06 +0000

commit e93d2786725aa6d2a8211ba47af2f2b0504cd750
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:12:58 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:12:58 2021 +0200

    VT-d: leave FECTL write to vtd_resume()
    
    We shouldn't blindly unmask the interrupt when resuming. vtd_resume()
    will restore the intended state.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 0d597e7bd1bd8a57619690d457f79769777a5834
    master date: 2021-03-30 14:39:23 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index a328239375..abbeb13988 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2109,7 +2109,7 @@ static int adjust_vtd_irq_affinities(void)
 }
 __initcall(adjust_vtd_irq_affinities);
 
-static int __must_check init_vtd_hw(void)
+static int __must_check init_vtd_hw(bool resume)
 {
     struct acpi_drhd_unit *drhd;
     struct vtd_iommu *iommu;
@@ -2138,6 +2138,10 @@ static int __must_check init_vtd_hw(void)
             disable_qinval(iommu);
         }
 
+        if ( resume )
+            /* FECTL write done by vtd_resume(). */
+            continue;
+
         spin_lock_irqsave(&iommu->register_lock, flags);
         sts = dmar_readl(iommu->reg, DMAR_FECTL_REG);
         sts &= ~DMA_FECTL_IM;
@@ -2329,7 +2333,7 @@ static int __init vtd_setup(void)
     P(iommu_hap_pt_share, "Shared EPT tables");
 #undef P
 
-    ret = init_vtd_hw();
+    ret = init_vtd_hw(false);
     if ( ret )
         goto error;
 
@@ -2596,7 +2600,7 @@ static void vtd_resume(void)
     if ( !iommu_enabled )
         return;
 
-    if ( init_vtd_hw() != 0  && force_iommu )
+    if ( init_vtd_hw(true) != 0 && force_iommu )
          panic("IOMMU setup failed, crash Xen for security purpose\n");
 
     for_each_drhd_unit ( drhd )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:23:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:23:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113498.216308 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnXJ-0002bu-NM; Tue, 20 Apr 2021 10:23:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113498.216308; Tue, 20 Apr 2021 10:23: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 1lYnXJ-0002bm-K4; Tue, 20 Apr 2021 10:23:17 +0000
Received: by outflank-mailman (input) for mailman id 113498;
 Tue, 20 Apr 2021 10:23: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 1lYnXI-0002bd-G7
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:23: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 1lYnXI-0006w6-FI
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:23:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnXI-0003j0-EP
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:23: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=ck7P4GWZPwWGbcw/H1Q54rttFAkeExfDp9XS/PbNiLY=; b=NR6491sr4bQL8VNvpkUaYqU1DD
	ovCFS1H4hdgE61unIw2bJPuYeQMu6ikK6T9T2xLDJBJy+K+XQJYaji+t2/Lpw/ezZKSFIkSeCZ1g/
	9jxeAPwx1Zl/tN5xkuk+GGRtUC4EQ6keUo6EgifgOLZDeUt9Xsdgc+stcodna14cyOhc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] VT-d: re-order register restoring in vtd_resume()
Message-Id: <E1lYnXI-0003j0-EP@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:23:16 +0000

commit 4352a49dccc0b4a422e86aa5eae96ea466ba5a52
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:13:26 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:13:26 2021 +0200

    VT-d: re-order register restoring in vtd_resume()
    
    For one FECTL must be written last - the interrupt shouldn't be unmasked
    without first having written the data and address needed to actually
    deliver it. In the common case (when dma_msi_set_affinity() doesn't end
    up bailing early) this happens from init_vtd_hw(), but for this to
    actually have the intended effect we shouldn't subsequently overwrite
    what was written there - this is only benign when old and new settings
    match. Instead we should restore the registers ahead of calling
    init_vtd_hw(), just for the unlikely case of dma_msi_set_affinity()
    bailing early.
    
    In the moved code drop some stray casts as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 95e07f8c0e64889ee56015c7f99bdf5309e9e8ef
    master date: 2021-03-30 14:39:54 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index abbeb13988..1e4f800a1a 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2600,6 +2600,21 @@ static void vtd_resume(void)
     if ( !iommu_enabled )
         return;
 
+    for_each_drhd_unit ( drhd )
+    {
+        iommu = drhd->iommu;
+        i = iommu->index;
+
+        spin_lock_irqsave(&iommu->register_lock, flags);
+        dmar_writel(iommu->reg, DMAR_FEDATA_REG,
+                    iommu_state[i][DMAR_FEDATA_REG]);
+        dmar_writel(iommu->reg, DMAR_FEADDR_REG,
+                    iommu_state[i][DMAR_FEADDR_REG]);
+        dmar_writel(iommu->reg, DMAR_FEUADDR_REG,
+                    iommu_state[i][DMAR_FEUADDR_REG]);
+        spin_unlock_irqrestore(&iommu->register_lock, flags);
+    }
+
     if ( init_vtd_hw(true) != 0 && force_iommu )
          panic("IOMMU setup failed, crash Xen for security purpose\n");
 
@@ -2611,12 +2626,6 @@ static void vtd_resume(void)
         spin_lock_irqsave(&iommu->register_lock, flags);
         dmar_writel(iommu->reg, DMAR_FECTL_REG,
                     (u32) iommu_state[i][DMAR_FECTL_REG]);
-        dmar_writel(iommu->reg, DMAR_FEDATA_REG,
-                    (u32) iommu_state[i][DMAR_FEDATA_REG]);
-        dmar_writel(iommu->reg, DMAR_FEADDR_REG,
-                    (u32) iommu_state[i][DMAR_FEADDR_REG]);
-        dmar_writel(iommu->reg, DMAR_FEUADDR_REG,
-                    (u32) iommu_state[i][DMAR_FEUADDR_REG]);
         spin_unlock_irqrestore(&iommu->register_lock, flags);
 
         iommu_enable_translation(drhd);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:23:28 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:23:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113499.216312 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnXU-0002dK-Oj; Tue, 20 Apr 2021 10:23:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113499.216312; Tue, 20 Apr 2021 10:23:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnXU-0002dC-Lf; Tue, 20 Apr 2021 10:23:28 +0000
Received: by outflank-mailman (input) for mailman id 113499;
 Tue, 20 Apr 2021 10:23: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 1lYnXS-0002cx-KI
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:23: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 1lYnXS-0006wH-JU
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:23:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnXS-0003kz-IH
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:23: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=K1wkHG5VQQuV6jy3/s8z4QRuP6Tm4OZhw7dJVsiwEPo=; b=5lHppXJNCuoC4dZ1xj9gWBv9Mp
	H3lHLlZ4skzEj3vAPCQ6moSgz/tvkdU6IysUtZ/syN+z1BS+0rM6FkKnUKbYv1GyNI1jYP5mXkKhY
	o4UjdhCGMn3VsuE98VGQkyPnxj1HDzQ7TdUqjJDH5um1FjtdTThWKnmj9WTD7bEEIPy4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] VT-d: restore flush hooks when disabling qinval
Message-Id: <E1lYnXS-0003kz-IH@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:23:26 +0000

commit 21e1ae3d2c80e606fc81be7a576c4a047c9dc879
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:13:53 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:13:53 2021 +0200

    VT-d: restore flush hooks when disabling qinval
    
    Leaving the hooks untouched is at best a latent risk: There may well be
    cases where some flush is needed, which then needs carrying out the
    "register" way.
    
    Switch from u<N> to uint<N>_t while needing to touch the function
    headers anyway.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 9c39dba2b179c0f4c42c98e97ea0878119718530
    master date: 2021-03-30 14:40:24 +0200
---
 xen/drivers/passthrough/vtd/extern.h | 10 ++++++++++
 xen/drivers/passthrough/vtd/iommu.c  | 19 ++++++++-----------
 xen/drivers/passthrough/vtd/qinval.c |  3 +++
 3 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index f776feefe6..1cac22a02f 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -50,6 +50,16 @@ int iommu_flush_iec_global(struct vtd_iommu *iommu);
 int iommu_flush_iec_index(struct vtd_iommu *iommu, u8 im, u16 iidx);
 void clear_fault_bits(struct vtd_iommu *iommu);
 
+int __must_check vtd_flush_context_reg(struct vtd_iommu *iommu, uint16_t did,
+                                       uint16_t source_id,
+                                       uint8_t function_mask, uint64_t type,
+                                       bool flush_non_present_entry);
+int __must_check vtd_flush_iotlb_reg(struct vtd_iommu *iommu, uint16_t did,
+                                     uint64_t addr, unsigned int size_order,
+                                     uint64_t type,
+                                     bool flush_non_present_entry,
+                                     bool flush_dev_iotlb);
+
 struct vtd_iommu *ioapic_to_iommu(unsigned int apic_id);
 struct vtd_iommu *hpet_to_iommu(unsigned int hpet_id);
 struct acpi_drhd_unit *ioapic_to_drhd(unsigned int apic_id);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 1e4f800a1a..01a2a461ba 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -327,10 +327,9 @@ static void iommu_flush_write_buffer(struct vtd_iommu *iommu)
 }
 
 /* return value determine if we need a write buffer flush */
-static int __must_check flush_context_reg(struct vtd_iommu *iommu, u16 did,
-                                          u16 source_id, u8 function_mask,
-                                          u64 type,
-                                          bool flush_non_present_entry)
+int vtd_flush_context_reg(struct vtd_iommu *iommu, uint16_t did,
+                          uint16_t source_id, uint8_t function_mask,
+                          uint64_t type, bool flush_non_present_entry)
 {
     u64 val = 0;
     unsigned long flags;
@@ -396,11 +395,9 @@ static int __must_check iommu_flush_context_device(struct vtd_iommu *iommu,
 }
 
 /* return value determine if we need a write buffer flush */
-static int __must_check flush_iotlb_reg(struct vtd_iommu *iommu, u16 did,
-                                        u64 addr,
-                                        unsigned int size_order, u64 type,
-                                        bool flush_non_present_entry,
-                                        bool flush_dev_iotlb)
+int vtd_flush_iotlb_reg(struct vtd_iommu *iommu, uint16_t did, uint64_t addr,
+                        unsigned int size_order, uint64_t type,
+                        bool flush_non_present_entry, bool flush_dev_iotlb)
 {
     int tlb_offset = ecap_iotlb_offset(iommu->ecap);
     u64 val = 0;
@@ -2161,8 +2158,8 @@ static int __must_check init_vtd_hw(bool resume)
          */
         if ( enable_qinval(iommu) != 0 )
         {
-            iommu->flush.context = flush_context_reg;
-            iommu->flush.iotlb   = flush_iotlb_reg;
+            iommu->flush.context = vtd_flush_context_reg;
+            iommu->flush.iotlb   = vtd_flush_iotlb_reg;
         }
     }
 
diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c
index 39b7abd009..764ef9f0fc 100644
--- a/xen/drivers/passthrough/vtd/qinval.c
+++ b/xen/drivers/passthrough/vtd/qinval.c
@@ -462,4 +462,7 @@ void disable_qinval(struct vtd_iommu *iommu)
                   !(sts & DMA_GSTS_QIES), sts);
 out:
     spin_unlock_irqrestore(&iommu->register_lock, flags);
+
+    iommu->flush.context = vtd_flush_context_reg;
+    iommu->flush.iotlb   = vtd_flush_iotlb_reg;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:23:38 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:23:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113500.216316 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnXe-0002eS-Qn; Tue, 20 Apr 2021 10:23:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113500.216316; Tue, 20 Apr 2021 10:23:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnXe-0002eJ-ND; Tue, 20 Apr 2021 10:23:38 +0000
Received: by outflank-mailman (input) for mailman id 113500;
 Tue, 20 Apr 2021 10:23: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 1lYnXc-0002e8-N3
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:23: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 1lYnXc-0006wN-MD
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:23:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnXc-0003m1-Le
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:23: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=mlEgjT96ByF3EfvonIQrcW9nes3eoKOmK813EFLx3jU=; b=2D4TtRiKCdf00uDWDvFh2BJziX
	S+8+LJiy/rayq9sa9N/ZcPq6NH3fKT7njNCd3meeHbG5AIb+/gwsc8Kx0FNx7SFGZGJCCDfwedjkn
	nr4FqyEUcWRzNFWjf4xiyvFXUVw47FEtd1Qy3IrVjiZMtx6mv0cQDrTlgLPKSt3Ol8gw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] fix for_each_cpu() again for NR_CPUS=1
Message-Id: <E1lYnXc-0003m1-Le@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:23:36 +0000

commit 0e711a09359e3cf95dc591ec04d8df4f84a35b03
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:14:34 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:14:34 2021 +0200

    fix for_each_cpu() again for NR_CPUS=1
    
    Unfortunately aa50f45332f1 ("xen: fix for_each_cpu when NR_CPUS=1") has
    caused quite a bit of fallout with gcc10, e.g. (there are at least two
    more similar ones, and I didn't bother trying to find them all):
    
    In file included from .../xen/include/xen/config.h:13,
                     from <command-line>:
    core_parking.c: In function ‘core_parking_power’:
    .../xen/include/asm/percpu.h:12:51: error: array subscript 1 is above array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds]
       12 |     (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
    .../xen/include/xen/compiler.h:141:29: note: in definition of macro ‘RELOC_HIDE’
      141 |     (typeof(ptr)) (__ptr + (off)); })
          |                             ^~~
    core_parking.c:133:39: note: in expansion of macro ‘per_cpu’
      133 |             core_tmp = cpumask_weight(per_cpu(cpu_core_mask, cpu));
          |                                       ^~~~~~~
    In file included from .../xen/include/xen/percpu.h:4,
                     from .../xen/include/asm/msr.h:7,
                     from .../xen/include/asm/time.h:5,
                     from .../xen/include/xen/time.h:76,
                     from .../xen/include/xen/spinlock.h:4,
                     from .../xen/include/xen/cpu.h:5,
                     from core_parking.c:19:
    .../xen/include/asm/percpu.h:6:22: note: while referencing ‘__per_cpu_offset’
        6 | extern unsigned long __per_cpu_offset[NR_CPUS];
          |                      ^~~~~~~~~~~~~~~~
    
    One of the further errors even went as far as claiming that an array
    index (range) of [0, 0] was outside the bounds of a [1] array, so
    something fishy is pretty clearly going on there.
    
    The compiler apparently wants to be able to see that the loop isn't
    really a loop in order to avoid triggering such warnings, yet what
    exactly makes it consider the loop exit condition constant and within
    the [0, 1] range isn't obvious - using ((mask)->bits[0] & 1) instead of
    cpumask_test_cpu() for example did _not_ help.
    
    Re-instate a special form of for_each_cpu(), experimentally "proven" to
    avoid the diagnostics.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
    master commit: 625faf9f002bd6ff4b6457a016b8ff338223b659
    master date: 2021-04-07 12:24:45 +0200
---
 xen/include/xen/cpumask.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/xen/cpumask.h b/xen/include/xen/cpumask.h
index e69589fc08..9826707909 100644
--- a/xen/include/xen/cpumask.h
+++ b/xen/include/xen/cpumask.h
@@ -368,10 +368,15 @@ static inline void free_cpumask_var(cpumask_var_t mask)
 #define FREE_CPUMASK_VAR(m) free_cpumask_var(m)
 #endif
 
+#if NR_CPUS > 1
 #define for_each_cpu(cpu, mask)			\
 	for ((cpu) = cpumask_first(mask);	\
 	     (cpu) < nr_cpu_ids;		\
 	     (cpu) = cpumask_next(cpu, mask))
+#else /* NR_CPUS == 1 */
+#define for_each_cpu(cpu, mask)			\
+	for ((cpu) = 0; (cpu) < cpumask_test_cpu(0, mask); ++(cpu))
+#endif /* NR_CPUS */
 
 /*
  * The following particular system cpumasks and operations manage
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:23:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:23:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113501.216319 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnXn-0002fq-TV; Tue, 20 Apr 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 113501.216319; Tue, 20 Apr 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 1lYnXn-0002fi-Qf; Tue, 20 Apr 2021 10:23:47 +0000
Received: by outflank-mailman (input) for mailman id 113501;
 Tue, 20 Apr 2021 10:23: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 1lYnXm-0002fc-Q3
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:23: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 1lYnXm-0006wV-PF
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:23:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnXm-0003nI-OY
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:23: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=VhstR5FbBRrJ2oCJTXWCUcwrAj1k9ENoEwUlrvbxvx8=; b=1tgJGRg7Hj/ohtL4ez7myoMSNZ
	ySVHM7Iv3x+ATGZmUOUoxTFQG2cISLXVRaaGCxnN/pRr3x6NFpuMzy+FVSgOfsJonXG9AJln70m5Z
	FW5vD/VbBCf7AM7wOjykOezRJrn83xsflkneZY9OPbWGcPvXWb006fgkNN5v7VgZmcrU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] x86/vpt: do not take pt_migrate rwlock in some cases
Message-Id: <E1lYnXm-0003nI-OY@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:23:46 +0000

commit 8113b02f0bf85b69e9180da63b43a12a274ea04b
Author:     Boris Ostrovsky <boris.ostrovsky@oracle.com>
AuthorDate: Tue Apr 20 12:15:12 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:15:12 2021 +0200

    x86/vpt: do not take pt_migrate rwlock in some cases
    
    Commit 8e76aef72820 ("x86/vpt: fix race when migrating timers between
    vCPUs") addressed XSA-336 by introducing a per-domain rwlock that was
    intended to protect periodic timer during VCPU migration. Since such
    migration is an infrequent event no performance impact was expected.
    
    Unfortunately this turned out not to be the case: on a fairly large
    guest (92 VCPUs) we've observed as much as 40% TPCC performance
    regression with some guest kernels. Further investigation pointed to
    pt_migrate read lock taken in pt_update_irq() as the largest contributor
    to this regression. With large number of VCPUs and large number of VMEXITs
    (from where pt_update_irq() is always called) the update of an atomic in
    read_lock() is thought to be the main cause.
    
    Stephen Brennan analyzed locking pattern and classified lock users as
    follows:
    
    1. Functions which read (maybe write) all periodic_time instances attached
    to a particular vCPU. These are functions which use pt_vcpu_lock() such
    as pt_restore_timer(), pt_save_timer(), etc.
    2. Functions which want to modify a particular periodic_time object.
    These functions lock whichever vCPU the periodic_time is attached to, but
    since the vCPU could be modified without holding any lock, they are
    vulnerable to XSA-336. Functions in this group use pt_lock(), such as
    pt_timer_fn() or destroy_periodic_time().
    3. Functions which not only want to modify the periodic_time, but also
    would like to modify the =vcpu= fields. These are create_periodic_time()
    or pt_adjust_vcpu(). They create XSA-336 conditions for group 2, but we
    can't simply hold 2 vcpu locks due to the deadlock risk.
    
    Roger then pointed out that group 1 functions don't really need to hold
    the pt_migrate rwlock and that instead groups 2 and 3 should hold per-vcpu
    lock whenever they modify per-vcpu timer lists.
    
    Suggested-by: Stephen Brennan <stephen.s.brennan@oracle.com>
    Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Stephen Brennan <stephen.s.brennan@oracle.com>
    master commit: 1f3d87c7512975274cc45c40097b05550eba1ac9
    master date: 2021-04-09 09:21:27 +0200
---
 xen/arch/x86/hvm/vpt.c        | 44 ++++++++++++++++++++++++++++++++++---------
 xen/include/asm-x86/hvm/vpt.h | 18 ++++++++++++------
 2 files changed, 47 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 6d5f98767c..a644e3ce53 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -152,32 +152,43 @@ static int pt_irq_masked(struct periodic_time *pt)
     return 1;
 }
 
+/*
+ * Functions which read (maybe write) all periodic_time instances
+ * attached to a particular vCPU use pt_vcpu_{un}lock locking helpers.
+ *
+ * Such users are explicitly forbidden from changing the value of the
+ * pt->vcpu field, because another thread holding the pt_migrate lock
+ * may already be spinning waiting for your vcpu lock.
+ */
 static void pt_vcpu_lock(struct vcpu *v)
 {
-    read_lock(&v->domain->arch.hvm.pl_time->pt_migrate);
     spin_lock(&v->arch.hvm.tm_lock);
 }
 
 static void pt_vcpu_unlock(struct vcpu *v)
 {
     spin_unlock(&v->arch.hvm.tm_lock);
-    read_unlock(&v->domain->arch.hvm.pl_time->pt_migrate);
 }
 
+/*
+ * Functions which want to modify a particular periodic_time object
+ * use pt_{un}lock locking helpers.
+ *
+ * These users lock whichever vCPU the periodic_time is attached to,
+ * but since the vCPU could be modified without holding any lock, they
+ * need to take an additional lock that protects against pt->vcpu
+ * changing.
+ */
 static void pt_lock(struct periodic_time *pt)
 {
-    /*
-     * We cannot use pt_vcpu_lock here, because we need to acquire the
-     * per-domain lock first and then (re-)fetch the value of pt->vcpu, or
-     * else we might be using a stale value of pt->vcpu.
-     */
     read_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
     spin_lock(&pt->vcpu->arch.hvm.tm_lock);
 }
 
 static void pt_unlock(struct periodic_time *pt)
 {
-    pt_vcpu_unlock(pt->vcpu);
+    spin_unlock(&pt->vcpu->arch.hvm.tm_lock);
+    read_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
 }
 
 static void pt_process_missed_ticks(struct periodic_time *pt)
@@ -542,8 +553,10 @@ void create_periodic_time(
     pt->cb = cb;
     pt->priv = data;
 
+    pt_vcpu_lock(v);
     pt->on_list = 1;
     list_add(&pt->list, &v->arch.hvm.tm_list);
+    pt_vcpu_unlock(v);
 
     init_timer(&pt->timer, pt_timer_fn, pt, v->processor);
     set_timer(&pt->timer, pt->scheduled);
@@ -579,13 +592,26 @@ static void pt_adjust_vcpu(struct periodic_time *pt, struct vcpu *v)
         return;
 
     write_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
+
+    if ( pt->vcpu == v )
+        goto out;
+
+    pt_vcpu_lock(pt->vcpu);
+    if ( pt->on_list )
+        list_del(&pt->list);
+    pt_vcpu_unlock(pt->vcpu);
+
     pt->vcpu = v;
+
+    pt_vcpu_lock(v);
     if ( pt->on_list )
     {
-        list_del(&pt->list);
         list_add(&pt->list, &v->arch.hvm.tm_list);
         migrate_timer(&pt->timer, v->processor);
     }
+    pt_vcpu_unlock(v);
+
+ out:
     write_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
 }
 
diff --git a/xen/include/asm-x86/hvm/vpt.h b/xen/include/asm-x86/hvm/vpt.h
index e2cdba4280..32d6a16ea1 100644
--- a/xen/include/asm-x86/hvm/vpt.h
+++ b/xen/include/asm-x86/hvm/vpt.h
@@ -134,12 +134,18 @@ struct pl_time {    /* platform time */
     struct RTCState  vrtc;
     struct HPETState vhpet;
     struct PMTState  vpmt;
-    /*
-     * rwlock to prevent periodic_time vCPU migration. Take the lock in read
-     * mode in order to prevent the vcpu field of periodic_time from changing.
-     * Lock must be taken in write mode when changes to the vcpu field are
-     * performed, as it allows exclusive access to all the timers of a domain.
-     */
+     /*
+      * Functions which want to modify the vcpu field of the vpt need
+      * to hold the global lock (pt_migrate) in write mode together
+      * with the per-vcpu locks of the lists being modified. Functions
+      * that want to lock a periodic_timer that's possibly on a
+      * different vCPU list need to take the lock in read mode first in
+      * order to prevent the vcpu field of periodic_timer from
+      * changing.
+      *
+      * Note that two vcpu locks cannot be held at the same time to
+      * avoid a deadlock.
+      */
     rwlock_t pt_migrate;
     /* guest_time = Xen sys time + stime_offset */
     int64_t stime_offset;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:23:58 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:23:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113502.216324 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnXx-0002hc-VX; Tue, 20 Apr 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 113502.216324; Tue, 20 Apr 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 1lYnXx-0002hU-SB; Tue, 20 Apr 2021 10:23:57 +0000
Received: by outflank-mailman (input) for mailman id 113502;
 Tue, 20 Apr 2021 10:23: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 1lYnXw-0002hN-Vd
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:23: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 1lYnXw-0006wv-UF
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:23:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnXw-0003oh-Sg
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:23: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=I/bSIREx1QAVY/CnOnBUPKX12owwImjpn2MwQn0XVyA=; b=yVNZKJ2rfQJvWp5NbNSsDqCK32
	YZz2bw/IDj7ekEWtVbLGuRb0RugPTV8mT9OuFLVy236yNqFS46GIqwaD2hcpMTNY7OYMR0SMBkNU5
	8kGOITKd5ziINxPT1KheImwmqLvpGYqS3K87OfxoQjOO8rJLvML/MajEaJPCBUIHQq1U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] x86/hpet: Factor hpet_enable_legacy_replacement_mode() out of hpet_setup()
Message-Id: <E1lYnXw-0003oh-Sg@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:23:56 +0000

commit 53f4ce9df0d3d1e61b6d2d758eb9a43bba80ff11
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Apr 20 12:15:50 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:15:50 2021 +0200

    x86/hpet: Factor hpet_enable_legacy_replacement_mode() out of hpet_setup()
    
    ... in preparation to introduce a second caller.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Frédéric Pierret <frederic.pierret@qubes-os.org>
    master commit: 238168b5bcd27fec97704f6295fa5bf7a442eb6f
    master date: 2021-04-15 18:25:40 +0100
---
 xen/arch/x86/hpet.c        | 116 ++++++++++++++++++++++++---------------------
 xen/include/asm-x86/hpet.h |   6 +++
 2 files changed, 68 insertions(+), 54 deletions(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 86b4e88f9b..d19646f818 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -763,11 +763,70 @@ int hpet_legacy_irq_tick(void)
 }
 
 static u32 *hpet_boot_cfg;
+static uint64_t __initdata hpet_rate;
+
+bool __init hpet_enable_legacy_replacement_mode(void)
+{
+    unsigned int cfg, c0_cfg, ticks, count;
+
+    if ( !hpet_rate ||
+         !(hpet_read32(HPET_ID) & HPET_ID_LEGSUP) ||
+         ((cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
+        return false;
+
+    /* Stop the main counter. */
+    hpet_write32(cfg & ~HPET_CFG_ENABLE, HPET_CFG);
+
+    /* Reconfigure channel 0 to be 32bit periodic. */
+    c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+    c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
+               HPET_TN_32BIT);
+    hpet_write32(c0_cfg, HPET_Tn_CFG(0));
+
+    /*
+     * The exact period doesn't have to match a legacy PIT.  All we need
+     * is an interrupt queued up via the IO-APIC to check routing.
+     *
+     * Use HZ as the frequency.
+     */
+    ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
+
+    count = hpet_read32(HPET_COUNTER);
+
+    /*
+     * HPET_TN_SETVAL above is atrociously documented in the spec.
+     *
+     * Periodic HPET channels have a main comparator register, and
+     * separate "accumulator" register.  Despite being named accumulator
+     * in the spec, this is not an accurate description of its behaviour
+     * or purpose.
+     *
+     * Each time an interrupt is generated, the "accumulator" register is
+     * re-added to the comparator set up the new period.
+     *
+     * Normally, writes to the CMP register update both registers.
+     * However, under these semantics, it is impossible to set up a
+     * periodic timer correctly without the main HPET counter being at 0.
+     *
+     * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
+     * use for periodic timers to mean that the second write to CMP
+     * updates the accumulator only, and not the absolute comparator
+     * value.
+     *
+     * This lets us set a period when the main counter isn't at 0.
+     */
+    hpet_write32(count + ticks, HPET_Tn_CMP(0));
+    hpet_write32(ticks,         HPET_Tn_CMP(0));
+
+    /* Restart the main counter, and legacy mode. */
+    hpet_write32(cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
+
+    return true;
+}
 
 u64 __init hpet_setup(void)
 {
-    static u64 __initdata hpet_rate;
-    unsigned int hpet_id, hpet_period, hpet_cfg;
+    unsigned int hpet_id, hpet_period;
     unsigned int last;
 
     if ( hpet_rate )
@@ -812,58 +871,7 @@ u64 __init hpet_setup(void)
      * Reconfigure the HPET into legacy mode to re-establish the timer
      * interrupt.
      */
-    if ( hpet_id & HPET_ID_LEGSUP &&
-         !((hpet_cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
-    {
-        unsigned int c0_cfg, ticks, count;
-
-        /* Stop the main counter. */
-        hpet_write32(hpet_cfg & ~HPET_CFG_ENABLE, HPET_CFG);
-
-        /* Reconfigure channel 0 to be 32bit periodic. */
-        c0_cfg = hpet_read32(HPET_Tn_CFG(0));
-        c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
-                   HPET_TN_32BIT);
-        hpet_write32(c0_cfg, HPET_Tn_CFG(0));
-
-        /*
-         * The exact period doesn't have to match a legacy PIT.  All we need
-         * is an interrupt queued up via the IO-APIC to check routing.
-         *
-         * Use HZ as the frequency.
-         */
-        ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
-
-        count = hpet_read32(HPET_COUNTER);
-
-        /*
-         * HPET_TN_SETVAL above is atrociously documented in the spec.
-         *
-         * Periodic HPET channels have a main comparator register, and
-         * separate "accumulator" register.  Despite being named accumulator
-         * in the spec, this is not an accurate description of its behaviour
-         * or purpose.
-         *
-         * Each time an interrupt is generated, the "accumulator" register is
-         * re-added to the comparator set up the new period.
-         *
-         * Normally, writes to the CMP register update both registers.
-         * However, under these semantics, it is impossible to set up a
-         * periodic timer correctly without the main HPET counter being at 0.
-         *
-         * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
-         * use for periodic timers to mean that the second write to CMP
-         * updates the accumulator only, and not the absolute comparator
-         * value.
-         *
-         * This lets us set a period when the main counter isn't at 0.
-         */
-        hpet_write32(count + ticks, HPET_Tn_CMP(0));
-        hpet_write32(ticks,         HPET_Tn_CMP(0));
-
-        /* Restart the main counter, and legacy mode. */
-        hpet_write32(hpet_cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
-    }
+    hpet_enable_legacy_replacement_mode();
 
     return hpet_rate;
 }
diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h
index fb6bf05065..50176de3d2 100644
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -72,6 +72,12 @@ void hpet_disable(void);
  */
 int hpet_legacy_irq_tick(void);
 
+/*
+ * Try to enable HPET Legacy Replacement mode.  Returns a boolean indicating
+ * whether the HPET configuration was changed.
+ */
+bool hpet_enable_legacy_replacement_mode(void);
+
 /*
  * Temporarily use an HPET event counter for timer interrupt handling,
  * rather than using the LAPIC timer. Used for Cx state entry.
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 10:24:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 10:24:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113503.216328 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYnY8-0002ij-0R; Tue, 20 Apr 2021 10:24:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113503.216328; Tue, 20 Apr 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 1lYnY7-0002ib-Th; Tue, 20 Apr 2021 10:24:07 +0000
Received: by outflank-mailman (input) for mailman id 113503;
 Tue, 20 Apr 2021 10:24: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 1lYnY7-0002iV-34
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:24: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 1lYnY7-0006xI-2H
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:24:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYnY7-0003ph-1Q
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 10:24: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=csofrQW/N6XLmJia18cUKKWZNMvc+pCQFjuJBfJ8Zpc=; b=wNP/y6cg2Bth6oLMTbBF1lx3nj
	30B0zfSJf0uk+kwYB+wedZEJ5aTA6saWdgGhmNjkCAbgwSoW9fAK6w7AxHn45f4QIJZBODv1GmZ/F
	HvN/rzFveZYZYAvyts62TYvAzjRNoRUwFOrX1Qu07sT3caFUqKoRIazAUYyecN5RV0/8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.13] x86/hpet: Don't enable legacy replacement mode unconditionally
Message-Id: <E1lYnY7-0003ph-1Q@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 10:24:07 +0000

commit 33049e3ad9c3a0f7432969f4b5d7b1a287b5b8f9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:16:19 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:16:19 2021 +0200

    x86/hpet: Don't enable legacy replacement mode unconditionally
    
    Commit e1de4c196a2e ("x86/timer: Fix boot on Intel systems using ITSSPRC
    static PIT clock gating") was reported to cause boot failures on certain
    AMD Ryzen systems.
    
    Refine the fix to do nothing in the default case, and only attempt to
    configure legacy replacement mode if IRQ0 is found to not be working.  If
    legacy replacement mode doesn't help, undo it before falling back to other IRQ
    routing configurations.
    
    In addition, introduce a "hpet" command line option so this heuristic
    can be overridden.  Since it makes little sense to introduce just
    "hpet=legacy-replacement", also allow for a boolean argument as well as
    "broadcast" to replace the separate "hpetbroadcast" option.
    
    Reported-by: Frédéric Pierret frederic.pierret@qubes-os.org
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Frédéric Pierret <frederic.pierret@qubes-os.org>
    master commit: b53173e7cdafb7a318a239d557478fd73734a86a
    master date: 2021-04-15 18:25:40 +0100
---
 docs/misc/xen-command-line.pandoc | 33 +++++++++++++++++
 xen/arch/x86/hpet.c               | 75 +++++++++++++++++++++++++++++----------
 xen/arch/x86/io_apic.c            | 31 ++++++++++++++++
 xen/include/asm-x86/hpet.h        |  7 ++++
 4 files changed, 128 insertions(+), 18 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 125b4f330b..0b6ec8b6a1 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1190,9 +1190,42 @@ supported. See docs/misc/arm/big.LITTLE.txt for more information.
 When the hmp-unsafe option is disabled (default), CPUs that are not
 identical to the boot CPU will be parked and not used by Xen.
 
+### hpet
+    = List of [ <bool> | broadcast=<bool> | legacy-replacement=<bool> ]
+
+    Applicability: x86
+
+Controls Xen's use of the system's High Precision Event Timer.  By default,
+Xen will use an HPET when available and not subject to errata.  Use of the
+HPET can be disabled by specifying `hpet=0`.
+
+ * The `broadcast` boolean is disabled by default, but forces Xen to keep
+   using the broadcast for CPUs in deep C-states even when an RTC interrupt is
+   enabled.  This then also affects raising of the RTC interrupt.
+
+ * The `legacy-replacement` boolean allows for control over whether Legacy
+   Replacement mode is enabled.
+
+   Legacy Replacement mode is intended for hardware which does not have an
+   8254 PIT, and allows the HPET to be configured into a compatible mode.
+   Intel chipsets from Skylake/ApolloLake onwards can turn the PIT off for
+   power saving reasons, and there is no platform-agnostic mechanism for
+   discovering this.
+
+   By default, Xen will not change hardware configuration, unless the PIT
+   appears to be absent, at which point Xen will try to enable Legacy
+   Replacement mode before falling back to pre-IO-APIC interrupt routing
+   options.
+
+   This behaviour can be inhibited by specifying `legacy-replacement=0`.
+   Alternatively, this mode can be enabled unconditionally (if available) by
+   specifying `legacy-replacement=1`.
+
 ### hpetbroadcast (x86)
 > `= <boolean>`
 
+Deprecated alternative of `hpet=broadcast`.
+
 ### hvm_debug (x86)
 > `= <integer>`
 
diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index d19646f818..927ed83c61 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -51,6 +51,8 @@ static unsigned int __read_mostly num_hpets_used;
 DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel);
 
 unsigned long __initdata hpet_address;
+int8_t __initdata opt_hpet_legacy_replacement = -1;
+static bool __initdata opt_hpet = true;
 u8 __initdata hpet_blockid;
 u8 __initdata hpet_flags;
 
@@ -62,6 +64,32 @@ u8 __initdata hpet_flags;
 static bool __initdata force_hpet_broadcast;
 boolean_param("hpetbroadcast", force_hpet_broadcast);
 
+static int __init parse_hpet_param(const char *s)
+{
+    const char *ss;
+    int val, rc = 0;
+
+    do {
+        ss = strchr(s, ',');
+        if ( !ss )
+            ss = strchr(s, '\0');
+
+        if ( (val = parse_bool(s, ss)) >= 0 )
+            opt_hpet = val;
+        else if ( (val = parse_boolean("broadcast", s, ss)) >= 0 )
+            force_hpet_broadcast = val;
+        else if ( (val = parse_boolean("legacy-replacement", s, ss)) >= 0 )
+            opt_hpet_legacy_replacement = val;
+        else
+            rc = -EINVAL;
+
+        s = ss + 1;
+    } while ( *ss );
+
+    return rc;
+}
+custom_param("hpet", parse_hpet_param);
+
 /*
  * Calculate a multiplication factor for scaled math, which is used to convert
  * nanoseconds based values to clock ticks:
@@ -764,6 +792,9 @@ int hpet_legacy_irq_tick(void)
 
 static u32 *hpet_boot_cfg;
 static uint64_t __initdata hpet_rate;
+static __initdata struct {
+    uint32_t cmp, cfg;
+} pre_legacy_c0;
 
 bool __init hpet_enable_legacy_replacement_mode(void)
 {
@@ -777,8 +808,11 @@ bool __init hpet_enable_legacy_replacement_mode(void)
     /* Stop the main counter. */
     hpet_write32(cfg & ~HPET_CFG_ENABLE, HPET_CFG);
 
+    /* Stash channel 0's old CFG/CMP incase we need to undo. */
+    pre_legacy_c0.cfg = c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+    pre_legacy_c0.cmp = hpet_read32(HPET_Tn_CMP(0));
+
     /* Reconfigure channel 0 to be 32bit periodic. */
-    c0_cfg = hpet_read32(HPET_Tn_CFG(0));
     c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
                HPET_TN_32BIT);
     hpet_write32(c0_cfg, HPET_Tn_CFG(0));
@@ -824,17 +858,33 @@ bool __init hpet_enable_legacy_replacement_mode(void)
     return true;
 }
 
+void __init hpet_disable_legacy_replacement_mode(void)
+{
+    unsigned int cfg = hpet_read32(HPET_CFG);
+
+    ASSERT(hpet_rate);
+
+    cfg &= ~(HPET_CFG_LEGACY | HPET_CFG_ENABLE);
+
+    /* Stop the main counter and disable legacy mode. */
+    hpet_write32(cfg, HPET_CFG);
+
+    /* Restore pre-Legacy Replacement Mode settings. */
+    hpet_write32(pre_legacy_c0.cfg, HPET_Tn_CFG(0));
+    hpet_write32(pre_legacy_c0.cmp, HPET_Tn_CMP(0));
+
+    /* Restart the main counter. */
+    hpet_write32(cfg | HPET_CFG_ENABLE, HPET_CFG);
+}
+
 u64 __init hpet_setup(void)
 {
     unsigned int hpet_id, hpet_period;
     unsigned int last;
 
-    if ( hpet_rate )
+    if ( hpet_rate || !hpet_address || !opt_hpet )
         return hpet_rate;
 
-    if ( hpet_address == 0 )
-        return 0;
-
     set_fixmap_nocache(FIX_HPET_BASE, hpet_address);
 
     hpet_id = hpet_read32(HPET_ID);
@@ -859,19 +909,8 @@ u64 __init hpet_setup(void)
     hpet_rate = 1000000000000000ULL; /* 10^15 */
     (void)do_div(hpet_rate, hpet_period);
 
-    /*
-     * Intel chipsets from Skylake/ApolloLake onwards can statically clock
-     * gate the 8259 PIT.  This option is enabled by default in slightly later
-     * systems, as turning the PIT off is a prerequisite to entering the C11
-     * power saving state.
-     *
-     * Xen currently depends on the legacy timer interrupt being active while
-     * IRQ routing is configured.
-     *
-     * Reconfigure the HPET into legacy mode to re-establish the timer
-     * interrupt.
-     */
-    hpet_enable_legacy_replacement_mode();
+    if ( opt_hpet_legacy_replacement > 0 )
+        hpet_enable_legacy_replacement_mode();
 
     return hpet_rate;
 }
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index e710827dcf..3eddf8e00a 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -28,6 +28,8 @@
 #include <xen/acpi.h>
 #include <xen/keyhandler.h>
 #include <xen/softirq.h>
+
+#include <asm/hpet.h>
 #include <asm/mc146818rtc.h>
 #include <asm/smp.h>
 #include <asm/desc.h>
@@ -1928,6 +1930,35 @@ static void __init check_timer(void)
             local_irq_restore(flags);
             return;
         }
+
+        /*
+         * Intel chipsets from Skylake/ApolloLake onwards can statically clock
+         * gate the 8254 PIT.  This option is enabled by default in slightly
+         * later systems, as turning the PIT off is a prerequisite to entering
+         * the C11 power saving state.
+         *
+         * Xen currently depends on the legacy timer interrupt being active
+         * while IRQ routing is configured.
+         *
+         * If the user hasn't made an explicit choice, attempt to reconfigure
+         * the HPET into legacy mode to re-establish the timer interrupt.
+         */
+        if ( opt_hpet_legacy_replacement < 0 &&
+             hpet_enable_legacy_replacement_mode() )
+        {
+            printk(XENLOG_ERR "..no 8254 timer found - trying HPET Legacy Replacement Mode\n");
+
+            if ( timer_irq_works() )
+            {
+                local_irq_restore(flags);
+                return;
+            }
+
+            /* Legacy Replacement mode hasn't helped.  Undo it. */
+            printk(XENLOG_ERR "..no HPET timer found - reverting Legacy Replacement Mode\n");
+            hpet_disable_legacy_replacement_mode();
+        }
+
         clear_IO_APIC_pin(apic1, pin1);
         printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to "
                "IO-APIC\n");
diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h
index 50176de3d2..8f9725a95e 100644
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -53,6 +53,7 @@
 extern unsigned long hpet_address;
 extern u8 hpet_blockid;
 extern u8 hpet_flags;
+extern int8_t opt_hpet_legacy_replacement;
 
 /*
  * Detect and initialise HPET hardware: return counter update frequency.
@@ -78,6 +79,12 @@ int hpet_legacy_irq_tick(void);
  */
 bool hpet_enable_legacy_replacement_mode(void);
 
+/*
+ * Undo the effects of hpet_disable_legacy_replacement_mode().  Must not be
+ * called unless enable() returned true.
+ */
+void hpet_disable_legacy_replacement_mode(void);
+
 /*
  * Temporarily use an HPET event counter for timer interrupt handling,
  * rather than using the LAPIC timer. Used for Cx state entry.
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 12:22:19 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 12:22:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113593.216473 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYpOP-0006AX-M4; Tue, 20 Apr 2021 12:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113593.216473; Tue, 20 Apr 2021 12:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYpOP-0006AO-Iy; Tue, 20 Apr 2021 12:22:13 +0000
Received: by outflank-mailman (input) for mailman id 113593;
 Tue, 20 Apr 2021 12:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYpOO-0006AJ-6T
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 12:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYpOO-0000WW-5E
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 12:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYpOO-0004k1-3m
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 12:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8RtdkrmDhuE56rdnGCR+/GnCi7AWek0lPHKYyHYJ2+A=; b=a+mBsgv0py6kHcIddyYdlv+2R2
	MD/bc7qBVC0zmCjXAfsfidzcDbcJEtf1uC/154KwJBGD9Ewg/E2qFsK6XWWHEa+CLwpx8LuRxw2+E
	2NgGiBxkDotxnTspkawgn427ooB0/S/Sf7nHUvX9EUVYjkdh0k9ij1zdqFYnklZ0OyKc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm64: Place a speculation barrier following an ret instruction
Message-Id: <E1lYpOO-0004k1-3m@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 12:22:12 +0000

commit bcab2ac84931ab58e2f2cd1242ed551d8aaff021
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jun 16 16:33:12 2020 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 20 13:17:34 2021 +0100

    xen/arm64: Place a speculation barrier following an ret instruction
    
    Some CPUs can speculate past a RET instruction and potentially perform
    speculative accesses to memory before processing the return.
    
    There is no known gadget available after the RET instruction today.
    However some of the registers (such as in check_pending_guest_serror())
    may contain a value provided by the guest.
    
    In order to harden the code, it would be better to add a speculation
    barrier after each RET instruction. The performance impact is meant to
    be negligeable as the speculation barrier is not meant to be
    architecturally executed.
    
    Rather than manually inserting a speculation barrier, use a macro
    which overrides the mnemonic RET and replace with RET + SB. We need to
    use the opcode for RET to prevent any macro recursion.
    
    This patch is only covering the assembly code. C code would need to be
    covered separately using the compiler support.
    
    Note that the definition of the macros sb needs to be moved earlier in
    asm-arm/macros.h so it can be used by the new macro.
    
    This is part of the work to mitigate straight-line speculation.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/include/asm-arm/arm64/macros.h |  6 ++++++
 xen/include/asm-arm/macros.h       | 18 +++++++++---------
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/xen/include/asm-arm/arm64/macros.h b/xen/include/asm-arm/arm64/macros.h
index f981b4f43e..5ad66efd6b 100644
--- a/xen/include/asm-arm/arm64/macros.h
+++ b/xen/include/asm-arm/arm64/macros.h
@@ -21,6 +21,12 @@
     ldr     \dst, [\dst, \tmp]
     .endm
 
+    .macro  ret
+        /* ret opcode */
+        .inst 0xd65f03c0
+        sb
+    .endm
+
 /*
  * Register aliases.
  */
diff --git a/xen/include/asm-arm/macros.h b/xen/include/asm-arm/macros.h
index 4833671f4c..1aa373760f 100644
--- a/xen/include/asm-arm/macros.h
+++ b/xen/include/asm-arm/macros.h
@@ -5,6 +5,15 @@
 # error "This file should only be included in assembly file"
 #endif
 
+    /*
+     * Speculative barrier
+     * XXX: Add support for the 'sb' instruction
+     */
+    .macro sb
+    dsb nsh
+    isb
+    .endm
+
 #if defined (CONFIG_ARM_32)
 # include <asm/arm32/macros.h>
 #elif defined(CONFIG_ARM_64)
@@ -20,13 +29,4 @@
     .endr
     .endm
 
-    /*
-     * Speculative barrier
-     * XXX: Add support for the 'sb' instruction
-     */
-    .macro sb
-    dsb nsh
-    isb
-    .endm
-
 #endif /* __ASM_ARM_MACROS_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 12:44:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 12:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.113638.216564 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYpja-0000Iy-56; Tue, 20 Apr 2021 12:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 113638.216564; Tue, 20 Apr 2021 12:44:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYpja-0000Ir-2E; Tue, 20 Apr 2021 12:44:06 +0000
Received: by outflank-mailman (input) for mailman id 113638;
 Tue, 20 Apr 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 1lYpjY-0000Im-Qz
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 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 1lYpjY-0000tB-MA
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 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 1lYpjY-0006mB-KU
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 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=Py4ZcgcPnMH3lKcMBTCt0nc5ZjX+1QQ99PhtZytxiVA=; b=6wRdCxolL4zDIGjqq6KLmSBLcY
	OjF2avKwYt8sXLDkWI1YSMU6z9d1zMr66/C6nGCNLp62FFHoSh7f78UyEkmd6A8YaqSJXNkvNLPma
	tcrlDRYAQx0KMXucqkdfBU/Wsa7ZlI7rD6lPP38T2gqyzz5MHYf481+VrSeH/IXPIO+w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: smmuv1: Revert associating the group pointer with the S2CR
Message-Id: <E1lYpjY-0006mB-KU@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 12:44:04 +0000

commit 9f6cd4983715cb31f0ea540e6bbb63f799a35d8a
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Fri Apr 16 12:25:02 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 20 13:22:54 2021 +0100

    xen/arm: smmuv1: Revert associating the group pointer with the S2CR
    
    Revert the code that associates the group pointer with the S2CR as this
    code causing an issue when the SMMU device has more than one master
    device with same stream-id. This issue is introduced by commit
    0435784cc75d ("xen/arm: smmuv1: Intelligent SMR allocation”
    
    Reverting the code will not impact to use of SMMU if two devices use the
    same stream-id but each device will be in a separate group. This is the same
    behaviour before the code is merged.
    
    Fixes: 0435784cc75d ("xen/arm: smmuv1: Intelligent SMR allocation”
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/drivers/passthrough/arm/smmu.c | 44 ++++----------------------------------
 1 file changed, 4 insertions(+), 40 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index 24ac4f3a80..1a68c2ab3b 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -597,7 +597,6 @@ enum arm_smmu_arch_version {
 };
 
 struct arm_smmu_s2cr {
-	struct iommu_group		*group;
 	int				count;
 	enum arm_smmu_s2cr_type		type;
 	enum arm_smmu_s2cr_privcfg	privcfg;
@@ -1498,7 +1497,6 @@ static int arm_smmu_master_alloc_smes(struct device *dev)
 	struct arm_smmu_master_cfg *cfg = find_smmu_master_cfg(dev);
 	struct arm_smmu_device *smmu = cfg->smmu;
 	struct arm_smmu_smr *smrs = smmu->smrs;
-	struct iommu_group *group;
 	int i, idx, ret;
 
 	spin_lock(&smmu->stream_map_lock);
@@ -1523,19 +1521,9 @@ static int arm_smmu_master_alloc_smes(struct device *dev)
 		cfg->smendx[i] = (s16)idx;
 	}
 
-	group = iommu_group_get(dev);
-	if (!group)
-		group = ERR_PTR(-ENOMEM);
-	if (IS_ERR(group)) {
-		ret = PTR_ERR(group);
-		goto out_err;
-	}
-	iommu_group_put(group);
-
 	/* It worked! Now, poke the actual hardware */
 	for_each_cfg_sme(cfg, i, idx) {
 		arm_smmu_write_sme(smmu, idx);
-		smmu->s2crs[idx].group = group;
 	}
 
 	spin_unlock(&smmu->stream_map_lock);
@@ -1966,27 +1954,6 @@ static void __arm_smmu_release_pci_iommudata(void *data)
 	kfree(data);
 }
 
-static struct iommu_group *arm_smmu_device_group(struct
-						arm_smmu_master_cfg *cfg)
-{
-	struct arm_smmu_device *smmu = cfg->smmu;
-	struct iommu_group *group = NULL;
-	int i, idx;
-
-	for_each_cfg_sme(cfg, i, idx) {
-		if (group && smmu->s2crs[idx].group &&
-		    group != smmu->s2crs[idx].group)
-			return ERR_PTR(-EINVAL);
-
-		group = smmu->s2crs[idx].group;
-	}
-
-	if (group)
-		return group;
-
-	return NULL;
-}
-
 static int arm_smmu_add_device(struct device *dev)
 {
 	struct arm_smmu_device *smmu;
@@ -2027,13 +1994,10 @@ static int arm_smmu_add_device(struct device *dev)
 		cfg->smmu = smmu;
 	}
 
-	group = arm_smmu_device_group(cfg);
-	if (!group) {
-		group = iommu_group_alloc();
-		if (IS_ERR(group)) {
-			dev_err(dev, "Failed to allocate IOMMU group\n");
-			return PTR_ERR(group);
-		}
+	group = iommu_group_alloc();
+	if (IS_ERR(group)) {
+		dev_err(dev, "Failed to allocate IOMMU group\n");
+		return PTR_ERR(group);
 	}
 
 	iommu_group_set_iommudata(group, cfg, releasefn);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 19:55:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 19:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114002.217162 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYwSg-0002Vx-HB; Tue, 20 Apr 2021 19:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114002.217162; Tue, 20 Apr 2021 19: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 1lYwSg-0002Vp-EB; Tue, 20 Apr 2021 19:55:06 +0000
Received: by outflank-mailman (input) for mailman id 114002;
 Tue, 20 Apr 2021 19: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 1lYwSe-0002Vk-It
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 19: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 1lYwSe-0000JP-B7
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 19:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYwSe-0005YV-A4
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 19: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=Fku05vw2KPKZi3P0qafWFSXqdKDcYPaFvxh7sQ856hY=; b=BJUk99pbcyjKkHjMajghvZ6Aw1
	ZZiEJjy5HKI9sO3HCurHLOXJvf603YpN+p8dnvg+gV6l2jjDt7hhHCB1yEnoWCgxb+E1LgyKRAf3U
	MsQrwEfchA3W+kfDLeWdrcAmSJx66j7Qm51RoP8hwT6FPNIXBUgtyEsYgl/vg+z13X9c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: add arm32 cross-build tests for Xen
Message-Id: <E1lYwSe-0005YV-A4@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 19:55:04 +0000

commit aaa3eafb3ba8b544d19ca41cda1477640b22b8fc
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Wed Apr 14 18:11:33 2021 -0700
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Tue Apr 20 12:54:03 2021 -0700

    automation: add arm32 cross-build tests for Xen
    
    Add a debian build container with cross-gcc for arm32 installed.
    Add build jobs to cross-compile Xen-only for arm32.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Acked-by: Wei Liu <wl@xen.org>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 .../build/debian/unstable-arm32-gcc.dockerfile     | 24 +++++++++++
 automation/gitlab-ci/build.yaml                    | 50 ++++++++++++++++++++++
 automation/scripts/build                           |  5 +++
 3 files changed, 79 insertions(+)

diff --git a/automation/build/debian/unstable-arm32-gcc.dockerfile b/automation/build/debian/unstable-arm32-gcc.dockerfile
new file mode 100644
index 0000000000..b41a57f197
--- /dev/null
+++ b/automation/build/debian/unstable-arm32-gcc.dockerfile
@@ -0,0 +1,24 @@
+FROM debian:unstable
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV USER root
+ENV CROSS_COMPILE /usr/bin/arm-linux-gnueabihf-
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        flex \
+        bison \
+        git \
+        gcc-arm-linux-gnueabihf \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
+
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index cca2c310e2..57bf2c7f80 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -117,6 +117,33 @@
   variables:
     <<: *clang
 
+.arm32-cross-build-tmpl:
+  <<: *build
+  variables:
+    XEN_TARGET_ARCH: arm32
+  tags:
+    - x86_64
+
+.arm32-cross-build:
+  extends: .arm32-cross-build-tmpl
+  variables:
+    debug: n
+
+.arm32-cross-build-debug:
+  extends: .arm32-cross-build-tmpl
+  variables:
+    debug: y
+
+.gcc-arm32-cross-build:
+  extends: .arm32-cross-build
+  variables:
+    <<: *gcc
+
+.gcc-arm32-cross-build-debug:
+  extends: .arm32-cross-build-debug
+  variables:
+    <<: *gcc
+
 .arm64-build-tmpl:
   <<: *build
   variables:
@@ -450,6 +477,29 @@ alpine-3.12-clang-debug:
   variables:
     CONTAINER: alpine:3.12
 
+# Arm32 cross-build
+
+debian-unstable-gcc-arm32:
+  extends: .gcc-arm32-cross-build
+  variables:
+    CONTAINER: debian:unstable-arm32-gcc
+
+debian-unstable-gcc-arm32-debug:
+  extends: .gcc-arm32-cross-build-debug
+  variables:
+    CONTAINER: debian:unstable-arm32-gcc
+
+debian-unstable-gcc-arm32-randconfig:
+  extends: .gcc-arm32-cross-build
+  variables:
+    CONTAINER: debian:unstable-arm32-gcc
+    RANDCONFIG: y
+
+debian-unstable-gcc-arm32-debug-randconfig:
+  extends: .gcc-arm32-cross-build-debug
+  variables:
+    CONTAINER: debian:unstable-arm32-gcc
+    RANDCONFIG: y
 
 # Arm builds
 
diff --git a/automation/scripts/build b/automation/scripts/build
index 1b752edfe6..eaf70b11d1 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -16,6 +16,11 @@ else
     make -j$(nproc) -C xen defconfig
 fi
 
+# arm32 only cross-compiles the hypervisor
+if [[ "${XEN_TARGET_ARCH}" = "arm32" ]]; then
+    hypervisor_only="y"
+fi
+
 # build up our configure options
 cfgargs=()
 cfgargs+=("--enable-docs")
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 22:11:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 22:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114030.217210 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYyaF-0006eI-S7; Tue, 20 Apr 2021 22:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114030.217210; Tue, 20 Apr 2021 22: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 1lYyaF-0006eA-P8; Tue, 20 Apr 2021 22:11:03 +0000
Received: by outflank-mailman (input) for mailman id 114030;
 Tue, 20 Apr 2021 22: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 1lYyaE-0006e5-Pp
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 22: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 1lYyaE-0002l4-La
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 22:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYyaE-0007Pq-K6
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 22: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=GIaXsBg8ON8SUVJiQtYrr3xF99CDh3hUgj177xBV44Q=; b=oww0aT7gfWl+uEoNz0L3ytZJ5m
	VxXg+so1hmNexXqrLvyp6431swBL1p74ZE5HqGbPDMDhorhLd6PzOAYzAWcuN/4nbGit0JVF1l8h0
	kT0jZfWARGWN5iojeBMl3foqEumNU+MdThfS+gA4+yc8/A31gccOmZCzPDVDnKo0Iab4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: adjust callback arrays
Message-Id: <E1lYyaE-0007Pq-K6@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 22:11:02 +0000

commit 17eaf4429cb86fe0795b38293891cc05e56ce177
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 19 15:26:22 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 19 15:26:22 2021 +0200

    x86/shadow: adjust callback arrays
    
    Some of them have entries with stale comments. Rather than correcting
    these comments, re-arrange how these arrays get populated: Use dedicated
    element initializers, serving the purpose of what the comments did so
    far. This then also makes these arrays independent of the actual
    ordering of the individual SH_type_*.
    
    While tightening respective ASSERT()s in hash_{vcpu,domain}_foreach(),
    also tighten related ones in shadow_hash_{insert,delete}().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c | 142 +++++++++++++---------------------------
 1 file changed, 44 insertions(+), 98 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index b99ca14e71..72d3816fcc 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -1565,7 +1565,7 @@ void shadow_hash_insert(struct domain *d, unsigned long n, unsigned int t,
 
     ASSERT(paging_locked_by_me(d));
     ASSERT(d->arch.paging.shadow.hash_table);
-    ASSERT(t);
+    ASSERT(t >= SH_type_min_shadow && t <= SH_type_max_shadow);
 
     sh_hash_audit(d);
 
@@ -1590,7 +1590,7 @@ void shadow_hash_delete(struct domain *d, unsigned long n, unsigned int t,
 
     ASSERT(paging_locked_by_me(d));
     ASSERT(d->arch.paging.shadow.hash_table);
-    ASSERT(t);
+    ASSERT(t >= SH_type_min_shadow && t <= SH_type_max_shadow);
 
     sh_hash_audit(d);
 
@@ -1668,7 +1668,7 @@ static void hash_vcpu_foreach(struct vcpu *v, unsigned int callback_mask,
         {
             if ( callback_mask & (1 << x->u.sh.type) )
             {
-                ASSERT(x->u.sh.type < SH_type_unused);
+                ASSERT(x->u.sh.type <= SH_type_max_shadow);
                 ASSERT(callbacks[x->u.sh.type] != NULL);
                 done = callbacks[x->u.sh.type](v, page_to_mfn(x),
                                                callback_mfn);
@@ -1715,7 +1715,7 @@ static void hash_domain_foreach(struct domain *d,
         {
             if ( callback_mask & (1 << x->u.sh.type) )
             {
-                ASSERT(x->u.sh.type < SH_type_unused);
+                ASSERT(x->u.sh.type <= SH_type_max_shadow);
                 ASSERT(callbacks[x->u.sh.type] != NULL);
                 done = callbacks[x->u.sh.type](d, page_to_mfn(x),
                                                callback_mfn);
@@ -1820,25 +1820,15 @@ int sh_remove_write_access(struct domain *d, mfn_t gmfn,
 {
     /* Dispatch table for getting per-type functions */
     static const hash_domain_callback_t callbacks[SH_type_unused] = {
-        NULL, /* none    */
 #ifdef CONFIG_HVM
-        SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 2), /* l1_32   */
-        SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 2), /* fl1_32  */
-        NULL, /* l2_32   */
-        SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 3), /* l1_pae  */
-        SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 3), /* fl1_pae */
-        NULL, /* l2_pae  */
+        [SH_type_l1_32_shadow] = SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 2),
+        [SH_type_fl1_32_shadow] = SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 2),
+        [SH_type_l1_pae_shadow] = SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 3),
+        [SH_type_fl1_pae_shadow] = SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 3),
 #endif
-        SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 4), /* l1_64   */
-        SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 4), /* fl1_64  */
-        NULL, /* l2_64   */
-        NULL, /* l2h_64  */
-        NULL, /* l3_64   */
-        NULL, /* l4_64   */
-        NULL, /* p2m     */
-        NULL  /* unused  */
+        [SH_type_l1_64_shadow] = SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 4),
+        [SH_type_fl1_64_shadow] = SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 4),
     };
-
     static const unsigned int callback_mask = SHF_L1_ANY | SHF_FL1_ANY;
     struct page_info *pg = mfn_to_page(gmfn);
 #if SHADOW_OPTIMIZATIONS & SHOPT_WRITABLE_HEURISTIC
@@ -2045,25 +2035,15 @@ int sh_remove_all_mappings(struct domain *d, mfn_t gmfn, gfn_t gfn)
 
     /* Dispatch table for getting per-type functions */
     static const hash_domain_callback_t callbacks[SH_type_unused] = {
-        NULL, /* none    */
 #ifdef CONFIG_HVM
-        SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 2), /* l1_32   */
-        SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 2), /* fl1_32  */
-        NULL, /* l2_32   */
-        SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3), /* l1_pae  */
-        SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3), /* fl1_pae */
-        NULL, /* l2_pae  */
+        [SH_type_l1_32_shadow] = SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 2),
+        [SH_type_fl1_32_shadow] = SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 2),
+        [SH_type_l1_pae_shadow] = SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3),
+        [SH_type_fl1_pae_shadow] = SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3),
 #endif
-        SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 4), /* l1_64   */
-        SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 4), /* fl1_64  */
-        NULL, /* l2_64   */
-        NULL, /* l2h_64  */
-        NULL, /* l3_64   */
-        NULL, /* l4_64   */
-        NULL, /* p2m     */
-        NULL  /* unused  */
+        [SH_type_l1_64_shadow] = SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 4),
+        [SH_type_fl1_64_shadow] = SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 4),
     };
-
     static const unsigned int callback_mask = SHF_L1_ANY | SHF_FL1_ANY;
 
     perfc_incr(shadow_mappings);
@@ -2190,44 +2170,26 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
     /* Dispatch table for getting per-type functions: each level must
      * be called with the function to remove a lower-level shadow. */
     static const hash_domain_callback_t callbacks[SH_type_unused] = {
-        NULL, /* none    */
 #ifdef CONFIG_HVM
-        NULL, /* l1_32   */
-        NULL, /* fl1_32  */
-        SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 2), /* l2_32   */
-        NULL, /* l1_pae  */
-        NULL, /* fl1_pae */
-        SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 3), /* l2_pae  */
+        [SH_type_l2_32_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 2),
+        [SH_type_l2_pae_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 3),
 #endif
-        NULL, /* l1_64   */
-        NULL, /* fl1_64  */
-        SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 4), /* l2_64   */
-        SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 4), /* l2h_64  */
-        SHADOW_INTERNAL_NAME(sh_remove_l2_shadow, 4), /* l3_64   */
-        SHADOW_INTERNAL_NAME(sh_remove_l3_shadow, 4), /* l4_64   */
-        NULL, /* p2m     */
-        NULL  /* unused  */
+        [SH_type_l2_64_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 4),
+        [SH_type_l2h_64_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 4),
+        [SH_type_l3_64_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l2_shadow, 4),
+        [SH_type_l4_64_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l3_shadow, 4),
     };
 
     /* Another lookup table, for choosing which mask to use */
     static const unsigned int masks[SH_type_unused] = {
-        0, /* none    */
 #ifdef CONFIG_HVM
-        SHF_L2_32, /* l1_32   */
-        0, /* fl1_32  */
-        0, /* l2_32   */
-        SHF_L2_PAE, /* l1_pae  */
-        0, /* fl1_pae */
-        0, /* l2_pae  */
+        [SH_type_l1_32_shadow] = SHF_L2_32,
+        [SH_type_l1_pae_shadow] = SHF_L2_PAE,
 #endif
-        SHF_L2H_64 | SHF_L2_64, /* l1_64   */
-        0, /* fl1_64  */
-        SHF_L3_64, /* l2_64   */
-        SHF_L3_64, /* l2h_64  */
-        SHF_L4_64, /* l3_64   */
-        0, /* l4_64   */
-        0, /* p2m     */
-        0  /* unused  */
+        [SH_type_l1_64_shadow] = SHF_L2H_64 | SHF_L2_64,
+        [SH_type_l2_64_shadow] = SHF_L3_64,
+        [SH_type_l2h_64_shadow] = SHF_L3_64,
+        [SH_type_l3_64_shadow] = SHF_L4_64,
     };
 
     ASSERT(!(all && fast));
@@ -2357,23 +2319,7 @@ static int sh_clear_up_pointer(struct vcpu *v, mfn_t smfn, mfn_t unused)
 void sh_reset_l3_up_pointers(struct vcpu *v)
 {
     static const hash_vcpu_callback_t callbacks[SH_type_unused] = {
-        NULL, /* none    */
-#ifdef CONFIG_HVM
-        NULL, /* l1_32   */
-        NULL, /* fl1_32  */
-        NULL, /* l2_32   */
-        NULL, /* l1_pae  */
-        NULL, /* fl1_pae */
-        NULL, /* l2_pae  */
-#endif
-        NULL, /* l1_64   */
-        NULL, /* fl1_64  */
-        NULL, /* l2_64   */
-        NULL, /* l2h_64  */
-        sh_clear_up_pointer, /* l3_64   */
-        NULL, /* l4_64   */
-        NULL, /* p2m     */
-        NULL  /* unused  */
+        [SH_type_l3_64_shadow] = sh_clear_up_pointer,
     };
     static const unsigned int callback_mask = SHF_L3_64;
 
@@ -3382,24 +3328,22 @@ void shadow_audit_tables(struct vcpu *v)
 {
     /* Dispatch table for getting per-type functions */
     static const hash_vcpu_callback_t callbacks[SH_type_unused] = {
-        NULL, /* none    */
 #if SHADOW_AUDIT & (SHADOW_AUDIT_ENTRIES | SHADOW_AUDIT_ENTRIES_FULL)
 # ifdef CONFIG_HVM
-        SHADOW_INTERNAL_NAME(sh_audit_l1_table, 2),  /* l1_32   */
-        SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 2), /* fl1_32  */
-        SHADOW_INTERNAL_NAME(sh_audit_l2_table, 2),  /* l2_32   */
-        SHADOW_INTERNAL_NAME(sh_audit_l1_table, 3),  /* l1_pae  */
-        SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 3), /* fl1_pae */
-        SHADOW_INTERNAL_NAME(sh_audit_l2_table, 3),  /* l2_pae  */
+        [SH_type_l1_32_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l1_table, 2),
+        [SH_type_fl1_32_shadow] = SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 2),
+        [SH_type_l2_32_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l2_table, 2),
+        [SH_type_l1_pae_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l1_table, 3),
+        [SH_type_fl1_pae_shadow] = SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 3),
+        [SH_type_l2_pae_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l2_table, 3),
 # endif
-        SHADOW_INTERNAL_NAME(sh_audit_l1_table, 4),  /* l1_64   */
-        SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 4), /* fl1_64  */
-        SHADOW_INTERNAL_NAME(sh_audit_l2_table, 4),  /* l2_64   */
-        SHADOW_INTERNAL_NAME(sh_audit_l2_table, 4),  /* l2h_64   */
-        SHADOW_INTERNAL_NAME(sh_audit_l3_table, 4),  /* l3_64   */
-        SHADOW_INTERNAL_NAME(sh_audit_l4_table, 4),  /* l4_64   */
+        [SH_type_l1_64_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l1_table, 4),
+        [SH_type_fl1_64_shadow] = SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 4),
+        [SH_type_l2_64_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l2_table, 4),
+        [SH_type_l2h_64_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l2_table, 4),
+        [SH_type_l3_64_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l3_table, 4),
+        [SH_type_l4_64_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l4_table, 4),
 #endif
-        NULL  /* All the rest */
     };
     unsigned int mask;
 
@@ -3427,7 +3371,9 @@ void shadow_audit_tables(struct vcpu *v)
         }
     }
 
-    HASH_CALLBACKS_CHECK(SHF_page_type_mask);
+    HASH_CALLBACKS_CHECK(SHADOW_AUDIT & (SHADOW_AUDIT_ENTRIES |
+                                         SHADOW_AUDIT_ENTRIES_FULL)
+                         ? SHF_page_type_mask : 0);
     hash_vcpu_foreach(v, mask, callbacks, INVALID_MFN);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 22:11:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 22:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114031.217214 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYyaP-0006fB-Tl; Tue, 20 Apr 2021 22:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114031.217214; Tue, 20 Apr 2021 22: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 1lYyaP-0006f4-Qn; Tue, 20 Apr 2021 22:11:13 +0000
Received: by outflank-mailman (input) for mailman id 114031;
 Tue, 20 Apr 2021 22: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 1lYyaO-0006ex-PV
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 22: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 1lYyaO-0002le-Oi
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 22:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYyaO-0007QO-Nx
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 22: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=n1erHsCexJETZZCJX7gEyUtccAeWSOc60LqVr2LrJ/Y=; b=4nAWDOCctPvu9+5Qdw8ya3vJNN
	GgG4XmE/s/jqnOAhhsmEjAsW18JBCfVmsMCNqC5BlKVsjRsAUQ43bh22uC0sggqjJDNVHOGm2v83O
	7+9Ki4tmYNzzPHtVs2cObSw6hstRnZwe5ONKEidlNBG3NMEGNTyGxh30D0bLNz9jdIJ0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: mem-access is HVM-only
Message-Id: <E1lYyaO-0007QO-Nx@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 22:11:12 +0000

commit 99192701e34e2e82276289efe4fd450fb91a703b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 19 15:28:00 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 19 15:28:00 2021 +0200

    x86: mem-access is HVM-only
    
    By excluding the file from being built for !HVM, #ifdef-ary can be
    removed from it.
    
    The new HVM dependency on the Kconfig option is benign for Arm.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
    Reviewed-by: Alexandru Isaila <aisaila@bitdefender.com>
---
 xen/arch/x86/Kconfig         |  2 +-
 xen/arch/x86/mm/mem_access.c | 20 --------------------
 xen/arch/x86/vm_event.c      |  2 ++
 xen/common/Kconfig           |  1 +
 4 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 57776d5106..db0de0a9ec 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -16,7 +16,6 @@ config X86
 	select HAS_FAST_MULTIPLY
 	select HAS_IOPORTS
 	select HAS_KEXEC
-	select MEM_ACCESS_ALWAYS_ON
 	select HAS_MEM_PAGING
 	select HAS_NS16550
 	select HAS_PASSTHROUGH
@@ -95,6 +94,7 @@ config HVM
 	def_bool !PV_SHIM_EXCLUSIVE
 	select COMPAT
 	select IOREQ_SERVER
+	select MEM_ACCESS_ALWAYS_ON
 	prompt "HVM support"
 	---help---
 	  Interfaces to support HVM domains.  HVM domains require hardware
diff --git a/xen/arch/x86/mm/mem_access.c b/xen/arch/x86/mm/mem_access.c
index ede774fb50..7750b81cd4 100644
--- a/xen/arch/x86/mm/mem_access.c
+++ b/xen/arch/x86/mm/mem_access.c
@@ -139,7 +139,6 @@ bool p2m_mem_access_emulate_check(struct vcpu *v,
     return violation;
 }
 
-#ifdef CONFIG_HVM
 bool p2m_mem_access_check(paddr_t gpa, unsigned long gla,
                           struct npfec npfec,
                           vm_event_request_t **req_ptr)
@@ -282,7 +281,6 @@ int p2m_set_altp2m_mem_access(struct domain *d, struct p2m_domain *hp2m,
      */
     return ap2m->set_entry(ap2m, gfn, mfn, PAGE_ORDER_4K, t, a, -1);
 }
-#endif
 
 static int set_mem_access(struct domain *d, struct p2m_domain *p2m,
                           struct p2m_domain *ap2m, p2m_access_t a,
@@ -290,7 +288,6 @@ static int set_mem_access(struct domain *d, struct p2m_domain *p2m,
 {
     int rc = 0;
 
-#ifdef CONFIG_HVM
     if ( ap2m )
     {
         rc = p2m_set_altp2m_mem_access(d, p2m, ap2m, a, gfn);
@@ -299,9 +296,6 @@ static int set_mem_access(struct domain *d, struct p2m_domain *p2m,
             rc = 0;
     }
     else
-#else
-    ASSERT(!ap2m);
-#endif
     {
         p2m_access_t _a;
         p2m_type_t t;
@@ -362,7 +356,6 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr,
     long rc = 0;
 
     /* altp2m view 0 is treated as the hostp2m */
-#ifdef CONFIG_HVM
     if ( altp2m_idx )
     {
         if ( altp2m_idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) ||
@@ -372,9 +365,6 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr,
 
         ap2m = array_access_nospec(d->arch.altp2m_p2m, altp2m_idx);
     }
-#else
-    ASSERT(!altp2m_idx);
-#endif
 
     if ( !xenmem_access_to_p2m_access(p2m, access, &a) )
         return -EINVAL;
@@ -422,7 +412,6 @@ long p2m_set_mem_access_multi(struct domain *d,
     long rc = 0;
 
     /* altp2m view 0 is treated as the hostp2m */
-#ifdef CONFIG_HVM
     if ( altp2m_idx )
     {
         if ( altp2m_idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) ||
@@ -432,9 +421,6 @@ long p2m_set_mem_access_multi(struct domain *d,
 
         ap2m = array_access_nospec(d->arch.altp2m_p2m, altp2m_idx);
     }
-#else
-    ASSERT(!altp2m_idx);
-#endif
 
     p2m_lock(p2m);
     if ( ap2m )
@@ -484,7 +470,6 @@ int p2m_get_mem_access(struct domain *d, gfn_t gfn, xenmem_access_t *access,
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
 
-#ifdef CONFIG_HVM
     if ( !altp2m_active(d) )
     {
         if ( altp2m_idx )
@@ -499,9 +484,6 @@ int p2m_get_mem_access(struct domain *d, gfn_t gfn, xenmem_access_t *access,
 
         p2m = array_access_nospec(d->arch.altp2m_p2m, altp2m_idx);
     }
-#else
-    ASSERT(!altp2m_idx);
-#endif
 
     return _p2m_get_mem_access(p2m, gfn, access);
 }
@@ -512,7 +494,6 @@ void arch_p2m_set_access_required(struct domain *d, bool access_required)
 
     p2m_get_hostp2m(d)->access_required = access_required;
 
-#ifdef CONFIG_HVM
     if ( altp2m_active(d) )
     {
         unsigned int i;
@@ -524,7 +505,6 @@ void arch_p2m_set_access_required(struct domain *d, bool access_required)
                 p2m->access_required = access_required;
         }
     }
-#endif
 }
 
 bool p2m_mem_access_sanity_check(const struct domain *d)
diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c
index 8f73a73e2e..ffcc64c40b 100644
--- a/xen/arch/x86/vm_event.c
+++ b/xen/arch/x86/vm_event.c
@@ -265,6 +265,7 @@ void vm_event_emulate_check(struct vcpu *v, vm_event_response_t *rsp)
         return;
     }
 
+#ifdef CONFIG_HVM
     switch ( rsp->reason )
     {
     case VM_EVENT_REASON_MEM_ACCESS:
@@ -298,6 +299,7 @@ void vm_event_emulate_check(struct vcpu *v, vm_event_response_t *rsp)
     default:
         break;
     };
+#endif
 }
 
 void vm_event_reset_vmtrace(struct vcpu *v)
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 3064bf6b89..b6c9827a7b 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -61,6 +61,7 @@ config MEM_ACCESS_ALWAYS_ON
 config MEM_ACCESS
 	def_bool MEM_ACCESS_ALWAYS_ON
 	prompt "Memory Access and VM events" if !MEM_ACCESS_ALWAYS_ON
+	depends on HVM
 	---help---
 
 	  Framework to configure memory access types for guests and receive
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 22:11:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 22:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114032.217218 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYyaa-0006gj-0r; Tue, 20 Apr 2021 22:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114032.217218; Tue, 20 Apr 2021 22: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 1lYyaZ-0006gb-UC; Tue, 20 Apr 2021 22:11:23 +0000
Received: by outflank-mailman (input) for mailman id 114032;
 Tue, 20 Apr 2021 22: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 1lYyaY-0006gS-TR
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 22: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 1lYyaY-0002ls-SG
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 22:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYyaY-0007RA-R0
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 22: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=CvJG4mHPANr/qeZEnZ4UJ2FofTrXLiUgtBhPkCa4Ze8=; b=PcHo7VXtd9DjGGUrKBRSvfxyNH
	K1MGrZJdE3rEtkBOfJU7NVhpHBi64ROmjQmigRewRN2svyM3KVE/2rjltRWtS9EBkzUUdrPiOR/3d
	aw781Z5nL2G4FOqDn3hnCl24o0MzB4/oIDUSPYy3e0tB/j46so+jL+HNUnEE91gBtSos=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: use is_pv_64bit_domain() to avoid double evaluate_nospec()
Message-Id: <E1lYyaY-0007RA-R0@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 22:11:22 +0000

commit a49d1087e2c0cd940c9b93ded29c576bbae292f5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 19 15:29:06 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 19 15:29:06 2021 +0200

    x86: use is_pv_64bit_domain() to avoid double evaluate_nospec()
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/domain.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 40e8ce7544..4dc27f798e 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1115,7 +1115,7 @@ int arch_set_info_guest(
           * update_cr3(), sh_update_cr3(), sh_walk_guest_tables(), and
           * shadow_one_bit_disable() for why that is.
           */
-         !is_hvm_domain(d) && !is_pv_32bit_domain(d) )
+         is_pv_64bit_domain(d) )
         v->arch.flags &= ~TF_kernel_mode;
 
     vcpu_setup_fpu(v, v->arch.xsave_area,
@@ -1267,7 +1267,7 @@ int arch_set_info_guest(
          * correct initial RO_MPT_VIRT_{START,END} L4 entry).
          */
         if ( d != current->domain && !VM_ASSIST(d, m2p_strict) &&
-             is_pv_domain(d) && !is_pv_32bit_domain(d) &&
+             is_pv_64bit_domain(d) &&
              test_bit(VMASST_TYPE_m2p_strict, &c.nat->vm_assist) &&
              atomic_read(&d->arch.pv.nr_l4_pages) )
         {
@@ -2002,8 +2002,7 @@ static void __context_switch(void)
 
 #if defined(CONFIG_PV) && defined(CONFIG_HVM)
     /* Prefetch the VMCB if we expect to use it later in the context switch */
-    if ( cpu_has_svm && is_pv_domain(nd) && !is_pv_32bit_domain(nd) &&
-         !is_idle_domain(nd) )
+    if ( cpu_has_svm && is_pv_64bit_domain(nd) && !is_idle_domain(nd) )
         svm_load_segs_prefetch();
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Apr 20 22:11:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Apr 2021 22:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114033.217223 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYyak-0006iG-2T; Tue, 20 Apr 2021 22:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114033.217223; Tue, 20 Apr 2021 22:11:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lYyaj-0006i8-Vs; Tue, 20 Apr 2021 22:11:33 +0000
Received: by outflank-mailman (input) for mailman id 114033;
 Tue, 20 Apr 2021 22:11: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 1lYyaj-0006hw-07
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 22:11: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 1lYyai-0002m1-VG
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 22:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lYyai-0007Rm-UP
 for xen-changelog@lists.xenproject.org; Tue, 20 Apr 2021 22: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=+FjTCC/Agd/9YdpmJwp7YwknoOWukX1Vt1biM3RrfLs=; b=twgMu6du0GZGkNh0caNyXnfdSj
	w5tLzNV6HlPMnlGg3QUhPUEFJ5dlagIztAIixy9X6ECyLx0H+XaLq0iWhFkePDTTdxdIUYRRr8ors
	P5HaNTpy7WJBAQdLzZL2uky1yvgq3W3L3ri9JH4B/30APVACzPwtU2uWlh42DJb9kdOg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/CPUID: add further "fast repeated string ops" feature flags
Message-Id: <E1lYyai-0007Rm-UP@xenbits.xenproject.org>
Date: Tue, 20 Apr 2021 22:11:32 +0000

commit a8c532be6a44c7faa54ac777a717f4aa65e3a806
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 19 15:29:39 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 19 15:29:39 2021 +0200

    x86/CPUID: add further "fast repeated string ops" feature flags
    
    Like ERMS this can always be exposed to guests, but I guess once we
    introduce full validation we want to make sure we don't reject incoming
    policies with any of these set when in the raw/host policies they're
    clear.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/light/libxl_cpuid.c              | 4 ++++
 tools/misc/xen-cpuid.c                      | 3 +++
 xen/include/public/arch-x86/cpufeatureset.h | 4 ++++
 3 files changed, 11 insertions(+)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index aee28b0430..943a343239 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -215,6 +215,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
 
         {"avx512-4vnniw",0x00000007,  0, CPUID_REG_EDX,  2,  1},
         {"avx512-4fmaps",0x00000007,  0, CPUID_REG_EDX,  3,  1},
+        {"fsrm",         0x00000007,  0, CPUID_REG_EDX,  4,  1},
         {"avx512-vp2intersect",0x00000007,0,CPUID_REG_EDX,8, 1},
         {"srbds-ctrl",   0x00000007,  0, CPUID_REG_EDX,  9,  1},
         {"md-clear",     0x00000007,  0, CPUID_REG_EDX, 10,  1},
@@ -229,6 +230,9 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
 
         {"avx-vnni",     0x00000007,  1, CPUID_REG_EAX,  4,  1},
         {"avx512-bf16",  0x00000007,  1, CPUID_REG_EAX,  5,  1},
+        {"fzrm",         0x00000007,  1, CPUID_REG_EAX, 10,  1},
+        {"fsrs",         0x00000007,  1, CPUID_REG_EAX, 11,  1},
+        {"fsrcs",        0x00000007,  1, CPUID_REG_EAX, 12,  1},
 
         {"lahfsahf",     0x80000001, NA, CPUID_REG_ECX,  0,  1},
         {"cmplegacy",    0x80000001, NA, CPUID_REG_ECX,  1,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 628e8f5aa2..b4229d1126 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -177,6 +177,9 @@ static const char *const str_7d0[32] =
 static const char *const str_7a1[32] =
 {
     [ 4] = "avx-vnni",      [ 5] = "avx512-bf16",
+
+    [10] = "fzrm",          [11] = "fsrs",
+    [12] = "fsrcs",
 };
 
 static const struct {
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 42bc8d4279..7cdd08d551 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -261,6 +261,7 @@ XEN_CPUFEATURE(AMD_PPIN,      8*32+23) /*   Protected Processor Inventory Number
 /* Intel-defined CPU features, CPUID level 0x00000007:0.edx, word 9 */
 XEN_CPUFEATURE(AVX512_4VNNIW, 9*32+ 2) /*A  AVX512 Neural Network Instructions */
 XEN_CPUFEATURE(AVX512_4FMAPS, 9*32+ 3) /*A  AVX512 Multiply Accumulation Single Precision */
+XEN_CPUFEATURE(FSRM,          9*32+ 4) /*A  Fast Short REP MOVS */
 XEN_CPUFEATURE(AVX512_VP2INTERSECT, 9*32+8) /*a  VP2INTERSECT{D,Q} insns */
 XEN_CPUFEATURE(SRBDS_CTRL,    9*32+ 9) /*   MSR_MCU_OPT_CTRL and RNGDS_MITG_DIS. */
 XEN_CPUFEATURE(MD_CLEAR,      9*32+10) /*A  VERW clears microarchitectural buffers */
@@ -277,6 +278,9 @@ XEN_CPUFEATURE(SSBD,          9*32+31) /*A  MSR_SPEC_CTRL.SSBD available */
 /* Intel-defined CPU features, CPUID level 0x00000007:1.eax, word 10 */
 XEN_CPUFEATURE(AVX_VNNI,     10*32+ 4) /*A  AVX-VNNI Instructions */
 XEN_CPUFEATURE(AVX512_BF16,  10*32+ 5) /*A  AVX512 BFloat16 Instructions */
+XEN_CPUFEATURE(FZRM,         10*32+10) /*A  Fast Zero-length REP MOVSB */
+XEN_CPUFEATURE(FSRS,         10*32+11) /*A  Fast Short REP STOSB */
+XEN_CPUFEATURE(FSRCS,        10*32+12) /*A  Fast Short REP CMPSB/SCASB */
 
 #endif /* XEN_CPUFEATURE */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 04:44:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 04:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114098.217287 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ4ia-00062o-9E; Wed, 21 Apr 2021 04:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114098.217287; Wed, 21 Apr 2021 04: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 1lZ4ia-00062f-6E; Wed, 21 Apr 2021 04:44:04 +0000
Received: by outflank-mailman (input) for mailman id 114098;
 Wed, 21 Apr 2021 04:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ4iY-00062K-Kw
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ4iY-0007EN-GR
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ4iY-0001d1-EM
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3gTzAQzzliuaOP5+U79DVcwj6t8bys4OYGJozX3LXMY=; b=4oYBuban5c9f6GOjg23ygFxYkF
	BoVQXprs2cwKIR6utLPtc4OkSkzErQFvWrQF5w1nuDgKffQ+NUWqYM8QW5zeXcQxDvpJ1BpUfgKm5
	mPaeTLO7rYs/uOBDyhLFfhSO3dnboYToXdQFgg60gpwLzIqNYv00zQMYwAsf6nZdOhPI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] VT-d: leave FECTL write to vtd_resume()
Message-Id: <E1lZ4iY-0001d1-EM@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 04:44:02 +0000

commit baa6957c3a21283af1e2c3161ec8a2fe7970a89f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 11:54:34 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:54:34 2021 +0200

    VT-d: leave FECTL write to vtd_resume()
    
    We shouldn't blindly unmask the interrupt when resuming. vtd_resume()
    will restore the intended state.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 0d597e7bd1bd8a57619690d457f79769777a5834
    master date: 2021-03-30 14:39:23 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 44e407d19f..058f55f9a0 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2092,7 +2092,7 @@ static int adjust_vtd_irq_affinities(void)
 }
 __initcall(adjust_vtd_irq_affinities);
 
-static int __must_check init_vtd_hw(void)
+static int __must_check init_vtd_hw(bool resume)
 {
     struct acpi_drhd_unit *drhd;
     struct vtd_iommu *iommu;
@@ -2121,6 +2121,10 @@ static int __must_check init_vtd_hw(void)
             disable_qinval(iommu);
         }
 
+        if ( resume )
+            /* FECTL write done by vtd_resume(). */
+            continue;
+
         spin_lock_irqsave(&iommu->register_lock, flags);
         sts = dmar_readl(iommu->reg, DMAR_FECTL_REG);
         sts &= ~DMA_FECTL_IM;
@@ -2320,7 +2324,7 @@ static int __init vtd_setup(void)
     P(iommu_hap_pt_share, "Shared EPT tables");
 #undef P
 
-    ret = init_vtd_hw();
+    ret = init_vtd_hw(false);
     if ( ret )
         goto error;
 
@@ -2590,7 +2594,7 @@ static void vtd_resume(void)
     if ( !iommu_enabled )
         return;
 
-    if ( init_vtd_hw() != 0  && force_iommu )
+    if ( init_vtd_hw(true) != 0 && force_iommu )
          panic("IOMMU setup failed, crash Xen for security purpose\n");
 
     for_each_drhd_unit ( drhd )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 04:44:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 04:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114099.217290 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ4ik-000650-Af; Wed, 21 Apr 2021 04:44:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114099.217290; Wed, 21 Apr 2021 04:44:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ4ik-00064s-7i; Wed, 21 Apr 2021 04:44:14 +0000
Received: by outflank-mailman (input) for mailman id 114099;
 Wed, 21 Apr 2021 04:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ4ii-00064n-M1
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ4ii-0007Eg-KQ
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ4ii-0001dd-Iu
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CmwKpwWMXMvf4iQn6ZDRXYiuadzng1OjRkYWPc/DisU=; b=ZUZhMCLzvqFt68hvS8lt7Sd8kO
	GZRY1FI7vjd5S3eLsZNjwTSEFKNlLwz9vdFHZnKftVSpgyv0y8zvmTs+fxuVga7uu9PiwqF9RTD3j
	IWbWWo7DnjZnY4imhcOkueHlLlrQEr+PfRmQmDu1QLXrYGBuib2QuZrDPXyPPrDJ9GC4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] VT-d: re-order register restoring in vtd_resume()
Message-Id: <E1lZ4ii-0001dd-Iu@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 04:44:12 +0000

commit 92dd3b56a7b5b284cf4f0c82945c35cf8ee54cc9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 11:55:19 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:55:19 2021 +0200

    VT-d: re-order register restoring in vtd_resume()
    
    For one FECTL must be written last - the interrupt shouldn't be unmasked
    without first having written the data and address needed to actually
    deliver it. In the common case (when dma_msi_set_affinity() doesn't end
    up bailing early) this happens from init_vtd_hw(), but for this to
    actually have the intended effect we shouldn't subsequently overwrite
    what was written there - this is only benign when old and new settings
    match. Instead we should restore the registers ahead of calling
    init_vtd_hw(), just for the unlikely case of dma_msi_set_affinity()
    bailing early.
    
    In the moved code drop some stray casts as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 95e07f8c0e64889ee56015c7f99bdf5309e9e8ef
    master date: 2021-03-30 14:39:54 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 058f55f9a0..114f9512e9 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2594,6 +2594,21 @@ static void vtd_resume(void)
     if ( !iommu_enabled )
         return;
 
+    for_each_drhd_unit ( drhd )
+    {
+        iommu = drhd->iommu;
+        i = iommu->index;
+
+        spin_lock_irqsave(&iommu->register_lock, flags);
+        dmar_writel(iommu->reg, DMAR_FEDATA_REG,
+                    iommu_state[i][DMAR_FEDATA_REG]);
+        dmar_writel(iommu->reg, DMAR_FEADDR_REG,
+                    iommu_state[i][DMAR_FEADDR_REG]);
+        dmar_writel(iommu->reg, DMAR_FEUADDR_REG,
+                    iommu_state[i][DMAR_FEUADDR_REG]);
+        spin_unlock_irqrestore(&iommu->register_lock, flags);
+    }
+
     if ( init_vtd_hw(true) != 0 && force_iommu )
          panic("IOMMU setup failed, crash Xen for security purpose\n");
 
@@ -2605,12 +2620,6 @@ static void vtd_resume(void)
         spin_lock_irqsave(&iommu->register_lock, flags);
         dmar_writel(iommu->reg, DMAR_FECTL_REG,
                     (u32) iommu_state[i][DMAR_FECTL_REG]);
-        dmar_writel(iommu->reg, DMAR_FEDATA_REG,
-                    (u32) iommu_state[i][DMAR_FEDATA_REG]);
-        dmar_writel(iommu->reg, DMAR_FEADDR_REG,
-                    (u32) iommu_state[i][DMAR_FEADDR_REG]);
-        dmar_writel(iommu->reg, DMAR_FEUADDR_REG,
-                    (u32) iommu_state[i][DMAR_FEUADDR_REG]);
         spin_unlock_irqrestore(&iommu->register_lock, flags);
 
         iommu_enable_translation(drhd);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 04:44:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 04:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114100.217295 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ4iu-00066H-Cd; Wed, 21 Apr 2021 04:44:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114100.217295; Wed, 21 Apr 2021 04:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ4iu-000669-9E; Wed, 21 Apr 2021 04:44:24 +0000
Received: by outflank-mailman (input) for mailman id 114100;
 Wed, 21 Apr 2021 04:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ4is-00065v-Py
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ4is-0007Em-P5
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ4is-0001eU-Mk
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JPj1/gVh8WzActJ17TsfyYX932txLbp14qgUPJ/XsKA=; b=jw0M5QBhS4sgJIX7M7Fe+tyN94
	ulfiNBe3dNOrj+mSjUQcsKh+33UBkWbMNJQmw4RRa8+T4SJiELucaC8m8NQ0ekTAibZUYcFe/KkzC
	z0+ccSP48+3xgxvd+0C8eKsAs+0r/ylEVDrry/MBAtzB+SAtOtYI/SH+1PGA1LE6KpBg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] VT-d: restore flush hooks when disabling qinval
Message-Id: <E1lZ4is-0001eU-Mk@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 04:44:22 +0000

commit bb071ce80d5536a5ae566d33d69a81cc62fdc1b3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 11:55:47 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:55:47 2021 +0200

    VT-d: restore flush hooks when disabling qinval
    
    Leaving the hooks untouched is at best a latent risk: There may well be
    cases where some flush is needed, which then needs carrying out the
    "register" way.
    
    Switch from u<N> to uint<N>_t while needing to touch the function
    headers anyway.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 9c39dba2b179c0f4c42c98e97ea0878119718530
    master date: 2021-03-30 14:40:24 +0200
---
 xen/drivers/passthrough/vtd/extern.h | 10 ++++++++++
 xen/drivers/passthrough/vtd/iommu.c  | 19 ++++++++-----------
 xen/drivers/passthrough/vtd/qinval.c |  3 +++
 3 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 19a908ab4f..156177bb3f 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -49,6 +49,16 @@ int iommu_flush_iec_global(struct vtd_iommu *iommu);
 int iommu_flush_iec_index(struct vtd_iommu *iommu, u8 im, u16 iidx);
 void clear_fault_bits(struct vtd_iommu *iommu);
 
+int __must_check vtd_flush_context_reg(struct vtd_iommu *iommu, uint16_t did,
+                                       uint16_t source_id,
+                                       uint8_t function_mask, uint64_t type,
+                                       bool flush_non_present_entry);
+int __must_check vtd_flush_iotlb_reg(struct vtd_iommu *iommu, uint16_t did,
+                                     uint64_t addr, unsigned int size_order,
+                                     uint64_t type,
+                                     bool flush_non_present_entry,
+                                     bool flush_dev_iotlb);
+
 struct vtd_iommu *ioapic_to_iommu(unsigned int apic_id);
 struct vtd_iommu *hpet_to_iommu(unsigned int hpet_id);
 struct acpi_drhd_unit *ioapic_to_drhd(unsigned int apic_id);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 114f9512e9..6428c8fe3e 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -380,10 +380,9 @@ static void iommu_flush_write_buffer(struct vtd_iommu *iommu)
 }
 
 /* return value determine if we need a write buffer flush */
-static int __must_check flush_context_reg(struct vtd_iommu *iommu, u16 did,
-                                          u16 source_id, u8 function_mask,
-                                          u64 type,
-                                          bool flush_non_present_entry)
+int vtd_flush_context_reg(struct vtd_iommu *iommu, uint16_t did,
+                          uint16_t source_id, uint8_t function_mask,
+                          uint64_t type, bool flush_non_present_entry)
 {
     u64 val = 0;
     unsigned long flags;
@@ -449,11 +448,9 @@ static int __must_check iommu_flush_context_device(struct vtd_iommu *iommu,
 }
 
 /* return value determine if we need a write buffer flush */
-static int __must_check flush_iotlb_reg(struct vtd_iommu *iommu, u16 did,
-                                        u64 addr,
-                                        unsigned int size_order, u64 type,
-                                        bool flush_non_present_entry,
-                                        bool flush_dev_iotlb)
+int vtd_flush_iotlb_reg(struct vtd_iommu *iommu, uint16_t did, uint64_t addr,
+                        unsigned int size_order, uint64_t type,
+                        bool flush_non_present_entry, bool flush_dev_iotlb)
 {
     int tlb_offset = ecap_iotlb_offset(iommu->ecap);
     u64 val = 0;
@@ -2144,8 +2141,8 @@ static int __must_check init_vtd_hw(bool resume)
          */
         if ( enable_qinval(iommu) != 0 )
         {
-            iommu->flush.context = flush_context_reg;
-            iommu->flush.iotlb   = flush_iotlb_reg;
+            iommu->flush.context = vtd_flush_context_reg;
+            iommu->flush.iotlb   = vtd_flush_iotlb_reg;
         }
     }
 
diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c
index 39b7abd009..764ef9f0fc 100644
--- a/xen/drivers/passthrough/vtd/qinval.c
+++ b/xen/drivers/passthrough/vtd/qinval.c
@@ -462,4 +462,7 @@ void disable_qinval(struct vtd_iommu *iommu)
                   !(sts & DMA_GSTS_QIES), sts);
 out:
     spin_unlock_irqrestore(&iommu->register_lock, flags);
+
+    iommu->flush.context = vtd_flush_context_reg;
+    iommu->flush.iotlb   = vtd_flush_iotlb_reg;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 04:44:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 04:44:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114101.217298 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ4j4-00067n-ET; Wed, 21 Apr 2021 04:44:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114101.217298; Wed, 21 Apr 2021 04:44:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ4j4-00067c-Ap; Wed, 21 Apr 2021 04:44:34 +0000
Received: by outflank-mailman (input) for mailman id 114101;
 Wed, 21 Apr 2021 04:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ4j2-00067R-Sv
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ4j2-0007Et-S4
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ4j2-0001fF-RI
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6ixuBPEY+NOxnOZQBzw32h4GiiESFxS2GFi90wZszyk=; b=FY4IH+OWFi9GOqMaMdf5Kv1vuG
	jVxmC/dLss/b6hfdRMC+nMQJZgMF9SsptcttnZ2qY8Yh5JcPfOvcrpRLjdW7ING/V+wwhGFO8rOQa
	Dc8i5VgGIL+O9kW7cFk8jQjIIxozdq2Q+ODmM+3TJ467txMdRR/2EdYbk7MbG5CIZSqA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] fix for_each_cpu() again for NR_CPUS=1
Message-Id: <E1lZ4j2-0001fF-RI@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 04:44:32 +0000

commit 5788a7e61145d0ad4f93d3ff22f7d6b5dfef7478
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 11:56:11 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:56:11 2021 +0200

    fix for_each_cpu() again for NR_CPUS=1
    
    Unfortunately aa50f45332f1 ("xen: fix for_each_cpu when NR_CPUS=1") has
    caused quite a bit of fallout with gcc10, e.g. (there are at least two
    more similar ones, and I didn't bother trying to find them all):
    
    In file included from .../xen/include/xen/config.h:13,
                     from <command-line>:
    core_parking.c: In function ‘core_parking_power’:
    .../xen/include/asm/percpu.h:12:51: error: array subscript 1 is above array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds]
       12 |     (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
    .../xen/include/xen/compiler.h:141:29: note: in definition of macro ‘RELOC_HIDE’
      141 |     (typeof(ptr)) (__ptr + (off)); })
          |                             ^~~
    core_parking.c:133:39: note: in expansion of macro ‘per_cpu’
      133 |             core_tmp = cpumask_weight(per_cpu(cpu_core_mask, cpu));
          |                                       ^~~~~~~
    In file included from .../xen/include/xen/percpu.h:4,
                     from .../xen/include/asm/msr.h:7,
                     from .../xen/include/asm/time.h:5,
                     from .../xen/include/xen/time.h:76,
                     from .../xen/include/xen/spinlock.h:4,
                     from .../xen/include/xen/cpu.h:5,
                     from core_parking.c:19:
    .../xen/include/asm/percpu.h:6:22: note: while referencing ‘__per_cpu_offset’
        6 | extern unsigned long __per_cpu_offset[NR_CPUS];
          |                      ^~~~~~~~~~~~~~~~
    
    One of the further errors even went as far as claiming that an array
    index (range) of [0, 0] was outside the bounds of a [1] array, so
    something fishy is pretty clearly going on there.
    
    The compiler apparently wants to be able to see that the loop isn't
    really a loop in order to avoid triggering such warnings, yet what
    exactly makes it consider the loop exit condition constant and within
    the [0, 1] range isn't obvious - using ((mask)->bits[0] & 1) instead of
    cpumask_test_cpu() for example did _not_ help.
    
    Re-instate a special form of for_each_cpu(), experimentally "proven" to
    avoid the diagnostics.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
    master commit: 625faf9f002bd6ff4b6457a016b8ff338223b659
    master date: 2021-04-07 12:24:45 +0200
---
 xen/include/xen/cpumask.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/xen/cpumask.h b/xen/include/xen/cpumask.h
index e69589fc08..9826707909 100644
--- a/xen/include/xen/cpumask.h
+++ b/xen/include/xen/cpumask.h
@@ -368,10 +368,15 @@ static inline void free_cpumask_var(cpumask_var_t mask)
 #define FREE_CPUMASK_VAR(m) free_cpumask_var(m)
 #endif
 
+#if NR_CPUS > 1
 #define for_each_cpu(cpu, mask)			\
 	for ((cpu) = cpumask_first(mask);	\
 	     (cpu) < nr_cpu_ids;		\
 	     (cpu) = cpumask_next(cpu, mask))
+#else /* NR_CPUS == 1 */
+#define for_each_cpu(cpu, mask)			\
+	for ((cpu) = 0; (cpu) < cpumask_test_cpu(0, mask); ++(cpu))
+#endif /* NR_CPUS */
 
 /*
  * The following particular system cpumasks and operations manage
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 04:44:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 04:44:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114102.217302 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ4jE-00069U-HR; Wed, 21 Apr 2021 04:44:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114102.217302; Wed, 21 Apr 2021 04:44: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 1lZ4jE-00069M-EY; Wed, 21 Apr 2021 04:44:44 +0000
Received: by outflank-mailman (input) for mailman id 114102;
 Wed, 21 Apr 2021 04:44: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 1lZ4jD-000697-0d
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:44: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 1lZ4jC-0007FA-Vd
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ4jC-0001g5-UI
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04: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=XFERG/lBhuy+Rh2vxWs5YjSStdlVMLzNtX0h3R03vEU=; b=Ty4LetsOqUEQEXFJ1HGz0uF4l7
	4/B2s08d8jQg5Pmr45RU+zb+bhx8/UCoq5+XLNhSasnuQIt45uiTKFVHeygEV07Qk3bZeUTwUeO2D
	sPPwSdruomOyQYAn++JfP7BikvF3mj/z9j39nbmy6ninmJfyciRsY+EsNzcn7n29fCZM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/vpt: do not take pt_migrate rwlock in some cases
Message-Id: <E1lZ4jC-0001g5-UI@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 04:44:42 +0000

commit e2e80ff86f76a898416be1a8b74edb9a64af8288
Author:     Boris Ostrovsky <boris.ostrovsky@oracle.com>
AuthorDate: Tue Apr 20 11:57:26 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:57:26 2021 +0200

    x86/vpt: do not take pt_migrate rwlock in some cases
    
    Commit 8e76aef72820 ("x86/vpt: fix race when migrating timers between
    vCPUs") addressed XSA-336 by introducing a per-domain rwlock that was
    intended to protect periodic timer during VCPU migration. Since such
    migration is an infrequent event no performance impact was expected.
    
    Unfortunately this turned out not to be the case: on a fairly large
    guest (92 VCPUs) we've observed as much as 40% TPCC performance
    regression with some guest kernels. Further investigation pointed to
    pt_migrate read lock taken in pt_update_irq() as the largest contributor
    to this regression. With large number of VCPUs and large number of VMEXITs
    (from where pt_update_irq() is always called) the update of an atomic in
    read_lock() is thought to be the main cause.
    
    Stephen Brennan analyzed locking pattern and classified lock users as
    follows:
    
    1. Functions which read (maybe write) all periodic_time instances attached
    to a particular vCPU. These are functions which use pt_vcpu_lock() such
    as pt_restore_timer(), pt_save_timer(), etc.
    2. Functions which want to modify a particular periodic_time object.
    These functions lock whichever vCPU the periodic_time is attached to, but
    since the vCPU could be modified without holding any lock, they are
    vulnerable to XSA-336. Functions in this group use pt_lock(), such as
    pt_timer_fn() or destroy_periodic_time().
    3. Functions which not only want to modify the periodic_time, but also
    would like to modify the =vcpu= fields. These are create_periodic_time()
    or pt_adjust_vcpu(). They create XSA-336 conditions for group 2, but we
    can't simply hold 2 vcpu locks due to the deadlock risk.
    
    Roger then pointed out that group 1 functions don't really need to hold
    the pt_migrate rwlock and that instead groups 2 and 3 should hold per-vcpu
    lock whenever they modify per-vcpu timer lists.
    
    Suggested-by: Stephen Brennan <stephen.s.brennan@oracle.com>
    Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Stephen Brennan <stephen.s.brennan@oracle.com>
    master commit: 1f3d87c7512975274cc45c40097b05550eba1ac9
    master date: 2021-04-09 09:21:27 +0200
---
 xen/arch/x86/hvm/vpt.c        | 44 ++++++++++++++++++++++++++++++++++---------
 xen/include/asm-x86/hvm/vpt.h | 18 ++++++++++++------
 2 files changed, 47 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 4c2afe2e91..560fab9cfc 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -153,32 +153,43 @@ static int pt_irq_masked(struct periodic_time *pt)
     return 1;
 }
 
+/*
+ * Functions which read (maybe write) all periodic_time instances
+ * attached to a particular vCPU use pt_vcpu_{un}lock locking helpers.
+ *
+ * Such users are explicitly forbidden from changing the value of the
+ * pt->vcpu field, because another thread holding the pt_migrate lock
+ * may already be spinning waiting for your vcpu lock.
+ */
 static void pt_vcpu_lock(struct vcpu *v)
 {
-    read_lock(&v->domain->arch.hvm.pl_time->pt_migrate);
     spin_lock(&v->arch.hvm.tm_lock);
 }
 
 static void pt_vcpu_unlock(struct vcpu *v)
 {
     spin_unlock(&v->arch.hvm.tm_lock);
-    read_unlock(&v->domain->arch.hvm.pl_time->pt_migrate);
 }
 
+/*
+ * Functions which want to modify a particular periodic_time object
+ * use pt_{un}lock locking helpers.
+ *
+ * These users lock whichever vCPU the periodic_time is attached to,
+ * but since the vCPU could be modified without holding any lock, they
+ * need to take an additional lock that protects against pt->vcpu
+ * changing.
+ */
 static void pt_lock(struct periodic_time *pt)
 {
-    /*
-     * We cannot use pt_vcpu_lock here, because we need to acquire the
-     * per-domain lock first and then (re-)fetch the value of pt->vcpu, or
-     * else we might be using a stale value of pt->vcpu.
-     */
     read_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
     spin_lock(&pt->vcpu->arch.hvm.tm_lock);
 }
 
 static void pt_unlock(struct periodic_time *pt)
 {
-    pt_vcpu_unlock(pt->vcpu);
+    spin_unlock(&pt->vcpu->arch.hvm.tm_lock);
+    read_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
 }
 
 static void pt_process_missed_ticks(struct periodic_time *pt)
@@ -543,8 +554,10 @@ void create_periodic_time(
     pt->cb = cb;
     pt->priv = data;
 
+    pt_vcpu_lock(v);
     pt->on_list = 1;
     list_add(&pt->list, &v->arch.hvm.tm_list);
+    pt_vcpu_unlock(v);
 
     init_timer(&pt->timer, pt_timer_fn, pt, v->processor);
     set_timer(&pt->timer, pt->scheduled);
@@ -580,13 +593,26 @@ static void pt_adjust_vcpu(struct periodic_time *pt, struct vcpu *v)
         return;
 
     write_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
+
+    if ( pt->vcpu == v )
+        goto out;
+
+    pt_vcpu_lock(pt->vcpu);
+    if ( pt->on_list )
+        list_del(&pt->list);
+    pt_vcpu_unlock(pt->vcpu);
+
     pt->vcpu = v;
+
+    pt_vcpu_lock(v);
     if ( pt->on_list )
     {
-        list_del(&pt->list);
         list_add(&pt->list, &v->arch.hvm.tm_list);
         migrate_timer(&pt->timer, v->processor);
     }
+    pt_vcpu_unlock(v);
+
+ out:
     write_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
 }
 
diff --git a/xen/include/asm-x86/hvm/vpt.h b/xen/include/asm-x86/hvm/vpt.h
index 39d26cbda4..74c0cedd11 100644
--- a/xen/include/asm-x86/hvm/vpt.h
+++ b/xen/include/asm-x86/hvm/vpt.h
@@ -128,12 +128,18 @@ struct pl_time {    /* platform time */
     struct RTCState  vrtc;
     struct HPETState vhpet;
     struct PMTState  vpmt;
-    /*
-     * rwlock to prevent periodic_time vCPU migration. Take the lock in read
-     * mode in order to prevent the vcpu field of periodic_time from changing.
-     * Lock must be taken in write mode when changes to the vcpu field are
-     * performed, as it allows exclusive access to all the timers of a domain.
-     */
+     /*
+      * Functions which want to modify the vcpu field of the vpt need
+      * to hold the global lock (pt_migrate) in write mode together
+      * with the per-vcpu locks of the lists being modified. Functions
+      * that want to lock a periodic_timer that's possibly on a
+      * different vCPU list need to take the lock in read mode first in
+      * order to prevent the vcpu field of periodic_timer from
+      * changing.
+      *
+      * Note that two vcpu locks cannot be held at the same time to
+      * avoid a deadlock.
+      */
     rwlock_t pt_migrate;
     /* guest_time = Xen sys time + stime_offset */
     int64_t stime_offset;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 04:44:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 04:44:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114103.217307 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ4jO-0006EB-Ir; Wed, 21 Apr 2021 04:44:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114103.217307; Wed, 21 Apr 2021 04:44: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 1lZ4jO-0006E3-Fz; Wed, 21 Apr 2021 04:44:54 +0000
Received: by outflank-mailman (input) for mailman id 114103;
 Wed, 21 Apr 2021 04:44: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 1lZ4jN-0006Ds-4O
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:44: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 1lZ4jN-0007FK-3A
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:44:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ4jN-0001gs-1n
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:44: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=7tXas0HjN2lEroOKnjqOLpoDAcRrx4i2xOInY8Zoz3M=; b=oMw2aPQ3fkclAjYBsj4ag4A8UB
	t8JfFjn0fP1TMRS+NvEem8j2WoWiDgBtLo8q5UPzSXqsTy6YVkhximEVadK6wCXexu9+H5KNx3oIS
	MnDuF1QeeDA/l5+Kzblb0tNo8ogssBQ6UkwICCbmcY4W8Os1tVOEBkmC7yh4M2/OM0Q4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] Revert "x86/HPET: don't enable legacy replacement mode unconditionally"
Message-Id: <E1lZ4jN-0001gs-1n@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 04:44:53 +0000

commit c129b5fd1430b50f4e6b275a070908d34dcef0dc
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Apr 20 11:58:06 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:58:06 2021 +0200

    Revert "x86/HPET: don't enable legacy replacement mode unconditionally"
    
    This reverts commit e680cc48b7184d3489873d6776f84ba1fc238ced.
    
    It was committed despite multiple objections.  The agreed upon fix is a
    different variation of the same original patch, and the delta between the two
    is far from clear.
    
    By reverting this commit first, the fixes are clear and coherent as individual
    patches, and in the appropriate form for backport to the older trees.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 2b05d427a09e108589dc57f54b517d0ffdf973ef
    master date: 2021-04-15 18:25:40 +0100
---
 docs/misc/xen-command-line.pandoc | 17 -----------------
 xen/arch/x86/hpet.c               | 37 ++++++-------------------------------
 2 files changed, 6 insertions(+), 48 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index deef6d0b4c..a0601ff838 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1274,26 +1274,9 @@ supported. See docs/misc/arm/big.LITTLE.txt for more information.
 When the hmp-unsafe option is disabled (default), CPUs that are not
 identical to the boot CPU will be parked and not used by Xen.
 
-### hpet (x86)
-> `= List of [ <boolean> | broadcast | legacy-replacement ]`
-
-> Default : `true`, `no-broadcast`, 'no-legacy-replacement`
-
-Controls Xen's use of the system's High Precision Event Timer.  The boolean
-allows to turn off use altogether.
-
-`broadcast` forces Xen to keep using the broadcast for CPUs in deep C-states
-even when an RTC interrupt got enabled.
-
-`legacy-replacement` is intended to be used on platforms where the timer
-interrupt doesn't get raised by the legacy PIT.  This then also affects
-raising of the RTC interrupt.
-
 ### hpetbroadcast (x86)
 > `= <boolean>`
 
-Deprecated alternative of `hpet=broadcast`.
-
 ### hvm_debug (x86)
 > `= <integer>`
 
diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 76d9ef2c02..1ff005fb4a 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -52,8 +52,6 @@ static unsigned int __read_mostly num_hpets_used;
 DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel);
 
 unsigned long __initdata hpet_address;
-static bool __initdata opt_hpet = true;
-static bool __initdata opt_legacy_replacement;
 u8 __initdata hpet_blockid;
 u8 __initdata hpet_flags;
 
@@ -65,32 +63,6 @@ u8 __initdata hpet_flags;
 static bool __initdata force_hpet_broadcast;
 boolean_param("hpetbroadcast", force_hpet_broadcast);
 
-static int __init parse_hpet_param(const char *s)
-{
-    const char *ss;
-    int val, rc = 0;
-
-    do {
-        ss = strchr(s, ',');
-        if ( !ss )
-            ss = strchr(s, '\0');
-
-        if ( (val = parse_bool(s, ss)) >= 0 )
-            opt_hpet = val;
-        else if ( (val = parse_boolean("broadcast", s, ss)) >= 0 )
-            force_hpet_broadcast = val;
-        else if ( (val = parse_boolean("legacy-replacement", s, ss)) >= 0 )
-            opt_legacy_replacement = val;
-        else
-            rc = -EINVAL;
-
-        s = ss + 1;
-    } while ( *ss );
-
-    return rc;
-}
-custom_param("hpet", parse_hpet_param);
-
 /*
  * Calculate a multiplication factor for scaled math, which is used to convert
  * nanoseconds based values to clock ticks:
@@ -789,9 +761,12 @@ u64 __init hpet_setup(void)
     unsigned int hpet_id, hpet_period, hpet_cfg;
     unsigned int last, rem;
 
-    if ( hpet_rate || !hpet_address || !opt_hpet )
+    if ( hpet_rate )
         return hpet_rate;
 
+    if ( hpet_address == 0 )
+        return 0;
+
     set_fixmap_nocache(FIX_HPET_BASE, hpet_address);
 
     hpet_id = hpet_read32(HPET_ID);
@@ -828,9 +803,9 @@ u64 __init hpet_setup(void)
      * IRQ routing is configured.
      *
      * Reconfigure the HPET into legacy mode to re-establish the timer
-     * interrupt, if available and if so requested.
+     * interrupt.
      */
-    if ( opt_legacy_replacement && (hpet_id & HPET_ID_LEGSUP) &&
+    if ( hpet_id & HPET_ID_LEGSUP &&
          !((hpet_cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
     {
         unsigned int c0_cfg, ticks, count;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 04:45:04 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 04:45:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114104.217311 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ4jY-0006Fk-Ks; Wed, 21 Apr 2021 04:45:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114104.217311; Wed, 21 Apr 2021 04:45:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ4jY-0006Fc-Ha; Wed, 21 Apr 2021 04:45:04 +0000
Received: by outflank-mailman (input) for mailman id 114104;
 Wed, 21 Apr 2021 04:45: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 1lZ4jX-0006F9-7s
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:45: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 1lZ4jX-0007Fu-6G
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:45:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ4jX-0001hw-5W
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:45: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=9dHHFTIqpl8ndGCmfEhCaEZ7InpUox69Wf3pG095GkM=; b=yFZy0cYgcxkhmehv6bsIyq9Gqo
	VCvGCIVX8KciEmsk0d04r9RL0iJnMOWevYRDu2cw8rwevEFWQ23ZPOOlhrNp7zRYqcPWjSiKApZpv
	X9XVgSmrqVXpwwNpz5sA0MErSpWM8+P86/5EOlYky7EH+evrK2p6hWr1aLXHVlckhATE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/hpet: Factor hpet_enable_legacy_replacement_mode() out of hpet_setup()
Message-Id: <E1lZ4jX-0001hw-5W@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 04:45:03 +0000

commit dfcce093f10eb4c3dc9b1cfccc5cfc622f04ac8c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Apr 20 11:58:31 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:58:31 2021 +0200

    x86/hpet: Factor hpet_enable_legacy_replacement_mode() out of hpet_setup()
    
    ... in preparation to introduce a second caller.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Frédéric Pierret <frederic.pierret@qubes-os.org>
    master commit: 238168b5bcd27fec97704f6295fa5bf7a442eb6f
    master date: 2021-04-15 18:25:40 +0100
---
 xen/arch/x86/hpet.c        | 116 ++++++++++++++++++++++++---------------------
 xen/include/asm-x86/hpet.h |   6 +++
 2 files changed, 68 insertions(+), 54 deletions(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 1ff005fb4a..c1d04f184f 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -754,11 +754,70 @@ int hpet_legacy_irq_tick(void)
 }
 
 static u32 *hpet_boot_cfg;
+static uint64_t __initdata hpet_rate;
+
+bool __init hpet_enable_legacy_replacement_mode(void)
+{
+    unsigned int cfg, c0_cfg, ticks, count;
+
+    if ( !hpet_rate ||
+         !(hpet_read32(HPET_ID) & HPET_ID_LEGSUP) ||
+         ((cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
+        return false;
+
+    /* Stop the main counter. */
+    hpet_write32(cfg & ~HPET_CFG_ENABLE, HPET_CFG);
+
+    /* Reconfigure channel 0 to be 32bit periodic. */
+    c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+    c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
+               HPET_TN_32BIT);
+    hpet_write32(c0_cfg, HPET_Tn_CFG(0));
+
+    /*
+     * The exact period doesn't have to match a legacy PIT.  All we need
+     * is an interrupt queued up via the IO-APIC to check routing.
+     *
+     * Use HZ as the frequency.
+     */
+    ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
+
+    count = hpet_read32(HPET_COUNTER);
+
+    /*
+     * HPET_TN_SETVAL above is atrociously documented in the spec.
+     *
+     * Periodic HPET channels have a main comparator register, and
+     * separate "accumulator" register.  Despite being named accumulator
+     * in the spec, this is not an accurate description of its behaviour
+     * or purpose.
+     *
+     * Each time an interrupt is generated, the "accumulator" register is
+     * re-added to the comparator set up the new period.
+     *
+     * Normally, writes to the CMP register update both registers.
+     * However, under these semantics, it is impossible to set up a
+     * periodic timer correctly without the main HPET counter being at 0.
+     *
+     * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
+     * use for periodic timers to mean that the second write to CMP
+     * updates the accumulator only, and not the absolute comparator
+     * value.
+     *
+     * This lets us set a period when the main counter isn't at 0.
+     */
+    hpet_write32(count + ticks, HPET_Tn_CMP(0));
+    hpet_write32(ticks,         HPET_Tn_CMP(0));
+
+    /* Restart the main counter, and legacy mode. */
+    hpet_write32(cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
+
+    return true;
+}
 
 u64 __init hpet_setup(void)
 {
-    static u64 __initdata hpet_rate;
-    unsigned int hpet_id, hpet_period, hpet_cfg;
+    unsigned int hpet_id, hpet_period;
     unsigned int last, rem;
 
     if ( hpet_rate )
@@ -805,58 +864,7 @@ u64 __init hpet_setup(void)
      * Reconfigure the HPET into legacy mode to re-establish the timer
      * interrupt.
      */
-    if ( hpet_id & HPET_ID_LEGSUP &&
-         !((hpet_cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
-    {
-        unsigned int c0_cfg, ticks, count;
-
-        /* Stop the main counter. */
-        hpet_write32(hpet_cfg & ~HPET_CFG_ENABLE, HPET_CFG);
-
-        /* Reconfigure channel 0 to be 32bit periodic. */
-        c0_cfg = hpet_read32(HPET_Tn_CFG(0));
-        c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
-                   HPET_TN_32BIT);
-        hpet_write32(c0_cfg, HPET_Tn_CFG(0));
-
-        /*
-         * The exact period doesn't have to match a legacy PIT.  All we need
-         * is an interrupt queued up via the IO-APIC to check routing.
-         *
-         * Use HZ as the frequency.
-         */
-        ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
-
-        count = hpet_read32(HPET_COUNTER);
-
-        /*
-         * HPET_TN_SETVAL above is atrociously documented in the spec.
-         *
-         * Periodic HPET channels have a main comparator register, and
-         * separate "accumulator" register.  Despite being named accumulator
-         * in the spec, this is not an accurate description of its behaviour
-         * or purpose.
-         *
-         * Each time an interrupt is generated, the "accumulator" register is
-         * re-added to the comparator set up the new period.
-         *
-         * Normally, writes to the CMP register update both registers.
-         * However, under these semantics, it is impossible to set up a
-         * periodic timer correctly without the main HPET counter being at 0.
-         *
-         * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
-         * use for periodic timers to mean that the second write to CMP
-         * updates the accumulator only, and not the absolute comparator
-         * value.
-         *
-         * This lets us set a period when the main counter isn't at 0.
-         */
-        hpet_write32(count + ticks, HPET_Tn_CMP(0));
-        hpet_write32(ticks,         HPET_Tn_CMP(0));
-
-        /* Restart the main counter, and legacy mode. */
-        hpet_write32(hpet_cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
-    }
+    hpet_enable_legacy_replacement_mode();
 
     return hpet_rate;
 }
diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h
index fb6bf05065..50176de3d2 100644
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -72,6 +72,12 @@ void hpet_disable(void);
  */
 int hpet_legacy_irq_tick(void);
 
+/*
+ * Try to enable HPET Legacy Replacement mode.  Returns a boolean indicating
+ * whether the HPET configuration was changed.
+ */
+bool hpet_enable_legacy_replacement_mode(void);
+
 /*
  * Temporarily use an HPET event counter for timer interrupt handling,
  * rather than using the LAPIC timer. Used for Cx state entry.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 04:45:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 04:45:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114105.217314 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ4ji-0006H6-Mp; Wed, 21 Apr 2021 04:45:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114105.217314; Wed, 21 Apr 2021 04:45:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ4ji-0006Gy-JR; Wed, 21 Apr 2021 04:45:14 +0000
Received: by outflank-mailman (input) for mailman id 114105;
 Wed, 21 Apr 2021 04:45:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ4jh-0006Go-Ar
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:45: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 1lZ4jh-0007GO-A1
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:45:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ4jh-0001il-8o
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 04:45: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=PbZ2JzTM1L0qbz38kBPqf6nPGCPzsm6rizhsW3iElgM=; b=zJHW39gQFkGaP2dReLOYj6DRnx
	mJveXSYTZNfDmkm2gK80DogED71R3rOPuDJl0pGlvvVPh4DZXCQQrrKWaFhJskf5U6Tbz0iccARcf
	J3OlphUbVl9HMsa/gXLIG6K4NixR3W6Mz/LxyS6M1XF3qon83kDNQugIeBDt5lVW5czE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] x86/hpet: Don't enable legacy replacement mode unconditionally
Message-Id: <E1lZ4jh-0001il-8o@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 04:45:13 +0000

commit eb1f325186be9e02c3e89619cd154eb57f202eba
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 11:59:01 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:59:01 2021 +0200

    x86/hpet: Don't enable legacy replacement mode unconditionally
    
    Commit e1de4c196a2e ("x86/timer: Fix boot on Intel systems using ITSSPRC
    static PIT clock gating") was reported to cause boot failures on certain
    AMD Ryzen systems.
    
    Refine the fix to do nothing in the default case, and only attempt to
    configure legacy replacement mode if IRQ0 is found to not be working.  If
    legacy replacement mode doesn't help, undo it before falling back to other IRQ
    routing configurations.
    
    In addition, introduce a "hpet" command line option so this heuristic
    can be overridden.  Since it makes little sense to introduce just
    "hpet=legacy-replacement", also allow for a boolean argument as well as
    "broadcast" to replace the separate "hpetbroadcast" option.
    
    Reported-by: Frédéric Pierret frederic.pierret@qubes-os.org
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Frédéric Pierret <frederic.pierret@qubes-os.org>
    master commit: b53173e7cdafb7a318a239d557478fd73734a86a
    master date: 2021-04-15 18:25:40 +0100
---
 docs/misc/xen-command-line.pandoc | 33 +++++++++++++++++
 xen/arch/x86/hpet.c               | 75 +++++++++++++++++++++++++++++----------
 xen/arch/x86/io_apic.c            | 31 ++++++++++++++++
 xen/include/asm-x86/hpet.h        |  7 ++++
 4 files changed, 128 insertions(+), 18 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index a0601ff838..a4bd3f12c5 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1274,9 +1274,42 @@ supported. See docs/misc/arm/big.LITTLE.txt for more information.
 When the hmp-unsafe option is disabled (default), CPUs that are not
 identical to the boot CPU will be parked and not used by Xen.
 
+### hpet
+    = List of [ <bool> | broadcast=<bool> | legacy-replacement=<bool> ]
+
+    Applicability: x86
+
+Controls Xen's use of the system's High Precision Event Timer.  By default,
+Xen will use an HPET when available and not subject to errata.  Use of the
+HPET can be disabled by specifying `hpet=0`.
+
+ * The `broadcast` boolean is disabled by default, but forces Xen to keep
+   using the broadcast for CPUs in deep C-states even when an RTC interrupt is
+   enabled.  This then also affects raising of the RTC interrupt.
+
+ * The `legacy-replacement` boolean allows for control over whether Legacy
+   Replacement mode is enabled.
+
+   Legacy Replacement mode is intended for hardware which does not have an
+   8254 PIT, and allows the HPET to be configured into a compatible mode.
+   Intel chipsets from Skylake/ApolloLake onwards can turn the PIT off for
+   power saving reasons, and there is no platform-agnostic mechanism for
+   discovering this.
+
+   By default, Xen will not change hardware configuration, unless the PIT
+   appears to be absent, at which point Xen will try to enable Legacy
+   Replacement mode before falling back to pre-IO-APIC interrupt routing
+   options.
+
+   This behaviour can be inhibited by specifying `legacy-replacement=0`.
+   Alternatively, this mode can be enabled unconditionally (if available) by
+   specifying `legacy-replacement=1`.
+
 ### hpetbroadcast (x86)
 > `= <boolean>`
 
+Deprecated alternative of `hpet=broadcast`.
+
 ### hvm_debug (x86)
 > `= <integer>`
 
diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index c1d04f184f..afe104dc93 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -52,6 +52,8 @@ static unsigned int __read_mostly num_hpets_used;
 DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel);
 
 unsigned long __initdata hpet_address;
+int8_t __initdata opt_hpet_legacy_replacement = -1;
+static bool __initdata opt_hpet = true;
 u8 __initdata hpet_blockid;
 u8 __initdata hpet_flags;
 
@@ -63,6 +65,32 @@ u8 __initdata hpet_flags;
 static bool __initdata force_hpet_broadcast;
 boolean_param("hpetbroadcast", force_hpet_broadcast);
 
+static int __init parse_hpet_param(const char *s)
+{
+    const char *ss;
+    int val, rc = 0;
+
+    do {
+        ss = strchr(s, ',');
+        if ( !ss )
+            ss = strchr(s, '\0');
+
+        if ( (val = parse_bool(s, ss)) >= 0 )
+            opt_hpet = val;
+        else if ( (val = parse_boolean("broadcast", s, ss)) >= 0 )
+            force_hpet_broadcast = val;
+        else if ( (val = parse_boolean("legacy-replacement", s, ss)) >= 0 )
+            opt_hpet_legacy_replacement = val;
+        else
+            rc = -EINVAL;
+
+        s = ss + 1;
+    } while ( *ss );
+
+    return rc;
+}
+custom_param("hpet", parse_hpet_param);
+
 /*
  * Calculate a multiplication factor for scaled math, which is used to convert
  * nanoseconds based values to clock ticks:
@@ -755,6 +783,9 @@ int hpet_legacy_irq_tick(void)
 
 static u32 *hpet_boot_cfg;
 static uint64_t __initdata hpet_rate;
+static __initdata struct {
+    uint32_t cmp, cfg;
+} pre_legacy_c0;
 
 bool __init hpet_enable_legacy_replacement_mode(void)
 {
@@ -768,8 +799,11 @@ bool __init hpet_enable_legacy_replacement_mode(void)
     /* Stop the main counter. */
     hpet_write32(cfg & ~HPET_CFG_ENABLE, HPET_CFG);
 
+    /* Stash channel 0's old CFG/CMP incase we need to undo. */
+    pre_legacy_c0.cfg = c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+    pre_legacy_c0.cmp = hpet_read32(HPET_Tn_CMP(0));
+
     /* Reconfigure channel 0 to be 32bit periodic. */
-    c0_cfg = hpet_read32(HPET_Tn_CFG(0));
     c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
                HPET_TN_32BIT);
     hpet_write32(c0_cfg, HPET_Tn_CFG(0));
@@ -815,17 +849,33 @@ bool __init hpet_enable_legacy_replacement_mode(void)
     return true;
 }
 
+void __init hpet_disable_legacy_replacement_mode(void)
+{
+    unsigned int cfg = hpet_read32(HPET_CFG);
+
+    ASSERT(hpet_rate);
+
+    cfg &= ~(HPET_CFG_LEGACY | HPET_CFG_ENABLE);
+
+    /* Stop the main counter and disable legacy mode. */
+    hpet_write32(cfg, HPET_CFG);
+
+    /* Restore pre-Legacy Replacement Mode settings. */
+    hpet_write32(pre_legacy_c0.cfg, HPET_Tn_CFG(0));
+    hpet_write32(pre_legacy_c0.cmp, HPET_Tn_CMP(0));
+
+    /* Restart the main counter. */
+    hpet_write32(cfg | HPET_CFG_ENABLE, HPET_CFG);
+}
+
 u64 __init hpet_setup(void)
 {
     unsigned int hpet_id, hpet_period;
     unsigned int last, rem;
 
-    if ( hpet_rate )
+    if ( hpet_rate || !hpet_address || !opt_hpet )
         return hpet_rate;
 
-    if ( hpet_address == 0 )
-        return 0;
-
     set_fixmap_nocache(FIX_HPET_BASE, hpet_address);
 
     hpet_id = hpet_read32(HPET_ID);
@@ -852,19 +902,8 @@ u64 __init hpet_setup(void)
     if ( (rem * 2) > hpet_period )
         hpet_rate++;
 
-    /*
-     * Intel chipsets from Skylake/ApolloLake onwards can statically clock
-     * gate the 8259 PIT.  This option is enabled by default in slightly later
-     * systems, as turning the PIT off is a prerequisite to entering the C11
-     * power saving state.
-     *
-     * Xen currently depends on the legacy timer interrupt being active while
-     * IRQ routing is configured.
-     *
-     * Reconfigure the HPET into legacy mode to re-establish the timer
-     * interrupt.
-     */
-    hpet_enable_legacy_replacement_mode();
+    if ( opt_hpet_legacy_replacement > 0 )
+        hpet_enable_legacy_replacement_mode();
 
     return hpet_rate;
 }
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index e93265f379..58b26d962c 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -29,6 +29,8 @@
 #include <xen/acpi.h>
 #include <xen/keyhandler.h>
 #include <xen/softirq.h>
+
+#include <asm/hpet.h>
 #include <asm/mc146818rtc.h>
 #include <asm/smp.h>
 #include <asm/desc.h>
@@ -1930,6 +1932,35 @@ static void __init check_timer(void)
             local_irq_restore(flags);
             return;
         }
+
+        /*
+         * Intel chipsets from Skylake/ApolloLake onwards can statically clock
+         * gate the 8254 PIT.  This option is enabled by default in slightly
+         * later systems, as turning the PIT off is a prerequisite to entering
+         * the C11 power saving state.
+         *
+         * Xen currently depends on the legacy timer interrupt being active
+         * while IRQ routing is configured.
+         *
+         * If the user hasn't made an explicit choice, attempt to reconfigure
+         * the HPET into legacy mode to re-establish the timer interrupt.
+         */
+        if ( opt_hpet_legacy_replacement < 0 &&
+             hpet_enable_legacy_replacement_mode() )
+        {
+            printk(XENLOG_ERR "..no 8254 timer found - trying HPET Legacy Replacement Mode\n");
+
+            if ( timer_irq_works() )
+            {
+                local_irq_restore(flags);
+                return;
+            }
+
+            /* Legacy Replacement mode hasn't helped.  Undo it. */
+            printk(XENLOG_ERR "..no HPET timer found - reverting Legacy Replacement Mode\n");
+            hpet_disable_legacy_replacement_mode();
+        }
+
         clear_IO_APIC_pin(apic1, pin1);
         printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to "
                "IO-APIC\n");
diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h
index 50176de3d2..8f9725a95e 100644
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -53,6 +53,7 @@
 extern unsigned long hpet_address;
 extern u8 hpet_blockid;
 extern u8 hpet_flags;
+extern int8_t opt_hpet_legacy_replacement;
 
 /*
  * Detect and initialise HPET hardware: return counter update frequency.
@@ -78,6 +79,12 @@ int hpet_legacy_irq_tick(void);
  */
 bool hpet_enable_legacy_replacement_mode(void);
 
+/*
+ * Undo the effects of hpet_disable_legacy_replacement_mode().  Must not be
+ * called unless enable() returned true.
+ */
+void hpet_disable_legacy_replacement_mode(void);
+
 /*
  * Temporarily use an HPET event counter for timer interrupt handling,
  * rather than using the LAPIC timer. Used for Cx state entry.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 09:44:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 09:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114229.217595 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ9Ou-0002Jm-Mq; Wed, 21 Apr 2021 09:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114229.217595; Wed, 21 Apr 2021 09: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 1lZ9Ou-0002Je-Jo; Wed, 21 Apr 2021 09:44:04 +0000
Received: by outflank-mailman (input) for mailman id 114229;
 Wed, 21 Apr 2021 09:44: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 1lZ9Os-0002JZ-Vb
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:44: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 1lZ9Os-0004bF-PZ
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ9Os-0008E4-Oj
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09: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=H5Ur4qz9aVR49UjoHnn7FCOlqm2wPncz84QN2R16xdI=; b=Dw2M/KruJ/jsMqdvDVPqaDxMCn
	joiktrFMRkM1E+MW9TPbWJhixhCaH6La+BWdLcnfjJCVfsavYesqjzUBYc2lWuziQYR3MeatP14nF
	zTsnhCdHDzAdKLXNrWiGgojoPGMTFuL4JZC+Wtc3vNcgt/xGNbLK1YgkndgmFJyz9otw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] update Xen version to 4.13.4-pre
Message-Id: <E1lZ9Os-0008E4-Oj@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 09:44:02 +0000

commit e3bcd4db25f6dede60b6b7c1ba8479a4a1ba234b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:09:20 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:09:20 2021 +0200

    update Xen version to 4.13.4-pre
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 5dc4c51371..ef1d388efe 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    = 13
-export XEN_EXTRAVERSION ?= .3$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .4-pre$(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.13


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 09:44:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 09:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114230.217598 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ9P3-0002Ko-Od; Wed, 21 Apr 2021 09:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114230.217598; Wed, 21 Apr 2021 09: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 1lZ9P3-0002Kg-LS; Wed, 21 Apr 2021 09:44:13 +0000
Received: by outflank-mailman (input) for mailman id 114230;
 Wed, 21 Apr 2021 09: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 1lZ9P2-0002KZ-Td
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09: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 1lZ9P2-0004bY-Sn
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ9P2-0008F9-Ro
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09: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=DFPiu7lC8Y1dUdIhL0bZK3QPmiiQ4GSSD8yjglwjnBQ=; b=CgFF3nTQ21COuTra0Y0yyFWHyt
	eE+sbATE0E0OXRqWYHCscDMNV66FFLKYRb8sA5HpIRitUx3HEwAGwqnuGuAQ5huOZf9WlgK4WFY2h
	monZDHteF81X93QYUG8xqKiSxYp1OBhBL2dmo5peITV7uVrDrFZniq7Gd4IgwVeZK2yo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] pci: cleanup MSI interrupts before removing device from IOMMU
Message-Id: <E1lZ9P2-0008F9-Ro@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 09:44:12 +0000

commit 5de15582604f1470425aea95a07db28e71650dca
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Apr 20 12:10:24 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:10:24 2021 +0200

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

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


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 09:44:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 09:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114231.217603 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ9PE-0002MG-Q0; Wed, 21 Apr 2021 09:44:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114231.217603; Wed, 21 Apr 2021 09:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ9PE-0002M9-N1; Wed, 21 Apr 2021 09:44:24 +0000
Received: by outflank-mailman (input) for mailman id 114231;
 Wed, 21 Apr 2021 09:44: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 1lZ9PD-0002Lw-3K
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:44: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 1lZ9PD-0004bl-1d
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:44:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ9PC-0008G1-Vc
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09: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=1Aqp2FBNNGjftH7hR/U2Y9I8p6YlqYW7fh1HOsDky0o=; b=LTIeyn1evpwVksI9QSg7OH+R+h
	Vv5tVBjI3NOVeI4wmLmA40ija1SFtX4s0jSuBFlG9HrhTjdOy1y89//3jV1y8bNU5mcAmWr6AU+DN
	RAEqdvw58WF5nP4JhAyDxNIwcELvnZ/omuGc4xoDxs8Gs0t8O6JR/BjD52o9x7rPxkyc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] x86emul: fix PINSRW and adjust other {,V}PINSR*
Message-Id: <E1lZ9PC-0008G1-Vc@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 09:44:22 +0000

commit 5aef2c59589fd84397a359c3561c0f3fdfe7baa0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:11:11 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:11:11 2021 +0200

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

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


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 09:44:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 09:44:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114232.217607 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ9PO-0002No-Rv; Wed, 21 Apr 2021 09:44:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114232.217607; Wed, 21 Apr 2021 09: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 1lZ9PO-0002Nf-Om; Wed, 21 Apr 2021 09:44:34 +0000
Received: by outflank-mailman (input) for mailman id 114232;
 Wed, 21 Apr 2021 09:44: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 1lZ9PN-0002NV-6m
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:44: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 1lZ9PN-0004bt-67
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:44:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ9PN-0008Hf-4A
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:44: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=XW9eDv6XcRK1cl/ZW9XW268grXgW9E+0tiFwDcGi+7s=; b=xE0hK8cZftPVfJHCKFvEpA99NR
	ZHUQU6FaIPWi86fmnaZTh4iIjQj/z7v08dAReBR7X4XC5EVt/Idg7NXYZn3YpxXR4HUjm1m8OU/Aq
	4AyK92f230V4OoGtYNvEgE+BDxlEal9wxYGzulNQQw4zyyiblocMoEMg3yqLVHV2idV0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] x86/timer: Fix boot on Intel systems using ITSSPRC static PIT clock gating
Message-Id: <E1lZ9PN-0008Hf-4A@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 09:44:33 +0000

commit ca06bce94fa2cd2cdc42e0c161df9166626436e4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Apr 20 12:11:59 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:11:59 2021 +0200

    x86/timer: Fix boot on Intel systems using ITSSPRC static PIT clock gating
    
    Recent Intel client devices have disabled the legacy PIT for powersaving
    reasons, breaking compatibility with a traditional IBM PC.  Xen depends on a
    legacy timer interrupt to check that the IO-APIC/PIC routing is configured
    correctly, and fails to boot with:
    
      (XEN) *******************************
      (XEN) Panic on CPU 0:
      (XEN) IO-APIC + timer doesn't work!  Boot with apic_verbosity=debug and send report.  Then try booting with the `noapic` option
      (XEN) *******************************
    
    While this setting can be undone by Xen, the details of how to differ by
    chipset, and would be very short sighted for battery based devices.  See bit 2
    "8254 Static Clock Gating Enable" in:
    
      https://edc.intel.com/content/www/us/en/design/products-and-solutions/processors-and-chipsets/comet-lake-u/intel-400-series-chipset-on-package-platform-controller-hub-register-database/itss-power-reduction-control-itssprc-offset-3300/
    
    All impacted systems have an HPET, but there is no indication of the absence
    of PIT functionality, nor a suitable way to probe for its absence.  As a short
    term fix, reconfigure the HPET into legacy replacement mode.  A better
    longterm fix would be to avoid the reliance on the timer interrupt entirely.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Jason Andryuk <jandryuk@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: e1de4c196a2eb4fd5063c30a2e115adf144bdeef
    master date: 2021-01-27 19:15:19 +0000
---
 xen/arch/x86/hpet.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 66 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index e99d7116b6..86b4e88f9b 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -767,7 +767,7 @@ static u32 *hpet_boot_cfg;
 u64 __init hpet_setup(void)
 {
     static u64 __initdata hpet_rate;
-    u32 hpet_id, hpet_period;
+    unsigned int hpet_id, hpet_period, hpet_cfg;
     unsigned int last;
 
     if ( hpet_rate )
@@ -800,6 +800,71 @@ u64 __init hpet_setup(void)
     hpet_rate = 1000000000000000ULL; /* 10^15 */
     (void)do_div(hpet_rate, hpet_period);
 
+    /*
+     * Intel chipsets from Skylake/ApolloLake onwards can statically clock
+     * gate the 8259 PIT.  This option is enabled by default in slightly later
+     * systems, as turning the PIT off is a prerequisite to entering the C11
+     * power saving state.
+     *
+     * Xen currently depends on the legacy timer interrupt being active while
+     * IRQ routing is configured.
+     *
+     * Reconfigure the HPET into legacy mode to re-establish the timer
+     * interrupt.
+     */
+    if ( hpet_id & HPET_ID_LEGSUP &&
+         !((hpet_cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
+    {
+        unsigned int c0_cfg, ticks, count;
+
+        /* Stop the main counter. */
+        hpet_write32(hpet_cfg & ~HPET_CFG_ENABLE, HPET_CFG);
+
+        /* Reconfigure channel 0 to be 32bit periodic. */
+        c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+        c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
+                   HPET_TN_32BIT);
+        hpet_write32(c0_cfg, HPET_Tn_CFG(0));
+
+        /*
+         * The exact period doesn't have to match a legacy PIT.  All we need
+         * is an interrupt queued up via the IO-APIC to check routing.
+         *
+         * Use HZ as the frequency.
+         */
+        ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
+
+        count = hpet_read32(HPET_COUNTER);
+
+        /*
+         * HPET_TN_SETVAL above is atrociously documented in the spec.
+         *
+         * Periodic HPET channels have a main comparator register, and
+         * separate "accumulator" register.  Despite being named accumulator
+         * in the spec, this is not an accurate description of its behaviour
+         * or purpose.
+         *
+         * Each time an interrupt is generated, the "accumulator" register is
+         * re-added to the comparator set up the new period.
+         *
+         * Normally, writes to the CMP register update both registers.
+         * However, under these semantics, it is impossible to set up a
+         * periodic timer correctly without the main HPET counter being at 0.
+         *
+         * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
+         * use for periodic timers to mean that the second write to CMP
+         * updates the accumulator only, and not the absolute comparator
+         * value.
+         *
+         * This lets us set a period when the main counter isn't at 0.
+         */
+        hpet_write32(count + ticks, HPET_Tn_CMP(0));
+        hpet_write32(ticks,         HPET_Tn_CMP(0));
+
+        /* Restart the main counter, and legacy mode. */
+        hpet_write32(hpet_cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
+    }
+
     return hpet_rate;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 09:44:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 09:44:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114233.217612 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ9PY-0002R6-U6; Wed, 21 Apr 2021 09:44:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114233.217612; Wed, 21 Apr 2021 09:44: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 1lZ9PY-0002Qd-QL; Wed, 21 Apr 2021 09:44:44 +0000
Received: by outflank-mailman (input) for mailman id 114233;
 Wed, 21 Apr 2021 09:44: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 1lZ9PX-0002Ot-Br
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:44: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 1lZ9PX-0004cB-B2
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:44:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ9PX-0008JL-99
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:44: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=epp70jC67ha7qS1ZgNtrKRoyPlXnPD1Wr52GYrO11Zs=; b=5B4ZpWUwMsvhPcEfxT2ZOumsNO
	Rj7i8fT3loqQxETdMOEF3wCjROe30ob1PlwQALsBGq9jZdVrJAyxe9VbURN+BrjyB/HJ+bAvDL4/N
	ra6oYbJPMkc14snAYJEET6jia7DYX60mzGoU/v0lED3MzyMtJ6OKB3iU8kBUgWocs6Ww=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] VT-d: correct off-by-1 in number-of-IOMMUs check
Message-Id: <E1lZ9PX-0008JL-99@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 09:44:43 +0000

commit 231237c12b1b5afc14ea9bbbf4e6470281b70fd4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:12:26 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:12:26 2021 +0200

    VT-d: correct off-by-1 in number-of-IOMMUs check
    
    Otherwise, if we really run on a system with this many IOMMUs,
    entering/leaving S3 would overrun iommu_state[].
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: b9b3082002cac68726fb303e0abd2ff0113d4657
    master date: 2021-03-23 17:01:30 +0100
---
 xen/drivers/passthrough/vtd/iommu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 61ba9b496b..a328239375 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1160,10 +1160,10 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
     unsigned long sagaw, nr_dom;
     int agaw;
 
-    if ( nr_iommus > MAX_IOMMUS )
+    if ( nr_iommus >= MAX_IOMMUS )
     {
         dprintk(XENLOG_ERR VTDPREFIX,
-                 "IOMMU: nr_iommus %d > MAX_IOMMUS\n", nr_iommus);
+                "IOMMU: nr_iommus %d > MAX_IOMMUS\n", nr_iommus + 1);
         return -ENOMEM;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 09:44:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 09:44:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114235.217615 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ9Pi-0002U9-V9; Wed, 21 Apr 2021 09:44:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114235.217615; Wed, 21 Apr 2021 09:44: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 1lZ9Pi-0002U1-SB; Wed, 21 Apr 2021 09:44:54 +0000
Received: by outflank-mailman (input) for mailman id 114235;
 Wed, 21 Apr 2021 09:44: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 1lZ9Ph-0002Tp-F5
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:44: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 1lZ9Ph-0004cJ-EM
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:44:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ9Ph-0008KH-DP
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:44: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=FBtEAIAr38gfAfx2nU9tbObdLVsMCBN345dgrPZyXjY=; b=NoNlHvVDiq939ZXlrHQVHV/xX/
	NtINNGh9BJi0TUlMv3uqJZdEhcCP/mJtyzc2N+/5TukiSdfQ9hEVdjYOm/NVEKJKqMYCkLtUqGSBF
	7bwFxetYNRCCsbtWlKifNJxFPv4K9/4f2MQMS5cxjTrKz4McOesugMW6KAZCygC/7z9Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] VT-d: leave FECTL write to vtd_resume()
Message-Id: <E1lZ9Ph-0008KH-DP@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 09:44:53 +0000

commit e93d2786725aa6d2a8211ba47af2f2b0504cd750
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:12:58 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:12:58 2021 +0200

    VT-d: leave FECTL write to vtd_resume()
    
    We shouldn't blindly unmask the interrupt when resuming. vtd_resume()
    will restore the intended state.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 0d597e7bd1bd8a57619690d457f79769777a5834
    master date: 2021-03-30 14:39:23 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index a328239375..abbeb13988 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2109,7 +2109,7 @@ static int adjust_vtd_irq_affinities(void)
 }
 __initcall(adjust_vtd_irq_affinities);
 
-static int __must_check init_vtd_hw(void)
+static int __must_check init_vtd_hw(bool resume)
 {
     struct acpi_drhd_unit *drhd;
     struct vtd_iommu *iommu;
@@ -2138,6 +2138,10 @@ static int __must_check init_vtd_hw(void)
             disable_qinval(iommu);
         }
 
+        if ( resume )
+            /* FECTL write done by vtd_resume(). */
+            continue;
+
         spin_lock_irqsave(&iommu->register_lock, flags);
         sts = dmar_readl(iommu->reg, DMAR_FECTL_REG);
         sts &= ~DMA_FECTL_IM;
@@ -2329,7 +2333,7 @@ static int __init vtd_setup(void)
     P(iommu_hap_pt_share, "Shared EPT tables");
 #undef P
 
-    ret = init_vtd_hw();
+    ret = init_vtd_hw(false);
     if ( ret )
         goto error;
 
@@ -2596,7 +2600,7 @@ static void vtd_resume(void)
     if ( !iommu_enabled )
         return;
 
-    if ( init_vtd_hw() != 0  && force_iommu )
+    if ( init_vtd_hw(true) != 0 && force_iommu )
          panic("IOMMU setup failed, crash Xen for security purpose\n");
 
     for_each_drhd_unit ( drhd )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 09:45:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 09:45:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114236.217621 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ9Pt-0002Wu-1R; Wed, 21 Apr 2021 09:45:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114236.217621; Wed, 21 Apr 2021 09:45: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 1lZ9Ps-0002Wl-Tl; Wed, 21 Apr 2021 09:45:04 +0000
Received: by outflank-mailman (input) for mailman id 114236;
 Wed, 21 Apr 2021 09:45: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 1lZ9Pr-0002Wd-IG
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:45: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 1lZ9Pr-0004cp-HU
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:45:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ9Pr-0008LK-Gg
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:45: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=+irGuRUUSVoTpW80zBuucdwgKCKENkHoJOa/xpo8EhI=; b=Na/Tt05u1Rxoxc9f2p3TCOwFY5
	0HKhRXN9Pw56rEoasQnQu/GwH22eVMCbxpqFREVZd9zMH6kgG/Lq7E8V1VoYPSyxq1kJh91Jeq8br
	Ts/ARy4ROCZYwyhEUc7ANHNfdkN6Js+V24j6clZ3sjjsbxsuHlXjgZVWq6W/sr8VeY2g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] VT-d: re-order register restoring in vtd_resume()
Message-Id: <E1lZ9Pr-0008LK-Gg@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 09:45:03 +0000

commit 4352a49dccc0b4a422e86aa5eae96ea466ba5a52
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:13:26 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:13:26 2021 +0200

    VT-d: re-order register restoring in vtd_resume()
    
    For one FECTL must be written last - the interrupt shouldn't be unmasked
    without first having written the data and address needed to actually
    deliver it. In the common case (when dma_msi_set_affinity() doesn't end
    up bailing early) this happens from init_vtd_hw(), but for this to
    actually have the intended effect we shouldn't subsequently overwrite
    what was written there - this is only benign when old and new settings
    match. Instead we should restore the registers ahead of calling
    init_vtd_hw(), just for the unlikely case of dma_msi_set_affinity()
    bailing early.
    
    In the moved code drop some stray casts as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 95e07f8c0e64889ee56015c7f99bdf5309e9e8ef
    master date: 2021-03-30 14:39:54 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index abbeb13988..1e4f800a1a 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2600,6 +2600,21 @@ static void vtd_resume(void)
     if ( !iommu_enabled )
         return;
 
+    for_each_drhd_unit ( drhd )
+    {
+        iommu = drhd->iommu;
+        i = iommu->index;
+
+        spin_lock_irqsave(&iommu->register_lock, flags);
+        dmar_writel(iommu->reg, DMAR_FEDATA_REG,
+                    iommu_state[i][DMAR_FEDATA_REG]);
+        dmar_writel(iommu->reg, DMAR_FEADDR_REG,
+                    iommu_state[i][DMAR_FEADDR_REG]);
+        dmar_writel(iommu->reg, DMAR_FEUADDR_REG,
+                    iommu_state[i][DMAR_FEUADDR_REG]);
+        spin_unlock_irqrestore(&iommu->register_lock, flags);
+    }
+
     if ( init_vtd_hw(true) != 0 && force_iommu )
          panic("IOMMU setup failed, crash Xen for security purpose\n");
 
@@ -2611,12 +2626,6 @@ static void vtd_resume(void)
         spin_lock_irqsave(&iommu->register_lock, flags);
         dmar_writel(iommu->reg, DMAR_FECTL_REG,
                     (u32) iommu_state[i][DMAR_FECTL_REG]);
-        dmar_writel(iommu->reg, DMAR_FEDATA_REG,
-                    (u32) iommu_state[i][DMAR_FEDATA_REG]);
-        dmar_writel(iommu->reg, DMAR_FEADDR_REG,
-                    (u32) iommu_state[i][DMAR_FEADDR_REG]);
-        dmar_writel(iommu->reg, DMAR_FEUADDR_REG,
-                    (u32) iommu_state[i][DMAR_FEUADDR_REG]);
         spin_unlock_irqrestore(&iommu->register_lock, flags);
 
         iommu_enable_translation(drhd);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 09:45:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 09:45:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114237.217623 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ9Q3-0002Yf-3W; Wed, 21 Apr 2021 09:45:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114237.217623; Wed, 21 Apr 2021 09:45: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 1lZ9Q3-0002YX-0Q; Wed, 21 Apr 2021 09:45:15 +0000
Received: by outflank-mailman (input) for mailman id 114237;
 Wed, 21 Apr 2021 09:45:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ9Q1-0002YO-MH
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:45: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 1lZ9Q1-0004dF-LY
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:45:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ9Q1-0008MP-Ju
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:45: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=S//vIhGLPNfqB3MJzZR4HHGFyEnrKSIp/KpvrzKdjs0=; b=FoD2sPp3l7Wk67Dl6cNX+jakmV
	tRwqDXre4uzrpsQoy0ookUVGLMOBVDatPMwOt50jMxULmSHWFvSzZciCwE4RQmTtmo2ZP/MJEXSyZ
	2TjyneSXfMX1n99l5fr+49G9bLpBJ+zz4KsKHt33foHkype52HW1UTw2Fvr9BMk5Zpco=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] VT-d: restore flush hooks when disabling qinval
Message-Id: <E1lZ9Q1-0008MP-Ju@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 09:45:13 +0000

commit 21e1ae3d2c80e606fc81be7a576c4a047c9dc879
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:13:53 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:13:53 2021 +0200

    VT-d: restore flush hooks when disabling qinval
    
    Leaving the hooks untouched is at best a latent risk: There may well be
    cases where some flush is needed, which then needs carrying out the
    "register" way.
    
    Switch from u<N> to uint<N>_t while needing to touch the function
    headers anyway.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 9c39dba2b179c0f4c42c98e97ea0878119718530
    master date: 2021-03-30 14:40:24 +0200
---
 xen/drivers/passthrough/vtd/extern.h | 10 ++++++++++
 xen/drivers/passthrough/vtd/iommu.c  | 19 ++++++++-----------
 xen/drivers/passthrough/vtd/qinval.c |  3 +++
 3 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index f776feefe6..1cac22a02f 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -50,6 +50,16 @@ int iommu_flush_iec_global(struct vtd_iommu *iommu);
 int iommu_flush_iec_index(struct vtd_iommu *iommu, u8 im, u16 iidx);
 void clear_fault_bits(struct vtd_iommu *iommu);
 
+int __must_check vtd_flush_context_reg(struct vtd_iommu *iommu, uint16_t did,
+                                       uint16_t source_id,
+                                       uint8_t function_mask, uint64_t type,
+                                       bool flush_non_present_entry);
+int __must_check vtd_flush_iotlb_reg(struct vtd_iommu *iommu, uint16_t did,
+                                     uint64_t addr, unsigned int size_order,
+                                     uint64_t type,
+                                     bool flush_non_present_entry,
+                                     bool flush_dev_iotlb);
+
 struct vtd_iommu *ioapic_to_iommu(unsigned int apic_id);
 struct vtd_iommu *hpet_to_iommu(unsigned int hpet_id);
 struct acpi_drhd_unit *ioapic_to_drhd(unsigned int apic_id);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 1e4f800a1a..01a2a461ba 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -327,10 +327,9 @@ static void iommu_flush_write_buffer(struct vtd_iommu *iommu)
 }
 
 /* return value determine if we need a write buffer flush */
-static int __must_check flush_context_reg(struct vtd_iommu *iommu, u16 did,
-                                          u16 source_id, u8 function_mask,
-                                          u64 type,
-                                          bool flush_non_present_entry)
+int vtd_flush_context_reg(struct vtd_iommu *iommu, uint16_t did,
+                          uint16_t source_id, uint8_t function_mask,
+                          uint64_t type, bool flush_non_present_entry)
 {
     u64 val = 0;
     unsigned long flags;
@@ -396,11 +395,9 @@ static int __must_check iommu_flush_context_device(struct vtd_iommu *iommu,
 }
 
 /* return value determine if we need a write buffer flush */
-static int __must_check flush_iotlb_reg(struct vtd_iommu *iommu, u16 did,
-                                        u64 addr,
-                                        unsigned int size_order, u64 type,
-                                        bool flush_non_present_entry,
-                                        bool flush_dev_iotlb)
+int vtd_flush_iotlb_reg(struct vtd_iommu *iommu, uint16_t did, uint64_t addr,
+                        unsigned int size_order, uint64_t type,
+                        bool flush_non_present_entry, bool flush_dev_iotlb)
 {
     int tlb_offset = ecap_iotlb_offset(iommu->ecap);
     u64 val = 0;
@@ -2161,8 +2158,8 @@ static int __must_check init_vtd_hw(bool resume)
          */
         if ( enable_qinval(iommu) != 0 )
         {
-            iommu->flush.context = flush_context_reg;
-            iommu->flush.iotlb   = flush_iotlb_reg;
+            iommu->flush.context = vtd_flush_context_reg;
+            iommu->flush.iotlb   = vtd_flush_iotlb_reg;
         }
     }
 
diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c
index 39b7abd009..764ef9f0fc 100644
--- a/xen/drivers/passthrough/vtd/qinval.c
+++ b/xen/drivers/passthrough/vtd/qinval.c
@@ -462,4 +462,7 @@ void disable_qinval(struct vtd_iommu *iommu)
                   !(sts & DMA_GSTS_QIES), sts);
 out:
     spin_unlock_irqrestore(&iommu->register_lock, flags);
+
+    iommu->flush.context = vtd_flush_context_reg;
+    iommu->flush.iotlb   = vtd_flush_iotlb_reg;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 09:45:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 09:45:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114238.217627 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ9QD-0002Zp-4z; Wed, 21 Apr 2021 09:45:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114238.217627; Wed, 21 Apr 2021 09:45: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 1lZ9QD-0002Zh-21; Wed, 21 Apr 2021 09:45:25 +0000
Received: by outflank-mailman (input) for mailman id 114238;
 Wed, 21 Apr 2021 09:45: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 1lZ9QB-0002ZX-PI
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:45: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 1lZ9QB-0004dM-OY
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:45:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ9QB-0008N5-Nq
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:45: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=dAw3485PHNS6SK5uQF3Hq8UeQemZj6NviZugTNz7j9o=; b=r37LxGbXGJOhDEK48yMbQX9hgL
	1DL3h//fWwX5EmZ55f5ucwmmHpZyTNfrZJdw1X8OKfyFxpfhEdt+6wFAKMqISW0+sFVpL3cw8IrWZ
	ptTMC3iisN6UxHPcqeE4jvhFN1fnNTySanunGI+q6W3Qn31Ze6ZZbHcMpmLAuV+rtwA0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] fix for_each_cpu() again for NR_CPUS=1
Message-Id: <E1lZ9QB-0008N5-Nq@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 09:45:23 +0000

commit 0e711a09359e3cf95dc591ec04d8df4f84a35b03
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:14:34 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:14:34 2021 +0200

    fix for_each_cpu() again for NR_CPUS=1
    
    Unfortunately aa50f45332f1 ("xen: fix for_each_cpu when NR_CPUS=1") has
    caused quite a bit of fallout with gcc10, e.g. (there are at least two
    more similar ones, and I didn't bother trying to find them all):
    
    In file included from .../xen/include/xen/config.h:13,
                     from <command-line>:
    core_parking.c: In function ‘core_parking_power’:
    .../xen/include/asm/percpu.h:12:51: error: array subscript 1 is above array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds]
       12 |     (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
    .../xen/include/xen/compiler.h:141:29: note: in definition of macro ‘RELOC_HIDE’
      141 |     (typeof(ptr)) (__ptr + (off)); })
          |                             ^~~
    core_parking.c:133:39: note: in expansion of macro ‘per_cpu’
      133 |             core_tmp = cpumask_weight(per_cpu(cpu_core_mask, cpu));
          |                                       ^~~~~~~
    In file included from .../xen/include/xen/percpu.h:4,
                     from .../xen/include/asm/msr.h:7,
                     from .../xen/include/asm/time.h:5,
                     from .../xen/include/xen/time.h:76,
                     from .../xen/include/xen/spinlock.h:4,
                     from .../xen/include/xen/cpu.h:5,
                     from core_parking.c:19:
    .../xen/include/asm/percpu.h:6:22: note: while referencing ‘__per_cpu_offset’
        6 | extern unsigned long __per_cpu_offset[NR_CPUS];
          |                      ^~~~~~~~~~~~~~~~
    
    One of the further errors even went as far as claiming that an array
    index (range) of [0, 0] was outside the bounds of a [1] array, so
    something fishy is pretty clearly going on there.
    
    The compiler apparently wants to be able to see that the loop isn't
    really a loop in order to avoid triggering such warnings, yet what
    exactly makes it consider the loop exit condition constant and within
    the [0, 1] range isn't obvious - using ((mask)->bits[0] & 1) instead of
    cpumask_test_cpu() for example did _not_ help.
    
    Re-instate a special form of for_each_cpu(), experimentally "proven" to
    avoid the diagnostics.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
    master commit: 625faf9f002bd6ff4b6457a016b8ff338223b659
    master date: 2021-04-07 12:24:45 +0200
---
 xen/include/xen/cpumask.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/xen/cpumask.h b/xen/include/xen/cpumask.h
index e69589fc08..9826707909 100644
--- a/xen/include/xen/cpumask.h
+++ b/xen/include/xen/cpumask.h
@@ -368,10 +368,15 @@ static inline void free_cpumask_var(cpumask_var_t mask)
 #define FREE_CPUMASK_VAR(m) free_cpumask_var(m)
 #endif
 
+#if NR_CPUS > 1
 #define for_each_cpu(cpu, mask)			\
 	for ((cpu) = cpumask_first(mask);	\
 	     (cpu) < nr_cpu_ids;		\
 	     (cpu) = cpumask_next(cpu, mask))
+#else /* NR_CPUS == 1 */
+#define for_each_cpu(cpu, mask)			\
+	for ((cpu) = 0; (cpu) < cpumask_test_cpu(0, mask); ++(cpu))
+#endif /* NR_CPUS */
 
 /*
  * The following particular system cpumasks and operations manage
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 09:45:35 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 09:45:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114239.217631 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ9QN-0002b0-6R; Wed, 21 Apr 2021 09:45:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114239.217631; Wed, 21 Apr 2021 09:45: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 1lZ9QN-0002as-3R; Wed, 21 Apr 2021 09:45:35 +0000
Received: by outflank-mailman (input) for mailman id 114239;
 Wed, 21 Apr 2021 09:45:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ9QL-0002ak-T1
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:45: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 1lZ9QL-0004dW-RR
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:45:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ9QL-0008OB-Qo
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:45: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=yhb7QCst9okMmiCW+0dejg8sSPYXthCv8bVphIY7QoY=; b=33I4HFYxzqWCI8s9sFoJ39NnE/
	5ITbge0Ik3a3JjCH9eJHFI/6/+CooKD5n6T2KDM81BPzDYYpv7Hc0Je6nh68hRKXlQT1ChBPRcJ+H
	pidGsWakNZI5OO1OEYk026z1HrQM8907Ph9zhQctqbIOW5RD++0afN03yk2BMby33NoQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] x86/vpt: do not take pt_migrate rwlock in some cases
Message-Id: <E1lZ9QL-0008OB-Qo@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 09:45:33 +0000

commit 8113b02f0bf85b69e9180da63b43a12a274ea04b
Author:     Boris Ostrovsky <boris.ostrovsky@oracle.com>
AuthorDate: Tue Apr 20 12:15:12 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:15:12 2021 +0200

    x86/vpt: do not take pt_migrate rwlock in some cases
    
    Commit 8e76aef72820 ("x86/vpt: fix race when migrating timers between
    vCPUs") addressed XSA-336 by introducing a per-domain rwlock that was
    intended to protect periodic timer during VCPU migration. Since such
    migration is an infrequent event no performance impact was expected.
    
    Unfortunately this turned out not to be the case: on a fairly large
    guest (92 VCPUs) we've observed as much as 40% TPCC performance
    regression with some guest kernels. Further investigation pointed to
    pt_migrate read lock taken in pt_update_irq() as the largest contributor
    to this regression. With large number of VCPUs and large number of VMEXITs
    (from where pt_update_irq() is always called) the update of an atomic in
    read_lock() is thought to be the main cause.
    
    Stephen Brennan analyzed locking pattern and classified lock users as
    follows:
    
    1. Functions which read (maybe write) all periodic_time instances attached
    to a particular vCPU. These are functions which use pt_vcpu_lock() such
    as pt_restore_timer(), pt_save_timer(), etc.
    2. Functions which want to modify a particular periodic_time object.
    These functions lock whichever vCPU the periodic_time is attached to, but
    since the vCPU could be modified without holding any lock, they are
    vulnerable to XSA-336. Functions in this group use pt_lock(), such as
    pt_timer_fn() or destroy_periodic_time().
    3. Functions which not only want to modify the periodic_time, but also
    would like to modify the =vcpu= fields. These are create_periodic_time()
    or pt_adjust_vcpu(). They create XSA-336 conditions for group 2, but we
    can't simply hold 2 vcpu locks due to the deadlock risk.
    
    Roger then pointed out that group 1 functions don't really need to hold
    the pt_migrate rwlock and that instead groups 2 and 3 should hold per-vcpu
    lock whenever they modify per-vcpu timer lists.
    
    Suggested-by: Stephen Brennan <stephen.s.brennan@oracle.com>
    Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Stephen Brennan <stephen.s.brennan@oracle.com>
    master commit: 1f3d87c7512975274cc45c40097b05550eba1ac9
    master date: 2021-04-09 09:21:27 +0200
---
 xen/arch/x86/hvm/vpt.c        | 44 ++++++++++++++++++++++++++++++++++---------
 xen/include/asm-x86/hvm/vpt.h | 18 ++++++++++++------
 2 files changed, 47 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 6d5f98767c..a644e3ce53 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -152,32 +152,43 @@ static int pt_irq_masked(struct periodic_time *pt)
     return 1;
 }
 
+/*
+ * Functions which read (maybe write) all periodic_time instances
+ * attached to a particular vCPU use pt_vcpu_{un}lock locking helpers.
+ *
+ * Such users are explicitly forbidden from changing the value of the
+ * pt->vcpu field, because another thread holding the pt_migrate lock
+ * may already be spinning waiting for your vcpu lock.
+ */
 static void pt_vcpu_lock(struct vcpu *v)
 {
-    read_lock(&v->domain->arch.hvm.pl_time->pt_migrate);
     spin_lock(&v->arch.hvm.tm_lock);
 }
 
 static void pt_vcpu_unlock(struct vcpu *v)
 {
     spin_unlock(&v->arch.hvm.tm_lock);
-    read_unlock(&v->domain->arch.hvm.pl_time->pt_migrate);
 }
 
+/*
+ * Functions which want to modify a particular periodic_time object
+ * use pt_{un}lock locking helpers.
+ *
+ * These users lock whichever vCPU the periodic_time is attached to,
+ * but since the vCPU could be modified without holding any lock, they
+ * need to take an additional lock that protects against pt->vcpu
+ * changing.
+ */
 static void pt_lock(struct periodic_time *pt)
 {
-    /*
-     * We cannot use pt_vcpu_lock here, because we need to acquire the
-     * per-domain lock first and then (re-)fetch the value of pt->vcpu, or
-     * else we might be using a stale value of pt->vcpu.
-     */
     read_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
     spin_lock(&pt->vcpu->arch.hvm.tm_lock);
 }
 
 static void pt_unlock(struct periodic_time *pt)
 {
-    pt_vcpu_unlock(pt->vcpu);
+    spin_unlock(&pt->vcpu->arch.hvm.tm_lock);
+    read_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
 }
 
 static void pt_process_missed_ticks(struct periodic_time *pt)
@@ -542,8 +553,10 @@ void create_periodic_time(
     pt->cb = cb;
     pt->priv = data;
 
+    pt_vcpu_lock(v);
     pt->on_list = 1;
     list_add(&pt->list, &v->arch.hvm.tm_list);
+    pt_vcpu_unlock(v);
 
     init_timer(&pt->timer, pt_timer_fn, pt, v->processor);
     set_timer(&pt->timer, pt->scheduled);
@@ -579,13 +592,26 @@ static void pt_adjust_vcpu(struct periodic_time *pt, struct vcpu *v)
         return;
 
     write_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
+
+    if ( pt->vcpu == v )
+        goto out;
+
+    pt_vcpu_lock(pt->vcpu);
+    if ( pt->on_list )
+        list_del(&pt->list);
+    pt_vcpu_unlock(pt->vcpu);
+
     pt->vcpu = v;
+
+    pt_vcpu_lock(v);
     if ( pt->on_list )
     {
-        list_del(&pt->list);
         list_add(&pt->list, &v->arch.hvm.tm_list);
         migrate_timer(&pt->timer, v->processor);
     }
+    pt_vcpu_unlock(v);
+
+ out:
     write_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
 }
 
diff --git a/xen/include/asm-x86/hvm/vpt.h b/xen/include/asm-x86/hvm/vpt.h
index e2cdba4280..32d6a16ea1 100644
--- a/xen/include/asm-x86/hvm/vpt.h
+++ b/xen/include/asm-x86/hvm/vpt.h
@@ -134,12 +134,18 @@ struct pl_time {    /* platform time */
     struct RTCState  vrtc;
     struct HPETState vhpet;
     struct PMTState  vpmt;
-    /*
-     * rwlock to prevent periodic_time vCPU migration. Take the lock in read
-     * mode in order to prevent the vcpu field of periodic_time from changing.
-     * Lock must be taken in write mode when changes to the vcpu field are
-     * performed, as it allows exclusive access to all the timers of a domain.
-     */
+     /*
+      * Functions which want to modify the vcpu field of the vpt need
+      * to hold the global lock (pt_migrate) in write mode together
+      * with the per-vcpu locks of the lists being modified. Functions
+      * that want to lock a periodic_timer that's possibly on a
+      * different vCPU list need to take the lock in read mode first in
+      * order to prevent the vcpu field of periodic_timer from
+      * changing.
+      *
+      * Note that two vcpu locks cannot be held at the same time to
+      * avoid a deadlock.
+      */
     rwlock_t pt_migrate;
     /* guest_time = Xen sys time + stime_offset */
     int64_t stime_offset;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 09:45:45 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 09:45:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114240.217635 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ9QX-0002cQ-7l; Wed, 21 Apr 2021 09:45:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114240.217635; Wed, 21 Apr 2021 09:45: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 1lZ9QX-0002cH-4t; Wed, 21 Apr 2021 09:45:45 +0000
Received: by outflank-mailman (input) for mailman id 114240;
 Wed, 21 Apr 2021 09:45: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 1lZ9QV-0002cA-Vk
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:45:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ9QV-0004dj-Uw
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:45:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ9QV-0008PC-Tu
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:45:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fFCcmfkUN1fd/QiSAUfd/4dY+kIRPxkP8rvO3VfWKFs=; b=TtQPQ74oZQ8COExz1Z305bwUwy
	oIIoGuFo3Avl6jHStwEnB4uqw4VS+kpqs2/TEO7+xjNs3SawxyXbOIiymwRXB7fxywQ9mOT7DZhZc
	8wusmKmsIODCW4tmwu4NqyTm1tZJ/L7nMuDKymVarQgBmUdEoqQFhcAO4NmBxjYINlyM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] x86/hpet: Factor hpet_enable_legacy_replacement_mode() out of hpet_setup()
Message-Id: <E1lZ9QV-0008PC-Tu@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 09:45:43 +0000

commit 53f4ce9df0d3d1e61b6d2d758eb9a43bba80ff11
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Apr 20 12:15:50 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:15:50 2021 +0200

    x86/hpet: Factor hpet_enable_legacy_replacement_mode() out of hpet_setup()
    
    ... in preparation to introduce a second caller.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Frédéric Pierret <frederic.pierret@qubes-os.org>
    master commit: 238168b5bcd27fec97704f6295fa5bf7a442eb6f
    master date: 2021-04-15 18:25:40 +0100
---
 xen/arch/x86/hpet.c        | 116 ++++++++++++++++++++++++---------------------
 xen/include/asm-x86/hpet.h |   6 +++
 2 files changed, 68 insertions(+), 54 deletions(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 86b4e88f9b..d19646f818 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -763,11 +763,70 @@ int hpet_legacy_irq_tick(void)
 }
 
 static u32 *hpet_boot_cfg;
+static uint64_t __initdata hpet_rate;
+
+bool __init hpet_enable_legacy_replacement_mode(void)
+{
+    unsigned int cfg, c0_cfg, ticks, count;
+
+    if ( !hpet_rate ||
+         !(hpet_read32(HPET_ID) & HPET_ID_LEGSUP) ||
+         ((cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
+        return false;
+
+    /* Stop the main counter. */
+    hpet_write32(cfg & ~HPET_CFG_ENABLE, HPET_CFG);
+
+    /* Reconfigure channel 0 to be 32bit periodic. */
+    c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+    c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
+               HPET_TN_32BIT);
+    hpet_write32(c0_cfg, HPET_Tn_CFG(0));
+
+    /*
+     * The exact period doesn't have to match a legacy PIT.  All we need
+     * is an interrupt queued up via the IO-APIC to check routing.
+     *
+     * Use HZ as the frequency.
+     */
+    ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
+
+    count = hpet_read32(HPET_COUNTER);
+
+    /*
+     * HPET_TN_SETVAL above is atrociously documented in the spec.
+     *
+     * Periodic HPET channels have a main comparator register, and
+     * separate "accumulator" register.  Despite being named accumulator
+     * in the spec, this is not an accurate description of its behaviour
+     * or purpose.
+     *
+     * Each time an interrupt is generated, the "accumulator" register is
+     * re-added to the comparator set up the new period.
+     *
+     * Normally, writes to the CMP register update both registers.
+     * However, under these semantics, it is impossible to set up a
+     * periodic timer correctly without the main HPET counter being at 0.
+     *
+     * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
+     * use for periodic timers to mean that the second write to CMP
+     * updates the accumulator only, and not the absolute comparator
+     * value.
+     *
+     * This lets us set a period when the main counter isn't at 0.
+     */
+    hpet_write32(count + ticks, HPET_Tn_CMP(0));
+    hpet_write32(ticks,         HPET_Tn_CMP(0));
+
+    /* Restart the main counter, and legacy mode. */
+    hpet_write32(cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
+
+    return true;
+}
 
 u64 __init hpet_setup(void)
 {
-    static u64 __initdata hpet_rate;
-    unsigned int hpet_id, hpet_period, hpet_cfg;
+    unsigned int hpet_id, hpet_period;
     unsigned int last;
 
     if ( hpet_rate )
@@ -812,58 +871,7 @@ u64 __init hpet_setup(void)
      * Reconfigure the HPET into legacy mode to re-establish the timer
      * interrupt.
      */
-    if ( hpet_id & HPET_ID_LEGSUP &&
-         !((hpet_cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
-    {
-        unsigned int c0_cfg, ticks, count;
-
-        /* Stop the main counter. */
-        hpet_write32(hpet_cfg & ~HPET_CFG_ENABLE, HPET_CFG);
-
-        /* Reconfigure channel 0 to be 32bit periodic. */
-        c0_cfg = hpet_read32(HPET_Tn_CFG(0));
-        c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
-                   HPET_TN_32BIT);
-        hpet_write32(c0_cfg, HPET_Tn_CFG(0));
-
-        /*
-         * The exact period doesn't have to match a legacy PIT.  All we need
-         * is an interrupt queued up via the IO-APIC to check routing.
-         *
-         * Use HZ as the frequency.
-         */
-        ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
-
-        count = hpet_read32(HPET_COUNTER);
-
-        /*
-         * HPET_TN_SETVAL above is atrociously documented in the spec.
-         *
-         * Periodic HPET channels have a main comparator register, and
-         * separate "accumulator" register.  Despite being named accumulator
-         * in the spec, this is not an accurate description of its behaviour
-         * or purpose.
-         *
-         * Each time an interrupt is generated, the "accumulator" register is
-         * re-added to the comparator set up the new period.
-         *
-         * Normally, writes to the CMP register update both registers.
-         * However, under these semantics, it is impossible to set up a
-         * periodic timer correctly without the main HPET counter being at 0.
-         *
-         * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
-         * use for periodic timers to mean that the second write to CMP
-         * updates the accumulator only, and not the absolute comparator
-         * value.
-         *
-         * This lets us set a period when the main counter isn't at 0.
-         */
-        hpet_write32(count + ticks, HPET_Tn_CMP(0));
-        hpet_write32(ticks,         HPET_Tn_CMP(0));
-
-        /* Restart the main counter, and legacy mode. */
-        hpet_write32(hpet_cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
-    }
+    hpet_enable_legacy_replacement_mode();
 
     return hpet_rate;
 }
diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h
index fb6bf05065..50176de3d2 100644
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -72,6 +72,12 @@ void hpet_disable(void);
  */
 int hpet_legacy_irq_tick(void);
 
+/*
+ * Try to enable HPET Legacy Replacement mode.  Returns a boolean indicating
+ * whether the HPET configuration was changed.
+ */
+bool hpet_enable_legacy_replacement_mode(void);
+
 /*
  * Temporarily use an HPET event counter for timer interrupt handling,
  * rather than using the LAPIC timer. Used for Cx state entry.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 09:45:55 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 09:45:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114241.217639 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZ9Qh-0002dc-A4; Wed, 21 Apr 2021 09:45:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114241.217639; Wed, 21 Apr 2021 09:45: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 1lZ9Qh-0002dU-6W; Wed, 21 Apr 2021 09:45:55 +0000
Received: by outflank-mailman (input) for mailman id 114241;
 Wed, 21 Apr 2021 09:45: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 1lZ9Qg-0002dL-43
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:45: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 1lZ9Qg-0004dp-3E
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:45:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZ9Qg-0008Q9-1z
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 09:45: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=+PKKmXNBMcsuRpJx8IPi9r1aoVpT9LpGeAFI6SVA+MQ=; b=BwgCtAMQrDiKt65ZZv92TuTDqp
	DihmUSz+QtNQY5mJTQ3YNC2JX6d5KcEJ303sh5ZUE4DMc3MdVHRiacjkwzgKQE4xgE90OsH6+WVxP
	7jH99DPPfIAvLTJCS9GU79BXzgUDmsuiKwfYUn5EywF0AD271XkBTXdA2+qRv7MKvCwU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.13] x86/hpet: Don't enable legacy replacement mode unconditionally
Message-Id: <E1lZ9Qg-0008Q9-1z@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 09:45:54 +0000

commit 33049e3ad9c3a0f7432969f4b5d7b1a287b5b8f9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:16:19 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:16:19 2021 +0200

    x86/hpet: Don't enable legacy replacement mode unconditionally
    
    Commit e1de4c196a2e ("x86/timer: Fix boot on Intel systems using ITSSPRC
    static PIT clock gating") was reported to cause boot failures on certain
    AMD Ryzen systems.
    
    Refine the fix to do nothing in the default case, and only attempt to
    configure legacy replacement mode if IRQ0 is found to not be working.  If
    legacy replacement mode doesn't help, undo it before falling back to other IRQ
    routing configurations.
    
    In addition, introduce a "hpet" command line option so this heuristic
    can be overridden.  Since it makes little sense to introduce just
    "hpet=legacy-replacement", also allow for a boolean argument as well as
    "broadcast" to replace the separate "hpetbroadcast" option.
    
    Reported-by: Frédéric Pierret frederic.pierret@qubes-os.org
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Frédéric Pierret <frederic.pierret@qubes-os.org>
    master commit: b53173e7cdafb7a318a239d557478fd73734a86a
    master date: 2021-04-15 18:25:40 +0100
---
 docs/misc/xen-command-line.pandoc | 33 +++++++++++++++++
 xen/arch/x86/hpet.c               | 75 +++++++++++++++++++++++++++++----------
 xen/arch/x86/io_apic.c            | 31 ++++++++++++++++
 xen/include/asm-x86/hpet.h        |  7 ++++
 4 files changed, 128 insertions(+), 18 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 125b4f330b..0b6ec8b6a1 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1190,9 +1190,42 @@ supported. See docs/misc/arm/big.LITTLE.txt for more information.
 When the hmp-unsafe option is disabled (default), CPUs that are not
 identical to the boot CPU will be parked and not used by Xen.
 
+### hpet
+    = List of [ <bool> | broadcast=<bool> | legacy-replacement=<bool> ]
+
+    Applicability: x86
+
+Controls Xen's use of the system's High Precision Event Timer.  By default,
+Xen will use an HPET when available and not subject to errata.  Use of the
+HPET can be disabled by specifying `hpet=0`.
+
+ * The `broadcast` boolean is disabled by default, but forces Xen to keep
+   using the broadcast for CPUs in deep C-states even when an RTC interrupt is
+   enabled.  This then also affects raising of the RTC interrupt.
+
+ * The `legacy-replacement` boolean allows for control over whether Legacy
+   Replacement mode is enabled.
+
+   Legacy Replacement mode is intended for hardware which does not have an
+   8254 PIT, and allows the HPET to be configured into a compatible mode.
+   Intel chipsets from Skylake/ApolloLake onwards can turn the PIT off for
+   power saving reasons, and there is no platform-agnostic mechanism for
+   discovering this.
+
+   By default, Xen will not change hardware configuration, unless the PIT
+   appears to be absent, at which point Xen will try to enable Legacy
+   Replacement mode before falling back to pre-IO-APIC interrupt routing
+   options.
+
+   This behaviour can be inhibited by specifying `legacy-replacement=0`.
+   Alternatively, this mode can be enabled unconditionally (if available) by
+   specifying `legacy-replacement=1`.
+
 ### hpetbroadcast (x86)
 > `= <boolean>`
 
+Deprecated alternative of `hpet=broadcast`.
+
 ### hvm_debug (x86)
 > `= <integer>`
 
diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index d19646f818..927ed83c61 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -51,6 +51,8 @@ static unsigned int __read_mostly num_hpets_used;
 DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel);
 
 unsigned long __initdata hpet_address;
+int8_t __initdata opt_hpet_legacy_replacement = -1;
+static bool __initdata opt_hpet = true;
 u8 __initdata hpet_blockid;
 u8 __initdata hpet_flags;
 
@@ -62,6 +64,32 @@ u8 __initdata hpet_flags;
 static bool __initdata force_hpet_broadcast;
 boolean_param("hpetbroadcast", force_hpet_broadcast);
 
+static int __init parse_hpet_param(const char *s)
+{
+    const char *ss;
+    int val, rc = 0;
+
+    do {
+        ss = strchr(s, ',');
+        if ( !ss )
+            ss = strchr(s, '\0');
+
+        if ( (val = parse_bool(s, ss)) >= 0 )
+            opt_hpet = val;
+        else if ( (val = parse_boolean("broadcast", s, ss)) >= 0 )
+            force_hpet_broadcast = val;
+        else if ( (val = parse_boolean("legacy-replacement", s, ss)) >= 0 )
+            opt_hpet_legacy_replacement = val;
+        else
+            rc = -EINVAL;
+
+        s = ss + 1;
+    } while ( *ss );
+
+    return rc;
+}
+custom_param("hpet", parse_hpet_param);
+
 /*
  * Calculate a multiplication factor for scaled math, which is used to convert
  * nanoseconds based values to clock ticks:
@@ -764,6 +792,9 @@ int hpet_legacy_irq_tick(void)
 
 static u32 *hpet_boot_cfg;
 static uint64_t __initdata hpet_rate;
+static __initdata struct {
+    uint32_t cmp, cfg;
+} pre_legacy_c0;
 
 bool __init hpet_enable_legacy_replacement_mode(void)
 {
@@ -777,8 +808,11 @@ bool __init hpet_enable_legacy_replacement_mode(void)
     /* Stop the main counter. */
     hpet_write32(cfg & ~HPET_CFG_ENABLE, HPET_CFG);
 
+    /* Stash channel 0's old CFG/CMP incase we need to undo. */
+    pre_legacy_c0.cfg = c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+    pre_legacy_c0.cmp = hpet_read32(HPET_Tn_CMP(0));
+
     /* Reconfigure channel 0 to be 32bit periodic. */
-    c0_cfg = hpet_read32(HPET_Tn_CFG(0));
     c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
                HPET_TN_32BIT);
     hpet_write32(c0_cfg, HPET_Tn_CFG(0));
@@ -824,17 +858,33 @@ bool __init hpet_enable_legacy_replacement_mode(void)
     return true;
 }
 
+void __init hpet_disable_legacy_replacement_mode(void)
+{
+    unsigned int cfg = hpet_read32(HPET_CFG);
+
+    ASSERT(hpet_rate);
+
+    cfg &= ~(HPET_CFG_LEGACY | HPET_CFG_ENABLE);
+
+    /* Stop the main counter and disable legacy mode. */
+    hpet_write32(cfg, HPET_CFG);
+
+    /* Restore pre-Legacy Replacement Mode settings. */
+    hpet_write32(pre_legacy_c0.cfg, HPET_Tn_CFG(0));
+    hpet_write32(pre_legacy_c0.cmp, HPET_Tn_CMP(0));
+
+    /* Restart the main counter. */
+    hpet_write32(cfg | HPET_CFG_ENABLE, HPET_CFG);
+}
+
 u64 __init hpet_setup(void)
 {
     unsigned int hpet_id, hpet_period;
     unsigned int last;
 
-    if ( hpet_rate )
+    if ( hpet_rate || !hpet_address || !opt_hpet )
         return hpet_rate;
 
-    if ( hpet_address == 0 )
-        return 0;
-
     set_fixmap_nocache(FIX_HPET_BASE, hpet_address);
 
     hpet_id = hpet_read32(HPET_ID);
@@ -859,19 +909,8 @@ u64 __init hpet_setup(void)
     hpet_rate = 1000000000000000ULL; /* 10^15 */
     (void)do_div(hpet_rate, hpet_period);
 
-    /*
-     * Intel chipsets from Skylake/ApolloLake onwards can statically clock
-     * gate the 8259 PIT.  This option is enabled by default in slightly later
-     * systems, as turning the PIT off is a prerequisite to entering the C11
-     * power saving state.
-     *
-     * Xen currently depends on the legacy timer interrupt being active while
-     * IRQ routing is configured.
-     *
-     * Reconfigure the HPET into legacy mode to re-establish the timer
-     * interrupt.
-     */
-    hpet_enable_legacy_replacement_mode();
+    if ( opt_hpet_legacy_replacement > 0 )
+        hpet_enable_legacy_replacement_mode();
 
     return hpet_rate;
 }
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index e710827dcf..3eddf8e00a 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -28,6 +28,8 @@
 #include <xen/acpi.h>
 #include <xen/keyhandler.h>
 #include <xen/softirq.h>
+
+#include <asm/hpet.h>
 #include <asm/mc146818rtc.h>
 #include <asm/smp.h>
 #include <asm/desc.h>
@@ -1928,6 +1930,35 @@ static void __init check_timer(void)
             local_irq_restore(flags);
             return;
         }
+
+        /*
+         * Intel chipsets from Skylake/ApolloLake onwards can statically clock
+         * gate the 8254 PIT.  This option is enabled by default in slightly
+         * later systems, as turning the PIT off is a prerequisite to entering
+         * the C11 power saving state.
+         *
+         * Xen currently depends on the legacy timer interrupt being active
+         * while IRQ routing is configured.
+         *
+         * If the user hasn't made an explicit choice, attempt to reconfigure
+         * the HPET into legacy mode to re-establish the timer interrupt.
+         */
+        if ( opt_hpet_legacy_replacement < 0 &&
+             hpet_enable_legacy_replacement_mode() )
+        {
+            printk(XENLOG_ERR "..no 8254 timer found - trying HPET Legacy Replacement Mode\n");
+
+            if ( timer_irq_works() )
+            {
+                local_irq_restore(flags);
+                return;
+            }
+
+            /* Legacy Replacement mode hasn't helped.  Undo it. */
+            printk(XENLOG_ERR "..no HPET timer found - reverting Legacy Replacement Mode\n");
+            hpet_disable_legacy_replacement_mode();
+        }
+
         clear_IO_APIC_pin(apic1, pin1);
         printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to "
                "IO-APIC\n");
diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h
index 50176de3d2..8f9725a95e 100644
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -53,6 +53,7 @@
 extern unsigned long hpet_address;
 extern u8 hpet_blockid;
 extern u8 hpet_flags;
+extern int8_t opt_hpet_legacy_replacement;
 
 /*
  * Detect and initialise HPET hardware: return counter update frequency.
@@ -78,6 +79,12 @@ int hpet_legacy_irq_tick(void);
  */
 bool hpet_enable_legacy_replacement_mode(void);
 
+/*
+ * Undo the effects of hpet_disable_legacy_replacement_mode().  Must not be
+ * called unless enable() returned true.
+ */
+void hpet_disable_legacy_replacement_mode(void);
+
 /*
  * Temporarily use an HPET event counter for timer interrupt handling,
  * rather than using the LAPIC timer. Used for Cx state entry.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 12:55:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 12:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114474.218153 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZCNj-0007id-Or; Wed, 21 Apr 2021 12:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114474.218153; Wed, 21 Apr 2021 12: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 1lZCNj-0007iV-Lv; Wed, 21 Apr 2021 12:55:03 +0000
Received: by outflank-mailman (input) for mailman id 114474;
 Wed, 21 Apr 2021 12: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 1lZCNi-0007iQ-L8
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12: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 1lZCNi-0007x9-JQ
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZCNi-0006j9-GZ
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12: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=gYEsgCiJjARwG/RYP52ufLZXtjEoUaK7x60Oy9D2lSE=; b=ak/vd0/YecsNVqexJzTg8X3P2c
	dWBGAjm6fin351x7ngSNsvyePPhpwK/z7V5HTIUWUJtBWMg7pDoFH6R8/ldsPp5JCIl15CfsMC2NQ
	NWZTzJ76jkBQDq78SobO8DkB6tWlaDM+ueuIVkjvHkwIUnzSy1hVSR5CXmnHzlWfNxVU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] VT-d: correct off-by-1 in number-of-IOMMUs check
Message-Id: <E1lZCNi-0006j9-GZ@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 12:55:02 +0000

commit 0c4caea34a16173a14074327992122e895984cea
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:01:40 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:01:40 2021 +0200

    VT-d: correct off-by-1 in number-of-IOMMUs check
    
    Otherwise, if we really run on a system with this many IOMMUs,
    entering/leaving S3 would overrun iommu_state[].
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: b9b3082002cac68726fb303e0abd2ff0113d4657
    master date: 2021-03-23 17:01:30 +0100
---
 xen/drivers/passthrough/vtd/iommu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 58128be8b5..ca09cd515c 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1163,10 +1163,10 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
     unsigned long sagaw, nr_dom;
     int agaw;
 
-    if ( nr_iommus > MAX_IOMMUS )
+    if ( nr_iommus >= MAX_IOMMUS )
     {
         dprintk(XENLOG_ERR VTDPREFIX,
-                 "IOMMU: nr_iommus %d > MAX_IOMMUS\n", nr_iommus);
+                "IOMMU: nr_iommus %d > MAX_IOMMUS\n", nr_iommus + 1);
         return -ENOMEM;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 12:55:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 12:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114475.218156 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZCNt-0007jo-Qg; Wed, 21 Apr 2021 12:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114475.218156; Wed, 21 Apr 2021 12: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 1lZCNt-0007jg-NY; Wed, 21 Apr 2021 12:55:13 +0000
Received: by outflank-mailman (input) for mailman id 114475;
 Wed, 21 Apr 2021 12: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 1lZCNs-0007jZ-Ni
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12: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 1lZCNs-0007xC-Ms
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZCNs-0006jl-Lt
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12: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=7owtwbAn97HdEmAnAo4cPN4LvqgZujgszj1cwNqNQss=; b=2CsHM93gDbEG2VFRLUjA+LMOBA
	uCWvUm3PvMWy1zNuXBfVHEyfPkyYsmKbdGfrdUYgi+hBzNxVh+4nVxAleUA/ZXZLzG54Lpon5arVU
	vn3Ij546A5BrnQGgmmrFSXKKaK5g2Y7Ga8FTnGiXnbHSsKwngdZu2KfqGbEy2D75JrCg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] VT-d: leave FECTL write to vtd_resume()
Message-Id: <E1lZCNs-0006jl-Lt@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 12:55:12 +0000

commit e9f10a9add1fb81475b5c6ef0fbc1b423dac3dad
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:02:11 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:02:11 2021 +0200

    VT-d: leave FECTL write to vtd_resume()
    
    We shouldn't blindly unmask the interrupt when resuming. vtd_resume()
    will restore the intended state.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 0d597e7bd1bd8a57619690d457f79769777a5834
    master date: 2021-03-30 14:39:23 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index ca09cd515c..db1171ce0c 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2112,7 +2112,7 @@ static int adjust_vtd_irq_affinities(void)
 }
 __initcall(adjust_vtd_irq_affinities);
 
-static int __must_check init_vtd_hw(void)
+static int __must_check init_vtd_hw(bool resume)
 {
     struct acpi_drhd_unit *drhd;
     struct vtd_iommu *iommu;
@@ -2141,6 +2141,10 @@ static int __must_check init_vtd_hw(void)
             disable_qinval(iommu);
         }
 
+        if ( resume )
+            /* FECTL write done by vtd_resume(). */
+            continue;
+
         spin_lock_irqsave(&iommu->register_lock, flags);
         sts = dmar_readl(iommu->reg, DMAR_FECTL_REG);
         sts &= ~DMA_FECTL_IM;
@@ -2340,7 +2344,7 @@ static int __init vtd_setup(void)
     P(iommu_hap_pt_share, "Shared EPT tables");
 #undef P
 
-    ret = init_vtd_hw();
+    ret = init_vtd_hw(false);
     if ( ret )
         goto error;
 
@@ -2611,7 +2615,7 @@ static void vtd_resume(void)
     if ( !iommu_enabled )
         return;
 
-    if ( init_vtd_hw() != 0  && force_iommu )
+    if ( init_vtd_hw(true) != 0 && force_iommu )
          panic("IOMMU setup failed, crash Xen for security purpose\n");
 
     for_each_drhd_unit ( drhd )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 12:55:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 12:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114476.218161 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZCO3-0007l3-S4; Wed, 21 Apr 2021 12:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114476.218161; Wed, 21 Apr 2021 12: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 1lZCO3-0007kv-P8; Wed, 21 Apr 2021 12:55:23 +0000
Received: by outflank-mailman (input) for mailman id 114476;
 Wed, 21 Apr 2021 12:55:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZCO3-0007km-4H
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12:55:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZCO2-0007xd-Q6
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZCO2-0006kR-PF
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12: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=PxfDgdfQ0J1KQMPaEs8XmxOBTviIkmrkn3zhx1lIDU4=; b=CF2f08l16eWQprNkMD4y/EYCcK
	D+adKc/USyMD3wvsC3+sdWl/ZxyfN9Pm45/SAk5vLcty0gZOnJhy4DBvRI9Yg/11wxojp22uIxWDZ
	jHr36w+9L2O1NePl3bW+7cBjPZZPLXSOl7AT3B3z+lPqhVDECqkGr3CDpjhwEs0rRJ70=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] VT-d: re-order register restoring in vtd_resume()
Message-Id: <E1lZCO2-0006kR-PF@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 12:55:22 +0000

commit 732cf387c9bb343ac89ddd4a2e713880d62d2b5f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:02:35 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:02:35 2021 +0200

    VT-d: re-order register restoring in vtd_resume()
    
    For one FECTL must be written last - the interrupt shouldn't be unmasked
    without first having written the data and address needed to actually
    deliver it. In the common case (when dma_msi_set_affinity() doesn't end
    up bailing early) this happens from init_vtd_hw(), but for this to
    actually have the intended effect we shouldn't subsequently overwrite
    what was written there - this is only benign when old and new settings
    match. Instead we should restore the registers ahead of calling
    init_vtd_hw(), just for the unlikely case of dma_msi_set_affinity()
    bailing early.
    
    In the moved code drop some stray casts as well.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 95e07f8c0e64889ee56015c7f99bdf5309e9e8ef
    master date: 2021-03-30 14:39:54 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index db1171ce0c..cf49118035 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2615,6 +2615,21 @@ static void vtd_resume(void)
     if ( !iommu_enabled )
         return;
 
+    for_each_drhd_unit ( drhd )
+    {
+        iommu = drhd->iommu;
+        i = iommu->index;
+
+        spin_lock_irqsave(&iommu->register_lock, flags);
+        dmar_writel(iommu->reg, DMAR_FEDATA_REG,
+                    iommu_state[i][DMAR_FEDATA_REG]);
+        dmar_writel(iommu->reg, DMAR_FEADDR_REG,
+                    iommu_state[i][DMAR_FEADDR_REG]);
+        dmar_writel(iommu->reg, DMAR_FEUADDR_REG,
+                    iommu_state[i][DMAR_FEUADDR_REG]);
+        spin_unlock_irqrestore(&iommu->register_lock, flags);
+    }
+
     if ( init_vtd_hw(true) != 0 && force_iommu )
          panic("IOMMU setup failed, crash Xen for security purpose\n");
 
@@ -2626,12 +2641,6 @@ static void vtd_resume(void)
         spin_lock_irqsave(&iommu->register_lock, flags);
         dmar_writel(iommu->reg, DMAR_FECTL_REG,
                     (u32) iommu_state[i][DMAR_FECTL_REG]);
-        dmar_writel(iommu->reg, DMAR_FEDATA_REG,
-                    (u32) iommu_state[i][DMAR_FEDATA_REG]);
-        dmar_writel(iommu->reg, DMAR_FEADDR_REG,
-                    (u32) iommu_state[i][DMAR_FEADDR_REG]);
-        dmar_writel(iommu->reg, DMAR_FEUADDR_REG,
-                    (u32) iommu_state[i][DMAR_FEUADDR_REG]);
         spin_unlock_irqrestore(&iommu->register_lock, flags);
 
         iommu_enable_translation(drhd);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 12:55:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 12:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114477.218164 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZCOD-0007o4-TN; Wed, 21 Apr 2021 12:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114477.218164; Wed, 21 Apr 2021 12:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZCOD-0007nw-Qd; Wed, 21 Apr 2021 12:55:33 +0000
Received: by outflank-mailman (input) for mailman id 114477;
 Wed, 21 Apr 2021 12: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 1lZCOC-0007nn-UA
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12: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 1lZCOC-0007xk-TI
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZCOC-0006l9-SV
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12: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=OeffVw1LGNgdrFoRHbHb4WgF9HK4encnU5MtZ1Oct/M=; b=b08M6FHSzAcFymmkRHXPQ7myrX
	0/C65HUxH6Bgi8bb7Vl/X5nfnbkgvnJyuCQbLgqr0OMQWedYF1RSpoxrQwNZwN5UR7S2A2YXdWFFZ
	KkzZySV3hlHf6LwV4hz9DWiti6QquGJSzJ+OTXOroOme3I7wz9Ysv7tmVnarhAfvulos=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] VT-d: restore flush hooks when disabling qinval
Message-Id: <E1lZCOC-0006l9-SV@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 12:55:32 +0000

commit da4733a23c02be224b2248f679cc0e35203e5a51
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:02:57 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:02:57 2021 +0200

    VT-d: restore flush hooks when disabling qinval
    
    Leaving the hooks untouched is at best a latent risk: There may well be
    cases where some flush is needed, which then needs carrying out the
    "register" way.
    
    Switch from u<N> to uint<N>_t while needing to touch the function
    headers anyway.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 9c39dba2b179c0f4c42c98e97ea0878119718530
    master date: 2021-03-30 14:40:24 +0200
---
 xen/drivers/passthrough/vtd/extern.h | 10 ++++++++++
 xen/drivers/passthrough/vtd/iommu.c  | 19 ++++++++-----------
 xen/drivers/passthrough/vtd/qinval.c |  3 +++
 3 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index f776feefe6..1cac22a02f 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -50,6 +50,16 @@ int iommu_flush_iec_global(struct vtd_iommu *iommu);
 int iommu_flush_iec_index(struct vtd_iommu *iommu, u8 im, u16 iidx);
 void clear_fault_bits(struct vtd_iommu *iommu);
 
+int __must_check vtd_flush_context_reg(struct vtd_iommu *iommu, uint16_t did,
+                                       uint16_t source_id,
+                                       uint8_t function_mask, uint64_t type,
+                                       bool flush_non_present_entry);
+int __must_check vtd_flush_iotlb_reg(struct vtd_iommu *iommu, uint16_t did,
+                                     uint64_t addr, unsigned int size_order,
+                                     uint64_t type,
+                                     bool flush_non_present_entry,
+                                     bool flush_dev_iotlb);
+
 struct vtd_iommu *ioapic_to_iommu(unsigned int apic_id);
 struct vtd_iommu *hpet_to_iommu(unsigned int hpet_id);
 struct acpi_drhd_unit *ioapic_to_drhd(unsigned int apic_id);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index cf49118035..74c7aca24b 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -333,10 +333,9 @@ static void iommu_flush_write_buffer(struct vtd_iommu *iommu)
 }
 
 /* return value determine if we need a write buffer flush */
-static int __must_check flush_context_reg(struct vtd_iommu *iommu, u16 did,
-                                          u16 source_id, u8 function_mask,
-                                          u64 type,
-                                          bool flush_non_present_entry)
+int vtd_flush_context_reg(struct vtd_iommu *iommu, uint16_t did,
+                          uint16_t source_id, uint8_t function_mask,
+                          uint64_t type, bool flush_non_present_entry)
 {
     u64 val = 0;
     unsigned long flags;
@@ -402,11 +401,9 @@ static int __must_check iommu_flush_context_device(struct vtd_iommu *iommu,
 }
 
 /* return value determine if we need a write buffer flush */
-static int __must_check flush_iotlb_reg(struct vtd_iommu *iommu, u16 did,
-                                        u64 addr,
-                                        unsigned int size_order, u64 type,
-                                        bool flush_non_present_entry,
-                                        bool flush_dev_iotlb)
+int vtd_flush_iotlb_reg(struct vtd_iommu *iommu, uint16_t did, uint64_t addr,
+                        unsigned int size_order, uint64_t type,
+                        bool flush_non_present_entry, bool flush_dev_iotlb)
 {
     int tlb_offset = ecap_iotlb_offset(iommu->ecap);
     u64 val = 0;
@@ -2164,8 +2161,8 @@ static int __must_check init_vtd_hw(bool resume)
          */
         if ( enable_qinval(iommu) != 0 )
         {
-            iommu->flush.context = flush_context_reg;
-            iommu->flush.iotlb   = flush_iotlb_reg;
+            iommu->flush.context = vtd_flush_context_reg;
+            iommu->flush.iotlb   = vtd_flush_iotlb_reg;
         }
     }
 
diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c
index 39b7abd009..764ef9f0fc 100644
--- a/xen/drivers/passthrough/vtd/qinval.c
+++ b/xen/drivers/passthrough/vtd/qinval.c
@@ -462,4 +462,7 @@ void disable_qinval(struct vtd_iommu *iommu)
                   !(sts & DMA_GSTS_QIES), sts);
 out:
     spin_unlock_irqrestore(&iommu->register_lock, flags);
+
+    iommu->flush.context = vtd_flush_context_reg;
+    iommu->flush.iotlb   = vtd_flush_iotlb_reg;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 12:55:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 12:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114478.218169 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZCON-0007pF-V7; Wed, 21 Apr 2021 12:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114478.218169; Wed, 21 Apr 2021 12:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZCON-0007p7-S7; Wed, 21 Apr 2021 12:55:43 +0000
Received: by outflank-mailman (input) for mailman id 114478;
 Wed, 21 Apr 2021 12: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 1lZCON-0007oz-2D
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12: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 1lZCOM-0007xw-W8
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZCOM-0006lt-VP
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12: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=zHpDXGrG/pTDnq2bN1qgCTcegMswduxM56xCUtSSCGg=; b=D+qfNOKnSJXjx7jRjNyBkWtpEi
	30dghqKx7xAq1ivhM9ImW8WHZoWU1+ej34RRb7ghFr3YcgqoSVaIv5j80c7nsGEjKYxOVj3SRPcfn
	revU7enFEGaEQzCoE2QGTw36lLVrbGSZKbvzYl5tL9g7ZVCrLVGoogvxD3LKUOUz0lr8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] fix for_each_cpu() again for NR_CPUS=1
Message-Id: <E1lZCOM-0006lt-VP@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 12:55:42 +0000

commit 2b5de808288da505cbe7b115c645989142577bcd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:03:29 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:03:29 2021 +0200

    fix for_each_cpu() again for NR_CPUS=1
    
    Unfortunately aa50f45332f1 ("xen: fix for_each_cpu when NR_CPUS=1") has
    caused quite a bit of fallout with gcc10, e.g. (there are at least two
    more similar ones, and I didn't bother trying to find them all):
    
    In file included from .../xen/include/xen/config.h:13,
                     from <command-line>:
    core_parking.c: In function ‘core_parking_power’:
    .../xen/include/asm/percpu.h:12:51: error: array subscript 1 is above array bounds of ‘long unsigned int[1]’ [-Werror=array-bounds]
       12 |     (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
    .../xen/include/xen/compiler.h:141:29: note: in definition of macro ‘RELOC_HIDE’
      141 |     (typeof(ptr)) (__ptr + (off)); })
          |                             ^~~
    core_parking.c:133:39: note: in expansion of macro ‘per_cpu’
      133 |             core_tmp = cpumask_weight(per_cpu(cpu_core_mask, cpu));
          |                                       ^~~~~~~
    In file included from .../xen/include/xen/percpu.h:4,
                     from .../xen/include/asm/msr.h:7,
                     from .../xen/include/asm/time.h:5,
                     from .../xen/include/xen/time.h:76,
                     from .../xen/include/xen/spinlock.h:4,
                     from .../xen/include/xen/cpu.h:5,
                     from core_parking.c:19:
    .../xen/include/asm/percpu.h:6:22: note: while referencing ‘__per_cpu_offset’
        6 | extern unsigned long __per_cpu_offset[NR_CPUS];
          |                      ^~~~~~~~~~~~~~~~
    
    One of the further errors even went as far as claiming that an array
    index (range) of [0, 0] was outside the bounds of a [1] array, so
    something fishy is pretty clearly going on there.
    
    The compiler apparently wants to be able to see that the loop isn't
    really a loop in order to avoid triggering such warnings, yet what
    exactly makes it consider the loop exit condition constant and within
    the [0, 1] range isn't obvious - using ((mask)->bits[0] & 1) instead of
    cpumask_test_cpu() for example did _not_ help.
    
    Re-instate a special form of for_each_cpu(), experimentally "proven" to
    avoid the diagnostics.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
    master commit: 625faf9f002bd6ff4b6457a016b8ff338223b659
    master date: 2021-04-07 12:24:45 +0200
---
 xen/include/xen/cpumask.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/xen/cpumask.h b/xen/include/xen/cpumask.h
index e69589fc08..9826707909 100644
--- a/xen/include/xen/cpumask.h
+++ b/xen/include/xen/cpumask.h
@@ -368,10 +368,15 @@ static inline void free_cpumask_var(cpumask_var_t mask)
 #define FREE_CPUMASK_VAR(m) free_cpumask_var(m)
 #endif
 
+#if NR_CPUS > 1
 #define for_each_cpu(cpu, mask)			\
 	for ((cpu) = cpumask_first(mask);	\
 	     (cpu) < nr_cpu_ids;		\
 	     (cpu) = cpumask_next(cpu, mask))
+#else /* NR_CPUS == 1 */
+#define for_each_cpu(cpu, mask)			\
+	for ((cpu) = 0; (cpu) < cpumask_test_cpu(0, mask); ++(cpu))
+#endif /* NR_CPUS */
 
 /*
  * The following particular system cpumasks and operations manage
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 12:55:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 12:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114479.218173 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZCOY-0007qY-0d; Wed, 21 Apr 2021 12:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114479.218173; Wed, 21 Apr 2021 12:55:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZCOX-0007qQ-U1; Wed, 21 Apr 2021 12:55:53 +0000
Received: by outflank-mailman (input) for mailman id 114479;
 Wed, 21 Apr 2021 12: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 1lZCOX-0007qI-5T
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12: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 1lZCOX-0007y8-4b
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12:55:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZCOX-0006mi-25
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12: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=s/q2+YLO6NrN2tyY3wooPxBQ9mjVL+h5TQhR7rbFJBo=; b=ljNuXAsgQQG2Ul/qxuZNW6EF7E
	w40ooVPSJX9mG482NSfsAuAtpF2uQg1ap4G4TtyEQxeBpWNMVxO0/0wsUJvI+wIvZfxlsjktmwVoq
	cpewBb2TVfd0aGnJt0v68b2Vsl6XoCtOD4L1i7r2DgW7sJNUFQ/LDM224fv0FTzXCTX4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/vpt: do not take pt_migrate rwlock in some cases
Message-Id: <E1lZCOX-0006mi-25@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 12:55:53 +0000

commit a67f981352a21e8e3ade9944c238fce30b23938f
Author:     Boris Ostrovsky <boris.ostrovsky@oracle.com>
AuthorDate: Tue Apr 20 12:04:16 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:04:16 2021 +0200

    x86/vpt: do not take pt_migrate rwlock in some cases
    
    Commit 8e76aef72820 ("x86/vpt: fix race when migrating timers between
    vCPUs") addressed XSA-336 by introducing a per-domain rwlock that was
    intended to protect periodic timer during VCPU migration. Since such
    migration is an infrequent event no performance impact was expected.
    
    Unfortunately this turned out not to be the case: on a fairly large
    guest (92 VCPUs) we've observed as much as 40% TPCC performance
    regression with some guest kernels. Further investigation pointed to
    pt_migrate read lock taken in pt_update_irq() as the largest contributor
    to this regression. With large number of VCPUs and large number of VMEXITs
    (from where pt_update_irq() is always called) the update of an atomic in
    read_lock() is thought to be the main cause.
    
    Stephen Brennan analyzed locking pattern and classified lock users as
    follows:
    
    1. Functions which read (maybe write) all periodic_time instances attached
    to a particular vCPU. These are functions which use pt_vcpu_lock() such
    as pt_restore_timer(), pt_save_timer(), etc.
    2. Functions which want to modify a particular periodic_time object.
    These functions lock whichever vCPU the periodic_time is attached to, but
    since the vCPU could be modified without holding any lock, they are
    vulnerable to XSA-336. Functions in this group use pt_lock(), such as
    pt_timer_fn() or destroy_periodic_time().
    3. Functions which not only want to modify the periodic_time, but also
    would like to modify the =vcpu= fields. These are create_periodic_time()
    or pt_adjust_vcpu(). They create XSA-336 conditions for group 2, but we
    can't simply hold 2 vcpu locks due to the deadlock risk.
    
    Roger then pointed out that group 1 functions don't really need to hold
    the pt_migrate rwlock and that instead groups 2 and 3 should hold per-vcpu
    lock whenever they modify per-vcpu timer lists.
    
    Suggested-by: Stephen Brennan <stephen.s.brennan@oracle.com>
    Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Stephen Brennan <stephen.s.brennan@oracle.com>
    master commit: 1f3d87c7512975274cc45c40097b05550eba1ac9
    master date: 2021-04-09 09:21:27 +0200
---
 xen/arch/x86/hvm/vpt.c        | 44 ++++++++++++++++++++++++++++++++++---------
 xen/include/asm-x86/hvm/vpt.h | 18 ++++++++++++------
 2 files changed, 47 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index ae7f715620..6a5458c8b7 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -153,32 +153,43 @@ static int pt_irq_masked(struct periodic_time *pt)
     return 1;
 }
 
+/*
+ * Functions which read (maybe write) all periodic_time instances
+ * attached to a particular vCPU use pt_vcpu_{un}lock locking helpers.
+ *
+ * Such users are explicitly forbidden from changing the value of the
+ * pt->vcpu field, because another thread holding the pt_migrate lock
+ * may already be spinning waiting for your vcpu lock.
+ */
 static void pt_vcpu_lock(struct vcpu *v)
 {
-    read_lock(&v->domain->arch.hvm.pl_time->pt_migrate);
     spin_lock(&v->arch.hvm.tm_lock);
 }
 
 static void pt_vcpu_unlock(struct vcpu *v)
 {
     spin_unlock(&v->arch.hvm.tm_lock);
-    read_unlock(&v->domain->arch.hvm.pl_time->pt_migrate);
 }
 
+/*
+ * Functions which want to modify a particular periodic_time object
+ * use pt_{un}lock locking helpers.
+ *
+ * These users lock whichever vCPU the periodic_time is attached to,
+ * but since the vCPU could be modified without holding any lock, they
+ * need to take an additional lock that protects against pt->vcpu
+ * changing.
+ */
 static void pt_lock(struct periodic_time *pt)
 {
-    /*
-     * We cannot use pt_vcpu_lock here, because we need to acquire the
-     * per-domain lock first and then (re-)fetch the value of pt->vcpu, or
-     * else we might be using a stale value of pt->vcpu.
-     */
     read_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
     spin_lock(&pt->vcpu->arch.hvm.tm_lock);
 }
 
 static void pt_unlock(struct periodic_time *pt)
 {
-    pt_vcpu_unlock(pt->vcpu);
+    spin_unlock(&pt->vcpu->arch.hvm.tm_lock);
+    read_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
 }
 
 static void pt_process_missed_ticks(struct periodic_time *pt)
@@ -543,8 +554,10 @@ void create_periodic_time(
     pt->cb = cb;
     pt->priv = data;
 
+    pt_vcpu_lock(v);
     pt->on_list = 1;
     list_add(&pt->list, &v->arch.hvm.tm_list);
+    pt_vcpu_unlock(v);
 
     init_timer(&pt->timer, pt_timer_fn, pt, v->processor);
     set_timer(&pt->timer, pt->scheduled);
@@ -580,13 +593,26 @@ static void pt_adjust_vcpu(struct periodic_time *pt, struct vcpu *v)
         return;
 
     write_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
+
+    if ( pt->vcpu == v )
+        goto out;
+
+    pt_vcpu_lock(pt->vcpu);
+    if ( pt->on_list )
+        list_del(&pt->list);
+    pt_vcpu_unlock(pt->vcpu);
+
     pt->vcpu = v;
+
+    pt_vcpu_lock(v);
     if ( pt->on_list )
     {
-        list_del(&pt->list);
         list_add(&pt->list, &v->arch.hvm.tm_list);
         migrate_timer(&pt->timer, v->processor);
     }
+    pt_vcpu_unlock(v);
+
+ out:
     write_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
 }
 
diff --git a/xen/include/asm-x86/hvm/vpt.h b/xen/include/asm-x86/hvm/vpt.h
index 39d26cbda4..74c0cedd11 100644
--- a/xen/include/asm-x86/hvm/vpt.h
+++ b/xen/include/asm-x86/hvm/vpt.h
@@ -128,12 +128,18 @@ struct pl_time {    /* platform time */
     struct RTCState  vrtc;
     struct HPETState vhpet;
     struct PMTState  vpmt;
-    /*
-     * rwlock to prevent periodic_time vCPU migration. Take the lock in read
-     * mode in order to prevent the vcpu field of periodic_time from changing.
-     * Lock must be taken in write mode when changes to the vcpu field are
-     * performed, as it allows exclusive access to all the timers of a domain.
-     */
+     /*
+      * Functions which want to modify the vcpu field of the vpt need
+      * to hold the global lock (pt_migrate) in write mode together
+      * with the per-vcpu locks of the lists being modified. Functions
+      * that want to lock a periodic_timer that's possibly on a
+      * different vCPU list need to take the lock in read mode first in
+      * order to prevent the vcpu field of periodic_timer from
+      * changing.
+      *
+      * Note that two vcpu locks cannot be held at the same time to
+      * avoid a deadlock.
+      */
     rwlock_t pt_migrate;
     /* guest_time = Xen sys time + stime_offset */
     int64_t stime_offset;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 12:56:04 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 12:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114480.218177 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZCOi-0007rx-3y; Wed, 21 Apr 2021 12:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114480.218177; Wed, 21 Apr 2021 12: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 1lZCOi-0007rp-0i; Wed, 21 Apr 2021 12:56:04 +0000
Received: by outflank-mailman (input) for mailman id 114480;
 Wed, 21 Apr 2021 12: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 1lZCOh-0007rj-9n
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12: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 1lZCOh-000802-91
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12:56:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZCOh-0006nd-7F
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12: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=Qq0ygu1lJZM2SYzaqnrrSogZDWOfsLylQRxqXVz9dPY=; b=61uMVrOGf5UpCntdH9UXGsXVdb
	sBce7ji6MKAbYtLsI0MPp0AYzMDXiA9cNkPtl+kjuVyfr40FYKtmVf/+IsdhM5ERMJQvs+MWdfk2y
	7L3BKmDBI6Wnc35OhsyhDZfKFcrBA+jJXkOyjTUiP5O8H6Guo0XXQUKjC7Eg751L+H4E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/hpet: Factor hpet_enable_legacy_replacement_mode() out of hpet_setup()
Message-Id: <E1lZCOh-0006nd-7F@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 12:56:03 +0000

commit 440e6d402dc2c01a5051b68c2a60ffe1453656aa
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Apr 20 12:04:54 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:04:54 2021 +0200

    x86/hpet: Factor hpet_enable_legacy_replacement_mode() out of hpet_setup()
    
    ... in preparation to introduce a second caller.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Frédéric Pierret <frederic.pierret@qubes-os.org>
    master commit: 238168b5bcd27fec97704f6295fa5bf7a442eb6f
    master date: 2021-04-15 18:25:40 +0100
---
 xen/arch/x86/hpet.c        | 116 ++++++++++++++++++++++++---------------------
 xen/include/asm-x86/hpet.h |   6 +++
 2 files changed, 68 insertions(+), 54 deletions(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 59ad71592c..1edd255a20 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -764,11 +764,70 @@ int hpet_legacy_irq_tick(void)
 }
 
 static u32 *hpet_boot_cfg;
+static uint64_t __initdata hpet_rate;
+
+bool __init hpet_enable_legacy_replacement_mode(void)
+{
+    unsigned int cfg, c0_cfg, ticks, count;
+
+    if ( !hpet_rate ||
+         !(hpet_read32(HPET_ID) & HPET_ID_LEGSUP) ||
+         ((cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
+        return false;
+
+    /* Stop the main counter. */
+    hpet_write32(cfg & ~HPET_CFG_ENABLE, HPET_CFG);
+
+    /* Reconfigure channel 0 to be 32bit periodic. */
+    c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+    c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
+               HPET_TN_32BIT);
+    hpet_write32(c0_cfg, HPET_Tn_CFG(0));
+
+    /*
+     * The exact period doesn't have to match a legacy PIT.  All we need
+     * is an interrupt queued up via the IO-APIC to check routing.
+     *
+     * Use HZ as the frequency.
+     */
+    ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
+
+    count = hpet_read32(HPET_COUNTER);
+
+    /*
+     * HPET_TN_SETVAL above is atrociously documented in the spec.
+     *
+     * Periodic HPET channels have a main comparator register, and
+     * separate "accumulator" register.  Despite being named accumulator
+     * in the spec, this is not an accurate description of its behaviour
+     * or purpose.
+     *
+     * Each time an interrupt is generated, the "accumulator" register is
+     * re-added to the comparator set up the new period.
+     *
+     * Normally, writes to the CMP register update both registers.
+     * However, under these semantics, it is impossible to set up a
+     * periodic timer correctly without the main HPET counter being at 0.
+     *
+     * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
+     * use for periodic timers to mean that the second write to CMP
+     * updates the accumulator only, and not the absolute comparator
+     * value.
+     *
+     * This lets us set a period when the main counter isn't at 0.
+     */
+    hpet_write32(count + ticks, HPET_Tn_CMP(0));
+    hpet_write32(ticks,         HPET_Tn_CMP(0));
+
+    /* Restart the main counter, and legacy mode. */
+    hpet_write32(cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
+
+    return true;
+}
 
 u64 __init hpet_setup(void)
 {
-    static u64 __initdata hpet_rate;
-    unsigned int hpet_id, hpet_period, hpet_cfg;
+    unsigned int hpet_id, hpet_period;
     unsigned int last, rem;
 
     if ( hpet_rate )
@@ -815,58 +874,7 @@ u64 __init hpet_setup(void)
      * Reconfigure the HPET into legacy mode to re-establish the timer
      * interrupt.
      */
-    if ( hpet_id & HPET_ID_LEGSUP &&
-         !((hpet_cfg = hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) )
-    {
-        unsigned int c0_cfg, ticks, count;
-
-        /* Stop the main counter. */
-        hpet_write32(hpet_cfg & ~HPET_CFG_ENABLE, HPET_CFG);
-
-        /* Reconfigure channel 0 to be 32bit periodic. */
-        c0_cfg = hpet_read32(HPET_Tn_CFG(0));
-        c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
-                   HPET_TN_32BIT);
-        hpet_write32(c0_cfg, HPET_Tn_CFG(0));
-
-        /*
-         * The exact period doesn't have to match a legacy PIT.  All we need
-         * is an interrupt queued up via the IO-APIC to check routing.
-         *
-         * Use HZ as the frequency.
-         */
-        ticks = ((SECONDS(1) / HZ) * div_sc(hpet_rate, SECONDS(1), 32)) >> 32;
-
-        count = hpet_read32(HPET_COUNTER);
-
-        /*
-         * HPET_TN_SETVAL above is atrociously documented in the spec.
-         *
-         * Periodic HPET channels have a main comparator register, and
-         * separate "accumulator" register.  Despite being named accumulator
-         * in the spec, this is not an accurate description of its behaviour
-         * or purpose.
-         *
-         * Each time an interrupt is generated, the "accumulator" register is
-         * re-added to the comparator set up the new period.
-         *
-         * Normally, writes to the CMP register update both registers.
-         * However, under these semantics, it is impossible to set up a
-         * periodic timer correctly without the main HPET counter being at 0.
-         *
-         * Instead, HPET_TN_SETVAL is a self-clearing control bit which we can
-         * use for periodic timers to mean that the second write to CMP
-         * updates the accumulator only, and not the absolute comparator
-         * value.
-         *
-         * This lets us set a period when the main counter isn't at 0.
-         */
-        hpet_write32(count + ticks, HPET_Tn_CMP(0));
-        hpet_write32(ticks,         HPET_Tn_CMP(0));
-
-        /* Restart the main counter, and legacy mode. */
-        hpet_write32(hpet_cfg | HPET_CFG_ENABLE | HPET_CFG_LEGACY, HPET_CFG);
-    }
+    hpet_enable_legacy_replacement_mode();
 
     return hpet_rate;
 }
diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h
index fb6bf05065..50176de3d2 100644
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -72,6 +72,12 @@ void hpet_disable(void);
  */
 int hpet_legacy_irq_tick(void);
 
+/*
+ * Try to enable HPET Legacy Replacement mode.  Returns a boolean indicating
+ * whether the HPET configuration was changed.
+ */
+bool hpet_enable_legacy_replacement_mode(void);
+
 /*
  * Temporarily use an HPET event counter for timer interrupt handling,
  * rather than using the LAPIC timer. Used for Cx state entry.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Apr 21 12:56:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Apr 2021 12:56:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114481.218180 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZCOs-0007tT-5K; Wed, 21 Apr 2021 12:56:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114481.218180; Wed, 21 Apr 2021 12:56:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZCOs-0007tL-2R; Wed, 21 Apr 2021 12:56:14 +0000
Received: by outflank-mailman (input) for mailman id 114481;
 Wed, 21 Apr 2021 12: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 1lZCOr-0007tE-DC
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12: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 1lZCOr-00080Q-CP
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12:56:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZCOr-0006ol-Bd
 for xen-changelog@lists.xenproject.org; Wed, 21 Apr 2021 12: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=A+XmGOnL8OFDPc+yHd5khcvZXE9bm3b94q5mKp5N0R4=; b=5wTpWkDfSIINbAJje94Ja7b/oL
	a15SVyBpmdfWTFQwWS04ZSatnJW3C6n1muswNHzZffkgC7BwPuZLL48fS+l5eXdPyrfu+hLuWzPG4
	Ri768z+orN6KGIQdMrNyihB63zZEOvYF0pizFbbjnIy37Z80yHgRvQru59xBsy4K1qwk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] x86/hpet: Don't enable legacy replacement mode unconditionally
Message-Id: <E1lZCOr-0006ol-Bd@xenbits.xenproject.org>
Date: Wed, 21 Apr 2021 12:56:13 +0000

commit b14d8345e530a54710700ec5fcb0879c2e056d31
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 20 12:05:20 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 12:05:20 2021 +0200

    x86/hpet: Don't enable legacy replacement mode unconditionally
    
    Commit e1de4c196a2e ("x86/timer: Fix boot on Intel systems using ITSSPRC
    static PIT clock gating") was reported to cause boot failures on certain
    AMD Ryzen systems.
    
    Refine the fix to do nothing in the default case, and only attempt to
    configure legacy replacement mode if IRQ0 is found to not be working.  If
    legacy replacement mode doesn't help, undo it before falling back to other IRQ
    routing configurations.
    
    In addition, introduce a "hpet" command line option so this heuristic
    can be overridden.  Since it makes little sense to introduce just
    "hpet=legacy-replacement", also allow for a boolean argument as well as
    "broadcast" to replace the separate "hpetbroadcast" option.
    
    Reported-by: Frédéric Pierret frederic.pierret@qubes-os.org
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Frédéric Pierret <frederic.pierret@qubes-os.org>
    master commit: b53173e7cdafb7a318a239d557478fd73734a86a
    master date: 2021-04-15 18:25:40 +0100
---
 docs/misc/xen-command-line.pandoc | 33 +++++++++++++++++
 xen/arch/x86/hpet.c               | 75 +++++++++++++++++++++++++++++----------
 xen/arch/x86/io_apic.c            | 31 ++++++++++++++++
 xen/include/asm-x86/hpet.h        |  7 ++++
 4 files changed, 128 insertions(+), 18 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 4ae9391fcd..f63fe9680a 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1221,9 +1221,42 @@ supported. See docs/misc/arm/big.LITTLE.txt for more information.
 When the hmp-unsafe option is disabled (default), CPUs that are not
 identical to the boot CPU will be parked and not used by Xen.
 
+### hpet
+    = List of [ <bool> | broadcast=<bool> | legacy-replacement=<bool> ]
+
+    Applicability: x86
+
+Controls Xen's use of the system's High Precision Event Timer.  By default,
+Xen will use an HPET when available and not subject to errata.  Use of the
+HPET can be disabled by specifying `hpet=0`.
+
+ * The `broadcast` boolean is disabled by default, but forces Xen to keep
+   using the broadcast for CPUs in deep C-states even when an RTC interrupt is
+   enabled.  This then also affects raising of the RTC interrupt.
+
+ * The `legacy-replacement` boolean allows for control over whether Legacy
+   Replacement mode is enabled.
+
+   Legacy Replacement mode is intended for hardware which does not have an
+   8254 PIT, and allows the HPET to be configured into a compatible mode.
+   Intel chipsets from Skylake/ApolloLake onwards can turn the PIT off for
+   power saving reasons, and there is no platform-agnostic mechanism for
+   discovering this.
+
+   By default, Xen will not change hardware configuration, unless the PIT
+   appears to be absent, at which point Xen will try to enable Legacy
+   Replacement mode before falling back to pre-IO-APIC interrupt routing
+   options.
+
+   This behaviour can be inhibited by specifying `legacy-replacement=0`.
+   Alternatively, this mode can be enabled unconditionally (if available) by
+   specifying `legacy-replacement=1`.
+
 ### hpetbroadcast (x86)
 > `= <boolean>`
 
+Deprecated alternative of `hpet=broadcast`.
+
 ### hvm_debug (x86)
 > `= <integer>`
 
diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 1edd255a20..f15df77661 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -52,6 +52,8 @@ static unsigned int __read_mostly num_hpets_used;
 DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel);
 
 unsigned long __initdata hpet_address;
+int8_t __initdata opt_hpet_legacy_replacement = -1;
+static bool __initdata opt_hpet = true;
 u8 __initdata hpet_blockid;
 u8 __initdata hpet_flags;
 
@@ -63,6 +65,32 @@ u8 __initdata hpet_flags;
 static bool __initdata force_hpet_broadcast;
 boolean_param("hpetbroadcast", force_hpet_broadcast);
 
+static int __init parse_hpet_param(const char *s)
+{
+    const char *ss;
+    int val, rc = 0;
+
+    do {
+        ss = strchr(s, ',');
+        if ( !ss )
+            ss = strchr(s, '\0');
+
+        if ( (val = parse_bool(s, ss)) >= 0 )
+            opt_hpet = val;
+        else if ( (val = parse_boolean("broadcast", s, ss)) >= 0 )
+            force_hpet_broadcast = val;
+        else if ( (val = parse_boolean("legacy-replacement", s, ss)) >= 0 )
+            opt_hpet_legacy_replacement = val;
+        else
+            rc = -EINVAL;
+
+        s = ss + 1;
+    } while ( *ss );
+
+    return rc;
+}
+custom_param("hpet", parse_hpet_param);
+
 /*
  * Calculate a multiplication factor for scaled math, which is used to convert
  * nanoseconds based values to clock ticks:
@@ -765,6 +793,9 @@ int hpet_legacy_irq_tick(void)
 
 static u32 *hpet_boot_cfg;
 static uint64_t __initdata hpet_rate;
+static __initdata struct {
+    uint32_t cmp, cfg;
+} pre_legacy_c0;
 
 bool __init hpet_enable_legacy_replacement_mode(void)
 {
@@ -778,8 +809,11 @@ bool __init hpet_enable_legacy_replacement_mode(void)
     /* Stop the main counter. */
     hpet_write32(cfg & ~HPET_CFG_ENABLE, HPET_CFG);
 
+    /* Stash channel 0's old CFG/CMP incase we need to undo. */
+    pre_legacy_c0.cfg = c0_cfg = hpet_read32(HPET_Tn_CFG(0));
+    pre_legacy_c0.cmp = hpet_read32(HPET_Tn_CMP(0));
+
     /* Reconfigure channel 0 to be 32bit periodic. */
-    c0_cfg = hpet_read32(HPET_Tn_CFG(0));
     c0_cfg |= (HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL |
                HPET_TN_32BIT);
     hpet_write32(c0_cfg, HPET_Tn_CFG(0));
@@ -825,17 +859,33 @@ bool __init hpet_enable_legacy_replacement_mode(void)
     return true;
 }
 
+void __init hpet_disable_legacy_replacement_mode(void)
+{
+    unsigned int cfg = hpet_read32(HPET_CFG);
+
+    ASSERT(hpet_rate);
+
+    cfg &= ~(HPET_CFG_LEGACY | HPET_CFG_ENABLE);
+
+    /* Stop the main counter and disable legacy mode. */
+    hpet_write32(cfg, HPET_CFG);
+
+    /* Restore pre-Legacy Replacement Mode settings. */
+    hpet_write32(pre_legacy_c0.cfg, HPET_Tn_CFG(0));
+    hpet_write32(pre_legacy_c0.cmp, HPET_Tn_CMP(0));
+
+    /* Restart the main counter. */
+    hpet_write32(cfg | HPET_CFG_ENABLE, HPET_CFG);
+}
+
 u64 __init hpet_setup(void)
 {
     unsigned int hpet_id, hpet_period;
     unsigned int last, rem;
 
-    if ( hpet_rate )
+    if ( hpet_rate || !hpet_address || !opt_hpet )
         return hpet_rate;
 
-    if ( hpet_address == 0 )
-        return 0;
-
     set_fixmap_nocache(FIX_HPET_BASE, hpet_address);
 
     hpet_id = hpet_read32(HPET_ID);
@@ -862,19 +912,8 @@ u64 __init hpet_setup(void)
     if ( (rem * 2) > hpet_period )
         hpet_rate++;
 
-    /*
-     * Intel chipsets from Skylake/ApolloLake onwards can statically clock
-     * gate the 8259 PIT.  This option is enabled by default in slightly later
-     * systems, as turning the PIT off is a prerequisite to entering the C11
-     * power saving state.
-     *
-     * Xen currently depends on the legacy timer interrupt being active while
-     * IRQ routing is configured.
-     *
-     * Reconfigure the HPET into legacy mode to re-establish the timer
-     * interrupt.
-     */
-    hpet_enable_legacy_replacement_mode();
+    if ( opt_hpet_legacy_replacement > 0 )
+        hpet_enable_legacy_replacement_mode();
 
     return hpet_rate;
 }
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index e66fa99ec7..856cf58b26 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -29,6 +29,8 @@
 #include <xen/acpi.h>
 #include <xen/keyhandler.h>
 #include <xen/softirq.h>
+
+#include <asm/hpet.h>
 #include <asm/mc146818rtc.h>
 #include <asm/smp.h>
 #include <asm/desc.h>
@@ -1930,6 +1932,35 @@ static void __init check_timer(void)
             local_irq_restore(flags);
             return;
         }
+
+        /*
+         * Intel chipsets from Skylake/ApolloLake onwards can statically clock
+         * gate the 8254 PIT.  This option is enabled by default in slightly
+         * later systems, as turning the PIT off is a prerequisite to entering
+         * the C11 power saving state.
+         *
+         * Xen currently depends on the legacy timer interrupt being active
+         * while IRQ routing is configured.
+         *
+         * If the user hasn't made an explicit choice, attempt to reconfigure
+         * the HPET into legacy mode to re-establish the timer interrupt.
+         */
+        if ( opt_hpet_legacy_replacement < 0 &&
+             hpet_enable_legacy_replacement_mode() )
+        {
+            printk(XENLOG_ERR "..no 8254 timer found - trying HPET Legacy Replacement Mode\n");
+
+            if ( timer_irq_works() )
+            {
+                local_irq_restore(flags);
+                return;
+            }
+
+            /* Legacy Replacement mode hasn't helped.  Undo it. */
+            printk(XENLOG_ERR "..no HPET timer found - reverting Legacy Replacement Mode\n");
+            hpet_disable_legacy_replacement_mode();
+        }
+
         clear_IO_APIC_pin(apic1, pin1);
         printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to "
                "IO-APIC\n");
diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h
index 50176de3d2..8f9725a95e 100644
--- a/xen/include/asm-x86/hpet.h
+++ b/xen/include/asm-x86/hpet.h
@@ -53,6 +53,7 @@
 extern unsigned long hpet_address;
 extern u8 hpet_blockid;
 extern u8 hpet_flags;
+extern int8_t opt_hpet_legacy_replacement;
 
 /*
  * Detect and initialise HPET hardware: return counter update frequency.
@@ -78,6 +79,12 @@ int hpet_legacy_irq_tick(void);
  */
 bool hpet_enable_legacy_replacement_mode(void);
 
+/*
+ * Undo the effects of hpet_disable_legacy_replacement_mode().  Must not be
+ * called unless enable() returned true.
+ */
+void hpet_disable_legacy_replacement_mode(void);
+
 /*
  * Temporarily use an HPET event counter for timer interrupt handling,
  * rather than using the LAPIC timer. Used for Cx state entry.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 03:55:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 03:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114993.219220 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZQQi-0000Dz-A6; Thu, 22 Apr 2021 03:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114993.219220; Thu, 22 Apr 2021 03:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZQQi-0000Dq-6h; Thu, 22 Apr 2021 03:55:04 +0000
Received: by outflank-mailman (input) for mailman id 114993;
 Thu, 22 Apr 2021 03: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 1lZQQg-0000DQ-RP
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 03: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 1lZQQg-0004bN-Nv
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 03:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZQQg-0007fm-M9
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 03: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=NWon+UdbkpLqMJBlP/MfuXuDHDzX5c54htBQksL0pOU=; b=h1dIrSEIgebJQmCP/LTHnvMgJY
	1OEFCw3wUaq2j07+1rXsCIbr5HpKhBFkLA5mfNIcvlrM+on+ruHyQELqef/m8/BKjGjuysYCFRnyf
	ukmerhYVBHJ8xX5cfjPJl9VP+jY/BdD4hzSNKtmC8F+c+7QK8o7IZsgKpH/X14LdLpFw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vpic: force int output to low when in init mode
Message-Id: <E1lZQQg-0007fm-M9@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 03:55:02 +0000

commit 1ca901c527d21c083ceb706839db2cdac102926c
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Apr 20 11:34:53 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:34:53 2021 +0200

    x86/vpic: force int output to low when in init mode
    
    When the PIC is on the init sequence prevent interrupt delivery. The
    state of the registers is in the process of being set during the init
    phase, so it makes sense to prevent any int line changes during that
    process.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vpic.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/vpic.c b/xen/arch/x86/hvm/vpic.c
index c1c1de7fd0..9195155ff0 100644
--- a/xen/arch/x86/hvm/vpic.c
+++ b/xen/arch/x86/hvm/vpic.c
@@ -101,11 +101,14 @@ static void vpic_update_int_output(struct hvm_hw_vpic *vpic)
     irq = vpic_get_highest_priority_irq(vpic);
     TRACE_3D(TRC_HVM_EMUL_PIC_INT_OUTPUT, vpic->int_output, vpic->is_master,
              irq);
-    if ( vpic->int_output == (irq >= 0) )
+    if ( vpic->int_output == (!vpic->init_state && irq >= 0) )
         return;
 
-    /* INT line transition L->H or H->L. */
-    vpic->int_output = !vpic->int_output;
+    /*
+     * INT line transition L->H or H->L.
+     * Force line status to L when in init mode.
+     */
+    vpic->int_output = !vpic->init_state && !vpic->int_output;
 
     if ( vpic->int_output )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 03:55:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 03:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114994.219225 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZQQs-0000Ge-C3; Thu, 22 Apr 2021 03:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114994.219225; Thu, 22 Apr 2021 03:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZQQs-0000GM-8G; Thu, 22 Apr 2021 03:55:14 +0000
Received: by outflank-mailman (input) for mailman id 114994;
 Thu, 22 Apr 2021 03: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 1lZQQq-0000Fz-TU
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 03: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 1lZQQq-0004bS-RV
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 03:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZQQq-0007zH-QH
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 03: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=GhAKTa44J/r95CCSJle40+tJcHpXRAgQS8HWHAx3VhA=; b=ZajarCbEH0VUCvkNry11BXoX0r
	jyQX7ae+BO8qV8JFtT2R6KJ0z/0NK3MQFaHjJLwjw+plUOd8BGWF44pGqHHx9G1bnRdBOCVtYVca2
	px0rIGjAeKgQuYqgQpOqZfyhM3MSzIUd5cvjcDUoz30awMyPqt45sRa8eNhk8IwrpCic=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vpic: don't trigger unmask event until end of init
Message-Id: <E1lZQQq-0007zH-QH@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 03:55:12 +0000

commit 192f7479f21ef63dad8d8acbbda93cce0971fe66
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Apr 20 11:35:29 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:35:29 2021 +0200

    x86/vpic: don't trigger unmask event until end of init
    
    Wait until the end of the init sequence to trigger the unmask event.
    Note that it will be unconditionally triggered, but that's harmless if
    not unmask actually happened.
    
    While there change the variable type to bool.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vpic.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vpic.c b/xen/arch/x86/hvm/vpic.c
index 9195155ff0..795a76768d 100644
--- a/xen/arch/x86/hvm/vpic.c
+++ b/xen/arch/x86/hvm/vpic.c
@@ -188,7 +188,8 @@ static void vpic_ioport_write(
     struct hvm_hw_vpic *vpic, uint32_t addr, uint32_t val)
 {
     int priority, cmd;
-    uint8_t mask, unmasked = 0;
+    uint8_t mask;
+    bool unmasked = false;
 
     vpic_lock(vpic);
 
@@ -200,7 +201,6 @@ static void vpic_ioport_write(
             /* Clear edge-sensing logic. */
             vpic->irr &= vpic->elcr;
 
-            unmasked = vpic->imr;
             /* No interrupts masked or in service. */
             vpic->imr = vpic->isr = 0;
 
@@ -294,13 +294,17 @@ static void vpic_ioport_write(
             /* ICW3 */
             vpic->init_state++;
             if ( !(vpic->init_state & 4) )
+            {
                 vpic->init_state = 0; /* No ICW4: init done */
+                unmasked = true;
+            }
             break;
         case 3:
             /* ICW4 */
             vpic->special_fully_nested_mode = (val >> 4) & 1;
             vpic->auto_eoi = (val >> 1) & 1;
             vpic->init_state = 0;
+            unmasked = true;
             break;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 03:55:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 03:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114995.219228 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZQR2-0000JH-DS; Thu, 22 Apr 2021 03:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114995.219228; Thu, 22 Apr 2021 03: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 1lZQR2-0000J9-A2; Thu, 22 Apr 2021 03:55:24 +0000
Received: by outflank-mailman (input) for mailman id 114995;
 Thu, 22 Apr 2021 03:55:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZQR0-0000Iu-VO
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 03: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 1lZQR0-0004bw-Ua
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 03:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZQR0-0007zx-Tf
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 03: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=PL6Tr1oIVEaFa03goL786yyzL1aEd9qe2Lhn3ULEiHc=; b=pgyZdbrvll9MaSB10iAlxnjZ+/
	goCFHWKhGZ+5wrX2vcezh5UIxiE5o2gtyzKq2mGF9YnCLxelmVTtnQnI5X4p4qJRPlt0UyeIoBHkl
	fMSjz4CtU2iqcWv7xWMOKzDfuy4zDd6VyxI4oEYHpIYZggvZeWFtLLSojVu5+0fQV/TU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vpic: issue dpci EOI for cleared pins at ICW1
Message-Id: <E1lZQR0-0007zx-Tf@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 03:55:22 +0000

commit 2d494f2198d7909a394085d079475bb099d7afe7
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Apr 20 11:36:09 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:36:09 2021 +0200

    x86/vpic: issue dpci EOI for cleared pins at ICW1
    
    When pins are cleared from either ISR or IRR as part of the
    initialization sequence forward the clearing of those pins to the dpci
    EOI handler, as it is equivalent to an EOI. Not doing so can bring the
    interrupt controller state out of sync with the dpci handling logic,
    that expects a notification when a pin has been EOI'ed.
    
    Fixes: 7b3cb5e5416 ('IRQ injection changes for HVM PCI passthru.')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vpic.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/xen/arch/x86/hvm/vpic.c b/xen/arch/x86/hvm/vpic.c
index 795a76768d..f465b7f997 100644
--- a/xen/arch/x86/hvm/vpic.c
+++ b/xen/arch/x86/hvm/vpic.c
@@ -197,6 +197,8 @@ static void vpic_ioport_write(
     {
         if ( val & 0x10 )
         {
+            unsigned int pending = vpic->isr | (vpic->irr & ~vpic->elcr);
+
             /* ICW1 */
             /* Clear edge-sensing logic. */
             vpic->irr &= vpic->elcr;
@@ -220,6 +222,24 @@ static void vpic_ioport_write(
             }
 
             vpic->init_state = ((val & 3) << 2) | 1;
+            vpic_update_int_output(vpic);
+            vpic_unlock(vpic);
+
+            /*
+             * Forward the EOI of any pending or in service interrupt that has
+             * been cleared from IRR or ISR, or else the dpci logic will get
+             * out of sync with the state of the interrupt controller.
+             */
+            while ( pending )
+            {
+                unsigned int pin = __scanbit(pending, 8);
+
+                ASSERT(pin < 8);
+                hvm_dpci_eoi(current->domain,
+                             hvm_isa_irq_to_gsi((addr >> 7) ? (pin | 8) : pin));
+                __clear_bit(pin, &pending);
+            }
+            return;
         }
         else if ( val & 0x08 )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 03:55:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 03:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114996.219232 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZQRC-0000Lq-GF; Thu, 22 Apr 2021 03:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114996.219232; Thu, 22 Apr 2021 03: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 1lZQRC-0000Li-Cs; Thu, 22 Apr 2021 03:55:34 +0000
Received: by outflank-mailman (input) for mailman id 114996;
 Thu, 22 Apr 2021 03:55:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZQRB-0000LP-53
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 03:55:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZQRB-0004c6-4E
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 03:55:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZQRB-00080y-0X
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 03:55:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=h2SPbp/8fRYljTqdXfUgKxvK/LLjzGtlIMALndZeGQw=; b=QWqFd+8k+yM2dS31CPyERUJCHT
	SdLnOzIOoeWWjQNLEmFY/mmE3QWWHEEZ4bjpiNUwBooIyZvNNqSp7s+ovu6UBXwezCfRrNFRCGvvP
	HhFHHUIFgJxCFSR//mb65pJ8u0AOMXc60tvVTIijzMHR/I+ywbaRuuVrDqLQOAMUSgy4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/dpci: remove the dpci EOI timer
Message-Id: <E1lZQRB-00080y-0X@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 03:55:33 +0000

commit 730d0f6082e66eefae64f35bc62e51fc54d02d55
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Apr 20 11:36:54 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 20 11:36:54 2021 +0200

    x86/dpci: remove the dpci EOI timer
    
    Current interrupt pass though code will setup a timer for each
    interrupt injected to the guest that requires an EOI from the guest.
    Such timer would perform two actions if the guest doesn't EOI the
    interrupt before a given period of time. The first one is deasserting
    the virtual line, the second is perform an EOI of the physical
    interrupt source if it requires such.
    
    The deasserting of the guest virtual line is wrong, since it messes
    with the interrupt status of the guest. This seems to have been done
    in order to compensate for missing deasserts when certain interrupt
    controller actions are performed. The original motivation of the
    introduction of the timer was to fix issues when a GSI was shared
    between different guests. We believe that other changes in the
    interrupt handling code (ie: proper propagation of EOI related actions
    to dpci) will have fixed such errors now.
    
    Performing an EOI of the physical interrupt source is redundant, since
    there's already a timer that takes care of this for all interrupts,
    not just the HVM dpci ones, see irq_guest_action_t struct eoi_timer
    field.
    
    Since both of the actions performed by the dpci timer are not
    required, remove it altogether.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/vtd/x86/hvm.c |  3 --
 xen/drivers/passthrough/x86/hvm.c     | 95 +----------------------------------
 xen/include/asm-x86/hvm/irq.h         |  3 --
 xen/include/xen/iommu.h               |  5 --
 4 files changed, 2 insertions(+), 104 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/x86/hvm.c b/xen/drivers/passthrough/vtd/x86/hvm.c
index f77b35815c..b531fe907a 100644
--- a/xen/drivers/passthrough/vtd/x86/hvm.c
+++ b/xen/drivers/passthrough/vtd/x86/hvm.c
@@ -36,10 +36,7 @@ static int _hvm_dpci_isairq_eoi(struct domain *d,
         {
             hvm_pci_intx_deassert(d, digl->device, digl->intx);
             if ( --pirq_dpci->pending == 0 )
-            {
-                stop_timer(&pirq_dpci->timer);
                 pirq_guest_eoi(dpci_pirq(pirq_dpci));
-            }
         }
     }
 
diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index a6e2863c14..351daafdc9 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -136,77 +136,6 @@ static void pt_pirq_softirq_reset(struct hvm_pirq_dpci *pirq_dpci)
     pirq_dpci->masked = 0;
 }
 
-bool pt_irq_need_timer(uint32_t flags)
-{
-    return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE |
-                      HVM_IRQ_DPCI_NO_EOI));
-}
-
-static int pt_irq_guest_eoi(struct domain *d, struct hvm_pirq_dpci *pirq_dpci,
-                            void *arg)
-{
-    if ( __test_and_clear_bit(_HVM_IRQ_DPCI_EOI_LATCH_SHIFT,
-                              &pirq_dpci->flags) )
-    {
-        pirq_dpci->masked = 0;
-        pirq_dpci->pending = 0;
-        pirq_guest_eoi(dpci_pirq(pirq_dpci));
-    }
-
-    return 0;
-}
-
-static void pt_irq_time_out(void *data)
-{
-    struct hvm_pirq_dpci *irq_map = data;
-    const struct hvm_irq_dpci *dpci;
-    const struct dev_intx_gsi_link *digl;
-
-    spin_lock(&irq_map->dom->event_lock);
-
-    if ( irq_map->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
-    {
-        ASSERT(is_hardware_domain(irq_map->dom));
-        /*
-         * Identity mapped, no need to iterate over the guest GSI list to find
-         * other pirqs sharing the same guest GSI.
-         *
-         * In the identity mapped case the EOI can also be done now, this way
-         * the iteration over the list of domain pirqs is avoided.
-         */
-        hvm_gsi_deassert(irq_map->dom, dpci_pirq(irq_map)->pirq);
-        irq_map->flags |= HVM_IRQ_DPCI_EOI_LATCH;
-        pt_irq_guest_eoi(irq_map->dom, irq_map, NULL);
-        spin_unlock(&irq_map->dom->event_lock);
-        return;
-    }
-
-    dpci = domain_get_irq_dpci(irq_map->dom);
-    if ( unlikely(!dpci) )
-    {
-        ASSERT_UNREACHABLE();
-        spin_unlock(&irq_map->dom->event_lock);
-        return;
-    }
-    list_for_each_entry ( digl, &irq_map->digl_list, list )
-    {
-        unsigned int guest_gsi = hvm_pci_intx_gsi(digl->device, digl->intx);
-        const struct hvm_girq_dpci_mapping *girq;
-
-        list_for_each_entry ( girq, &dpci->girq[guest_gsi], list )
-        {
-            struct pirq *pirq = pirq_info(irq_map->dom, girq->machine_gsi);
-
-            pirq_dpci(pirq)->flags |= HVM_IRQ_DPCI_EOI_LATCH;
-        }
-        hvm_pci_intx_deassert(irq_map->dom, digl->device, digl->intx);
-    }
-
-    pt_pirq_iterate(irq_map->dom, pt_irq_guest_eoi, NULL);
-
-    spin_unlock(&irq_map->dom->event_lock);
-}
-
 struct hvm_irq_dpci *domain_get_irq_dpci(const struct domain *d)
 {
     if ( !d || !is_hvm_domain(d) )
@@ -568,15 +497,10 @@ int pt_irq_create_bind(
                 }
             }
 
-            /* Init timer before binding */
-            if ( pt_irq_need_timer(pirq_dpci->flags) )
-                init_timer(&pirq_dpci->timer, pt_irq_time_out, pirq_dpci, 0);
             /* Deal with gsi for legacy devices */
             rc = pirq_guest_bind(d->vcpu[0], info, share);
             if ( unlikely(rc) )
             {
-                if ( pt_irq_need_timer(pirq_dpci->flags) )
-                    kill_timer(&pirq_dpci->timer);
                 /*
                  * There is no path for __do_IRQ to schedule softirq as
                  * IRQ_GUEST is not set. As such we can reset 'dom' directly.
@@ -743,8 +667,6 @@ int pt_irq_destroy_bind(
     {
         pirq_guest_unbind(d, pirq);
         msixtbl_pt_unregister(d, pirq);
-        if ( pt_irq_need_timer(pirq_dpci->flags) )
-            kill_timer(&pirq_dpci->timer);
         pirq_dpci->flags = 0;
         /*
          * See comment in pt_irq_create_bind's PT_IRQ_TYPE_MSI before the
@@ -934,16 +856,6 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
             __msi_pirq_eoi(pirq_dpci);
             goto out;
         }
-
-        /*
-         * Set a timer to see if the guest can finish the interrupt or not. For
-         * example, the guest OS may unmask the PIC during boot, before the
-         * guest driver is loaded. hvm_pci_intx_assert() may succeed, but the
-         * guest will never deal with the irq, then the physical interrupt line
-         * will never be deasserted.
-         */
-        ASSERT(pt_irq_need_timer(pirq_dpci->flags));
-        set_timer(&pirq_dpci->timer, NOW() + PT_IRQ_TIME_OUT);
     }
 
  out:
@@ -967,10 +879,10 @@ static void hvm_pirq_eoi(struct pirq *pirq)
      * since interrupt is still not EOIed
      */
     if ( --pirq_dpci->pending ||
-         !pt_irq_need_timer(pirq_dpci->flags) )
+         /* When the interrupt source is MSI no Ack should be performed. */
+         (pirq_dpci->flags & HVM_IRQ_DPCI_TRANSLATE) )
         return;
 
-    stop_timer(&pirq_dpci->timer);
     pirq_guest_eoi(pirq);
 }
 
@@ -1042,9 +954,6 @@ static int pci_clean_dpci_irq(struct domain *d,
 
     pirq_guest_unbind(d, dpci_pirq(pirq_dpci));
 
-    if ( pt_irq_need_timer(pirq_dpci->flags) )
-        kill_timer(&pirq_dpci->timer);
-
     list_for_each_entry_safe ( digl, tmp, &pirq_dpci->digl_list, list )
     {
         list_del(&digl->list);
diff --git a/xen/include/asm-x86/hvm/irq.h b/xen/include/asm-x86/hvm/irq.h
index 717c2299de..c4369ceb7a 100644
--- a/xen/include/asm-x86/hvm/irq.h
+++ b/xen/include/asm-x86/hvm/irq.h
@@ -116,7 +116,6 @@ struct dev_intx_gsi_link {
 #define _HVM_IRQ_DPCI_MACH_PCI_SHIFT            0
 #define _HVM_IRQ_DPCI_MACH_MSI_SHIFT            1
 #define _HVM_IRQ_DPCI_MAPPED_SHIFT              2
-#define _HVM_IRQ_DPCI_EOI_LATCH_SHIFT           3
 #define _HVM_IRQ_DPCI_GUEST_PCI_SHIFT           4
 #define _HVM_IRQ_DPCI_GUEST_MSI_SHIFT           5
 #define _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT        6
@@ -125,7 +124,6 @@ struct dev_intx_gsi_link {
 #define HVM_IRQ_DPCI_MACH_PCI        (1u << _HVM_IRQ_DPCI_MACH_PCI_SHIFT)
 #define HVM_IRQ_DPCI_MACH_MSI        (1u << _HVM_IRQ_DPCI_MACH_MSI_SHIFT)
 #define HVM_IRQ_DPCI_MAPPED          (1u << _HVM_IRQ_DPCI_MAPPED_SHIFT)
-#define HVM_IRQ_DPCI_EOI_LATCH       (1u << _HVM_IRQ_DPCI_EOI_LATCH_SHIFT)
 #define HVM_IRQ_DPCI_GUEST_PCI       (1u << _HVM_IRQ_DPCI_GUEST_PCI_SHIFT)
 #define HVM_IRQ_DPCI_GUEST_MSI       (1u << _HVM_IRQ_DPCI_GUEST_MSI_SHIFT)
 #define HVM_IRQ_DPCI_IDENTITY_GSI    (1u << _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT)
@@ -170,7 +168,6 @@ struct hvm_pirq_dpci {
     struct list_head digl_list;
     struct domain *dom;
     struct hvm_gmsi_info gmsi;
-    struct timer timer;
     struct list_head softirq_list;
 };
 
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index ea0cd0f1a2..4f0e5ac622 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -183,11 +183,6 @@ int pt_irq_destroy_bind(struct domain *, const struct xen_domctl_bind_pt_irq *);
 void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq);
 struct hvm_irq_dpci *domain_get_irq_dpci(const struct domain *);
 void free_hvm_irq_dpci(struct hvm_irq_dpci *dpci);
-#ifdef CONFIG_HVM
-bool pt_irq_need_timer(uint32_t flags);
-#else
-static inline bool pt_irq_need_timer(unsigned int flags) { return false; }
-#endif
 
 struct msi_desc;
 struct msi_msg;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 03:55:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 03:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114998.219236 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZQRM-0000NY-HZ; Thu, 22 Apr 2021 03:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114998.219236; Thu, 22 Apr 2021 03: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 1lZQRM-0000NQ-Ee; Thu, 22 Apr 2021 03:55:44 +0000
Received: by outflank-mailman (input) for mailman id 114998;
 Thu, 22 Apr 2021 03: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 1lZQRL-0000NF-7y
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 03: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 1lZQRL-0004cH-7F
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 03:55:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZQRL-00081e-6Q
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 03:55:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Eq3+fvw+dKUnM5wxQQFKAaKWTzvxUCuYYuHt8cFHz1w=; b=JpdMl1V8l4dd5i2FKMT1KG4ra2
	pzITR9cUWgbIAc276rHz1mO/ezVJFTzRygIy5epCm7XUGj0hJzB2a26qGJJ75YTtn7/FpiO6OmmJC
	fAZprWAgqhRyV46lczLD1W5RbVxdSi/JyGTAm8+2kYrXi9FRU8ssD9S4y+ZBesnHeWDE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm64: Place a speculation barrier following an ret instruction
Message-Id: <E1lZQRL-00081e-6Q@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 03:55:43 +0000

commit bcab2ac84931ab58e2f2cd1242ed551d8aaff021
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jun 16 16:33:12 2020 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 20 13:17:34 2021 +0100

    xen/arm64: Place a speculation barrier following an ret instruction
    
    Some CPUs can speculate past a RET instruction and potentially perform
    speculative accesses to memory before processing the return.
    
    There is no known gadget available after the RET instruction today.
    However some of the registers (such as in check_pending_guest_serror())
    may contain a value provided by the guest.
    
    In order to harden the code, it would be better to add a speculation
    barrier after each RET instruction. The performance impact is meant to
    be negligeable as the speculation barrier is not meant to be
    architecturally executed.
    
    Rather than manually inserting a speculation barrier, use a macro
    which overrides the mnemonic RET and replace with RET + SB. We need to
    use the opcode for RET to prevent any macro recursion.
    
    This patch is only covering the assembly code. C code would need to be
    covered separately using the compiler support.
    
    Note that the definition of the macros sb needs to be moved earlier in
    asm-arm/macros.h so it can be used by the new macro.
    
    This is part of the work to mitigate straight-line speculation.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/include/asm-arm/arm64/macros.h |  6 ++++++
 xen/include/asm-arm/macros.h       | 18 +++++++++---------
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/xen/include/asm-arm/arm64/macros.h b/xen/include/asm-arm/arm64/macros.h
index f981b4f43e..5ad66efd6b 100644
--- a/xen/include/asm-arm/arm64/macros.h
+++ b/xen/include/asm-arm/arm64/macros.h
@@ -21,6 +21,12 @@
     ldr     \dst, [\dst, \tmp]
     .endm
 
+    .macro  ret
+        /* ret opcode */
+        .inst 0xd65f03c0
+        sb
+    .endm
+
 /*
  * Register aliases.
  */
diff --git a/xen/include/asm-arm/macros.h b/xen/include/asm-arm/macros.h
index 4833671f4c..1aa373760f 100644
--- a/xen/include/asm-arm/macros.h
+++ b/xen/include/asm-arm/macros.h
@@ -5,6 +5,15 @@
 # error "This file should only be included in assembly file"
 #endif
 
+    /*
+     * Speculative barrier
+     * XXX: Add support for the 'sb' instruction
+     */
+    .macro sb
+    dsb nsh
+    isb
+    .endm
+
 #if defined (CONFIG_ARM_32)
 # include <asm/arm32/macros.h>
 #elif defined(CONFIG_ARM_64)
@@ -20,13 +29,4 @@
     .endr
     .endm
 
-    /*
-     * Speculative barrier
-     * XXX: Add support for the 'sb' instruction
-     */
-    .macro sb
-    dsb nsh
-    isb
-    .endm
-
 #endif /* __ASM_ARM_MACROS_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 03:55:55 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 03:55:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.114999.219240 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZQRX-0000Ow-Iz; Thu, 22 Apr 2021 03:55:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 114999.219240; Thu, 22 Apr 2021 03: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 1lZQRX-0000Oo-GB; Thu, 22 Apr 2021 03:55:55 +0000
Received: by outflank-mailman (input) for mailman id 114999;
 Thu, 22 Apr 2021 03: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 1lZQRV-0000Oa-B8
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 03: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 1lZQRV-0004cO-AG
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 03:55:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZQRV-00082J-9W
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 03: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=7Y2W0hfBo9zcsYdxDKZ7uyEK3r8fzKqE5u6EfhyL1AQ=; b=qpl9jT62vxd1LdIzfH9RG/AXZB
	YDM6IcY695FXR+r34l4MwMhKNKqsuJXgLkS5Y5bqpSFK7uVv0Yx+q3uR8SYWY9+uvibQrxY6IHCGP
	5J7ztOYKgr2lwfpjgXCD4rAMhIayO6NWTJXZiU1S1DECay17gBOIs5qQrupo2BjbxzZM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: smmuv1: Revert associating the group pointer with the S2CR
Message-Id: <E1lZQRV-00082J-9W@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 03:55:53 +0000

commit 9f6cd4983715cb31f0ea540e6bbb63f799a35d8a
Author:     Rahul Singh <rahul.singh@arm.com>
AuthorDate: Fri Apr 16 12:25:02 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Apr 20 13:22:54 2021 +0100

    xen/arm: smmuv1: Revert associating the group pointer with the S2CR
    
    Revert the code that associates the group pointer with the S2CR as this
    code causing an issue when the SMMU device has more than one master
    device with same stream-id. This issue is introduced by commit
    0435784cc75d ("xen/arm: smmuv1: Intelligent SMR allocation”
    
    Reverting the code will not impact to use of SMMU if two devices use the
    same stream-id but each device will be in a separate group. This is the same
    behaviour before the code is merged.
    
    Fixes: 0435784cc75d ("xen/arm: smmuv1: Intelligent SMR allocation”
    Signed-off-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/drivers/passthrough/arm/smmu.c | 44 ++++----------------------------------
 1 file changed, 4 insertions(+), 40 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c
index 24ac4f3a80..1a68c2ab3b 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -597,7 +597,6 @@ enum arm_smmu_arch_version {
 };
 
 struct arm_smmu_s2cr {
-	struct iommu_group		*group;
 	int				count;
 	enum arm_smmu_s2cr_type		type;
 	enum arm_smmu_s2cr_privcfg	privcfg;
@@ -1498,7 +1497,6 @@ static int arm_smmu_master_alloc_smes(struct device *dev)
 	struct arm_smmu_master_cfg *cfg = find_smmu_master_cfg(dev);
 	struct arm_smmu_device *smmu = cfg->smmu;
 	struct arm_smmu_smr *smrs = smmu->smrs;
-	struct iommu_group *group;
 	int i, idx, ret;
 
 	spin_lock(&smmu->stream_map_lock);
@@ -1523,19 +1521,9 @@ static int arm_smmu_master_alloc_smes(struct device *dev)
 		cfg->smendx[i] = (s16)idx;
 	}
 
-	group = iommu_group_get(dev);
-	if (!group)
-		group = ERR_PTR(-ENOMEM);
-	if (IS_ERR(group)) {
-		ret = PTR_ERR(group);
-		goto out_err;
-	}
-	iommu_group_put(group);
-
 	/* It worked! Now, poke the actual hardware */
 	for_each_cfg_sme(cfg, i, idx) {
 		arm_smmu_write_sme(smmu, idx);
-		smmu->s2crs[idx].group = group;
 	}
 
 	spin_unlock(&smmu->stream_map_lock);
@@ -1966,27 +1954,6 @@ static void __arm_smmu_release_pci_iommudata(void *data)
 	kfree(data);
 }
 
-static struct iommu_group *arm_smmu_device_group(struct
-						arm_smmu_master_cfg *cfg)
-{
-	struct arm_smmu_device *smmu = cfg->smmu;
-	struct iommu_group *group = NULL;
-	int i, idx;
-
-	for_each_cfg_sme(cfg, i, idx) {
-		if (group && smmu->s2crs[idx].group &&
-		    group != smmu->s2crs[idx].group)
-			return ERR_PTR(-EINVAL);
-
-		group = smmu->s2crs[idx].group;
-	}
-
-	if (group)
-		return group;
-
-	return NULL;
-}
-
 static int arm_smmu_add_device(struct device *dev)
 {
 	struct arm_smmu_device *smmu;
@@ -2027,13 +1994,10 @@ static int arm_smmu_add_device(struct device *dev)
 		cfg->smmu = smmu;
 	}
 
-	group = arm_smmu_device_group(cfg);
-	if (!group) {
-		group = iommu_group_alloc();
-		if (IS_ERR(group)) {
-			dev_err(dev, "Failed to allocate IOMMU group\n");
-			return PTR_ERR(group);
-		}
+	group = iommu_group_alloc();
+	if (IS_ERR(group)) {
+		dev_err(dev, "Failed to allocate IOMMU group\n");
+		return PTR_ERR(group);
 	}
 
 	iommu_group_set_iommudata(group, cfg, releasefn);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 11:44:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 11:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115313.219908 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZXkd-0000Yl-JA; Thu, 22 Apr 2021 11:44:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115313.219908; Thu, 22 Apr 2021 11:44:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZXkd-0000Yd-GM; Thu, 22 Apr 2021 11:44:07 +0000
Received: by outflank-mailman (input) for mailman id 115313;
 Thu, 22 Apr 2021 11: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 1lZXkb-0000YW-HJ
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 11: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 1lZXkb-00054n-GP
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 11:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZXkb-0002nj-FE
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 11: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=TN599lOfiAyXc7r0+g3uxQ6f7DLdGCHyXxCPAVll3r8=; b=YhXZGa0yHeM3Q+ougU7NOOgXeC
	FXGOrr1jBrlg28hf0MtlvJC0ZLaBKGvox3E8NXD9p9EMfBxgy7qn3+THBEvgQ7owdMysA8h8Qy0ww
	xbFKTXntPVetjYQog4T2tKyefYkNzXR9+jl8+Zl0APLg+kiGTa5P6hWMozdgJfRn7MQo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/time: latch to-be-written TSC value early in rendezvous loop
Message-Id: <E1lZXkb-0002nj-FE@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 11:44:05 +0000

commit 6ca022a1e16a3ad46ddb3f5fff48b69a434b1c21
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 13:25:53 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 13:25:53 2021 +0200

    x86/time: latch to-be-written TSC value early in rendezvous loop
    
    To reduce latency on time_calibration_tsc_rendezvous()'s last loop
    iteration, read the value to be written on the last iteration at the end
    of the loop body (i.e. in particular at the end of the second to last
    iteration).
    
    On my single-socket 18-core Skylake system this reduces the average loop
    exit time on CPU0 (from the TSC write on the last iteration to until
    after the main loop) from around 32k cycles to around 29k (albeit the
    values measured on separate runs vary quite significantly).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/time.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 6bc1fd11d6..e92365f5bd 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1683,7 +1683,7 @@ static void time_calibration_tsc_rendezvous(void *_r)
     int i;
     struct calibration_rendezvous *r = _r;
     unsigned int total_cpus = cpumask_weight(&r->cpu_calibration_map);
-    uint64_t tsc = 0;
+    uint64_t tsc = 0, master_tsc = 0;
 
     /* Loop to get rid of cache effects on TSC skew. */
     for ( i = 4; i >= 0; i-- )
@@ -1708,7 +1708,7 @@ static void time_calibration_tsc_rendezvous(void *_r)
             atomic_inc(&r->semaphore);
 
             if ( i == 0 )
-                write_tsc(r->master_tsc_stamp);
+                write_tsc(master_tsc);
 
             while ( atomic_read(&r->semaphore) != (2*total_cpus - 1) )
                 cpu_relax();
@@ -1730,7 +1730,7 @@ static void time_calibration_tsc_rendezvous(void *_r)
             }
 
             if ( i == 0 )
-                write_tsc(r->master_tsc_stamp);
+                write_tsc(master_tsc);
 
             atomic_inc(&r->semaphore);
             while ( atomic_read(&r->semaphore) > total_cpus )
@@ -1739,9 +1739,17 @@ static void time_calibration_tsc_rendezvous(void *_r)
 
         /* Just in case a read above ended up reading zero. */
         tsc += !tsc;
+
+        /*
+         * To reduce latency of the TSC write on the last iteration,
+         * fetch the value to be written into a local variable. To avoid
+         * introducing yet another conditional branch (which the CPU may
+         * have difficulty predicting well) do this on all iterations.
+         */
+        master_tsc = r->master_tsc_stamp;
     }
 
-    time_calibration_rendezvous_tail(r, tsc, r->master_tsc_stamp);
+    time_calibration_rendezvous_tail(r, tsc, master_tsc);
 }
 
 /* Ordinary rendezvous function which does not modify TSC values. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 11:44:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 11:44:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115314.219912 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZXkn-0000ZX-LB; Thu, 22 Apr 2021 11:44:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115314.219912; Thu, 22 Apr 2021 11:44:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZXkn-0000ZP-Hv; Thu, 22 Apr 2021 11:44:17 +0000
Received: by outflank-mailman (input) for mailman id 115314;
 Thu, 22 Apr 2021 11: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 1lZXkl-0000ZH-Lt
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 11: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 1lZXkl-00054w-K1
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 11:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZXkl-0002oW-Ik
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 11: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=p1gIQ++rRU9EEozGbXsYtZuyyliag53hU0UN5KbUA3k=; b=DBEw3rKHO37brpc9YNVVC/SQz2
	Sg6Eo6C1iuYUHQBQfsz/8eEEkqZ3CSWys3yrlGI/TkiYiVdKe+ov6NHHjZDD1GLNfSvZ6yze7iU0y
	SA3lefV9C65392u5AfSOoHr9YokockcO/PkYVenZjVfuf31I8A1K24mUSaPANDvogMz4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/time: yield to hyperthreads after updating TSC during rendezvous
Message-Id: <E1lZXkl-0002oW-Ik@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 11:44:15 +0000

commit f1a042b9829687affabb95c7c1cbcde29f1d36bd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 13:26:26 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 13:26:26 2021 +0200

    x86/time: yield to hyperthreads after updating TSC during rendezvous
    
    Since we'd like the updates to be done as synchronously as possible,
    make an attempt at yielding immediately after the TSC write.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/time.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index e92365f5bd..5578b7b3a2 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1708,7 +1708,14 @@ static void time_calibration_tsc_rendezvous(void *_r)
             atomic_inc(&r->semaphore);
 
             if ( i == 0 )
+            {
                 write_tsc(master_tsc);
+                /*
+                 * Try to give our hyperthread(s), if any, a chance to do
+                 * the same as instantly as possible.
+                 */
+                cpu_relax();
+            }
 
             while ( atomic_read(&r->semaphore) != (2*total_cpus - 1) )
                 cpu_relax();
@@ -1730,7 +1737,14 @@ static void time_calibration_tsc_rendezvous(void *_r)
             }
 
             if ( i == 0 )
+            {
                 write_tsc(master_tsc);
+                /*
+                 * Try to give our hyperthread(s), if any, a chance to do
+                 * the same as instantly as possible.
+                 */
+                cpu_relax();
+            }
 
             atomic_inc(&r->semaphore);
             while ( atomic_read(&r->semaphore) > total_cpus )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 11:44:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 11:44:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115315.219917 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZXkw-0000bG-Nx; Thu, 22 Apr 2021 11:44:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115315.219917; Thu, 22 Apr 2021 11: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 1lZXkw-0000b8-L2; Thu, 22 Apr 2021 11:44:26 +0000
Received: by outflank-mailman (input) for mailman id 115315;
 Thu, 22 Apr 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 1lZXkv-0000ay-Oq
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 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 1lZXkv-000554-O2
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 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 1lZXkv-0002pP-MI
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 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=p3xZxpidwZEJ7N8RRybmxHQMPIb7elMDUH67KzR8hu0=; b=An9X/SB2CoNNbmUGdrjufD2PCF
	uv0j0dwMfCQmF7x9jzbdzJKf9n2kgXKodohB+A2OdF8E0x84hTWNnLewhzcVrsY2vQrJr4AWvZeLY
	GrFST4nPST7wvT5aVo2GHe+fLDJHsFjeQUbii2f/aAahun8d/f+nH5zBf08eu+LsIp9Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/EFI: program headers are an ELF concept
Message-Id: <E1lZXkv-0002pP-MI@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 11:44:25 +0000

commit d1657d9d8663693db2ae90913e9e77ce719af849
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 13:27:06 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 13:27:06 2021 +0200

    x86/EFI: program headers are an ELF concept
    
    While they apparently do no harm when building xen.efi, their use is
    potentially misleading. Conditionalize their use to be for just the ELF
    binary we produce.
    
    No change to the resulting binaries.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/xen.lds.S | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 0273f79152..3e29147b6a 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -34,13 +34,19 @@ OUTPUT_FORMAT(FORMAT, FORMAT, FORMAT)
 
 OUTPUT_ARCH(i386:x86-64)
 
+#ifndef EFI
 PHDRS
 {
   text PT_LOAD ;
-#if (defined(BUILD_ID) || defined (CONFIG_PVH_GUEST)) && !defined(EFI)
+#if defined(BUILD_ID) || defined(CONFIG_PVH_GUEST)
   note PT_NOTE ;
 #endif
 }
+#define PHDR(x) :x
+#else
+#define PHDR(x)
+#endif
+
 SECTIONS
 {
 #if !defined(EFI)
@@ -83,7 +89,7 @@ SECTIONS
        *(.text.kexec)
        *(.gnu.warning)
        _etext = .;             /* End of text section */
-  } :text = 0x9090
+  } PHDR(text) = 0x9090
 
   . = ALIGN(SECTION_ALIGN);
   __2M_text_end = .;
@@ -134,12 +140,12 @@ SECTIONS
        *(SORT(.data.vpci.*))
        __end_vpci_array = .;
 #endif
-  } :text
+  } PHDR(text)
 
 #if defined(CONFIG_PVH_GUEST) && !defined(EFI)
   DECL_SECTION(.note.Xen) {
       *(.note.Xen)
-  } :note :text
+  } PHDR(note) PHDR(text)
 #endif
 
 #if defined(BUILD_ID)
@@ -154,13 +160,13 @@ SECTIONS
        __note_gnu_build_id_start = .;
        *(.note.gnu.build-id)
        __note_gnu_build_id_end = .;
-  } :note :text
+  } PHDR(note) PHDR(text)
 #elif defined(BUILD_ID_EFI)
   DECL_SECTION(.buildid) {
        __note_gnu_build_id_start = .;
        *(.buildid)
        __note_gnu_build_id_end = .;
-  } :text
+  }
 #endif
 #endif
 
@@ -173,7 +179,7 @@ SECTIONS
   . = ALIGN(4);
   DECL_SECTION(.reloc) {
     *(.reloc)
-  } :text
+  } PHDR(text)
 #endif
 
   _erodata = .;
@@ -202,7 +208,7 @@ SECTIONS
 #ifdef EFI /* EFI wants to merge all of .init.*  ELF doesn't. */
        . = ALIGN(SMP_CACHE_BYTES);
 #else
-  } :text
+  } PHDR(text)
   DECL_SECTION(.init.data) {
 #endif
 
@@ -260,7 +266,7 @@ SECTIONS
        *(SORT(.data.vpci.*))
        __end_vpci_array = .;
 #endif
-  } :text
+  } PHDR(text)
 
   . = ALIGN(SECTION_ALIGN);
   __init_end = .;
@@ -281,7 +287,7 @@ SECTIONS
        *(.data.paramhypfs)
        __paramhypfs_end = .;
 #endif
-  } :text
+  } PHDR(text)
 
   DECL_SECTION(.data) {
        *(.data.page_aligned)
@@ -289,7 +295,7 @@ SECTIONS
        *(.data.rel)
        *(.data.rel.*)
        CONSTRUCTORS
-  } :text
+  } PHDR(text)
 
   DECL_SECTION(.bss) {
        __bss_start = .;
@@ -306,7 +312,7 @@ SECTIONS
        *(.bss)
        . = ALIGN(POINTER_ALIGN);
        __bss_end = .;
-  } :text
+  } PHDR(text)
   _end = . ;
 
   . = ALIGN(SECTION_ALIGN);
@@ -316,12 +322,12 @@ SECTIONS
   . = ALIGN(4);
   DECL_SECTION(.reloc) {
     *(.reloc)
-  } :text
+  }
   /* Trick the linker into setting the image size to exactly 16Mb. */
   . = ALIGN(__section_alignment__);
   DECL_SECTION(.pad) {
     . = ALIGN(MB(16));
-  } :text
+  }
 #endif
 
 #ifndef XEN_BUILD_EFI
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 11:44:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 11:44:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115316.219921 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZXl6-0000ct-Pl; Thu, 22 Apr 2021 11:44:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115316.219921; Thu, 22 Apr 2021 11: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 1lZXl6-0000ck-Mc; Thu, 22 Apr 2021 11:44:36 +0000
Received: by outflank-mailman (input) for mailman id 115316;
 Thu, 22 Apr 2021 11: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 1lZXl5-0000cc-Ss
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 11: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 1lZXl5-00055d-RB
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 11:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZXl5-0002qB-QN
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 11: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=XLNvl4/QIi31NJu5GKLM4gO3TUHRDhYqVG5Msqyo8b4=; b=vCY+mCqutddsFHhSkgnAQKhYUL
	a7Ye5WdI8Ru+RxAP9vRZ67q6bLoxHnhjqprKpjnMpuoo8jYA7eRfYYFivN5qrOPicJeA+Y2PHdL0S
	oN2GF2TgEyzSBJbCvVlm1g6sTu6D/OxaFtVp197mqW08MNLABvF86L8l8okgSCXmz0Tw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/EFI: redo .reloc section bounds determination
Message-Id: <E1lZXl5-0002qB-QN@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 11:44:35 +0000

commit d4057f3732baeeeed7f88e8b9b9f27b89fd7ef12
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 13:27:47 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 13:27:47 2021 +0200

    x86/EFI: redo .reloc section bounds determination
    
    There's no need to link relocs-dummy.o into the ELF binary. The two
    symbols needed can as well be provided by the linker script. Then our
    mkreloc tool also doesn't need to put them in the generated assembler
    source.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/Makefile           |  5 ++---
 xen/arch/x86/efi/mkreloc.c      |  6 +-----
 xen/arch/x86/efi/relocs-dummy.S |  2 --
 xen/arch/x86/xen.lds.S          | 31 ++++++++++++++-----------------
 4 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 053206e4f0..0b4c24112d 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -136,7 +136,6 @@ XEN_NO_PE_FIXUPS := $(if $(XEN_BUILD_EFI), \
 endif
 
 ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS)
-EFI_OBJS-$(XEN_BUILD_EFI) := efi/relocs-dummy.o
 
 ifeq ($(CONFIG_LTO),y)
 # Gather all LTO objects together
@@ -144,13 +143,13 @@ prelink_lto.o: $(ALL_OBJS) $(ALL_LIBS)
 	$(LD_LTO) -r -o $@ $(filter-out %.a,$^) --start-group $(filter %.a,$^) --end-group
 
 # Link it with all the binary objects
-prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o $(EFI_OBJS-y) FORCE
+prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o FORCE
 	$(call if_changed,ld)
 
 prelink-efi.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o FORCE
 	$(call if_changed,ld)
 else
-prelink.o: $(ALL_OBJS) $(ALL_LIBS) $(EFI_OBJS-y) FORCE
+prelink.o: $(ALL_OBJS) $(ALL_LIBS) FORCE
 	$(call if_changed,ld)
 
 prelink-efi.o: $(ALL_OBJS) $(ALL_LIBS) FORCE
diff --git a/xen/arch/x86/efi/mkreloc.c b/xen/arch/x86/efi/mkreloc.c
index 9efeaee7c5..083740ab8a 100644
--- a/xen/arch/x86/efi/mkreloc.c
+++ b/xen/arch/x86/efi/mkreloc.c
@@ -320,9 +320,7 @@ int main(int argc, char *argv[])
     }
 
     puts("\t.section .reloc, \"a\", @progbits\n"
-         "\t.balign 4\n"
-         "\t.globl __base_relocs_start, __base_relocs_end\n"
-         "__base_relocs_start:");
+         "\t.balign 4");
 
     for ( i = 0; i < nsec; ++i )
     {
@@ -373,8 +371,6 @@ int main(int argc, char *argv[])
 
     diff_sections(NULL, NULL, NULL, 0, 0, 0, 0);
 
-    puts("__base_relocs_end:");
-
     close(in1);
     close(in2);
 
diff --git a/xen/arch/x86/efi/relocs-dummy.S b/xen/arch/x86/efi/relocs-dummy.S
index d928a82d53..b95fa444da 100644
--- a/xen/arch/x86/efi/relocs-dummy.S
+++ b/xen/arch/x86/efi/relocs-dummy.S
@@ -1,10 +1,8 @@
 
 	.section .reloc, "a", @progbits
 	.balign 4
-GLOBAL(__base_relocs_start)
 	.long 0
 	.long 8
-GLOBAL(__base_relocs_end)
 
 	.globl VIRT_START, ALT_START
 	.equ VIRT_START, XEN_VIRT_START
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 3e29147b6a..5fadb02b7f 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -170,18 +170,6 @@ SECTIONS
 #endif
 #endif
 
-/*
- * ELF builds are linked to a fixed virtual address, and in principle
- * shouldn't have a .reloc section.  However, due to the way EFI support is
- * currently implemented, retaining the .reloc section is necessary.
- */
-#if defined(XEN_BUILD_EFI) && !defined(EFI)
-  . = ALIGN(4);
-  DECL_SECTION(.reloc) {
-    *(.reloc)
-  } PHDR(text)
-#endif
-
   _erodata = .;
 
   . = ALIGN(SECTION_ALIGN);
@@ -319,18 +307,27 @@ SECTIONS
   __2M_rwdata_end = .;
 
 #ifdef EFI
-  . = ALIGN(4);
-  DECL_SECTION(.reloc) {
+  .reloc ALIGN(4) : {
+    __base_relocs_start = .;
     *(.reloc)
+    __base_relocs_end = .;
   }
   /* Trick the linker into setting the image size to exactly 16Mb. */
   . = ALIGN(__section_alignment__);
   DECL_SECTION(.pad) {
     . = ALIGN(MB(16));
   }
-#endif
-
-#ifndef XEN_BUILD_EFI
+#elif defined(XEN_BUILD_EFI)
+  /*
+   * Due to the way EFI support is currently implemented, these two symbols
+   * need to be defined.  Their precise values shouldn't matter (the consuming
+   * function doesn't get called), but to be on the safe side both values would
+   * better match.  Of course the need to be reachable by the relocations
+   * referencing them.
+   */
+  PROVIDE(__base_relocs_start = .);
+  PROVIDE(__base_relocs_end = .);
+#else
   efi = .;
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 11:44:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 11:44:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115317.219926 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZXlG-0000eM-RR; Thu, 22 Apr 2021 11:44:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115317.219926; Thu, 22 Apr 2021 11:44:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZXlG-0000eB-O8; Thu, 22 Apr 2021 11:44:46 +0000
Received: by outflank-mailman (input) for mailman id 115317;
 Thu, 22 Apr 2021 11:44:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZXlF-0000e4-Uk
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 11: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 1lZXlF-00055o-U1
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 11:44:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZXlF-0002qu-TP
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 11: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=HgzjLflDlUlxLy+5IMWqbYM6s7DNxycS03jKx8wMAHE=; b=ecDbrpuThLt/1f+kzbzidrRyiS
	bv+DBota9KU59azEbFaB0+CDgfwvYcV/ID6Qn+IkMj0NGT9VVQjNgPr26NFXgn6TIi3qALeQOu729
	/m6cFZKGomL+3LAbYXvv7P07gV42SBttHDAzuA9ZC0UVUEY7ZGi3EOD+3wV2gwbD4mp0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: drop use of prelink-efi.o
Message-Id: <E1lZXlF-0002qu-TP@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 11:44:45 +0000

commit f27d9db17fdae34cb89441d0d5ebefb09fa7dce5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 13:28:37 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 13:28:37 2021 +0200

    x86: drop use of prelink-efi.o
    
    Now that its contents matches prelink.o, use that one uniformly.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/Makefile | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 0b4c24112d..b224b1cf89 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -145,18 +145,12 @@ prelink_lto.o: $(ALL_OBJS) $(ALL_LIBS)
 # Link it with all the binary objects
 prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o FORCE
 	$(call if_changed,ld)
-
-prelink-efi.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o FORCE
-	$(call if_changed,ld)
 else
 prelink.o: $(ALL_OBJS) $(ALL_LIBS) FORCE
 	$(call if_changed,ld)
-
-prelink-efi.o: $(ALL_OBJS) $(ALL_LIBS) FORCE
-	$(call if_changed,ld)
 endif
 
-targets += prelink.o prelink-efi.o
+targets += prelink.o
 
 $(TARGET)-syms: prelink.o xen.lds
 	$(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \
@@ -217,7 +211,7 @@ endif
 note_file_option ?= $(note_file)
 
 ifeq ($(XEN_BUILD_PE),y)
-$(TARGET).efi: prelink-efi.o $(note_file) efi.lds efi/relocs-dummy.o efi/mkreloc
+$(TARGET).efi: prelink.o $(note_file) efi.lds efi/relocs-dummy.o efi/mkreloc
 	$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
 	          $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< efi/relocs-dummy.o \
 	                $(BASEDIR)/common/symbols-dummy.o $(note_file_option) -o $(@D)/.$(@F).$(base).0 &&) :
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 11:44:56 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 11:44:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115319.219929 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZXlQ-0000m7-T1; Thu, 22 Apr 2021 11:44:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115319.219929; Thu, 22 Apr 2021 11: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 1lZXlQ-0000ly-Pi; Thu, 22 Apr 2021 11:44:56 +0000
Received: by outflank-mailman (input) for mailman id 115319;
 Thu, 22 Apr 2021 11:44:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZXlQ-0000lq-1X
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 11:44: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 1lZXlQ-00055r-0i
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 11:44:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZXlQ-0002rt-03
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 11:44:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/QH13IabQ3v0TzyGR6jiHCv/BxbrnmUAqflYFsUWNDM=; b=RrD8+x11EyVVqXooahm12QIUqD
	6L468499z2pSUoep6BPxmCAsAEYo5FjlQguxEKcspBItEUVHgTGgvlVLtQqKBlSuEVUmn2A3cppWI
	WwgEh7/FR7/5ngfSwd/aEOE/qUyGrVZ50Ch54mzOncPdoVavBylye+GS48ZeTXk2ksNk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/EFI: avoid use of GNU ld's --disable-reloc-section when possible
Message-Id: <E1lZXlQ-0002rt-03@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 11:44:56 +0000

commit 1be65ec4c8bc172aadd6bc1b6553c668152899ae
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 13:29:49 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 13:29:49 2021 +0200

    x86/EFI: avoid use of GNU ld's --disable-reloc-section when possible
    
    As of commit 6fa7408d72b3 ("ld: don't generate base relocations in PE
    output for absolute symbols") I'm feeling sufficiently confident in GNU
    ld to use its logic for generating base relocations, which was enabled
    for executables at some point last year (prior to that this would have
    got done only for DLLs).
    
    GNU ld, seeing the original relocations coming from the ELF object files,
    generates different relocation types for our page tables (64-bit ones,
    while mkreloc produces 32-bit ones). This requires also permitting and
    handling that type in efi_arch_relocate_image().
    
    Note that in the case that we leave base relocation generation to ld,
    while efi/relocs-dummy.o then won't be linked into any executable
    anymore, it still needs generating (and hence dependencies need to be
    kept as they are) in order to have VIRT_BASE pulled out of it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/Makefile       | 41 ++++++++++++++++++++++++++++++++---------
 xen/arch/x86/efi/check.c    | 14 ++++++++++++++
 xen/arch/x86/efi/efi-boot.h |  6 ++++--
 3 files changed, 50 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index b224b1cf89..5b47206ad1 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -123,18 +123,37 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
 	mv $(TMP) $(TARGET)
 
 ifneq ($(efi-y),)
+
 # Check if the compiler supports the MS ABI.
 export XEN_BUILD_EFI := $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o efi/check.o 2>/dev/null && echo y)
+CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
+
 # Check if the linker supports PE.
 EFI_LDFLAGS = $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=10 --strip-debug
 XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) $(EFI_LDFLAGS) -o efi/check.efi efi/check.o 2>/dev/null && echo y))
-CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
-# Check if the linker produces fixups in PE by default (we need to disable it doing so for now).
-XEN_NO_PE_FIXUPS := $(if $(XEN_BUILD_EFI), \
-                         $(shell $(LD) $(EFI_LDFLAGS) --disable-reloc-section -o efi/check.efi efi/check.o 2>/dev/null && \
-                                 echo --disable-reloc-section))
+
+ifeq ($(XEN_BUILD_PE),y)
+
+# Check if the linker produces fixups in PE by default
+nr-fixups := $(shell $(OBJDUMP) -p efi/check.efi | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
+ifeq ($(nr-fixups),2)
+MKRELOC := :
+relocs-dummy :=
+else
+MKRELOC := efi/mkreloc
+relocs-dummy := efi/relocs-dummy.o
+# If the linker produced fixups but not precisely two of them, we need to
+# disable it doing so.  But if it didn't produce any fixups, it also wouldn't
+# recognize the option.
+ifneq ($(nr-fixups),0)
+EFI_LDFLAGS += --disable-reloc-section
+endif
 endif
 
+endif # $(XEN_BUILD_PE)
+
+endif # $(efi-y)
+
 ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS)
 
 ifeq ($(CONFIG_LTO),y)
@@ -178,7 +197,7 @@ note.o: $(TARGET)-syms
 		--rename-section=.data=.note.gnu.build-id -S $@.bin $@
 	rm -f $@.bin
 
-EFI_LDFLAGS += --image-base=$(1) --stack=0,0 --heap=0,0 $(XEN_NO_PE_FIXUPS)
+EFI_LDFLAGS += --image-base=$(1) --stack=0,0 --heap=0,0
 EFI_LDFLAGS += --section-alignment=0x200000 --file-alignment=0x20
 EFI_LDFLAGS += --major-image-version=$(XEN_VERSION)
 EFI_LDFLAGS += --minor-image-version=$(XEN_SUBVERSION)
@@ -192,7 +211,11 @@ EFI_LDFLAGS += --no-insert-timestamp
 endif
 
 $(TARGET).efi: VIRT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A VIRT_START$$,,p')
+ifeq ($(MKRELOC),:)
+$(TARGET).efi: ALT_BASE :=
+else
 $(TARGET).efi: ALT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A ALT_START$$,,p')
+endif
 
 ifneq ($(build_id_linker),)
 ifeq ($(call ld-ver-build-id,$(LD) $(filter -m%,$(EFI_LDFLAGS))),y)
@@ -213,16 +236,16 @@ note_file_option ?= $(note_file)
 ifeq ($(XEN_BUILD_PE),y)
 $(TARGET).efi: prelink.o $(note_file) efi.lds efi/relocs-dummy.o efi/mkreloc
 	$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
-	          $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< efi/relocs-dummy.o \
+	          $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< $(relocs-dummy) \
 	                $(BASEDIR)/common/symbols-dummy.o $(note_file_option) -o $(@D)/.$(@F).$(base).0 &&) :
-	efi/mkreloc $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).0) >$(@D)/.$(@F).0r.S
+	$(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).0) >$(@D)/.$(@F).0r.S
 	$(NM) -pa --format=sysv $(@D)/.$(@F).$(VIRT_BASE).0 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0s.S
 	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o
 	$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
 	          $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< \
 	                $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o $(note_file_option) -o $(@D)/.$(@F).$(base).1 &&) :
-	efi/mkreloc $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).1) >$(@D)/.$(@F).1r.S
+	$(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).1) >$(@D)/.$(@F).1r.S
 	$(NM) -pa --format=sysv $(@D)/.$(@F).$(VIRT_BASE).1 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1s.S
 	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o
diff --git a/xen/arch/x86/efi/check.c b/xen/arch/x86/efi/check.c
index 7fedd5a610..9e473faad3 100644
--- a/xen/arch/x86/efi/check.c
+++ b/xen/arch/x86/efi/check.c
@@ -2,3 +2,17 @@ int __attribute__((__ms_abi__)) test(int i)
 {
     return i;
 }
+
+/*
+ * Populate an array with "addresses" of relocatable and absolute values.
+ * This is to probe ld for (a) emitting base relocations at all and (b) not
+ * emitting base relocations for absolute symbols.
+ */
+extern const unsigned char __image_base__[], __file_alignment__[],
+                           __section_alignment__[];
+const void *const data[] = {
+    __image_base__,
+    __file_alignment__,
+    __section_alignment__,
+    data,
+};
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 2541ba1f32..fb217031ff 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -86,10 +86,12 @@ static void __init efi_arch_relocate_image(unsigned long delta)
                 }
                 break;
             case PE_BASE_RELOC_DIR64:
-                if ( in_page_tables(addr) )
-                    blexit(L"Unexpected relocation type");
                 if ( delta )
+                {
                     *(u64 *)addr += delta;
+                    if ( in_page_tables(addr) )
+                        *(u64 *)addr += xen_phys_start;
+                }
                 break;
             default:
                 blexit(L"Unsupported relocation type");
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:22:25 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:22:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115357.220004 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYLc-00054c-8g; Thu, 22 Apr 2021 12:22:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115357.220004; Thu, 22 Apr 2021 12:22:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYLc-00054U-5o; Thu, 22 Apr 2021 12:22:20 +0000
Received: by outflank-mailman (input) for mailman id 115357;
 Thu, 22 Apr 2021 12:22:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYLa-00054P-9o
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:22:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYLa-0005k4-6p
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:22:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYLa-0005su-0y
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:22:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Wug72l1AcxUDxzkolnqty28k17U7O1eiYPpiKzIA8vQ=; b=FXGXo7IpVB9/sIVhfBUlSIX5Bo
	kf9L6pz1a1mflQ/so0ivujr6rxNChCbcwgYKR5/LWtCGqDKJiLjJyjtHy29GiWmDpL4VpgHvaIPBS
	G0zg8o9i7Rk1TfQcnwNQo0PvVrG35+AnBcGF9gxFczRwz1Vo41x2vgr8t9kUvFtlM7U4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mm: rewrite virt_to_xen_l*e
Message-Id: <E1lZYLa-0005su-0y@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:22:18 +0000

commit 4215992594b66e3f37ea776e71808987589c102a
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:12:31 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:12:31 2021 +0200

    x86/mm: rewrite virt_to_xen_l*e
    
    Rewrite those functions to use the new APIs. Modify its callers to unmap
    the pointer returned. Since alloc_xen_pagetable_new() is almost never
    useful unless accompanied by page clearing and a mapping, introduce a
    helper alloc_map_clear_xen_pt() for this sequence.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c        | 102 +++++++++++++++++++++++++++++++++--------------
 xen/include/asm-x86/mm.h |   1 +
 2 files changed, 72 insertions(+), 31 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index b7a10bbdd4..5944ef19dc 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4931,8 +4931,28 @@ void free_xen_pagetable_new(mfn_t mfn)
         free_xenheap_page(mfn_to_virt(mfn_x(mfn)));
 }
 
+void *alloc_mapped_pagetable(mfn_t *pmfn)
+{
+    mfn_t mfn = alloc_xen_pagetable_new();
+    void *ret;
+
+    if ( mfn_eq(mfn, INVALID_MFN) )
+        return NULL;
+
+    if ( pmfn )
+        *pmfn = mfn;
+    ret = map_domain_page(mfn);
+    clear_page(ret);
+
+    return ret;
+}
+
 static DEFINE_SPINLOCK(map_pgdir_lock);
 
+/*
+ * For virt_to_xen_lXe() functions, they take a linear address and return a
+ * pointer to Xen's LX entry. Caller needs to unmap the pointer.
+ */
 static l3_pgentry_t *virt_to_xen_l3e(unsigned long v)
 {
     l4_pgentry_t *pl4e;
@@ -4941,33 +4961,33 @@ static l3_pgentry_t *virt_to_xen_l3e(unsigned long v)
     if ( !(l4e_get_flags(*pl4e) & _PAGE_PRESENT) )
     {
         bool locking = system_state > SYS_STATE_boot;
-        l3_pgentry_t *l3t = alloc_xen_pagetable();
+        mfn_t l3mfn;
+        l3_pgentry_t *l3t = alloc_mapped_pagetable(&l3mfn);
 
         if ( !l3t )
             return NULL;
-        clear_page(l3t);
+        UNMAP_DOMAIN_PAGE(l3t);
         if ( locking )
             spin_lock(&map_pgdir_lock);
         if ( !(l4e_get_flags(*pl4e) & _PAGE_PRESENT) )
         {
-            l4_pgentry_t l4e = l4e_from_paddr(__pa(l3t), __PAGE_HYPERVISOR);
+            l4_pgentry_t l4e = l4e_from_mfn(l3mfn, __PAGE_HYPERVISOR);
 
             l4e_write(pl4e, l4e);
             efi_update_l4_pgtable(l4_table_offset(v), l4e);
-            l3t = NULL;
+            l3mfn = INVALID_MFN;
         }
         if ( locking )
             spin_unlock(&map_pgdir_lock);
-        if ( l3t )
-            free_xen_pagetable(l3t);
+        free_xen_pagetable_new(l3mfn);
     }
 
-    return l4e_to_l3e(*pl4e) + l3_table_offset(v);
+    return map_l3t_from_l4e(*pl4e) + l3_table_offset(v);
 }
 
 static l2_pgentry_t *virt_to_xen_l2e(unsigned long v)
 {
-    l3_pgentry_t *pl3e;
+    l3_pgentry_t *pl3e, l3e;
 
     pl3e = virt_to_xen_l3e(v);
     if ( !pl3e )
@@ -4976,31 +4996,37 @@ static l2_pgentry_t *virt_to_xen_l2e(unsigned long v)
     if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) )
     {
         bool locking = system_state > SYS_STATE_boot;
-        l2_pgentry_t *l2t = alloc_xen_pagetable();
+        mfn_t l2mfn;
+        l2_pgentry_t *l2t = alloc_mapped_pagetable(&l2mfn);
 
         if ( !l2t )
+        {
+            unmap_domain_page(pl3e);
             return NULL;
-        clear_page(l2t);
+        }
+        UNMAP_DOMAIN_PAGE(l2t);
         if ( locking )
             spin_lock(&map_pgdir_lock);
         if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) )
         {
-            l3e_write(pl3e, l3e_from_paddr(__pa(l2t), __PAGE_HYPERVISOR));
-            l2t = NULL;
+            l3e_write(pl3e, l3e_from_mfn(l2mfn, __PAGE_HYPERVISOR));
+            l2mfn = INVALID_MFN;
         }
         if ( locking )
             spin_unlock(&map_pgdir_lock);
-        if ( l2t )
-            free_xen_pagetable(l2t);
+        free_xen_pagetable_new(l2mfn);
     }
 
     BUG_ON(l3e_get_flags(*pl3e) & _PAGE_PSE);
-    return l3e_to_l2e(*pl3e) + l2_table_offset(v);
+    l3e = *pl3e;
+    unmap_domain_page(pl3e);
+
+    return map_l2t_from_l3e(l3e) + l2_table_offset(v);
 }
 
 l1_pgentry_t *virt_to_xen_l1e(unsigned long v)
 {
-    l2_pgentry_t *pl2e;
+    l2_pgentry_t *pl2e, l2e;
 
     pl2e = virt_to_xen_l2e(v);
     if ( !pl2e )
@@ -5009,26 +5035,32 @@ l1_pgentry_t *virt_to_xen_l1e(unsigned long v)
     if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )
     {
         bool locking = system_state > SYS_STATE_boot;
-        l1_pgentry_t *l1t = alloc_xen_pagetable();
+        mfn_t l1mfn;
+        l1_pgentry_t *l1t = alloc_mapped_pagetable(&l1mfn);
 
         if ( !l1t )
+        {
+            unmap_domain_page(pl2e);
             return NULL;
-        clear_page(l1t);
+        }
+        UNMAP_DOMAIN_PAGE(l1t);
         if ( locking )
             spin_lock(&map_pgdir_lock);
         if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )
         {
-            l2e_write(pl2e, l2e_from_paddr(__pa(l1t), __PAGE_HYPERVISOR));
-            l1t = NULL;
+            l2e_write(pl2e, l2e_from_mfn(l1mfn, __PAGE_HYPERVISOR));
+            l1mfn = INVALID_MFN;
         }
         if ( locking )
             spin_unlock(&map_pgdir_lock);
-        if ( l1t )
-            free_xen_pagetable(l1t);
+        free_xen_pagetable_new(l1mfn);
     }
 
     BUG_ON(l2e_get_flags(*pl2e) & _PAGE_PSE);
-    return l2e_to_l1e(*pl2e) + l1_table_offset(v);
+    l2e = *pl2e;
+    unmap_domain_page(pl2e);
+
+    return map_l1t_from_l2e(l2e) + l1_table_offset(v);
 }
 
 /* Convert to from superpage-mapping flags for map_pages_to_xen(). */
@@ -5085,7 +5117,7 @@ mfn_t xen_map_to_mfn(unsigned long va)
 
     L3T_INIT(l3page);
     CHECK_MAPPED(pl3e);
-    l3page = virt_to_page(pl3e);
+    l3page = mfn_to_page(domain_page_map_to_mfn(pl3e));
     L3T_LOCK(l3page);
 
     CHECK_MAPPED(l3e_get_flags(*pl3e) & _PAGE_PRESENT);
@@ -5124,7 +5156,8 @@ int map_pages_to_xen(
     unsigned int flags)
 {
     bool locking = system_state > SYS_STATE_boot;
-    l2_pgentry_t *pl2e, ol2e;
+    l3_pgentry_t *pl3e = NULL, ol3e;
+    l2_pgentry_t *pl2e = NULL, ol2e;
     l1_pgentry_t *pl1e, ol1e;
     unsigned int  i;
     int rc = -ENOMEM;
@@ -5148,15 +5181,16 @@ int map_pages_to_xen(
 
     while ( nr_mfns != 0 )
     {
-        l3_pgentry_t *pl3e, ol3e;
-
+        /* Clean up the previous iteration. */
         L3T_UNLOCK(current_l3page);
+        UNMAP_DOMAIN_PAGE(pl3e);
+        UNMAP_DOMAIN_PAGE(pl2e);
 
         pl3e = virt_to_xen_l3e(virt);
         if ( !pl3e )
             goto out;
 
-        current_l3page = virt_to_page(pl3e);
+        current_l3page = mfn_to_page(domain_page_map_to_mfn(pl3e));
         L3T_LOCK(current_l3page);
         ol3e = *pl3e;
 
@@ -5321,6 +5355,8 @@ int map_pages_to_xen(
                 pl1e = virt_to_xen_l1e(virt);
                 if ( pl1e == NULL )
                     goto out;
+
+                UNMAP_DOMAIN_PAGE(pl1e);
             }
             else if ( l2e_get_flags(*pl2e) & _PAGE_PSE )
             {
@@ -5498,6 +5534,8 @@ int map_pages_to_xen(
 
  out:
     L3T_UNLOCK(current_l3page);
+    unmap_domain_page(pl3e);
+    unmap_domain_page(pl2e);
     return rc;
 }
 
@@ -5521,6 +5559,7 @@ int populate_pt_range(unsigned long virt, unsigned long nr_mfns)
 int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
 {
     bool locking = system_state > SYS_STATE_boot;
+    l3_pgentry_t *pl3e = NULL;
     l2_pgentry_t *pl2e;
     l1_pgentry_t *pl1e;
     unsigned int  i;
@@ -5539,15 +5578,15 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
 
     while ( v < e )
     {
-        l3_pgentry_t *pl3e;
-
+        /* Clean up the previous iteration. */
         L3T_UNLOCK(current_l3page);
+        UNMAP_DOMAIN_PAGE(pl3e);
 
         pl3e = virt_to_xen_l3e(v);
         if ( !pl3e )
             goto out;
 
-        current_l3page = virt_to_page(pl3e);
+        current_l3page = mfn_to_page(domain_page_map_to_mfn(pl3e));
         L3T_LOCK(current_l3page);
 
         if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) )
@@ -5777,6 +5816,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
 
  out:
     L3T_UNLOCK(current_l3page);
+    unmap_domain_page(pl3e);
     return rc;
 }
 
diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index 041c158f03..111754675c 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -577,6 +577,7 @@ void *alloc_xen_pagetable(void);
 void free_xen_pagetable(void *v);
 mfn_t alloc_xen_pagetable_new(void);
 void free_xen_pagetable_new(mfn_t mfn);
+void *alloc_mapped_pagetable(mfn_t *pmfn);
 
 l1_pgentry_t *virt_to_xen_l1e(unsigned long v);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:22:30 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:22:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115358.220009 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYLm-00055j-AV; Thu, 22 Apr 2021 12:22:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115358.220009; Thu, 22 Apr 2021 12:22:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYLm-00055b-7Q; Thu, 22 Apr 2021 12:22:30 +0000
Received: by outflank-mailman (input) for mailman id 115358;
 Thu, 22 Apr 2021 12:22:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYLk-00055V-D3
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:22:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYLk-0005kN-C3
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:22:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYLk-0005tf-B0
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:22:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6AQfAPm13srqWLU/fmbtkswrmZDvZVPJf8w0JwpryeE=; b=AWJhbxs2Ie8ZFRDVMXEhqBiOC+
	C4IEqY/xgLQeRjc/DcdlpoF85eeGs4E73NEbQdo09+5JJUENnxMG+pdipoBF0bRBU3h2DknGran9D
	ZTU2wbDXqRAJ4xfN2Xiy4HfC0FRLAClJrf9xdviJT7H3von6ZCPtwrmhdXPs4QMnNvcc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mm: switch to new APIs in map_pages_to_xen
Message-Id: <E1lZYLk-0005tf-B0@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:22:28 +0000

commit 4b5b08314ebc8146bfc4c2f8e356f1423a2b70ed
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:12:51 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:12:51 2021 +0200

    x86/mm: switch to new APIs in map_pages_to_xen
    
    Page tables allocated in that function should be mapped and unmapped
    now.
    
    Take the opportunity to avoid a potential double map in
    map_pages_to_xen() by initialising pl1e to NULL and only map it if it
    was not mapped earlier.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c | 64 +++++++++++++++++++++++++++++++++----------------------
 1 file changed, 38 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 5944ef19dc..a7549de05f 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5215,7 +5215,7 @@ int map_pages_to_xen(
                 }
                 else
                 {
-                    l2_pgentry_t *l2t = l3e_to_l2e(ol3e);
+                    l2_pgentry_t *l2t = map_l2t_from_l3e(ol3e);
 
                     for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
                     {
@@ -5227,10 +5227,11 @@ int map_pages_to_xen(
                         else
                         {
                             unsigned int j;
-                            const l1_pgentry_t *l1t = l2e_to_l1e(ol2e);
+                            const l1_pgentry_t *l1t = map_l1t_from_l2e(ol2e);
 
                             for ( j = 0; j < L1_PAGETABLE_ENTRIES; j++ )
                                 flush_flags(l1e_get_flags(l1t[j]));
+                            unmap_domain_page(l1t);
                         }
                     }
                     flush_area(virt, flush_flags);
@@ -5239,9 +5240,10 @@ int map_pages_to_xen(
                         ol2e = l2t[i];
                         if ( (l2e_get_flags(ol2e) & _PAGE_PRESENT) &&
                              !(l2e_get_flags(ol2e) & _PAGE_PSE) )
-                            free_xen_pagetable(l2e_to_l1e(ol2e));
+                            free_xen_pagetable_new(l2e_get_mfn(ol2e));
                     }
-                    free_xen_pagetable(l2t);
+                    unmap_domain_page(l2t);
+                    free_xen_pagetable_new(l3e_get_mfn(ol3e));
                 }
             }
 
@@ -5258,6 +5260,7 @@ int map_pages_to_xen(
             unsigned int flush_flags =
                 FLUSH_TLB | FLUSH_ORDER(2 * PAGETABLE_ORDER);
             l2_pgentry_t *l2t;
+            mfn_t l2mfn;
 
             /* Skip this PTE if there is no change. */
             if ( ((l3e_get_pfn(ol3e) & ~(L2_PAGETABLE_ENTRIES *
@@ -5279,15 +5282,17 @@ int map_pages_to_xen(
                 continue;
             }
 
-            l2t = alloc_xen_pagetable();
-            if ( l2t == NULL )
+            l2mfn = alloc_xen_pagetable_new();
+            if ( mfn_eq(l2mfn, INVALID_MFN) )
                 goto out;
 
+            l2t = map_domain_page(l2mfn);
             for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
                 l2e_write(l2t + i,
                           l2e_from_pfn(l3e_get_pfn(ol3e) +
                                        (i << PAGETABLE_ORDER),
                                        l3e_get_flags(ol3e)));
+            UNMAP_DOMAIN_PAGE(l2t);
 
             if ( l3e_get_flags(ol3e) & _PAGE_GLOBAL )
                 flush_flags |= FLUSH_TLB_GLOBAL;
@@ -5297,15 +5302,15 @@ int map_pages_to_xen(
             if ( (l3e_get_flags(*pl3e) & _PAGE_PRESENT) &&
                  (l3e_get_flags(*pl3e) & _PAGE_PSE) )
             {
-                l3e_write_atomic(pl3e, l3e_from_mfn(virt_to_mfn(l2t),
-                                                    __PAGE_HYPERVISOR));
-                l2t = NULL;
+                l3e_write_atomic(pl3e,
+                                 l3e_from_mfn(l2mfn, __PAGE_HYPERVISOR));
+                l2mfn = INVALID_MFN;
             }
             if ( locking )
                 spin_unlock(&map_pgdir_lock);
             flush_area(virt, flush_flags);
-            if ( l2t )
-                free_xen_pagetable(l2t);
+
+            free_xen_pagetable_new(l2mfn);
         }
 
         pl2e = virt_to_xen_l2e(virt);
@@ -5333,12 +5338,13 @@ int map_pages_to_xen(
                 }
                 else
                 {
-                    l1_pgentry_t *l1t = l2e_to_l1e(ol2e);
+                    l1_pgentry_t *l1t = map_l1t_from_l2e(ol2e);
 
                     for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
                         flush_flags(l1e_get_flags(l1t[i]));
                     flush_area(virt, flush_flags);
-                    free_xen_pagetable(l1t);
+                    unmap_domain_page(l1t);
+                    free_xen_pagetable_new(l2e_get_mfn(ol2e));
                 }
             }
 
@@ -5349,20 +5355,20 @@ int map_pages_to_xen(
         }
         else
         {
+            pl1e = NULL;
             /* Normal page mapping. */
             if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )
             {
                 pl1e = virt_to_xen_l1e(virt);
                 if ( pl1e == NULL )
                     goto out;
-
-                UNMAP_DOMAIN_PAGE(pl1e);
             }
             else if ( l2e_get_flags(*pl2e) & _PAGE_PSE )
             {
                 unsigned int flush_flags =
                     FLUSH_TLB | FLUSH_ORDER(PAGETABLE_ORDER);
                 l1_pgentry_t *l1t;
+                mfn_t l1mfn;
 
                 /* Skip this PTE if there is no change. */
                 if ( (((l2e_get_pfn(*pl2e) & ~(L1_PAGETABLE_ENTRIES - 1)) +
@@ -5382,14 +5388,16 @@ int map_pages_to_xen(
                     goto check_l3;
                 }
 
-                l1t = alloc_xen_pagetable();
-                if ( l1t == NULL )
+                l1mfn = alloc_xen_pagetable_new();
+                if ( mfn_eq(l1mfn, INVALID_MFN) )
                     goto out;
 
+                l1t = map_domain_page(l1mfn);
                 for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
                     l1e_write(&l1t[i],
                               l1e_from_pfn(l2e_get_pfn(*pl2e) + i,
                                            lNf_to_l1f(l2e_get_flags(*pl2e))));
+                UNMAP_DOMAIN_PAGE(l1t);
 
                 if ( l2e_get_flags(*pl2e) & _PAGE_GLOBAL )
                     flush_flags |= FLUSH_TLB_GLOBAL;
@@ -5399,20 +5407,22 @@ int map_pages_to_xen(
                 if ( (l2e_get_flags(*pl2e) & _PAGE_PRESENT) &&
                      (l2e_get_flags(*pl2e) & _PAGE_PSE) )
                 {
-                    l2e_write_atomic(pl2e, l2e_from_mfn(virt_to_mfn(l1t),
+                    l2e_write_atomic(pl2e, l2e_from_mfn(l1mfn,
                                                         __PAGE_HYPERVISOR));
-                    l1t = NULL;
+                    l1mfn = INVALID_MFN;
                 }
                 if ( locking )
                     spin_unlock(&map_pgdir_lock);
                 flush_area(virt, flush_flags);
-                if ( l1t )
-                    free_xen_pagetable(l1t);
+
+                free_xen_pagetable_new(l1mfn);
             }
 
-            pl1e  = l2e_to_l1e(*pl2e) + l1_table_offset(virt);
+            if ( !pl1e )
+                pl1e = map_l1t_from_l2e(*pl2e) + l1_table_offset(virt);
             ol1e  = *pl1e;
             l1e_write_atomic(pl1e, l1e_from_mfn(mfn, flags));
+            UNMAP_DOMAIN_PAGE(pl1e);
             if ( (l1e_get_flags(ol1e) & _PAGE_PRESENT) )
             {
                 unsigned int flush_flags = FLUSH_TLB | FLUSH_ORDER(0);
@@ -5456,12 +5466,13 @@ int map_pages_to_xen(
                     goto check_l3;
                 }
 
-                l1t = l2e_to_l1e(ol2e);
+                l1t = map_l1t_from_l2e(ol2e);
                 base_mfn = l1e_get_pfn(l1t[0]) & ~(L1_PAGETABLE_ENTRIES - 1);
                 for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
                     if ( (l1e_get_pfn(l1t[i]) != (base_mfn + i)) ||
                          (l1e_get_flags(l1t[i]) != flags) )
                         break;
+                UNMAP_DOMAIN_PAGE(l1t);
                 if ( i == L1_PAGETABLE_ENTRIES )
                 {
                     l2e_write_atomic(pl2e, l2e_from_pfn(base_mfn,
@@ -5471,7 +5482,7 @@ int map_pages_to_xen(
                     flush_area(virt - PAGE_SIZE,
                                FLUSH_TLB_GLOBAL |
                                FLUSH_ORDER(PAGETABLE_ORDER));
-                    free_xen_pagetable(l2e_to_l1e(ol2e));
+                    free_xen_pagetable_new(l2e_get_mfn(ol2e));
                 }
                 else if ( locking )
                     spin_unlock(&map_pgdir_lock);
@@ -5504,7 +5515,7 @@ int map_pages_to_xen(
                 continue;
             }
 
-            l2t = l3e_to_l2e(ol3e);
+            l2t = map_l2t_from_l3e(ol3e);
             base_mfn = l2e_get_pfn(l2t[0]) & ~(L2_PAGETABLE_ENTRIES *
                                               L1_PAGETABLE_ENTRIES - 1);
             for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
@@ -5512,6 +5523,7 @@ int map_pages_to_xen(
                       (base_mfn + (i << PAGETABLE_ORDER))) ||
                      (l2e_get_flags(l2t[i]) != l1f_to_lNf(flags)) )
                     break;
+            UNMAP_DOMAIN_PAGE(l2t);
             if ( i == L2_PAGETABLE_ENTRIES )
             {
                 l3e_write_atomic(pl3e, l3e_from_pfn(base_mfn,
@@ -5521,7 +5533,7 @@ int map_pages_to_xen(
                 flush_area(virt - PAGE_SIZE,
                            FLUSH_TLB_GLOBAL |
                            FLUSH_ORDER(2*PAGETABLE_ORDER));
-                free_xen_pagetable(l3e_to_l2e(ol3e));
+                free_xen_pagetable_new(l3e_get_mfn(ol3e));
             }
             else if ( locking )
                 spin_unlock(&map_pgdir_lock);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:22:40 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:22:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115359.220013 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYLw-000575-C4; Thu, 22 Apr 2021 12:22:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115359.220013; Thu, 22 Apr 2021 12:22:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYLw-00056x-95; Thu, 22 Apr 2021 12:22:40 +0000
Received: by outflank-mailman (input) for mailman id 115359;
 Thu, 22 Apr 2021 12:22:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYLu-00056l-HG
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:22:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYLu-0005kY-GH
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:22:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYLu-0005uK-EX
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:22:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tUTV1T6pwfAxRoejMUVj8QM7XjGyLBeC9D5oyLUJPSg=; b=t84At8XPTWL726ozRloAoxQxVb
	2vtTotCuRJ0oorAXiOs4UTEdL96H2izz7b1mhIqKiIKocDg3j/aeAYfwO7GOgRyh0nIUKv3vPwNEn
	j4l37GTAaGkYgNBSGiYlMyU3GwIePvQIPJscr8SvJsNtwlOJYMdRaW6waaHL+4MLDL8k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mm: switch to new APIs in modify_xen_mappings
Message-Id: <E1lZYLu-0005uK-EX@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:22:38 +0000

commit dd68f2e49bea791244919fcbca8a76b611d2fa29
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:13:02 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:13:02 2021 +0200

    x86/mm: switch to new APIs in modify_xen_mappings
    
    Page tables allocated in that function should be mapped and unmapped
    now.
    
    Note that pl2e now maybe mapped and unmapped in different iterations, so
    we need to add clean-ups for that.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c | 57 +++++++++++++++++++++++++++++++++++--------------------
 1 file changed, 36 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index a7549de05f..f6f4831f66 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5546,6 +5546,7 @@ int map_pages_to_xen(
 
  out:
     L3T_UNLOCK(current_l3page);
+    unmap_domain_page(pl2e);
     unmap_domain_page(pl3e);
     unmap_domain_page(pl2e);
     return rc;
@@ -5572,7 +5573,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
 {
     bool locking = system_state > SYS_STATE_boot;
     l3_pgentry_t *pl3e = NULL;
-    l2_pgentry_t *pl2e;
+    l2_pgentry_t *pl2e = NULL;
     l1_pgentry_t *pl1e;
     unsigned int  i;
     unsigned long v = s;
@@ -5592,6 +5593,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
     {
         /* Clean up the previous iteration. */
         L3T_UNLOCK(current_l3page);
+        UNMAP_DOMAIN_PAGE(pl2e);
         UNMAP_DOMAIN_PAGE(pl3e);
 
         pl3e = virt_to_xen_l3e(v);
@@ -5614,6 +5616,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
         if ( l3e_get_flags(*pl3e) & _PAGE_PSE )
         {
             l2_pgentry_t *l2t;
+            mfn_t l2mfn;
 
             if ( l2_table_offset(v) == 0 &&
                  l1_table_offset(v) == 0 &&
@@ -5630,35 +5633,38 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
             }
 
             /* PAGE1GB: shatter the superpage and fall through. */
-            l2t = alloc_xen_pagetable();
-            if ( !l2t )
+            l2mfn = alloc_xen_pagetable_new();
+            if ( mfn_eq(l2mfn, INVALID_MFN) )
                 goto out;
 
+            l2t = map_domain_page(l2mfn);
             for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
                 l2e_write(l2t + i,
                           l2e_from_pfn(l3e_get_pfn(*pl3e) +
                                        (i << PAGETABLE_ORDER),
                                        l3e_get_flags(*pl3e)));
+            UNMAP_DOMAIN_PAGE(l2t);
+
             if ( locking )
                 spin_lock(&map_pgdir_lock);
             if ( (l3e_get_flags(*pl3e) & _PAGE_PRESENT) &&
                  (l3e_get_flags(*pl3e) & _PAGE_PSE) )
             {
-                l3e_write_atomic(pl3e, l3e_from_mfn(virt_to_mfn(l2t),
-                                                    __PAGE_HYPERVISOR));
-                l2t = NULL;
+                l3e_write_atomic(pl3e,
+                                 l3e_from_mfn(l2mfn, __PAGE_HYPERVISOR));
+                l2mfn = INVALID_MFN;
             }
             if ( locking )
                 spin_unlock(&map_pgdir_lock);
-            if ( l2t )
-                free_xen_pagetable(l2t);
+
+            free_xen_pagetable_new(l2mfn);
         }
 
         /*
          * The L3 entry has been verified to be present, and we've dealt with
          * 1G pages as well, so the L2 table cannot require allocation.
          */
-        pl2e = l3e_to_l2e(*pl3e) + l2_table_offset(v);
+        pl2e = map_l2t_from_l3e(*pl3e) + l2_table_offset(v);
 
         if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )
         {
@@ -5686,41 +5692,45 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
             else
             {
                 l1_pgentry_t *l1t;
-
                 /* PSE: shatter the superpage and try again. */
-                l1t = alloc_xen_pagetable();
-                if ( !l1t )
+                mfn_t l1mfn = alloc_xen_pagetable_new();
+
+                if ( mfn_eq(l1mfn, INVALID_MFN) )
                     goto out;
 
+                l1t = map_domain_page(l1mfn);
                 for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
                     l1e_write(&l1t[i],
                               l1e_from_pfn(l2e_get_pfn(*pl2e) + i,
                                            l2e_get_flags(*pl2e) & ~_PAGE_PSE));
+                UNMAP_DOMAIN_PAGE(l1t);
+
                 if ( locking )
                     spin_lock(&map_pgdir_lock);
                 if ( (l2e_get_flags(*pl2e) & _PAGE_PRESENT) &&
                      (l2e_get_flags(*pl2e) & _PAGE_PSE) )
                 {
-                    l2e_write_atomic(pl2e, l2e_from_mfn(virt_to_mfn(l1t),
+                    l2e_write_atomic(pl2e, l2e_from_mfn(l1mfn,
                                                         __PAGE_HYPERVISOR));
-                    l1t = NULL;
+                    l1mfn = INVALID_MFN;
                 }
                 if ( locking )
                     spin_unlock(&map_pgdir_lock);
-                if ( l1t )
-                    free_xen_pagetable(l1t);
+
+                free_xen_pagetable_new(l1mfn);
             }
         }
         else
         {
             l1_pgentry_t nl1e, *l1t;
+            mfn_t l1mfn;
 
             /*
              * Ordinary 4kB mapping: The L2 entry has been verified to be
              * present, and we've dealt with 2M pages as well, so the L1 table
              * cannot require allocation.
              */
-            pl1e = l2e_to_l1e(*pl2e) + l1_table_offset(v);
+            pl1e = map_l1t_from_l2e(*pl2e) + l1_table_offset(v);
 
             /* Confirm the caller isn't trying to create new mappings. */
             if ( !(l1e_get_flags(*pl1e) & _PAGE_PRESENT) )
@@ -5731,6 +5741,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
                                (l1e_get_flags(*pl1e) & ~FLAGS_MASK) | nf);
 
             l1e_write_atomic(pl1e, nl1e);
+            UNMAP_DOMAIN_PAGE(pl1e);
             v += PAGE_SIZE;
 
             /*
@@ -5760,10 +5771,12 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
                 continue;
             }
 
-            l1t = l2e_to_l1e(*pl2e);
+            l1mfn = l2e_get_mfn(*pl2e);
+            l1t = map_domain_page(l1mfn);
             for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
                 if ( l1e_get_intpte(l1t[i]) != 0 )
                     break;
+            UNMAP_DOMAIN_PAGE(l1t);
             if ( i == L1_PAGETABLE_ENTRIES )
             {
                 /* Empty: zap the L2E and free the L1 page. */
@@ -5771,7 +5784,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
                 if ( locking )
                     spin_unlock(&map_pgdir_lock);
                 flush_area(NULL, FLUSH_TLB_GLOBAL); /* flush before free */
-                free_xen_pagetable(l1t);
+                free_xen_pagetable_new(l1mfn);
             }
             else if ( locking )
                 spin_unlock(&map_pgdir_lock);
@@ -5802,11 +5815,13 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
 
         {
             l2_pgentry_t *l2t;
+            mfn_t l2mfn = l3e_get_mfn(*pl3e);
 
-            l2t = l3e_to_l2e(*pl3e);
+            l2t = map_domain_page(l2mfn);
             for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
                 if ( l2e_get_intpte(l2t[i]) != 0 )
                     break;
+            UNMAP_DOMAIN_PAGE(l2t);
             if ( i == L2_PAGETABLE_ENTRIES )
             {
                 /* Empty: zap the L3E and free the L2 page. */
@@ -5814,7 +5829,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
                 if ( locking )
                     spin_unlock(&map_pgdir_lock);
                 flush_area(NULL, FLUSH_TLB_GLOBAL); /* flush before free */
-                free_xen_pagetable(l2t);
+                free_xen_pagetable_new(l2mfn);
             }
             else if ( locking )
                 spin_unlock(&map_pgdir_lock);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:22:50 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:22:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115360.220017 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYM6-00058m-F0; Thu, 22 Apr 2021 12:22:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115360.220017; Thu, 22 Apr 2021 12:22:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYM6-00058f-Bx; Thu, 22 Apr 2021 12:22:50 +0000
Received: by outflank-mailman (input) for mailman id 115360;
 Thu, 22 Apr 2021 12:22:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYM4-00058S-KA
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:22:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYM4-0005kf-JD
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:22:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYM4-0005ur-IZ
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:22:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BNCzoIwqqzLBI+okpXosfvWhNlUqWJKaTF+sRfPNwH8=; b=Qs2fB4+3Xxrj06TO3Z58tHv2DT
	2m3ylJpNHHjcdKrJL2aHNXhkrLKJOELC7Q0n6ud7h29TQ2yjoDMb8wTIHlQZqF34Bu4rjU9YKO6nP
	q02vBjJQ8MHLIvQ/h+6JHK10ozzMUF6uGw6PlEHjuNepNC4jJPzjMSY3pE4/41XctQJU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86_64/mm: introduce pl2e in paging_init
Message-Id: <E1lZYM4-0005ur-IZ@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:22:48 +0000

commit 33a8018d2e4e4c62b767f9934c682d9d8c90d3d5
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:13:13 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:13:13 2021 +0200

    x86_64/mm: introduce pl2e in paging_init
    
    We will soon map and unmap pages in paging_init(). Introduce pl2e so
    that we can use l2_ro_mpt to point to the page table itself.
    
    No functional change.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/mm.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index d7e67311fa..59049bdf8e 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -496,7 +496,7 @@ void __init paging_init(void)
     unsigned long i, mpt_size, va;
     unsigned int n, memflags;
     l3_pgentry_t *l3_ro_mpt;
-    l2_pgentry_t *l2_ro_mpt = NULL;
+    l2_pgentry_t *pl2e = NULL, *l2_ro_mpt = NULL;
     struct page_info *l1_pg;
 
     /*
@@ -546,7 +546,7 @@ void __init paging_init(void)
             (L2_PAGETABLE_SHIFT - 3 + PAGE_SHIFT)));
 
         if ( cpu_has_page1gb &&
-             !((unsigned long)l2_ro_mpt & ~PAGE_MASK) &&
+             !((unsigned long)pl2e & ~PAGE_MASK) &&
              (mpt_size >> L3_PAGETABLE_SHIFT) > (i >> PAGETABLE_ORDER) )
         {
             unsigned int k, holes;
@@ -606,7 +606,7 @@ void __init paging_init(void)
             memset((void *)(RDWR_MPT_VIRT_START + (i << L2_PAGETABLE_SHIFT)),
                    0xFF, 1UL << L2_PAGETABLE_SHIFT);
         }
-        if ( !((unsigned long)l2_ro_mpt & ~PAGE_MASK) )
+        if ( !((unsigned long)pl2e & ~PAGE_MASK) )
         {
             if ( (l2_ro_mpt = alloc_xen_pagetable()) == NULL )
                 goto nomem;
@@ -614,13 +614,14 @@ void __init paging_init(void)
             l3e_write(&l3_ro_mpt[l3_table_offset(va)],
                       l3e_from_paddr(__pa(l2_ro_mpt),
                                      __PAGE_HYPERVISOR_RO | _PAGE_USER));
+            pl2e = l2_ro_mpt;
             ASSERT(!l2_table_offset(va));
         }
         /* NB. Cannot be GLOBAL: guest user mode should not see it. */
         if ( l1_pg )
-            l2e_write(l2_ro_mpt, l2e_from_page(
+            l2e_write(pl2e, l2e_from_page(
                 l1_pg, /*_PAGE_GLOBAL|*/_PAGE_PSE|_PAGE_USER|_PAGE_PRESENT));
-        l2_ro_mpt++;
+        pl2e++;
     }
 #undef CNT
 #undef MFN
@@ -632,6 +633,7 @@ void __init paging_init(void)
             goto nomem;
         compat_idle_pg_table_l2 = l2_ro_mpt;
         clear_page(l2_ro_mpt);
+        pl2e = l2_ro_mpt;
 
         /* Allocate and map the compatibility mode machine-to-phys table. */
         mpt_size = (mpt_size >> 1) + (1UL << (L2_PAGETABLE_SHIFT - 1));
@@ -649,7 +651,7 @@ void __init paging_init(void)
              sizeof(*compat_machine_to_phys_mapping))
     BUILD_BUG_ON((sizeof(*frame_table) & ~sizeof(*frame_table)) % \
                  sizeof(*compat_machine_to_phys_mapping));
-    for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++, l2_ro_mpt++ )
+    for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++, pl2e++ )
     {
         memflags = MEMF_node(phys_to_nid(i <<
             (L2_PAGETABLE_SHIFT - 2 + PAGE_SHIFT)));
@@ -671,7 +673,7 @@ void __init paging_init(void)
                         (i << L2_PAGETABLE_SHIFT)),
                0xFF, 1UL << L2_PAGETABLE_SHIFT);
         /* NB. Cannot be GLOBAL as the ptes get copied into per-VM space. */
-        l2e_write(l2_ro_mpt, l2e_from_page(l1_pg, _PAGE_PSE|_PAGE_PRESENT));
+        l2e_write(pl2e, l2e_from_page(l1_pg, _PAGE_PSE|_PAGE_PRESENT));
     }
 #undef CNT
 #undef MFN
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:23:00 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:23:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115361.220021 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYMG-0005A0-GR; Thu, 22 Apr 2021 12:23:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115361.220021; Thu, 22 Apr 2021 12:23:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYMG-00059s-DQ; Thu, 22 Apr 2021 12:23:00 +0000
Received: by outflank-mailman (input) for mailman id 115361;
 Thu, 22 Apr 2021 12:22:58 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYME-00059g-Ph
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:22:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYME-0005kp-O8
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:22:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYME-0005vN-LP
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:22:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TmG0wPop0VUnrVE9WZD5hj+sE/DNHnOiYKnkT4fxkuc=; b=xZf9hzdImCJqmerLrLJB8Vudxr
	rOAEaZiCKJKE8mbHXZdo/tbswiND1xYTv1dA/AcFFGR+JAhLUpZ98MeC1UHftvbrQvQH3oxGJ6u0r
	1TVPAdO6JO69wngYWWvufmtDANSGO/jF3B/4TeB0s6iduQKhIAZwJHQ63hlysqcyBWuA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86_64/mm: switch to new APIs in paging_init
Message-Id: <E1lZYME-0005vN-LP@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:22:58 +0000

commit d87e3ff90dd9a66ce96191247eff215e52c9eeef
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:13:24 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:13:24 2021 +0200

    x86_64/mm: switch to new APIs in paging_init
    
    Map and unmap pages instead of relying on the direct map.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/mm.c | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index 59049bdf8e..3e40d529bb 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -498,6 +498,7 @@ void __init paging_init(void)
     l3_pgentry_t *l3_ro_mpt;
     l2_pgentry_t *pl2e = NULL, *l2_ro_mpt = NULL;
     struct page_info *l1_pg;
+    mfn_t mfn;
 
     /*
      * We setup the L3s for 1:1 mapping if host support memory hotplug
@@ -510,22 +511,22 @@ void __init paging_init(void)
         if ( !(l4e_get_flags(idle_pg_table[l4_table_offset(va)]) &
               _PAGE_PRESENT) )
         {
-            l3_pgentry_t *pl3t = alloc_xen_pagetable();
+            l3_pgentry_t *pl3t = alloc_mapped_pagetable(&mfn);
 
             if ( !pl3t )
                 goto nomem;
-            clear_page(pl3t);
+            UNMAP_DOMAIN_PAGE(pl3t);
             l4e_write(&idle_pg_table[l4_table_offset(va)],
-                      l4e_from_paddr(__pa(pl3t), __PAGE_HYPERVISOR_RW));
+                      l4e_from_mfn(mfn, __PAGE_HYPERVISOR_RW));
         }
     }
 
     /* Create user-accessible L2 directory to map the MPT for guests. */
-    if ( (l3_ro_mpt = alloc_xen_pagetable()) == NULL )
+    l3_ro_mpt = alloc_mapped_pagetable(&mfn);
+    if ( !l3_ro_mpt )
         goto nomem;
-    clear_page(l3_ro_mpt);
     l4e_write(&idle_pg_table[l4_table_offset(RO_MPT_VIRT_START)],
-              l4e_from_paddr(__pa(l3_ro_mpt), __PAGE_HYPERVISOR_RO | _PAGE_USER));
+              l4e_from_mfn(mfn, __PAGE_HYPERVISOR_RO | _PAGE_USER));
 
     /*
      * Allocate and map the machine-to-phys table.
@@ -608,12 +609,14 @@ void __init paging_init(void)
         }
         if ( !((unsigned long)pl2e & ~PAGE_MASK) )
         {
-            if ( (l2_ro_mpt = alloc_xen_pagetable()) == NULL )
+            UNMAP_DOMAIN_PAGE(l2_ro_mpt);
+
+            l2_ro_mpt = alloc_mapped_pagetable(&mfn);
+            if ( !l2_ro_mpt )
                 goto nomem;
-            clear_page(l2_ro_mpt);
+
             l3e_write(&l3_ro_mpt[l3_table_offset(va)],
-                      l3e_from_paddr(__pa(l2_ro_mpt),
-                                     __PAGE_HYPERVISOR_RO | _PAGE_USER));
+                      l3e_from_mfn(mfn, __PAGE_HYPERVISOR_RO | _PAGE_USER));
             pl2e = l2_ro_mpt;
             ASSERT(!l2_table_offset(va));
         }
@@ -625,15 +628,18 @@ void __init paging_init(void)
     }
 #undef CNT
 #undef MFN
+    UNMAP_DOMAIN_PAGE(l2_ro_mpt);
+    UNMAP_DOMAIN_PAGE(l3_ro_mpt);
 
     /* Create user-accessible L2 directory to map the MPT for compat guests. */
     if ( opt_pv32 )
     {
-        if ( (l2_ro_mpt = alloc_xen_pagetable()) == NULL )
+        mfn = alloc_xen_pagetable_new();
+        if ( mfn_eq(mfn, INVALID_MFN) )
             goto nomem;
-        compat_idle_pg_table_l2 = l2_ro_mpt;
-        clear_page(l2_ro_mpt);
-        pl2e = l2_ro_mpt;
+        compat_idle_pg_table_l2 = map_domain_page_global(mfn);
+        clear_page(compat_idle_pg_table_l2);
+        pl2e = compat_idle_pg_table_l2;
 
         /* Allocate and map the compatibility mode machine-to-phys table. */
         mpt_size = (mpt_size >> 1) + (1UL << (L2_PAGETABLE_SHIFT - 1));
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:23:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:23:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115362.220025 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYMQ-0005BD-Hy; Thu, 22 Apr 2021 12:23:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115362.220025; Thu, 22 Apr 2021 12:23:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYMQ-0005B5-Eu; Thu, 22 Apr 2021 12:23:10 +0000
Received: by outflank-mailman (input) for mailman id 115362;
 Thu, 22 Apr 2021 12:23:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYMO-0005Av-Sf
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:23:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYMO-0005lE-RU
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:23:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYMO-0005w3-QR
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:23:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fB4TH1+CWHNVhx8d4PI/RuUl2Uoloc4bHrIVs1YebcY=; b=O8aY6X+TcFSG3fRLdS3QCCIT1S
	ln/qbNk4Mvtu6kfYfGrzWlccH+d/qh3lCALOeQ5u8heUO7bZtohiN7hhh6G5IKIl2hmyBY9HJoGix
	2wMjxZW9YGaJhWwzfEangNo34ekExZOMEQV17eebNZOhqVuI7b+10sMyYbrJB0Yd/qNY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86_64/mm: switch to new APIs in setup_m2p_table
Message-Id: <E1lZYMO-0005w3-QR@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:23:08 +0000

commit 7e2fdcdb3e0fa215f08571037f6dea4abb3e94fb
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:13:34 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:13:34 2021 +0200

    x86_64/mm: switch to new APIs in setup_m2p_table
    
    While doing so, avoid repetitive mapping of l2_ro_mpt by keeping it
    across loops, and only unmap and map it when crossing 1G boundaries.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/mm.c | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index 3e40d529bb..c625075695 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -402,7 +402,8 @@ static int setup_m2p_table(struct mem_hotadd_info *info)
 
     ASSERT(l4e_get_flags(idle_pg_table[l4_table_offset(RO_MPT_VIRT_START)])
             & _PAGE_PRESENT);
-    l3_ro_mpt = l4e_to_l3e(idle_pg_table[l4_table_offset(RO_MPT_VIRT_START)]);
+    l3_ro_mpt = map_l3t_from_l4e(
+                    idle_pg_table[l4_table_offset(RO_MPT_VIRT_START)]);
 
     smap = (info->spfn & (~((1UL << (L2_PAGETABLE_SHIFT - 3)) -1)));
     emap = ((info->epfn + ((1UL << (L2_PAGETABLE_SHIFT - 3)) - 1 )) &
@@ -420,6 +421,10 @@ static int setup_m2p_table(struct mem_hotadd_info *info)
     i = smap;
     while ( i < emap )
     {
+        if ( (RO_MPT_VIRT_START + i * sizeof(*machine_to_phys_mapping)) &
+             ((1UL << L3_PAGETABLE_SHIFT) - 1) )
+            UNMAP_DOMAIN_PAGE(l2_ro_mpt);
+
         switch ( m2p_mapped(i) )
         {
         case M2P_1G_MAPPED:
@@ -455,32 +460,31 @@ static int setup_m2p_table(struct mem_hotadd_info *info)
 
             ASSERT(!(l3e_get_flags(l3_ro_mpt[l3_table_offset(va)]) &
                   _PAGE_PSE));
-            if ( l3e_get_flags(l3_ro_mpt[l3_table_offset(va)]) &
-              _PAGE_PRESENT )
-                l2_ro_mpt = l3e_to_l2e(l3_ro_mpt[l3_table_offset(va)]) +
-                  l2_table_offset(va);
+            if ( l2_ro_mpt )
+                /* nothing */;
+            else if ( l3e_get_flags(l3_ro_mpt[l3_table_offset(va)]) &
+                      _PAGE_PRESENT )
+                l2_ro_mpt = map_l2t_from_l3e(l3_ro_mpt[l3_table_offset(va)]);
             else
             {
-                l2_ro_mpt = alloc_xen_pagetable();
+                mfn_t l2_ro_mpt_mfn;
+
+                l2_ro_mpt = alloc_mapped_pagetable(&l2_ro_mpt_mfn);
                 if ( !l2_ro_mpt )
                 {
                     ret = -ENOMEM;
                     goto error;
                 }
 
-                clear_page(l2_ro_mpt);
                 l3e_write(&l3_ro_mpt[l3_table_offset(va)],
-                          l3e_from_paddr(__pa(l2_ro_mpt),
-                                         __PAGE_HYPERVISOR_RO | _PAGE_USER));
-                l2_ro_mpt += l2_table_offset(va);
+                          l3e_from_mfn(l2_ro_mpt_mfn,
+                                       __PAGE_HYPERVISOR_RO | _PAGE_USER));
             }
 
             /* NB. Cannot be GLOBAL: guest user mode should not see it. */
-            l2e_write(l2_ro_mpt, l2e_from_mfn(mfn,
+            l2e_write(&l2_ro_mpt[l2_table_offset(va)], l2e_from_mfn(mfn,
                    /*_PAGE_GLOBAL|*/_PAGE_PSE|_PAGE_USER|_PAGE_PRESENT));
         }
-        if ( !((unsigned long)l2_ro_mpt & ~PAGE_MASK) )
-            l2_ro_mpt = NULL;
         i += ( 1UL << (L2_PAGETABLE_SHIFT - 3));
     }
 #undef CNT
@@ -488,6 +492,8 @@ static int setup_m2p_table(struct mem_hotadd_info *info)
 
     ret = setup_compat_m2p_table(info);
 error:
+    unmap_domain_page(l2_ro_mpt);
+    unmap_domain_page(l3_ro_mpt);
     return ret;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:23:20 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:23:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115363.220029 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYMa-0005CX-Jc; Thu, 22 Apr 2021 12:23:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115363.220029; Thu, 22 Apr 2021 12:23:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYMa-0005CP-GR; Thu, 22 Apr 2021 12:23:20 +0000
Received: by outflank-mailman (input) for mailman id 115363;
 Thu, 22 Apr 2021 12:23:19 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYMY-0005CE-VZ
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:23:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYMY-0005lP-Ug
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:23:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYMY-0005yE-Tw
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:23:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GM9Gau4tfBpyxzASYjefMBM212zzUa6VSAXHezT6Zvc=; b=JBXUseSKm6BU9EdO9WYSoO6WGk
	oi+GS/hsldTzc344z0ORd/dUj+EfhLMGhvZciCikkLVJ/jFM1oqoHDN+FAfE1DfxIjCdN5fnpluOB
	OkvGwgPPnTcGo1kABctvmdCHfv1o3w1UMMQalWWnZQ/B1CW2fGK0V1S0TyGrIZd/XJoA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] efi: use new page table APIs in copy_mapping
Message-Id: <E1lZYMY-0005yE-Tw@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:23:18 +0000

commit a2b4c46b6eeebe0aa9a89ac134a3286be6ab6336
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:13:44 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:13:44 2021 +0200

    efi: use new page table APIs in copy_mapping
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/efi/boot.c | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 63e289ab85..539d86c6e8 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -6,6 +6,7 @@
 #include <xen/compile.h>
 #include <xen/ctype.h>
 #include <xen/dmi.h>
+#include <xen/domain_page.h>
 #include <xen/init.h>
 #include <xen/keyhandler.h>
 #include <xen/lib.h>
@@ -1439,29 +1440,42 @@ static __init void copy_mapping(unsigned long mfn, unsigned long end,
                                                  unsigned long emfn))
 {
     unsigned long next;
+    l3_pgentry_t *l3src = NULL, *l3dst = NULL;
 
     for ( ; mfn < end; mfn = next )
     {
         l4_pgentry_t l4e = efi_l4_pgtable[l4_table_offset(mfn << PAGE_SHIFT)];
-        l3_pgentry_t *l3src, *l3dst;
         unsigned long va = (unsigned long)mfn_to_virt(mfn);
 
+        if ( !(mfn & ((1UL << (L4_PAGETABLE_SHIFT - PAGE_SHIFT)) - 1)) )
+            UNMAP_DOMAIN_PAGE(l3dst);
+        if ( !(va & ((1UL << L4_PAGETABLE_SHIFT) - 1)) )
+            UNMAP_DOMAIN_PAGE(l3src);
         next = mfn + (1UL << (L3_PAGETABLE_SHIFT - PAGE_SHIFT));
         if ( !is_valid(mfn, min(next, end)) )
             continue;
-        if ( !(l4e_get_flags(l4e) & _PAGE_PRESENT) )
+
+        if ( l3dst )
+            /* nothing */;
+        else if ( !(l4e_get_flags(l4e) & _PAGE_PRESENT) )
         {
-            l3dst = alloc_xen_pagetable();
+            mfn_t l3mfn;
+
+            l3dst = alloc_mapped_pagetable(&l3mfn);
             BUG_ON(!l3dst);
-            clear_page(l3dst);
             efi_l4_pgtable[l4_table_offset(mfn << PAGE_SHIFT)] =
-                l4e_from_paddr(virt_to_maddr(l3dst), __PAGE_HYPERVISOR);
+                l4e_from_mfn(l3mfn, __PAGE_HYPERVISOR);
         }
         else
-            l3dst = l4e_to_l3e(l4e);
-        l3src = l4e_to_l3e(idle_pg_table[l4_table_offset(va)]);
+            l3dst = map_l3t_from_l4e(l4e);
+
+        if ( !l3src )
+            l3src = map_l3t_from_l4e(idle_pg_table[l4_table_offset(va)]);
         l3dst[l3_table_offset(mfn << PAGE_SHIFT)] = l3src[l3_table_offset(va)];
     }
+
+    unmap_domain_page(l3src);
+    unmap_domain_page(l3dst);
 }
 
 static bool __init ram_range_valid(unsigned long smfn, unsigned long emfn)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:23:30 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:23:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115364.220034 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYMk-0005E4-Lw; Thu, 22 Apr 2021 12:23:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115364.220034; Thu, 22 Apr 2021 12:23:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYMk-0005Du-I0; Thu, 22 Apr 2021 12:23:30 +0000
Received: by outflank-mailman (input) for mailman id 115364;
 Thu, 22 Apr 2021 12:23:29 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYMj-0005Dl-2L
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:23:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYMj-0005lq-1S
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:23:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYMj-0005z7-0r
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:23:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kGaeHQ6mLOLgzsBN6qlgwY6VOS2E4dqicvirtrUk+uQ=; b=jAw4sxEmRMmE1ucDDIS0aqwr3a
	WHHwcDsHM2uVevLODjSx41BqtS01c7tzIjNFYlB8cUcwHrdXewafxC7IeKD1BkmwgwTrRahSGVqjO
	jniPJXkNm3F0bKaRFmPHbay/Fjb/ylo39Bao9Y/lycFQcbIdVh+jhcBC9mCdWH3XMUUQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] efi: switch to new APIs in EFI code
Message-Id: <E1lZYMj-0005z7-0r@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:23:29 +0000

commit aad7aff5ea694cf065305f92225d52e43d6759ff
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:13:54 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:13:54 2021 +0200

    efi: switch to new APIs in EFI code
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/efi/runtime.h | 13 ++++++++---
 xen/common/efi/boot.c      | 55 +++++++++++++++++++++++++++-------------------
 xen/common/efi/efi.h       |  3 ++-
 xen/common/efi/runtime.c   |  8 +++----
 4 files changed, 48 insertions(+), 31 deletions(-)

diff --git a/xen/arch/x86/efi/runtime.h b/xen/arch/x86/efi/runtime.h
index d9eb8f5c27..77866c5f21 100644
--- a/xen/arch/x86/efi/runtime.h
+++ b/xen/arch/x86/efi/runtime.h
@@ -1,12 +1,19 @@
+#include <xen/domain_page.h>
+#include <xen/mm.h>
 #include <asm/atomic.h>
 #include <asm/mc146818rtc.h>
 
 #ifndef COMPAT
-l4_pgentry_t *__read_mostly efi_l4_pgtable;
+mfn_t __read_mostly efi_l4_mfn = INVALID_MFN_INITIALIZER;
 
 void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t l4e)
 {
-    if ( efi_l4_pgtable )
-        l4e_write(efi_l4_pgtable + l4idx, l4e);
+    if ( !mfn_eq(efi_l4_mfn, INVALID_MFN) )
+    {
+        l4_pgentry_t *efi_l4t = map_domain_page(efi_l4_mfn);
+
+        l4e_write(efi_l4t + l4idx, l4e);
+        unmap_domain_page(efi_l4t);
+    }
 }
 #endif
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 539d86c6e8..758f9d74d2 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -1437,14 +1437,15 @@ custom_param("efi", parse_efi_param);
 
 static __init void copy_mapping(unsigned long mfn, unsigned long end,
                                 bool (*is_valid)(unsigned long smfn,
-                                                 unsigned long emfn))
+                                                 unsigned long emfn),
+                                l4_pgentry_t *efi_l4t)
 {
     unsigned long next;
     l3_pgentry_t *l3src = NULL, *l3dst = NULL;
 
     for ( ; mfn < end; mfn = next )
     {
-        l4_pgentry_t l4e = efi_l4_pgtable[l4_table_offset(mfn << PAGE_SHIFT)];
+        l4_pgentry_t l4e = efi_l4t[l4_table_offset(mfn << PAGE_SHIFT)];
         unsigned long va = (unsigned long)mfn_to_virt(mfn);
 
         if ( !(mfn & ((1UL << (L4_PAGETABLE_SHIFT - PAGE_SHIFT)) - 1)) )
@@ -1463,7 +1464,7 @@ static __init void copy_mapping(unsigned long mfn, unsigned long end,
 
             l3dst = alloc_mapped_pagetable(&l3mfn);
             BUG_ON(!l3dst);
-            efi_l4_pgtable[l4_table_offset(mfn << PAGE_SHIFT)] =
+            efi_l4t[l4_table_offset(mfn << PAGE_SHIFT)] =
                 l4e_from_mfn(l3mfn, __PAGE_HYPERVISOR);
         }
         else
@@ -1496,6 +1497,7 @@ static bool __init rt_range_valid(unsigned long smfn, unsigned long emfn)
 void __init efi_init_memory(void)
 {
     unsigned int i;
+    l4_pgentry_t *efi_l4t;
     struct rt_extra {
         struct rt_extra *next;
         unsigned long smfn, emfn;
@@ -1610,11 +1612,10 @@ void __init efi_init_memory(void)
      * Set up 1:1 page tables for runtime calls. See SetVirtualAddressMap() in
      * efi_exit_boot().
      */
-    efi_l4_pgtable = alloc_xen_pagetable();
-    BUG_ON(!efi_l4_pgtable);
-    clear_page(efi_l4_pgtable);
+    efi_l4t = alloc_mapped_pagetable(&efi_l4_mfn);
+    BUG_ON(!efi_l4t);
 
-    copy_mapping(0, max_page, ram_range_valid);
+    copy_mapping(0, max_page, ram_range_valid, efi_l4t);
 
     /* Insert non-RAM runtime mappings inside the direct map. */
     for ( i = 0; i < efi_memmap_size; i += efi_mdesc_size )
@@ -1630,58 +1631,64 @@ void __init efi_init_memory(void)
             copy_mapping(PFN_DOWN(desc->PhysicalStart),
                          PFN_UP(desc->PhysicalStart +
                                 (desc->NumberOfPages << EFI_PAGE_SHIFT)),
-                         rt_range_valid);
+                         rt_range_valid, efi_l4t);
     }
 
     /* Insert non-RAM runtime mappings outside of the direct map. */
     while ( (extra = extra_head) != NULL )
     {
         unsigned long addr = extra->smfn << PAGE_SHIFT;
-        l4_pgentry_t l4e = efi_l4_pgtable[l4_table_offset(addr)];
+        l4_pgentry_t l4e = efi_l4t[l4_table_offset(addr)];
         l3_pgentry_t *pl3e;
         l2_pgentry_t *pl2e;
         l1_pgentry_t *l1t;
 
         if ( !(l4e_get_flags(l4e) & _PAGE_PRESENT) )
         {
-            pl3e = alloc_xen_pagetable();
+            mfn_t l3mfn;
+
+            pl3e = alloc_mapped_pagetable(&l3mfn);
             BUG_ON(!pl3e);
-            clear_page(pl3e);
-            efi_l4_pgtable[l4_table_offset(addr)] =
-                l4e_from_paddr(virt_to_maddr(pl3e), __PAGE_HYPERVISOR);
+            efi_l4t[l4_table_offset(addr)] =
+                l4e_from_mfn(l3mfn, __PAGE_HYPERVISOR);
         }
         else
-            pl3e = l4e_to_l3e(l4e);
+            pl3e = map_l3t_from_l4e(l4e);
         pl3e += l3_table_offset(addr);
         if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) )
         {
-            pl2e = alloc_xen_pagetable();
+            mfn_t l2mfn;
+
+            pl2e = alloc_mapped_pagetable(&l2mfn);
             BUG_ON(!pl2e);
-            clear_page(pl2e);
-            *pl3e = l3e_from_paddr(virt_to_maddr(pl2e), __PAGE_HYPERVISOR);
+            *pl3e = l3e_from_mfn(l2mfn, __PAGE_HYPERVISOR);
         }
         else
         {
             BUG_ON(l3e_get_flags(*pl3e) & _PAGE_PSE);
-            pl2e = l3e_to_l2e(*pl3e);
+            pl2e = map_l2t_from_l3e(*pl3e);
         }
+        UNMAP_DOMAIN_PAGE(pl3e);
         pl2e += l2_table_offset(addr);
         if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )
         {
-            l1t = alloc_xen_pagetable();
+            mfn_t l1mfn;
+
+            l1t = alloc_mapped_pagetable(&l1mfn);
             BUG_ON(!l1t);
-            clear_page(l1t);
-            *pl2e = l2e_from_paddr(virt_to_maddr(l1t), __PAGE_HYPERVISOR);
+            *pl2e = l2e_from_mfn(l1mfn, __PAGE_HYPERVISOR);
         }
         else
         {
             BUG_ON(l2e_get_flags(*pl2e) & _PAGE_PSE);
-            l1t = l2e_to_l1e(*pl2e);
+            l1t = map_l1t_from_l2e(*pl2e);
         }
+        UNMAP_DOMAIN_PAGE(pl2e);
         for ( i = l1_table_offset(addr);
               i < L1_PAGETABLE_ENTRIES && extra->smfn < extra->emfn;
               ++i, ++extra->smfn )
             l1t[i] = l1e_from_pfn(extra->smfn, extra->prot);
+        UNMAP_DOMAIN_PAGE(l1t);
 
         if ( extra->smfn == extra->emfn )
         {
@@ -1693,6 +1700,8 @@ void __init efi_init_memory(void)
     /* Insert Xen mappings. */
     for ( i = l4_table_offset(HYPERVISOR_VIRT_START);
           i < l4_table_offset(DIRECTMAP_VIRT_END); ++i )
-        efi_l4_pgtable[i] = idle_pg_table[i];
+        efi_l4t[i] = idle_pg_table[i];
+
+    unmap_domain_page(efi_l4t);
 }
 #endif
diff --git a/xen/common/efi/efi.h b/xen/common/efi/efi.h
index 663a8b5000..c9aa65d506 100644
--- a/xen/common/efi/efi.h
+++ b/xen/common/efi/efi.h
@@ -6,6 +6,7 @@
 #include <efi/eficapsule.h>
 #include <efi/efiapi.h>
 #include <xen/efi.h>
+#include <xen/mm.h>
 #include <xen/spinlock.h>
 #include <asm/page.h>
 
@@ -29,7 +30,7 @@ extern UINTN efi_memmap_size, efi_mdesc_size;
 extern void *efi_memmap;
 
 #ifdef CONFIG_X86
-extern l4_pgentry_t *efi_l4_pgtable;
+extern mfn_t efi_l4_mfn;
 #endif
 
 extern const struct efi_pci_rom *efi_pci_roms;
diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index 95367694b5..375b94229e 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -85,7 +85,7 @@ struct efi_rs_state efi_rs_enter(void)
     static const u32 mxcsr = MXCSR_DEFAULT;
     struct efi_rs_state state = { .cr3 = 0 };
 
-    if ( !efi_l4_pgtable )
+    if ( mfn_eq(efi_l4_mfn, INVALID_MFN) )
         return state;
 
     state.cr3 = read_cr3();
@@ -111,7 +111,7 @@ struct efi_rs_state efi_rs_enter(void)
         lgdt(&gdt_desc);
     }
 
-    switch_cr3_cr4(virt_to_maddr(efi_l4_pgtable), read_cr4());
+    switch_cr3_cr4(mfn_to_maddr(efi_l4_mfn), read_cr4());
 
     return state;
 }
@@ -140,9 +140,9 @@ void efi_rs_leave(struct efi_rs_state *state)
 
 bool efi_rs_using_pgtables(void)
 {
-    return efi_l4_pgtable &&
+    return !mfn_eq(efi_l4_mfn, INVALID_MFN) &&
            (smp_processor_id() == efi_rs_on_cpu) &&
-           (read_cr3() == virt_to_maddr(efi_l4_pgtable));
+           (read_cr3() == mfn_to_maddr(efi_l4_mfn));
 }
 
 unsigned long efi_get_time(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:23:39 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:23:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115365.220037 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYMt-0005FJ-PF; Thu, 22 Apr 2021 12:23:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115365.220037; Thu, 22 Apr 2021 12:23:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYMt-0005FB-Ln; Thu, 22 Apr 2021 12:23:39 +0000
Received: by outflank-mailman (input) for mailman id 115365;
 Thu, 22 Apr 2021 12:23:39 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYMt-0005F4-5W
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:23:39 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYMt-0005lw-4l
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:23:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYMt-00060C-3d
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:23:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DAsvr0uKhqG2JYkNgfMfA5OUYh47ksL7HsI6hry2BeI=; b=EGmemWjBa6uC1VDCIibVG+lQxP
	Hb4lMCKBTkpTc0Ou/jglKTvgMOd6DoIJSeLyD7kQIgfu04wKusgS630kmG4S32Sh73xXQ7d2huqer
	odtwixfkc7CJPljT6OaXCSu/ebrvyM4iTdQvry90jY3gEnyC1Eayj82OWofqBlfDDsog=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/smpboot: add exit path for clone_mapping()
Message-Id: <E1lZYMt-00060C-3d@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:23:39 +0000

commit 62cd9f9895961ded34c14ca67a05c67706d07142
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:14:03 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:14:03 2021 +0200

    x86/smpboot: add exit path for clone_mapping()
    
    We will soon need to clean up page table mappings in the exit path.
    
    No functional change.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/smpboot.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 82c1012e89..e90c4dfa8a 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -696,6 +696,7 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
     l3_pgentry_t *pl3e;
     l2_pgentry_t *pl2e;
     l1_pgentry_t *pl1e;
+    int rc = 0;
 
     /*
      * Sanity check 'linear'.  We only allow cloning from the Xen virtual
@@ -736,7 +737,7 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
             pl1e = l2e_to_l1e(*pl2e) + l1_table_offset(linear);
             flags = l1e_get_flags(*pl1e);
             if ( !(flags & _PAGE_PRESENT) )
-                return 0;
+                goto out;
             pfn = l1e_get_pfn(*pl1e);
         }
     }
@@ -744,8 +745,9 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
     if ( !(root_get_flags(rpt[root_table_offset(linear)]) & _PAGE_PRESENT) )
     {
         pl3e = alloc_xen_pagetable();
+        rc = -ENOMEM;
         if ( !pl3e )
-            return -ENOMEM;
+            goto out;
         clear_page(pl3e);
         l4e_write(&rpt[root_table_offset(linear)],
                   l4e_from_paddr(__pa(pl3e), __PAGE_HYPERVISOR));
@@ -758,8 +760,9 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
     if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) )
     {
         pl2e = alloc_xen_pagetable();
+        rc = -ENOMEM;
         if ( !pl2e )
-            return -ENOMEM;
+            goto out;
         clear_page(pl2e);
         l3e_write(pl3e, l3e_from_paddr(__pa(pl2e), __PAGE_HYPERVISOR));
     }
@@ -774,8 +777,9 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
     if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )
     {
         pl1e = alloc_xen_pagetable();
+        rc = -ENOMEM;
         if ( !pl1e )
-            return -ENOMEM;
+            goto out;
         clear_page(pl1e);
         l2e_write(pl2e, l2e_from_paddr(__pa(pl1e), __PAGE_HYPERVISOR));
     }
@@ -796,7 +800,9 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
     else
         l1e_write(pl1e, l1e_from_pfn(pfn, flags));
 
-    return 0;
+    rc = 0;
+ out:
+    return rc;
 }
 
 DEFINE_PER_CPU(root_pgentry_t *, root_pgt);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:23:49 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:23:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115366.220041 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYN3-0005Gi-QO; Thu, 22 Apr 2021 12:23:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115366.220041; Thu, 22 Apr 2021 12:23:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYN3-0005Ga-NY; Thu, 22 Apr 2021 12:23:49 +0000
Received: by outflank-mailman (input) for mailman id 115366;
 Thu, 22 Apr 2021 12:23:49 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYN3-0005GS-8K
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:23:49 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYN3-0005m3-7a
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:23:49 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYN3-00060q-73
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:23:49 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Dp0pA5fyWjWpqzvFTySyWP0cY8ErTNQdD8DmSPRiaxM=; b=EbZugr2NQ+FsaweQnS3TRQ+kIS
	kAWhbwSmP4CC22Bby2EKmf8MkkU8O6wAfbSrtAj7spF6iRo3lsHEHDstbGGB1JsNLbHJfWLbknCtF
	049yCTaNnT/ZKqSAHUGXA9R41Yqib8F+CZD1fF4KPnNAEtJABFcd3xiJHB//wG0QSPMA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/smpboot: switch clone_mapping() to new APIs
Message-Id: <E1lZYN3-00060q-73@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:23:49 +0000

commit d5f7d3dbdfdc4fa8160e92549f975c856140c923
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:14:13 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:14:13 2021 +0200

    x86/smpboot: switch clone_mapping() to new APIs
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/smpboot.c | 44 +++++++++++++++++++++++++++-----------------
 1 file changed, 27 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index e90c4dfa8a..765cf33960 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -694,8 +694,8 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
     unsigned long linear = (unsigned long)ptr, pfn;
     unsigned int flags;
     l3_pgentry_t *pl3e;
-    l2_pgentry_t *pl2e;
-    l1_pgentry_t *pl1e;
+    l2_pgentry_t *pl2e = NULL;
+    l1_pgentry_t *pl1e = NULL;
     int rc = 0;
 
     /*
@@ -710,7 +710,7 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
          (linear >= XEN_VIRT_END && linear < DIRECTMAP_VIRT_START) )
         return -EINVAL;
 
-    pl3e = l4e_to_l3e(idle_pg_table[root_table_offset(linear)]) +
+    pl3e = map_l3t_from_l4e(idle_pg_table[root_table_offset(linear)]) +
         l3_table_offset(linear);
 
     flags = l3e_get_flags(*pl3e);
@@ -723,7 +723,7 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
     }
     else
     {
-        pl2e = l3e_to_l2e(*pl3e) + l2_table_offset(linear);
+        pl2e = map_l2t_from_l3e(*pl3e) + l2_table_offset(linear);
         flags = l2e_get_flags(*pl2e);
         ASSERT(flags & _PAGE_PRESENT);
         if ( flags & _PAGE_PSE )
@@ -734,7 +734,7 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
         }
         else
         {
-            pl1e = l2e_to_l1e(*pl2e) + l1_table_offset(linear);
+            pl1e = map_l1t_from_l2e(*pl2e) + l1_table_offset(linear);
             flags = l1e_get_flags(*pl1e);
             if ( !(flags & _PAGE_PRESENT) )
                 goto out;
@@ -742,51 +742,58 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
         }
     }
 
+    UNMAP_DOMAIN_PAGE(pl1e);
+    UNMAP_DOMAIN_PAGE(pl2e);
+    unmap_domain_page(pl3e);
+
     if ( !(root_get_flags(rpt[root_table_offset(linear)]) & _PAGE_PRESENT) )
     {
-        pl3e = alloc_xen_pagetable();
+        mfn_t l3mfn;
+
+        pl3e = alloc_mapped_pagetable(&l3mfn);
         rc = -ENOMEM;
         if ( !pl3e )
             goto out;
-        clear_page(pl3e);
         l4e_write(&rpt[root_table_offset(linear)],
-                  l4e_from_paddr(__pa(pl3e), __PAGE_HYPERVISOR));
+                  l4e_from_mfn(l3mfn, __PAGE_HYPERVISOR));
     }
     else
-        pl3e = l4e_to_l3e(rpt[root_table_offset(linear)]);
+        pl3e = map_l3t_from_l4e(rpt[root_table_offset(linear)]);
 
     pl3e += l3_table_offset(linear);
 
     if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) )
     {
-        pl2e = alloc_xen_pagetable();
+        mfn_t l2mfn;
+
+        pl2e = alloc_mapped_pagetable(&l2mfn);
         rc = -ENOMEM;
         if ( !pl2e )
             goto out;
-        clear_page(pl2e);
-        l3e_write(pl3e, l3e_from_paddr(__pa(pl2e), __PAGE_HYPERVISOR));
+        l3e_write(pl3e, l3e_from_mfn(l2mfn, __PAGE_HYPERVISOR));
     }
     else
     {
         ASSERT(!(l3e_get_flags(*pl3e) & _PAGE_PSE));
-        pl2e = l3e_to_l2e(*pl3e);
+        pl2e = map_l2t_from_l3e(*pl3e);
     }
 
     pl2e += l2_table_offset(linear);
 
     if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )
     {
-        pl1e = alloc_xen_pagetable();
+        mfn_t l1mfn;
+
+        pl1e = alloc_mapped_pagetable(&l1mfn);
         rc = -ENOMEM;
         if ( !pl1e )
             goto out;
-        clear_page(pl1e);
-        l2e_write(pl2e, l2e_from_paddr(__pa(pl1e), __PAGE_HYPERVISOR));
+        l2e_write(pl2e, l2e_from_mfn(l1mfn, __PAGE_HYPERVISOR));
     }
     else
     {
         ASSERT(!(l2e_get_flags(*pl2e) & _PAGE_PSE));
-        pl1e = l2e_to_l1e(*pl2e);
+        pl1e = map_l1t_from_l2e(*pl2e);
     }
 
     pl1e += l1_table_offset(linear);
@@ -802,6 +809,9 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
 
     rc = 0;
  out:
+    unmap_domain_page(pl1e);
+    unmap_domain_page(pl2e);
+    unmap_domain_page(pl3e);
     return rc;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:23:59 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:23:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115367.220045 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYND-0005Iv-Ro; Thu, 22 Apr 2021 12:23:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115367.220045; Thu, 22 Apr 2021 12:23:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYND-0005In-P3; Thu, 22 Apr 2021 12:23:59 +0000
Received: by outflank-mailman (input) for mailman id 115367;
 Thu, 22 Apr 2021 12:23:59 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYND-0005Ig-Bc
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:23:59 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYND-0005mD-Aq
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:23:59 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYND-00061O-AD
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:23:59 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mi6WbrpyIz/I8lpKBRGNqgq2Z4kYUGfYEOb7PuplJ1I=; b=hEsEx3zZp77RXXMXbIVxQxVucm
	H10kmDVHcu4jXBkyfq2IkbhcMrO/AP4mdWuY62uuoK2aEDKDdAGIpZWBjcxaN2WWX6voqSk6Rk7SQ
	fd7TxHyYtKZCdtlPxGpBfJOk8WbqepByxtdKFogLC+0meXOpu9o6UGQGa4s9VN3L3Euw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mm: drop old page table APIs
Message-Id: <E1lZYND-00061O-AD@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:23:59 +0000

commit 16ea77931c815b60857de76d46c06d0ec741f99c
Author:     Hongyan Xia <hongyxia@amazon.com>
AuthorDate: Thu Apr 22 14:14:22 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:14:22 2021 +0200

    x86/mm: drop old page table APIs
    
    Two sets of old APIs, alloc/free_xen_pagetable() and lXe_to_lYe(), are
    now dropped to avoid the dependency on direct map.
    
    There are two special cases which still have not been re-written into
    the new APIs, thus need special treatment:
    
    rpt in smpboot.c cannot use ephemeral mappings yet. The problem is that
    rpt is read and written in context switch code, but the mapping
    infrastructure is NOT context-switch-safe, meaning we cannot map rpt in
    one domain and unmap in another. Before the mapping infrastructure
    supports context switches, rpt has to be globally mapped.
    
    Also, lXe_to_lYe() during Xen image relocation cannot be converted into
    map/unmap pairs. We cannot hold on to mappings while the mapping
    infrastructure is being relocated! It is enough to remove the direct map
    in the second e820 pass, so we still use the direct map (<4GiB) in Xen
    relocation (which is during the first e820 pass).
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c          | 14 --------------
 xen/arch/x86/setup.c       |  4 ++--
 xen/arch/x86/smpboot.c     |  4 ++--
 xen/include/asm-x86/mm.h   |  2 --
 xen/include/asm-x86/page.h |  5 -----
 5 files changed, 4 insertions(+), 25 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index f6f4831f66..ca8ef57e77 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4891,20 +4891,6 @@ int mmcfg_intercept_write(
     return X86EMUL_OKAY;
 }
 
-void *alloc_xen_pagetable(void)
-{
-    mfn_t mfn = alloc_xen_pagetable_new();
-
-    return mfn_eq(mfn, INVALID_MFN) ? NULL : mfn_to_virt(mfn_x(mfn));
-}
-
-void free_xen_pagetable(void *v)
-{
-    mfn_t mfn = v ? virt_to_mfn(v) : INVALID_MFN;
-
-    free_xen_pagetable_new(mfn);
-}
-
 /*
  * For these PTE APIs, the caller must follow the alloc-map-unmap-free
  * lifecycle, which means explicitly mapping the PTE pages before accessing
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index a6658d9769..f2dff2ae6a 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1247,7 +1247,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
                     continue;
                 *pl4e = l4e_from_intpte(l4e_get_intpte(*pl4e) +
                                         xen_phys_start);
-                pl3e = l4e_to_l3e(*pl4e);
+                pl3e = __va(l4e_get_paddr(*pl4e));
                 for ( j = 0; j < L3_PAGETABLE_ENTRIES; j++, pl3e++ )
                 {
                     /* Not present, 1GB mapping, or already relocated? */
@@ -1257,7 +1257,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
                         continue;
                     *pl3e = l3e_from_intpte(l3e_get_intpte(*pl3e) +
                                             xen_phys_start);
-                    pl2e = l3e_to_l2e(*pl3e);
+                    pl2e = __va(l3e_get_paddr(*pl3e));
                     for ( k = 0; k < L2_PAGETABLE_ENTRIES; k++, pl2e++ )
                     {
                         /* Not present, PSE, or already relocated? */
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 765cf33960..ad878d8aeb 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -830,7 +830,7 @@ static int setup_cpu_root_pgt(unsigned int cpu)
     if ( !opt_xpti_hwdom && !opt_xpti_domu )
         return 0;
 
-    rpt = alloc_xen_pagetable();
+    rpt = alloc_xenheap_page();
     if ( !rpt )
         return -ENOMEM;
 
@@ -933,7 +933,7 @@ static void cleanup_cpu_root_pgt(unsigned int cpu)
         free_xen_pagetable_new(l3mfn);
     }
 
-    free_xen_pagetable(rpt);
+    free_xenheap_page(rpt);
 
     /* Also zap the stub mapping for this CPU. */
     if ( stub_linear )
diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index 111754675c..0a72fa7a26 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -573,8 +573,6 @@ int vcpu_destroy_pagetables(struct vcpu *);
 void *do_page_walk(struct vcpu *v, unsigned long addr);
 
 /* Allocator functions for Xen pagetables. */
-void *alloc_xen_pagetable(void);
-void free_xen_pagetable(void *v);
 mfn_t alloc_xen_pagetable_new(void);
 void free_xen_pagetable_new(mfn_t mfn);
 void *alloc_mapped_pagetable(mfn_t *pmfn);
diff --git a/xen/include/asm-x86/page.h b/xen/include/asm-x86/page.h
index 4c7f2cb70c..1d080cffbe 100644
--- a/xen/include/asm-x86/page.h
+++ b/xen/include/asm-x86/page.h
@@ -180,11 +180,6 @@ static inline l4_pgentry_t l4e_from_paddr(paddr_t pa, unsigned int flags)
 #define l4e_has_changed(x,y,flags) \
     ( !!(((x).l4 ^ (y).l4) & ((PADDR_MASK&PAGE_MASK)|put_pte_flags(flags))) )
 
-/* Pagetable walking. */
-#define l2e_to_l1e(x)              ((l1_pgentry_t *)__va(l2e_get_paddr(x)))
-#define l3e_to_l2e(x)              ((l2_pgentry_t *)__va(l3e_get_paddr(x)))
-#define l4e_to_l3e(x)              ((l3_pgentry_t *)__va(l4e_get_paddr(x)))
-
 #define map_l1t_from_l2e(x)        (l1_pgentry_t *)map_domain_page(l2e_get_mfn(x))
 #define map_l2t_from_l3e(x)        (l2_pgentry_t *)map_domain_page(l3e_get_mfn(x))
 #define map_l3t_from_l4e(x)        (l3_pgentry_t *)map_domain_page(l4e_get_mfn(x))
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:24:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:24:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115368.220049 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYNN-0005Lt-Tv; Thu, 22 Apr 2021 12:24:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115368.220049; Thu, 22 Apr 2021 12:24: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 1lZYNN-0005Ll-Qm; Thu, 22 Apr 2021 12:24:09 +0000
Received: by outflank-mailman (input) for mailman id 115368;
 Thu, 22 Apr 2021 12:24:09 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYNN-0005Lf-Eo
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:24:09 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYNN-0005mc-E1
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:24:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYNN-000625-DQ
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:24:09 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wkVU4Nl08wwRZ3CBKJ/mbZ9wBqzwIarI6/O3put5DeA=; b=zm9BwD7rzSz9UYB5ANlBDrTDOX
	NZh98wnXHTFrgugN8H6QJY/daAUMctI8BVEBucJaEb8THTJtl8W1rnqpY5X4+UX51DcqDvgmLX+oR
	F1ziJCmDHTL5ylYa4qJTkWefrfbtwR/LfRasVp4srPO69WrFoSO9GMXT+nK8xEz8m3VE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: switch to use domheap page for page tables
Message-Id: <E1lZYNN-000625-DQ@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:24:09 +0000

commit bf6cead724b42e5d1956df94ed4fdbda816cc2f7
Author:     Hongyan Xia <hongyxia@amazon.com>
AuthorDate: Thu Apr 22 14:14:41 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:14:41 2021 +0200

    x86: switch to use domheap page for page tables
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index ca8ef57e77..38681123ac 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4901,10 +4901,10 @@ mfn_t alloc_xen_pagetable_new(void)
 {
     if ( system_state != SYS_STATE_early_boot )
     {
-        void *ptr = alloc_xenheap_page();
+        const struct page_info *pg = alloc_domheap_page(NULL, 0);
 
-        BUG_ON(!hardware_domain && !ptr);
-        return ptr ? virt_to_mfn(ptr) : INVALID_MFN;
+        BUG_ON(!hardware_domain && !pg);
+        return pg ? page_to_mfn(pg) : INVALID_MFN;
     }
 
     return alloc_boot_pages(1, 1);
@@ -4914,7 +4914,7 @@ mfn_t alloc_xen_pagetable_new(void)
 void free_xen_pagetable_new(mfn_t mfn)
 {
     if ( system_state != SYS_STATE_early_boot && !mfn_eq(mfn, INVALID_MFN) )
-        free_xenheap_page(mfn_to_virt(mfn_x(mfn)));
+        free_domheap_page(mfn_to_page(mfn));
 }
 
 void *alloc_mapped_pagetable(mfn_t *pmfn)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:24:20 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:24:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115369.220053 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYNY-0005NI-VM; Thu, 22 Apr 2021 12:24:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115369.220053; Thu, 22 Apr 2021 12:24:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYNY-0005NA-SU; Thu, 22 Apr 2021 12:24:20 +0000
Received: by outflank-mailman (input) for mailman id 115369;
 Thu, 22 Apr 2021 12:24:19 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYNX-0005N1-IW
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:24:19 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYNX-0005mj-HZ
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:24:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYNX-00062k-Gq
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:24:19 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=p55dj4BGmj+b7fNAYrlcHCXKvlBKConfv5RcPApIbgQ=; b=TuAL4l49zJ6z00V3Lo9v3Hg/sX
	nTL28CzhJMoXnxINfzXoMujAuMCMdNrxDMHB7FNoiDlRsQT7UoiayVoyW/dPqOJx6+qt4BKl7/rk9
	Dzav+sg3xBrnxjPQUAgtDm4HA2jvHph8FO/STHXPWRGOEIjy7NoyD4hTDxsHmjIZRDRU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mm: drop _new suffix for page table APIs
Message-Id: <E1lZYNX-00062k-Gq@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:24:19 +0000

commit 3e701a3a8314a69b6c93ce83427f5d324b003ad8
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:14:52 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:14:52 2021 +0200

    x86/mm: drop _new suffix for page table APIs
    
    No functional change.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c        | 44 ++++++++++++++++++++++----------------------
 xen/arch/x86/smpboot.c   |  6 +++---
 xen/arch/x86/x86_64/mm.c |  2 +-
 xen/include/asm-x86/mm.h |  4 ++--
 4 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 38681123ac..50229e38d3 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -369,7 +369,7 @@ void __init arch_init_memory(void)
             ASSERT(root_pgt_pv_xen_slots < ROOT_PAGETABLE_PV_XEN_SLOTS);
             if ( l4_table_offset(split_va) == l4_table_offset(split_va - 1) )
             {
-                mfn_t l3mfn = alloc_xen_pagetable_new();
+                mfn_t l3mfn = alloc_xen_pagetable();
 
                 if ( !mfn_eq(l3mfn, INVALID_MFN) )
                 {
@@ -4897,7 +4897,7 @@ int mmcfg_intercept_write(
  * them. The caller must check whether the allocation has succeeded, and only
  * pass valid MFNs to map_domain_page().
  */
-mfn_t alloc_xen_pagetable_new(void)
+mfn_t alloc_xen_pagetable(void)
 {
     if ( system_state != SYS_STATE_early_boot )
     {
@@ -4911,7 +4911,7 @@ mfn_t alloc_xen_pagetable_new(void)
 }
 
 /* mfn can be INVALID_MFN */
-void free_xen_pagetable_new(mfn_t mfn)
+void free_xen_pagetable(mfn_t mfn)
 {
     if ( system_state != SYS_STATE_early_boot && !mfn_eq(mfn, INVALID_MFN) )
         free_domheap_page(mfn_to_page(mfn));
@@ -4919,7 +4919,7 @@ void free_xen_pagetable_new(mfn_t mfn)
 
 void *alloc_mapped_pagetable(mfn_t *pmfn)
 {
-    mfn_t mfn = alloc_xen_pagetable_new();
+    mfn_t mfn = alloc_xen_pagetable();
     void *ret;
 
     if ( mfn_eq(mfn, INVALID_MFN) )
@@ -4965,7 +4965,7 @@ static l3_pgentry_t *virt_to_xen_l3e(unsigned long v)
         }
         if ( locking )
             spin_unlock(&map_pgdir_lock);
-        free_xen_pagetable_new(l3mfn);
+        free_xen_pagetable(l3mfn);
     }
 
     return map_l3t_from_l4e(*pl4e) + l3_table_offset(v);
@@ -5000,7 +5000,7 @@ static l2_pgentry_t *virt_to_xen_l2e(unsigned long v)
         }
         if ( locking )
             spin_unlock(&map_pgdir_lock);
-        free_xen_pagetable_new(l2mfn);
+        free_xen_pagetable(l2mfn);
     }
 
     BUG_ON(l3e_get_flags(*pl3e) & _PAGE_PSE);
@@ -5039,7 +5039,7 @@ l1_pgentry_t *virt_to_xen_l1e(unsigned long v)
         }
         if ( locking )
             spin_unlock(&map_pgdir_lock);
-        free_xen_pagetable_new(l1mfn);
+        free_xen_pagetable(l1mfn);
     }
 
     BUG_ON(l2e_get_flags(*pl2e) & _PAGE_PSE);
@@ -5226,10 +5226,10 @@ int map_pages_to_xen(
                         ol2e = l2t[i];
                         if ( (l2e_get_flags(ol2e) & _PAGE_PRESENT) &&
                              !(l2e_get_flags(ol2e) & _PAGE_PSE) )
-                            free_xen_pagetable_new(l2e_get_mfn(ol2e));
+                            free_xen_pagetable(l2e_get_mfn(ol2e));
                     }
                     unmap_domain_page(l2t);
-                    free_xen_pagetable_new(l3e_get_mfn(ol3e));
+                    free_xen_pagetable(l3e_get_mfn(ol3e));
                 }
             }
 
@@ -5268,7 +5268,7 @@ int map_pages_to_xen(
                 continue;
             }
 
-            l2mfn = alloc_xen_pagetable_new();
+            l2mfn = alloc_xen_pagetable();
             if ( mfn_eq(l2mfn, INVALID_MFN) )
                 goto out;
 
@@ -5296,7 +5296,7 @@ int map_pages_to_xen(
                 spin_unlock(&map_pgdir_lock);
             flush_area(virt, flush_flags);
 
-            free_xen_pagetable_new(l2mfn);
+            free_xen_pagetable(l2mfn);
         }
 
         pl2e = virt_to_xen_l2e(virt);
@@ -5330,7 +5330,7 @@ int map_pages_to_xen(
                         flush_flags(l1e_get_flags(l1t[i]));
                     flush_area(virt, flush_flags);
                     unmap_domain_page(l1t);
-                    free_xen_pagetable_new(l2e_get_mfn(ol2e));
+                    free_xen_pagetable(l2e_get_mfn(ol2e));
                 }
             }
 
@@ -5374,7 +5374,7 @@ int map_pages_to_xen(
                     goto check_l3;
                 }
 
-                l1mfn = alloc_xen_pagetable_new();
+                l1mfn = alloc_xen_pagetable();
                 if ( mfn_eq(l1mfn, INVALID_MFN) )
                     goto out;
 
@@ -5401,7 +5401,7 @@ int map_pages_to_xen(
                     spin_unlock(&map_pgdir_lock);
                 flush_area(virt, flush_flags);
 
-                free_xen_pagetable_new(l1mfn);
+                free_xen_pagetable(l1mfn);
             }
 
             if ( !pl1e )
@@ -5468,7 +5468,7 @@ int map_pages_to_xen(
                     flush_area(virt - PAGE_SIZE,
                                FLUSH_TLB_GLOBAL |
                                FLUSH_ORDER(PAGETABLE_ORDER));
-                    free_xen_pagetable_new(l2e_get_mfn(ol2e));
+                    free_xen_pagetable(l2e_get_mfn(ol2e));
                 }
                 else if ( locking )
                     spin_unlock(&map_pgdir_lock);
@@ -5519,7 +5519,7 @@ int map_pages_to_xen(
                 flush_area(virt - PAGE_SIZE,
                            FLUSH_TLB_GLOBAL |
                            FLUSH_ORDER(2*PAGETABLE_ORDER));
-                free_xen_pagetable_new(l3e_get_mfn(ol3e));
+                free_xen_pagetable(l3e_get_mfn(ol3e));
             }
             else if ( locking )
                 spin_unlock(&map_pgdir_lock);
@@ -5619,7 +5619,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
             }
 
             /* PAGE1GB: shatter the superpage and fall through. */
-            l2mfn = alloc_xen_pagetable_new();
+            l2mfn = alloc_xen_pagetable();
             if ( mfn_eq(l2mfn, INVALID_MFN) )
                 goto out;
 
@@ -5643,7 +5643,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
             if ( locking )
                 spin_unlock(&map_pgdir_lock);
 
-            free_xen_pagetable_new(l2mfn);
+            free_xen_pagetable(l2mfn);
         }
 
         /*
@@ -5679,7 +5679,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
             {
                 l1_pgentry_t *l1t;
                 /* PSE: shatter the superpage and try again. */
-                mfn_t l1mfn = alloc_xen_pagetable_new();
+                mfn_t l1mfn = alloc_xen_pagetable();
 
                 if ( mfn_eq(l1mfn, INVALID_MFN) )
                     goto out;
@@ -5703,7 +5703,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
                 if ( locking )
                     spin_unlock(&map_pgdir_lock);
 
-                free_xen_pagetable_new(l1mfn);
+                free_xen_pagetable(l1mfn);
             }
         }
         else
@@ -5770,7 +5770,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
                 if ( locking )
                     spin_unlock(&map_pgdir_lock);
                 flush_area(NULL, FLUSH_TLB_GLOBAL); /* flush before free */
-                free_xen_pagetable_new(l1mfn);
+                free_xen_pagetable(l1mfn);
             }
             else if ( locking )
                 spin_unlock(&map_pgdir_lock);
@@ -5815,7 +5815,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
                 if ( locking )
                     spin_unlock(&map_pgdir_lock);
                 flush_area(NULL, FLUSH_TLB_GLOBAL); /* flush before free */
-                free_xen_pagetable_new(l2mfn);
+                free_xen_pagetable(l2mfn);
             }
             else if ( locking )
                 spin_unlock(&map_pgdir_lock);
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index ad878d8aeb..0dce1ae872 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -922,15 +922,15 @@ static void cleanup_cpu_root_pgt(unsigned int cpu)
                     continue;
 
                 ASSERT(!(l2e_get_flags(l2t[i2]) & _PAGE_PSE));
-                free_xen_pagetable_new(l2e_get_mfn(l2t[i2]));
+                free_xen_pagetable(l2e_get_mfn(l2t[i2]));
             }
 
             unmap_domain_page(l2t);
-            free_xen_pagetable_new(l2mfn);
+            free_xen_pagetable(l2mfn);
         }
 
         unmap_domain_page(l3t);
-        free_xen_pagetable_new(l3mfn);
+        free_xen_pagetable(l3mfn);
     }
 
     free_xenheap_page(rpt);
diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index c625075695..c41ce847b3 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -640,7 +640,7 @@ void __init paging_init(void)
     /* Create user-accessible L2 directory to map the MPT for compat guests. */
     if ( opt_pv32 )
     {
-        mfn = alloc_xen_pagetable_new();
+        mfn = alloc_xen_pagetable();
         if ( mfn_eq(mfn, INVALID_MFN) )
             goto nomem;
         compat_idle_pg_table_l2 = map_domain_page_global(mfn);
diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index 0a72fa7a26..56d7a71a24 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -573,8 +573,8 @@ int vcpu_destroy_pagetables(struct vcpu *);
 void *do_page_walk(struct vcpu *v, unsigned long addr);
 
 /* Allocator functions for Xen pagetables. */
-mfn_t alloc_xen_pagetable_new(void);
-void free_xen_pagetable_new(mfn_t mfn);
+mfn_t alloc_xen_pagetable(void);
+void free_xen_pagetable(mfn_t mfn);
 void *alloc_mapped_pagetable(mfn_t *pmfn);
 
 l1_pgentry_t *virt_to_xen_l1e(unsigned long v);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:24:31 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:24:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115370.220056 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYNj-0005Os-2J; Thu, 22 Apr 2021 12:24:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115370.220056; Thu, 22 Apr 2021 12:24:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYNi-0005Ok-Vf; Thu, 22 Apr 2021 12:24:30 +0000
Received: by outflank-mailman (input) for mailman id 115370;
 Thu, 22 Apr 2021 12:24:29 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYNh-0005OX-N6
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:24:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYNh-0005n5-LQ
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:24:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYNh-00063a-Jx
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:24:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bIiafK+JooDOsvkphox153qKcZkdMZhgfyHYN79fgoY=; b=J8VOKi5AVhcY1pz8GKC1cr6kBb
	c8zQ4M3Qr0lV2yN6tubHt6MoWa/KTKqtzdcKfuewurpYt73/pjJfNLQxOXGqV2dkSHwC3es+aSeJe
	4ZXgwkyig4i39Mm62Qqhia0iPbEmxahGryvQEkmcac3/lsJAbJuAk+88jDV021iOHOXo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shim: Simplify compat handling in write_start_info()
Message-Id: <E1lZYNh-00063a-Jx@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:24:29 +0000

commit ecf5db4003290f98f5b600adbbf36c185d3e7b21
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Apr 19 15:33:05 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 22 13:17:33 2021 +0100

    x86/shim: Simplify compat handling in write_start_info()
    
    Factor out a compat boolean to remove the lfence overhead from multiple
    is_pv_32bit_domain() calls.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/shim.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index d16c0048c0..4c6f442274 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -280,12 +280,12 @@ void __init pv_shim_setup_dom(struct domain *d, l4_pgentry_t *l4start,
 static void write_start_info(struct domain *d)
 {
     struct cpu_user_regs *regs = guest_cpu_user_regs();
-    start_info_t *si = map_domain_page(_mfn(is_pv_32bit_domain(d) ? regs->edx
-                                                                  : regs->rdx));
+    bool compat = is_pv_32bit_domain(d);
+    start_info_t *si = map_domain_page(_mfn(compat ? regs->edx : regs->rdx));
     uint64_t param;
 
     snprintf(si->magic, sizeof(si->magic), "xen-3.0-x86_%s",
-             is_pv_32bit_domain(d) ? "32p" : "64");
+             compat ? "32p" : "64");
     si->nr_pages = domain_tot_pages(d);
     si->shared_info = virt_to_maddr(d->shared_info);
     si->flags = 0;
@@ -300,7 +300,7 @@ static void write_start_info(struct domain *d)
                                           &si->console.domU.mfn) )
         BUG();
 
-    if ( is_pv_32bit_domain(d) )
+    if ( compat )
         xlat_start_info(si, XLAT_start_info_console_domU);
 
     unmap_domain_page(si);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:24:41 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:24:41 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115371.220061 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYNt-0005QG-43; Thu, 22 Apr 2021 12:24:41 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115371.220061; Thu, 22 Apr 2021 12:24:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYNt-0005Q6-0w; Thu, 22 Apr 2021 12:24:41 +0000
Received: by outflank-mailman (input) for mailman id 115371;
 Thu, 22 Apr 2021 12:24:39 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYNr-0005Px-P2
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:24:39 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYNr-0005nG-OA
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:24:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYNr-00064G-Ne
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:24:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gsqJ65sw2u5WYf/KArWslJnW1Oo5pnf1562xtbWMKs4=; b=xevtsHeYq6mhGH+uqXrD1jvn83
	ghNaD5lJUIGseVIbmVPVE4MhBAF5vwY9Mgdk2kPfxRC8NRfR36yOJaCyxT8OVxHIV2sN93mtCuAeq
	8PhBLOniD81zUG9IlMr78Y8zT/w/Y2Oxv1d4tFHD39xRaY7A/CwSSXY7uxOzL9Pkdhsw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Drop TravisCI
Message-Id: <E1lZYNr-00064G-Ne@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:24:39 +0000

commit e0dc9b095e7c73dcf6dbfe5c87c33c4708da4d1f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Apr 21 10:16:13 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 22 13:17:33 2021 +0100

    CI: Drop TravisCI
    
    Travis-ci.org is shutting down shortly.  The arm cross-compile testing has
    been broken for a long time now, and all testing has now been superseded by
    our Gitlab infrastructure.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 .travis.yml | 86 -------------------------------------------------------------
 1 file changed, 86 deletions(-)

diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index f3cd15b79f..0000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,86 +0,0 @@
-language: c
-dist: trusty
-sudo: required
-# don't test master, smoke and coverity branches
-branches:
-    except:
-        - master
-        - smoke
-        - /^coverity-tested\/.*/
-        - /^stable-.*/
-matrix:
-    include:
-        - compiler: gcc
-          env: XEN_TARGET_ARCH=x86_64 debug=n
-        - compiler: gcc
-          env: XEN_TARGET_ARCH=x86_64 XEN_CONFIG_EXPERT=y RANDCONFIG=y debug=n
-        - compiler: gcc-5
-          env: XEN_TARGET_ARCH=x86_64 debug=n
-        - compiler: gcc
-          env: XEN_TARGET_ARCH=x86_64 debug=y
-        - compiler: gcc-5
-          env: XEN_TARGET_ARCH=x86_64 debug=y
-        - compiler: clang
-          env: XEN_TARGET_ARCH=x86_64 clang=y debug=n
-        - compiler: clang
-          env: XEN_TARGET_ARCH=x86_64 clang=y debug=y
-        - compiler: gcc
-          env: XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- debug=n
-        - compiler: gcc
-          env: XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- XEN_CONFIG_EXPERT=y RANDCONFIG=y debug=n
-        - compiler: gcc
-          env: XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- debug=y
-        - compiler: gcc
-          env: XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- debug=n
-        - compiler: gcc
-          env: XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- XEN_CONFIG_EXPERT=y RANDCONFIG=y debug=n
-        - compiler: gcc
-          env: XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- debug=y
-addons:
-    apt:
-        sources:
-            - ubuntu-toolchain-r-test
-        packages:
-            - zlib1g-dev
-            - libncurses5-dev
-            - libssl-dev
-            - python-dev
-            - xorg-dev
-            - uuid-dev
-            - libyajl-dev
-            - libaio-dev
-            - libglib2.0-dev
-            - libpixman-1-dev
-            - pkg-config
-            - flex
-            - bison
-            - acpica-tools
-            - bin86
-            - bcc
-            - libnl-3-dev
-            - ocaml-nox
-            - libfindlib-ocaml-dev
-            - transfig
-            - pandoc
-            - gcc-arm-linux-gnueabihf
-            - gcc-aarch64-linux-gnu
-            - gcc-5
-            - g++-5
-            - seabios
-            - checkpolicy
-            - ghostscript
-# we must set CXX manually instead of using 'language: cpp' due to
-# travis-ci/travis-ci#3871
-before_script:
-    - export CXX=${CC/cc/++}
-    - export CXX=${CXX/clang/clang++}
-script:
-    - ./scripts/travis-build
-after_script:
-    - cat xen/.config
-    - cat tools/config.log
-    - cat docs/config.log
-notifications:
-    irc:
-        channels:
-            - secure: "mPIFllF6eW3F3talvccMy55Tfcid66IPkkXZYCxDKRF2DQrMyvmg4qt0xN6gGZsdfOBMNr+/YfO5PxusBCUkVdBGBzd3QhFoIDYZbJZgzVh3yNDQ+x4L7p1cZNrwJ2loMmSX6KxGKZxZX9NRStrTUkVyp0jGZB9xkwT8Rl6jXj7EQkgQ95K1Wqafx0ycLfyDQmzX9bzi/3KIBFKMGmK18AFMh+R30zK0FPUUsS4+VhepIkVqO5puU3OYePd34wRnWlt7hjU2Vj5vYmVXp3UOE+E8/Lf9IGVAhitDi+EC35b8zo2BHJ9z6xZARYPvfSqbXcXV20RycabI+e3ufZJ40eatssly5QjWH+HhKS42C4gV1psmQhkTCNCM62Ty5uf6R1hsZJQuiOZrc8ojdje8ey2MxJk4R+Xz+Igg1/kD6+WX9/Y6Y3iRuj5HL1xCYfpTbK4mC7ofw0SofW2aAGI68jHpCqJdQCDzMl6748PlDMM0eKe0MPKIEenYHcoBnOEC/jciXUDa6wduV75EEip7oq2i+m44MopcsEDTpdliH077GhKapF0ActjvBTLpyoTRSfkKm0NZol/dgwd3PGG/mY8clIoeXWRb4opk93ejPC967KmSNC68SlfwaJmFZS5T9vAgb6k7r6i9G3dmYtrLKzws8IV1CPWqLzk58+v4pRk="
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:24:51 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:24:51 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115372.220065 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYO3-0005Y6-5d; Thu, 22 Apr 2021 12:24:51 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115372.220065; Thu, 22 Apr 2021 12:24:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYO3-0005Xy-2d; Thu, 22 Apr 2021 12:24:51 +0000
Received: by outflank-mailman (input) for mailman id 115372;
 Thu, 22 Apr 2021 12:24:49 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYO1-0005Xn-S7
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:24:49 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYO1-0005nT-RC
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:24:49 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYO1-00064x-QP
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:24:49 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=a1wUsyisLR2IM23O005CUxtqoB6CcJ6t/7/rYUCDXUs=; b=Miha8vRGnGjKEHWbtdP5h3sTkl
	9CtdtkP7nlPnIR86hJ31SAqBinMHRxzlBs+ZbiqZcQNCTuhSkVbE+MTFV4H8oiI0RKXXz+vod/wEH
	HrO53FOgGbHp0uRlX9mJwUr8Wl20t98i5rLmAOwV+0JO1xKkb5zqZ1iw6NdNJOc6BU3o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libs/light: Remove unnecessary libxl_list_vm() call
Message-Id: <E1lZYO1-00064x-QP@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:24:49 +0000

commit fe6cbbf163ec852d823379ab481c62044f92ea75
Author:     Costin Lupu <costin.lupu@cs.pub.ro>
AuthorDate: Mon Apr 19 16:01:42 2021 +0300
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 22 13:17:33 2021 +0100

    tools/libs/light: Remove unnecessary libxl_list_vm() call
    
    The removed lines were initially added by commit 314e64084d31, but the
    subsequent code which was using the nb_vm variable was later removed by
    commit 2ba368d13893, which makes these lines of code an overlooked
    reminiscence. Moreover, the call becomes very expensive when there is a
    considerable number of VMs (~1000 instances) running on the host.
    
    Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/light/libxl_create.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index 0c64268f66..43e9ba9c63 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -578,7 +578,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
                        uint32_t *domid, bool soft_reset)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
-    int ret, rc, nb_vm;
+    int ret, rc;
     const char *dom_type;
     char *uuid_string;
     char *dom_path, *vm_path, *libxl_path;
@@ -586,7 +586,6 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
     struct xs_permissions rwperm[1];
     struct xs_permissions noperm[1];
     xs_transaction_t t = 0;
-    libxl_vminfo *vm_list;
 
     /* convenience aliases */
     libxl_domain_create_info *info = &d_config->c_info;
@@ -869,14 +868,6 @@ retry_transaction:
                         ARRAY_SIZE(rwperm));
     }
 
-    vm_list = libxl_list_vm(ctx, &nb_vm);
-    if (!vm_list) {
-        LOGD(ERROR, *domid, "cannot get number of running guests");
-        rc = ERROR_FAIL;
-        goto out;
-    }
-    libxl_vminfo_list_free(vm_list, nb_vm);
-
     xs_write(ctx->xsh, t, GCSPRINTF("%s/uuid", vm_path), uuid_string, strlen(uuid_string));
     xs_write(ctx->xsh, t, GCSPRINTF("%s/name", vm_path), info->name, strlen(info->name));
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:55:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115405.220135 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYrK-0000TP-N3; Thu, 22 Apr 2021 12:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115405.220135; Thu, 22 Apr 2021 12:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYrK-0000TH-Jr; Thu, 22 Apr 2021 12:55:06 +0000
Received: by outflank-mailman (input) for mailman id 115405;
 Thu, 22 Apr 2021 12:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYrJ-0000TC-7Y
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:55:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYrJ-0006Hs-6V
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYrJ-0008Jx-4w
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:55:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5DirSjcCAJb2c3qa2GNThccBH3+Qt2Py4fxk8da3JL0=; b=oaBI5t8ndVgeHs+Ouz9Zveskm9
	rF9zyp+fOkD5RcOuAQJHP51ya5cUvgL2YDm8TYzlqtlMa0FnmA9jOR7pHNV0PgkvBsI3EoF34t36Q
	5wkMHx5dVuTLrzGlXO+oaWEUUnHFvPGE7NOP694Xo2d/h0af7Y46mGmQnpOtalXA0OVs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents
Message-Id: <E1lZYrJ-0008Jx-4w@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:55:05 +0000

commit 540d911c2813c3d8f4cdbb3f5672119e5e768a3d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:39:24 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:39:24 2021 +0200

    x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents
    
    Zapping leaf data for out of range leaves is just one half of it: To
    avoid guests (bogusly or worse) inferring information from mere leaf
    presence, also shrink maximum indicators such that the respective
    trailing entry is not all blank (unless of course it's the initial
    subleaf of a leaf that's not the final one).
    
    This is also in preparation of bumping the maximum basic leaf we
    support, to ensure guests not getting exposed related features won't
    observe a change in behavior.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/tests/cpu-policy/test-cpu-policy.c | 101 +++++++++++++++++++++++++++++++
 xen/arch/x86/cpuid.c                     |  12 ++++
 xen/arch/x86/traps.c                     |   6 +-
 xen/include/public/arch-x86/cpuid.h      |   6 +-
 xen/include/xen/lib/x86/cpuid.h          |   7 +++
 xen/lib/x86/cpuid.c                      |  39 ++++++++++++
 6 files changed, 168 insertions(+), 3 deletions(-)

diff --git a/tools/tests/cpu-policy/test-cpu-policy.c b/tools/tests/cpu-policy/test-cpu-policy.c
index 0fa209f1ea..cb578ca6e5 100644
--- a/tools/tests/cpu-policy/test-cpu-policy.c
+++ b/tools/tests/cpu-policy/test-cpu-policy.c
@@ -8,10 +8,13 @@
 #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, ...)                          \
 ({                                              \
@@ -553,6 +556,103 @@ 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 {
@@ -668,6 +768,7 @@ 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 050cd5713e..03a483b93a 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -341,6 +341,8 @@ 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)
@@ -410,6 +412,8 @@ 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)
@@ -430,6 +434,8 @@ 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)
@@ -495,6 +501,8 @@ 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)
@@ -519,6 +527,8 @@ 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)
@@ -699,6 +709,8 @@ 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)
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 3c2e563cce..e60af16ddd 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -964,13 +964,15 @@ void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_t leaf,
     uint32_t base = is_viridian_domain(d) ? 0x40000100 : 0x40000000;
     uint32_t idx  = leaf - base;
     unsigned int limit = is_viridian_domain(d) ? p->hv2_limit : p->hv_limit;
+    unsigned int dflt = is_pv_domain(d) ? XEN_CPUID_MAX_PV_NUM_LEAVES
+                                        : XEN_CPUID_MAX_HVM_NUM_LEAVES;
 
     if ( limit == 0 )
         /* Default number of leaves */
-        limit = XEN_CPUID_MAX_NUM_LEAVES;
+        limit = dflt;
     else
         /* Clamp toolstack value between 2 and MAX_NUM_LEAVES. */
-        limit = min(max(limit, 2u), XEN_CPUID_MAX_NUM_LEAVES + 0u);
+        limit = min(max(limit, 2u), dflt);
 
     if ( idx > limit )
         return;
diff --git a/xen/include/public/arch-x86/cpuid.h b/xen/include/public/arch-x86/cpuid.h
index ce46305bee..00926b1fef 100644
--- a/xen/include/public/arch-x86/cpuid.h
+++ b/xen/include/public/arch-x86/cpuid.h
@@ -113,6 +113,10 @@
 /* Max. address width in bits taking memory hotplug into account. */
 #define XEN_CPUID_MACHINE_ADDRESS_WIDTH_MASK (0xffu << 0)
 
-#define XEN_CPUID_MAX_NUM_LEAVES 5
+#define XEN_CPUID_MAX_PV_NUM_LEAVES 5
+#define XEN_CPUID_MAX_HVM_NUM_LEAVES 4
+#define XEN_CPUID_MAX_NUM_LEAVES \
+    (XEN_CPUID_MAX_PV_NUM_LEAVES > XEN_CPUID_MAX_HVM_NUM_LEAVES ? \
+     XEN_CPUID_MAX_PV_NUM_LEAVES : XEN_CPUID_MAX_HVM_NUM_LEAVES)
 
 #endif /* __XEN_PUBLIC_ARCH_X86_CPUID_H__ */
diff --git a/xen/include/xen/lib/x86/cpuid.h b/xen/include/xen/lib/x86/cpuid.h
index f4ef8a9f2f..ef695d2ff7 100644
--- a/xen/include/xen/lib/x86/cpuid.h
+++ b/xen/include/xen/lib/x86/cpuid.h
@@ -351,6 +351,13 @@ 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 8eb88314f5..1409c254c8 100644
--- a/xen/lib/x86/cpuid.c
+++ b/xen/lib/x86/cpuid.c
@@ -236,6 +236,45 @@ 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 Apr 22 12:55:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115406.220139 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYrU-0000UI-Ow; Thu, 22 Apr 2021 12:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115406.220139; Thu, 22 Apr 2021 12:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYrU-0000UA-Lh; Thu, 22 Apr 2021 12:55:16 +0000
Received: by outflank-mailman (input) for mailman id 115406;
 Thu, 22 Apr 2021 12:55:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYrT-0000Tz-C1
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:55:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYrT-0006Hv-AA
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYrT-0008L3-9G
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:55:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/RtjfINLzWtNo+DGGi3l0uFw6eXgAQ5IGhqtdmodeas=; b=Ytsj6LlgnlRpLEGbhG9OXtXXQe
	Jp+vmM00tKx5NIT6/QAe+8AemQql5j9F3gvHGna1KKeoGjtOOF+59bYB3HtReDt2Szd3he/HafPdc
	IEt8h6plGfLMBQmZsPitrgHNQRa9CcfbmRC44uGyajZmfSmuzijjIKM+VtcNky8ovIkM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move memset()
Message-Id: <E1lZYrT-0008L3-9G@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:55:15 +0000

commit 8bd9c8d50315d5f3eb146c889ce629e5fcb18efa
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:42:31 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:42:31 2021 +0200

    lib: move memset()
    
    By moving the function into an archive, x86 doesn't need to announce
    anymore that is has its own implementation - symbol resolution by the
    linker will now guarantee that the generic function remains unused, and
    the forwarding to the compiler built-in gets done by the common header
    anyway.
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c          | 20 --------------------
 xen/include/asm-x86/string.h |  3 ---
 xen/lib/Makefile             |  1 +
 xen/lib/memset.c             | 33 +++++++++++++++++++++++++++++++++
 4 files changed, 34 insertions(+), 23 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index af3d96ad0f..3c83736d6b 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -311,26 +311,6 @@ char *(strstr)(const char *s1, const char *s2)
 }
 #endif
 
-#ifndef __HAVE_ARCH_MEMSET
-/**
- * memset - Fill a region of memory with the given value
- * @s: Pointer to the start of the area.
- * @c: The byte to fill the area with
- * @count: The size of the area.
- *
- * Do not use memset() to access IO space, use memset_io() instead.
- */
-void *(memset)(void *s, int c, size_t count)
-{
-	char *xs = (char *) s;
-
-	while (count--)
-		*xs++ = c;
-
-	return s;
-}
-#endif
-
 #ifndef __HAVE_ARCH_MEMCPY
 /**
  * memcpy - Copy one area of memory to another
diff --git a/xen/include/asm-x86/string.h b/xen/include/asm-x86/string.h
index 4f1e1d4daf..3102d91f13 100644
--- a/xen/include/asm-x86/string.h
+++ b/xen/include/asm-x86/string.h
@@ -7,9 +7,6 @@
 #define __HAVE_ARCH_MEMMOVE
 #define memmove(d, s, n) __builtin_memmove(d, s, n)
 
-#define __HAVE_ARCH_MEMSET
-#define memset(s, c, n) __builtin_memset(s, c, n)
-
 #endif /* __X86_STRING_H__ */
 /*
  * Local variables:
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index a5dc1442a4..98e5747ca7 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -4,6 +4,7 @@ lib-y += bsearch.o
 lib-y += ctors.o
 lib-y += ctype.o
 lib-y += list-sort.o
+lib-y += memset.o
 lib-y += muldiv64.o
 lib-y += parse-size.o
 lib-y += rbtree.o
diff --git a/xen/lib/memset.c b/xen/lib/memset.c
new file mode 100644
index 0000000000..e86afafd02
--- /dev/null
+++ b/xen/lib/memset.c
@@ -0,0 +1,33 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * memset - Fill a region of memory with the given value
+ * @s: Pointer to the start of the area.
+ * @c: The byte to fill the area with
+ * @count: The size of the area.
+ *
+ * Do not use memset() to access IO space, use memset_io() instead.
+ */
+void *(memset)(void *s, int c, size_t count)
+{
+	char *xs = (char *) s;
+
+	while (count--)
+		*xs++ = c;
+
+	return s;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:55:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115407.220143 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYre-0000W1-SJ; Thu, 22 Apr 2021 12:55:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115407.220143; Thu, 22 Apr 2021 12:55:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYre-0000Vs-P2; Thu, 22 Apr 2021 12:55:26 +0000
Received: by outflank-mailman (input) for mailman id 115407;
 Thu, 22 Apr 2021 12:55:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYrd-0000VS-FK
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:55:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYrd-0006I6-Dm
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYrd-0008Lv-CT
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:55:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=foflSWNS5NiUBTdSeZ5QbS/opHRdh3EGIrazEoYyq2Q=; b=nj3Dds6NdHrAeRX1s+j3ZQL7BW
	qM9TBvYQg9VHc8Cjg7e2mD2DZPt1gJfPLznfEfNCdNtE4TitOQR4Jt9acng/a/Z6pqJv82EAOhGDF
	bc36QkoBZpdKsgg9hZjdKVeH8wu8DlQuZe2JROIwg5AgkdL9eSbp0WuDqX9dTcrW5bRc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move memcpy()
Message-Id: <E1lZYrd-0008Lv-CT@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:55:25 +0000

commit 54febb419b1749535bf2f462e9a3eb3086e35d0a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:44:35 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:44:35 2021 +0200

    lib: move memcpy()
    
    By moving the function into an archive, x86 doesn't need to announce
    anymore that is has its own implementation - symbol resolution by the
    linker will now guarantee that the generic function remains unused, and
    the forwarding to the compiler built-in gets done by the common header
    anyway.
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c          | 21 ---------------------
 xen/include/asm-x86/string.h |  3 ---
 xen/lib/Makefile             |  1 +
 xen/lib/memcpy.c             | 34 ++++++++++++++++++++++++++++++++++
 4 files changed, 35 insertions(+), 24 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 3c83736d6b..3989cd8f3d 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -311,27 +311,6 @@ char *(strstr)(const char *s1, const char *s2)
 }
 #endif
 
-#ifndef __HAVE_ARCH_MEMCPY
-/**
- * memcpy - Copy one area of memory to another
- * @dest: Where to copy to
- * @src: Where to copy from
- * @count: The size of the area.
- *
- * You should not use this function to access IO space, use memcpy_toio()
- * or memcpy_fromio() instead.
- */
-void *(memcpy)(void *dest, const void *src, size_t count)
-{
-	char *tmp = (char *) dest, *s = (char *) src;
-
-	while (count--)
-		*tmp++ = *s++;
-
-	return dest;
-}
-#endif
-
 #ifndef __HAVE_ARCH_MEMMOVE
 /**
  * memmove - Copy one area of memory to another
diff --git a/xen/include/asm-x86/string.h b/xen/include/asm-x86/string.h
index 3102d91f13..b45e48ce33 100644
--- a/xen/include/asm-x86/string.h
+++ b/xen/include/asm-x86/string.h
@@ -1,9 +1,6 @@
 #ifndef __X86_STRING_H__
 #define __X86_STRING_H__
 
-#define __HAVE_ARCH_MEMCPY
-#define memcpy(d, s, n) __builtin_memcpy(d, s, n)
-
 #define __HAVE_ARCH_MEMMOVE
 #define memmove(d, s, n) __builtin_memmove(d, s, n)
 
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 98e5747ca7..7116de61b2 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -4,6 +4,7 @@ lib-y += bsearch.o
 lib-y += ctors.o
 lib-y += ctype.o
 lib-y += list-sort.o
+lib-y += memcpy.o
 lib-y += memset.o
 lib-y += muldiv64.o
 lib-y += parse-size.o
diff --git a/xen/lib/memcpy.c b/xen/lib/memcpy.c
new file mode 100644
index 0000000000..afb322797d
--- /dev/null
+++ b/xen/lib/memcpy.c
@@ -0,0 +1,34 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * memcpy - Copy one area of memory to another
+ * @dest: Where to copy to
+ * @src: Where to copy from
+ * @count: The size of the area.
+ *
+ * You should not use this function to access IO space, use memcpy_toio()
+ * or memcpy_fromio() instead.
+ */
+void *(memcpy)(void *dest, const void *src, size_t count)
+{
+	char *tmp = (char *) dest, *s = (char *) src;
+
+	while (count--)
+		*tmp++ = *s++;
+
+	return dest;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:55:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:55:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115408.220146 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYro-0000XU-TU; Thu, 22 Apr 2021 12:55:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115408.220146; Thu, 22 Apr 2021 12:55:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYro-0000XM-Qf; Thu, 22 Apr 2021 12:55:36 +0000
Received: by outflank-mailman (input) for mailman id 115408;
 Thu, 22 Apr 2021 12:55:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYrn-0000XB-IN
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:55:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYrn-0006IX-HQ
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:55:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYrn-0008Mk-GX
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:55:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=O7o/7ROXdaKIJigOSU7+rWNiMj0HirK/7zdGDtEi46o=; b=zYGWqRgYuvPr8NDsAaAohAEfGc
	jixq1sFZGygvDULR6CbrB/nVuyaGAt5SUpFgCO2KB2RgXy1rlJtxsQL1BmBaxE05StrTqLt5V4Tm+
	MIyiBfXFe6cX7QYVkJkUtoy0xByRb82oOxK6RDESj/UsTKH/VrruwQbveyb5DIJbYMos=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move memmove()
Message-Id: <E1lZYrn-0008Mk-GX@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:55:35 +0000

commit b85fabd2e5003861293f131256252bca1afbaa91
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:44:53 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:44:53 2021 +0200

    lib: move memmove()
    
    By moving the function into an archive, x86 doesn't need to announce
    anymore that is has its own implementation - symbol resolution by the
    linker will now guarantee that the generic function remains unused, and
    the forwarding to the compiler built-in gets done by the common header
    anyway.
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c          | 30 ------------------------------
 xen/include/asm-x86/string.h |  3 ---
 xen/lib/Makefile             |  1 +
 xen/lib/memmove.c            | 42 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 43 insertions(+), 33 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 3989cd8f3d..4171d67f04 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -311,36 +311,6 @@ char *(strstr)(const char *s1, const char *s2)
 }
 #endif
 
-#ifndef __HAVE_ARCH_MEMMOVE
-/**
- * memmove - Copy one area of memory to another
- * @dest: Where to copy to
- * @src: Where to copy from
- * @count: The size of the area.
- *
- * Unlike memcpy(), memmove() copes with overlapping areas.
- */
-void *(memmove)(void *dest, const void *src, size_t count)
-{
-	char *tmp, *s;
-
-	if (dest <= src) {
-		tmp = (char *) dest;
-		s = (char *) src;
-		while (count--)
-			*tmp++ = *s++;
-		}
-	else {
-		tmp = (char *) dest + count;
-		s = (char *) src + count;
-		while (count--)
-			*--tmp = *--s;
-		}
-
-	return dest;
-}
-#endif
-
 #ifndef __HAVE_ARCH_MEMCMP
 /**
  * memcmp - Compare two areas of memory
diff --git a/xen/include/asm-x86/string.h b/xen/include/asm-x86/string.h
index b45e48ce33..f08d95096e 100644
--- a/xen/include/asm-x86/string.h
+++ b/xen/include/asm-x86/string.h
@@ -1,9 +1,6 @@
 #ifndef __X86_STRING_H__
 #define __X86_STRING_H__
 
-#define __HAVE_ARCH_MEMMOVE
-#define memmove(d, s, n) __builtin_memmove(d, s, n)
-
 #endif /* __X86_STRING_H__ */
 /*
  * Local variables:
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 7116de61b2..abb78b956f 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -5,6 +5,7 @@ lib-y += ctors.o
 lib-y += ctype.o
 lib-y += list-sort.o
 lib-y += memcpy.o
+lib-y += memmove.o
 lib-y += memset.o
 lib-y += muldiv64.o
 lib-y += parse-size.o
diff --git a/xen/lib/memmove.c b/xen/lib/memmove.c
new file mode 100644
index 0000000000..1ab79dfb28
--- /dev/null
+++ b/xen/lib/memmove.c
@@ -0,0 +1,42 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * memmove - Copy one area of memory to another
+ * @dest: Where to copy to
+ * @src: Where to copy from
+ * @count: The size of the area.
+ *
+ * Unlike memcpy(), memmove() copes with overlapping areas.
+ */
+void *(memmove)(void *dest, const void *src, size_t count)
+{
+	char *tmp, *s;
+
+	if (dest <= src) {
+		tmp = (char *) dest;
+		s = (char *) src;
+		while (count--)
+			*tmp++ = *s++;
+	} else {
+		tmp = (char *) dest + count;
+		s = (char *) src + count;
+		while (count--)
+			*--tmp = *--s;
+	}
+
+	return dest;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:55:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:55:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115409.220151 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYry-0000Yl-V9; Thu, 22 Apr 2021 12:55:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115409.220151; Thu, 22 Apr 2021 12:55:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYry-0000Yd-S8; Thu, 22 Apr 2021 12:55:46 +0000
Received: by outflank-mailman (input) for mailman id 115409;
 Thu, 22 Apr 2021 12:55:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYrx-0000YV-Ls
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:55:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYrx-0006Il-L6
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:55:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYrx-0008NK-Jk
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:55:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9Xrxx73AaNui762qTqf6Hv4qltwAYzUpnHdJZxObpto=; b=XH6y0euFubduNy80191cFzUliI
	Bfv4/ALQXRCVK+piAZ3Lft3ow5UDeGKnxJghtx/dy+OMuJG6fpOPoue+cDOxk5ZMcYbbrezfmbgtw
	Z7D7I1vAfv1sMOxfubl6CcqArtmZ7bSJaJUYAfGh5AtxWqamFfpcXGsczUs0cK8ERFTA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move memcmp()
Message-Id: <E1lZYrx-0008NK-Jk@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:55:45 +0000

commit 880d89fbfe7ea4229f58d87ad5959acca41d5d12
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:45:06 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:45:06 2021 +0200

    lib: move memcmp()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 19 -------------------
 xen/lib/Makefile    |  1 +
 xen/lib/memcmp.c    | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 4171d67f04..f40b65f630 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -311,25 +311,6 @@ char *(strstr)(const char *s1, const char *s2)
 }
 #endif
 
-#ifndef __HAVE_ARCH_MEMCMP
-/**
- * memcmp - Compare two areas of memory
- * @cs: One area of memory
- * @ct: Another area of memory
- * @count: The size of the area.
- */
-int (memcmp)(const void *cs, const void *ct, size_t count)
-{
-	const unsigned char *su1, *su2;
-	int res = 0;
-
-	for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
-		if ((res = *su1 - *su2) != 0)
-			break;
-	return res;
-}
-#endif
-
 #ifndef __HAVE_ARCH_MEMCHR
 /**
  * memchr - Find a character in an area of memory.
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index abb78b956f..2667bb2d53 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -4,6 +4,7 @@ lib-y += bsearch.o
 lib-y += ctors.o
 lib-y += ctype.o
 lib-y += list-sort.o
+lib-y += memcmp.o
 lib-y += memcpy.o
 lib-y += memmove.o
 lib-y += memset.o
diff --git a/xen/lib/memcmp.c b/xen/lib/memcmp.c
new file mode 100644
index 0000000000..df0e9be8c5
--- /dev/null
+++ b/xen/lib/memcmp.c
@@ -0,0 +1,32 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * memcmp - Compare two areas of memory
+ * @cs: One area of memory
+ * @ct: Another area of memory
+ * @count: The size of the area.
+ */
+int (memcmp)(const void *cs, const void *ct, size_t count)
+{
+	const unsigned char *su1, *su2;
+	int res = 0;
+
+	for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
+		if ((res = *su1 - *su2) != 0)
+			break;
+	return res;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:55:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:55:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115410.220155 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYs9-0000Zy-0V; Thu, 22 Apr 2021 12:55:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115410.220155; Thu, 22 Apr 2021 12:55:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYs8-0000Zq-Tj; Thu, 22 Apr 2021 12:55:56 +0000
Received: by outflank-mailman (input) for mailman id 115410;
 Thu, 22 Apr 2021 12:55:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYs7-0000Zg-P0
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:55:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYs7-0006Iw-O4
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:55:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYs7-0008Nq-NG
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:55:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6XUEwpsuKe1xcp/1a95jhmu3uqyQ4cimpAp3uUpTBcE=; b=S2hPWLboaY1Y7/CW2O3daXmGUt
	zQUE2bhZLss1iHdKf5X3mzeAYBhqBScZYS7Nd6nWJEcsfPeJPoheEsSbY8PhjvUFg8yEKPAOEMw0d
	UmMKAPTbtuCSg55em+moY5v1madfSUKF2vbgp6OJhgLE30epxwxgeZ4VZLpRfe0lcOZs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move memchr()
Message-Id: <E1lZYs7-0008Nq-NG@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:55:55 +0000

commit ff2e37e64cab577951f1a095086dc2c59d9e7cba
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:45:21 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:45:21 2021 +0200

    lib: move memchr()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 22 ----------------------
 xen/lib/Makefile    |  1 +
 xen/lib/memchr.c    | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index f40b65f630..ba282637f1 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -311,28 +311,6 @@ char *(strstr)(const char *s1, const char *s2)
 }
 #endif
 
-#ifndef __HAVE_ARCH_MEMCHR
-/**
- * memchr - Find a character in an area of memory.
- * @s: The memory area
- * @c: The byte to search for
- * @n: The size of the area.
- *
- * returns the address of the first occurrence of @c, or %NULL
- * if @c is not found
- */
-void *(memchr)(const void *s, int c, size_t n)
-{
-	const unsigned char *p = s;
-
-	while (n--)
-		if ((unsigned char)c == *p++)
-			return (void *)(p - 1);
-
-	return NULL;
-}
-#endif
-
 /**
  * memchr_inv - Find an unmatching character in an area of memory.
  * @s: The memory area
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 2667bb2d53..acdd0a4a12 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -4,6 +4,7 @@ lib-y += bsearch.o
 lib-y += ctors.o
 lib-y += ctype.o
 lib-y += list-sort.o
+lib-y += memchr.o
 lib-y += memcmp.o
 lib-y += memcpy.o
 lib-y += memmove.o
diff --git a/xen/lib/memchr.c b/xen/lib/memchr.c
new file mode 100644
index 0000000000..75c44b962c
--- /dev/null
+++ b/xen/lib/memchr.c
@@ -0,0 +1,35 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * memchr - Find a character in an area of memory.
+ * @s: The memory area
+ * @c: The byte to search for
+ * @n: The size of the area.
+ *
+ * returns the address of the first occurrence of @c, or %NULL
+ * if @c is not found
+ */
+void *(memchr)(const void *s, int c, size_t n)
+{
+	const unsigned char *p = s;
+
+	while (n--)
+		if ((unsigned char)c == *p++)
+			return (void *)(p - 1);
+
+	return NULL;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:56:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:56:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115411.220159 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYsJ-0000bH-26; Thu, 22 Apr 2021 12:56:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115411.220159; Thu, 22 Apr 2021 12:56:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYsI-0000b9-VO; Thu, 22 Apr 2021 12:56:06 +0000
Received: by outflank-mailman (input) for mailman id 115411;
 Thu, 22 Apr 2021 12:56:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYsH-0000b1-Ti
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:56:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYsH-0006Kq-R1
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:56:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYsH-0008Op-QL
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:56:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LxxeVhwaaQUR3VaI0b9BL6xL/voLX5/q8B+mMFjzwOM=; b=3+IBLnoF1hnaMh40KS/KM6TNVF
	GKorbRJNwds2dz0bC20yP3Y46KGXNYwME0vgeD2k8IBsVemMwAhmpg5TMDI1JylYcNL2RHLPuMaRC
	EeNVbbv52tIyWim+H0zsG/7NDr3mYLI+W+VrhGuCl3TbFFCno9YrCiFyJFh+4RDJp6Vg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move memchr_inv()
Message-Id: <E1lZYsH-0008Op-QL@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:56:05 +0000

commit 47cb18e069695f889577fc3651227541820f502b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:45:33 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:45:33 2021 +0200

    lib: move memchr_inv()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c  | 20 --------------------
 xen/lib/Makefile     |  1 +
 xen/lib/memchr_inv.c | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index ba282637f1..eae5e2a314 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -311,26 +311,6 @@ char *(strstr)(const char *s1, const char *s2)
 }
 #endif
 
-/**
- * memchr_inv - Find an unmatching character in an area of memory.
- * @s: The memory area
- * @c: The byte that is expected
- * @n: The size of the area.
- *
- * returns the address of the first occurrence of a character other than @c,
- * or %NULL if the whole buffer contains just @c.
- */
-void *memchr_inv(const void *s, int c, size_t n)
-{
-	const unsigned char *p = s;
-
-	while (n--)
-		if ((unsigned char)c != *p++)
-			return (void *)(p - 1);
-
-	return NULL;
-}
-
 /*
  * Local variables:
  * mode: C
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index acdd0a4a12..ce61fbe3cd 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -5,6 +5,7 @@ lib-y += ctors.o
 lib-y += ctype.o
 lib-y += list-sort.o
 lib-y += memchr.o
+lib-y += memchr_inv.o
 lib-y += memcmp.o
 lib-y += memcpy.o
 lib-y += memmove.o
diff --git a/xen/lib/memchr_inv.c b/xen/lib/memchr_inv.c
new file mode 100644
index 0000000000..1bf6cb6ee0
--- /dev/null
+++ b/xen/lib/memchr_inv.c
@@ -0,0 +1,35 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * memchr_inv - Find an unmatching character in an area of memory.
+ * @s: The memory area
+ * @c: The byte that is expected
+ * @n: The size of the area.
+ *
+ * returns the address of the first occurrence of a character other than @c,
+ * or %NULL if the whole buffer contains just @c.
+ */
+void *memchr_inv(const void *s, int c, size_t n)
+{
+	const unsigned char *p = s;
+
+	while (n--)
+		if ((unsigned char)c != *p++)
+			return (void *)(p - 1);
+
+	return NULL;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:56:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:56:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115412.220163 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYsT-0000ca-3e; Thu, 22 Apr 2021 12:56:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115412.220163; Thu, 22 Apr 2021 12:56: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 1lZYsT-0000cR-0e; Thu, 22 Apr 2021 12:56:17 +0000
Received: by outflank-mailman (input) for mailman id 115412;
 Thu, 22 Apr 2021 12:56: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 1lZYsR-0000cJ-Uj
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:56:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYsR-0006Kx-Tp
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:56:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYsR-0008PH-TF
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:56:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nfJm4vWEL7Bf/kEQPub0pukt0WqiVED17WPpSukj2RA=; b=I/TBXS8EDwTwGB14EaIwJLFzw2
	hQPMemWVG7VOktPDHB10o6Bd13A2i5Ndak4tGl6F4saQwGx4Ux7sqZqH6fW7l8GHxVNCQkrE1AJvC
	VQZRB77Xy/UyPFsAoZFCgaAYosIEIg/13xUkEGSuPoZBYJXUv8LbnTjtrGTldADxKE/c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move strlen()
Message-Id: <E1lZYsR-0008PH-TF@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:56:15 +0000

commit 9d0c024c2fa9f5e0224edf26febf27feaa757827
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:48:01 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:48:01 2021 +0200

    lib: move strlen()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 15 ---------------
 xen/lib/Makefile    |  1 +
 xen/lib/strlen.c    | 28 ++++++++++++++++++++++++++++
 3 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index eae5e2a314..752f65954c 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -184,21 +184,6 @@ char *(strrchr)(const char *s, int c)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRLEN
-/**
- * strlen - Find the length of a string
- * @s: The string to be sized
- */
-size_t (strlen)(const char * s)
-{
-	const char *sc;
-
-	for (sc = s; *sc != '\0'; ++sc)
-		/* nothing */;
-	return sc - s;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRNLEN
 /**
  * strnlen - Find the length of a length-limited string
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index ce61fbe3cd..25c6ec62b1 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -14,6 +14,7 @@ lib-y += muldiv64.o
 lib-y += parse-size.o
 lib-y += rbtree.o
 lib-y += sort.o
+lib-y += strlen.o
 lib-$(CONFIG_X86) += xxhash32.o
 lib-$(CONFIG_X86) += xxhash64.o
 
diff --git a/xen/lib/strlen.c b/xen/lib/strlen.c
new file mode 100644
index 0000000000..96f9bea43d
--- /dev/null
+++ b/xen/lib/strlen.c
@@ -0,0 +1,28 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strlen - Find the length of a string
+ * @s: The string to be sized
+ */
+size_t (strlen)(const char * s)
+{
+	const char *sc;
+
+	for (sc = s; *sc != '\0'; ++sc)
+		/* nothing */;
+	return sc - s;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:56:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:56:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115413.220167 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYsd-0000e2-5K; Thu, 22 Apr 2021 12:56:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115413.220167; Thu, 22 Apr 2021 12:56:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYsd-0000du-2E; Thu, 22 Apr 2021 12:56:27 +0000
Received: by outflank-mailman (input) for mailman id 115413;
 Thu, 22 Apr 2021 12:56: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 1lZYsc-0000dk-1l
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:56: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 1lZYsc-0006L5-0W
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:56:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYsb-0008Pw-WE
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:56: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=5At7I9j/sUVJHKf6jU5uoYLJdvLy4ClTQP4Knanm1oA=; b=ah8QjZ+OT2xHLE/6Qofj4Ocx9w
	OBEh1GLNEycbVY5H9EpcMs1MnnfZsxcBReQmTuqvUAE8YXp9EfM4BbdrHILcuaxxcmpJMjH8kOwmS
	Vczl3IKJiDW8BEc+670llwBm5Zm2IwetP+IpY4TSOT1E3BbzThcuvOgdySFJGWpxsD4k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move strnlen()
Message-Id: <E1lZYsb-0008Pw-WE@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:56:25 +0000

commit 36bba1238a398fb7f84a6c432e099db91d54c657
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:48:14 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:48:14 2021 +0200

    lib: move strnlen()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 16 ----------------
 xen/lib/Makefile    |  1 +
 xen/lib/strnlen.c   | 29 +++++++++++++++++++++++++++++
 3 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 752f65954c..6be445e26e 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -184,22 +184,6 @@ char *(strrchr)(const char *s, int c)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRNLEN
-/**
- * strnlen - Find the length of a length-limited string
- * @s: The string to be sized
- * @count: The maximum number of bytes to search
- */
-size_t strnlen(const char * s, size_t count)
-{
-	const char *sc;
-
-	for (sc = s; count-- && *sc != '\0'; ++sc)
-		/* nothing */;
-	return sc - s;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRSPN
 /**
  * strspn - Calculate the length of the initial substring of @s which only
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 25c6ec62b1..1a642c929f 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -15,6 +15,7 @@ lib-y += parse-size.o
 lib-y += rbtree.o
 lib-y += sort.o
 lib-y += strlen.o
+lib-y += strnlen.o
 lib-$(CONFIG_X86) += xxhash32.o
 lib-$(CONFIG_X86) += xxhash64.o
 
diff --git a/xen/lib/strnlen.c b/xen/lib/strnlen.c
new file mode 100644
index 0000000000..4433f6ee87
--- /dev/null
+++ b/xen/lib/strnlen.c
@@ -0,0 +1,29 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strnlen - Find the length of a length-limited string
+ * @s: The string to be sized
+ * @count: The maximum number of bytes to search
+ */
+size_t strnlen(const char * s, size_t count)
+{
+	const char *sc;
+
+	for (sc = s; count-- && *sc != '\0'; ++sc)
+		/* nothing */;
+	return sc - s;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:56:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:56:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115415.220171 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYsn-0000fV-8O; Thu, 22 Apr 2021 12:56:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115415.220171; Thu, 22 Apr 2021 12: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 1lZYsn-0000fN-5V; Thu, 22 Apr 2021 12:56:37 +0000
Received: by outflank-mailman (input) for mailman id 115415;
 Thu, 22 Apr 2021 12:56: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 1lZYsm-0000fE-51
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:56: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 1lZYsm-0006LU-4I
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:56:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYsm-0008QO-2p
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:56: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=ccTDstTbCceOa0ErywW3fZPSPy1tJ0L7cGaqlFxKfXM=; b=fcCd4geOLJvp7GIeTVnCCDhvpB
	kk/q4RW55JrLOKzbpDrwaIA61SNEvOUK8sei4hV90xWC6/C3lMEJzcs2R3V+C3PbLDfb2DCKmHDsi
	gAWQGVpVIWjM6poHA6X/gSa/7+Xq7CFtU2wSI5TNyAWKA3UjoYNwkvHTW/+QcVK9d/SY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move strcmp()
Message-Id: <E1lZYsm-0008QO-2p@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:56:36 +0000

commit 4d0e3e734676c48b405c80344ba97060fcc0cad8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:48:25 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:48:25 2021 +0200

    lib: move strcmp()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 19 -------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strcmp.c    | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 6be445e26e..1d8cd0ab05 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -111,25 +111,6 @@ size_t strlcat(char *dest, const char *src, size_t size)
 EXPORT_SYMBOL(strlcat);
 #endif
 
-#ifndef __HAVE_ARCH_STRCMP
-/**
- * strcmp - Compare two strings
- * @cs: One string
- * @ct: Another string
- */
-int (strcmp)(const char *cs, const char *ct)
-{
-	register signed char __res;
-
-	while (1) {
-		if ((__res = *cs - *ct++) != 0 || !*cs++)
-			break;
-	}
-
-	return __res;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRNCMP
 /**
  * strncmp - Compare two length-limited strings
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 1a642c929f..c85fed7d01 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -14,6 +14,7 @@ lib-y += muldiv64.o
 lib-y += parse-size.o
 lib-y += rbtree.o
 lib-y += sort.o
+lib-y += strcmp.o
 lib-y += strlen.o
 lib-y += strnlen.o
 lib-$(CONFIG_X86) += xxhash32.o
diff --git a/xen/lib/strcmp.c b/xen/lib/strcmp.c
new file mode 100644
index 0000000000..465f1c4191
--- /dev/null
+++ b/xen/lib/strcmp.c
@@ -0,0 +1,32 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strcmp - Compare two strings
+ * @cs: One string
+ * @ct: Another string
+ */
+int (strcmp)(const char *cs, const char *ct)
+{
+	register signed char __res;
+
+	while (1) {
+		if ((__res = *cs - *ct++) != 0 || !*cs++)
+			break;
+	}
+
+	return __res;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:56:48 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:56:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115416.220175 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYsy-0000gv-A0; Thu, 22 Apr 2021 12:56:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115416.220175; Thu, 22 Apr 2021 12:56: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 1lZYsy-0000gn-79; Thu, 22 Apr 2021 12:56:48 +0000
Received: by outflank-mailman (input) for mailman id 115416;
 Thu, 22 Apr 2021 12:56:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYsw-0000ga-9q
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:56:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYsw-0006Le-92
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:56:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYsw-0008R4-6a
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:56:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5Uzo/mS7Nt1g6kJtU5qZM5crvlYH3sqlCVb+1/pnKyI=; b=OmNDTBMlYgPe3WGt9592NPQ3yF
	lF7Fbnsdhs9KcjxOWOOWyUu9DCs85/EaMmj3exDeIhXMwfbPTx8pVpfBY2Ij4DlExVXA+ULEfGEfr
	PIL3u+qy+Bg4moyUZyL9XEyoowyjh3FFC+s3oOxP434cqnOT6N+Xlozhg2NWFTgaLZ4M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move strncmp()
Message-Id: <E1lZYsw-0008R4-6a@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:56:46 +0000

commit 187e1e21d69faf43754ecfe79aa6b3119736a8ea
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:48:38 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:48:38 2021 +0200

    lib: move strncmp()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 21 ---------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strncmp.c   | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 1d8cd0ab05..f36a4a31e5 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -111,27 +111,6 @@ size_t strlcat(char *dest, const char *src, size_t size)
 EXPORT_SYMBOL(strlcat);
 #endif
 
-#ifndef __HAVE_ARCH_STRNCMP
-/**
- * strncmp - Compare two length-limited strings
- * @cs: One string
- * @ct: Another string
- * @count: The maximum number of bytes to compare
- */
-int (strncmp)(const char *cs, const char *ct, size_t count)
-{
-	register signed char __res = 0;
-
-	while (count) {
-		if ((__res = *cs - *ct++) != 0 || !*cs++)
-			break;
-		count--;
-	}
-
-	return __res;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRCHR
 /**
  * strchr - Find the first occurrence of a character in a string
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index c85fed7d01..12af30d670 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -16,6 +16,7 @@ lib-y += rbtree.o
 lib-y += sort.o
 lib-y += strcmp.o
 lib-y += strlen.o
+lib-y += strncmp.o
 lib-y += strnlen.o
 lib-$(CONFIG_X86) += xxhash32.o
 lib-$(CONFIG_X86) += xxhash64.o
diff --git a/xen/lib/strncmp.c b/xen/lib/strncmp.c
new file mode 100644
index 0000000000..9af7fa1c99
--- /dev/null
+++ b/xen/lib/strncmp.c
@@ -0,0 +1,34 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strncmp - Compare two length-limited strings
+ * @cs: One string
+ * @ct: Another string
+ * @count: The maximum number of bytes to compare
+ */
+int (strncmp)(const char *cs, const char *ct, size_t count)
+{
+	register signed char __res = 0;
+
+	while (count) {
+		if ((__res = *cs - *ct++) != 0 || !*cs++)
+			break;
+		count--;
+	}
+
+	return __res;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:56:58 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:56:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115417.220179 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYt8-0000i1-Bz; Thu, 22 Apr 2021 12:56:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115417.220179; Thu, 22 Apr 2021 12:56:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYt8-0000ht-8e; Thu, 22 Apr 2021 12:56:58 +0000
Received: by outflank-mailman (input) for mailman id 115417;
 Thu, 22 Apr 2021 12:56:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYt6-0000hg-Cs
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:56:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYt6-0006Ln-Bx
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:56:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYt6-0008Rc-BH
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:56:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=omE7xibR5KoAPs3Ga8enzgkmuxchEhRF4miM5ApJ5CQ=; b=dcf1dAEO/BfDP2Qd9asGvxQaYL
	LG7NtajH9ylSQiogvR7VXfhjlQ4EqjlHw0ZzXf95+OuT8vIGL6QUfcJtmFGodaxZ9lFoi/FA+a67q
	LTcjtSz5jswd4pYdjnJqtZp+u0So3PV0MXWXJcxewLmOpxUzSYDIHYpC8fYr+5ArYTdI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move strlcpy()
Message-Id: <E1lZYt6-0008Rc-BH@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:56:56 +0000

commit ead845c4fbe44d2ea8d16eaaa6d59f1d63a29b2d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:48:59 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:48:59 2021 +0200

    lib: move strlcpy()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 26 --------------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strlcpy.c   | 38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+), 26 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index f36a4a31e5..84af23270d 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -56,32 +56,6 @@ int (strcasecmp)(const char *s1, const char *s2)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRLCPY
-/**
- * strlcpy - Copy a %NUL terminated string into a sized buffer
- * @dest: Where to copy the string to
- * @src: Where to copy the string from
- * @size: size of destination buffer
- *
- * Compatible with *BSD: the result is always a valid
- * NUL-terminated string that fits in the buffer (unless,
- * of course, the buffer size is zero). It does not pad
- * out the result like strncpy() does.
- */
-size_t strlcpy(char *dest, const char *src, size_t size)
-{
-	size_t ret = strlen(src);
-
-	if (size) {
-		size_t len = (ret >= size) ? size-1 : ret;
-		memcpy(dest, src, len);
-		dest[len] = '\0';
-	}
-	return ret;
-}
-EXPORT_SYMBOL(strlcpy);
-#endif
-
 #ifndef __HAVE_ARCH_STRLCAT
 /**
  * strlcat - Append a %NUL terminated string into a sized buffer
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 12af30d670..ed1d2e47d4 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -15,6 +15,7 @@ lib-y += parse-size.o
 lib-y += rbtree.o
 lib-y += sort.o
 lib-y += strcmp.o
+lib-y += strlcpy.o
 lib-y += strlen.o
 lib-y += strncmp.o
 lib-y += strnlen.o
diff --git a/xen/lib/strlcpy.c b/xen/lib/strlcpy.c
new file mode 100644
index 0000000000..f5daba5e16
--- /dev/null
+++ b/xen/lib/strlcpy.c
@@ -0,0 +1,38 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strlcpy - Copy a %NUL terminated string into a sized buffer
+ * @dest: Where to copy the string to
+ * @src: Where to copy the string from
+ * @size: size of destination buffer
+ *
+ * Compatible with *BSD: the result is always a valid
+ * NUL-terminated string that fits in the buffer (unless,
+ * of course, the buffer size is zero). It does not pad
+ * out the result like strncpy() does.
+ */
+size_t strlcpy(char *dest, const char *src, size_t size)
+{
+	size_t ret = strlen(src);
+
+	if (size) {
+		size_t len = (ret >= size) ? size-1 : ret;
+		memcpy(dest, src, len);
+		dest[len] = '\0';
+	}
+	return ret;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:57:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:57:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115418.220183 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYtI-0000jH-D5; Thu, 22 Apr 2021 12:57:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115418.220183; Thu, 22 Apr 2021 12:57:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYtI-0000j9-AD; Thu, 22 Apr 2021 12:57:08 +0000
Received: by outflank-mailman (input) for mailman id 115418;
 Thu, 22 Apr 2021 12:57:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYtG-0000ix-Lx
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:57:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYtG-0006MB-LB
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:57:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYtG-0008Sz-Jf
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:57:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0Vy3PjbGuvx4gQogZEIkVuvfcSA4MFwL7YIvSUj4j8A=; b=L71nmWztclN1cR0hVocLHSi5mn
	yzYd9P3ZbkxDjbh2HPUAeBzk7fhOAcGj+Ieo8ux2UTnec8WfCDoFUc6DjR1Q59L9VgwWW9zgSZomC
	VpMYPhqOHyiAZiRTLBEC/6OrcX3yVnQ4SJ8pTA971BJq697sBnw4dVDwsfwCX48YtykI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move strlcat()
Message-Id: <E1lZYtG-0008Sz-Jf@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:57:06 +0000

commit 9c1e40fb7f9b197fa1c20842bc2fdb47550a2f33
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:49:10 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:49:10 2021 +0200

    lib: move strlcat()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 29 -----------------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strlcat.c   | 41 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 42 insertions(+), 29 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 84af23270d..6042262b49 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -56,35 +56,6 @@ int (strcasecmp)(const char *s1, const char *s2)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRLCAT
-/**
- * strlcat - Append a %NUL terminated string into a sized buffer
- * @dest: Where to copy the string to
- * @src: Where to copy the string from
- * @size: size of destination buffer
- *
- * Compatible with *BSD: the result is always a valid
- * NUL-terminated string that fits in the buffer (unless,
- * of course, the buffer size is zero).
- */
-size_t strlcat(char *dest, const char *src, size_t size)
-{
-	size_t slen = strlen(src);
-	size_t dlen = strnlen(dest, size);
-	char *p = dest + dlen;
-
-	while ((p - dest) < size)
-		if ((*p++ = *src++) == '\0')
-			break;
-
-	if (dlen < size)
-		*(p-1) = '\0';
-
-	return slen + dlen;
-}
-EXPORT_SYMBOL(strlcat);
-#endif
-
 #ifndef __HAVE_ARCH_STRCHR
 /**
  * strchr - Find the first occurrence of a character in a string
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index ed1d2e47d4..0c6c726adf 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -15,6 +15,7 @@ lib-y += parse-size.o
 lib-y += rbtree.o
 lib-y += sort.o
 lib-y += strcmp.o
+lib-y += strlcat.o
 lib-y += strlcpy.o
 lib-y += strlen.o
 lib-y += strncmp.o
diff --git a/xen/lib/strlcat.c b/xen/lib/strlcat.c
new file mode 100644
index 0000000000..ec32be4890
--- /dev/null
+++ b/xen/lib/strlcat.c
@@ -0,0 +1,41 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strlcat - Append a %NUL terminated string into a sized buffer
+ * @dest: Where to copy the string to
+ * @src: Where to copy the string from
+ * @size: size of destination buffer
+ *
+ * Compatible with *BSD: the result is always a valid
+ * NUL-terminated string that fits in the buffer (unless,
+ * of course, the buffer size is zero).
+ */
+size_t strlcat(char *dest, const char *src, size_t size)
+{
+	size_t slen = strlen(src);
+	size_t dlen = strnlen(dest, size);
+	char *p = dest + dlen;
+
+	while ((p - dest) < size)
+		if ((*p++ = *src++) == '\0')
+			break;
+
+	if (dlen < size)
+		*(p-1) = '\0';
+
+	return slen + dlen;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:57:18 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:57:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115419.220187 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYtS-0000ka-FB; Thu, 22 Apr 2021 12:57:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115419.220187; Thu, 22 Apr 2021 12:57:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYtS-0000kR-Bo; Thu, 22 Apr 2021 12:57:18 +0000
Received: by outflank-mailman (input) for mailman id 115419;
 Thu, 22 Apr 2021 12:57:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYtQ-0000kI-T4
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:57:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYtQ-0006ML-Ra
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:57:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYtQ-0008Tk-Pl
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:57:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tD6SugycOSXKxJa+I9SGUHJAXMugsF0W3ZTfx3W4vxg=; b=ERIrh+zHS7XotfdehH+lJub1gW
	1abeJ5g30ZzKK9KWNdLflYLVcGYZS92HyNxZG8yu6t7zghTkoupdY6eu0bJ9JLmE6WDbmT4qjEihY
	Wx8+dV/yZog8RfSJyKM0rQxgr96wqg7orRLw7/nTla98/lvS0HM8FsYgZFxn2PTYpXLk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move strchr()
Message-Id: <E1lZYtQ-0008Tk-Pl@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:57:16 +0000

commit 7095953455001bb2d95792bb0b9c822e479b1c57
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:50:25 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:50:25 2021 +0200

    lib: move strchr()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 15 ---------------
 xen/lib/Makefile    |  1 +
 xen/lib/strchr.c    | 28 ++++++++++++++++++++++++++++
 3 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 6042262b49..f433b15afd 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -56,21 +56,6 @@ int (strcasecmp)(const char *s1, const char *s2)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRCHR
-/**
- * strchr - Find the first occurrence of a character in a string
- * @s: The string to be searched
- * @c: The character to search for
- */
-char *(strchr)(const char *s, int c)
-{
-	for(; *s != (char) c; ++s)
-		if (*s == '\0')
-			return NULL;
-	return (char *) s;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRRCHR
 /**
  * strrchr - Find the last occurrence of a character in a string
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 0c6c726adf..b69b516369 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -14,6 +14,7 @@ lib-y += muldiv64.o
 lib-y += parse-size.o
 lib-y += rbtree.o
 lib-y += sort.o
+lib-y += strchr.o
 lib-y += strcmp.o
 lib-y += strlcat.o
 lib-y += strlcpy.o
diff --git a/xen/lib/strchr.c b/xen/lib/strchr.c
new file mode 100644
index 0000000000..2eba3f1574
--- /dev/null
+++ b/xen/lib/strchr.c
@@ -0,0 +1,28 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strchr - Find the first occurrence of a character in a string
+ * @s: The string to be searched
+ * @c: The character to search for
+ */
+char *(strchr)(const char *s, int c)
+{
+	for(; *s != (char) c; ++s)
+		if (*s == '\0')
+			return NULL;
+	return (char *) s;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:57:28 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:57:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115420.220191 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYtc-0000m1-Gd; Thu, 22 Apr 2021 12:57:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115420.220191; Thu, 22 Apr 2021 12:57:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYtc-0000lt-DQ; Thu, 22 Apr 2021 12:57:28 +0000
Received: by outflank-mailman (input) for mailman id 115420;
 Thu, 22 Apr 2021 12:57: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 1lZYta-0000lg-Vs
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:57:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYta-0006MS-V4
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:57:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYta-0008Ub-UW
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:57:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zkQCSwuTTXwcXORaEo66FzENrO8KD8ZRQxBdjdG2uxI=; b=Fm+xu0wuBE5skP+G9v6McEMjNx
	GjFO94nu7Rii/brrJuWKizKBgfXGpKw+cp0z+uutUa4Sx0YROIcrmuZiBgFd8+edljfDASVICvafP
	FrEV+SD8EuvwZtgAMSpFXDzaslCJ6TRMjxTkqKpczXPiD3AsbLJnisDYO3DbwzawOS1E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move strrchr()
Message-Id: <E1lZYta-0008Ub-UW@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:57:26 +0000

commit a50eb38545319dd52ba891dc47a8d0b478823d90
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:50:44 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:50:44 2021 +0200

    lib: move strrchr()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 18 ------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strrchr.c   | 31 +++++++++++++++++++++++++++++++
 3 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index f433b15afd..7c4edc17e3 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -56,24 +56,6 @@ int (strcasecmp)(const char *s1, const char *s2)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRRCHR
-/**
- * strrchr - Find the last occurrence of a character in a string
- * @s: The string to be searched
- * @c: The character to search for
- */
-char *(strrchr)(const char *s, int c)
-{
-	const char *p = s + strlen(s);
-
-	for (; *p != (char)c; --p)
-		if (p == s)
-			return NULL;
-
-	return (char *)p;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRSPN
 /**
  * strspn - Calculate the length of the initial substring of @s which only
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index b69b516369..e531e2dfb3 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -21,6 +21,7 @@ lib-y += strlcpy.o
 lib-y += strlen.o
 lib-y += strncmp.o
 lib-y += strnlen.o
+lib-y += strrchr.o
 lib-$(CONFIG_X86) += xxhash32.o
 lib-$(CONFIG_X86) += xxhash64.o
 
diff --git a/xen/lib/strrchr.c b/xen/lib/strrchr.c
new file mode 100644
index 0000000000..0d53dd9518
--- /dev/null
+++ b/xen/lib/strrchr.c
@@ -0,0 +1,31 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strrchr - Find the last occurrence of a character in a string
+ * @s: The string to be searched
+ * @c: The character to search for
+ */
+char *(strrchr)(const char *s, int c)
+{
+	const char *p = s + strlen(s);
+
+	for (; *p != (char)c; --p)
+		if (p == s)
+			return NULL;
+
+	return (char *)p;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:57:38 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:57:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115421.220195 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYtm-0000n7-IL; Thu, 22 Apr 2021 12:57:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115421.220195; Thu, 22 Apr 2021 12:57:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYtm-0000mz-F1; Thu, 22 Apr 2021 12:57:38 +0000
Received: by outflank-mailman (input) for mailman id 115421;
 Thu, 22 Apr 2021 12:57: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 1lZYtl-0000mq-38
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:57: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 1lZYtl-0006Mt-2K
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:57:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYtl-0008VX-1Q
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:57: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=JZEmoWtaYpgSf7iUqVQij6VB2oSjUurGRPjWqi6ofpo=; b=4pI8EYxnkPkINi8yW/KCLW14Sb
	ZO1en27D+kUNJF7XRA6kQdUEghIC3C1BR4mLr5pGNOPHuoCym0Ea1u6ZUM6WGRvQBuZ0BDLrP5iNl
	oLPyw9kJ421+pfwMPWmN0z8XOBH034FoZiDd68WUQK8ot1U8q/eeB51Wy5v+4MG3wnVY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move strstr()
Message-Id: <E1lZYtl-0008VX-1Q@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:57:37 +0000

commit 1f9d9b0b3e72d93ce8dfb33b51a8e44f77321e99
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:50:54 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:50:54 2021 +0200

    lib: move strstr()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 21 ---------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strstr.c    | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 7c4edc17e3..abb1689edd 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -131,27 +131,6 @@ char * strsep(char **s, const char *ct)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRSTR
-/**
- * strstr - Find the first substring in a %NUL terminated string
- * @s1: The string to be searched
- * @s2: The string to search for
- */
-char *(strstr)(const char *s1, const char *s2)
-{
-	size_t l1, l2 = strlen(s2);
-
-	if (!l2)
-		return (char *)s1;
-
-	for (l1 = strlen(s1); l1 >= l2; --l1, ++s1)
-		if (!memcmp(s1, s2, l2))
-			return (char *)s1;
-
-	return NULL;
-}
-#endif
-
 /*
  * Local variables:
  * mode: C
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index e531e2dfb3..57a7095ffa 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -22,6 +22,7 @@ lib-y += strlen.o
 lib-y += strncmp.o
 lib-y += strnlen.o
 lib-y += strrchr.o
+lib-y += strstr.o
 lib-$(CONFIG_X86) += xxhash32.o
 lib-$(CONFIG_X86) += xxhash64.o
 
diff --git a/xen/lib/strstr.c b/xen/lib/strstr.c
new file mode 100644
index 0000000000..c305f5acb3
--- /dev/null
+++ b/xen/lib/strstr.c
@@ -0,0 +1,34 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strstr - Find the first substring in a %NUL terminated string
+ * @s1: The string to be searched
+ * @s2: The string to search for
+ */
+char *(strstr)(const char *s1, const char *s2)
+{
+	size_t l1, l2 = strlen(s2);
+
+	if (!l2)
+		return (char *)s1;
+
+	for (l1 = strlen(s1); l1 >= l2; --l1, ++s1)
+		if (!memcmp(s1, s2, l2))
+			return (char *)s1;
+
+	return NULL;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:57:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:57:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115422.220199 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYtv-0000oq-Ln; Thu, 22 Apr 2021 12:57:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115422.220199; Thu, 22 Apr 2021 12: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 1lZYtv-0000oi-Ir; Thu, 22 Apr 2021 12:57:47 +0000
Received: by outflank-mailman (input) for mailman id 115422;
 Thu, 22 Apr 2021 12:57:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYtv-0000ob-7E
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:57: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 1lZYtv-0006N3-6T
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:57:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYtv-0008W4-4s
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:57: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=ht+rwzoU77ix2bnY8EJur+Izw62R0UVpY2rFiQcb8uk=; b=wspdRO1QwSWs82iViM4eEEiO3M
	oK9I6V/2Kb0bJv+icpzBQSo4nuobBBhvmgNNK8mlAR8Q8o8tUonhLb8gH9JiVhqPFjKNctM51euJa
	sv0ZAabaLF+EqOGlVgPICpryMOoy8dWQWrDTq+PYmE8D4jHbbHoud/8GjM41zJlFR2aQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move strcasecmp()
Message-Id: <E1lZYtv-0008W4-4s@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:57:47 +0000

commit 50ee4fb90a525c9b543cabe78a3df6d8588bba30
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:51:08 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:51:08 2021 +0200

    lib: move strcasecmp()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c  | 15 ---------------
 xen/lib/Makefile     |  1 +
 xen/lib/strcasecmp.c | 29 +++++++++++++++++++++++++++++
 3 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index abb1689edd..2b81daef89 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -41,21 +41,6 @@ int strnicmp(const char *s1, const char *s2, size_t len)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRCASECMP
-int (strcasecmp)(const char *s1, const char *s2)
-{
-    int c1, c2;
-
-    do
-    {
-        c1 = tolower(*s1++);
-        c2 = tolower(*s2++);
-    } while ( c1 == c2 && c1 != 0 );
-
-    return c1 - c2;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRSPN
 /**
  * strspn - Calculate the length of the initial substring of @s which only
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 57a7095ffa..6264b3aae3 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -14,6 +14,7 @@ lib-y += muldiv64.o
 lib-y += parse-size.o
 lib-y += rbtree.o
 lib-y += sort.o
+lib-y += strcasecmp.o
 lib-y += strchr.o
 lib-y += strcmp.o
 lib-y += strlcat.o
diff --git a/xen/lib/strcasecmp.c b/xen/lib/strcasecmp.c
new file mode 100644
index 0000000000..c2a411310e
--- /dev/null
+++ b/xen/lib/strcasecmp.c
@@ -0,0 +1,29 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+#include <xen/ctype.h>
+
+int (strcasecmp)(const char *s1, const char *s2)
+{
+    int c1, c2;
+
+    do
+    {
+        c1 = tolower(*s1++);
+        c2 = tolower(*s2++);
+    } while ( c1 == c2 && c1 != 0 );
+
+    return c1 - c2;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:57:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:57:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115423.220203 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYu5-0000pz-NH; Thu, 22 Apr 2021 12:57:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115423.220203; Thu, 22 Apr 2021 12: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 1lZYu5-0000ps-KL; Thu, 22 Apr 2021 12:57:57 +0000
Received: by outflank-mailman (input) for mailman id 115423;
 Thu, 22 Apr 2021 12:57:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYu5-0000pm-AB
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:57:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYu5-0006NB-9P
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:57:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYu5-00004t-8v
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:57:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=b9g5Sr5cAe+kluZU198hfDlBB0uvm36roJTL4PQpQtY=; b=pt4WxAjjuw1hwqE9zxKgy7nUaI
	boAaoppCvU3zsaAUiDTXFeV1XdGxuwaZ1iOB++Zl+tqzuWvLP7eNdQuI6UpSEXEmVO7eicuRftA13
	3Ce7Kyxm0acpIeUcQnPPdAgyC13r5Ac55GvfT9aOguc8UyKN/KjzofjXK9x7fubxWR8I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move/rename strnicmp() to strncasecmp()
Message-Id: <E1lZYu5-00004t-8v@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:57:57 +0000

commit 3acd02a50b3b271284d2a37227c658b2cdae8231
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:51:47 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:51:47 2021 +0200

    lib: move/rename strnicmp() to strncasecmp()
    
    While moving the implementation, also rename it to match strcasecmp(),
    allowing the similar use of a compiler builtin in this case as well.
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain_build.c   |  4 ++--
 xen/common/string.c           | 33 ------------------------------
 xen/drivers/acpi/pmstat.c     | 20 +++++++++---------
 xen/drivers/cpufreq/cpufreq.c |  2 +-
 xen/include/xen/string.h      |  6 +++++-
 xen/lib/Makefile              |  1 +
 xen/lib/strncasecmp.c         | 47 +++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 66 insertions(+), 47 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index b1d7b9849f..282416e74d 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1224,8 +1224,8 @@ static int __init map_range_to_domain(const struct dt_device_node *dev,
      * They are not MMIO and therefore a domain should not be able to
      * manage them via the IOMEM interface.
      */
-    if ( strnicmp(dt_node_full_name(dev), "/reserved-memory/",
-         strlen("/reserved-memory/")) != 0 )
+    if ( strncasecmp(dt_node_full_name(dev), "/reserved-memory/",
+                     strlen("/reserved-memory/")) != 0 )
     {
         res = iomem_permit_access(d, paddr_to_pfn(addr),
                 paddr_to_pfn(PAGE_ALIGN(addr + len - 1)));
diff --git a/xen/common/string.c b/xen/common/string.c
index 2b81daef89..f373f82171 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -8,39 +8,6 @@
 #include <xen/string.h>
 #include <xen/ctype.h>
 
-#ifndef __HAVE_ARCH_STRNICMP
-/**
- * strnicmp - Case insensitive, length-limited string comparison
- * @s1: One string
- * @s2: The other string
- * @len: the maximum number of characters to compare
- */
-int strnicmp(const char *s1, const char *s2, size_t len)
-{
-	/* Yes, Virginia, it had better be unsigned */
-	unsigned char c1, c2;
-
-	c1 = 0;	c2 = 0;
-	if (len) {
-		do {
-			c1 = *s1; c2 = *s2;
-			s1++; s2++;
-			if (!c1)
-				break;
-			if (!c2)
-				break;
-			if (c1 == c2)
-				continue;
-			c1 = tolower(c1);
-			c2 = tolower(c2);
-			if (c1 != c2)
-				break;
-		} while (--len);
-	}
-	return (int)c1 - (int)c2;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRSPN
 /**
  * strspn - Calculate the length of the initial substring of @s which only
diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c
index 2f528f9ca3..1bae635101 100644
--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -275,14 +275,14 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
         strlcpy(op->u.get_para.scaling_governor, "Unknown", CPUFREQ_NAME_LEN);
 
     /* governor specific para */
-    if ( !strnicmp(op->u.get_para.scaling_governor, 
-                   "userspace", CPUFREQ_NAME_LEN) )
+    if ( !strncasecmp(op->u.get_para.scaling_governor,
+                      "userspace", CPUFREQ_NAME_LEN) )
     {
         op->u.get_para.u.userspace.scaling_setspeed = policy->cur;
     }
 
-    if ( !strnicmp(op->u.get_para.scaling_governor, 
-                   "ondemand", CPUFREQ_NAME_LEN) )
+    if ( !strncasecmp(op->u.get_para.scaling_governor,
+                      "ondemand", CPUFREQ_NAME_LEN) )
     {
         ret = get_cpufreq_ondemand_para(
             &op->u.get_para.u.ondemand.sampling_rate_max,
@@ -350,8 +350,8 @@ static int set_cpufreq_para(struct xen_sysctl_pm_op *op)
     {
         unsigned int freq =op->u.set_para.ctrl_value;
 
-        if ( !strnicmp(policy->governor->name,
-                       "userspace", CPUFREQ_NAME_LEN) )
+        if ( !strncasecmp(policy->governor->name,
+                          "userspace", CPUFREQ_NAME_LEN) )
             ret = write_userspace_scaling_setspeed(op->cpuid, freq);
         else
             ret = -EINVAL;
@@ -363,8 +363,8 @@ static int set_cpufreq_para(struct xen_sysctl_pm_op *op)
     {
         unsigned int sampling_rate = op->u.set_para.ctrl_value;
 
-        if ( !strnicmp(policy->governor->name,
-                       "ondemand", CPUFREQ_NAME_LEN) )
+        if ( !strncasecmp(policy->governor->name,
+                          "ondemand", CPUFREQ_NAME_LEN) )
             ret = write_ondemand_sampling_rate(sampling_rate);
         else
             ret = -EINVAL;
@@ -376,8 +376,8 @@ static int set_cpufreq_para(struct xen_sysctl_pm_op *op)
     {
         unsigned int up_threshold = op->u.set_para.ctrl_value;
 
-        if ( !strnicmp(policy->governor->name,
-                       "ondemand", CPUFREQ_NAME_LEN) )
+        if ( !strncasecmp(policy->governor->name,
+                          "ondemand", CPUFREQ_NAME_LEN) )
             ret = write_ondemand_up_threshold(up_threshold);
         else
             ret = -EINVAL;
diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c
index e630a47419..419aae83ee 100644
--- a/xen/drivers/cpufreq/cpufreq.c
+++ b/xen/drivers/cpufreq/cpufreq.c
@@ -111,7 +111,7 @@ struct cpufreq_governor *__find_governor(const char *governor)
         return NULL;
 
     list_for_each_entry(t, &cpufreq_governor_list, governor_list)
-        if (!strnicmp(governor, t->name, CPUFREQ_NAME_LEN))
+        if (!strncasecmp(governor, t->name, CPUFREQ_NAME_LEN))
             return t;
 
     return NULL;
diff --git a/xen/include/xen/string.h b/xen/include/xen/string.h
index 4f438b018a..b4d2217a96 100644
--- a/xen/include/xen/string.h
+++ b/xen/include/xen/string.h
@@ -16,8 +16,8 @@ size_t strlcpy(char *, const char *, size_t);
 size_t strlcat(char *, const char *, size_t);
 int strcmp(const char *, const char *);
 int strncmp(const char *, const char *, size_t);
-int strnicmp(const char *, const char *, size_t);
 int strcasecmp(const char *, const char *);
+int strncasecmp(const char *, const char *, size_t);
 char *strchr(const char *, int);
 char *strrchr(const char *, int);
 char *strstr(const char *, const char *);
@@ -48,6 +48,10 @@ void *memchr_inv(const void *, int, size_t);
 #define strcasecmp(s1, s2) __builtin_strcasecmp(s1, s2)
 #endif
 
+#ifndef __HAVE_ARCH_STRCASECMP
+#define strncasecmp(s1, s2, n) __builtin_strncasecmp(s1, s2, n)
+#endif
+
 #ifndef __HAVE_ARCH_STRCHR
 #define strchr(s1, c) __builtin_strchr(s1, c)
 #endif
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 6264b3aae3..02240831e0 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -20,6 +20,7 @@ lib-y += strcmp.o
 lib-y += strlcat.o
 lib-y += strlcpy.o
 lib-y += strlen.o
+lib-y += strncasecmp.o
 lib-y += strncmp.o
 lib-y += strnlen.o
 lib-y += strrchr.o
diff --git a/xen/lib/strncasecmp.c b/xen/lib/strncasecmp.c
new file mode 100644
index 0000000000..407cf2a40e
--- /dev/null
+++ b/xen/lib/strncasecmp.c
@@ -0,0 +1,47 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+#include <xen/ctype.h>
+
+/**
+ * strncasecmp - Case insensitive, length-limited string comparison
+ * @s1: One string
+ * @s2: The other string
+ * @len: the maximum number of characters to compare
+ */
+int (strncasecmp)(const char *s1, const char *s2, size_t len)
+{
+	/* Yes, Virginia, it had better be unsigned */
+	unsigned char c1, c2;
+
+	c1 = 0;	c2 = 0;
+	if (len) {
+		do {
+			c1 = *s1; c2 = *s2;
+			s1++; s2++;
+			if (!c1)
+				break;
+			if (!c2)
+				break;
+			if (c1 == c2)
+				continue;
+			c1 = tolower(c1);
+			c2 = tolower(c2);
+			if (c1 != c2)
+				break;
+		} while (--len);
+	}
+	return (int)c1 - (int)c2;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:58:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:58:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115424.220206 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYuF-0000r5-P3; Thu, 22 Apr 2021 12:58:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115424.220206; Thu, 22 Apr 2021 12: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 1lZYuF-0000qx-M3; Thu, 22 Apr 2021 12:58:07 +0000
Received: by outflank-mailman (input) for mailman id 115424;
 Thu, 22 Apr 2021 12:58:07 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYuF-0000qs-D7
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:58:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYuF-0006NX-CJ
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:58:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYuF-00005j-Be
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:58:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4WAGuVIdrg8RcK2npEuZlx8zrph0CyEK3d8BU9F28Y4=; b=i8G7KN344ptBcu+YeUyRHIokG2
	ANWxMJ5CKB2RNqoQIyg/VL7lsXybWw3VSbr8EK8r1HscA8qK3beB8DzedavHmKdBqwbo2uoZRTBz6
	6ODVIow3pNZut4fn5Ti5kMLDhIIMHtKojhdSIDoiOZ6lznooaAJiA0dnkezURVpSoT1E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move strspn()
Message-Id: <E1lZYuF-00005j-Be@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:58:07 +0000

commit b3573bbd2ea6c8cdbe8c3a635354404fc19478f8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:52:57 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:52:57 2021 +0200

    lib: move strspn()
    
    Allow the function to be individually linkable, discardable, and
    overridable. In fact the function is unused at present, and hence will
    now get omitted from the final binaries.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 27 ---------------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strspn.c    | 40 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+), 27 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index f373f82171..6310facebd 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -8,33 +8,6 @@
 #include <xen/string.h>
 #include <xen/ctype.h>
 
-#ifndef __HAVE_ARCH_STRSPN
-/**
- * strspn - Calculate the length of the initial substring of @s which only
- * 	contain letters in @accept
- * @s: The string to be searched
- * @accept: The string to search for
- */
-size_t strspn(const char *s, const char *accept)
-{
-	const char *p;
-	const char *a;
-	size_t count = 0;
-
-	for (p = s; *p != '\0'; ++p) {
-		for (a = accept; *a != '\0'; ++a) {
-			if (*p == *a)
-				break;
-		}
-		if (*a == '\0')
-			return count;
-		++count;
-	}
-
-	return count;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRPBRK
 /**
  * strpbrk - Find the first occurrence of a set of characters
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 02240831e0..4126fdd05e 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -24,6 +24,7 @@ lib-y += strncasecmp.o
 lib-y += strncmp.o
 lib-y += strnlen.o
 lib-y += strrchr.o
+lib-y += strspn.o
 lib-y += strstr.o
 lib-$(CONFIG_X86) += xxhash32.o
 lib-$(CONFIG_X86) += xxhash64.o
diff --git a/xen/lib/strspn.c b/xen/lib/strspn.c
new file mode 100644
index 0000000000..3422057d4d
--- /dev/null
+++ b/xen/lib/strspn.c
@@ -0,0 +1,40 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strspn - Calculate the length of the initial substring of @s which only
+ * 	contain letters in @accept
+ * @s: The string to be searched
+ * @accept: The string to search for
+ */
+size_t strspn(const char *s, const char *accept)
+{
+	const char *p;
+	const char *a;
+	size_t count = 0;
+
+	for (p = s; *p != '\0'; ++p) {
+		for (a = accept; *a != '\0'; ++a) {
+			if (*p == *a)
+				break;
+		}
+		if (*a == '\0')
+			return count;
+		++count;
+	}
+
+	return count;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:58:18 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:58:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115425.220211 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYuQ-0000si-Qf; Thu, 22 Apr 2021 12:58:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115425.220211; Thu, 22 Apr 2021 12:58: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 1lZYuQ-0000sb-Nj; Thu, 22 Apr 2021 12:58:18 +0000
Received: by outflank-mailman (input) for mailman id 115425;
 Thu, 22 Apr 2021 12:58: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 1lZYuP-0000sV-HS
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:58: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 1lZYuP-0006Nf-FE
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:58:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYuP-00007s-EY
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:58: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=AHcB6EfxvC/krW9dhWm+sz9VcZJMQAQ4F1A1Sr9KXk0=; b=3O/WJR83tVdqMViIVDsUpKwryX
	1Z5XeQ96n5MxhSEkHK2jXtOl2uppUGTDtN5JSD0xb32o2nd7pOn8Db9WZz5/HjjF//yFniBOhL5zP
	9q2ST9yNVoiozB5BRfEWI3JnOk+rvOpoqHDK/H/P7eQQGHutObd17VVuh9VepmDFE39I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move strpbrk()
Message-Id: <E1lZYuP-00007s-EY@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:58:17 +0000

commit 4a0630eae4f1eb0ede38511fb97f19673299aac4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:53:10 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:53:10 2021 +0200

    lib: move strpbrk()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 20 --------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strpbrk.c   | 33 +++++++++++++++++++++++++++++++++
 3 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 6310facebd..05cd199b61 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -8,26 +8,6 @@
 #include <xen/string.h>
 #include <xen/ctype.h>
 
-#ifndef __HAVE_ARCH_STRPBRK
-/**
- * strpbrk - Find the first occurrence of a set of characters
- * @cs: The string to be searched
- * @ct: The characters to search for
- */
-char * strpbrk(const char * cs,const char * ct)
-{
-	const char *sc1,*sc2;
-
-	for( sc1 = cs; *sc1 != '\0'; ++sc1) {
-		for( sc2 = ct; *sc2 != '\0'; ++sc2) {
-			if (*sc1 == *sc2)
-				return (char *) sc1;
-		}
-	}
-	return NULL;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRSEP
 /**
  * strsep - Split a string into tokens
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 4126fdd05e..dd96bd0d90 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -23,6 +23,7 @@ lib-y += strlen.o
 lib-y += strncasecmp.o
 lib-y += strncmp.o
 lib-y += strnlen.o
+lib-y += strpbrk.o
 lib-y += strrchr.o
 lib-y += strspn.o
 lib-y += strstr.o
diff --git a/xen/lib/strpbrk.c b/xen/lib/strpbrk.c
new file mode 100644
index 0000000000..54c15784c4
--- /dev/null
+++ b/xen/lib/strpbrk.c
@@ -0,0 +1,33 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strpbrk - Find the first occurrence of a set of characters
+ * @cs: The string to be searched
+ * @ct: The characters to search for
+ */
+char *strpbrk(const char * cs,const char * ct)
+{
+	const char *sc1,*sc2;
+
+	for( sc1 = cs; *sc1 != '\0'; ++sc1) {
+		for( sc2 = ct; *sc2 != '\0'; ++sc2) {
+			if (*sc1 == *sc2)
+				return (char *) sc1;
+		}
+	}
+	return NULL;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 12:58:28 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 12:58:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115426.220216 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZYua-0000uJ-So; Thu, 22 Apr 2021 12:58:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115426.220216; Thu, 22 Apr 2021 12:58: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 1lZYua-0000u6-PO; Thu, 22 Apr 2021 12:58:28 +0000
Received: by outflank-mailman (input) for mailman id 115426;
 Thu, 22 Apr 2021 12:58: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 1lZYuZ-0000ty-Kl
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:58: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 1lZYuZ-0006Nq-JD
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:58:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZYuZ-00008U-HX
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 12:58: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=EcLeXC1nojK86p6YlGU1VbJshBbcjauocf520JGa4ds=; b=ALKsXE4aeF0IcfM/vynAhV4vNH
	Q5iIsuavmmL+xnP1yXXlrQkK2thB2xYuBzoFQXn4UwNYCJCLICEgNGeuUCAQNupgNp4bB9H2e8+u5
	ZUIPeqxxlrlnzsnfZ2MuhZ/GL2DisdvPxOBcpD0D3X2hkJmtiWI74juRSJyniF9Nk/GA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] lib: move strsep()
Message-Id: <E1lZYuZ-00008U-HX@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 12:58:27 +0000

commit 4f7bfefe79f417a657dba5bd25129dd6961e8de7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:53:21 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:53:21 2021 +0200

    lib: move strsep()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/Makefile |  1 -
 xen/common/string.c | 47 -----------------------------------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strsep.c    | 41 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 42 insertions(+), 48 deletions(-)

diff --git a/xen/common/Makefile b/xen/common/Makefile
index e2a7e62d14..54de70d422 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -40,7 +40,6 @@ obj-y += softirq.o
 obj-y += smp.o
 obj-y += spinlock.o
 obj-y += stop_machine.o
-obj-y += string.o
 obj-y += symbols.o
 obj-y += tasklet.o
 obj-y += time.o
diff --git a/xen/common/string.c b/xen/common/string.c
deleted file mode 100644
index 05cd199b61..0000000000
--- a/xen/common/string.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  linux/lib/string.c
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- */
-
-#include <xen/types.h>
-#include <xen/string.h>
-#include <xen/ctype.h>
-
-#ifndef __HAVE_ARCH_STRSEP
-/**
- * strsep - Split a string into tokens
- * @s: The string to be searched
- * @ct: The characters to search for
- *
- * strsep() updates @s to point after the token, ready for the next call.
- *
- * It returns empty tokens, too, behaving exactly like the libc function
- * of that name. In fact, it was stolen from glibc2 and de-fancy-fied.
- * Same semantics, slimmer shape. ;)
- */
-char * strsep(char **s, const char *ct)
-{
-	char *sbegin = *s, *end;
-
-	if (sbegin == NULL)
-		return NULL;
-
-	end = strpbrk(sbegin, ct);
-	if (end)
-		*end++ = '\0';
-	*s = end;
-
-	return sbegin;
-}
-#endif
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 8
- * tab-width: 8
- * indent-tabs-mode: t
- * End:
- */
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index dd96bd0d90..b311ea739c 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -25,6 +25,7 @@ lib-y += strncmp.o
 lib-y += strnlen.o
 lib-y += strpbrk.o
 lib-y += strrchr.o
+lib-y += strsep.o
 lib-y += strspn.o
 lib-y += strstr.o
 lib-$(CONFIG_X86) += xxhash32.o
diff --git a/xen/lib/strsep.c b/xen/lib/strsep.c
new file mode 100644
index 0000000000..0bda9901c2
--- /dev/null
+++ b/xen/lib/strsep.c
@@ -0,0 +1,41 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strsep - Split a string into tokens
+ * @s: The string to be searched
+ * @ct: The characters to search for
+ *
+ * strsep() updates @s to point after the token, ready for the next call.
+ *
+ * It returns empty tokens, too, behaving exactly like the libc function
+ * of that name. In fact, it was stolen from glibc2 and de-fancy-fied.
+ * Same semantics, slimmer shape. ;)
+ */
+char *strsep(char **s, const char *ct)
+{
+	char *sbegin = *s, *end;
+
+	if (sbegin == NULL)
+		return NULL;
+
+	end = strpbrk(sbegin, ct);
+	if (end)
+		*end++ = '\0';
+	*s = end;
+
+	return sbegin;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 13:44:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 13:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115446.220258 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZZck-0005jS-Tc; Thu, 22 Apr 2021 13:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115446.220258; Thu, 22 Apr 2021 13: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 1lZZck-0005jK-QW; Thu, 22 Apr 2021 13:44:06 +0000
Received: by outflank-mailman (input) for mailman id 115446;
 Thu, 22 Apr 2021 13: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 1lZZcj-0005jF-2S
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 13: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 1lZZcj-00078n-1c
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 13:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZZci-0003px-VE
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 13:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+p7jfagIxqAUL5sf9nZuRS/2RIaiQ7PaoWxZB5f9sJc=; b=WiEcaOK0AJ3lkWWWv/9bJhnVZ2
	fZiS+m2dHn03TWkkgC9qDn143IZCdaErKmsGWOGH2St2zxGeyNKQaMj1+ReS2C0Zx+rIzrsEta3Qt
	MO6rTNE7MzD+ZUkRNJ90q4W95+woMkZlnWyKq78RvlFPpC51EknwAEHLigujaMSIcEu0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: build in openSUSE Tumbleweed
Message-Id: <E1lZZci-0003px-VE@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 13:44:04 +0000

commit a60a72c17f116f6ef0fe2a5a77f8faa912d848b2
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Wed Jul 31 18:58:51 2019 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 22 13:54:31 2021 +0100

    automation: build in openSUSE Tumbleweed
    
    Mark the tests as non-fatal, as Tumbleweed is a bleeding edge rolling release.
    
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Acked-by: Doug Goldstein <cardoe@cardoe.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/gitlab-ci/build.yaml | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 57bf2c7f80..20d1d0cb34 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -457,6 +457,30 @@ opensuse-leap-gcc-debug:
   variables:
     CONTAINER: suse:opensuse-leap
 
+opensuse-tumbleweed-clang:
+  extends: .clang-x86-64-build
+  variables:
+    CONTAINER: suse:opensuse-tumbleweed
+  allow_failure: true
+
+opensuse-tumbleweed-clang-debug:
+  extends: .clang-x86-64-build-debug
+  variables:
+    CONTAINER: suse:opensuse-tumbleweed
+  allow_failure: true
+
+opensuse-tumbleweed-gcc:
+  extends: .gcc-x86-64-build
+  variables:
+    CONTAINER: suse:opensuse-tumbleweed
+  allow_failure: true
+
+opensuse-tumbleweed-gcc-debug:
+  extends: .gcc-x86-64-build-debug
+  variables:
+    CONTAINER: suse:opensuse-tumbleweed
+  allow_failure: true
+
 alpine-3.12-gcc:
   extends: .gcc-x86-64-build
   variables:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 17:55:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 17:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115775.220926 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZdXe-0002dn-BT; Thu, 22 Apr 2021 17:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115775.220926; Thu, 22 Apr 2021 17:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZdXe-0002df-8X; Thu, 22 Apr 2021 17:55:06 +0000
Received: by outflank-mailman (input) for mailman id 115775;
 Thu, 22 Apr 2021 17:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZdXd-0002da-CJ
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 17:55:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZdXd-0003Z8-6P
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 17:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZdXd-0004RL-4u
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 17:55:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=t0yPMZFWDAQTVD2dX7oewEq7sUEKFGE/BGUB+MuYVpE=; b=rhIrYJ+A7278pP5Bgt8WnS7hyZ
	fldoO7LWZgXnWmMzB+hOIeMwyeo8GdWjHWoLmR3iQV/6kwlw6MqGTOEgaVAqmTtuZWo7zaGFXRTGO
	ASQxDxqONMRvqb1kbQiAamz2JDOlK4Y+GLLjevKM50gyw6fwNdbNtMVyraFINuLQsa6k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mm: fix wrong unmap call
Message-Id: <E1lZdXd-0004RL-4u@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 17:55:05 +0000

commit f889fa267c47c3495d304da5da9dd2ef8a4c95af
Author:     Hongyan Xia <hongyxia@amazon.com>
AuthorDate: Thu Apr 22 18:42:30 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 22 18:49:23 2021 +0100

    x86/mm: fix wrong unmap call
    
    Commit 'x86/mm: switch to new APIs in modify_xen_mappings' applied the
    hunk of the unmap call to map_pages_to_xen() which was wrong and clearly
    should have been at the end of modify_xen_mappings(). Fix.
    
    Fixes: dd68f2e49bea ("x86/mm: switch to new APIs in modify_xen_mappings")
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Tested-by: Julien Grall <jgrall@amazon.com>
    Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 50229e38d3..84e3ccf47e 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5532,7 +5532,6 @@ int map_pages_to_xen(
 
  out:
     L3T_UNLOCK(current_l3page);
-    unmap_domain_page(pl2e);
     unmap_domain_page(pl3e);
     unmap_domain_page(pl2e);
     return rc;
@@ -5830,6 +5829,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
  out:
     L3T_UNLOCK(current_l3page);
     unmap_domain_page(pl3e);
+    unmap_domain_page(pl2e);
     return rc;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 18:22:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 18:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115785.220942 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZdxm-0005V3-Jl; Thu, 22 Apr 2021 18:22:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115785.220942; Thu, 22 Apr 2021 18: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 1lZdxm-0005Uv-Gf; Thu, 22 Apr 2021 18:22:06 +0000
Received: by outflank-mailman (input) for mailman id 115785;
 Thu, 22 Apr 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 1lZdxl-0005Un-Gc
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 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 1lZdxl-00046R-Fo
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 18:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZdxl-0007AS-Ed
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 18: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=qfMX+m2LHTi3VB+9P7HkA4HAie+I3h+ee9lNXIc8UzM=; b=JyJaZbwicbWNu2rqDq8j+RsDTb
	YfoCOezvP2rNFZE9GD5s/jgShB1gTvV7Q10VmdCWoyoxxIjrukmb5HTSLH8IN4uTPiWrXIwRU6mga
	CIhHdublLw/WJzLz9yFSrrFvColobXEbQZUDXNi/4NXhXKbkpYRjCS7GgP0KwnoZCgoQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cpuid: support LFENCE always serialising CPUID bit
Message-Id: <E1lZdxl-0007AS-Ed@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 18:22:05 +0000

commit e9b4fe26364950258c9f57f0f68eccb778eeadbb
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Apr 15 16:47:31 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 22 19:05:24 2021 +0100

    x86/cpuid: support LFENCE always serialising CPUID bit
    
    AMD Milan (Zen3) CPUs have an LFENCE Always Serialising CPUID bit in
    leaf 80000021.eax. Previous AMD versions used to have a user settable
    bit in DE_CFG MSR to select whether LFENCE was dispatch serialising,
    which Xen always attempts to set. The forcefully always on setting is
    due to the addition of SEV-SNP so that a VMM cannot break the
    confidentiality of a guest.
    
    In order to support this new CPUID bit move the LFENCE_DISPATCH
    synthetic CPUID bit to map the hardware bit (leaving a hole in the
    synthetic range) and either rely on the bit already being set by the
    native CPUID output, or attempt to fake it in Xen by modifying the
    DE_CFG MSR. This requires adding one more entry to the featureset to
    support leaf 80000021.eax.
    
    The bit is always exposed to guests by default even if the underlying
    hardware doesn't support leaf 80000021. Note that Xen doesn't allow
    guests to change the DE_CFG value, so once set by Xen LFENCE will always
    be serialising.
    
    Note that the access to DE_CFG by guests is left as-is: reads will
    unconditionally return LFENCE_SERIALISE bit set, while writes are
    silently dropped.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    [Always expose to guests by default]
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/light/libxl_cpuid.c              |  2 ++
 tools/misc/xen-cpuid.c                      |  6 +++++
 xen/arch/x86/cpu/amd.c                      |  7 ++++++
 xen/arch/x86/cpu/common.c                   |  3 +++
 xen/arch/x86/cpuid.c                        | 15 +++++++++++-
 xen/include/asm-x86/cpufeatures.h           |  2 +-
 xen/include/public/arch-x86/cpufeatureset.h |  3 +++
 xen/include/xen/lib/x86/cpuid.h             | 37 ++++++++++++++++++++++++++++-
 8 files changed, 72 insertions(+), 3 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 943a343239..f32c5d3a6f 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -288,6 +288,8 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"svm_decode",   0x8000000a, NA, CPUID_REG_EDX,  7,  1},
         {"svm_pausefilt",0x8000000a, NA, CPUID_REG_EDX, 10,  1},
 
+        {"lfence+",      0x80000021, NA, CPUID_REG_EAX,  2,  1},
+
         {"maxhvleaf",    0x40000000, NA, CPUID_REG_EAX,  0,  8},
 
         {NULL, 0, NA, CPUID_REG_INV, 0, 0}
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index b4229d1126..a17ad07832 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -182,6 +182,11 @@ static const char *const str_7a1[32] =
     [12] = "fsrcs",
 };
 
+static const char *const str_e21a[32] =
+{
+    [ 2] = "lfence+",
+};
+
 static const struct {
     const char *name;
     const char *abbr;
@@ -199,6 +204,7 @@ static const struct {
     { "0x80000008.ebx",   "e8b", str_e8b },
     { "0x00000007:0.edx", "7d0", str_7d0 },
     { "0x00000007:1.eax", "7a1", str_7a1 },
+    { "0x80000021.eax",  "e21a", str_e21a },
 };
 
 #define COL_ALIGN "18"
diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 9c8dcd91ee..169f80d635 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -646,6 +646,13 @@ void amd_init_lfence(struct cpuinfo_x86 *c)
 {
 	uint64_t value;
 
+	/*
+	 * Some hardware has LFENCE dispatch serialising always enabled,
+	 * nothing to do on that case.
+	 */
+	if (test_bit(X86_FEATURE_LFENCE_DISPATCH, c->x86_capability))
+		return;
+
 	/*
 	 * Attempt to set lfence to be Dispatch Serialising.  This MSR almost
 	 * certainly isn't virtualised (and Xen at least will leak the real
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index e5c3caf41d..0eb364f8a6 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -412,6 +412,9 @@ static void generic_identify(struct cpuinfo_x86 *c)
 	if (c->extended_cpuid_level >= 0x80000008)
 		c->x86_capability[cpufeat_word(X86_FEATURE_CLZERO)]
 			= cpuid_ebx(0x80000008);
+	if (c->extended_cpuid_level >= 0x80000021)
+		c->x86_capability[cpufeat_word(X86_FEATURE_LFENCE_DISPATCH)]
+			= cpuid_eax(0x80000021);
 
 	/* Intel-defined flags: level 0x00000007 */
 	if ( c->cpuid_level >= 0x00000007 ) {
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 03a483b93a..752bf244ea 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -311,6 +311,7 @@ static void __init calculate_raw_policy(void)
 static void __init calculate_host_policy(void)
 {
     struct cpuid_policy *p = &host_cpuid_policy;
+    unsigned int max_extd_leaf;
 
     *p = raw_cpuid_policy;
 
@@ -318,7 +319,19 @@ static void __init calculate_host_policy(void)
         min_t(uint32_t, p->basic.max_leaf,   ARRAY_SIZE(p->basic.raw) - 1);
     p->feat.max_subleaf =
         min_t(uint32_t, p->feat.max_subleaf, ARRAY_SIZE(p->feat.raw) - 1);
-    p->extd.max_leaf = 0x80000000 | min_t(uint32_t, p->extd.max_leaf & 0xffff,
+
+    max_extd_leaf = p->extd.max_leaf;
+
+    /*
+     * For AMD/Hygon hardware before Zen3, we unilaterally modify LFENCE to be
+     * dispatch serialising for Spectre mitigations.  Extend max_extd_leaf
+     * beyond what hardware supports, to include the feature leaf containing
+     * this information.
+     */
+    if ( cpu_has_lfence_dispatch )
+        max_extd_leaf = max(max_extd_leaf, 0x80000021);
+
+    p->extd.max_leaf = 0x80000000 | min_t(uint32_t, max_extd_leaf & 0xffff,
                                           ARRAY_SIZE(p->extd.raw) - 1);
 
     cpuid_featureset_to_policy(boot_cpu_data.x86_capability, p);
diff --git a/xen/include/asm-x86/cpufeatures.h b/xen/include/asm-x86/cpufeatures.h
index d7e42d9bb6..6c8f432aee 100644
--- a/xen/include/asm-x86/cpufeatures.h
+++ b/xen/include/asm-x86/cpufeatures.h
@@ -24,7 +24,7 @@ XEN_CPUFEATURE(APERFMPERF,        X86_SYNTH( 8)) /* APERFMPERF */
 XEN_CPUFEATURE(MFENCE_RDTSC,      X86_SYNTH( 9)) /* MFENCE synchronizes RDTSC */
 XEN_CPUFEATURE(XEN_SMEP,          X86_SYNTH(10)) /* SMEP gets used by Xen itself */
 XEN_CPUFEATURE(XEN_SMAP,          X86_SYNTH(11)) /* SMAP gets used by Xen itself */
-XEN_CPUFEATURE(LFENCE_DISPATCH,   X86_SYNTH(12)) /* lfence set as Dispatch Serialising */
+/* Bit 12 - unused. */
 XEN_CPUFEATURE(IND_THUNK_LFENCE,  X86_SYNTH(13)) /* Use IND_THUNK_LFENCE */
 XEN_CPUFEATURE(IND_THUNK_JMP,     X86_SYNTH(14)) /* Use IND_THUNK_JMP */
 XEN_CPUFEATURE(SC_BRANCH_HARDEN,  X86_SYNTH(15)) /* Conditional Branch Hardening */
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 7cdd08d551..c42f56bdd4 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -282,6 +282,9 @@ XEN_CPUFEATURE(FZRM,         10*32+10) /*A  Fast Zero-length REP MOVSB */
 XEN_CPUFEATURE(FSRS,         10*32+11) /*A  Fast Short REP STOSB */
 XEN_CPUFEATURE(FSRCS,        10*32+12) /*A  Fast Short REP CMPSB/SCASB */
 
+/* AMD-defined CPU features, CPUID level 0x80000021.eax, word 11 */
+XEN_CPUFEATURE(LFENCE_DISPATCH,    11*32+ 2) /*A  LFENCE always serializing */
+
 #endif /* XEN_CPUFEATURE */
 
 /* Clean up from a default include.  Close the enum (for C). */
diff --git a/xen/include/xen/lib/x86/cpuid.h b/xen/include/xen/lib/x86/cpuid.h
index ef695d2ff7..2300faf03e 100644
--- a/xen/include/xen/lib/x86/cpuid.h
+++ b/xen/include/xen/lib/x86/cpuid.h
@@ -15,6 +15,7 @@
 #define FEATURESET_e8b    8 /* 0x80000008.ebx      */
 #define FEATURESET_7d0    9 /* 0x00000007:0.edx    */
 #define FEATURESET_7a1   10 /* 0x00000007:1.eax    */
+#define FEATURESET_e21a  11 /* 0x80000021.eax      */
 
 struct cpuid_leaf
 {
@@ -84,7 +85,7 @@ const char *x86_cpuid_vendor_to_str(unsigned int vendor);
 #define CPUID_GUEST_NR_TOPO       (1u + 1)
 #define CPUID_GUEST_NR_XSTATE     (62u + 1)
 #define CPUID_GUEST_NR_EXTD_INTEL (0x8u + 1)
-#define CPUID_GUEST_NR_EXTD_AMD   (0x1cu + 1)
+#define CPUID_GUEST_NR_EXTD_AMD   (0x21u + 1)
 #define CPUID_GUEST_NR_EXTD       MAX(CPUID_GUEST_NR_EXTD_INTEL, \
                                       CPUID_GUEST_NR_EXTD_AMD)
 
@@ -264,6 +265,38 @@ struct cpuid_policy
             };
             uint32_t nc:8, :4, apic_id_size:4, :16;
             uint32_t /* d */:32;
+
+            uint64_t :64, :64; /* Leaf 0x80000009. */
+            uint64_t :64, :64; /* Leaf 0x8000000a - SVM rev and features. */
+            uint64_t :64, :64; /* Leaf 0x8000000b. */
+            uint64_t :64, :64; /* Leaf 0x8000000c. */
+            uint64_t :64, :64; /* Leaf 0x8000000d. */
+            uint64_t :64, :64; /* Leaf 0x8000000e. */
+            uint64_t :64, :64; /* Leaf 0x8000000f. */
+            uint64_t :64, :64; /* Leaf 0x80000010. */
+            uint64_t :64, :64; /* Leaf 0x80000011. */
+            uint64_t :64, :64; /* Leaf 0x80000012. */
+            uint64_t :64, :64; /* Leaf 0x80000013. */
+            uint64_t :64, :64; /* Leaf 0x80000014. */
+            uint64_t :64, :64; /* Leaf 0x80000015. */
+            uint64_t :64, :64; /* Leaf 0x80000016. */
+            uint64_t :64, :64; /* Leaf 0x80000017. */
+            uint64_t :64, :64; /* Leaf 0x80000018. */
+            uint64_t :64, :64; /* Leaf 0x80000019 - TLB 1GB Identifiers. */
+            uint64_t :64, :64; /* Leaf 0x8000001a - Performance related info. */
+            uint64_t :64, :64; /* Leaf 0x8000001b - IBS feature information. */
+            uint64_t :64, :64; /* Leaf 0x8000001c. */
+            uint64_t :64, :64; /* Leaf 0x8000001d - Cache properties. */
+            uint64_t :64, :64; /* Leaf 0x8000001e - Extd APIC/Core/Node IDs. */
+            uint64_t :64, :64; /* Leaf 0x8000001f - AMD Secure Encryption. */
+            uint64_t :64, :64; /* Leaf 0x80000020 - Platform QoS. */
+
+            /* Leaf 0x80000021 - Extended Feature 2 */
+            union {
+                uint32_t e21a;
+                struct { DECL_BITFIELD(e21a); };
+            };
+            uint32_t /* b */:32, /* c */:32, /* d */:32;
         };
     } extd;
 
@@ -293,6 +326,7 @@ static inline void cpuid_policy_to_featureset(
     fs[FEATURESET_e8b] = p->extd.e8b;
     fs[FEATURESET_7d0] = p->feat._7d0;
     fs[FEATURESET_7a1] = p->feat._7a1;
+    fs[FEATURESET_e21a] = p->extd.e21a;
 }
 
 /* Fill in a CPUID policy from a featureset bitmap. */
@@ -310,6 +344,7 @@ static inline void cpuid_featureset_to_policy(
     p->extd.e8b   = fs[FEATURESET_e8b];
     p->feat._7d0  = fs[FEATURESET_7d0];
     p->feat._7a1  = fs[FEATURESET_7a1];
+    p->extd.e21a  = fs[FEATURESET_e21a];
 }
 
 static inline uint64_t cpuid_policy_xcr0_max(const struct cpuid_policy *p)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 22 22:22:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Apr 2021 22:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.115836.221044 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZhhy-0003cW-VV; Thu, 22 Apr 2021 22:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 115836.221044; Thu, 22 Apr 2021 22: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 1lZhhy-0003cP-Sg; Thu, 22 Apr 2021 22:22:02 +0000
Received: by outflank-mailman (input) for mailman id 115836;
 Thu, 22 Apr 2021 22:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZhhy-0003cK-8B
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 22:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZhhy-00084D-16
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 22:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZhhx-0001Os-VC
 for xen-changelog@lists.xenproject.org; Thu, 22 Apr 2021 22: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=7OFz4Z9IHYAtEJQ2lmdPcH5RZDr30s7qskn/lvanxYY=; b=M73WF5lk142hBP/stzmfGo6t7E
	0noORhGtL0mO1VI8oR69hvqI7bKlCF0hgdHodEgaCHJvWu8DlPNkMXpVUvZfKTyLwiBMyAHuS+xUr
	nw2udfxbDRMtxKPTWvO00luwUAhKDOxmwhJ1hOSb2V6zr4ctWrbTIaUJRt3dItEm9MZs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: add arm32 cross-build tests for Xen
Message-Id: <E1lZhhx-0001Os-VC@xenbits.xenproject.org>
Date: Thu, 22 Apr 2021 22:22:01 +0000

commit aaa3eafb3ba8b544d19ca41cda1477640b22b8fc
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Wed Apr 14 18:11:33 2021 -0700
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Tue Apr 20 12:54:03 2021 -0700

    automation: add arm32 cross-build tests for Xen
    
    Add a debian build container with cross-gcc for arm32 installed.
    Add build jobs to cross-compile Xen-only for arm32.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Acked-by: Wei Liu <wl@xen.org>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 .../build/debian/unstable-arm32-gcc.dockerfile     | 24 +++++++++++
 automation/gitlab-ci/build.yaml                    | 50 ++++++++++++++++++++++
 automation/scripts/build                           |  5 +++
 3 files changed, 79 insertions(+)

diff --git a/automation/build/debian/unstable-arm32-gcc.dockerfile b/automation/build/debian/unstable-arm32-gcc.dockerfile
new file mode 100644
index 0000000000..b41a57f197
--- /dev/null
+++ b/automation/build/debian/unstable-arm32-gcc.dockerfile
@@ -0,0 +1,24 @@
+FROM debian:unstable
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV USER root
+ENV CROSS_COMPILE /usr/bin/arm-linux-gnueabihf-
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        flex \
+        bison \
+        git \
+        gcc-arm-linux-gnueabihf \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
+
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index cca2c310e2..57bf2c7f80 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -117,6 +117,33 @@
   variables:
     <<: *clang
 
+.arm32-cross-build-tmpl:
+  <<: *build
+  variables:
+    XEN_TARGET_ARCH: arm32
+  tags:
+    - x86_64
+
+.arm32-cross-build:
+  extends: .arm32-cross-build-tmpl
+  variables:
+    debug: n
+
+.arm32-cross-build-debug:
+  extends: .arm32-cross-build-tmpl
+  variables:
+    debug: y
+
+.gcc-arm32-cross-build:
+  extends: .arm32-cross-build
+  variables:
+    <<: *gcc
+
+.gcc-arm32-cross-build-debug:
+  extends: .arm32-cross-build-debug
+  variables:
+    <<: *gcc
+
 .arm64-build-tmpl:
   <<: *build
   variables:
@@ -450,6 +477,29 @@ alpine-3.12-clang-debug:
   variables:
     CONTAINER: alpine:3.12
 
+# Arm32 cross-build
+
+debian-unstable-gcc-arm32:
+  extends: .gcc-arm32-cross-build
+  variables:
+    CONTAINER: debian:unstable-arm32-gcc
+
+debian-unstable-gcc-arm32-debug:
+  extends: .gcc-arm32-cross-build-debug
+  variables:
+    CONTAINER: debian:unstable-arm32-gcc
+
+debian-unstable-gcc-arm32-randconfig:
+  extends: .gcc-arm32-cross-build
+  variables:
+    CONTAINER: debian:unstable-arm32-gcc
+    RANDCONFIG: y
+
+debian-unstable-gcc-arm32-debug-randconfig:
+  extends: .gcc-arm32-cross-build-debug
+  variables:
+    CONTAINER: debian:unstable-arm32-gcc
+    RANDCONFIG: y
 
 # Arm builds
 
diff --git a/automation/scripts/build b/automation/scripts/build
index 1b752edfe6..eaf70b11d1 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -16,6 +16,11 @@ else
     make -j$(nproc) -C xen defconfig
 fi
 
+# arm32 only cross-compiles the hypervisor
+if [[ "${XEN_TARGET_ARCH}" = "arm32" ]]; then
+    hypervisor_only="y"
+fi
+
 # build up our configure options
 cfgargs=()
 cfgargs+=("--enable-docs")
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:44:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116085.221506 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtI4-0001fH-Gi; Fri, 23 Apr 2021 10:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116085.221506; Fri, 23 Apr 2021 10: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 1lZtI4-0001f9-DR; Fri, 23 Apr 2021 10:44:04 +0000
Received: by outflank-mailman (input) for mailman id 116085;
 Fri, 23 Apr 2021 10:44: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 1lZtI3-0001f4-9U
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:44: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 1lZtI3-0002ei-8d
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:44:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtI3-0000h8-7D
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:44:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bEj3SLbL48bklMsrPcDVGfChgQe/lIabsIsah3IBAi4=; b=brpE99BLkpxn8fhW7HlqT36Toj
	/uMFdLe4ugG7lKLBulTgDVMtnSJszQFNWdxlVntGXmrq7pnkd+NqPbIeLqZrK4uKcsTSn5+tJsf02
	uw2fl/nj2WK+ECvVRvYCXHutjQ5ZqEnA+d2MgqZw2Q7HCtM0uRIh6Yl/nzTn5sQBhp+U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: latch to-be-written TSC value early in rendezvous loop
Message-Id: <E1lZtI3-0000h8-7D@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:44:03 +0000

commit 6ca022a1e16a3ad46ddb3f5fff48b69a434b1c21
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 13:25:53 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 13:25:53 2021 +0200

    x86/time: latch to-be-written TSC value early in rendezvous loop
    
    To reduce latency on time_calibration_tsc_rendezvous()'s last loop
    iteration, read the value to be written on the last iteration at the end
    of the loop body (i.e. in particular at the end of the second to last
    iteration).
    
    On my single-socket 18-core Skylake system this reduces the average loop
    exit time on CPU0 (from the TSC write on the last iteration to until
    after the main loop) from around 32k cycles to around 29k (albeit the
    values measured on separate runs vary quite significantly).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/time.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 6bc1fd11d6..e92365f5bd 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1683,7 +1683,7 @@ static void time_calibration_tsc_rendezvous(void *_r)
     int i;
     struct calibration_rendezvous *r = _r;
     unsigned int total_cpus = cpumask_weight(&r->cpu_calibration_map);
-    uint64_t tsc = 0;
+    uint64_t tsc = 0, master_tsc = 0;
 
     /* Loop to get rid of cache effects on TSC skew. */
     for ( i = 4; i >= 0; i-- )
@@ -1708,7 +1708,7 @@ static void time_calibration_tsc_rendezvous(void *_r)
             atomic_inc(&r->semaphore);
 
             if ( i == 0 )
-                write_tsc(r->master_tsc_stamp);
+                write_tsc(master_tsc);
 
             while ( atomic_read(&r->semaphore) != (2*total_cpus - 1) )
                 cpu_relax();
@@ -1730,7 +1730,7 @@ static void time_calibration_tsc_rendezvous(void *_r)
             }
 
             if ( i == 0 )
-                write_tsc(r->master_tsc_stamp);
+                write_tsc(master_tsc);
 
             atomic_inc(&r->semaphore);
             while ( atomic_read(&r->semaphore) > total_cpus )
@@ -1739,9 +1739,17 @@ static void time_calibration_tsc_rendezvous(void *_r)
 
         /* Just in case a read above ended up reading zero. */
         tsc += !tsc;
+
+        /*
+         * To reduce latency of the TSC write on the last iteration,
+         * fetch the value to be written into a local variable. To avoid
+         * introducing yet another conditional branch (which the CPU may
+         * have difficulty predicting well) do this on all iterations.
+         */
+        master_tsc = r->master_tsc_stamp;
     }
 
-    time_calibration_rendezvous_tail(r, tsc, r->master_tsc_stamp);
+    time_calibration_rendezvous_tail(r, tsc, master_tsc);
 }
 
 /* Ordinary rendezvous function which does not modify TSC values. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:44:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116086.221509 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtIE-0001g4-I7; Fri, 23 Apr 2021 10:44:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116086.221509; Fri, 23 Apr 2021 10:44:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtIE-0001fv-F2; Fri, 23 Apr 2021 10:44:14 +0000
Received: by outflank-mailman (input) for mailman id 116086;
 Fri, 23 Apr 2021 10:44: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 1lZtID-0001fp-Ef
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:44: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 1lZtID-0002el-D4
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:44:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtID-0000hr-B7
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:44: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=6nD37L8ulihSeXZADmdhD/4dTl3Vut8fkE+pENobIDY=; b=Y5jULO2vsPNIalN7GiPF8+LJHj
	Ch+Gi4k5VPinADqtEtVHLkVeUsj579w1gNbR4DmHw0MDeVdgQUbNUC721OlW/SaS2CN/Ub4hCUvil
	vDaSS1iqRzCwwuhY+EVC4EQ8vN4ANtMAkqpXlBIRNR0v5uLwkVh2Z/O4opLjT5s+JilM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: yield to hyperthreads after updating TSC during rendezvous
Message-Id: <E1lZtID-0000hr-B7@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:44:13 +0000

commit f1a042b9829687affabb95c7c1cbcde29f1d36bd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 13:26:26 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 13:26:26 2021 +0200

    x86/time: yield to hyperthreads after updating TSC during rendezvous
    
    Since we'd like the updates to be done as synchronously as possible,
    make an attempt at yielding immediately after the TSC write.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/time.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index e92365f5bd..5578b7b3a2 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1708,7 +1708,14 @@ static void time_calibration_tsc_rendezvous(void *_r)
             atomic_inc(&r->semaphore);
 
             if ( i == 0 )
+            {
                 write_tsc(master_tsc);
+                /*
+                 * Try to give our hyperthread(s), if any, a chance to do
+                 * the same as instantly as possible.
+                 */
+                cpu_relax();
+            }
 
             while ( atomic_read(&r->semaphore) != (2*total_cpus - 1) )
                 cpu_relax();
@@ -1730,7 +1737,14 @@ static void time_calibration_tsc_rendezvous(void *_r)
             }
 
             if ( i == 0 )
+            {
                 write_tsc(master_tsc);
+                /*
+                 * Try to give our hyperthread(s), if any, a chance to do
+                 * the same as instantly as possible.
+                 */
+                cpu_relax();
+            }
 
             atomic_inc(&r->semaphore);
             while ( atomic_read(&r->semaphore) > total_cpus )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:44:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116087.221513 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtIO-0001hP-LY; Fri, 23 Apr 2021 10:44:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116087.221513; Fri, 23 Apr 2021 10:44:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtIO-0001hH-I0; Fri, 23 Apr 2021 10:44:24 +0000
Received: by outflank-mailman (input) for mailman id 116087;
 Fri, 23 Apr 2021 10:44: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 1lZtIN-0001h7-IJ
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:44: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 1lZtIN-0002et-HX
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:44:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtIN-0000ia-FM
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:44: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=Tp5t+NP/KoifffVvt6bo0Dv2618omG2PvKl7hNGhGv4=; b=ffAft1MIPhkM4X+4sNK6wTnbQG
	TVd3hZlEg1ExdQA61yTj1oaKEorsj7ZjdKBVcw/JWs3uQj3hROYyOuCdnjn6q0YF1tnwBWvOxEFz7
	dAzNGLuao2iG8DQRZ3ZSgLV5wnT3c8aq1+OS4RjE4twPLb6STSArMJ/4c/kxcKl4JARU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/EFI: program headers are an ELF concept
Message-Id: <E1lZtIN-0000ia-FM@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:44:23 +0000

commit d1657d9d8663693db2ae90913e9e77ce719af849
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 13:27:06 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 13:27:06 2021 +0200

    x86/EFI: program headers are an ELF concept
    
    While they apparently do no harm when building xen.efi, their use is
    potentially misleading. Conditionalize their use to be for just the ELF
    binary we produce.
    
    No change to the resulting binaries.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/xen.lds.S | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 0273f79152..3e29147b6a 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -34,13 +34,19 @@ OUTPUT_FORMAT(FORMAT, FORMAT, FORMAT)
 
 OUTPUT_ARCH(i386:x86-64)
 
+#ifndef EFI
 PHDRS
 {
   text PT_LOAD ;
-#if (defined(BUILD_ID) || defined (CONFIG_PVH_GUEST)) && !defined(EFI)
+#if defined(BUILD_ID) || defined(CONFIG_PVH_GUEST)
   note PT_NOTE ;
 #endif
 }
+#define PHDR(x) :x
+#else
+#define PHDR(x)
+#endif
+
 SECTIONS
 {
 #if !defined(EFI)
@@ -83,7 +89,7 @@ SECTIONS
        *(.text.kexec)
        *(.gnu.warning)
        _etext = .;             /* End of text section */
-  } :text = 0x9090
+  } PHDR(text) = 0x9090
 
   . = ALIGN(SECTION_ALIGN);
   __2M_text_end = .;
@@ -134,12 +140,12 @@ SECTIONS
        *(SORT(.data.vpci.*))
        __end_vpci_array = .;
 #endif
-  } :text
+  } PHDR(text)
 
 #if defined(CONFIG_PVH_GUEST) && !defined(EFI)
   DECL_SECTION(.note.Xen) {
       *(.note.Xen)
-  } :note :text
+  } PHDR(note) PHDR(text)
 #endif
 
 #if defined(BUILD_ID)
@@ -154,13 +160,13 @@ SECTIONS
        __note_gnu_build_id_start = .;
        *(.note.gnu.build-id)
        __note_gnu_build_id_end = .;
-  } :note :text
+  } PHDR(note) PHDR(text)
 #elif defined(BUILD_ID_EFI)
   DECL_SECTION(.buildid) {
        __note_gnu_build_id_start = .;
        *(.buildid)
        __note_gnu_build_id_end = .;
-  } :text
+  }
 #endif
 #endif
 
@@ -173,7 +179,7 @@ SECTIONS
   . = ALIGN(4);
   DECL_SECTION(.reloc) {
     *(.reloc)
-  } :text
+  } PHDR(text)
 #endif
 
   _erodata = .;
@@ -202,7 +208,7 @@ SECTIONS
 #ifdef EFI /* EFI wants to merge all of .init.*  ELF doesn't. */
        . = ALIGN(SMP_CACHE_BYTES);
 #else
-  } :text
+  } PHDR(text)
   DECL_SECTION(.init.data) {
 #endif
 
@@ -260,7 +266,7 @@ SECTIONS
        *(SORT(.data.vpci.*))
        __end_vpci_array = .;
 #endif
-  } :text
+  } PHDR(text)
 
   . = ALIGN(SECTION_ALIGN);
   __init_end = .;
@@ -281,7 +287,7 @@ SECTIONS
        *(.data.paramhypfs)
        __paramhypfs_end = .;
 #endif
-  } :text
+  } PHDR(text)
 
   DECL_SECTION(.data) {
        *(.data.page_aligned)
@@ -289,7 +295,7 @@ SECTIONS
        *(.data.rel)
        *(.data.rel.*)
        CONSTRUCTORS
-  } :text
+  } PHDR(text)
 
   DECL_SECTION(.bss) {
        __bss_start = .;
@@ -306,7 +312,7 @@ SECTIONS
        *(.bss)
        . = ALIGN(POINTER_ALIGN);
        __bss_end = .;
-  } :text
+  } PHDR(text)
   _end = . ;
 
   . = ALIGN(SECTION_ALIGN);
@@ -316,12 +322,12 @@ SECTIONS
   . = ALIGN(4);
   DECL_SECTION(.reloc) {
     *(.reloc)
-  } :text
+  }
   /* Trick the linker into setting the image size to exactly 16Mb. */
   . = ALIGN(__section_alignment__);
   DECL_SECTION(.pad) {
     . = ALIGN(MB(16));
-  } :text
+  }
 #endif
 
 #ifndef XEN_BUILD_EFI
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:44:34 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:44:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116088.221517 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtIY-0001ip-Mp; Fri, 23 Apr 2021 10:44:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116088.221517; Fri, 23 Apr 2021 10: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 1lZtIY-0001ih-Jg; Fri, 23 Apr 2021 10:44:34 +0000
Received: by outflank-mailman (input) for mailman id 116088;
 Fri, 23 Apr 2021 10:44: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 1lZtIX-0001iW-LW
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:44: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 1lZtIX-0002f3-Ki
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:44:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtIX-0000jQ-Jw
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:44: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=W1me6UWqpLraT+ZtncFm+5AhbCGJ7TzBdXpiVYwq774=; b=ZftK1MLfedm2cJ57aywbB4owYv
	jNfqodJQlp7s2TX+R7eYT9C//hsXtpvGZQcoWqLiJJncu24KvvZs562upn3qvk4pIBBaONbvPxM4j
	XZBrwzCWi4TsDvx3WfECPGbmlIR9SdREk4Uq/Pv6huZJ+YW3MQfat7M4UTAh4Kxb1Wkg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/EFI: redo .reloc section bounds determination
Message-Id: <E1lZtIX-0000jQ-Jw@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:44:33 +0000

commit d4057f3732baeeeed7f88e8b9b9f27b89fd7ef12
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 13:27:47 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 13:27:47 2021 +0200

    x86/EFI: redo .reloc section bounds determination
    
    There's no need to link relocs-dummy.o into the ELF binary. The two
    symbols needed can as well be provided by the linker script. Then our
    mkreloc tool also doesn't need to put them in the generated assembler
    source.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/Makefile           |  5 ++---
 xen/arch/x86/efi/mkreloc.c      |  6 +-----
 xen/arch/x86/efi/relocs-dummy.S |  2 --
 xen/arch/x86/xen.lds.S          | 31 ++++++++++++++-----------------
 4 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 053206e4f0..0b4c24112d 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -136,7 +136,6 @@ XEN_NO_PE_FIXUPS := $(if $(XEN_BUILD_EFI), \
 endif
 
 ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS)
-EFI_OBJS-$(XEN_BUILD_EFI) := efi/relocs-dummy.o
 
 ifeq ($(CONFIG_LTO),y)
 # Gather all LTO objects together
@@ -144,13 +143,13 @@ prelink_lto.o: $(ALL_OBJS) $(ALL_LIBS)
 	$(LD_LTO) -r -o $@ $(filter-out %.a,$^) --start-group $(filter %.a,$^) --end-group
 
 # Link it with all the binary objects
-prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o $(EFI_OBJS-y) FORCE
+prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o FORCE
 	$(call if_changed,ld)
 
 prelink-efi.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o FORCE
 	$(call if_changed,ld)
 else
-prelink.o: $(ALL_OBJS) $(ALL_LIBS) $(EFI_OBJS-y) FORCE
+prelink.o: $(ALL_OBJS) $(ALL_LIBS) FORCE
 	$(call if_changed,ld)
 
 prelink-efi.o: $(ALL_OBJS) $(ALL_LIBS) FORCE
diff --git a/xen/arch/x86/efi/mkreloc.c b/xen/arch/x86/efi/mkreloc.c
index 9efeaee7c5..083740ab8a 100644
--- a/xen/arch/x86/efi/mkreloc.c
+++ b/xen/arch/x86/efi/mkreloc.c
@@ -320,9 +320,7 @@ int main(int argc, char *argv[])
     }
 
     puts("\t.section .reloc, \"a\", @progbits\n"
-         "\t.balign 4\n"
-         "\t.globl __base_relocs_start, __base_relocs_end\n"
-         "__base_relocs_start:");
+         "\t.balign 4");
 
     for ( i = 0; i < nsec; ++i )
     {
@@ -373,8 +371,6 @@ int main(int argc, char *argv[])
 
     diff_sections(NULL, NULL, NULL, 0, 0, 0, 0);
 
-    puts("__base_relocs_end:");
-
     close(in1);
     close(in2);
 
diff --git a/xen/arch/x86/efi/relocs-dummy.S b/xen/arch/x86/efi/relocs-dummy.S
index d928a82d53..b95fa444da 100644
--- a/xen/arch/x86/efi/relocs-dummy.S
+++ b/xen/arch/x86/efi/relocs-dummy.S
@@ -1,10 +1,8 @@
 
 	.section .reloc, "a", @progbits
 	.balign 4
-GLOBAL(__base_relocs_start)
 	.long 0
 	.long 8
-GLOBAL(__base_relocs_end)
 
 	.globl VIRT_START, ALT_START
 	.equ VIRT_START, XEN_VIRT_START
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 3e29147b6a..5fadb02b7f 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -170,18 +170,6 @@ SECTIONS
 #endif
 #endif
 
-/*
- * ELF builds are linked to a fixed virtual address, and in principle
- * shouldn't have a .reloc section.  However, due to the way EFI support is
- * currently implemented, retaining the .reloc section is necessary.
- */
-#if defined(XEN_BUILD_EFI) && !defined(EFI)
-  . = ALIGN(4);
-  DECL_SECTION(.reloc) {
-    *(.reloc)
-  } PHDR(text)
-#endif
-
   _erodata = .;
 
   . = ALIGN(SECTION_ALIGN);
@@ -319,18 +307,27 @@ SECTIONS
   __2M_rwdata_end = .;
 
 #ifdef EFI
-  . = ALIGN(4);
-  DECL_SECTION(.reloc) {
+  .reloc ALIGN(4) : {
+    __base_relocs_start = .;
     *(.reloc)
+    __base_relocs_end = .;
   }
   /* Trick the linker into setting the image size to exactly 16Mb. */
   . = ALIGN(__section_alignment__);
   DECL_SECTION(.pad) {
     . = ALIGN(MB(16));
   }
-#endif
-
-#ifndef XEN_BUILD_EFI
+#elif defined(XEN_BUILD_EFI)
+  /*
+   * Due to the way EFI support is currently implemented, these two symbols
+   * need to be defined.  Their precise values shouldn't matter (the consuming
+   * function doesn't get called), but to be on the safe side both values would
+   * better match.  Of course the need to be reachable by the relocations
+   * referencing them.
+   */
+  PROVIDE(__base_relocs_start = .);
+  PROVIDE(__base_relocs_end = .);
+#else
   efi = .;
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:44:44 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:44:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116089.221521 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtIi-0001ki-OP; Fri, 23 Apr 2021 10:44:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116089.221521; Fri, 23 Apr 2021 10:44: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 1lZtIi-0001ka-LK; Fri, 23 Apr 2021 10:44:44 +0000
Received: by outflank-mailman (input) for mailman id 116089;
 Fri, 23 Apr 2021 10:44: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 1lZtIh-0001kT-PF
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:44: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 1lZtIh-0002fa-Ng
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:44:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtIh-0000kZ-Mt
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:44: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=3lHYThdMUkwJAWYeBQ4xena+mTcl5bY0mDHTp1pa54g=; b=QUeEt2hcyIWUiIP1xpbBu2iEMG
	auhXlZnNq21R8LvA09NjfuTnXgSgPure7WBXjrfC0+n9bHXnm1gUKqp1RHxstscO5mw8pZU0/2uhX
	HWxqv4OhHom90yEcLD9Z2jcSZfxIx77n4GP//r5EBSvL1i5L5j10t6c0M7cs2c6d+rfI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: drop use of prelink-efi.o
Message-Id: <E1lZtIh-0000kZ-Mt@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:44:43 +0000

commit f27d9db17fdae34cb89441d0d5ebefb09fa7dce5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 13:28:37 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 13:28:37 2021 +0200

    x86: drop use of prelink-efi.o
    
    Now that its contents matches prelink.o, use that one uniformly.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/Makefile | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 0b4c24112d..b224b1cf89 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -145,18 +145,12 @@ prelink_lto.o: $(ALL_OBJS) $(ALL_LIBS)
 # Link it with all the binary objects
 prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o FORCE
 	$(call if_changed,ld)
-
-prelink-efi.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o FORCE
-	$(call if_changed,ld)
 else
 prelink.o: $(ALL_OBJS) $(ALL_LIBS) FORCE
 	$(call if_changed,ld)
-
-prelink-efi.o: $(ALL_OBJS) $(ALL_LIBS) FORCE
-	$(call if_changed,ld)
 endif
 
-targets += prelink.o prelink-efi.o
+targets += prelink.o
 
 $(TARGET)-syms: prelink.o xen.lds
 	$(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \
@@ -217,7 +211,7 @@ endif
 note_file_option ?= $(note_file)
 
 ifeq ($(XEN_BUILD_PE),y)
-$(TARGET).efi: prelink-efi.o $(note_file) efi.lds efi/relocs-dummy.o efi/mkreloc
+$(TARGET).efi: prelink.o $(note_file) efi.lds efi/relocs-dummy.o efi/mkreloc
 	$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
 	          $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< efi/relocs-dummy.o \
 	                $(BASEDIR)/common/symbols-dummy.o $(note_file_option) -o $(@D)/.$(@F).$(base).0 &&) :
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:44:54 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:44:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116090.221525 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtIs-0001uh-Q6; Fri, 23 Apr 2021 10:44:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116090.221525; Fri, 23 Apr 2021 10:44: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 1lZtIs-0001uZ-Mw; Fri, 23 Apr 2021 10:44:54 +0000
Received: by outflank-mailman (input) for mailman id 116090;
 Fri, 23 Apr 2021 10:44: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 1lZtIr-0001uR-SH
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:44: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 1lZtIr-0002fk-RS
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:44:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtIr-0000ly-QU
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:44: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=MDY7T+S/IaTReKtPhnDIwM5nknIfMlDGiMNGVkGw5xU=; b=lYzfZLyNhgDicPY9Nqg18JSvvF
	DDfnNGTcDX3ti6V2mnvcjQbH/IKHt03svg/X9V0zYJmkhsP4ZF7PBOxFRYD05A2+2vAyhbrkIYJOL
	4WrX6Ub0EDMkCLxEKmbKPmOPaW2JRYCvIxnDMOwczENynyVh5eYObmX57m482qL/IqXo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/EFI: avoid use of GNU ld's --disable-reloc-section when possible
Message-Id: <E1lZtIr-0000ly-QU@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:44:53 +0000

commit 1be65ec4c8bc172aadd6bc1b6553c668152899ae
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 13:29:49 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 13:29:49 2021 +0200

    x86/EFI: avoid use of GNU ld's --disable-reloc-section when possible
    
    As of commit 6fa7408d72b3 ("ld: don't generate base relocations in PE
    output for absolute symbols") I'm feeling sufficiently confident in GNU
    ld to use its logic for generating base relocations, which was enabled
    for executables at some point last year (prior to that this would have
    got done only for DLLs).
    
    GNU ld, seeing the original relocations coming from the ELF object files,
    generates different relocation types for our page tables (64-bit ones,
    while mkreloc produces 32-bit ones). This requires also permitting and
    handling that type in efi_arch_relocate_image().
    
    Note that in the case that we leave base relocation generation to ld,
    while efi/relocs-dummy.o then won't be linked into any executable
    anymore, it still needs generating (and hence dependencies need to be
    kept as they are) in order to have VIRT_BASE pulled out of it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/Makefile       | 41 ++++++++++++++++++++++++++++++++---------
 xen/arch/x86/efi/check.c    | 14 ++++++++++++++
 xen/arch/x86/efi/efi-boot.h |  6 ++++--
 3 files changed, 50 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index b224b1cf89..5b47206ad1 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -123,18 +123,37 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
 	mv $(TMP) $(TARGET)
 
 ifneq ($(efi-y),)
+
 # Check if the compiler supports the MS ABI.
 export XEN_BUILD_EFI := $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o efi/check.o 2>/dev/null && echo y)
+CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
+
 # Check if the linker supports PE.
 EFI_LDFLAGS = $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=10 --strip-debug
 XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) $(EFI_LDFLAGS) -o efi/check.efi efi/check.o 2>/dev/null && echo y))
-CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
-# Check if the linker produces fixups in PE by default (we need to disable it doing so for now).
-XEN_NO_PE_FIXUPS := $(if $(XEN_BUILD_EFI), \
-                         $(shell $(LD) $(EFI_LDFLAGS) --disable-reloc-section -o efi/check.efi efi/check.o 2>/dev/null && \
-                                 echo --disable-reloc-section))
+
+ifeq ($(XEN_BUILD_PE),y)
+
+# Check if the linker produces fixups in PE by default
+nr-fixups := $(shell $(OBJDUMP) -p efi/check.efi | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
+ifeq ($(nr-fixups),2)
+MKRELOC := :
+relocs-dummy :=
+else
+MKRELOC := efi/mkreloc
+relocs-dummy := efi/relocs-dummy.o
+# If the linker produced fixups but not precisely two of them, we need to
+# disable it doing so.  But if it didn't produce any fixups, it also wouldn't
+# recognize the option.
+ifneq ($(nr-fixups),0)
+EFI_LDFLAGS += --disable-reloc-section
+endif
 endif
 
+endif # $(XEN_BUILD_PE)
+
+endif # $(efi-y)
+
 ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS)
 
 ifeq ($(CONFIG_LTO),y)
@@ -178,7 +197,7 @@ note.o: $(TARGET)-syms
 		--rename-section=.data=.note.gnu.build-id -S $@.bin $@
 	rm -f $@.bin
 
-EFI_LDFLAGS += --image-base=$(1) --stack=0,0 --heap=0,0 $(XEN_NO_PE_FIXUPS)
+EFI_LDFLAGS += --image-base=$(1) --stack=0,0 --heap=0,0
 EFI_LDFLAGS += --section-alignment=0x200000 --file-alignment=0x20
 EFI_LDFLAGS += --major-image-version=$(XEN_VERSION)
 EFI_LDFLAGS += --minor-image-version=$(XEN_SUBVERSION)
@@ -192,7 +211,11 @@ EFI_LDFLAGS += --no-insert-timestamp
 endif
 
 $(TARGET).efi: VIRT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A VIRT_START$$,,p')
+ifeq ($(MKRELOC),:)
+$(TARGET).efi: ALT_BASE :=
+else
 $(TARGET).efi: ALT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A ALT_START$$,,p')
+endif
 
 ifneq ($(build_id_linker),)
 ifeq ($(call ld-ver-build-id,$(LD) $(filter -m%,$(EFI_LDFLAGS))),y)
@@ -213,16 +236,16 @@ note_file_option ?= $(note_file)
 ifeq ($(XEN_BUILD_PE),y)
 $(TARGET).efi: prelink.o $(note_file) efi.lds efi/relocs-dummy.o efi/mkreloc
 	$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
-	          $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< efi/relocs-dummy.o \
+	          $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< $(relocs-dummy) \
 	                $(BASEDIR)/common/symbols-dummy.o $(note_file_option) -o $(@D)/.$(@F).$(base).0 &&) :
-	efi/mkreloc $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).0) >$(@D)/.$(@F).0r.S
+	$(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).0) >$(@D)/.$(@F).0r.S
 	$(NM) -pa --format=sysv $(@D)/.$(@F).$(VIRT_BASE).0 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0s.S
 	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o
 	$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
 	          $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< \
 	                $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o $(note_file_option) -o $(@D)/.$(@F).$(base).1 &&) :
-	efi/mkreloc $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).1) >$(@D)/.$(@F).1r.S
+	$(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).1) >$(@D)/.$(@F).1r.S
 	$(NM) -pa --format=sysv $(@D)/.$(@F).$(VIRT_BASE).1 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1s.S
 	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o
diff --git a/xen/arch/x86/efi/check.c b/xen/arch/x86/efi/check.c
index 7fedd5a610..9e473faad3 100644
--- a/xen/arch/x86/efi/check.c
+++ b/xen/arch/x86/efi/check.c
@@ -2,3 +2,17 @@ int __attribute__((__ms_abi__)) test(int i)
 {
     return i;
 }
+
+/*
+ * Populate an array with "addresses" of relocatable and absolute values.
+ * This is to probe ld for (a) emitting base relocations at all and (b) not
+ * emitting base relocations for absolute symbols.
+ */
+extern const unsigned char __image_base__[], __file_alignment__[],
+                           __section_alignment__[];
+const void *const data[] = {
+    __image_base__,
+    __file_alignment__,
+    __section_alignment__,
+    data,
+};
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 2541ba1f32..fb217031ff 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -86,10 +86,12 @@ static void __init efi_arch_relocate_image(unsigned long delta)
                 }
                 break;
             case PE_BASE_RELOC_DIR64:
-                if ( in_page_tables(addr) )
-                    blexit(L"Unexpected relocation type");
                 if ( delta )
+                {
                     *(u64 *)addr += delta;
+                    if ( in_page_tables(addr) )
+                        *(u64 *)addr += xen_phys_start;
+                }
                 break;
             default:
                 blexit(L"Unsupported relocation type");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:45:05 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:45:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116091.221529 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtJ3-0001w0-Rs; Fri, 23 Apr 2021 10:45:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116091.221529; Fri, 23 Apr 2021 10:45: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 1lZtJ3-0001vs-Oh; Fri, 23 Apr 2021 10:45:05 +0000
Received: by outflank-mailman (input) for mailman id 116091;
 Fri, 23 Apr 2021 10:45: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 1lZtJ2-0001vk-PP
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:45: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 1lZtJ2-0002gI-Od
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:45:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtJ1-0000n4-UI
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:45: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=+ID7NLvYYXchcefIv2Ji+Q3+6T+WNTJLB7/6mgibpCk=; b=ft1h60j90LdlwSDYP/ff+qVMJ1
	vz05Dszn+PMNLDLiEoqnuHESOg7MGQkKoX0qC53JIBVp8a4T2tN1FnWLa/5LhYa3UbHibSApSCUtS
	jfVwM8QWiOt9vLhTCCaudT2NQpzEwWCQP+Wi89W30OB+lxqeIrjPe6rSvtlUKJQYKizw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm: rewrite virt_to_xen_l*e
Message-Id: <E1lZtJ1-0000n4-UI@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:45:03 +0000

commit 4215992594b66e3f37ea776e71808987589c102a
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:12:31 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:12:31 2021 +0200

    x86/mm: rewrite virt_to_xen_l*e
    
    Rewrite those functions to use the new APIs. Modify its callers to unmap
    the pointer returned. Since alloc_xen_pagetable_new() is almost never
    useful unless accompanied by page clearing and a mapping, introduce a
    helper alloc_map_clear_xen_pt() for this sequence.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c        | 102 +++++++++++++++++++++++++++++++++--------------
 xen/include/asm-x86/mm.h |   1 +
 2 files changed, 72 insertions(+), 31 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index b7a10bbdd4..5944ef19dc 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4931,8 +4931,28 @@ void free_xen_pagetable_new(mfn_t mfn)
         free_xenheap_page(mfn_to_virt(mfn_x(mfn)));
 }
 
+void *alloc_mapped_pagetable(mfn_t *pmfn)
+{
+    mfn_t mfn = alloc_xen_pagetable_new();
+    void *ret;
+
+    if ( mfn_eq(mfn, INVALID_MFN) )
+        return NULL;
+
+    if ( pmfn )
+        *pmfn = mfn;
+    ret = map_domain_page(mfn);
+    clear_page(ret);
+
+    return ret;
+}
+
 static DEFINE_SPINLOCK(map_pgdir_lock);
 
+/*
+ * For virt_to_xen_lXe() functions, they take a linear address and return a
+ * pointer to Xen's LX entry. Caller needs to unmap the pointer.
+ */
 static l3_pgentry_t *virt_to_xen_l3e(unsigned long v)
 {
     l4_pgentry_t *pl4e;
@@ -4941,33 +4961,33 @@ static l3_pgentry_t *virt_to_xen_l3e(unsigned long v)
     if ( !(l4e_get_flags(*pl4e) & _PAGE_PRESENT) )
     {
         bool locking = system_state > SYS_STATE_boot;
-        l3_pgentry_t *l3t = alloc_xen_pagetable();
+        mfn_t l3mfn;
+        l3_pgentry_t *l3t = alloc_mapped_pagetable(&l3mfn);
 
         if ( !l3t )
             return NULL;
-        clear_page(l3t);
+        UNMAP_DOMAIN_PAGE(l3t);
         if ( locking )
             spin_lock(&map_pgdir_lock);
         if ( !(l4e_get_flags(*pl4e) & _PAGE_PRESENT) )
         {
-            l4_pgentry_t l4e = l4e_from_paddr(__pa(l3t), __PAGE_HYPERVISOR);
+            l4_pgentry_t l4e = l4e_from_mfn(l3mfn, __PAGE_HYPERVISOR);
 
             l4e_write(pl4e, l4e);
             efi_update_l4_pgtable(l4_table_offset(v), l4e);
-            l3t = NULL;
+            l3mfn = INVALID_MFN;
         }
         if ( locking )
             spin_unlock(&map_pgdir_lock);
-        if ( l3t )
-            free_xen_pagetable(l3t);
+        free_xen_pagetable_new(l3mfn);
     }
 
-    return l4e_to_l3e(*pl4e) + l3_table_offset(v);
+    return map_l3t_from_l4e(*pl4e) + l3_table_offset(v);
 }
 
 static l2_pgentry_t *virt_to_xen_l2e(unsigned long v)
 {
-    l3_pgentry_t *pl3e;
+    l3_pgentry_t *pl3e, l3e;
 
     pl3e = virt_to_xen_l3e(v);
     if ( !pl3e )
@@ -4976,31 +4996,37 @@ static l2_pgentry_t *virt_to_xen_l2e(unsigned long v)
     if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) )
     {
         bool locking = system_state > SYS_STATE_boot;
-        l2_pgentry_t *l2t = alloc_xen_pagetable();
+        mfn_t l2mfn;
+        l2_pgentry_t *l2t = alloc_mapped_pagetable(&l2mfn);
 
         if ( !l2t )
+        {
+            unmap_domain_page(pl3e);
             return NULL;
-        clear_page(l2t);
+        }
+        UNMAP_DOMAIN_PAGE(l2t);
         if ( locking )
             spin_lock(&map_pgdir_lock);
         if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) )
         {
-            l3e_write(pl3e, l3e_from_paddr(__pa(l2t), __PAGE_HYPERVISOR));
-            l2t = NULL;
+            l3e_write(pl3e, l3e_from_mfn(l2mfn, __PAGE_HYPERVISOR));
+            l2mfn = INVALID_MFN;
         }
         if ( locking )
             spin_unlock(&map_pgdir_lock);
-        if ( l2t )
-            free_xen_pagetable(l2t);
+        free_xen_pagetable_new(l2mfn);
     }
 
     BUG_ON(l3e_get_flags(*pl3e) & _PAGE_PSE);
-    return l3e_to_l2e(*pl3e) + l2_table_offset(v);
+    l3e = *pl3e;
+    unmap_domain_page(pl3e);
+
+    return map_l2t_from_l3e(l3e) + l2_table_offset(v);
 }
 
 l1_pgentry_t *virt_to_xen_l1e(unsigned long v)
 {
-    l2_pgentry_t *pl2e;
+    l2_pgentry_t *pl2e, l2e;
 
     pl2e = virt_to_xen_l2e(v);
     if ( !pl2e )
@@ -5009,26 +5035,32 @@ l1_pgentry_t *virt_to_xen_l1e(unsigned long v)
     if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )
     {
         bool locking = system_state > SYS_STATE_boot;
-        l1_pgentry_t *l1t = alloc_xen_pagetable();
+        mfn_t l1mfn;
+        l1_pgentry_t *l1t = alloc_mapped_pagetable(&l1mfn);
 
         if ( !l1t )
+        {
+            unmap_domain_page(pl2e);
             return NULL;
-        clear_page(l1t);
+        }
+        UNMAP_DOMAIN_PAGE(l1t);
         if ( locking )
             spin_lock(&map_pgdir_lock);
         if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )
         {
-            l2e_write(pl2e, l2e_from_paddr(__pa(l1t), __PAGE_HYPERVISOR));
-            l1t = NULL;
+            l2e_write(pl2e, l2e_from_mfn(l1mfn, __PAGE_HYPERVISOR));
+            l1mfn = INVALID_MFN;
         }
         if ( locking )
             spin_unlock(&map_pgdir_lock);
-        if ( l1t )
-            free_xen_pagetable(l1t);
+        free_xen_pagetable_new(l1mfn);
     }
 
     BUG_ON(l2e_get_flags(*pl2e) & _PAGE_PSE);
-    return l2e_to_l1e(*pl2e) + l1_table_offset(v);
+    l2e = *pl2e;
+    unmap_domain_page(pl2e);
+
+    return map_l1t_from_l2e(l2e) + l1_table_offset(v);
 }
 
 /* Convert to from superpage-mapping flags for map_pages_to_xen(). */
@@ -5085,7 +5117,7 @@ mfn_t xen_map_to_mfn(unsigned long va)
 
     L3T_INIT(l3page);
     CHECK_MAPPED(pl3e);
-    l3page = virt_to_page(pl3e);
+    l3page = mfn_to_page(domain_page_map_to_mfn(pl3e));
     L3T_LOCK(l3page);
 
     CHECK_MAPPED(l3e_get_flags(*pl3e) & _PAGE_PRESENT);
@@ -5124,7 +5156,8 @@ int map_pages_to_xen(
     unsigned int flags)
 {
     bool locking = system_state > SYS_STATE_boot;
-    l2_pgentry_t *pl2e, ol2e;
+    l3_pgentry_t *pl3e = NULL, ol3e;
+    l2_pgentry_t *pl2e = NULL, ol2e;
     l1_pgentry_t *pl1e, ol1e;
     unsigned int  i;
     int rc = -ENOMEM;
@@ -5148,15 +5181,16 @@ int map_pages_to_xen(
 
     while ( nr_mfns != 0 )
     {
-        l3_pgentry_t *pl3e, ol3e;
-
+        /* Clean up the previous iteration. */
         L3T_UNLOCK(current_l3page);
+        UNMAP_DOMAIN_PAGE(pl3e);
+        UNMAP_DOMAIN_PAGE(pl2e);
 
         pl3e = virt_to_xen_l3e(virt);
         if ( !pl3e )
             goto out;
 
-        current_l3page = virt_to_page(pl3e);
+        current_l3page = mfn_to_page(domain_page_map_to_mfn(pl3e));
         L3T_LOCK(current_l3page);
         ol3e = *pl3e;
 
@@ -5321,6 +5355,8 @@ int map_pages_to_xen(
                 pl1e = virt_to_xen_l1e(virt);
                 if ( pl1e == NULL )
                     goto out;
+
+                UNMAP_DOMAIN_PAGE(pl1e);
             }
             else if ( l2e_get_flags(*pl2e) & _PAGE_PSE )
             {
@@ -5498,6 +5534,8 @@ int map_pages_to_xen(
 
  out:
     L3T_UNLOCK(current_l3page);
+    unmap_domain_page(pl3e);
+    unmap_domain_page(pl2e);
     return rc;
 }
 
@@ -5521,6 +5559,7 @@ int populate_pt_range(unsigned long virt, unsigned long nr_mfns)
 int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
 {
     bool locking = system_state > SYS_STATE_boot;
+    l3_pgentry_t *pl3e = NULL;
     l2_pgentry_t *pl2e;
     l1_pgentry_t *pl1e;
     unsigned int  i;
@@ -5539,15 +5578,15 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
 
     while ( v < e )
     {
-        l3_pgentry_t *pl3e;
-
+        /* Clean up the previous iteration. */
         L3T_UNLOCK(current_l3page);
+        UNMAP_DOMAIN_PAGE(pl3e);
 
         pl3e = virt_to_xen_l3e(v);
         if ( !pl3e )
             goto out;
 
-        current_l3page = virt_to_page(pl3e);
+        current_l3page = mfn_to_page(domain_page_map_to_mfn(pl3e));
         L3T_LOCK(current_l3page);
 
         if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) )
@@ -5777,6 +5816,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
 
  out:
     L3T_UNLOCK(current_l3page);
+    unmap_domain_page(pl3e);
     return rc;
 }
 
diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index 041c158f03..111754675c 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -577,6 +577,7 @@ void *alloc_xen_pagetable(void);
 void free_xen_pagetable(void *v);
 mfn_t alloc_xen_pagetable_new(void);
 void free_xen_pagetable_new(mfn_t mfn);
+void *alloc_mapped_pagetable(mfn_t *pmfn);
 
 l1_pgentry_t *virt_to_xen_l1e(unsigned long v);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:45:15 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:45:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116092.221533 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtJD-0001xZ-US; Fri, 23 Apr 2021 10:45:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116092.221533; Fri, 23 Apr 2021 10:45: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 1lZtJD-0001xR-RY; Fri, 23 Apr 2021 10:45:15 +0000
Received: by outflank-mailman (input) for mailman id 116092;
 Fri, 23 Apr 2021 10:45: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 1lZtJC-0001xJ-Sd
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:45: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 1lZtJC-0002gQ-Rs
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:45:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtJC-0000oH-RJ
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:45: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=J2lipkeHR+FLGauDcyaAXABBVHzvlt4qULcWy/U9tzY=; b=j/6eWluHj3S+M/hNpf3JcWXxVm
	NdzcoZWNDkZOtIzM1dE/W7pIiBxFuO13qWkZRHgi2HOUY8xgCyEbTGAFYhUIJL2/csVxfEaGNEo4E
	cgVDwPWrT82qpnvhKv8jmszZEG+e+RmIluGHfjAa9cLCNHrJiyhJHmIEPkTSsK9G5PaE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm: switch to new APIs in map_pages_to_xen
Message-Id: <E1lZtJC-0000oH-RJ@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:45:14 +0000

commit 4b5b08314ebc8146bfc4c2f8e356f1423a2b70ed
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:12:51 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:12:51 2021 +0200

    x86/mm: switch to new APIs in map_pages_to_xen
    
    Page tables allocated in that function should be mapped and unmapped
    now.
    
    Take the opportunity to avoid a potential double map in
    map_pages_to_xen() by initialising pl1e to NULL and only map it if it
    was not mapped earlier.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c | 64 +++++++++++++++++++++++++++++++++----------------------
 1 file changed, 38 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 5944ef19dc..a7549de05f 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5215,7 +5215,7 @@ int map_pages_to_xen(
                 }
                 else
                 {
-                    l2_pgentry_t *l2t = l3e_to_l2e(ol3e);
+                    l2_pgentry_t *l2t = map_l2t_from_l3e(ol3e);
 
                     for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
                     {
@@ -5227,10 +5227,11 @@ int map_pages_to_xen(
                         else
                         {
                             unsigned int j;
-                            const l1_pgentry_t *l1t = l2e_to_l1e(ol2e);
+                            const l1_pgentry_t *l1t = map_l1t_from_l2e(ol2e);
 
                             for ( j = 0; j < L1_PAGETABLE_ENTRIES; j++ )
                                 flush_flags(l1e_get_flags(l1t[j]));
+                            unmap_domain_page(l1t);
                         }
                     }
                     flush_area(virt, flush_flags);
@@ -5239,9 +5240,10 @@ int map_pages_to_xen(
                         ol2e = l2t[i];
                         if ( (l2e_get_flags(ol2e) & _PAGE_PRESENT) &&
                              !(l2e_get_flags(ol2e) & _PAGE_PSE) )
-                            free_xen_pagetable(l2e_to_l1e(ol2e));
+                            free_xen_pagetable_new(l2e_get_mfn(ol2e));
                     }
-                    free_xen_pagetable(l2t);
+                    unmap_domain_page(l2t);
+                    free_xen_pagetable_new(l3e_get_mfn(ol3e));
                 }
             }
 
@@ -5258,6 +5260,7 @@ int map_pages_to_xen(
             unsigned int flush_flags =
                 FLUSH_TLB | FLUSH_ORDER(2 * PAGETABLE_ORDER);
             l2_pgentry_t *l2t;
+            mfn_t l2mfn;
 
             /* Skip this PTE if there is no change. */
             if ( ((l3e_get_pfn(ol3e) & ~(L2_PAGETABLE_ENTRIES *
@@ -5279,15 +5282,17 @@ int map_pages_to_xen(
                 continue;
             }
 
-            l2t = alloc_xen_pagetable();
-            if ( l2t == NULL )
+            l2mfn = alloc_xen_pagetable_new();
+            if ( mfn_eq(l2mfn, INVALID_MFN) )
                 goto out;
 
+            l2t = map_domain_page(l2mfn);
             for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
                 l2e_write(l2t + i,
                           l2e_from_pfn(l3e_get_pfn(ol3e) +
                                        (i << PAGETABLE_ORDER),
                                        l3e_get_flags(ol3e)));
+            UNMAP_DOMAIN_PAGE(l2t);
 
             if ( l3e_get_flags(ol3e) & _PAGE_GLOBAL )
                 flush_flags |= FLUSH_TLB_GLOBAL;
@@ -5297,15 +5302,15 @@ int map_pages_to_xen(
             if ( (l3e_get_flags(*pl3e) & _PAGE_PRESENT) &&
                  (l3e_get_flags(*pl3e) & _PAGE_PSE) )
             {
-                l3e_write_atomic(pl3e, l3e_from_mfn(virt_to_mfn(l2t),
-                                                    __PAGE_HYPERVISOR));
-                l2t = NULL;
+                l3e_write_atomic(pl3e,
+                                 l3e_from_mfn(l2mfn, __PAGE_HYPERVISOR));
+                l2mfn = INVALID_MFN;
             }
             if ( locking )
                 spin_unlock(&map_pgdir_lock);
             flush_area(virt, flush_flags);
-            if ( l2t )
-                free_xen_pagetable(l2t);
+
+            free_xen_pagetable_new(l2mfn);
         }
 
         pl2e = virt_to_xen_l2e(virt);
@@ -5333,12 +5338,13 @@ int map_pages_to_xen(
                 }
                 else
                 {
-                    l1_pgentry_t *l1t = l2e_to_l1e(ol2e);
+                    l1_pgentry_t *l1t = map_l1t_from_l2e(ol2e);
 
                     for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
                         flush_flags(l1e_get_flags(l1t[i]));
                     flush_area(virt, flush_flags);
-                    free_xen_pagetable(l1t);
+                    unmap_domain_page(l1t);
+                    free_xen_pagetable_new(l2e_get_mfn(ol2e));
                 }
             }
 
@@ -5349,20 +5355,20 @@ int map_pages_to_xen(
         }
         else
         {
+            pl1e = NULL;
             /* Normal page mapping. */
             if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )
             {
                 pl1e = virt_to_xen_l1e(virt);
                 if ( pl1e == NULL )
                     goto out;
-
-                UNMAP_DOMAIN_PAGE(pl1e);
             }
             else if ( l2e_get_flags(*pl2e) & _PAGE_PSE )
             {
                 unsigned int flush_flags =
                     FLUSH_TLB | FLUSH_ORDER(PAGETABLE_ORDER);
                 l1_pgentry_t *l1t;
+                mfn_t l1mfn;
 
                 /* Skip this PTE if there is no change. */
                 if ( (((l2e_get_pfn(*pl2e) & ~(L1_PAGETABLE_ENTRIES - 1)) +
@@ -5382,14 +5388,16 @@ int map_pages_to_xen(
                     goto check_l3;
                 }
 
-                l1t = alloc_xen_pagetable();
-                if ( l1t == NULL )
+                l1mfn = alloc_xen_pagetable_new();
+                if ( mfn_eq(l1mfn, INVALID_MFN) )
                     goto out;
 
+                l1t = map_domain_page(l1mfn);
                 for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
                     l1e_write(&l1t[i],
                               l1e_from_pfn(l2e_get_pfn(*pl2e) + i,
                                            lNf_to_l1f(l2e_get_flags(*pl2e))));
+                UNMAP_DOMAIN_PAGE(l1t);
 
                 if ( l2e_get_flags(*pl2e) & _PAGE_GLOBAL )
                     flush_flags |= FLUSH_TLB_GLOBAL;
@@ -5399,20 +5407,22 @@ int map_pages_to_xen(
                 if ( (l2e_get_flags(*pl2e) & _PAGE_PRESENT) &&
                      (l2e_get_flags(*pl2e) & _PAGE_PSE) )
                 {
-                    l2e_write_atomic(pl2e, l2e_from_mfn(virt_to_mfn(l1t),
+                    l2e_write_atomic(pl2e, l2e_from_mfn(l1mfn,
                                                         __PAGE_HYPERVISOR));
-                    l1t = NULL;
+                    l1mfn = INVALID_MFN;
                 }
                 if ( locking )
                     spin_unlock(&map_pgdir_lock);
                 flush_area(virt, flush_flags);
-                if ( l1t )
-                    free_xen_pagetable(l1t);
+
+                free_xen_pagetable_new(l1mfn);
             }
 
-            pl1e  = l2e_to_l1e(*pl2e) + l1_table_offset(virt);
+            if ( !pl1e )
+                pl1e = map_l1t_from_l2e(*pl2e) + l1_table_offset(virt);
             ol1e  = *pl1e;
             l1e_write_atomic(pl1e, l1e_from_mfn(mfn, flags));
+            UNMAP_DOMAIN_PAGE(pl1e);
             if ( (l1e_get_flags(ol1e) & _PAGE_PRESENT) )
             {
                 unsigned int flush_flags = FLUSH_TLB | FLUSH_ORDER(0);
@@ -5456,12 +5466,13 @@ int map_pages_to_xen(
                     goto check_l3;
                 }
 
-                l1t = l2e_to_l1e(ol2e);
+                l1t = map_l1t_from_l2e(ol2e);
                 base_mfn = l1e_get_pfn(l1t[0]) & ~(L1_PAGETABLE_ENTRIES - 1);
                 for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
                     if ( (l1e_get_pfn(l1t[i]) != (base_mfn + i)) ||
                          (l1e_get_flags(l1t[i]) != flags) )
                         break;
+                UNMAP_DOMAIN_PAGE(l1t);
                 if ( i == L1_PAGETABLE_ENTRIES )
                 {
                     l2e_write_atomic(pl2e, l2e_from_pfn(base_mfn,
@@ -5471,7 +5482,7 @@ int map_pages_to_xen(
                     flush_area(virt - PAGE_SIZE,
                                FLUSH_TLB_GLOBAL |
                                FLUSH_ORDER(PAGETABLE_ORDER));
-                    free_xen_pagetable(l2e_to_l1e(ol2e));
+                    free_xen_pagetable_new(l2e_get_mfn(ol2e));
                 }
                 else if ( locking )
                     spin_unlock(&map_pgdir_lock);
@@ -5504,7 +5515,7 @@ int map_pages_to_xen(
                 continue;
             }
 
-            l2t = l3e_to_l2e(ol3e);
+            l2t = map_l2t_from_l3e(ol3e);
             base_mfn = l2e_get_pfn(l2t[0]) & ~(L2_PAGETABLE_ENTRIES *
                                               L1_PAGETABLE_ENTRIES - 1);
             for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
@@ -5512,6 +5523,7 @@ int map_pages_to_xen(
                       (base_mfn + (i << PAGETABLE_ORDER))) ||
                      (l2e_get_flags(l2t[i]) != l1f_to_lNf(flags)) )
                     break;
+            UNMAP_DOMAIN_PAGE(l2t);
             if ( i == L2_PAGETABLE_ENTRIES )
             {
                 l3e_write_atomic(pl3e, l3e_from_pfn(base_mfn,
@@ -5521,7 +5533,7 @@ int map_pages_to_xen(
                 flush_area(virt - PAGE_SIZE,
                            FLUSH_TLB_GLOBAL |
                            FLUSH_ORDER(2*PAGETABLE_ORDER));
-                free_xen_pagetable(l3e_to_l2e(ol3e));
+                free_xen_pagetable_new(l3e_get_mfn(ol3e));
             }
             else if ( locking )
                 spin_unlock(&map_pgdir_lock);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:45:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:45:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116094.221549 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtJO-00021e-8H; Fri, 23 Apr 2021 10:45:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116094.221549; Fri, 23 Apr 2021 10: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 1lZtJO-00021W-51; Fri, 23 Apr 2021 10:45:26 +0000
Received: by outflank-mailman (input) for mailman id 116094;
 Fri, 23 Apr 2021 10: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 1lZtJN-00021E-0S
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10: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 1lZtJM-0002gb-VH
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:45:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtJM-0000ot-UY
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:45: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=NiiNZhoBMOklCefdqJO66p3IhUgnIB2zARJtplEYPB4=; b=6K3eaE8K5aR50MgFqaIOx0NqmS
	fo9KHIay24rdggBz/x+DiVoqIV6YZXYlTGTfxSX3rguMfHmdLcYKZGR7I2EjwmazWb4ZfYjk6iXOW
	heb28E3QXWSw8nDF7u6Yc37OlN/ZJgxhPaWVgStRGXE1MEfoqf3i9m3+YWi06OEJB/3A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm: switch to new APIs in modify_xen_mappings
Message-Id: <E1lZtJM-0000ot-UY@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:45:24 +0000

commit dd68f2e49bea791244919fcbca8a76b611d2fa29
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:13:02 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:13:02 2021 +0200

    x86/mm: switch to new APIs in modify_xen_mappings
    
    Page tables allocated in that function should be mapped and unmapped
    now.
    
    Note that pl2e now maybe mapped and unmapped in different iterations, so
    we need to add clean-ups for that.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c | 57 +++++++++++++++++++++++++++++++++++--------------------
 1 file changed, 36 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index a7549de05f..f6f4831f66 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5546,6 +5546,7 @@ int map_pages_to_xen(
 
  out:
     L3T_UNLOCK(current_l3page);
+    unmap_domain_page(pl2e);
     unmap_domain_page(pl3e);
     unmap_domain_page(pl2e);
     return rc;
@@ -5572,7 +5573,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
 {
     bool locking = system_state > SYS_STATE_boot;
     l3_pgentry_t *pl3e = NULL;
-    l2_pgentry_t *pl2e;
+    l2_pgentry_t *pl2e = NULL;
     l1_pgentry_t *pl1e;
     unsigned int  i;
     unsigned long v = s;
@@ -5592,6 +5593,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
     {
         /* Clean up the previous iteration. */
         L3T_UNLOCK(current_l3page);
+        UNMAP_DOMAIN_PAGE(pl2e);
         UNMAP_DOMAIN_PAGE(pl3e);
 
         pl3e = virt_to_xen_l3e(v);
@@ -5614,6 +5616,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
         if ( l3e_get_flags(*pl3e) & _PAGE_PSE )
         {
             l2_pgentry_t *l2t;
+            mfn_t l2mfn;
 
             if ( l2_table_offset(v) == 0 &&
                  l1_table_offset(v) == 0 &&
@@ -5630,35 +5633,38 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
             }
 
             /* PAGE1GB: shatter the superpage and fall through. */
-            l2t = alloc_xen_pagetable();
-            if ( !l2t )
+            l2mfn = alloc_xen_pagetable_new();
+            if ( mfn_eq(l2mfn, INVALID_MFN) )
                 goto out;
 
+            l2t = map_domain_page(l2mfn);
             for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
                 l2e_write(l2t + i,
                           l2e_from_pfn(l3e_get_pfn(*pl3e) +
                                        (i << PAGETABLE_ORDER),
                                        l3e_get_flags(*pl3e)));
+            UNMAP_DOMAIN_PAGE(l2t);
+
             if ( locking )
                 spin_lock(&map_pgdir_lock);
             if ( (l3e_get_flags(*pl3e) & _PAGE_PRESENT) &&
                  (l3e_get_flags(*pl3e) & _PAGE_PSE) )
             {
-                l3e_write_atomic(pl3e, l3e_from_mfn(virt_to_mfn(l2t),
-                                                    __PAGE_HYPERVISOR));
-                l2t = NULL;
+                l3e_write_atomic(pl3e,
+                                 l3e_from_mfn(l2mfn, __PAGE_HYPERVISOR));
+                l2mfn = INVALID_MFN;
             }
             if ( locking )
                 spin_unlock(&map_pgdir_lock);
-            if ( l2t )
-                free_xen_pagetable(l2t);
+
+            free_xen_pagetable_new(l2mfn);
         }
 
         /*
          * The L3 entry has been verified to be present, and we've dealt with
          * 1G pages as well, so the L2 table cannot require allocation.
          */
-        pl2e = l3e_to_l2e(*pl3e) + l2_table_offset(v);
+        pl2e = map_l2t_from_l3e(*pl3e) + l2_table_offset(v);
 
         if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )
         {
@@ -5686,41 +5692,45 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
             else
             {
                 l1_pgentry_t *l1t;
-
                 /* PSE: shatter the superpage and try again. */
-                l1t = alloc_xen_pagetable();
-                if ( !l1t )
+                mfn_t l1mfn = alloc_xen_pagetable_new();
+
+                if ( mfn_eq(l1mfn, INVALID_MFN) )
                     goto out;
 
+                l1t = map_domain_page(l1mfn);
                 for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
                     l1e_write(&l1t[i],
                               l1e_from_pfn(l2e_get_pfn(*pl2e) + i,
                                            l2e_get_flags(*pl2e) & ~_PAGE_PSE));
+                UNMAP_DOMAIN_PAGE(l1t);
+
                 if ( locking )
                     spin_lock(&map_pgdir_lock);
                 if ( (l2e_get_flags(*pl2e) & _PAGE_PRESENT) &&
                      (l2e_get_flags(*pl2e) & _PAGE_PSE) )
                 {
-                    l2e_write_atomic(pl2e, l2e_from_mfn(virt_to_mfn(l1t),
+                    l2e_write_atomic(pl2e, l2e_from_mfn(l1mfn,
                                                         __PAGE_HYPERVISOR));
-                    l1t = NULL;
+                    l1mfn = INVALID_MFN;
                 }
                 if ( locking )
                     spin_unlock(&map_pgdir_lock);
-                if ( l1t )
-                    free_xen_pagetable(l1t);
+
+                free_xen_pagetable_new(l1mfn);
             }
         }
         else
         {
             l1_pgentry_t nl1e, *l1t;
+            mfn_t l1mfn;
 
             /*
              * Ordinary 4kB mapping: The L2 entry has been verified to be
              * present, and we've dealt with 2M pages as well, so the L1 table
              * cannot require allocation.
              */
-            pl1e = l2e_to_l1e(*pl2e) + l1_table_offset(v);
+            pl1e = map_l1t_from_l2e(*pl2e) + l1_table_offset(v);
 
             /* Confirm the caller isn't trying to create new mappings. */
             if ( !(l1e_get_flags(*pl1e) & _PAGE_PRESENT) )
@@ -5731,6 +5741,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
                                (l1e_get_flags(*pl1e) & ~FLAGS_MASK) | nf);
 
             l1e_write_atomic(pl1e, nl1e);
+            UNMAP_DOMAIN_PAGE(pl1e);
             v += PAGE_SIZE;
 
             /*
@@ -5760,10 +5771,12 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
                 continue;
             }
 
-            l1t = l2e_to_l1e(*pl2e);
+            l1mfn = l2e_get_mfn(*pl2e);
+            l1t = map_domain_page(l1mfn);
             for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
                 if ( l1e_get_intpte(l1t[i]) != 0 )
                     break;
+            UNMAP_DOMAIN_PAGE(l1t);
             if ( i == L1_PAGETABLE_ENTRIES )
             {
                 /* Empty: zap the L2E and free the L1 page. */
@@ -5771,7 +5784,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
                 if ( locking )
                     spin_unlock(&map_pgdir_lock);
                 flush_area(NULL, FLUSH_TLB_GLOBAL); /* flush before free */
-                free_xen_pagetable(l1t);
+                free_xen_pagetable_new(l1mfn);
             }
             else if ( locking )
                 spin_unlock(&map_pgdir_lock);
@@ -5802,11 +5815,13 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
 
         {
             l2_pgentry_t *l2t;
+            mfn_t l2mfn = l3e_get_mfn(*pl3e);
 
-            l2t = l3e_to_l2e(*pl3e);
+            l2t = map_domain_page(l2mfn);
             for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
                 if ( l2e_get_intpte(l2t[i]) != 0 )
                     break;
+            UNMAP_DOMAIN_PAGE(l2t);
             if ( i == L2_PAGETABLE_ENTRIES )
             {
                 /* Empty: zap the L3E and free the L2 page. */
@@ -5814,7 +5829,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
                 if ( locking )
                     spin_unlock(&map_pgdir_lock);
                 flush_area(NULL, FLUSH_TLB_GLOBAL); /* flush before free */
-                free_xen_pagetable(l2t);
+                free_xen_pagetable_new(l2mfn);
             }
             else if ( locking )
                 spin_unlock(&map_pgdir_lock);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:45:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:45:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116096.221553 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtJY-00024G-9U; Fri, 23 Apr 2021 10:45:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116096.221553; Fri, 23 Apr 2021 10: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 1lZtJY-000247-6c; Fri, 23 Apr 2021 10:45:36 +0000
Received: by outflank-mailman (input) for mailman id 116096;
 Fri, 23 Apr 2021 10: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 1lZtJX-00023q-2g
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10: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 1lZtJX-0002gh-1w
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:45:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtJX-0000pW-1O
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10: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=VqcZcs/9GFO79AuArsvJlwx8QLrYaSAI+xW3//ovukQ=; b=TIVW5FXTMbYXEFVtYt6BjY0LyH
	RhW1y02H/S+mZLwGXcrbN+y05zZGAIxS2JZRLk++Czn5gNZBDVgYzKf2WYQohRYlqzzcqQCYQyYSq
	Jy1yqf6WDeOvaH4+lUlUdx0T06LvaJ7uhXVe6sDatIwAjTQuIdFo9mcvrMH5pwiJ3HHI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86_64/mm: introduce pl2e in paging_init
Message-Id: <E1lZtJX-0000pW-1O@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:45:35 +0000

commit 33a8018d2e4e4c62b767f9934c682d9d8c90d3d5
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:13:13 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:13:13 2021 +0200

    x86_64/mm: introduce pl2e in paging_init
    
    We will soon map and unmap pages in paging_init(). Introduce pl2e so
    that we can use l2_ro_mpt to point to the page table itself.
    
    No functional change.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/mm.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index d7e67311fa..59049bdf8e 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -496,7 +496,7 @@ void __init paging_init(void)
     unsigned long i, mpt_size, va;
     unsigned int n, memflags;
     l3_pgentry_t *l3_ro_mpt;
-    l2_pgentry_t *l2_ro_mpt = NULL;
+    l2_pgentry_t *pl2e = NULL, *l2_ro_mpt = NULL;
     struct page_info *l1_pg;
 
     /*
@@ -546,7 +546,7 @@ void __init paging_init(void)
             (L2_PAGETABLE_SHIFT - 3 + PAGE_SHIFT)));
 
         if ( cpu_has_page1gb &&
-             !((unsigned long)l2_ro_mpt & ~PAGE_MASK) &&
+             !((unsigned long)pl2e & ~PAGE_MASK) &&
              (mpt_size >> L3_PAGETABLE_SHIFT) > (i >> PAGETABLE_ORDER) )
         {
             unsigned int k, holes;
@@ -606,7 +606,7 @@ void __init paging_init(void)
             memset((void *)(RDWR_MPT_VIRT_START + (i << L2_PAGETABLE_SHIFT)),
                    0xFF, 1UL << L2_PAGETABLE_SHIFT);
         }
-        if ( !((unsigned long)l2_ro_mpt & ~PAGE_MASK) )
+        if ( !((unsigned long)pl2e & ~PAGE_MASK) )
         {
             if ( (l2_ro_mpt = alloc_xen_pagetable()) == NULL )
                 goto nomem;
@@ -614,13 +614,14 @@ void __init paging_init(void)
             l3e_write(&l3_ro_mpt[l3_table_offset(va)],
                       l3e_from_paddr(__pa(l2_ro_mpt),
                                      __PAGE_HYPERVISOR_RO | _PAGE_USER));
+            pl2e = l2_ro_mpt;
             ASSERT(!l2_table_offset(va));
         }
         /* NB. Cannot be GLOBAL: guest user mode should not see it. */
         if ( l1_pg )
-            l2e_write(l2_ro_mpt, l2e_from_page(
+            l2e_write(pl2e, l2e_from_page(
                 l1_pg, /*_PAGE_GLOBAL|*/_PAGE_PSE|_PAGE_USER|_PAGE_PRESENT));
-        l2_ro_mpt++;
+        pl2e++;
     }
 #undef CNT
 #undef MFN
@@ -632,6 +633,7 @@ void __init paging_init(void)
             goto nomem;
         compat_idle_pg_table_l2 = l2_ro_mpt;
         clear_page(l2_ro_mpt);
+        pl2e = l2_ro_mpt;
 
         /* Allocate and map the compatibility mode machine-to-phys table. */
         mpt_size = (mpt_size >> 1) + (1UL << (L2_PAGETABLE_SHIFT - 1));
@@ -649,7 +651,7 @@ void __init paging_init(void)
              sizeof(*compat_machine_to_phys_mapping))
     BUILD_BUG_ON((sizeof(*frame_table) & ~sizeof(*frame_table)) % \
                  sizeof(*compat_machine_to_phys_mapping));
-    for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++, l2_ro_mpt++ )
+    for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++, pl2e++ )
     {
         memflags = MEMF_node(phys_to_nid(i <<
             (L2_PAGETABLE_SHIFT - 2 + PAGE_SHIFT)));
@@ -671,7 +673,7 @@ void __init paging_init(void)
                         (i << L2_PAGETABLE_SHIFT)),
                0xFF, 1UL << L2_PAGETABLE_SHIFT);
         /* NB. Cannot be GLOBAL as the ptes get copied into per-VM space. */
-        l2e_write(l2_ro_mpt, l2e_from_page(l1_pg, _PAGE_PSE|_PAGE_PRESENT));
+        l2e_write(pl2e, l2e_from_page(l1_pg, _PAGE_PSE|_PAGE_PRESENT));
     }
 #undef CNT
 #undef MFN
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:45:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:45:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116098.221558 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtJi-00026g-By; Fri, 23 Apr 2021 10:45:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116098.221558; Fri, 23 Apr 2021 10:45: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 1lZtJi-00026Y-83; Fri, 23 Apr 2021 10:45:46 +0000
Received: by outflank-mailman (input) for mailman id 116098;
 Fri, 23 Apr 2021 10: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 1lZtJh-00026J-7E
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10: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 1lZtJh-0002hC-52
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:45:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtJh-0000qD-4H
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10: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=aTvxF5oZTjnDx3xdAoIR1fCIDg3j1n1lTzahUcHT+ow=; b=HI4UhHsi/B8b0JxkkhBh5g7Ihv
	JCvdXpkI8sW3W6WfBLdShnxyX4YIkP4LCc5OvPhClzqM0FsYnaHs6LD8gXCe16kK2I1N20kg4MeZ0
	briZGmLse1qtRW09D+9qFxnWoFQ0B0Pk1vLOviagn4C+R2BBgYrhFC1eK6ZLnmqGMsjY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86_64/mm: switch to new APIs in paging_init
Message-Id: <E1lZtJh-0000qD-4H@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:45:45 +0000

commit d87e3ff90dd9a66ce96191247eff215e52c9eeef
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:13:24 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:13:24 2021 +0200

    x86_64/mm: switch to new APIs in paging_init
    
    Map and unmap pages instead of relying on the direct map.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/mm.c | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index 59049bdf8e..3e40d529bb 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -498,6 +498,7 @@ void __init paging_init(void)
     l3_pgentry_t *l3_ro_mpt;
     l2_pgentry_t *pl2e = NULL, *l2_ro_mpt = NULL;
     struct page_info *l1_pg;
+    mfn_t mfn;
 
     /*
      * We setup the L3s for 1:1 mapping if host support memory hotplug
@@ -510,22 +511,22 @@ void __init paging_init(void)
         if ( !(l4e_get_flags(idle_pg_table[l4_table_offset(va)]) &
               _PAGE_PRESENT) )
         {
-            l3_pgentry_t *pl3t = alloc_xen_pagetable();
+            l3_pgentry_t *pl3t = alloc_mapped_pagetable(&mfn);
 
             if ( !pl3t )
                 goto nomem;
-            clear_page(pl3t);
+            UNMAP_DOMAIN_PAGE(pl3t);
             l4e_write(&idle_pg_table[l4_table_offset(va)],
-                      l4e_from_paddr(__pa(pl3t), __PAGE_HYPERVISOR_RW));
+                      l4e_from_mfn(mfn, __PAGE_HYPERVISOR_RW));
         }
     }
 
     /* Create user-accessible L2 directory to map the MPT for guests. */
-    if ( (l3_ro_mpt = alloc_xen_pagetable()) == NULL )
+    l3_ro_mpt = alloc_mapped_pagetable(&mfn);
+    if ( !l3_ro_mpt )
         goto nomem;
-    clear_page(l3_ro_mpt);
     l4e_write(&idle_pg_table[l4_table_offset(RO_MPT_VIRT_START)],
-              l4e_from_paddr(__pa(l3_ro_mpt), __PAGE_HYPERVISOR_RO | _PAGE_USER));
+              l4e_from_mfn(mfn, __PAGE_HYPERVISOR_RO | _PAGE_USER));
 
     /*
      * Allocate and map the machine-to-phys table.
@@ -608,12 +609,14 @@ void __init paging_init(void)
         }
         if ( !((unsigned long)pl2e & ~PAGE_MASK) )
         {
-            if ( (l2_ro_mpt = alloc_xen_pagetable()) == NULL )
+            UNMAP_DOMAIN_PAGE(l2_ro_mpt);
+
+            l2_ro_mpt = alloc_mapped_pagetable(&mfn);
+            if ( !l2_ro_mpt )
                 goto nomem;
-            clear_page(l2_ro_mpt);
+
             l3e_write(&l3_ro_mpt[l3_table_offset(va)],
-                      l3e_from_paddr(__pa(l2_ro_mpt),
-                                     __PAGE_HYPERVISOR_RO | _PAGE_USER));
+                      l3e_from_mfn(mfn, __PAGE_HYPERVISOR_RO | _PAGE_USER));
             pl2e = l2_ro_mpt;
             ASSERT(!l2_table_offset(va));
         }
@@ -625,15 +628,18 @@ void __init paging_init(void)
     }
 #undef CNT
 #undef MFN
+    UNMAP_DOMAIN_PAGE(l2_ro_mpt);
+    UNMAP_DOMAIN_PAGE(l3_ro_mpt);
 
     /* Create user-accessible L2 directory to map the MPT for compat guests. */
     if ( opt_pv32 )
     {
-        if ( (l2_ro_mpt = alloc_xen_pagetable()) == NULL )
+        mfn = alloc_xen_pagetable_new();
+        if ( mfn_eq(mfn, INVALID_MFN) )
             goto nomem;
-        compat_idle_pg_table_l2 = l2_ro_mpt;
-        clear_page(l2_ro_mpt);
-        pl2e = l2_ro_mpt;
+        compat_idle_pg_table_l2 = map_domain_page_global(mfn);
+        clear_page(compat_idle_pg_table_l2);
+        pl2e = compat_idle_pg_table_l2;
 
         /* Allocate and map the compatibility mode machine-to-phys table. */
         mpt_size = (mpt_size >> 1) + (1UL << (L2_PAGETABLE_SHIFT - 1));
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:45:56 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:45:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116100.221561 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtJs-00028U-F0; Fri, 23 Apr 2021 10:45:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116100.221561; Fri, 23 Apr 2021 10:45: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 1lZtJs-00028M-BR; Fri, 23 Apr 2021 10:45:56 +0000
Received: by outflank-mailman (input) for mailman id 116100;
 Fri, 23 Apr 2021 10: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 1lZtJr-00028B-9F
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10: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 1lZtJr-0002hL-8I
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:45:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtJr-0000r1-7d
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10: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=j9oLQtZ+N3oqUQCGat2IU4IAtnRjL6PlrZJUeGZvvyM=; b=4xmzadzfsQmSBE0G+0fczGTbZt
	4D8jZsNgQ/J+SzrpTf0gjuXtJ/tg+HJJ/XfRS5iVCF2ul2i1QuYGwq4RHeyXF/lxEn9qKhvYzUfZ1
	7bWtXFhzJL+gfePyt3KbMwIfQBPF9qPJ/fiFsMnLIsl5+ZJEusbaDeBc6NDiz2gRFdjE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86_64/mm: switch to new APIs in setup_m2p_table
Message-Id: <E1lZtJr-0000r1-7d@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:45:55 +0000

commit 7e2fdcdb3e0fa215f08571037f6dea4abb3e94fb
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:13:34 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:13:34 2021 +0200

    x86_64/mm: switch to new APIs in setup_m2p_table
    
    While doing so, avoid repetitive mapping of l2_ro_mpt by keeping it
    across loops, and only unmap and map it when crossing 1G boundaries.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/mm.c | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index 3e40d529bb..c625075695 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -402,7 +402,8 @@ static int setup_m2p_table(struct mem_hotadd_info *info)
 
     ASSERT(l4e_get_flags(idle_pg_table[l4_table_offset(RO_MPT_VIRT_START)])
             & _PAGE_PRESENT);
-    l3_ro_mpt = l4e_to_l3e(idle_pg_table[l4_table_offset(RO_MPT_VIRT_START)]);
+    l3_ro_mpt = map_l3t_from_l4e(
+                    idle_pg_table[l4_table_offset(RO_MPT_VIRT_START)]);
 
     smap = (info->spfn & (~((1UL << (L2_PAGETABLE_SHIFT - 3)) -1)));
     emap = ((info->epfn + ((1UL << (L2_PAGETABLE_SHIFT - 3)) - 1 )) &
@@ -420,6 +421,10 @@ static int setup_m2p_table(struct mem_hotadd_info *info)
     i = smap;
     while ( i < emap )
     {
+        if ( (RO_MPT_VIRT_START + i * sizeof(*machine_to_phys_mapping)) &
+             ((1UL << L3_PAGETABLE_SHIFT) - 1) )
+            UNMAP_DOMAIN_PAGE(l2_ro_mpt);
+
         switch ( m2p_mapped(i) )
         {
         case M2P_1G_MAPPED:
@@ -455,32 +460,31 @@ static int setup_m2p_table(struct mem_hotadd_info *info)
 
             ASSERT(!(l3e_get_flags(l3_ro_mpt[l3_table_offset(va)]) &
                   _PAGE_PSE));
-            if ( l3e_get_flags(l3_ro_mpt[l3_table_offset(va)]) &
-              _PAGE_PRESENT )
-                l2_ro_mpt = l3e_to_l2e(l3_ro_mpt[l3_table_offset(va)]) +
-                  l2_table_offset(va);
+            if ( l2_ro_mpt )
+                /* nothing */;
+            else if ( l3e_get_flags(l3_ro_mpt[l3_table_offset(va)]) &
+                      _PAGE_PRESENT )
+                l2_ro_mpt = map_l2t_from_l3e(l3_ro_mpt[l3_table_offset(va)]);
             else
             {
-                l2_ro_mpt = alloc_xen_pagetable();
+                mfn_t l2_ro_mpt_mfn;
+
+                l2_ro_mpt = alloc_mapped_pagetable(&l2_ro_mpt_mfn);
                 if ( !l2_ro_mpt )
                 {
                     ret = -ENOMEM;
                     goto error;
                 }
 
-                clear_page(l2_ro_mpt);
                 l3e_write(&l3_ro_mpt[l3_table_offset(va)],
-                          l3e_from_paddr(__pa(l2_ro_mpt),
-                                         __PAGE_HYPERVISOR_RO | _PAGE_USER));
-                l2_ro_mpt += l2_table_offset(va);
+                          l3e_from_mfn(l2_ro_mpt_mfn,
+                                       __PAGE_HYPERVISOR_RO | _PAGE_USER));
             }
 
             /* NB. Cannot be GLOBAL: guest user mode should not see it. */
-            l2e_write(l2_ro_mpt, l2e_from_mfn(mfn,
+            l2e_write(&l2_ro_mpt[l2_table_offset(va)], l2e_from_mfn(mfn,
                    /*_PAGE_GLOBAL|*/_PAGE_PSE|_PAGE_USER|_PAGE_PRESENT));
         }
-        if ( !((unsigned long)l2_ro_mpt & ~PAGE_MASK) )
-            l2_ro_mpt = NULL;
         i += ( 1UL << (L2_PAGETABLE_SHIFT - 3));
     }
 #undef CNT
@@ -488,6 +492,8 @@ static int setup_m2p_table(struct mem_hotadd_info *info)
 
     ret = setup_compat_m2p_table(info);
 error:
+    unmap_domain_page(l2_ro_mpt);
+    unmap_domain_page(l3_ro_mpt);
     return ret;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:46:06 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:46:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116101.221565 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtK2-00029z-GJ; Fri, 23 Apr 2021 10:46:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116101.221565; Fri, 23 Apr 2021 10:46: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 1lZtK2-00029q-DD; Fri, 23 Apr 2021 10:46:06 +0000
Received: by outflank-mailman (input) for mailman id 116101;
 Fri, 23 Apr 2021 10: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 1lZtK1-00029f-Cf
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10: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 1lZtK1-0002jE-Bl
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:46:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtK1-0000sG-Av
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10: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=+/am3cfMVOukDWcxlKKxqY6M5vdiG4d1ZcY+74yLA3k=; b=SLteHQ3evtBCB8/G3qrQrI9EWl
	n4DF+87hahkUVTQ4UVDHNhitANYbKThwVTNUSrJLNKBYQF9hXduuzyDinrqovzFJ1uYdRUiYLr4P6
	aEwwR8ec93OWM9knW0bNDaGFfrst1gZPvDuqYTHFXgKxU/DXehYwBPOEw0OWzBUZmiDs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] efi: use new page table APIs in copy_mapping
Message-Id: <E1lZtK1-0000sG-Av@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:46:05 +0000

commit a2b4c46b6eeebe0aa9a89ac134a3286be6ab6336
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:13:44 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:13:44 2021 +0200

    efi: use new page table APIs in copy_mapping
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/efi/boot.c | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 63e289ab85..539d86c6e8 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -6,6 +6,7 @@
 #include <xen/compile.h>
 #include <xen/ctype.h>
 #include <xen/dmi.h>
+#include <xen/domain_page.h>
 #include <xen/init.h>
 #include <xen/keyhandler.h>
 #include <xen/lib.h>
@@ -1439,29 +1440,42 @@ static __init void copy_mapping(unsigned long mfn, unsigned long end,
                                                  unsigned long emfn))
 {
     unsigned long next;
+    l3_pgentry_t *l3src = NULL, *l3dst = NULL;
 
     for ( ; mfn < end; mfn = next )
     {
         l4_pgentry_t l4e = efi_l4_pgtable[l4_table_offset(mfn << PAGE_SHIFT)];
-        l3_pgentry_t *l3src, *l3dst;
         unsigned long va = (unsigned long)mfn_to_virt(mfn);
 
+        if ( !(mfn & ((1UL << (L4_PAGETABLE_SHIFT - PAGE_SHIFT)) - 1)) )
+            UNMAP_DOMAIN_PAGE(l3dst);
+        if ( !(va & ((1UL << L4_PAGETABLE_SHIFT) - 1)) )
+            UNMAP_DOMAIN_PAGE(l3src);
         next = mfn + (1UL << (L3_PAGETABLE_SHIFT - PAGE_SHIFT));
         if ( !is_valid(mfn, min(next, end)) )
             continue;
-        if ( !(l4e_get_flags(l4e) & _PAGE_PRESENT) )
+
+        if ( l3dst )
+            /* nothing */;
+        else if ( !(l4e_get_flags(l4e) & _PAGE_PRESENT) )
         {
-            l3dst = alloc_xen_pagetable();
+            mfn_t l3mfn;
+
+            l3dst = alloc_mapped_pagetable(&l3mfn);
             BUG_ON(!l3dst);
-            clear_page(l3dst);
             efi_l4_pgtable[l4_table_offset(mfn << PAGE_SHIFT)] =
-                l4e_from_paddr(virt_to_maddr(l3dst), __PAGE_HYPERVISOR);
+                l4e_from_mfn(l3mfn, __PAGE_HYPERVISOR);
         }
         else
-            l3dst = l4e_to_l3e(l4e);
-        l3src = l4e_to_l3e(idle_pg_table[l4_table_offset(va)]);
+            l3dst = map_l3t_from_l4e(l4e);
+
+        if ( !l3src )
+            l3src = map_l3t_from_l4e(idle_pg_table[l4_table_offset(va)]);
         l3dst[l3_table_offset(mfn << PAGE_SHIFT)] = l3src[l3_table_offset(va)];
     }
+
+    unmap_domain_page(l3src);
+    unmap_domain_page(l3dst);
 }
 
 static bool __init ram_range_valid(unsigned long smfn, unsigned long emfn)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:46:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:46:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116102.221569 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtKD-0002Bk-I8; Fri, 23 Apr 2021 10:46:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116102.221569; Fri, 23 Apr 2021 10: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 1lZtKD-0002BY-El; Fri, 23 Apr 2021 10:46:17 +0000
Received: by outflank-mailman (input) for mailman id 116102;
 Fri, 23 Apr 2021 10:46: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 1lZtKB-0002BH-Fl
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:46: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 1lZtKB-0002jR-F3
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:46:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtKB-0000t2-EK
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:46: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=YnxUhhVHJsK7fBfGr8RCEgz62WrZpUdp3TqoryrnicQ=; b=hclMOxFgJlnlnc0etNRjv6l9Ox
	KXAIbLB3eG+maiYJgZnHQu+qeg8x68gyQ8uIWZaWHu3TwDDmJ9nRQSynRfNuDwSW1Off5/bUwsfpN
	wwzshqfYwHQZa0rU0+KZGRgu3nOoIpsxKefJa75cz5XRm7bwSNXq3TaXI7hqI0infJ6A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] efi: switch to new APIs in EFI code
Message-Id: <E1lZtKB-0000t2-EK@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:46:15 +0000

commit aad7aff5ea694cf065305f92225d52e43d6759ff
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:13:54 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:13:54 2021 +0200

    efi: switch to new APIs in EFI code
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/efi/runtime.h | 13 ++++++++---
 xen/common/efi/boot.c      | 55 +++++++++++++++++++++++++++-------------------
 xen/common/efi/efi.h       |  3 ++-
 xen/common/efi/runtime.c   |  8 +++----
 4 files changed, 48 insertions(+), 31 deletions(-)

diff --git a/xen/arch/x86/efi/runtime.h b/xen/arch/x86/efi/runtime.h
index d9eb8f5c27..77866c5f21 100644
--- a/xen/arch/x86/efi/runtime.h
+++ b/xen/arch/x86/efi/runtime.h
@@ -1,12 +1,19 @@
+#include <xen/domain_page.h>
+#include <xen/mm.h>
 #include <asm/atomic.h>
 #include <asm/mc146818rtc.h>
 
 #ifndef COMPAT
-l4_pgentry_t *__read_mostly efi_l4_pgtable;
+mfn_t __read_mostly efi_l4_mfn = INVALID_MFN_INITIALIZER;
 
 void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t l4e)
 {
-    if ( efi_l4_pgtable )
-        l4e_write(efi_l4_pgtable + l4idx, l4e);
+    if ( !mfn_eq(efi_l4_mfn, INVALID_MFN) )
+    {
+        l4_pgentry_t *efi_l4t = map_domain_page(efi_l4_mfn);
+
+        l4e_write(efi_l4t + l4idx, l4e);
+        unmap_domain_page(efi_l4t);
+    }
 }
 #endif
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 539d86c6e8..758f9d74d2 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -1437,14 +1437,15 @@ custom_param("efi", parse_efi_param);
 
 static __init void copy_mapping(unsigned long mfn, unsigned long end,
                                 bool (*is_valid)(unsigned long smfn,
-                                                 unsigned long emfn))
+                                                 unsigned long emfn),
+                                l4_pgentry_t *efi_l4t)
 {
     unsigned long next;
     l3_pgentry_t *l3src = NULL, *l3dst = NULL;
 
     for ( ; mfn < end; mfn = next )
     {
-        l4_pgentry_t l4e = efi_l4_pgtable[l4_table_offset(mfn << PAGE_SHIFT)];
+        l4_pgentry_t l4e = efi_l4t[l4_table_offset(mfn << PAGE_SHIFT)];
         unsigned long va = (unsigned long)mfn_to_virt(mfn);
 
         if ( !(mfn & ((1UL << (L4_PAGETABLE_SHIFT - PAGE_SHIFT)) - 1)) )
@@ -1463,7 +1464,7 @@ static __init void copy_mapping(unsigned long mfn, unsigned long end,
 
             l3dst = alloc_mapped_pagetable(&l3mfn);
             BUG_ON(!l3dst);
-            efi_l4_pgtable[l4_table_offset(mfn << PAGE_SHIFT)] =
+            efi_l4t[l4_table_offset(mfn << PAGE_SHIFT)] =
                 l4e_from_mfn(l3mfn, __PAGE_HYPERVISOR);
         }
         else
@@ -1496,6 +1497,7 @@ static bool __init rt_range_valid(unsigned long smfn, unsigned long emfn)
 void __init efi_init_memory(void)
 {
     unsigned int i;
+    l4_pgentry_t *efi_l4t;
     struct rt_extra {
         struct rt_extra *next;
         unsigned long smfn, emfn;
@@ -1610,11 +1612,10 @@ void __init efi_init_memory(void)
      * Set up 1:1 page tables for runtime calls. See SetVirtualAddressMap() in
      * efi_exit_boot().
      */
-    efi_l4_pgtable = alloc_xen_pagetable();
-    BUG_ON(!efi_l4_pgtable);
-    clear_page(efi_l4_pgtable);
+    efi_l4t = alloc_mapped_pagetable(&efi_l4_mfn);
+    BUG_ON(!efi_l4t);
 
-    copy_mapping(0, max_page, ram_range_valid);
+    copy_mapping(0, max_page, ram_range_valid, efi_l4t);
 
     /* Insert non-RAM runtime mappings inside the direct map. */
     for ( i = 0; i < efi_memmap_size; i += efi_mdesc_size )
@@ -1630,58 +1631,64 @@ void __init efi_init_memory(void)
             copy_mapping(PFN_DOWN(desc->PhysicalStart),
                          PFN_UP(desc->PhysicalStart +
                                 (desc->NumberOfPages << EFI_PAGE_SHIFT)),
-                         rt_range_valid);
+                         rt_range_valid, efi_l4t);
     }
 
     /* Insert non-RAM runtime mappings outside of the direct map. */
     while ( (extra = extra_head) != NULL )
     {
         unsigned long addr = extra->smfn << PAGE_SHIFT;
-        l4_pgentry_t l4e = efi_l4_pgtable[l4_table_offset(addr)];
+        l4_pgentry_t l4e = efi_l4t[l4_table_offset(addr)];
         l3_pgentry_t *pl3e;
         l2_pgentry_t *pl2e;
         l1_pgentry_t *l1t;
 
         if ( !(l4e_get_flags(l4e) & _PAGE_PRESENT) )
         {
-            pl3e = alloc_xen_pagetable();
+            mfn_t l3mfn;
+
+            pl3e = alloc_mapped_pagetable(&l3mfn);
             BUG_ON(!pl3e);
-            clear_page(pl3e);
-            efi_l4_pgtable[l4_table_offset(addr)] =
-                l4e_from_paddr(virt_to_maddr(pl3e), __PAGE_HYPERVISOR);
+            efi_l4t[l4_table_offset(addr)] =
+                l4e_from_mfn(l3mfn, __PAGE_HYPERVISOR);
         }
         else
-            pl3e = l4e_to_l3e(l4e);
+            pl3e = map_l3t_from_l4e(l4e);
         pl3e += l3_table_offset(addr);
         if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) )
         {
-            pl2e = alloc_xen_pagetable();
+            mfn_t l2mfn;
+
+            pl2e = alloc_mapped_pagetable(&l2mfn);
             BUG_ON(!pl2e);
-            clear_page(pl2e);
-            *pl3e = l3e_from_paddr(virt_to_maddr(pl2e), __PAGE_HYPERVISOR);
+            *pl3e = l3e_from_mfn(l2mfn, __PAGE_HYPERVISOR);
         }
         else
         {
             BUG_ON(l3e_get_flags(*pl3e) & _PAGE_PSE);
-            pl2e = l3e_to_l2e(*pl3e);
+            pl2e = map_l2t_from_l3e(*pl3e);
         }
+        UNMAP_DOMAIN_PAGE(pl3e);
         pl2e += l2_table_offset(addr);
         if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )
         {
-            l1t = alloc_xen_pagetable();
+            mfn_t l1mfn;
+
+            l1t = alloc_mapped_pagetable(&l1mfn);
             BUG_ON(!l1t);
-            clear_page(l1t);
-            *pl2e = l2e_from_paddr(virt_to_maddr(l1t), __PAGE_HYPERVISOR);
+            *pl2e = l2e_from_mfn(l1mfn, __PAGE_HYPERVISOR);
         }
         else
         {
             BUG_ON(l2e_get_flags(*pl2e) & _PAGE_PSE);
-            l1t = l2e_to_l1e(*pl2e);
+            l1t = map_l1t_from_l2e(*pl2e);
         }
+        UNMAP_DOMAIN_PAGE(pl2e);
         for ( i = l1_table_offset(addr);
               i < L1_PAGETABLE_ENTRIES && extra->smfn < extra->emfn;
               ++i, ++extra->smfn )
             l1t[i] = l1e_from_pfn(extra->smfn, extra->prot);
+        UNMAP_DOMAIN_PAGE(l1t);
 
         if ( extra->smfn == extra->emfn )
         {
@@ -1693,6 +1700,8 @@ void __init efi_init_memory(void)
     /* Insert Xen mappings. */
     for ( i = l4_table_offset(HYPERVISOR_VIRT_START);
           i < l4_table_offset(DIRECTMAP_VIRT_END); ++i )
-        efi_l4_pgtable[i] = idle_pg_table[i];
+        efi_l4t[i] = idle_pg_table[i];
+
+    unmap_domain_page(efi_l4t);
 }
 #endif
diff --git a/xen/common/efi/efi.h b/xen/common/efi/efi.h
index 663a8b5000..c9aa65d506 100644
--- a/xen/common/efi/efi.h
+++ b/xen/common/efi/efi.h
@@ -6,6 +6,7 @@
 #include <efi/eficapsule.h>
 #include <efi/efiapi.h>
 #include <xen/efi.h>
+#include <xen/mm.h>
 #include <xen/spinlock.h>
 #include <asm/page.h>
 
@@ -29,7 +30,7 @@ extern UINTN efi_memmap_size, efi_mdesc_size;
 extern void *efi_memmap;
 
 #ifdef CONFIG_X86
-extern l4_pgentry_t *efi_l4_pgtable;
+extern mfn_t efi_l4_mfn;
 #endif
 
 extern const struct efi_pci_rom *efi_pci_roms;
diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index 95367694b5..375b94229e 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -85,7 +85,7 @@ struct efi_rs_state efi_rs_enter(void)
     static const u32 mxcsr = MXCSR_DEFAULT;
     struct efi_rs_state state = { .cr3 = 0 };
 
-    if ( !efi_l4_pgtable )
+    if ( mfn_eq(efi_l4_mfn, INVALID_MFN) )
         return state;
 
     state.cr3 = read_cr3();
@@ -111,7 +111,7 @@ struct efi_rs_state efi_rs_enter(void)
         lgdt(&gdt_desc);
     }
 
-    switch_cr3_cr4(virt_to_maddr(efi_l4_pgtable), read_cr4());
+    switch_cr3_cr4(mfn_to_maddr(efi_l4_mfn), read_cr4());
 
     return state;
 }
@@ -140,9 +140,9 @@ void efi_rs_leave(struct efi_rs_state *state)
 
 bool efi_rs_using_pgtables(void)
 {
-    return efi_l4_pgtable &&
+    return !mfn_eq(efi_l4_mfn, INVALID_MFN) &&
            (smp_processor_id() == efi_rs_on_cpu) &&
-           (read_cr3() == virt_to_maddr(efi_l4_pgtable));
+           (read_cr3() == mfn_to_maddr(efi_l4_mfn));
 }
 
 unsigned long efi_get_time(void)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:46:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:46:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116103.221573 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtKN-0002Cm-JE; Fri, 23 Apr 2021 10:46:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116103.221573; Fri, 23 Apr 2021 10: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 1lZtKN-0002Ce-GI; Fri, 23 Apr 2021 10:46:27 +0000
Received: by outflank-mailman (input) for mailman id 116103;
 Fri, 23 Apr 2021 10:46: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 1lZtKL-0002CS-In
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:46: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 1lZtKL-0002je-I3
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:46:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtKL-0000to-HV
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:46: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=/eZItu66J3gzsbN1lq0aIU9Oi00z+/4FA2qZI29pPqQ=; b=mNen+ddvCLwol4ZMr7jhN+W5vC
	b8pO/mZu5v8ouG9yTZcOJd4daa4T+Go9xxiNZ6ld9O0jOKBuRWcanbd6sK1x08I1TG2n47LcvZAi6
	iMCQ+A/bcQZFp24vuHHb1uZ43plNTlNk2fVETzqilV+iwBVOzeARSmml77MBehZs+fbs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/smpboot: add exit path for clone_mapping()
Message-Id: <E1lZtKL-0000to-HV@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:46:25 +0000

commit 62cd9f9895961ded34c14ca67a05c67706d07142
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:14:03 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:14:03 2021 +0200

    x86/smpboot: add exit path for clone_mapping()
    
    We will soon need to clean up page table mappings in the exit path.
    
    No functional change.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/smpboot.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 82c1012e89..e90c4dfa8a 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -696,6 +696,7 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
     l3_pgentry_t *pl3e;
     l2_pgentry_t *pl2e;
     l1_pgentry_t *pl1e;
+    int rc = 0;
 
     /*
      * Sanity check 'linear'.  We only allow cloning from the Xen virtual
@@ -736,7 +737,7 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
             pl1e = l2e_to_l1e(*pl2e) + l1_table_offset(linear);
             flags = l1e_get_flags(*pl1e);
             if ( !(flags & _PAGE_PRESENT) )
-                return 0;
+                goto out;
             pfn = l1e_get_pfn(*pl1e);
         }
     }
@@ -744,8 +745,9 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
     if ( !(root_get_flags(rpt[root_table_offset(linear)]) & _PAGE_PRESENT) )
     {
         pl3e = alloc_xen_pagetable();
+        rc = -ENOMEM;
         if ( !pl3e )
-            return -ENOMEM;
+            goto out;
         clear_page(pl3e);
         l4e_write(&rpt[root_table_offset(linear)],
                   l4e_from_paddr(__pa(pl3e), __PAGE_HYPERVISOR));
@@ -758,8 +760,9 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
     if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) )
     {
         pl2e = alloc_xen_pagetable();
+        rc = -ENOMEM;
         if ( !pl2e )
-            return -ENOMEM;
+            goto out;
         clear_page(pl2e);
         l3e_write(pl3e, l3e_from_paddr(__pa(pl2e), __PAGE_HYPERVISOR));
     }
@@ -774,8 +777,9 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
     if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )
     {
         pl1e = alloc_xen_pagetable();
+        rc = -ENOMEM;
         if ( !pl1e )
-            return -ENOMEM;
+            goto out;
         clear_page(pl1e);
         l2e_write(pl2e, l2e_from_paddr(__pa(pl1e), __PAGE_HYPERVISOR));
     }
@@ -796,7 +800,9 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
     else
         l1e_write(pl1e, l1e_from_pfn(pfn, flags));
 
-    return 0;
+    rc = 0;
+ out:
+    return rc;
 }
 
 DEFINE_PER_CPU(root_pgentry_t *, root_pgt);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:46:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:46:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116104.221577 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtKX-0002EO-L7; Fri, 23 Apr 2021 10:46:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116104.221577; Fri, 23 Apr 2021 10: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 1lZtKX-0002EG-Hs; Fri, 23 Apr 2021 10:46:37 +0000
Received: by outflank-mailman (input) for mailman id 116104;
 Fri, 23 Apr 2021 10:46: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 1lZtKV-0002E0-LZ
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:46: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 1lZtKV-0002jn-Ko
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:46:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtKV-0000uV-KH
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:46: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=L50c4rW40Wd1e3w8Do836BaVf5F7fTTnSEkPqHprtyE=; b=YZFTUyjfSqYtBNUDDwQaCfvx1j
	+47BTBlPqFkx0WFk7H+K7bToAUlSWDcki6jeHvRDJvQdWsp8nfcQMucx5D2VZK44f5fvaGyenzNQw
	WsUNpD+9TffneHIu0oOYlxrR1IZ6LOKuhwd9YN+A2KAF4lMow/JK9F3D12u7qJFu/lTs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/smpboot: switch clone_mapping() to new APIs
Message-Id: <E1lZtKV-0000uV-KH@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:46:35 +0000

commit d5f7d3dbdfdc4fa8160e92549f975c856140c923
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:14:13 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:14:13 2021 +0200

    x86/smpboot: switch clone_mapping() to new APIs
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/smpboot.c | 44 +++++++++++++++++++++++++++-----------------
 1 file changed, 27 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index e90c4dfa8a..765cf33960 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -694,8 +694,8 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
     unsigned long linear = (unsigned long)ptr, pfn;
     unsigned int flags;
     l3_pgentry_t *pl3e;
-    l2_pgentry_t *pl2e;
-    l1_pgentry_t *pl1e;
+    l2_pgentry_t *pl2e = NULL;
+    l1_pgentry_t *pl1e = NULL;
     int rc = 0;
 
     /*
@@ -710,7 +710,7 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
          (linear >= XEN_VIRT_END && linear < DIRECTMAP_VIRT_START) )
         return -EINVAL;
 
-    pl3e = l4e_to_l3e(idle_pg_table[root_table_offset(linear)]) +
+    pl3e = map_l3t_from_l4e(idle_pg_table[root_table_offset(linear)]) +
         l3_table_offset(linear);
 
     flags = l3e_get_flags(*pl3e);
@@ -723,7 +723,7 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
     }
     else
     {
-        pl2e = l3e_to_l2e(*pl3e) + l2_table_offset(linear);
+        pl2e = map_l2t_from_l3e(*pl3e) + l2_table_offset(linear);
         flags = l2e_get_flags(*pl2e);
         ASSERT(flags & _PAGE_PRESENT);
         if ( flags & _PAGE_PSE )
@@ -734,7 +734,7 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
         }
         else
         {
-            pl1e = l2e_to_l1e(*pl2e) + l1_table_offset(linear);
+            pl1e = map_l1t_from_l2e(*pl2e) + l1_table_offset(linear);
             flags = l1e_get_flags(*pl1e);
             if ( !(flags & _PAGE_PRESENT) )
                 goto out;
@@ -742,51 +742,58 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
         }
     }
 
+    UNMAP_DOMAIN_PAGE(pl1e);
+    UNMAP_DOMAIN_PAGE(pl2e);
+    unmap_domain_page(pl3e);
+
     if ( !(root_get_flags(rpt[root_table_offset(linear)]) & _PAGE_PRESENT) )
     {
-        pl3e = alloc_xen_pagetable();
+        mfn_t l3mfn;
+
+        pl3e = alloc_mapped_pagetable(&l3mfn);
         rc = -ENOMEM;
         if ( !pl3e )
             goto out;
-        clear_page(pl3e);
         l4e_write(&rpt[root_table_offset(linear)],
-                  l4e_from_paddr(__pa(pl3e), __PAGE_HYPERVISOR));
+                  l4e_from_mfn(l3mfn, __PAGE_HYPERVISOR));
     }
     else
-        pl3e = l4e_to_l3e(rpt[root_table_offset(linear)]);
+        pl3e = map_l3t_from_l4e(rpt[root_table_offset(linear)]);
 
     pl3e += l3_table_offset(linear);
 
     if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) )
     {
-        pl2e = alloc_xen_pagetable();
+        mfn_t l2mfn;
+
+        pl2e = alloc_mapped_pagetable(&l2mfn);
         rc = -ENOMEM;
         if ( !pl2e )
             goto out;
-        clear_page(pl2e);
-        l3e_write(pl3e, l3e_from_paddr(__pa(pl2e), __PAGE_HYPERVISOR));
+        l3e_write(pl3e, l3e_from_mfn(l2mfn, __PAGE_HYPERVISOR));
     }
     else
     {
         ASSERT(!(l3e_get_flags(*pl3e) & _PAGE_PSE));
-        pl2e = l3e_to_l2e(*pl3e);
+        pl2e = map_l2t_from_l3e(*pl3e);
     }
 
     pl2e += l2_table_offset(linear);
 
     if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) )
     {
-        pl1e = alloc_xen_pagetable();
+        mfn_t l1mfn;
+
+        pl1e = alloc_mapped_pagetable(&l1mfn);
         rc = -ENOMEM;
         if ( !pl1e )
             goto out;
-        clear_page(pl1e);
-        l2e_write(pl2e, l2e_from_paddr(__pa(pl1e), __PAGE_HYPERVISOR));
+        l2e_write(pl2e, l2e_from_mfn(l1mfn, __PAGE_HYPERVISOR));
     }
     else
     {
         ASSERT(!(l2e_get_flags(*pl2e) & _PAGE_PSE));
-        pl1e = l2e_to_l1e(*pl2e);
+        pl1e = map_l1t_from_l2e(*pl2e);
     }
 
     pl1e += l1_table_offset(linear);
@@ -802,6 +809,9 @@ static int clone_mapping(const void *ptr, root_pgentry_t *rpt)
 
     rc = 0;
  out:
+    unmap_domain_page(pl1e);
+    unmap_domain_page(pl2e);
+    unmap_domain_page(pl3e);
     return rc;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:46:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:46:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116105.221580 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtKh-0002GB-OL; Fri, 23 Apr 2021 10:46:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116105.221580; Fri, 23 Apr 2021 10:46: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 1lZtKh-0002G3-LL; Fri, 23 Apr 2021 10:46:47 +0000
Received: by outflank-mailman (input) for mailman id 116105;
 Fri, 23 Apr 2021 10:46: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 1lZtKf-0002Ft-PB
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:46: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 1lZtKf-0002kA-OT
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:46:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtKf-0000vR-NW
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:46: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=ffwDqyFjhCTORFbs109t//qhdcensH0GCCaji5KCFXs=; b=VRwRKWiFXQcD3UoUd3mUDOFKxk
	VYCWApPI/+kWGbBUzG0Z5FeY1GkdidtRF0zChK5c8WDQid67bSTi3gFKpJd4ouYkTjY4TAL4QBY3t
	UE3A/R/qVb8iRLpVcTMbcpEfkKoCYUHr01vbowYKtQluKtYjA+jhUQItGYjBLBAs5WjU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm: drop old page table APIs
Message-Id: <E1lZtKf-0000vR-NW@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:46:45 +0000

commit 16ea77931c815b60857de76d46c06d0ec741f99c
Author:     Hongyan Xia <hongyxia@amazon.com>
AuthorDate: Thu Apr 22 14:14:22 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:14:22 2021 +0200

    x86/mm: drop old page table APIs
    
    Two sets of old APIs, alloc/free_xen_pagetable() and lXe_to_lYe(), are
    now dropped to avoid the dependency on direct map.
    
    There are two special cases which still have not been re-written into
    the new APIs, thus need special treatment:
    
    rpt in smpboot.c cannot use ephemeral mappings yet. The problem is that
    rpt is read and written in context switch code, but the mapping
    infrastructure is NOT context-switch-safe, meaning we cannot map rpt in
    one domain and unmap in another. Before the mapping infrastructure
    supports context switches, rpt has to be globally mapped.
    
    Also, lXe_to_lYe() during Xen image relocation cannot be converted into
    map/unmap pairs. We cannot hold on to mappings while the mapping
    infrastructure is being relocated! It is enough to remove the direct map
    in the second e820 pass, so we still use the direct map (<4GiB) in Xen
    relocation (which is during the first e820 pass).
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c          | 14 --------------
 xen/arch/x86/setup.c       |  4 ++--
 xen/arch/x86/smpboot.c     |  4 ++--
 xen/include/asm-x86/mm.h   |  2 --
 xen/include/asm-x86/page.h |  5 -----
 5 files changed, 4 insertions(+), 25 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index f6f4831f66..ca8ef57e77 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4891,20 +4891,6 @@ int mmcfg_intercept_write(
     return X86EMUL_OKAY;
 }
 
-void *alloc_xen_pagetable(void)
-{
-    mfn_t mfn = alloc_xen_pagetable_new();
-
-    return mfn_eq(mfn, INVALID_MFN) ? NULL : mfn_to_virt(mfn_x(mfn));
-}
-
-void free_xen_pagetable(void *v)
-{
-    mfn_t mfn = v ? virt_to_mfn(v) : INVALID_MFN;
-
-    free_xen_pagetable_new(mfn);
-}
-
 /*
  * For these PTE APIs, the caller must follow the alloc-map-unmap-free
  * lifecycle, which means explicitly mapping the PTE pages before accessing
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index a6658d9769..f2dff2ae6a 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1247,7 +1247,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
                     continue;
                 *pl4e = l4e_from_intpte(l4e_get_intpte(*pl4e) +
                                         xen_phys_start);
-                pl3e = l4e_to_l3e(*pl4e);
+                pl3e = __va(l4e_get_paddr(*pl4e));
                 for ( j = 0; j < L3_PAGETABLE_ENTRIES; j++, pl3e++ )
                 {
                     /* Not present, 1GB mapping, or already relocated? */
@@ -1257,7 +1257,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
                         continue;
                     *pl3e = l3e_from_intpte(l3e_get_intpte(*pl3e) +
                                             xen_phys_start);
-                    pl2e = l3e_to_l2e(*pl3e);
+                    pl2e = __va(l3e_get_paddr(*pl3e));
                     for ( k = 0; k < L2_PAGETABLE_ENTRIES; k++, pl2e++ )
                     {
                         /* Not present, PSE, or already relocated? */
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 765cf33960..ad878d8aeb 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -830,7 +830,7 @@ static int setup_cpu_root_pgt(unsigned int cpu)
     if ( !opt_xpti_hwdom && !opt_xpti_domu )
         return 0;
 
-    rpt = alloc_xen_pagetable();
+    rpt = alloc_xenheap_page();
     if ( !rpt )
         return -ENOMEM;
 
@@ -933,7 +933,7 @@ static void cleanup_cpu_root_pgt(unsigned int cpu)
         free_xen_pagetable_new(l3mfn);
     }
 
-    free_xen_pagetable(rpt);
+    free_xenheap_page(rpt);
 
     /* Also zap the stub mapping for this CPU. */
     if ( stub_linear )
diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index 111754675c..0a72fa7a26 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -573,8 +573,6 @@ int vcpu_destroy_pagetables(struct vcpu *);
 void *do_page_walk(struct vcpu *v, unsigned long addr);
 
 /* Allocator functions for Xen pagetables. */
-void *alloc_xen_pagetable(void);
-void free_xen_pagetable(void *v);
 mfn_t alloc_xen_pagetable_new(void);
 void free_xen_pagetable_new(mfn_t mfn);
 void *alloc_mapped_pagetable(mfn_t *pmfn);
diff --git a/xen/include/asm-x86/page.h b/xen/include/asm-x86/page.h
index 4c7f2cb70c..1d080cffbe 100644
--- a/xen/include/asm-x86/page.h
+++ b/xen/include/asm-x86/page.h
@@ -180,11 +180,6 @@ static inline l4_pgentry_t l4e_from_paddr(paddr_t pa, unsigned int flags)
 #define l4e_has_changed(x,y,flags) \
     ( !!(((x).l4 ^ (y).l4) & ((PADDR_MASK&PAGE_MASK)|put_pte_flags(flags))) )
 
-/* Pagetable walking. */
-#define l2e_to_l1e(x)              ((l1_pgentry_t *)__va(l2e_get_paddr(x)))
-#define l3e_to_l2e(x)              ((l2_pgentry_t *)__va(l3e_get_paddr(x)))
-#define l4e_to_l3e(x)              ((l3_pgentry_t *)__va(l4e_get_paddr(x)))
-
 #define map_l1t_from_l2e(x)        (l1_pgentry_t *)map_domain_page(l2e_get_mfn(x))
 #define map_l2t_from_l3e(x)        (l2_pgentry_t *)map_domain_page(l3e_get_mfn(x))
 #define map_l3t_from_l4e(x)        (l3_pgentry_t *)map_domain_page(l4e_get_mfn(x))
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:46:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:46:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116106.221585 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtKr-0002HP-Pg; Fri, 23 Apr 2021 10:46:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116106.221585; Fri, 23 Apr 2021 10:46: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 1lZtKr-0002HH-Mr; Fri, 23 Apr 2021 10:46:57 +0000
Received: by outflank-mailman (input) for mailman id 116106;
 Fri, 23 Apr 2021 10:46: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 1lZtKp-0002H7-Si
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:46: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 1lZtKp-0002kN-Ru
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:46:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtKp-0000wF-Qw
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:46: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=LNhgpAzi7Y5vNPXWpGBK/iC7SpCcUrC0fi74m7WQRW0=; b=iRKy1bptHn90zvLvvrB+WirJgM
	lHIeXgDbBqrpcSYrUSUifANrBJ3g4q/YEEMfN5spfIoqGrv5WJ+uTP+y3vhghAQyHwb4XGj+Yep6F
	CH962Glxs6exXSS1k5HXlwvHRLfvm4+wcDAzRUfLa05XkqTkxN+4L3HMWXPDheZZovB0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: switch to use domheap page for page tables
Message-Id: <E1lZtKp-0000wF-Qw@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:46:55 +0000

commit bf6cead724b42e5d1956df94ed4fdbda816cc2f7
Author:     Hongyan Xia <hongyxia@amazon.com>
AuthorDate: Thu Apr 22 14:14:41 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:14:41 2021 +0200

    x86: switch to use domheap page for page tables
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index ca8ef57e77..38681123ac 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4901,10 +4901,10 @@ mfn_t alloc_xen_pagetable_new(void)
 {
     if ( system_state != SYS_STATE_early_boot )
     {
-        void *ptr = alloc_xenheap_page();
+        const struct page_info *pg = alloc_domheap_page(NULL, 0);
 
-        BUG_ON(!hardware_domain && !ptr);
-        return ptr ? virt_to_mfn(ptr) : INVALID_MFN;
+        BUG_ON(!hardware_domain && !pg);
+        return pg ? page_to_mfn(pg) : INVALID_MFN;
     }
 
     return alloc_boot_pages(1, 1);
@@ -4914,7 +4914,7 @@ mfn_t alloc_xen_pagetable_new(void)
 void free_xen_pagetable_new(mfn_t mfn)
 {
     if ( system_state != SYS_STATE_early_boot && !mfn_eq(mfn, INVALID_MFN) )
-        free_xenheap_page(mfn_to_virt(mfn_x(mfn)));
+        free_domheap_page(mfn_to_page(mfn));
 }
 
 void *alloc_mapped_pagetable(mfn_t *pmfn)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:47:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:47:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116107.221589 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtL1-0002Ih-Rb; Fri, 23 Apr 2021 10:47:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116107.221589; Fri, 23 Apr 2021 10:47: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 1lZtL1-0002Ib-ON; Fri, 23 Apr 2021 10:47:07 +0000
Received: by outflank-mailman (input) for mailman id 116107;
 Fri, 23 Apr 2021 10:47: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 1lZtL0-0002IJ-0o
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:47: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 1lZtKz-0002km-WF
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:47:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtKz-0000xa-Uh
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:47: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=Qr29CkDltKQArtqP58D4AHCaIY8EqMHxvgdVreT1D80=; b=NTAemU4hLaQoHQOnD9GbVb9xPQ
	JIlHtPYJjZDDZ4triQZW7r9xmGZXTlnWh7Pm5oNTCU0ATGvFlRiMiawogVvih5qZ+qDbGa+SlH52i
	3DxNSrGvAevPBqhB2lTn1Zmzs5BJB3yZnNNNy3k6uDWURDFbITRxzhGS1g0/JWWoK7hU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm: drop _new suffix for page table APIs
Message-Id: <E1lZtKz-0000xa-Uh@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:47:05 +0000

commit 3e701a3a8314a69b6c93ce83427f5d324b003ad8
Author:     Wei Liu <wei.liu2@citrix.com>
AuthorDate: Thu Apr 22 14:14:52 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:14:52 2021 +0200

    x86/mm: drop _new suffix for page table APIs
    
    No functional change.
    
    Signed-off-by: Wei Liu <wei.liu2@citrix.com>
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c        | 44 ++++++++++++++++++++++----------------------
 xen/arch/x86/smpboot.c   |  6 +++---
 xen/arch/x86/x86_64/mm.c |  2 +-
 xen/include/asm-x86/mm.h |  4 ++--
 4 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 38681123ac..50229e38d3 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -369,7 +369,7 @@ void __init arch_init_memory(void)
             ASSERT(root_pgt_pv_xen_slots < ROOT_PAGETABLE_PV_XEN_SLOTS);
             if ( l4_table_offset(split_va) == l4_table_offset(split_va - 1) )
             {
-                mfn_t l3mfn = alloc_xen_pagetable_new();
+                mfn_t l3mfn = alloc_xen_pagetable();
 
                 if ( !mfn_eq(l3mfn, INVALID_MFN) )
                 {
@@ -4897,7 +4897,7 @@ int mmcfg_intercept_write(
  * them. The caller must check whether the allocation has succeeded, and only
  * pass valid MFNs to map_domain_page().
  */
-mfn_t alloc_xen_pagetable_new(void)
+mfn_t alloc_xen_pagetable(void)
 {
     if ( system_state != SYS_STATE_early_boot )
     {
@@ -4911,7 +4911,7 @@ mfn_t alloc_xen_pagetable_new(void)
 }
 
 /* mfn can be INVALID_MFN */
-void free_xen_pagetable_new(mfn_t mfn)
+void free_xen_pagetable(mfn_t mfn)
 {
     if ( system_state != SYS_STATE_early_boot && !mfn_eq(mfn, INVALID_MFN) )
         free_domheap_page(mfn_to_page(mfn));
@@ -4919,7 +4919,7 @@ void free_xen_pagetable_new(mfn_t mfn)
 
 void *alloc_mapped_pagetable(mfn_t *pmfn)
 {
-    mfn_t mfn = alloc_xen_pagetable_new();
+    mfn_t mfn = alloc_xen_pagetable();
     void *ret;
 
     if ( mfn_eq(mfn, INVALID_MFN) )
@@ -4965,7 +4965,7 @@ static l3_pgentry_t *virt_to_xen_l3e(unsigned long v)
         }
         if ( locking )
             spin_unlock(&map_pgdir_lock);
-        free_xen_pagetable_new(l3mfn);
+        free_xen_pagetable(l3mfn);
     }
 
     return map_l3t_from_l4e(*pl4e) + l3_table_offset(v);
@@ -5000,7 +5000,7 @@ static l2_pgentry_t *virt_to_xen_l2e(unsigned long v)
         }
         if ( locking )
             spin_unlock(&map_pgdir_lock);
-        free_xen_pagetable_new(l2mfn);
+        free_xen_pagetable(l2mfn);
     }
 
     BUG_ON(l3e_get_flags(*pl3e) & _PAGE_PSE);
@@ -5039,7 +5039,7 @@ l1_pgentry_t *virt_to_xen_l1e(unsigned long v)
         }
         if ( locking )
             spin_unlock(&map_pgdir_lock);
-        free_xen_pagetable_new(l1mfn);
+        free_xen_pagetable(l1mfn);
     }
 
     BUG_ON(l2e_get_flags(*pl2e) & _PAGE_PSE);
@@ -5226,10 +5226,10 @@ int map_pages_to_xen(
                         ol2e = l2t[i];
                         if ( (l2e_get_flags(ol2e) & _PAGE_PRESENT) &&
                              !(l2e_get_flags(ol2e) & _PAGE_PSE) )
-                            free_xen_pagetable_new(l2e_get_mfn(ol2e));
+                            free_xen_pagetable(l2e_get_mfn(ol2e));
                     }
                     unmap_domain_page(l2t);
-                    free_xen_pagetable_new(l3e_get_mfn(ol3e));
+                    free_xen_pagetable(l3e_get_mfn(ol3e));
                 }
             }
 
@@ -5268,7 +5268,7 @@ int map_pages_to_xen(
                 continue;
             }
 
-            l2mfn = alloc_xen_pagetable_new();
+            l2mfn = alloc_xen_pagetable();
             if ( mfn_eq(l2mfn, INVALID_MFN) )
                 goto out;
 
@@ -5296,7 +5296,7 @@ int map_pages_to_xen(
                 spin_unlock(&map_pgdir_lock);
             flush_area(virt, flush_flags);
 
-            free_xen_pagetable_new(l2mfn);
+            free_xen_pagetable(l2mfn);
         }
 
         pl2e = virt_to_xen_l2e(virt);
@@ -5330,7 +5330,7 @@ int map_pages_to_xen(
                         flush_flags(l1e_get_flags(l1t[i]));
                     flush_area(virt, flush_flags);
                     unmap_domain_page(l1t);
-                    free_xen_pagetable_new(l2e_get_mfn(ol2e));
+                    free_xen_pagetable(l2e_get_mfn(ol2e));
                 }
             }
 
@@ -5374,7 +5374,7 @@ int map_pages_to_xen(
                     goto check_l3;
                 }
 
-                l1mfn = alloc_xen_pagetable_new();
+                l1mfn = alloc_xen_pagetable();
                 if ( mfn_eq(l1mfn, INVALID_MFN) )
                     goto out;
 
@@ -5401,7 +5401,7 @@ int map_pages_to_xen(
                     spin_unlock(&map_pgdir_lock);
                 flush_area(virt, flush_flags);
 
-                free_xen_pagetable_new(l1mfn);
+                free_xen_pagetable(l1mfn);
             }
 
             if ( !pl1e )
@@ -5468,7 +5468,7 @@ int map_pages_to_xen(
                     flush_area(virt - PAGE_SIZE,
                                FLUSH_TLB_GLOBAL |
                                FLUSH_ORDER(PAGETABLE_ORDER));
-                    free_xen_pagetable_new(l2e_get_mfn(ol2e));
+                    free_xen_pagetable(l2e_get_mfn(ol2e));
                 }
                 else if ( locking )
                     spin_unlock(&map_pgdir_lock);
@@ -5519,7 +5519,7 @@ int map_pages_to_xen(
                 flush_area(virt - PAGE_SIZE,
                            FLUSH_TLB_GLOBAL |
                            FLUSH_ORDER(2*PAGETABLE_ORDER));
-                free_xen_pagetable_new(l3e_get_mfn(ol3e));
+                free_xen_pagetable(l3e_get_mfn(ol3e));
             }
             else if ( locking )
                 spin_unlock(&map_pgdir_lock);
@@ -5619,7 +5619,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
             }
 
             /* PAGE1GB: shatter the superpage and fall through. */
-            l2mfn = alloc_xen_pagetable_new();
+            l2mfn = alloc_xen_pagetable();
             if ( mfn_eq(l2mfn, INVALID_MFN) )
                 goto out;
 
@@ -5643,7 +5643,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
             if ( locking )
                 spin_unlock(&map_pgdir_lock);
 
-            free_xen_pagetable_new(l2mfn);
+            free_xen_pagetable(l2mfn);
         }
 
         /*
@@ -5679,7 +5679,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
             {
                 l1_pgentry_t *l1t;
                 /* PSE: shatter the superpage and try again. */
-                mfn_t l1mfn = alloc_xen_pagetable_new();
+                mfn_t l1mfn = alloc_xen_pagetable();
 
                 if ( mfn_eq(l1mfn, INVALID_MFN) )
                     goto out;
@@ -5703,7 +5703,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
                 if ( locking )
                     spin_unlock(&map_pgdir_lock);
 
-                free_xen_pagetable_new(l1mfn);
+                free_xen_pagetable(l1mfn);
             }
         }
         else
@@ -5770,7 +5770,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
                 if ( locking )
                     spin_unlock(&map_pgdir_lock);
                 flush_area(NULL, FLUSH_TLB_GLOBAL); /* flush before free */
-                free_xen_pagetable_new(l1mfn);
+                free_xen_pagetable(l1mfn);
             }
             else if ( locking )
                 spin_unlock(&map_pgdir_lock);
@@ -5815,7 +5815,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
                 if ( locking )
                     spin_unlock(&map_pgdir_lock);
                 flush_area(NULL, FLUSH_TLB_GLOBAL); /* flush before free */
-                free_xen_pagetable_new(l2mfn);
+                free_xen_pagetable(l2mfn);
             }
             else if ( locking )
                 spin_unlock(&map_pgdir_lock);
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index ad878d8aeb..0dce1ae872 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -922,15 +922,15 @@ static void cleanup_cpu_root_pgt(unsigned int cpu)
                     continue;
 
                 ASSERT(!(l2e_get_flags(l2t[i2]) & _PAGE_PSE));
-                free_xen_pagetable_new(l2e_get_mfn(l2t[i2]));
+                free_xen_pagetable(l2e_get_mfn(l2t[i2]));
             }
 
             unmap_domain_page(l2t);
-            free_xen_pagetable_new(l2mfn);
+            free_xen_pagetable(l2mfn);
         }
 
         unmap_domain_page(l3t);
-        free_xen_pagetable_new(l3mfn);
+        free_xen_pagetable(l3mfn);
     }
 
     free_xenheap_page(rpt);
diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index c625075695..c41ce847b3 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -640,7 +640,7 @@ void __init paging_init(void)
     /* Create user-accessible L2 directory to map the MPT for compat guests. */
     if ( opt_pv32 )
     {
-        mfn = alloc_xen_pagetable_new();
+        mfn = alloc_xen_pagetable();
         if ( mfn_eq(mfn, INVALID_MFN) )
             goto nomem;
         compat_idle_pg_table_l2 = map_domain_page_global(mfn);
diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index 0a72fa7a26..56d7a71a24 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -573,8 +573,8 @@ int vcpu_destroy_pagetables(struct vcpu *);
 void *do_page_walk(struct vcpu *v, unsigned long addr);
 
 /* Allocator functions for Xen pagetables. */
-mfn_t alloc_xen_pagetable_new(void);
-void free_xen_pagetable_new(mfn_t mfn);
+mfn_t alloc_xen_pagetable(void);
+void free_xen_pagetable(mfn_t mfn);
 void *alloc_mapped_pagetable(mfn_t *pmfn);
 
 l1_pgentry_t *virt_to_xen_l1e(unsigned long v);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:47:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:47:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116108.221593 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtLB-0002KE-Su; Fri, 23 Apr 2021 10:47:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116108.221593; Fri, 23 Apr 2021 10:47: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 1lZtLB-0002K6-Px; Fri, 23 Apr 2021 10:47:17 +0000
Received: by outflank-mailman (input) for mailman id 116108;
 Fri, 23 Apr 2021 10:47: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 1lZtLA-0002Jw-4a
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:47: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 1lZtLA-0002kw-3t
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:47:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtLA-0000yN-2X
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:47: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=x1Za2yVP7TJzAxbZAffpIfV0ew/rq/atDHWyocPd/oo=; b=P1F9HBqO3o8QVfC0qC6gmeAYQC
	6cTTsI6FFwi1AqOML4a3CJG+5dEM7qgnCl/XjHu1XnxE8emI7UDpt4TYXBa3JvSUu5Y2B+BAfGbqT
	+Ap3LAqNyfsgU18G0TPT6v3T+XP+lKM3RuFkyDb+dckuKIzdEg6Rc0334cApMYGsBJWk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shim: Simplify compat handling in write_start_info()
Message-Id: <E1lZtLA-0000yN-2X@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:47:16 +0000

commit ecf5db4003290f98f5b600adbbf36c185d3e7b21
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Apr 19 15:33:05 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 22 13:17:33 2021 +0100

    x86/shim: Simplify compat handling in write_start_info()
    
    Factor out a compat boolean to remove the lfence overhead from multiple
    is_pv_32bit_domain() calls.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/shim.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index d16c0048c0..4c6f442274 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -280,12 +280,12 @@ void __init pv_shim_setup_dom(struct domain *d, l4_pgentry_t *l4start,
 static void write_start_info(struct domain *d)
 {
     struct cpu_user_regs *regs = guest_cpu_user_regs();
-    start_info_t *si = map_domain_page(_mfn(is_pv_32bit_domain(d) ? regs->edx
-                                                                  : regs->rdx));
+    bool compat = is_pv_32bit_domain(d);
+    start_info_t *si = map_domain_page(_mfn(compat ? regs->edx : regs->rdx));
     uint64_t param;
 
     snprintf(si->magic, sizeof(si->magic), "xen-3.0-x86_%s",
-             is_pv_32bit_domain(d) ? "32p" : "64");
+             compat ? "32p" : "64");
     si->nr_pages = domain_tot_pages(d);
     si->shared_info = virt_to_maddr(d->shared_info);
     si->flags = 0;
@@ -300,7 +300,7 @@ static void write_start_info(struct domain *d)
                                           &si->console.domU.mfn) )
         BUG();
 
-    if ( is_pv_32bit_domain(d) )
+    if ( compat )
         xlat_start_info(si, XLAT_start_info_console_domU);
 
     unmap_domain_page(si);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:47:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:47:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116109.221597 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtLK-0002LW-Uc; Fri, 23 Apr 2021 10:47:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116109.221597; Fri, 23 Apr 2021 10:47: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 1lZtLK-0002LN-RS; Fri, 23 Apr 2021 10:47:26 +0000
Received: by outflank-mailman (input) for mailman id 116109;
 Fri, 23 Apr 2021 10:47: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 1lZtLK-0002LG-7Y
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:47: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 1lZtLK-0002l3-6q
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:47:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtLK-0000zC-67
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:47: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=81i5TDCfQncsa2G2zf/GHq+Dexmc65rw5BHJ/Qd8btI=; b=QcrpWUlWCcEKAIyOw3YRGwXBc0
	FhjcoRAMxi2slhQje9WL2c43H2zC7iKLr66qbYJRtzDiPtX5yI2kUmZOCMkOQVLMIlOKbGrZeQboc
	vnzisMOdmnZ/03nZ6M1Bo2kLVh5BqrfmeZe2td+3+Uskh1IRefkJoVOBpPNYnQdJQYjQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Drop TravisCI
Message-Id: <E1lZtLK-0000zC-67@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:47:26 +0000

commit e0dc9b095e7c73dcf6dbfe5c87c33c4708da4d1f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Apr 21 10:16:13 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 22 13:17:33 2021 +0100

    CI: Drop TravisCI
    
    Travis-ci.org is shutting down shortly.  The arm cross-compile testing has
    been broken for a long time now, and all testing has now been superseded by
    our Gitlab infrastructure.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 .travis.yml | 86 -------------------------------------------------------------
 1 file changed, 86 deletions(-)

diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index f3cd15b79f..0000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,86 +0,0 @@
-language: c
-dist: trusty
-sudo: required
-# don't test master, smoke and coverity branches
-branches:
-    except:
-        - master
-        - smoke
-        - /^coverity-tested\/.*/
-        - /^stable-.*/
-matrix:
-    include:
-        - compiler: gcc
-          env: XEN_TARGET_ARCH=x86_64 debug=n
-        - compiler: gcc
-          env: XEN_TARGET_ARCH=x86_64 XEN_CONFIG_EXPERT=y RANDCONFIG=y debug=n
-        - compiler: gcc-5
-          env: XEN_TARGET_ARCH=x86_64 debug=n
-        - compiler: gcc
-          env: XEN_TARGET_ARCH=x86_64 debug=y
-        - compiler: gcc-5
-          env: XEN_TARGET_ARCH=x86_64 debug=y
-        - compiler: clang
-          env: XEN_TARGET_ARCH=x86_64 clang=y debug=n
-        - compiler: clang
-          env: XEN_TARGET_ARCH=x86_64 clang=y debug=y
-        - compiler: gcc
-          env: XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- debug=n
-        - compiler: gcc
-          env: XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- XEN_CONFIG_EXPERT=y RANDCONFIG=y debug=n
-        - compiler: gcc
-          env: XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- debug=y
-        - compiler: gcc
-          env: XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- debug=n
-        - compiler: gcc
-          env: XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- XEN_CONFIG_EXPERT=y RANDCONFIG=y debug=n
-        - compiler: gcc
-          env: XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- debug=y
-addons:
-    apt:
-        sources:
-            - ubuntu-toolchain-r-test
-        packages:
-            - zlib1g-dev
-            - libncurses5-dev
-            - libssl-dev
-            - python-dev
-            - xorg-dev
-            - uuid-dev
-            - libyajl-dev
-            - libaio-dev
-            - libglib2.0-dev
-            - libpixman-1-dev
-            - pkg-config
-            - flex
-            - bison
-            - acpica-tools
-            - bin86
-            - bcc
-            - libnl-3-dev
-            - ocaml-nox
-            - libfindlib-ocaml-dev
-            - transfig
-            - pandoc
-            - gcc-arm-linux-gnueabihf
-            - gcc-aarch64-linux-gnu
-            - gcc-5
-            - g++-5
-            - seabios
-            - checkpolicy
-            - ghostscript
-# we must set CXX manually instead of using 'language: cpp' due to
-# travis-ci/travis-ci#3871
-before_script:
-    - export CXX=${CC/cc/++}
-    - export CXX=${CXX/clang/clang++}
-script:
-    - ./scripts/travis-build
-after_script:
-    - cat xen/.config
-    - cat tools/config.log
-    - cat docs/config.log
-notifications:
-    irc:
-        channels:
-            - secure: "mPIFllF6eW3F3talvccMy55Tfcid66IPkkXZYCxDKRF2DQrMyvmg4qt0xN6gGZsdfOBMNr+/YfO5PxusBCUkVdBGBzd3QhFoIDYZbJZgzVh3yNDQ+x4L7p1cZNrwJ2loMmSX6KxGKZxZX9NRStrTUkVyp0jGZB9xkwT8Rl6jXj7EQkgQ95K1Wqafx0ycLfyDQmzX9bzi/3KIBFKMGmK18AFMh+R30zK0FPUUsS4+VhepIkVqO5puU3OYePd34wRnWlt7hjU2Vj5vYmVXp3UOE+E8/Lf9IGVAhitDi+EC35b8zo2BHJ9z6xZARYPvfSqbXcXV20RycabI+e3ufZJ40eatssly5QjWH+HhKS42C4gV1psmQhkTCNCM62Ty5uf6R1hsZJQuiOZrc8ojdje8ey2MxJk4R+Xz+Igg1/kD6+WX9/Y6Y3iRuj5HL1xCYfpTbK4mC7ofw0SofW2aAGI68jHpCqJdQCDzMl6748PlDMM0eKe0MPKIEenYHcoBnOEC/jciXUDa6wduV75EEip7oq2i+m44MopcsEDTpdliH077GhKapF0ActjvBTLpyoTRSfkKm0NZol/dgwd3PGG/mY8clIoeXWRb4opk93ejPC967KmSNC68SlfwaJmFZS5T9vAgb6k7r6i9G3dmYtrLKzws8IV1CPWqLzk58+v4pRk="
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:47:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:47:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116110.221601 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtLV-0002Nn-1Z; Fri, 23 Apr 2021 10:47:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116110.221601; Fri, 23 Apr 2021 10:47: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 1lZtLU-0002Nh-UR; Fri, 23 Apr 2021 10:47:36 +0000
Received: by outflank-mailman (input) for mailman id 116110;
 Fri, 23 Apr 2021 10:47: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 1lZtLU-0002Mo-BN
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:47: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 1lZtLU-0002lF-Ae
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:47:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtLU-00010A-9C
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:47: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=mPd2pw9N6TMc/TNPoHTbMzmXmoWsGMNu4UwVcaZOWtY=; b=BXrHi1SMkf6Rs3DpgHDxJB4AmB
	TTNZLlD16TnR7YzSe0mEHUYPdleDD7HLOlHWbe2OrdNO5nSMiCXxndGvdUbzdoFEFww62io+qp+3C
	Pvx2NZHJJQHumTZtOOQrca8qJGWZhQBg1QB09ZJcejHu627d9QWP5V2ltO1urxDOoRrU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libs/light: Remove unnecessary libxl_list_vm() call
Message-Id: <E1lZtLU-00010A-9C@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:47:36 +0000

commit fe6cbbf163ec852d823379ab481c62044f92ea75
Author:     Costin Lupu <costin.lupu@cs.pub.ro>
AuthorDate: Mon Apr 19 16:01:42 2021 +0300
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 22 13:17:33 2021 +0100

    tools/libs/light: Remove unnecessary libxl_list_vm() call
    
    The removed lines were initially added by commit 314e64084d31, but the
    subsequent code which was using the nb_vm variable was later removed by
    commit 2ba368d13893, which makes these lines of code an overlooked
    reminiscence. Moreover, the call becomes very expensive when there is a
    considerable number of VMs (~1000 instances) running on the host.
    
    Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/libs/light/libxl_create.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index 0c64268f66..43e9ba9c63 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -578,7 +578,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
                        uint32_t *domid, bool soft_reset)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
-    int ret, rc, nb_vm;
+    int ret, rc;
     const char *dom_type;
     char *uuid_string;
     char *dom_path, *vm_path, *libxl_path;
@@ -586,7 +586,6 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
     struct xs_permissions rwperm[1];
     struct xs_permissions noperm[1];
     xs_transaction_t t = 0;
-    libxl_vminfo *vm_list;
 
     /* convenience aliases */
     libxl_domain_create_info *info = &d_config->c_info;
@@ -869,14 +868,6 @@ retry_transaction:
                         ARRAY_SIZE(rwperm));
     }
 
-    vm_list = libxl_list_vm(ctx, &nb_vm);
-    if (!vm_list) {
-        LOGD(ERROR, *domid, "cannot get number of running guests");
-        rc = ERROR_FAIL;
-        goto out;
-    }
-    libxl_vminfo_list_free(vm_list, nb_vm);
-
     xs_write(ctx->xsh, t, GCSPRINTF("%s/uuid", vm_path), uuid_string, strlen(uuid_string));
     xs_write(ctx->xsh, t, GCSPRINTF("%s/name", vm_path), info->name, strlen(info->name));
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:47:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:47:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116112.221605 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtLf-0002QL-2y; Fri, 23 Apr 2021 10:47:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116112.221605; Fri, 23 Apr 2021 10:47: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 1lZtLe-0002QD-W4; Fri, 23 Apr 2021 10:47:46 +0000
Received: by outflank-mailman (input) for mailman id 116112;
 Fri, 23 Apr 2021 10:47: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 1lZtLe-0002Q7-F2
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:47: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 1lZtLe-0002lg-EH
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:47:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtLe-00010k-DD
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:47: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=sV9YyG/KWpTytUTKMk/3qbPXinuLzU5/ufq7F0Lu1dA=; b=HQDd6LcXur4zg3UG3tdNxN23c1
	GIhY6qOTN22QOPEZa9K3NWua2m8bxLy2THLfvQBcmnTnuqyZDIPnooFOIozK6AzLYDK4GquP+CCaT
	4QLfD8ayGmsImNjdUcLwAJB8PtTJASLkjA71chmll97cfg2778ULZDFV2w76Mv9Yidjo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents
Message-Id: <E1lZtLe-00010k-DD@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:47:46 +0000

commit 540d911c2813c3d8f4cdbb3f5672119e5e768a3d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:39:24 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:39:24 2021 +0200

    x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents
    
    Zapping leaf data for out of range leaves is just one half of it: To
    avoid guests (bogusly or worse) inferring information from mere leaf
    presence, also shrink maximum indicators such that the respective
    trailing entry is not all blank (unless of course it's the initial
    subleaf of a leaf that's not the final one).
    
    This is also in preparation of bumping the maximum basic leaf we
    support, to ensure guests not getting exposed related features won't
    observe a change in behavior.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/tests/cpu-policy/test-cpu-policy.c | 101 +++++++++++++++++++++++++++++++
 xen/arch/x86/cpuid.c                     |  12 ++++
 xen/arch/x86/traps.c                     |   6 +-
 xen/include/public/arch-x86/cpuid.h      |   6 +-
 xen/include/xen/lib/x86/cpuid.h          |   7 +++
 xen/lib/x86/cpuid.c                      |  39 ++++++++++++
 6 files changed, 168 insertions(+), 3 deletions(-)

diff --git a/tools/tests/cpu-policy/test-cpu-policy.c b/tools/tests/cpu-policy/test-cpu-policy.c
index 0fa209f1ea..cb578ca6e5 100644
--- a/tools/tests/cpu-policy/test-cpu-policy.c
+++ b/tools/tests/cpu-policy/test-cpu-policy.c
@@ -8,10 +8,13 @@
 #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, ...)                          \
 ({                                              \
@@ -553,6 +556,103 @@ 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 {
@@ -668,6 +768,7 @@ 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 050cd5713e..03a483b93a 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -341,6 +341,8 @@ 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)
@@ -410,6 +412,8 @@ 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)
@@ -430,6 +434,8 @@ 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)
@@ -495,6 +501,8 @@ 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)
@@ -519,6 +527,8 @@ 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)
@@ -699,6 +709,8 @@ 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)
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 3c2e563cce..e60af16ddd 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -964,13 +964,15 @@ void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_t leaf,
     uint32_t base = is_viridian_domain(d) ? 0x40000100 : 0x40000000;
     uint32_t idx  = leaf - base;
     unsigned int limit = is_viridian_domain(d) ? p->hv2_limit : p->hv_limit;
+    unsigned int dflt = is_pv_domain(d) ? XEN_CPUID_MAX_PV_NUM_LEAVES
+                                        : XEN_CPUID_MAX_HVM_NUM_LEAVES;
 
     if ( limit == 0 )
         /* Default number of leaves */
-        limit = XEN_CPUID_MAX_NUM_LEAVES;
+        limit = dflt;
     else
         /* Clamp toolstack value between 2 and MAX_NUM_LEAVES. */
-        limit = min(max(limit, 2u), XEN_CPUID_MAX_NUM_LEAVES + 0u);
+        limit = min(max(limit, 2u), dflt);
 
     if ( idx > limit )
         return;
diff --git a/xen/include/public/arch-x86/cpuid.h b/xen/include/public/arch-x86/cpuid.h
index ce46305bee..00926b1fef 100644
--- a/xen/include/public/arch-x86/cpuid.h
+++ b/xen/include/public/arch-x86/cpuid.h
@@ -113,6 +113,10 @@
 /* Max. address width in bits taking memory hotplug into account. */
 #define XEN_CPUID_MACHINE_ADDRESS_WIDTH_MASK (0xffu << 0)
 
-#define XEN_CPUID_MAX_NUM_LEAVES 5
+#define XEN_CPUID_MAX_PV_NUM_LEAVES 5
+#define XEN_CPUID_MAX_HVM_NUM_LEAVES 4
+#define XEN_CPUID_MAX_NUM_LEAVES \
+    (XEN_CPUID_MAX_PV_NUM_LEAVES > XEN_CPUID_MAX_HVM_NUM_LEAVES ? \
+     XEN_CPUID_MAX_PV_NUM_LEAVES : XEN_CPUID_MAX_HVM_NUM_LEAVES)
 
 #endif /* __XEN_PUBLIC_ARCH_X86_CPUID_H__ */
diff --git a/xen/include/xen/lib/x86/cpuid.h b/xen/include/xen/lib/x86/cpuid.h
index f4ef8a9f2f..ef695d2ff7 100644
--- a/xen/include/xen/lib/x86/cpuid.h
+++ b/xen/include/xen/lib/x86/cpuid.h
@@ -351,6 +351,13 @@ 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 8eb88314f5..1409c254c8 100644
--- a/xen/lib/x86/cpuid.c
+++ b/xen/lib/x86/cpuid.c
@@ -236,6 +236,45 @@ 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#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:47:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:47:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116113.221609 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtLp-0002RL-4A; Fri, 23 Apr 2021 10:47:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116113.221609; Fri, 23 Apr 2021 10:47: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 1lZtLp-0002RD-1J; Fri, 23 Apr 2021 10:47:57 +0000
Received: by outflank-mailman (input) for mailman id 116113;
 Fri, 23 Apr 2021 10:47: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 1lZtLo-0002R6-Hl
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:47: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 1lZtLo-0002lo-H5
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:47:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtLo-00011N-GZ
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:47: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=IMe51sGCe3wgNjHMgZcMMLy0saPPQNroQe/w2KXL3hg=; b=zEYrZIM81REYU5cpxbwHtEhghV
	H1iW1rVHFF8DJ96xTZyWYNy927RZZ3NhtT6ihMj43j+4ncfJpyA0B/uXr7YZd7wCyXkzhHEjITn6j
	nZDebfWqH6ff1ls0FLlBvq3nHgRH03iCZizPkAFHKyQclRwssAZviaccA2lkN5UOPk4M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move memset()
Message-Id: <E1lZtLo-00011N-GZ@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:47:56 +0000

commit 8bd9c8d50315d5f3eb146c889ce629e5fcb18efa
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:42:31 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:42:31 2021 +0200

    lib: move memset()
    
    By moving the function into an archive, x86 doesn't need to announce
    anymore that is has its own implementation - symbol resolution by the
    linker will now guarantee that the generic function remains unused, and
    the forwarding to the compiler built-in gets done by the common header
    anyway.
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c          | 20 --------------------
 xen/include/asm-x86/string.h |  3 ---
 xen/lib/Makefile             |  1 +
 xen/lib/memset.c             | 33 +++++++++++++++++++++++++++++++++
 4 files changed, 34 insertions(+), 23 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index af3d96ad0f..3c83736d6b 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -311,26 +311,6 @@ char *(strstr)(const char *s1, const char *s2)
 }
 #endif
 
-#ifndef __HAVE_ARCH_MEMSET
-/**
- * memset - Fill a region of memory with the given value
- * @s: Pointer to the start of the area.
- * @c: The byte to fill the area with
- * @count: The size of the area.
- *
- * Do not use memset() to access IO space, use memset_io() instead.
- */
-void *(memset)(void *s, int c, size_t count)
-{
-	char *xs = (char *) s;
-
-	while (count--)
-		*xs++ = c;
-
-	return s;
-}
-#endif
-
 #ifndef __HAVE_ARCH_MEMCPY
 /**
  * memcpy - Copy one area of memory to another
diff --git a/xen/include/asm-x86/string.h b/xen/include/asm-x86/string.h
index 4f1e1d4daf..3102d91f13 100644
--- a/xen/include/asm-x86/string.h
+++ b/xen/include/asm-x86/string.h
@@ -7,9 +7,6 @@
 #define __HAVE_ARCH_MEMMOVE
 #define memmove(d, s, n) __builtin_memmove(d, s, n)
 
-#define __HAVE_ARCH_MEMSET
-#define memset(s, c, n) __builtin_memset(s, c, n)
-
 #endif /* __X86_STRING_H__ */
 /*
  * Local variables:
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index a5dc1442a4..98e5747ca7 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -4,6 +4,7 @@ lib-y += bsearch.o
 lib-y += ctors.o
 lib-y += ctype.o
 lib-y += list-sort.o
+lib-y += memset.o
 lib-y += muldiv64.o
 lib-y += parse-size.o
 lib-y += rbtree.o
diff --git a/xen/lib/memset.c b/xen/lib/memset.c
new file mode 100644
index 0000000000..e86afafd02
--- /dev/null
+++ b/xen/lib/memset.c
@@ -0,0 +1,33 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * memset - Fill a region of memory with the given value
+ * @s: Pointer to the start of the area.
+ * @c: The byte to fill the area with
+ * @count: The size of the area.
+ *
+ * Do not use memset() to access IO space, use memset_io() instead.
+ */
+void *(memset)(void *s, int c, size_t count)
+{
+	char *xs = (char *) s;
+
+	while (count--)
+		*xs++ = c;
+
+	return s;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:48:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:48:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116114.221613 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtLz-0002Sb-5w; Fri, 23 Apr 2021 10:48:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116114.221613; Fri, 23 Apr 2021 10:48: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 1lZtLz-0002SS-2m; Fri, 23 Apr 2021 10:48:07 +0000
Received: by outflank-mailman (input) for mailman id 116114;
 Fri, 23 Apr 2021 10:48: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 1lZtLy-0002SM-Ku
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:48: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 1lZtLy-0002mA-KE
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:48:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtLy-00012V-JQ
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:48: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=EPB9/+vhRIKsv19oLVMbY1tTeYBiWmK3IpgJ4rPLxe4=; b=gpnOuRyYzka3vXHg5PuOEfoD2b
	DBtSMkubZEsobDGddLmNB571rzQd9nUdvyH3x5exE8Iv9s7o41UInkXJrh7HkUgB5LRIer852HVck
	ZhzsMR0pfoyKJk7qd032jL5uyWckzFkbwqUlVbtV5lfJjD3mBHTB4sqsJC0roXG6hklU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move memcpy()
Message-Id: <E1lZtLy-00012V-JQ@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:48:06 +0000

commit 54febb419b1749535bf2f462e9a3eb3086e35d0a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:44:35 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:44:35 2021 +0200

    lib: move memcpy()
    
    By moving the function into an archive, x86 doesn't need to announce
    anymore that is has its own implementation - symbol resolution by the
    linker will now guarantee that the generic function remains unused, and
    the forwarding to the compiler built-in gets done by the common header
    anyway.
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c          | 21 ---------------------
 xen/include/asm-x86/string.h |  3 ---
 xen/lib/Makefile             |  1 +
 xen/lib/memcpy.c             | 34 ++++++++++++++++++++++++++++++++++
 4 files changed, 35 insertions(+), 24 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 3c83736d6b..3989cd8f3d 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -311,27 +311,6 @@ char *(strstr)(const char *s1, const char *s2)
 }
 #endif
 
-#ifndef __HAVE_ARCH_MEMCPY
-/**
- * memcpy - Copy one area of memory to another
- * @dest: Where to copy to
- * @src: Where to copy from
- * @count: The size of the area.
- *
- * You should not use this function to access IO space, use memcpy_toio()
- * or memcpy_fromio() instead.
- */
-void *(memcpy)(void *dest, const void *src, size_t count)
-{
-	char *tmp = (char *) dest, *s = (char *) src;
-
-	while (count--)
-		*tmp++ = *s++;
-
-	return dest;
-}
-#endif
-
 #ifndef __HAVE_ARCH_MEMMOVE
 /**
  * memmove - Copy one area of memory to another
diff --git a/xen/include/asm-x86/string.h b/xen/include/asm-x86/string.h
index 3102d91f13..b45e48ce33 100644
--- a/xen/include/asm-x86/string.h
+++ b/xen/include/asm-x86/string.h
@@ -1,9 +1,6 @@
 #ifndef __X86_STRING_H__
 #define __X86_STRING_H__
 
-#define __HAVE_ARCH_MEMCPY
-#define memcpy(d, s, n) __builtin_memcpy(d, s, n)
-
 #define __HAVE_ARCH_MEMMOVE
 #define memmove(d, s, n) __builtin_memmove(d, s, n)
 
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 98e5747ca7..7116de61b2 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -4,6 +4,7 @@ lib-y += bsearch.o
 lib-y += ctors.o
 lib-y += ctype.o
 lib-y += list-sort.o
+lib-y += memcpy.o
 lib-y += memset.o
 lib-y += muldiv64.o
 lib-y += parse-size.o
diff --git a/xen/lib/memcpy.c b/xen/lib/memcpy.c
new file mode 100644
index 0000000000..afb322797d
--- /dev/null
+++ b/xen/lib/memcpy.c
@@ -0,0 +1,34 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * memcpy - Copy one area of memory to another
+ * @dest: Where to copy to
+ * @src: Where to copy from
+ * @count: The size of the area.
+ *
+ * You should not use this function to access IO space, use memcpy_toio()
+ * or memcpy_fromio() instead.
+ */
+void *(memcpy)(void *dest, const void *src, size_t count)
+{
+	char *tmp = (char *) dest, *s = (char *) src;
+
+	while (count--)
+		*tmp++ = *s++;
+
+	return dest;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:48:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:48:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116115.221616 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtM9-0002U5-7K; Fri, 23 Apr 2021 10:48:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116115.221616; Fri, 23 Apr 2021 10:48: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 1lZtM9-0002Tx-4R; Fri, 23 Apr 2021 10:48:17 +0000
Received: by outflank-mailman (input) for mailman id 116115;
 Fri, 23 Apr 2021 10:48: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 1lZtM8-0002Tr-Om
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:48: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 1lZtM8-0002mH-O1
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:48:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtM8-00014P-MX
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:48: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=xGpv/nYwrdvOzAjTSRuefu276ZU9MBfo59VpLI38n4I=; b=gGo9URcK6OUc6o2Pop7dhouAjA
	dBkmNCqTpo/f6nkiPq5d6udiN3ihC9k8SELiSlGrJ7dgqrUJxPeDV9rR8lVUNhBrM0jry50VsAzhf
	07qcE1tt41fTLwjScGwonQIC70ZoIH1u8JGJvjexZu/77IDflbGMM9yjLrCSrhROAKfc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move memmove()
Message-Id: <E1lZtM8-00014P-MX@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:48:16 +0000

commit b85fabd2e5003861293f131256252bca1afbaa91
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:44:53 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:44:53 2021 +0200

    lib: move memmove()
    
    By moving the function into an archive, x86 doesn't need to announce
    anymore that is has its own implementation - symbol resolution by the
    linker will now guarantee that the generic function remains unused, and
    the forwarding to the compiler built-in gets done by the common header
    anyway.
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c          | 30 ------------------------------
 xen/include/asm-x86/string.h |  3 ---
 xen/lib/Makefile             |  1 +
 xen/lib/memmove.c            | 42 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 43 insertions(+), 33 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 3989cd8f3d..4171d67f04 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -311,36 +311,6 @@ char *(strstr)(const char *s1, const char *s2)
 }
 #endif
 
-#ifndef __HAVE_ARCH_MEMMOVE
-/**
- * memmove - Copy one area of memory to another
- * @dest: Where to copy to
- * @src: Where to copy from
- * @count: The size of the area.
- *
- * Unlike memcpy(), memmove() copes with overlapping areas.
- */
-void *(memmove)(void *dest, const void *src, size_t count)
-{
-	char *tmp, *s;
-
-	if (dest <= src) {
-		tmp = (char *) dest;
-		s = (char *) src;
-		while (count--)
-			*tmp++ = *s++;
-		}
-	else {
-		tmp = (char *) dest + count;
-		s = (char *) src + count;
-		while (count--)
-			*--tmp = *--s;
-		}
-
-	return dest;
-}
-#endif
-
 #ifndef __HAVE_ARCH_MEMCMP
 /**
  * memcmp - Compare two areas of memory
diff --git a/xen/include/asm-x86/string.h b/xen/include/asm-x86/string.h
index b45e48ce33..f08d95096e 100644
--- a/xen/include/asm-x86/string.h
+++ b/xen/include/asm-x86/string.h
@@ -1,9 +1,6 @@
 #ifndef __X86_STRING_H__
 #define __X86_STRING_H__
 
-#define __HAVE_ARCH_MEMMOVE
-#define memmove(d, s, n) __builtin_memmove(d, s, n)
-
 #endif /* __X86_STRING_H__ */
 /*
  * Local variables:
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 7116de61b2..abb78b956f 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -5,6 +5,7 @@ lib-y += ctors.o
 lib-y += ctype.o
 lib-y += list-sort.o
 lib-y += memcpy.o
+lib-y += memmove.o
 lib-y += memset.o
 lib-y += muldiv64.o
 lib-y += parse-size.o
diff --git a/xen/lib/memmove.c b/xen/lib/memmove.c
new file mode 100644
index 0000000000..1ab79dfb28
--- /dev/null
+++ b/xen/lib/memmove.c
@@ -0,0 +1,42 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * memmove - Copy one area of memory to another
+ * @dest: Where to copy to
+ * @src: Where to copy from
+ * @count: The size of the area.
+ *
+ * Unlike memcpy(), memmove() copes with overlapping areas.
+ */
+void *(memmove)(void *dest, const void *src, size_t count)
+{
+	char *tmp, *s;
+
+	if (dest <= src) {
+		tmp = (char *) dest;
+		s = (char *) src;
+		while (count--)
+			*tmp++ = *s++;
+	} else {
+		tmp = (char *) dest + count;
+		s = (char *) src + count;
+		while (count--)
+			*--tmp = *--s;
+	}
+
+	return dest;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:48:28 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:48:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116116.221621 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtMK-0002Vg-A5; Fri, 23 Apr 2021 10:48:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116116.221621; Fri, 23 Apr 2021 10:48: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 1lZtMK-0002VY-7D; Fri, 23 Apr 2021 10:48:28 +0000
Received: by outflank-mailman (input) for mailman id 116116;
 Fri, 23 Apr 2021 10:48: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 1lZtMI-0002VQ-RZ
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:48: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 1lZtMI-0002mS-Qu
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:48:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtMI-00016A-QM
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:48: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=NlAmxZ1LuJ6LJHI0McTjWOgJfmUtqI7BPZgnPfmcITU=; b=g9U1oKn7nhPH9OAmdPf0Phqtoc
	5bPjMDEZiNUTFdgl5DUd75HGiE+N4aDoKkaYsHOTHE0RlsVHX+fhF/hRKlMnfoEDl52savFQpyH7A
	lQb2EW+s0iJW0nGzVrcCEYknE5iMI5w4HXZvYZCEf6qtQ1+GboJGN3R7sW8jrR4SLSJM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move memcmp()
Message-Id: <E1lZtMI-00016A-QM@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:48:26 +0000

commit 880d89fbfe7ea4229f58d87ad5959acca41d5d12
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:45:06 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:45:06 2021 +0200

    lib: move memcmp()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 19 -------------------
 xen/lib/Makefile    |  1 +
 xen/lib/memcmp.c    | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 4171d67f04..f40b65f630 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -311,25 +311,6 @@ char *(strstr)(const char *s1, const char *s2)
 }
 #endif
 
-#ifndef __HAVE_ARCH_MEMCMP
-/**
- * memcmp - Compare two areas of memory
- * @cs: One area of memory
- * @ct: Another area of memory
- * @count: The size of the area.
- */
-int (memcmp)(const void *cs, const void *ct, size_t count)
-{
-	const unsigned char *su1, *su2;
-	int res = 0;
-
-	for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
-		if ((res = *su1 - *su2) != 0)
-			break;
-	return res;
-}
-#endif
-
 #ifndef __HAVE_ARCH_MEMCHR
 /**
  * memchr - Find a character in an area of memory.
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index abb78b956f..2667bb2d53 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -4,6 +4,7 @@ lib-y += bsearch.o
 lib-y += ctors.o
 lib-y += ctype.o
 lib-y += list-sort.o
+lib-y += memcmp.o
 lib-y += memcpy.o
 lib-y += memmove.o
 lib-y += memset.o
diff --git a/xen/lib/memcmp.c b/xen/lib/memcmp.c
new file mode 100644
index 0000000000..df0e9be8c5
--- /dev/null
+++ b/xen/lib/memcmp.c
@@ -0,0 +1,32 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * memcmp - Compare two areas of memory
+ * @cs: One area of memory
+ * @ct: Another area of memory
+ * @count: The size of the area.
+ */
+int (memcmp)(const void *cs, const void *ct, size_t count)
+{
+	const unsigned char *su1, *su2;
+	int res = 0;
+
+	for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
+		if ((res = *su1 - *su2) != 0)
+			break;
+	return res;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:48:38 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:48:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116117.221624 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtMU-0002Ws-Bg; Fri, 23 Apr 2021 10:48:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116117.221624; Fri, 23 Apr 2021 10:48: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 1lZtMU-0002Wm-8g; Fri, 23 Apr 2021 10:48:38 +0000
Received: by outflank-mailman (input) for mailman id 116117;
 Fri, 23 Apr 2021 10:48: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 1lZtMS-0002Wb-UV
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:48: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 1lZtMS-0002ma-Tp
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:48:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtMS-00017E-TG
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:48: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=CqiZxCDRNaboULKzJ9opw0cfM/S+p8o6dOYSyvph3y8=; b=6Oj3N3yuFNdAPdH8WQ+DJ8YwOP
	Rb2Sv2XR+5tkmdR9MOYBmaLqUXud/MH3MaVKaw7NwBerL3LaGCvP8ieb1ha2z79Rmye2aDx7Ao/sm
	X4YkM+0UARVTApmvms6dwyBB1t3tcCcF2CgQyrTmoQlv+9ikgev6kHSo5XN8FTFOBEL0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move memchr()
Message-Id: <E1lZtMS-00017E-TG@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:48:36 +0000

commit ff2e37e64cab577951f1a095086dc2c59d9e7cba
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:45:21 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:45:21 2021 +0200

    lib: move memchr()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 22 ----------------------
 xen/lib/Makefile    |  1 +
 xen/lib/memchr.c    | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index f40b65f630..ba282637f1 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -311,28 +311,6 @@ char *(strstr)(const char *s1, const char *s2)
 }
 #endif
 
-#ifndef __HAVE_ARCH_MEMCHR
-/**
- * memchr - Find a character in an area of memory.
- * @s: The memory area
- * @c: The byte to search for
- * @n: The size of the area.
- *
- * returns the address of the first occurrence of @c, or %NULL
- * if @c is not found
- */
-void *(memchr)(const void *s, int c, size_t n)
-{
-	const unsigned char *p = s;
-
-	while (n--)
-		if ((unsigned char)c == *p++)
-			return (void *)(p - 1);
-
-	return NULL;
-}
-#endif
-
 /**
  * memchr_inv - Find an unmatching character in an area of memory.
  * @s: The memory area
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 2667bb2d53..acdd0a4a12 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -4,6 +4,7 @@ lib-y += bsearch.o
 lib-y += ctors.o
 lib-y += ctype.o
 lib-y += list-sort.o
+lib-y += memchr.o
 lib-y += memcmp.o
 lib-y += memcpy.o
 lib-y += memmove.o
diff --git a/xen/lib/memchr.c b/xen/lib/memchr.c
new file mode 100644
index 0000000000..75c44b962c
--- /dev/null
+++ b/xen/lib/memchr.c
@@ -0,0 +1,35 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * memchr - Find a character in an area of memory.
+ * @s: The memory area
+ * @c: The byte to search for
+ * @n: The size of the area.
+ *
+ * returns the address of the first occurrence of @c, or %NULL
+ * if @c is not found
+ */
+void *(memchr)(const void *s, int c, size_t n)
+{
+	const unsigned char *p = s;
+
+	while (n--)
+		if ((unsigned char)c == *p++)
+			return (void *)(p - 1);
+
+	return NULL;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:48:48 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:48:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116118.221629 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtMe-0002YQ-DN; Fri, 23 Apr 2021 10:48:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116118.221629; Fri, 23 Apr 2021 10:48: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 1lZtMe-0002YI-A8; Fri, 23 Apr 2021 10:48:48 +0000
Received: by outflank-mailman (input) for mailman id 116118;
 Fri, 23 Apr 2021 10:48: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 1lZtMd-0002YA-11
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:48: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 1lZtMd-0002my-0M
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:48:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtMc-00017s-W6
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:48: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=WDBJRSCTYwNfazk31Bq9MRATAVeEG77KpR5fGnXJySY=; b=qxu2vt3gqc2pJBlq1NQGATqqN5
	5vn30lvQ2bS0vqiXlke0eLZJ+sDGG8CIaolVPHeMa3CnCPoV8eEoQVBYdaI/iykPAi2r4E0wbZYR0
	IJtjtSyajw3FUKIBta+9wnbgq6mOq/H48oBmUJOsR2+EgZow7P2pkMpdFjKEckgELeIs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move memchr_inv()
Message-Id: <E1lZtMc-00017s-W6@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:48:46 +0000

commit 47cb18e069695f889577fc3651227541820f502b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:45:33 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:45:33 2021 +0200

    lib: move memchr_inv()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c  | 20 --------------------
 xen/lib/Makefile     |  1 +
 xen/lib/memchr_inv.c | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index ba282637f1..eae5e2a314 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -311,26 +311,6 @@ char *(strstr)(const char *s1, const char *s2)
 }
 #endif
 
-/**
- * memchr_inv - Find an unmatching character in an area of memory.
- * @s: The memory area
- * @c: The byte that is expected
- * @n: The size of the area.
- *
- * returns the address of the first occurrence of a character other than @c,
- * or %NULL if the whole buffer contains just @c.
- */
-void *memchr_inv(const void *s, int c, size_t n)
-{
-	const unsigned char *p = s;
-
-	while (n--)
-		if ((unsigned char)c != *p++)
-			return (void *)(p - 1);
-
-	return NULL;
-}
-
 /*
  * Local variables:
  * mode: C
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index acdd0a4a12..ce61fbe3cd 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -5,6 +5,7 @@ lib-y += ctors.o
 lib-y += ctype.o
 lib-y += list-sort.o
 lib-y += memchr.o
+lib-y += memchr_inv.o
 lib-y += memcmp.o
 lib-y += memcpy.o
 lib-y += memmove.o
diff --git a/xen/lib/memchr_inv.c b/xen/lib/memchr_inv.c
new file mode 100644
index 0000000000..1bf6cb6ee0
--- /dev/null
+++ b/xen/lib/memchr_inv.c
@@ -0,0 +1,35 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * memchr_inv - Find an unmatching character in an area of memory.
+ * @s: The memory area
+ * @c: The byte that is expected
+ * @n: The size of the area.
+ *
+ * returns the address of the first occurrence of a character other than @c,
+ * or %NULL if the whole buffer contains just @c.
+ */
+void *memchr_inv(const void *s, int c, size_t n)
+{
+	const unsigned char *p = s;
+
+	while (n--)
+		if ((unsigned char)c != *p++)
+			return (void *)(p - 1);
+
+	return NULL;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:48:58 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:48:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116119.221632 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtMo-0002Zb-Eq; Fri, 23 Apr 2021 10:48:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116119.221632; Fri, 23 Apr 2021 10:48: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 1lZtMo-0002ZV-Be; Fri, 23 Apr 2021 10:48:58 +0000
Received: by outflank-mailman (input) for mailman id 116119;
 Fri, 23 Apr 2021 10:48: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 1lZtMn-0002ZL-3x
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:48: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 1lZtMn-0002n9-3G
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:48:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtMn-00019D-2g
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:48: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=aGO5l3/kDstaTymxN0Yq681KBaHztBM/CpMvzGfpi20=; b=5suYaRw0sU6aAePwIE5irvsCcR
	H524MzukQIE8bZET/sinGFMzP26Rq9JdJXLCCPzGXWeHjdLB/+huW9e2PL+73wqU7TcFYSu4U2cke
	17IW7PyRteg4JZht07lTstPOFr6D+Z6Cj2nWkLuVJ5Vab5Z21u2hEE+aKbcchQk4qdEQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move strlen()
Message-Id: <E1lZtMn-00019D-2g@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:48:57 +0000

commit 9d0c024c2fa9f5e0224edf26febf27feaa757827
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:48:01 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:48:01 2021 +0200

    lib: move strlen()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 15 ---------------
 xen/lib/Makefile    |  1 +
 xen/lib/strlen.c    | 28 ++++++++++++++++++++++++++++
 3 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index eae5e2a314..752f65954c 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -184,21 +184,6 @@ char *(strrchr)(const char *s, int c)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRLEN
-/**
- * strlen - Find the length of a string
- * @s: The string to be sized
- */
-size_t (strlen)(const char * s)
-{
-	const char *sc;
-
-	for (sc = s; *sc != '\0'; ++sc)
-		/* nothing */;
-	return sc - s;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRNLEN
 /**
  * strnlen - Find the length of a length-limited string
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index ce61fbe3cd..25c6ec62b1 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -14,6 +14,7 @@ lib-y += muldiv64.o
 lib-y += parse-size.o
 lib-y += rbtree.o
 lib-y += sort.o
+lib-y += strlen.o
 lib-$(CONFIG_X86) += xxhash32.o
 lib-$(CONFIG_X86) += xxhash64.o
 
diff --git a/xen/lib/strlen.c b/xen/lib/strlen.c
new file mode 100644
index 0000000000..96f9bea43d
--- /dev/null
+++ b/xen/lib/strlen.c
@@ -0,0 +1,28 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strlen - Find the length of a string
+ * @s: The string to be sized
+ */
+size_t (strlen)(const char * s)
+{
+	const char *sc;
+
+	for (sc = s; *sc != '\0'; ++sc)
+		/* nothing */;
+	return sc - s;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:49:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:49:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116120.221638 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtMy-0002b3-GY; Fri, 23 Apr 2021 10:49:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116120.221638; Fri, 23 Apr 2021 10:49: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 1lZtMy-0002as-D7; Fri, 23 Apr 2021 10:49:08 +0000
Received: by outflank-mailman (input) for mailman id 116120;
 Fri, 23 Apr 2021 10:49: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 1lZtMx-0002ak-8B
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:49: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 1lZtMx-0002nU-6E
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:49:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtMx-0001A9-5g
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:49: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=IgHCJePcqX6UCuRZeR+h+cMBDlkZR7KwFb4XgbZJXc4=; b=CFY7BpqT8uc1GKN/160UFdqZCZ
	bcnmXFdDfTWBkeHniJN7/1HKsqUcJx4k5i2iBvBX4a0qSNwi1aAvSE9oH+PiWLW54HgqZ8rCZpRvu
	oGJOOk6Yi2hYBMvz2NhtMgf/YsEyM55e+lP8KKu8NidPMUAvHbS8i9ylZhFpd4p8C4V8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move strnlen()
Message-Id: <E1lZtMx-0001A9-5g@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:49:07 +0000

commit 36bba1238a398fb7f84a6c432e099db91d54c657
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:48:14 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:48:14 2021 +0200

    lib: move strnlen()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 16 ----------------
 xen/lib/Makefile    |  1 +
 xen/lib/strnlen.c   | 29 +++++++++++++++++++++++++++++
 3 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 752f65954c..6be445e26e 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -184,22 +184,6 @@ char *(strrchr)(const char *s, int c)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRNLEN
-/**
- * strnlen - Find the length of a length-limited string
- * @s: The string to be sized
- * @count: The maximum number of bytes to search
- */
-size_t strnlen(const char * s, size_t count)
-{
-	const char *sc;
-
-	for (sc = s; count-- && *sc != '\0'; ++sc)
-		/* nothing */;
-	return sc - s;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRSPN
 /**
  * strspn - Calculate the length of the initial substring of @s which only
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 25c6ec62b1..1a642c929f 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -15,6 +15,7 @@ lib-y += parse-size.o
 lib-y += rbtree.o
 lib-y += sort.o
 lib-y += strlen.o
+lib-y += strnlen.o
 lib-$(CONFIG_X86) += xxhash32.o
 lib-$(CONFIG_X86) += xxhash64.o
 
diff --git a/xen/lib/strnlen.c b/xen/lib/strnlen.c
new file mode 100644
index 0000000000..4433f6ee87
--- /dev/null
+++ b/xen/lib/strnlen.c
@@ -0,0 +1,29 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strnlen - Find the length of a length-limited string
+ * @s: The string to be sized
+ * @count: The maximum number of bytes to search
+ */
+size_t strnlen(const char * s, size_t count)
+{
+	const char *sc;
+
+	for (sc = s; count-- && *sc != '\0'; ++sc)
+		/* nothing */;
+	return sc - s;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:49:18 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:49:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116122.221644 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtN8-0002ck-Je; Fri, 23 Apr 2021 10:49:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116122.221644; Fri, 23 Apr 2021 10:49: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 1lZtN8-0002cc-Gj; Fri, 23 Apr 2021 10:49:18 +0000
Received: by outflank-mailman (input) for mailman id 116122;
 Fri, 23 Apr 2021 10:49: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 1lZtN7-0002cQ-Ai
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:49: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 1lZtN7-0002nf-9U
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:49:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtN7-0001B7-8i
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:49: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=xrKb7Qd0Iq6Weex8kSxzmDWxhBPZUyPUKp82wIlVI0Y=; b=pf8bDiZN6JRkOETgwUEBsCXM75
	L2LOsvJ/x7ASJxQIRndBOuoHn7tsKoVrfFckcMbsUUpECIoQK7GU7gbev/nfM8mXD1oFwnBSMqaBa
	S5Xxxall38J1j/oOALWMOKbsR6pqBXhsgYDe3ftDBYlBf7tj+ufX49tCEJumwVC0DQJI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move strcmp()
Message-Id: <E1lZtN7-0001B7-8i@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:49:17 +0000

commit 4d0e3e734676c48b405c80344ba97060fcc0cad8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:48:25 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:48:25 2021 +0200

    lib: move strcmp()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 19 -------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strcmp.c    | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 6be445e26e..1d8cd0ab05 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -111,25 +111,6 @@ size_t strlcat(char *dest, const char *src, size_t size)
 EXPORT_SYMBOL(strlcat);
 #endif
 
-#ifndef __HAVE_ARCH_STRCMP
-/**
- * strcmp - Compare two strings
- * @cs: One string
- * @ct: Another string
- */
-int (strcmp)(const char *cs, const char *ct)
-{
-	register signed char __res;
-
-	while (1) {
-		if ((__res = *cs - *ct++) != 0 || !*cs++)
-			break;
-	}
-
-	return __res;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRNCMP
 /**
  * strncmp - Compare two length-limited strings
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 1a642c929f..c85fed7d01 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -14,6 +14,7 @@ lib-y += muldiv64.o
 lib-y += parse-size.o
 lib-y += rbtree.o
 lib-y += sort.o
+lib-y += strcmp.o
 lib-y += strlen.o
 lib-y += strnlen.o
 lib-$(CONFIG_X86) += xxhash32.o
diff --git a/xen/lib/strcmp.c b/xen/lib/strcmp.c
new file mode 100644
index 0000000000..465f1c4191
--- /dev/null
+++ b/xen/lib/strcmp.c
@@ -0,0 +1,32 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strcmp - Compare two strings
+ * @cs: One string
+ * @ct: Another string
+ */
+int (strcmp)(const char *cs, const char *ct)
+{
+	register signed char __res;
+
+	while (1) {
+		if ((__res = *cs - *ct++) != 0 || !*cs++)
+			break;
+	}
+
+	return __res;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:49:28 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:49:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116123.221648 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtNI-0002e3-LM; Fri, 23 Apr 2021 10:49:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116123.221648; Fri, 23 Apr 2021 10:49: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 1lZtNI-0002dv-IH; Fri, 23 Apr 2021 10:49:28 +0000
Received: by outflank-mailman (input) for mailman id 116123;
 Fri, 23 Apr 2021 10:49: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 1lZtNH-0002dh-Eh
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:49: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 1lZtNH-0002nn-E1
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:49:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtNH-0001Cp-Cn
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:49: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=7p5MgjrTy+PSumv57PrlnbnuPWTA9K5szAasQIHiaCA=; b=w9lkzIEIEvfITXwbbzrJsdy0KM
	a49OnE21nBeW9UVupO/YMV9rPsUsMw1aEkaE+OTnjO422sLB83MARwDTFL+iXyJFcwwT9fklBmsOk
	nn+DbnYy3jHgPVfLxX2r+1cJ7abwKzA13fU1JwWZDnXbu8gsqSBxQGeahblZN0AQgA9E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move strncmp()
Message-Id: <E1lZtNH-0001Cp-Cn@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:49:27 +0000

commit 187e1e21d69faf43754ecfe79aa6b3119736a8ea
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:48:38 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:48:38 2021 +0200

    lib: move strncmp()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 21 ---------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strncmp.c   | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 1d8cd0ab05..f36a4a31e5 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -111,27 +111,6 @@ size_t strlcat(char *dest, const char *src, size_t size)
 EXPORT_SYMBOL(strlcat);
 #endif
 
-#ifndef __HAVE_ARCH_STRNCMP
-/**
- * strncmp - Compare two length-limited strings
- * @cs: One string
- * @ct: Another string
- * @count: The maximum number of bytes to compare
- */
-int (strncmp)(const char *cs, const char *ct, size_t count)
-{
-	register signed char __res = 0;
-
-	while (count) {
-		if ((__res = *cs - *ct++) != 0 || !*cs++)
-			break;
-		count--;
-	}
-
-	return __res;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRCHR
 /**
  * strchr - Find the first occurrence of a character in a string
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index c85fed7d01..12af30d670 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -16,6 +16,7 @@ lib-y += rbtree.o
 lib-y += sort.o
 lib-y += strcmp.o
 lib-y += strlen.o
+lib-y += strncmp.o
 lib-y += strnlen.o
 lib-$(CONFIG_X86) += xxhash32.o
 lib-$(CONFIG_X86) += xxhash64.o
diff --git a/xen/lib/strncmp.c b/xen/lib/strncmp.c
new file mode 100644
index 0000000000..9af7fa1c99
--- /dev/null
+++ b/xen/lib/strncmp.c
@@ -0,0 +1,34 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strncmp - Compare two length-limited strings
+ * @cs: One string
+ * @ct: Another string
+ * @count: The maximum number of bytes to compare
+ */
+int (strncmp)(const char *cs, const char *ct, size_t count)
+{
+	register signed char __res = 0;
+
+	while (count) {
+		if ((__res = *cs - *ct++) != 0 || !*cs++)
+			break;
+		count--;
+	}
+
+	return __res;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:49:38 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:49:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116124.221652 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtNS-0002fe-Oc; Fri, 23 Apr 2021 10:49:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116124.221652; Fri, 23 Apr 2021 10:49: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 1lZtNS-0002fW-Lk; Fri, 23 Apr 2021 10:49:38 +0000
Received: by outflank-mailman (input) for mailman id 116124;
 Fri, 23 Apr 2021 10:49: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 1lZtNR-0002fN-Ia
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:49: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 1lZtNR-0002ny-Hs
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:49:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtNR-0001NT-Gi
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:49: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=qA+BNYo+EgRJqu1wAbyjB2fCSQRi0lktFVwT+lmd2QU=; b=WRJRdqu3qk8KZXxAd2Ag4dtmSM
	LJakv9fjqYmKhNxRr0ZrGkUt5/yIiOz4mf/91e2uAQyj95JqPRMJjGHIKzCQOTXY/X++sUXxsvtBJ
	x2N8cXr5S7nEY9q9SofWQra14m/3vzPJiIQsOlL1ekW4MSfwTSnErct2iBVupxBDMLus=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move strlcpy()
Message-Id: <E1lZtNR-0001NT-Gi@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:49:37 +0000

commit ead845c4fbe44d2ea8d16eaaa6d59f1d63a29b2d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:48:59 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:48:59 2021 +0200

    lib: move strlcpy()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 26 --------------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strlcpy.c   | 38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+), 26 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index f36a4a31e5..84af23270d 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -56,32 +56,6 @@ int (strcasecmp)(const char *s1, const char *s2)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRLCPY
-/**
- * strlcpy - Copy a %NUL terminated string into a sized buffer
- * @dest: Where to copy the string to
- * @src: Where to copy the string from
- * @size: size of destination buffer
- *
- * Compatible with *BSD: the result is always a valid
- * NUL-terminated string that fits in the buffer (unless,
- * of course, the buffer size is zero). It does not pad
- * out the result like strncpy() does.
- */
-size_t strlcpy(char *dest, const char *src, size_t size)
-{
-	size_t ret = strlen(src);
-
-	if (size) {
-		size_t len = (ret >= size) ? size-1 : ret;
-		memcpy(dest, src, len);
-		dest[len] = '\0';
-	}
-	return ret;
-}
-EXPORT_SYMBOL(strlcpy);
-#endif
-
 #ifndef __HAVE_ARCH_STRLCAT
 /**
  * strlcat - Append a %NUL terminated string into a sized buffer
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 12af30d670..ed1d2e47d4 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -15,6 +15,7 @@ lib-y += parse-size.o
 lib-y += rbtree.o
 lib-y += sort.o
 lib-y += strcmp.o
+lib-y += strlcpy.o
 lib-y += strlen.o
 lib-y += strncmp.o
 lib-y += strnlen.o
diff --git a/xen/lib/strlcpy.c b/xen/lib/strlcpy.c
new file mode 100644
index 0000000000..f5daba5e16
--- /dev/null
+++ b/xen/lib/strlcpy.c
@@ -0,0 +1,38 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strlcpy - Copy a %NUL terminated string into a sized buffer
+ * @dest: Where to copy the string to
+ * @src: Where to copy the string from
+ * @size: size of destination buffer
+ *
+ * Compatible with *BSD: the result is always a valid
+ * NUL-terminated string that fits in the buffer (unless,
+ * of course, the buffer size is zero). It does not pad
+ * out the result like strncpy() does.
+ */
+size_t strlcpy(char *dest, const char *src, size_t size)
+{
+	size_t ret = strlen(src);
+
+	if (size) {
+		size_t len = (ret >= size) ? size-1 : ret;
+		memcpy(dest, src, len);
+		dest[len] = '\0';
+	}
+	return ret;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:49:48 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:49:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116125.221656 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtNc-0002hF-QL; Fri, 23 Apr 2021 10:49:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116125.221656; Fri, 23 Apr 2021 10:49: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 1lZtNc-0002h7-NP; Fri, 23 Apr 2021 10:49:48 +0000
Received: by outflank-mailman (input) for mailman id 116125;
 Fri, 23 Apr 2021 10:49: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 1lZtNb-0002gz-N1
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:49: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 1lZtNb-0002oT-LR
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:49:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtNb-0001P4-KB
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:49: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=S9C1NBMCQleytavmYbVEHCiLYTuQcN+OEaQFphzB8Ek=; b=HqZD1s4dVTRKwLQ41YZeXinXBo
	zorwG9aMsFgPpC79V2ONYOVn+TUE/3yqFQn/0TZh5hWM3u7Pzz6YvEe0cCWOQZPZW02HsPBx3ZO4J
	w06MWfTqizv4zeqTongJEIgx4dk/UHZwR0yi/Sci1+L9sh3s+kTrh2F7exiws9Rc9AjI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move strlcat()
Message-Id: <E1lZtNb-0001P4-KB@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:49:47 +0000

commit 9c1e40fb7f9b197fa1c20842bc2fdb47550a2f33
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:49:10 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:49:10 2021 +0200

    lib: move strlcat()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 29 -----------------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strlcat.c   | 41 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 42 insertions(+), 29 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 84af23270d..6042262b49 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -56,35 +56,6 @@ int (strcasecmp)(const char *s1, const char *s2)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRLCAT
-/**
- * strlcat - Append a %NUL terminated string into a sized buffer
- * @dest: Where to copy the string to
- * @src: Where to copy the string from
- * @size: size of destination buffer
- *
- * Compatible with *BSD: the result is always a valid
- * NUL-terminated string that fits in the buffer (unless,
- * of course, the buffer size is zero).
- */
-size_t strlcat(char *dest, const char *src, size_t size)
-{
-	size_t slen = strlen(src);
-	size_t dlen = strnlen(dest, size);
-	char *p = dest + dlen;
-
-	while ((p - dest) < size)
-		if ((*p++ = *src++) == '\0')
-			break;
-
-	if (dlen < size)
-		*(p-1) = '\0';
-
-	return slen + dlen;
-}
-EXPORT_SYMBOL(strlcat);
-#endif
-
 #ifndef __HAVE_ARCH_STRCHR
 /**
  * strchr - Find the first occurrence of a character in a string
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index ed1d2e47d4..0c6c726adf 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -15,6 +15,7 @@ lib-y += parse-size.o
 lib-y += rbtree.o
 lib-y += sort.o
 lib-y += strcmp.o
+lib-y += strlcat.o
 lib-y += strlcpy.o
 lib-y += strlen.o
 lib-y += strncmp.o
diff --git a/xen/lib/strlcat.c b/xen/lib/strlcat.c
new file mode 100644
index 0000000000..ec32be4890
--- /dev/null
+++ b/xen/lib/strlcat.c
@@ -0,0 +1,41 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strlcat - Append a %NUL terminated string into a sized buffer
+ * @dest: Where to copy the string to
+ * @src: Where to copy the string from
+ * @size: size of destination buffer
+ *
+ * Compatible with *BSD: the result is always a valid
+ * NUL-terminated string that fits in the buffer (unless,
+ * of course, the buffer size is zero).
+ */
+size_t strlcat(char *dest, const char *src, size_t size)
+{
+	size_t slen = strlen(src);
+	size_t dlen = strnlen(dest, size);
+	char *p = dest + dlen;
+
+	while ((p - dest) < size)
+		if ((*p++ = *src++) == '\0')
+			break;
+
+	if (dlen < size)
+		*(p-1) = '\0';
+
+	return slen + dlen;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:49:58 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:49:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116127.221659 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtNm-0002iY-Rv; Fri, 23 Apr 2021 10:49:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116127.221659; Fri, 23 Apr 2021 10:49: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 1lZtNm-0002iP-Ox; Fri, 23 Apr 2021 10:49:58 +0000
Received: by outflank-mailman (input) for mailman id 116127;
 Fri, 23 Apr 2021 10:49: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 1lZtNl-0002iE-QQ
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:49: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 1lZtNl-0002oa-PI
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:49:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtNl-0001Qb-Nn
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:49: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=ySoLvo+ahCXf0i9RTy+cFSy5jatyDwzvutRf++kq6sY=; b=qwF4y+JS9e4/3D5+RGs+s8QMZv
	zaKKwJAwZ8Hfs6aGXUNBWMQpYCgeVe7Da8B7AeHBVAumXUq0q8Jk455u16vnJEgHHlFa5H34+qmLu
	lgNeN5IdmYtsx+QYwRKq1ex3SBIeHjjDIscYutP81aVVZpYHSFhwmpo6P9QEJ1t1/Mak=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move strchr()
Message-Id: <E1lZtNl-0001Qb-Nn@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:49:57 +0000

commit 7095953455001bb2d95792bb0b9c822e479b1c57
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:50:25 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:50:25 2021 +0200

    lib: move strchr()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 15 ---------------
 xen/lib/Makefile    |  1 +
 xen/lib/strchr.c    | 28 ++++++++++++++++++++++++++++
 3 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 6042262b49..f433b15afd 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -56,21 +56,6 @@ int (strcasecmp)(const char *s1, const char *s2)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRCHR
-/**
- * strchr - Find the first occurrence of a character in a string
- * @s: The string to be searched
- * @c: The character to search for
- */
-char *(strchr)(const char *s, int c)
-{
-	for(; *s != (char) c; ++s)
-		if (*s == '\0')
-			return NULL;
-	return (char *) s;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRRCHR
 /**
  * strrchr - Find the last occurrence of a character in a string
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 0c6c726adf..b69b516369 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -14,6 +14,7 @@ lib-y += muldiv64.o
 lib-y += parse-size.o
 lib-y += rbtree.o
 lib-y += sort.o
+lib-y += strchr.o
 lib-y += strcmp.o
 lib-y += strlcat.o
 lib-y += strlcpy.o
diff --git a/xen/lib/strchr.c b/xen/lib/strchr.c
new file mode 100644
index 0000000000..2eba3f1574
--- /dev/null
+++ b/xen/lib/strchr.c
@@ -0,0 +1,28 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strchr - Find the first occurrence of a character in a string
+ * @s: The string to be searched
+ * @c: The character to search for
+ */
+char *(strchr)(const char *s, int c)
+{
+	for(; *s != (char) c; ++s)
+		if (*s == '\0')
+			return NULL;
+	return (char *) s;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:50:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:50:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116128.221664 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtNw-0003Qx-Tj; Fri, 23 Apr 2021 10:50:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116128.221664; Fri, 23 Apr 2021 10:50: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 1lZtNw-0003Qp-QZ; Fri, 23 Apr 2021 10:50:08 +0000
Received: by outflank-mailman (input) for mailman id 116128;
 Fri, 23 Apr 2021 10:50: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 1lZtNv-0003Ml-Sy
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:50: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 1lZtNv-0002ou-SE
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:50:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtNv-0001S3-Ra
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:50: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=ily2e9cEPDDduz7nXADVRnDSuWv/POdZPj6vcf+gWj4=; b=YE3y+MBvPnMvwocT/GXQ3BEwu/
	TAyjyCCPZUZ3RO7juM5KJnfZwZQSvDhybS0gaivluvqHChC5BJzK4JqTMm1VerHMZqiOe6xHqDUuz
	YXeHoXfHZdoLsCkNNDqEZKFIEWUTdiLhlgrGh/DG5P8oC7yPJuarhfG2m6z07MsYSJhA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move strrchr()
Message-Id: <E1lZtNv-0001S3-Ra@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:50:07 +0000

commit a50eb38545319dd52ba891dc47a8d0b478823d90
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:50:44 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:50:44 2021 +0200

    lib: move strrchr()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 18 ------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strrchr.c   | 31 +++++++++++++++++++++++++++++++
 3 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index f433b15afd..7c4edc17e3 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -56,24 +56,6 @@ int (strcasecmp)(const char *s1, const char *s2)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRRCHR
-/**
- * strrchr - Find the last occurrence of a character in a string
- * @s: The string to be searched
- * @c: The character to search for
- */
-char *(strrchr)(const char *s, int c)
-{
-	const char *p = s + strlen(s);
-
-	for (; *p != (char)c; --p)
-		if (p == s)
-			return NULL;
-
-	return (char *)p;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRSPN
 /**
  * strspn - Calculate the length of the initial substring of @s which only
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index b69b516369..e531e2dfb3 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -21,6 +21,7 @@ lib-y += strlcpy.o
 lib-y += strlen.o
 lib-y += strncmp.o
 lib-y += strnlen.o
+lib-y += strrchr.o
 lib-$(CONFIG_X86) += xxhash32.o
 lib-$(CONFIG_X86) += xxhash64.o
 
diff --git a/xen/lib/strrchr.c b/xen/lib/strrchr.c
new file mode 100644
index 0000000000..0d53dd9518
--- /dev/null
+++ b/xen/lib/strrchr.c
@@ -0,0 +1,31 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strrchr - Find the last occurrence of a character in a string
+ * @s: The string to be searched
+ * @c: The character to search for
+ */
+char *(strrchr)(const char *s, int c)
+{
+	const char *p = s + strlen(s);
+
+	for (; *p != (char)c; --p)
+		if (p == s)
+			return NULL;
+
+	return (char *)p;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:50:19 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:50:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116129.221670 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtO6-0003SH-Vo; Fri, 23 Apr 2021 10:50:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116129.221670; Fri, 23 Apr 2021 10:50: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 1lZtO6-0003S4-S9; Fri, 23 Apr 2021 10:50:18 +0000
Received: by outflank-mailman (input) for mailman id 116129;
 Fri, 23 Apr 2021 10:50:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtO5-0003Rx-W2
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:50: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 1lZtO5-0002p1-VG
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:50:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtO5-0001cN-Ub
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:50: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=PMvhpN2WHy0EiAhTyZAoYXptUQe/Z4JT9iLjURcvEjo=; b=QKHpKCEt7bN8MQovqURqRRWD57
	u8VrIEli9An4FlprGJs7IYeVyaT8u9vIz4/hNAxTkMBuvunqfQP60iY3R2foRjR5WOLOSW9BujPMe
	dplrxn9Ln12Kj3enBIk6RY6M0oIvvT+k9hnvegEzjy/TzXIlcresx+e7mNZJwB+oUXeU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move strstr()
Message-Id: <E1lZtO5-0001cN-Ub@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:50:17 +0000

commit 1f9d9b0b3e72d93ce8dfb33b51a8e44f77321e99
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:50:54 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:50:54 2021 +0200

    lib: move strstr()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 21 ---------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strstr.c    | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 7c4edc17e3..abb1689edd 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -131,27 +131,6 @@ char * strsep(char **s, const char *ct)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRSTR
-/**
- * strstr - Find the first substring in a %NUL terminated string
- * @s1: The string to be searched
- * @s2: The string to search for
- */
-char *(strstr)(const char *s1, const char *s2)
-{
-	size_t l1, l2 = strlen(s2);
-
-	if (!l2)
-		return (char *)s1;
-
-	for (l1 = strlen(s1); l1 >= l2; --l1, ++s1)
-		if (!memcmp(s1, s2, l2))
-			return (char *)s1;
-
-	return NULL;
-}
-#endif
-
 /*
  * Local variables:
  * mode: C
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index e531e2dfb3..57a7095ffa 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -22,6 +22,7 @@ lib-y += strlen.o
 lib-y += strncmp.o
 lib-y += strnlen.o
 lib-y += strrchr.o
+lib-y += strstr.o
 lib-$(CONFIG_X86) += xxhash32.o
 lib-$(CONFIG_X86) += xxhash64.o
 
diff --git a/xen/lib/strstr.c b/xen/lib/strstr.c
new file mode 100644
index 0000000000..c305f5acb3
--- /dev/null
+++ b/xen/lib/strstr.c
@@ -0,0 +1,34 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strstr - Find the first substring in a %NUL terminated string
+ * @s1: The string to be searched
+ * @s2: The string to search for
+ */
+char *(strstr)(const char *s1, const char *s2)
+{
+	size_t l1, l2 = strlen(s2);
+
+	if (!l2)
+		return (char *)s1;
+
+	for (l1 = strlen(s1); l1 >= l2; --l1, ++s1)
+		if (!memcmp(s1, s2, l2))
+			return (char *)s1;
+
+	return NULL;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:50:30 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:50:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116130.221672 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtOI-0003TU-0p; Fri, 23 Apr 2021 10:50:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116130.221672; Fri, 23 Apr 2021 10:50:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtOH-0003TM-Tx; Fri, 23 Apr 2021 10:50:29 +0000
Received: by outflank-mailman (input) for mailman id 116130;
 Fri, 23 Apr 2021 10:50:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtOG-0003T9-6x
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:50:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtOG-0002p8-2u
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:50:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtOG-0001nI-1O
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:50:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oJ/vwo7bpNwPGfqxeGZw/75PYdQ2fZG84IQG23plksk=; b=1S1mg/60yHVwgqTlE3jE6JXs5f
	JNk92omCTVocJZGCofyoXh0s0+C/1PnapFR1gDHrVFIpO488ekKiSETJ35lYMQdyEvSLbfzEEFmDc
	hScQy+kYGzrqBrra2LzxYnwwKtdORMjEAZvZNsnyolV+tv1JYswRwDn7YHWJam+SAhCs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move strcasecmp()
Message-Id: <E1lZtOG-0001nI-1O@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:50:28 +0000

commit 50ee4fb90a525c9b543cabe78a3df6d8588bba30
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:51:08 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:51:08 2021 +0200

    lib: move strcasecmp()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c  | 15 ---------------
 xen/lib/Makefile     |  1 +
 xen/lib/strcasecmp.c | 29 +++++++++++++++++++++++++++++
 3 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index abb1689edd..2b81daef89 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -41,21 +41,6 @@ int strnicmp(const char *s1, const char *s2, size_t len)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRCASECMP
-int (strcasecmp)(const char *s1, const char *s2)
-{
-    int c1, c2;
-
-    do
-    {
-        c1 = tolower(*s1++);
-        c2 = tolower(*s2++);
-    } while ( c1 == c2 && c1 != 0 );
-
-    return c1 - c2;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRSPN
 /**
  * strspn - Calculate the length of the initial substring of @s which only
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 57a7095ffa..6264b3aae3 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -14,6 +14,7 @@ lib-y += muldiv64.o
 lib-y += parse-size.o
 lib-y += rbtree.o
 lib-y += sort.o
+lib-y += strcasecmp.o
 lib-y += strchr.o
 lib-y += strcmp.o
 lib-y += strlcat.o
diff --git a/xen/lib/strcasecmp.c b/xen/lib/strcasecmp.c
new file mode 100644
index 0000000000..c2a411310e
--- /dev/null
+++ b/xen/lib/strcasecmp.c
@@ -0,0 +1,29 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+#include <xen/ctype.h>
+
+int (strcasecmp)(const char *s1, const char *s2)
+{
+    int c1, c2;
+
+    do
+    {
+        c1 = tolower(*s1++);
+        c2 = tolower(*s2++);
+    } while ( c1 == c2 && c1 != 0 );
+
+    return c1 - c2;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:50:40 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:50:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116131.221675 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtOS-0003Uh-28; Fri, 23 Apr 2021 10:50:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116131.221675; Fri, 23 Apr 2021 10:50:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtOR-0003Ua-VZ; Fri, 23 Apr 2021 10:50:39 +0000
Received: by outflank-mailman (input) for mailman id 116131;
 Fri, 23 Apr 2021 10:50:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtOQ-0003UO-6t
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:50:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtOQ-0002pI-6C
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:50:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtOQ-0001om-5Z
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:50:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ekgn4oULDBPW1kDBkBLB1TaUYPlIxIO8ehsfhO6q/mQ=; b=H7wiQ2jaJBjJuX151/L2WunPxm
	5cHkPTovMUTpSpnVRt9y8IFWLNpH7kXAIFMpDudBw/xGRc2NmXH7XBNePpa2Nm8fSCY2hgQsZxnUt
	4iWuehI4VXI2kaZ7X0TVKqG4baMA7APF9gM778lro7OFyTWNN0x+E2YtulyAq8Pe0aYA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move/rename strnicmp() to strncasecmp()
Message-Id: <E1lZtOQ-0001om-5Z@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:50:38 +0000

commit 3acd02a50b3b271284d2a37227c658b2cdae8231
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:51:47 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:51:47 2021 +0200

    lib: move/rename strnicmp() to strncasecmp()
    
    While moving the implementation, also rename it to match strcasecmp(),
    allowing the similar use of a compiler builtin in this case as well.
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain_build.c   |  4 ++--
 xen/common/string.c           | 33 ------------------------------
 xen/drivers/acpi/pmstat.c     | 20 +++++++++---------
 xen/drivers/cpufreq/cpufreq.c |  2 +-
 xen/include/xen/string.h      |  6 +++++-
 xen/lib/Makefile              |  1 +
 xen/lib/strncasecmp.c         | 47 +++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 66 insertions(+), 47 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index b1d7b9849f..282416e74d 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1224,8 +1224,8 @@ static int __init map_range_to_domain(const struct dt_device_node *dev,
      * They are not MMIO and therefore a domain should not be able to
      * manage them via the IOMEM interface.
      */
-    if ( strnicmp(dt_node_full_name(dev), "/reserved-memory/",
-         strlen("/reserved-memory/")) != 0 )
+    if ( strncasecmp(dt_node_full_name(dev), "/reserved-memory/",
+                     strlen("/reserved-memory/")) != 0 )
     {
         res = iomem_permit_access(d, paddr_to_pfn(addr),
                 paddr_to_pfn(PAGE_ALIGN(addr + len - 1)));
diff --git a/xen/common/string.c b/xen/common/string.c
index 2b81daef89..f373f82171 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -8,39 +8,6 @@
 #include <xen/string.h>
 #include <xen/ctype.h>
 
-#ifndef __HAVE_ARCH_STRNICMP
-/**
- * strnicmp - Case insensitive, length-limited string comparison
- * @s1: One string
- * @s2: The other string
- * @len: the maximum number of characters to compare
- */
-int strnicmp(const char *s1, const char *s2, size_t len)
-{
-	/* Yes, Virginia, it had better be unsigned */
-	unsigned char c1, c2;
-
-	c1 = 0;	c2 = 0;
-	if (len) {
-		do {
-			c1 = *s1; c2 = *s2;
-			s1++; s2++;
-			if (!c1)
-				break;
-			if (!c2)
-				break;
-			if (c1 == c2)
-				continue;
-			c1 = tolower(c1);
-			c2 = tolower(c2);
-			if (c1 != c2)
-				break;
-		} while (--len);
-	}
-	return (int)c1 - (int)c2;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRSPN
 /**
  * strspn - Calculate the length of the initial substring of @s which only
diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c
index 2f528f9ca3..1bae635101 100644
--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -275,14 +275,14 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
         strlcpy(op->u.get_para.scaling_governor, "Unknown", CPUFREQ_NAME_LEN);
 
     /* governor specific para */
-    if ( !strnicmp(op->u.get_para.scaling_governor, 
-                   "userspace", CPUFREQ_NAME_LEN) )
+    if ( !strncasecmp(op->u.get_para.scaling_governor,
+                      "userspace", CPUFREQ_NAME_LEN) )
     {
         op->u.get_para.u.userspace.scaling_setspeed = policy->cur;
     }
 
-    if ( !strnicmp(op->u.get_para.scaling_governor, 
-                   "ondemand", CPUFREQ_NAME_LEN) )
+    if ( !strncasecmp(op->u.get_para.scaling_governor,
+                      "ondemand", CPUFREQ_NAME_LEN) )
     {
         ret = get_cpufreq_ondemand_para(
             &op->u.get_para.u.ondemand.sampling_rate_max,
@@ -350,8 +350,8 @@ static int set_cpufreq_para(struct xen_sysctl_pm_op *op)
     {
         unsigned int freq =op->u.set_para.ctrl_value;
 
-        if ( !strnicmp(policy->governor->name,
-                       "userspace", CPUFREQ_NAME_LEN) )
+        if ( !strncasecmp(policy->governor->name,
+                          "userspace", CPUFREQ_NAME_LEN) )
             ret = write_userspace_scaling_setspeed(op->cpuid, freq);
         else
             ret = -EINVAL;
@@ -363,8 +363,8 @@ static int set_cpufreq_para(struct xen_sysctl_pm_op *op)
     {
         unsigned int sampling_rate = op->u.set_para.ctrl_value;
 
-        if ( !strnicmp(policy->governor->name,
-                       "ondemand", CPUFREQ_NAME_LEN) )
+        if ( !strncasecmp(policy->governor->name,
+                          "ondemand", CPUFREQ_NAME_LEN) )
             ret = write_ondemand_sampling_rate(sampling_rate);
         else
             ret = -EINVAL;
@@ -376,8 +376,8 @@ static int set_cpufreq_para(struct xen_sysctl_pm_op *op)
     {
         unsigned int up_threshold = op->u.set_para.ctrl_value;
 
-        if ( !strnicmp(policy->governor->name,
-                       "ondemand", CPUFREQ_NAME_LEN) )
+        if ( !strncasecmp(policy->governor->name,
+                          "ondemand", CPUFREQ_NAME_LEN) )
             ret = write_ondemand_up_threshold(up_threshold);
         else
             ret = -EINVAL;
diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c
index e630a47419..419aae83ee 100644
--- a/xen/drivers/cpufreq/cpufreq.c
+++ b/xen/drivers/cpufreq/cpufreq.c
@@ -111,7 +111,7 @@ struct cpufreq_governor *__find_governor(const char *governor)
         return NULL;
 
     list_for_each_entry(t, &cpufreq_governor_list, governor_list)
-        if (!strnicmp(governor, t->name, CPUFREQ_NAME_LEN))
+        if (!strncasecmp(governor, t->name, CPUFREQ_NAME_LEN))
             return t;
 
     return NULL;
diff --git a/xen/include/xen/string.h b/xen/include/xen/string.h
index 4f438b018a..b4d2217a96 100644
--- a/xen/include/xen/string.h
+++ b/xen/include/xen/string.h
@@ -16,8 +16,8 @@ size_t strlcpy(char *, const char *, size_t);
 size_t strlcat(char *, const char *, size_t);
 int strcmp(const char *, const char *);
 int strncmp(const char *, const char *, size_t);
-int strnicmp(const char *, const char *, size_t);
 int strcasecmp(const char *, const char *);
+int strncasecmp(const char *, const char *, size_t);
 char *strchr(const char *, int);
 char *strrchr(const char *, int);
 char *strstr(const char *, const char *);
@@ -48,6 +48,10 @@ void *memchr_inv(const void *, int, size_t);
 #define strcasecmp(s1, s2) __builtin_strcasecmp(s1, s2)
 #endif
 
+#ifndef __HAVE_ARCH_STRCASECMP
+#define strncasecmp(s1, s2, n) __builtin_strncasecmp(s1, s2, n)
+#endif
+
 #ifndef __HAVE_ARCH_STRCHR
 #define strchr(s1, c) __builtin_strchr(s1, c)
 #endif
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 6264b3aae3..02240831e0 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -20,6 +20,7 @@ lib-y += strcmp.o
 lib-y += strlcat.o
 lib-y += strlcpy.o
 lib-y += strlen.o
+lib-y += strncasecmp.o
 lib-y += strncmp.o
 lib-y += strnlen.o
 lib-y += strrchr.o
diff --git a/xen/lib/strncasecmp.c b/xen/lib/strncasecmp.c
new file mode 100644
index 0000000000..407cf2a40e
--- /dev/null
+++ b/xen/lib/strncasecmp.c
@@ -0,0 +1,47 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+#include <xen/ctype.h>
+
+/**
+ * strncasecmp - Case insensitive, length-limited string comparison
+ * @s1: One string
+ * @s2: The other string
+ * @len: the maximum number of characters to compare
+ */
+int (strncasecmp)(const char *s1, const char *s2, size_t len)
+{
+	/* Yes, Virginia, it had better be unsigned */
+	unsigned char c1, c2;
+
+	c1 = 0;	c2 = 0;
+	if (len) {
+		do {
+			c1 = *s1; c2 = *s2;
+			s1++; s2++;
+			if (!c1)
+				break;
+			if (!c2)
+				break;
+			if (c1 == c2)
+				continue;
+			c1 = tolower(c1);
+			c2 = tolower(c2);
+			if (c1 != c2)
+				break;
+		} while (--len);
+	}
+	return (int)c1 - (int)c2;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:50:50 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:50:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116132.221680 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtOc-0003WD-6N; Fri, 23 Apr 2021 10:50:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116132.221680; Fri, 23 Apr 2021 10:50:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtOc-0003W5-3M; Fri, 23 Apr 2021 10:50:50 +0000
Received: by outflank-mailman (input) for mailman id 116132;
 Fri, 23 Apr 2021 10:50:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtOa-0003Vu-Aa
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:50:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtOa-0002pg-9I
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:50:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtOa-0001qH-8k
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:50:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8iKgeHiq0/r4CqL1vOvJl+r/xy1k0GhCv9bim1SW8Po=; b=YAmx5Aaox2UpzrFR7C23gKHNqQ
	/Z1+XGcbFRfViL9BwHqOM2S9d4Ha8qepR1omMTLz5HStDT8oeDeSHxlh+B9fFA7girrZvoa9zmeTk
	yL5rf4xWfKgtZjoz8yorYSdTsSXFfMiRBq+JQ3VnDuf49qszA8o3VQS6Pp6RwEOICmHg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move strspn()
Message-Id: <E1lZtOa-0001qH-8k@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:50:48 +0000

commit b3573bbd2ea6c8cdbe8c3a635354404fc19478f8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:52:57 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:52:57 2021 +0200

    lib: move strspn()
    
    Allow the function to be individually linkable, discardable, and
    overridable. In fact the function is unused at present, and hence will
    now get omitted from the final binaries.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 27 ---------------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strspn.c    | 40 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+), 27 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index f373f82171..6310facebd 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -8,33 +8,6 @@
 #include <xen/string.h>
 #include <xen/ctype.h>
 
-#ifndef __HAVE_ARCH_STRSPN
-/**
- * strspn - Calculate the length of the initial substring of @s which only
- * 	contain letters in @accept
- * @s: The string to be searched
- * @accept: The string to search for
- */
-size_t strspn(const char *s, const char *accept)
-{
-	const char *p;
-	const char *a;
-	size_t count = 0;
-
-	for (p = s; *p != '\0'; ++p) {
-		for (a = accept; *a != '\0'; ++a) {
-			if (*p == *a)
-				break;
-		}
-		if (*a == '\0')
-			return count;
-		++count;
-	}
-
-	return count;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRPBRK
 /**
  * strpbrk - Find the first occurrence of a set of characters
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 02240831e0..4126fdd05e 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -24,6 +24,7 @@ lib-y += strncasecmp.o
 lib-y += strncmp.o
 lib-y += strnlen.o
 lib-y += strrchr.o
+lib-y += strspn.o
 lib-y += strstr.o
 lib-$(CONFIG_X86) += xxhash32.o
 lib-$(CONFIG_X86) += xxhash64.o
diff --git a/xen/lib/strspn.c b/xen/lib/strspn.c
new file mode 100644
index 0000000000..3422057d4d
--- /dev/null
+++ b/xen/lib/strspn.c
@@ -0,0 +1,40 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strspn - Calculate the length of the initial substring of @s which only
+ * 	contain letters in @accept
+ * @s: The string to be searched
+ * @accept: The string to search for
+ */
+size_t strspn(const char *s, const char *accept)
+{
+	const char *p;
+	const char *a;
+	size_t count = 0;
+
+	for (p = s; *p != '\0'; ++p) {
+		for (a = accept; *a != '\0'; ++a) {
+			if (*p == *a)
+				break;
+		}
+		if (*a == '\0')
+			return count;
+		++count;
+	}
+
+	return count;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:51:00 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:51:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116133.221684 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtOm-0003Xb-8N; Fri, 23 Apr 2021 10:51:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116133.221684; Fri, 23 Apr 2021 10:51:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtOm-0003XT-5N; Fri, 23 Apr 2021 10:51:00 +0000
Received: by outflank-mailman (input) for mailman id 116133;
 Fri, 23 Apr 2021 10:50:58 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtOk-0003XH-Ck
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:50:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtOk-0002pq-C2
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:50:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtOk-0001rE-BY
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:50:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Q9u8zyGtDXEbTJiNrRnuQr5ahWoJcHmYgBIoR619B2k=; b=ddaxLj9LC7R1PXR1kBllehg12i
	shUbaRV9KllEVEnith2nIviTCWedMBwPMo9uNGxJr3YnHVsCXbvlXmPdvaTKm8kUm09j69m48YqZm
	cYrAoOD/FdjdbTkjIDtt06tKPiN589tFVAt8ySkIECgXV9/U7RfmeYibjJxdyKD7p6Xk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move strpbrk()
Message-Id: <E1lZtOk-0001rE-BY@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:50:58 +0000

commit 4a0630eae4f1eb0ede38511fb97f19673299aac4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:53:10 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:53:10 2021 +0200

    lib: move strpbrk()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/string.c | 20 --------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strpbrk.c   | 33 +++++++++++++++++++++++++++++++++
 3 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 6310facebd..05cd199b61 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -8,26 +8,6 @@
 #include <xen/string.h>
 #include <xen/ctype.h>
 
-#ifndef __HAVE_ARCH_STRPBRK
-/**
- * strpbrk - Find the first occurrence of a set of characters
- * @cs: The string to be searched
- * @ct: The characters to search for
- */
-char * strpbrk(const char * cs,const char * ct)
-{
-	const char *sc1,*sc2;
-
-	for( sc1 = cs; *sc1 != '\0'; ++sc1) {
-		for( sc2 = ct; *sc2 != '\0'; ++sc2) {
-			if (*sc1 == *sc2)
-				return (char *) sc1;
-		}
-	}
-	return NULL;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRSEP
 /**
  * strsep - Split a string into tokens
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 4126fdd05e..dd96bd0d90 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -23,6 +23,7 @@ lib-y += strlen.o
 lib-y += strncasecmp.o
 lib-y += strncmp.o
 lib-y += strnlen.o
+lib-y += strpbrk.o
 lib-y += strrchr.o
 lib-y += strspn.o
 lib-y += strstr.o
diff --git a/xen/lib/strpbrk.c b/xen/lib/strpbrk.c
new file mode 100644
index 0000000000..54c15784c4
--- /dev/null
+++ b/xen/lib/strpbrk.c
@@ -0,0 +1,33 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strpbrk - Find the first occurrence of a set of characters
+ * @cs: The string to be searched
+ * @ct: The characters to search for
+ */
+char *strpbrk(const char * cs,const char * ct)
+{
+	const char *sc1,*sc2;
+
+	for( sc1 = cs; *sc1 != '\0'; ++sc1) {
+		for( sc2 = ct; *sc2 != '\0'; ++sc2) {
+			if (*sc1 == *sc2)
+				return (char *) sc1;
+		}
+	}
+	return NULL;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:51:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:51:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116134.221688 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtOw-0003Yo-9m; Fri, 23 Apr 2021 10:51:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116134.221688; Fri, 23 Apr 2021 10:51:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtOw-0003Yg-6t; Fri, 23 Apr 2021 10:51:10 +0000
Received: by outflank-mailman (input) for mailman id 116134;
 Fri, 23 Apr 2021 10:51:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtOu-0003YV-FX
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:51:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtOu-0002rg-Eo
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:51:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtOu-0001sL-EJ
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:51:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fK91b8vm+Uvlq7n7nQeKFmUoVzvCYDdtZxkijN9FpAc=; b=LZMosCgn1X6R5twMZRcbJO8VT8
	Ts3Tg6WvQYBR3WcW/hm0/bPjF13nU2nhprP7UK8Nu2AT8TFmxx6qNpM9gzgjnWFeiTyuiAWIGKLzC
	qhS/XGx7gGgqpcYxy6lSnIldxCksxJetyLnq5PZWwTzZ+QM3zeq08Q6Xvg4wyEvci35I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] lib: move strsep()
Message-Id: <E1lZtOu-0001sL-EJ@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:51:08 +0000

commit 4f7bfefe79f417a657dba5bd25129dd6961e8de7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 22 14:53:21 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 22 14:53:21 2021 +0200

    lib: move strsep()
    
    Allow the function to be individually linkable, discardable, and
    overridable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/Makefile |  1 -
 xen/common/string.c | 47 -----------------------------------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strsep.c    | 41 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 42 insertions(+), 48 deletions(-)

diff --git a/xen/common/Makefile b/xen/common/Makefile
index e2a7e62d14..54de70d422 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -40,7 +40,6 @@ obj-y += softirq.o
 obj-y += smp.o
 obj-y += spinlock.o
 obj-y += stop_machine.o
-obj-y += string.o
 obj-y += symbols.o
 obj-y += tasklet.o
 obj-y += time.o
diff --git a/xen/common/string.c b/xen/common/string.c
deleted file mode 100644
index 05cd199b61..0000000000
--- a/xen/common/string.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  linux/lib/string.c
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- */
-
-#include <xen/types.h>
-#include <xen/string.h>
-#include <xen/ctype.h>
-
-#ifndef __HAVE_ARCH_STRSEP
-/**
- * strsep - Split a string into tokens
- * @s: The string to be searched
- * @ct: The characters to search for
- *
- * strsep() updates @s to point after the token, ready for the next call.
- *
- * It returns empty tokens, too, behaving exactly like the libc function
- * of that name. In fact, it was stolen from glibc2 and de-fancy-fied.
- * Same semantics, slimmer shape. ;)
- */
-char * strsep(char **s, const char *ct)
-{
-	char *sbegin = *s, *end;
-
-	if (sbegin == NULL)
-		return NULL;
-
-	end = strpbrk(sbegin, ct);
-	if (end)
-		*end++ = '\0';
-	*s = end;
-
-	return sbegin;
-}
-#endif
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 8
- * tab-width: 8
- * indent-tabs-mode: t
- * End:
- */
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index dd96bd0d90..b311ea739c 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -25,6 +25,7 @@ lib-y += strncmp.o
 lib-y += strnlen.o
 lib-y += strpbrk.o
 lib-y += strrchr.o
+lib-y += strsep.o
 lib-y += strspn.o
 lib-y += strstr.o
 lib-$(CONFIG_X86) += xxhash32.o
diff --git a/xen/lib/strsep.c b/xen/lib/strsep.c
new file mode 100644
index 0000000000..0bda9901c2
--- /dev/null
+++ b/xen/lib/strsep.c
@@ -0,0 +1,41 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strsep - Split a string into tokens
+ * @s: The string to be searched
+ * @ct: The characters to search for
+ *
+ * strsep() updates @s to point after the token, ready for the next call.
+ *
+ * It returns empty tokens, too, behaving exactly like the libc function
+ * of that name. In fact, it was stolen from glibc2 and de-fancy-fied.
+ * Same semantics, slimmer shape. ;)
+ */
+char *strsep(char **s, const char *ct)
+{
+	char *sbegin = *s, *end;
+
+	if (sbegin == NULL)
+		return NULL;
+
+	end = strpbrk(sbegin, ct);
+	if (end)
+		*end++ = '\0';
+	*s = end;
+
+	return sbegin;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:51:20 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:51:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116135.221691 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtP6-0003Zz-B6; Fri, 23 Apr 2021 10:51:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116135.221691; Fri, 23 Apr 2021 10:51:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtP6-0003Zs-8N; Fri, 23 Apr 2021 10:51:20 +0000
Received: by outflank-mailman (input) for mailman id 116135;
 Fri, 23 Apr 2021 10:51:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtP4-0003Zh-IY
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:51:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtP4-0002rs-Ho
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:51:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtP4-0001tH-H2
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:51:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=W9CeVp+YQ6/48rYD3QRlu75/820bzKRDebRjbmUv+ow=; b=x36K9XIUpi0sbJ6SaVUOWVrRVZ
	djDFA0EP84Lkef5PPEtUsopUOBCYttoy60De2W+EONXFhnpFYOl//3k0MV7caHDFF4nRpq/qSX240
	gn4AW8ctEjfMlhxT2FcXSRjqfZGihz04XF8dX6/mT8R+S95+vCnfdOFMjTjqq/URVdtk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: build in openSUSE Tumbleweed
Message-Id: <E1lZtP4-0001tH-H2@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:51:18 +0000

commit a60a72c17f116f6ef0fe2a5a77f8faa912d848b2
Author:     Dario Faggioli <dfaggioli@suse.com>
AuthorDate: Wed Jul 31 18:58:51 2019 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 22 13:54:31 2021 +0100

    automation: build in openSUSE Tumbleweed
    
    Mark the tests as non-fatal, as Tumbleweed is a bleeding edge rolling release.
    
    Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
    Acked-by: Doug Goldstein <cardoe@cardoe.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/gitlab-ci/build.yaml | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 57bf2c7f80..20d1d0cb34 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -457,6 +457,30 @@ opensuse-leap-gcc-debug:
   variables:
     CONTAINER: suse:opensuse-leap
 
+opensuse-tumbleweed-clang:
+  extends: .clang-x86-64-build
+  variables:
+    CONTAINER: suse:opensuse-tumbleweed
+  allow_failure: true
+
+opensuse-tumbleweed-clang-debug:
+  extends: .clang-x86-64-build-debug
+  variables:
+    CONTAINER: suse:opensuse-tumbleweed
+  allow_failure: true
+
+opensuse-tumbleweed-gcc:
+  extends: .gcc-x86-64-build
+  variables:
+    CONTAINER: suse:opensuse-tumbleweed
+  allow_failure: true
+
+opensuse-tumbleweed-gcc-debug:
+  extends: .gcc-x86-64-build-debug
+  variables:
+    CONTAINER: suse:opensuse-tumbleweed
+  allow_failure: true
+
 alpine-3.12-gcc:
   extends: .gcc-x86-64-build
   variables:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 10:51:30 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 10:51:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116136.221696 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtPG-0003bL-D0; Fri, 23 Apr 2021 10:51:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116136.221696; Fri, 23 Apr 2021 10:51:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZtPG-0003bD-9z; Fri, 23 Apr 2021 10:51:30 +0000
Received: by outflank-mailman (input) for mailman id 116136;
 Fri, 23 Apr 2021 10:51:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtPE-0003az-Li
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:51:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtPE-0002s3-Kr
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:51:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZtPE-0001tp-KI
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 10:51:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BDn+bJiG2TpXaVYGGMuRvpmnHiHwy1gKHO8EIp2l4F0=; b=fJs3wKH1bfGfozTsnteeeNcuNQ
	KqdY2s1wrBi/PWCxX4dK0IkapZJS3QjNFmyYh9gTH1fJChWDB/KS6ESb+ARBNNfmZkffJ0rcfj+F1
	+ihJDBpzOD9x8g+ihF79aOkgZP4UZkzdxqgcp0C+rIBedXhQxtA+SYTCaPWuXM9dk3R0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm: fix wrong unmap call
Message-Id: <E1lZtPE-0001tp-KI@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 10:51:28 +0000

commit f889fa267c47c3495d304da5da9dd2ef8a4c95af
Author:     Hongyan Xia <hongyxia@amazon.com>
AuthorDate: Thu Apr 22 18:42:30 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 22 18:49:23 2021 +0100

    x86/mm: fix wrong unmap call
    
    Commit 'x86/mm: switch to new APIs in modify_xen_mappings' applied the
    hunk of the unmap call to map_pages_to_xen() which was wrong and clearly
    should have been at the end of modify_xen_mappings(). Fix.
    
    Fixes: dd68f2e49bea ("x86/mm: switch to new APIs in modify_xen_mappings")
    Signed-off-by: Hongyan Xia <hongyxia@amazon.com>
    Tested-by: Julien Grall <jgrall@amazon.com>
    Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 50229e38d3..84e3ccf47e 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5532,7 +5532,6 @@ int map_pages_to_xen(
 
  out:
     L3T_UNLOCK(current_l3page);
-    unmap_domain_page(pl2e);
     unmap_domain_page(pl3e);
     unmap_domain_page(pl2e);
     return rc;
@@ -5830,6 +5829,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
  out:
     L3T_UNLOCK(current_l3page);
     unmap_domain_page(pl3e);
+    unmap_domain_page(pl2e);
     return rc;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 14:00:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 14:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116402.222186 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZwLm-0001g9-Ei; Fri, 23 Apr 2021 14:00:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116402.222186; Fri, 23 Apr 2021 14: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 1lZwLm-0001g2-Aq; Fri, 23 Apr 2021 14:00:06 +0000
Received: by outflank-mailman (input) for mailman id 116402;
 Fri, 23 Apr 2021 14: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 1lZwLl-0001as-Cw
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 14: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 1lZwLl-00069K-9O
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 14:00:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZwLl-00008Q-69
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 14: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=LABc2uVBYntlN+38oQu+47EtChudPjjrBX6qXL0Xjqo=; b=nKRSEviqvVr9ZZVmrYILDncp0o
	eU330+B6HTtTcbh8kqQrrzFLWeo5OuhFO3Q2LcJH9DQaD4bFvShVugYwSDthgKzWcT2QzMXphAOFG
	EIY9HqPjXYOhPOKnG5A3OsFVAnNgukWccA30CfrcX5xjJATxvHrtsrkXILtjGBLkWER0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/oprof: fix !HVM && !PV32 build
Message-Id: <E1lZwLl-00008Q-69@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 14:00:05 +0000

commit fae4f071e1e14b005c8c4d79eda9ec7778cb21d8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 23 15:57:27 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 23 15:57:27 2021 +0200

    x86/oprof: fix !HVM && !PV32 build
    
    clang, at the very least, doesn't like unused inline functions, unless
    their definitions live in a header.
    
    Fixes: d23d792478 ("x86: avoid building COMPAT code when !HVM && !PV32")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/oprofile/backtrace.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/oprofile/backtrace.c b/xen/arch/x86/oprofile/backtrace.c
index 929bf51a40..bd5d1b0f6c 100644
--- a/xen/arch/x86/oprofile/backtrace.c
+++ b/xen/arch/x86/oprofile/backtrace.c
@@ -43,6 +43,7 @@ dump_hypervisor_backtrace(struct vcpu *vcpu, const struct frame_head *head,
     return head->ebp;
 }
 
+#ifdef CONFIG_COMPAT
 static inline int is_32bit_vcpu(struct vcpu *vcpu)
 {
     if (is_hvm_vcpu(vcpu))
@@ -50,6 +51,7 @@ static inline int is_32bit_vcpu(struct vcpu *vcpu)
     else
         return is_pv_32bit_vcpu(vcpu);
 }
+#endif
 
 static struct frame_head *
 dump_guest_backtrace(struct vcpu *vcpu, const struct frame_head *head,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 14:00:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 14:00:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116403.222189 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZwLw-0001ko-FR; Fri, 23 Apr 2021 14:00:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116403.222189; Fri, 23 Apr 2021 14:00:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lZwLw-0001kh-Cc; Fri, 23 Apr 2021 14:00:16 +0000
Received: by outflank-mailman (input) for mailman id 116403;
 Fri, 23 Apr 2021 14:00:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZwLv-0001kc-EU
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 14:00:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZwLv-00069N-Di
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 14:00:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lZwLv-0000AP-Bs
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 14:00: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=25nFqhSjG/r9CUVzDRcdIHosEUl0duJ7RTIcVCyEUig=; b=gfkTaxvhdcWuVXCIhKIxNr6nEm
	GjSX9anRx5I6/z8CXorbPlKJ2qkrpitgEitnW45HC6BBtVK/bzdAYvlgyNe7YSIYjiQcSH99/FUcX
	4XlQ9s4pLjmArLXHfsPNV8lvXRK1qwwK0zhU0Vvuwna+PE2qJilAdbU3G3qhrooqdYpM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pv: fix clang build without CONFIG_PV32
Message-Id: <E1lZwLv-0000AP-Bs@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 14:00:15 +0000

commit fc5d0c98076b4c84fa978259eae0f521e95962c7
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri Apr 23 15:58:37 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 23 15:58:37 2021 +0200

    x86/pv: fix clang build without CONFIG_PV32
    
    Clang reports the following build error without CONFIG_PV32:
    
    hypercall.c:253:10: error: variable 'op' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
        if ( !is_pv_32bit_vcpu(curr) )
             ^~~~~~~~~~~~~~~~~~~~~~~
    hypercall.c:282:21: note: uninitialized use occurs here
        return unlikely(op == __HYPERVISOR_iret)
                        ^~
    /root/src/xen/xen/include/xen/compiler.h:21:43: note: expanded from macro 'unlikely'
    #define unlikely(x)   __builtin_expect(!!(x),0)
                                              ^
    hypercall.c:253:5: note: remove the 'if' if its condition is always true
        if ( !is_pv_32bit_vcpu(curr) )
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    hypercall.c:251:21: note: initialize the variable 'op' to silence this warning
        unsigned long op;
                        ^
                         = 0
    
    Rearrange the code in arch_do_multicall_call so that the if guards the
    32bit branch and when CONFIG_PV32 is not set there's no conditional at
    all.
    
    Fixes: 527922008bc ('x86: slim down hypercall handling when !PV32')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/hypercall.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c
index e30c59b628..d573f74aa1 100644
--- a/xen/arch/x86/pv/hypercall.c
+++ b/xen/arch/x86/pv/hypercall.c
@@ -250,34 +250,34 @@ enum mc_disposition arch_do_multicall_call(struct mc_state *state)
     struct vcpu *curr = current;
     unsigned long op;
 
-    if ( !is_pv_32bit_vcpu(curr) )
+#ifdef CONFIG_PV32
+    if ( is_pv_32bit_vcpu(curr) )
     {
-        struct multicall_entry *call = &state->call;
+        struct compat_multicall_entry *call = &state->compat_call;
 
         op = call->op;
         if ( (op < ARRAY_SIZE(pv_hypercall_table)) &&
-             pv_hypercall_table[op].native )
-            call->result = pv_hypercall_table[op].native(
+             pv_hypercall_table[op].compat )
+            call->result = pv_hypercall_table[op].compat(
                 call->args[0], call->args[1], call->args[2],
                 call->args[3], call->args[4], call->args[5]);
         else
             call->result = -ENOSYS;
     }
-#ifdef CONFIG_PV32
     else
+#endif
     {
-        struct compat_multicall_entry *call = &state->compat_call;
+        struct multicall_entry *call = &state->call;
 
         op = call->op;
         if ( (op < ARRAY_SIZE(pv_hypercall_table)) &&
-             pv_hypercall_table[op].compat )
-            call->result = pv_hypercall_table[op].compat(
+             pv_hypercall_table[op].native )
+            call->result = pv_hypercall_table[op].native(
                 call->args[0], call->args[1], call->args[2],
                 call->args[3], call->args[4], call->args[5]);
         else
             call->result = -ENOSYS;
     }
-#endif
 
     return unlikely(op == __HYPERVISOR_iret)
            ? mc_exit
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 23 18:00:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Apr 2021 18:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116564.222466 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1la063-0003cQ-4Z; Fri, 23 Apr 2021 18:00:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116564.222466; Fri, 23 Apr 2021 18:00:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1la063-0003cD-14; Fri, 23 Apr 2021 18:00:07 +0000
Received: by outflank-mailman (input) for mailman id 116564;
 Fri, 23 Apr 2021 18: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 1la061-0003NE-75
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 18: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 1la061-0002OG-3N
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 18:00:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1la061-0006xr-09
 for xen-changelog@lists.xenproject.org; Fri, 23 Apr 2021 18: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=Pe7k6sh+eQi9QcxTQqOG0VAUKrImGSzAL+7rUZ9SDcw=; b=tquEfi1TFkRP/54bksUHRuoFQU
	9GkIYDCRh7L+cdigFeMDpyqq/pDL6oNuDMwXroguOLPdGHOdVTtEjS83giN7Oxhfe/DgGpg5278qz
	jAmeYRx4FqhPe8/ZSGeWsbxpsQeZ9cZwTbyHwnkT+kJjxSdsLb+2Z5Pr99x7G/INtBcI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: depend on PV || HVM
Message-Id: <E1la061-0006xr-09@xenbits.xenproject.org>
Date: Fri, 23 Apr 2021 18:00:05 +0000

commit bea65a212c0581520203b6ad0d07615693f42f73
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 16 14:32:46 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Apr 23 18:57:01 2021 +0100

    x86/shadow: depend on PV || HVM
    
    With the building of guest_?.o now depending on PV or HVM, without
    further #ifdef-ary shadow code won't link anymore when !PV && !HVM.
    Since this isn't a useful configuration anyway, exclude shadow code from
    being built in this case.
    
    Fixes: aff8bf94ce65 ("x86/shadow: only 4-level guest code needs building when !HVM")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index db0de0a9ec..32b9f23a20 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -122,6 +122,7 @@ config XEN_SHSTK
 config SHADOW_PAGING
 	bool "Shadow Paging"
 	default !PV_SHIM_EXCLUSIVE
+	depends on PV || HVM
 	---help---
 
           Shadow paging is a software alternative to hardware paging support
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Apr 24 02:00:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Apr 2021 02:00:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116650.222585 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1la7aV-0008Vr-MA; Sat, 24 Apr 2021 02:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116650.222585; Sat, 24 Apr 2021 02: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 1la7aV-0008V9-Il; Sat, 24 Apr 2021 02:00:03 +0000
Received: by outflank-mailman (input) for mailman id 116650;
 Sat, 24 Apr 2021 02: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 1la7aU-00089o-6B
 for xen-changelog@lists.xenproject.org; Sat, 24 Apr 2021 02: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 1la7aU-0007xA-3f
 for xen-changelog@lists.xenproject.org; Sat, 24 Apr 2021 02:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1la7aU-000131-00
 for xen-changelog@lists.xenproject.org; Sat, 24 Apr 2021 02:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jPq4uHW2BN3Y/bEkkZuX9bO/MSPXegP2aO5JPUniVHY=; b=YepK/bN97b6jMxHEimiJ+azr+D
	rEeTEmuYS5W+cRlaKJZB8RfzyfaMSLeqYDIEAEqebWtD4g+kEgW/8azhbmy3WTW8AtYC3/zQZf1wS
	MhqhpXNUEH222jE+7HDwYnG486yO7HYiNkuvh3PWwQsEcjAgzF/Q/wOgDpnkopb6j2nc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/cpuid: support LFENCE always serialising CPUID bit
Message-Id: <E1la7aU-000131-00@xenbits.xenproject.org>
Date: Sat, 24 Apr 2021 02:00:02 +0000

commit e9b4fe26364950258c9f57f0f68eccb778eeadbb
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Apr 15 16:47:31 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 22 19:05:24 2021 +0100

    x86/cpuid: support LFENCE always serialising CPUID bit
    
    AMD Milan (Zen3) CPUs have an LFENCE Always Serialising CPUID bit in
    leaf 80000021.eax. Previous AMD versions used to have a user settable
    bit in DE_CFG MSR to select whether LFENCE was dispatch serialising,
    which Xen always attempts to set. The forcefully always on setting is
    due to the addition of SEV-SNP so that a VMM cannot break the
    confidentiality of a guest.
    
    In order to support this new CPUID bit move the LFENCE_DISPATCH
    synthetic CPUID bit to map the hardware bit (leaving a hole in the
    synthetic range) and either rely on the bit already being set by the
    native CPUID output, or attempt to fake it in Xen by modifying the
    DE_CFG MSR. This requires adding one more entry to the featureset to
    support leaf 80000021.eax.
    
    The bit is always exposed to guests by default even if the underlying
    hardware doesn't support leaf 80000021. Note that Xen doesn't allow
    guests to change the DE_CFG value, so once set by Xen LFENCE will always
    be serialising.
    
    Note that the access to DE_CFG by guests is left as-is: reads will
    unconditionally return LFENCE_SERIALISE bit set, while writes are
    silently dropped.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    [Always expose to guests by default]
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/light/libxl_cpuid.c              |  2 ++
 tools/misc/xen-cpuid.c                      |  6 +++++
 xen/arch/x86/cpu/amd.c                      |  7 ++++++
 xen/arch/x86/cpu/common.c                   |  3 +++
 xen/arch/x86/cpuid.c                        | 15 +++++++++++-
 xen/include/asm-x86/cpufeatures.h           |  2 +-
 xen/include/public/arch-x86/cpufeatureset.h |  3 +++
 xen/include/xen/lib/x86/cpuid.h             | 37 ++++++++++++++++++++++++++++-
 8 files changed, 72 insertions(+), 3 deletions(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 943a343239..f32c5d3a6f 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -288,6 +288,8 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"svm_decode",   0x8000000a, NA, CPUID_REG_EDX,  7,  1},
         {"svm_pausefilt",0x8000000a, NA, CPUID_REG_EDX, 10,  1},
 
+        {"lfence+",      0x80000021, NA, CPUID_REG_EAX,  2,  1},
+
         {"maxhvleaf",    0x40000000, NA, CPUID_REG_EAX,  0,  8},
 
         {NULL, 0, NA, CPUID_REG_INV, 0, 0}
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index b4229d1126..a17ad07832 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -182,6 +182,11 @@ static const char *const str_7a1[32] =
     [12] = "fsrcs",
 };
 
+static const char *const str_e21a[32] =
+{
+    [ 2] = "lfence+",
+};
+
 static const struct {
     const char *name;
     const char *abbr;
@@ -199,6 +204,7 @@ static const struct {
     { "0x80000008.ebx",   "e8b", str_e8b },
     { "0x00000007:0.edx", "7d0", str_7d0 },
     { "0x00000007:1.eax", "7a1", str_7a1 },
+    { "0x80000021.eax",  "e21a", str_e21a },
 };
 
 #define COL_ALIGN "18"
diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 9c8dcd91ee..169f80d635 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -646,6 +646,13 @@ void amd_init_lfence(struct cpuinfo_x86 *c)
 {
 	uint64_t value;
 
+	/*
+	 * Some hardware has LFENCE dispatch serialising always enabled,
+	 * nothing to do on that case.
+	 */
+	if (test_bit(X86_FEATURE_LFENCE_DISPATCH, c->x86_capability))
+		return;
+
 	/*
 	 * Attempt to set lfence to be Dispatch Serialising.  This MSR almost
 	 * certainly isn't virtualised (and Xen at least will leak the real
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index e5c3caf41d..0eb364f8a6 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -412,6 +412,9 @@ static void generic_identify(struct cpuinfo_x86 *c)
 	if (c->extended_cpuid_level >= 0x80000008)
 		c->x86_capability[cpufeat_word(X86_FEATURE_CLZERO)]
 			= cpuid_ebx(0x80000008);
+	if (c->extended_cpuid_level >= 0x80000021)
+		c->x86_capability[cpufeat_word(X86_FEATURE_LFENCE_DISPATCH)]
+			= cpuid_eax(0x80000021);
 
 	/* Intel-defined flags: level 0x00000007 */
 	if ( c->cpuid_level >= 0x00000007 ) {
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 03a483b93a..752bf244ea 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -311,6 +311,7 @@ static void __init calculate_raw_policy(void)
 static void __init calculate_host_policy(void)
 {
     struct cpuid_policy *p = &host_cpuid_policy;
+    unsigned int max_extd_leaf;
 
     *p = raw_cpuid_policy;
 
@@ -318,7 +319,19 @@ static void __init calculate_host_policy(void)
         min_t(uint32_t, p->basic.max_leaf,   ARRAY_SIZE(p->basic.raw) - 1);
     p->feat.max_subleaf =
         min_t(uint32_t, p->feat.max_subleaf, ARRAY_SIZE(p->feat.raw) - 1);
-    p->extd.max_leaf = 0x80000000 | min_t(uint32_t, p->extd.max_leaf & 0xffff,
+
+    max_extd_leaf = p->extd.max_leaf;
+
+    /*
+     * For AMD/Hygon hardware before Zen3, we unilaterally modify LFENCE to be
+     * dispatch serialising for Spectre mitigations.  Extend max_extd_leaf
+     * beyond what hardware supports, to include the feature leaf containing
+     * this information.
+     */
+    if ( cpu_has_lfence_dispatch )
+        max_extd_leaf = max(max_extd_leaf, 0x80000021);
+
+    p->extd.max_leaf = 0x80000000 | min_t(uint32_t, max_extd_leaf & 0xffff,
                                           ARRAY_SIZE(p->extd.raw) - 1);
 
     cpuid_featureset_to_policy(boot_cpu_data.x86_capability, p);
diff --git a/xen/include/asm-x86/cpufeatures.h b/xen/include/asm-x86/cpufeatures.h
index d7e42d9bb6..6c8f432aee 100644
--- a/xen/include/asm-x86/cpufeatures.h
+++ b/xen/include/asm-x86/cpufeatures.h
@@ -24,7 +24,7 @@ XEN_CPUFEATURE(APERFMPERF,        X86_SYNTH( 8)) /* APERFMPERF */
 XEN_CPUFEATURE(MFENCE_RDTSC,      X86_SYNTH( 9)) /* MFENCE synchronizes RDTSC */
 XEN_CPUFEATURE(XEN_SMEP,          X86_SYNTH(10)) /* SMEP gets used by Xen itself */
 XEN_CPUFEATURE(XEN_SMAP,          X86_SYNTH(11)) /* SMAP gets used by Xen itself */
-XEN_CPUFEATURE(LFENCE_DISPATCH,   X86_SYNTH(12)) /* lfence set as Dispatch Serialising */
+/* Bit 12 - unused. */
 XEN_CPUFEATURE(IND_THUNK_LFENCE,  X86_SYNTH(13)) /* Use IND_THUNK_LFENCE */
 XEN_CPUFEATURE(IND_THUNK_JMP,     X86_SYNTH(14)) /* Use IND_THUNK_JMP */
 XEN_CPUFEATURE(SC_BRANCH_HARDEN,  X86_SYNTH(15)) /* Conditional Branch Hardening */
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 7cdd08d551..c42f56bdd4 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -282,6 +282,9 @@ XEN_CPUFEATURE(FZRM,         10*32+10) /*A  Fast Zero-length REP MOVSB */
 XEN_CPUFEATURE(FSRS,         10*32+11) /*A  Fast Short REP STOSB */
 XEN_CPUFEATURE(FSRCS,        10*32+12) /*A  Fast Short REP CMPSB/SCASB */
 
+/* AMD-defined CPU features, CPUID level 0x80000021.eax, word 11 */
+XEN_CPUFEATURE(LFENCE_DISPATCH,    11*32+ 2) /*A  LFENCE always serializing */
+
 #endif /* XEN_CPUFEATURE */
 
 /* Clean up from a default include.  Close the enum (for C). */
diff --git a/xen/include/xen/lib/x86/cpuid.h b/xen/include/xen/lib/x86/cpuid.h
index ef695d2ff7..2300faf03e 100644
--- a/xen/include/xen/lib/x86/cpuid.h
+++ b/xen/include/xen/lib/x86/cpuid.h
@@ -15,6 +15,7 @@
 #define FEATURESET_e8b    8 /* 0x80000008.ebx      */
 #define FEATURESET_7d0    9 /* 0x00000007:0.edx    */
 #define FEATURESET_7a1   10 /* 0x00000007:1.eax    */
+#define FEATURESET_e21a  11 /* 0x80000021.eax      */
 
 struct cpuid_leaf
 {
@@ -84,7 +85,7 @@ const char *x86_cpuid_vendor_to_str(unsigned int vendor);
 #define CPUID_GUEST_NR_TOPO       (1u + 1)
 #define CPUID_GUEST_NR_XSTATE     (62u + 1)
 #define CPUID_GUEST_NR_EXTD_INTEL (0x8u + 1)
-#define CPUID_GUEST_NR_EXTD_AMD   (0x1cu + 1)
+#define CPUID_GUEST_NR_EXTD_AMD   (0x21u + 1)
 #define CPUID_GUEST_NR_EXTD       MAX(CPUID_GUEST_NR_EXTD_INTEL, \
                                       CPUID_GUEST_NR_EXTD_AMD)
 
@@ -264,6 +265,38 @@ struct cpuid_policy
             };
             uint32_t nc:8, :4, apic_id_size:4, :16;
             uint32_t /* d */:32;
+
+            uint64_t :64, :64; /* Leaf 0x80000009. */
+            uint64_t :64, :64; /* Leaf 0x8000000a - SVM rev and features. */
+            uint64_t :64, :64; /* Leaf 0x8000000b. */
+            uint64_t :64, :64; /* Leaf 0x8000000c. */
+            uint64_t :64, :64; /* Leaf 0x8000000d. */
+            uint64_t :64, :64; /* Leaf 0x8000000e. */
+            uint64_t :64, :64; /* Leaf 0x8000000f. */
+            uint64_t :64, :64; /* Leaf 0x80000010. */
+            uint64_t :64, :64; /* Leaf 0x80000011. */
+            uint64_t :64, :64; /* Leaf 0x80000012. */
+            uint64_t :64, :64; /* Leaf 0x80000013. */
+            uint64_t :64, :64; /* Leaf 0x80000014. */
+            uint64_t :64, :64; /* Leaf 0x80000015. */
+            uint64_t :64, :64; /* Leaf 0x80000016. */
+            uint64_t :64, :64; /* Leaf 0x80000017. */
+            uint64_t :64, :64; /* Leaf 0x80000018. */
+            uint64_t :64, :64; /* Leaf 0x80000019 - TLB 1GB Identifiers. */
+            uint64_t :64, :64; /* Leaf 0x8000001a - Performance related info. */
+            uint64_t :64, :64; /* Leaf 0x8000001b - IBS feature information. */
+            uint64_t :64, :64; /* Leaf 0x8000001c. */
+            uint64_t :64, :64; /* Leaf 0x8000001d - Cache properties. */
+            uint64_t :64, :64; /* Leaf 0x8000001e - Extd APIC/Core/Node IDs. */
+            uint64_t :64, :64; /* Leaf 0x8000001f - AMD Secure Encryption. */
+            uint64_t :64, :64; /* Leaf 0x80000020 - Platform QoS. */
+
+            /* Leaf 0x80000021 - Extended Feature 2 */
+            union {
+                uint32_t e21a;
+                struct { DECL_BITFIELD(e21a); };
+            };
+            uint32_t /* b */:32, /* c */:32, /* d */:32;
         };
     } extd;
 
@@ -293,6 +326,7 @@ static inline void cpuid_policy_to_featureset(
     fs[FEATURESET_e8b] = p->extd.e8b;
     fs[FEATURESET_7d0] = p->feat._7d0;
     fs[FEATURESET_7a1] = p->feat._7a1;
+    fs[FEATURESET_e21a] = p->extd.e21a;
 }
 
 /* Fill in a CPUID policy from a featureset bitmap. */
@@ -310,6 +344,7 @@ static inline void cpuid_featureset_to_policy(
     p->extd.e8b   = fs[FEATURESET_e8b];
     p->feat._7d0  = fs[FEATURESET_7d0];
     p->feat._7a1  = fs[FEATURESET_7a1];
+    p->extd.e21a  = fs[FEATURESET_e21a];
 }
 
 static inline uint64_t cpuid_policy_xcr0_max(const struct cpuid_policy *p)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 24 19:22:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Apr 2021 19:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116918.222796 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1laNqt-0007DZ-FO; Sat, 24 Apr 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 116918.222796; Sat, 24 Apr 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 1laNqt-0007DQ-CL; Sat, 24 Apr 2021 19:22:03 +0000
Received: by outflank-mailman (input) for mailman id 116918;
 Sat, 24 Apr 2021 19:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1laNqs-0007D2-Bc
 for xen-changelog@lists.xenproject.org; Sat, 24 Apr 2021 19:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1laNqs-0002BE-8w
 for xen-changelog@lists.xenproject.org; Sat, 24 Apr 2021 19:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1laNqs-00071m-6M
 for xen-changelog@lists.xenproject.org; Sat, 24 Apr 2021 19:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=o9ZauxPlMltkG/Mva3auv4kK8ys3UEgt7qDOFzm7e+s=; b=A6c69Pv5/Zsh+e2iBqIDbuw5SE
	5zy+3jefZeMm7r/7kRXrge9Pg5ykK3+54TZuaxZ2/rDR3PK9Mk6G/CSfAkNbz885eKE9A3nx57fYJ
	w5JWEm3q8ybBjFELIiLlDUQVOrlmp+mBPketND0Z0trP0nNV6wy3FG4tJIKzYsa2r2CY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/oprof: fix !HVM && !PV32 build
Message-Id: <E1laNqs-00071m-6M@xenbits.xenproject.org>
Date: Sat, 24 Apr 2021 19:22:02 +0000

commit fae4f071e1e14b005c8c4d79eda9ec7778cb21d8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 23 15:57:27 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 23 15:57:27 2021 +0200

    x86/oprof: fix !HVM && !PV32 build
    
    clang, at the very least, doesn't like unused inline functions, unless
    their definitions live in a header.
    
    Fixes: d23d792478 ("x86: avoid building COMPAT code when !HVM && !PV32")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/oprofile/backtrace.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/oprofile/backtrace.c b/xen/arch/x86/oprofile/backtrace.c
index 929bf51a40..bd5d1b0f6c 100644
--- a/xen/arch/x86/oprofile/backtrace.c
+++ b/xen/arch/x86/oprofile/backtrace.c
@@ -43,6 +43,7 @@ dump_hypervisor_backtrace(struct vcpu *vcpu, const struct frame_head *head,
     return head->ebp;
 }
 
+#ifdef CONFIG_COMPAT
 static inline int is_32bit_vcpu(struct vcpu *vcpu)
 {
     if (is_hvm_vcpu(vcpu))
@@ -50,6 +51,7 @@ static inline int is_32bit_vcpu(struct vcpu *vcpu)
     else
         return is_pv_32bit_vcpu(vcpu);
 }
+#endif
 
 static struct frame_head *
 dump_guest_backtrace(struct vcpu *vcpu, const struct frame_head *head,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 24 19:22:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Apr 2021 19:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116919.222801 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1laNr3-0007EY-HB; Sat, 24 Apr 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 116919.222801; Sat, 24 Apr 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 1laNr3-0007EN-Ds; Sat, 24 Apr 2021 19:22:13 +0000
Received: by outflank-mailman (input) for mailman id 116919;
 Sat, 24 Apr 2021 19: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 1laNr2-0007EG-FX
 for xen-changelog@lists.xenproject.org; Sat, 24 Apr 2021 19:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1laNr2-0002Ba-Dj
 for xen-changelog@lists.xenproject.org; Sat, 24 Apr 2021 19:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1laNr2-00072N-BB
 for xen-changelog@lists.xenproject.org; Sat, 24 Apr 2021 19:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xjAjT7iYf8lrqwPkxM+qDvFN4m0MMFisn8AVgyiHXdU=; b=S7fnV9D/Gj/R0hLOFmrNKvrMDb
	RgKqr/WiR0XI1rHeZVHlIlPXt1spYYOui+1RMgBlrgk9aCHKcCoWMRcpcolwGA8PgZqZTVEGE6rR8
	14RU2qjHMH7BoeQ7zjSiFJse6cLznKO2XRD0G6xm5pi7gXFx9D39bVa6vpI8IDFcoizA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pv: fix clang build without CONFIG_PV32
Message-Id: <E1laNr2-00072N-BB@xenbits.xenproject.org>
Date: Sat, 24 Apr 2021 19:22:12 +0000

commit fc5d0c98076b4c84fa978259eae0f521e95962c7
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Fri Apr 23 15:58:37 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Apr 23 15:58:37 2021 +0200

    x86/pv: fix clang build without CONFIG_PV32
    
    Clang reports the following build error without CONFIG_PV32:
    
    hypercall.c:253:10: error: variable 'op' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
        if ( !is_pv_32bit_vcpu(curr) )
             ^~~~~~~~~~~~~~~~~~~~~~~
    hypercall.c:282:21: note: uninitialized use occurs here
        return unlikely(op == __HYPERVISOR_iret)
                        ^~
    /root/src/xen/xen/include/xen/compiler.h:21:43: note: expanded from macro 'unlikely'
    #define unlikely(x)   __builtin_expect(!!(x),0)
                                              ^
    hypercall.c:253:5: note: remove the 'if' if its condition is always true
        if ( !is_pv_32bit_vcpu(curr) )
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    hypercall.c:251:21: note: initialize the variable 'op' to silence this warning
        unsigned long op;
                        ^
                         = 0
    
    Rearrange the code in arch_do_multicall_call so that the if guards the
    32bit branch and when CONFIG_PV32 is not set there's no conditional at
    all.
    
    Fixes: 527922008bc ('x86: slim down hypercall handling when !PV32')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/hypercall.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c
index e30c59b628..d573f74aa1 100644
--- a/xen/arch/x86/pv/hypercall.c
+++ b/xen/arch/x86/pv/hypercall.c
@@ -250,34 +250,34 @@ enum mc_disposition arch_do_multicall_call(struct mc_state *state)
     struct vcpu *curr = current;
     unsigned long op;
 
-    if ( !is_pv_32bit_vcpu(curr) )
+#ifdef CONFIG_PV32
+    if ( is_pv_32bit_vcpu(curr) )
     {
-        struct multicall_entry *call = &state->call;
+        struct compat_multicall_entry *call = &state->compat_call;
 
         op = call->op;
         if ( (op < ARRAY_SIZE(pv_hypercall_table)) &&
-             pv_hypercall_table[op].native )
-            call->result = pv_hypercall_table[op].native(
+             pv_hypercall_table[op].compat )
+            call->result = pv_hypercall_table[op].compat(
                 call->args[0], call->args[1], call->args[2],
                 call->args[3], call->args[4], call->args[5]);
         else
             call->result = -ENOSYS;
     }
-#ifdef CONFIG_PV32
     else
+#endif
     {
-        struct compat_multicall_entry *call = &state->compat_call;
+        struct multicall_entry *call = &state->call;
 
         op = call->op;
         if ( (op < ARRAY_SIZE(pv_hypercall_table)) &&
-             pv_hypercall_table[op].compat )
-            call->result = pv_hypercall_table[op].compat(
+             pv_hypercall_table[op].native )
+            call->result = pv_hypercall_table[op].native(
                 call->args[0], call->args[1], call->args[2],
                 call->args[3], call->args[4], call->args[5]);
         else
             call->result = -ENOSYS;
     }
-#endif
 
     return unlikely(op == __HYPERVISOR_iret)
            ? mc_exit
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Apr 24 19:22:24 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Apr 2021 19:22:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.116920.222804 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1laNrE-0007Ft-IH; Sat, 24 Apr 2021 19:22:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 116920.222804; Sat, 24 Apr 2021 19:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1laNrE-0007Fl-FO; Sat, 24 Apr 2021 19:22:24 +0000
Received: by outflank-mailman (input) for mailman id 116920;
 Sat, 24 Apr 2021 19: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 1laNrC-0007FT-Hf
 for xen-changelog@lists.xenproject.org; Sat, 24 Apr 2021 19: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 1laNrC-0002Bi-Go
 for xen-changelog@lists.xenproject.org; Sat, 24 Apr 2021 19:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1laNrC-000737-Fw
 for xen-changelog@lists.xenproject.org; Sat, 24 Apr 2021 19: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=FDbGTLjKecJbXGUDwuk5z7Y9oypfus0fiQmfzmy/N3s=; b=nyGhhx+GzEG5/iUBVrMxuk9TSS
	6f5aJxjGBuRHGttDNzsp9CxgSk5lVuJmWEDKWkYl8lcwhE27W3S56kfSlVbqq6ZjQ28UiQzYIbMlY
	rWhaRM1z5vaJ78kHPb9IYQzFpq/kRfIkfRHV+fCusa9ifytEpiKQxcNHHU52RPapCkww=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: depend on PV || HVM
Message-Id: <E1laNrC-000737-Fw@xenbits.xenproject.org>
Date: Sat, 24 Apr 2021 19:22:22 +0000

commit bea65a212c0581520203b6ad0d07615693f42f73
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Apr 16 14:32:46 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Apr 23 18:57:01 2021 +0100

    x86/shadow: depend on PV || HVM
    
    With the building of guest_?.o now depending on PV or HVM, without
    further #ifdef-ary shadow code won't link anymore when !PV && !HVM.
    Since this isn't a useful configuration anyway, exclude shadow code from
    being built in this case.
    
    Fixes: aff8bf94ce65 ("x86/shadow: only 4-level guest code needs building when !HVM")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index db0de0a9ec..32b9f23a20 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -122,6 +122,7 @@ config XEN_SHSTK
 config SHADOW_PAGING
 	bool "Shadow Paging"
 	default !PV_SHIM_EXCLUSIVE
+	depends on PV || HVM
 	---help---
 
           Shadow paging is a software alternative to hardware paging support
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Apr 25 12:55:12 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 25 Apr 2021 12:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.117151.223010 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1laeHy-0002e8-Nq; Sun, 25 Apr 2021 12:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 117151.223010; Sun, 25 Apr 2021 12:55:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1laeHy-0002du-KA; Sun, 25 Apr 2021 12:55:06 +0000
Received: by outflank-mailman (input) for mailman id 117151;
 Sun, 25 Apr 2021 12:55:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1laeHx-0002dk-Go
 for xen-changelog@lists.xenproject.org; Sun, 25 Apr 2021 12:55:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1laeHx-0001Sh-Eg
 for xen-changelog@lists.xenproject.org; Sun, 25 Apr 2021 12:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1laeHx-0006nk-DO
 for xen-changelog@lists.xenproject.org; Sun, 25 Apr 2021 12:55:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ydiODAlWwe1Ely5dJDh6nAcDGzKynGbZlOycxsvZzXc=; b=kzGdrbNLWRRs3qR1ZxHi6ooo6j
	iy2L7m/h/GqxD3ej0Cda+M6YymWMpmKRg46gb2sFIegV3sPrO9FmSEfHb5Ya5zH1098gHaXP5gXxm
	a9q5U2IDB82pEy+WP26sVa+F7loa0Ilk+LGdl5ZooZqOilqTJdhgpd3MZgA8S2585sOQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: Remove unused prototype
Message-Id: <E1laeHx-0006nk-DO@xenbits.xenproject.org>
Date: Sun, 25 Apr 2021 12:55:05 +0000

commit 3c1c6c401eabca0f74022c990199e0f2b14ec0b9
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Apr 20 14:46:06 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Sun Apr 25 13:49:06 2021 +0100

    tools/xenstored: Remove unused prototype
    
    A prototype for dump_conn() has been present for quite a long time
    but there are no implementation. Even, AFAICT in the patch that
    introduced it. So drop it.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/xenstore/xenstored_core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index d54a6042a9..591b28e455 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2085,7 +2085,6 @@ static struct option options[] = {
 #endif
 	{ NULL, 0, NULL, 0 } };
 
-extern void dump_conn(struct connection *conn); 
 int dom0_domid = 0;
 int dom0_event = 0;
 int priv_domid = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sun Apr 25 12:55:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 25 Apr 2021 12:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.117152.223013 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1laeI8-0002g4-P1; Sun, 25 Apr 2021 12:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 117152.223013; Sun, 25 Apr 2021 12:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1laeI8-0002fw-Lk; Sun, 25 Apr 2021 12:55:16 +0000
Received: by outflank-mailman (input) for mailman id 117152;
 Sun, 25 Apr 2021 12:55:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1laeI7-0002fi-Kz
 for xen-changelog@lists.xenproject.org; Sun, 25 Apr 2021 12:55:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1laeI7-0001T1-Hy
 for xen-changelog@lists.xenproject.org; Sun, 25 Apr 2021 12:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1laeI7-0006oG-H2
 for xen-changelog@lists.xenproject.org; Sun, 25 Apr 2021 12:55:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2pKDK8BQVIFZu3Wj5AjRrRFILjbW2xZjjl4jcW1IgZw=; b=A9o9o6uHmY7sWQsho3v/oqcR5n
	+Rtx2b8hSYz2kPPN7wMBPjyCgHbGv7r3KfwSZLqGGn2UIyPD/DUNVuTnP0HeFHv0ZI+N40tK/zfVA
	6Und09FZ6tDi3BwWDvUbOY2qRgSCKsex6hhaWeHUWjoJCLj0MzciNTNqcwLgHTXZJUWI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: Wire properly the command line option -M/--path-max
Message-Id: <E1laeI7-0006oG-H2@xenbits.xenproject.org>
Date: Sun, 25 Apr 2021 12:55:15 +0000

commit ab392969ea178ef9a4b499f92c3fb5bd2e4e13ed
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed Apr 21 14:56:38 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Sun Apr 25 13:50:52 2021 +0100

    tools/xenstored: Wire properly the command line option -M/--path-max
    
    The command line option -M/--path-max was meant to be added by
    commit 924bf8c793cb "tools/xenstore: rework path length check" but this
    wasn't wired through properly.
    
    Fix it by adding the missing "case 'M':".
    
    Fixes: 924bf8c793cb ("tools/xenstore: rework path length check")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/xenstore/xenstored_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 591b28e455..c638e46221 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2148,6 +2148,7 @@ int main(int argc, char *argv[])
 		case 'A':
 			quota_nb_perms_per_node = strtol(optarg, NULL, 10);
 			break;
+		case 'M':
 			quota_max_path_len = strtol(optarg, NULL, 10);
 			quota_max_path_len = min(XENSTORE_REL_PATH_MAX,
 						 quota_max_path_len);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 26 04:44:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Apr 2021 04:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.117447.223368 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lat6J-0006Ac-MY; Mon, 26 Apr 2021 04:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 117447.223368; Mon, 26 Apr 2021 04:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lat6J-0006AU-JS; Mon, 26 Apr 2021 04:44:03 +0000
Received: by outflank-mailman (input) for mailman id 117447;
 Mon, 26 Apr 2021 04:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lat6I-0006AM-Po
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 04:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lat6I-00089B-OW
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 04:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lat6I-0000QL-MQ
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 04:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=j0BLC5JtzE3Ntxo8nLjkALb/EY6QxYkO2jA4hnYrgYk=; b=Jj0a9yaiVrWPs5+70/d+uXYtHw
	m1fyXTa6xeIU4TlB0OpGstpTcDqH4SwIhHQHEgVX/L4h1xda1ZvnywwB31/J//mZoKitUl7qNwLWS
	tIoriJqhuqDEdiWmMKFYdDvaMLU/Rr/KCoL1qF+MyqO8y4tvaUjk66VUOLob8wW13pA4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: Remove unused prototype
Message-Id: <E1lat6I-0000QL-MQ@xenbits.xenproject.org>
Date: Mon, 26 Apr 2021 04:44:02 +0000

commit 3c1c6c401eabca0f74022c990199e0f2b14ec0b9
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Apr 20 14:46:06 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Sun Apr 25 13:49:06 2021 +0100

    tools/xenstored: Remove unused prototype
    
    A prototype for dump_conn() has been present for quite a long time
    but there are no implementation. Even, AFAICT in the patch that
    introduced it. So drop it.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/xenstore/xenstored_core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index d54a6042a9..591b28e455 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2085,7 +2085,6 @@ static struct option options[] = {
 #endif
 	{ NULL, 0, NULL, 0 } };
 
-extern void dump_conn(struct connection *conn); 
 int dom0_domid = 0;
 int dom0_event = 0;
 int priv_domid = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Apr 26 04:44:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Apr 2021 04:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.117448.223372 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lat6T-0006Be-O1; Mon, 26 Apr 2021 04:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 117448.223372; Mon, 26 Apr 2021 04:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lat6T-0006BW-L8; Mon, 26 Apr 2021 04:44:13 +0000
Received: by outflank-mailman (input) for mailman id 117448;
 Mon, 26 Apr 2021 04:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lat6S-0006BP-Ty
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 04:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lat6S-00089E-S6
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 04:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lat6S-0000R4-Qn
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 04:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S+w59uwDIxW+ag43goqnQYElNp2mGDvEYkltptvOcsg=; b=pgEYU1wtE9JWQZyOUBpdBbjUAA
	7HXsc3sCeAnPyrxQftooTu/i2jjav3ASO3VpPsno7PIwjikZnR+oUslybeIz5XNmyAe5z4uui9vr+
	CNECtryg8z4uEhXK7KgsQzh0V8dG7+9FcXj8oDN7GEeGS9ls7hH7pO6ff9Z0ua5V9rJQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: Wire properly the command line option -M/--path-max
Message-Id: <E1lat6S-0000R4-Qn@xenbits.xenproject.org>
Date: Mon, 26 Apr 2021 04:44:12 +0000

commit ab392969ea178ef9a4b499f92c3fb5bd2e4e13ed
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed Apr 21 14:56:38 2021 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Sun Apr 25 13:50:52 2021 +0100

    tools/xenstored: Wire properly the command line option -M/--path-max
    
    The command line option -M/--path-max was meant to be added by
    commit 924bf8c793cb "tools/xenstore: rework path length check" but this
    wasn't wired through properly.
    
    Fix it by adding the missing "case 'M':".
    
    Fixes: 924bf8c793cb ("tools/xenstore: rework path length check")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/xenstore/xenstored_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 591b28e455..c638e46221 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2148,6 +2148,7 @@ int main(int argc, char *argv[])
 		case 'A':
 			quota_nb_perms_per_node = strtol(optarg, NULL, 10);
 			break;
+		case 'M':
 			quota_max_path_len = strtol(optarg, NULL, 10);
 			quota_max_path_len = min(XENSTORE_REL_PATH_MAX,
 						 quota_max_path_len);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Apr 26 08:33:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Apr 2021 08:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.117510.223418 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lawfz-0002n6-7X; Mon, 26 Apr 2021 08:33:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 117510.223418; Mon, 26 Apr 2021 08:33:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lawfz-0002my-4Z; Mon, 26 Apr 2021 08:33:07 +0000
Received: by outflank-mailman (input) for mailman id 117510;
 Mon, 26 Apr 2021 08:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lawfx-0002mt-JK
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08:33:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lawfx-0004Lb-D2
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lawfx-0007yC-AZ
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dIssvMpMefLl0ERM6qWjjTu1UESw0LvfIjbqhZDNjJ4=; b=dUu5YJyoMDCjLapWqwTEGg3OkC
	62+eGO+KmfiiDu2g37nGNKvYJbHEUUTJaxeBcagsNZm6KK6d355zAAwON+OStlh5gs81skSt5Kbt0
	9KZImF5i5EG7yU01QU8KxAe5Qnglpuwio5Yf9y2uOATvPjYq+of+uRRifcVe8evtIdDU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VT-d: Don't assume register-based invalidation is always supported
Message-Id: <E1lawfx-0007yC-AZ@xenbits.xenproject.org>
Date: Mon, 26 Apr 2021 08:33:05 +0000

commit 6773b1a7584a75a486e9774541ad5bd84c9aa5ee
Author:     Chao Gao <chao.gao@intel.com>
AuthorDate: Mon Apr 26 10:16:50 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 26 10:16:50 2021 +0200

    VT-d: Don't assume register-based invalidation is always supported
    
    According to Intel VT-d SPEC rev3.3 Section 6.5, Register-based Invalidation
    isn't supported by Intel VT-d version 6 and beyond.
    
    This hardware change impacts following two scenarios: admin can disable
    queued invalidation via 'qinval' cmdline and use register-based interface;
    VT-d switches to register-based invalidation when queued invalidation needs
    to be disabled, for example, during disabling x2apic or during system
    suspension or after enabling queued invalidation fails.
    
    To deal with this hardware change, if register-based invalidation isn't
    supported, queued invalidation cannot be disabled through Xen cmdline; and
    if queued invalidation has to be disabled temporarily in some scenarios,
    VT-d won't switch to register-based interface but use some dummy functions
    to catch errors in case there is any invalidation request issued when queued
    invalidation is disabled.
    
    Signed-off-by: Chao Gao <chao.gao@intel.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 docs/misc/xen-command-line.pandoc    |  4 +++-
 xen/drivers/passthrough/vtd/iommu.c  | 27 +++++++++++++++++++++++++--
 xen/drivers/passthrough/vtd/iommu.h  |  7 +++++++
 xen/drivers/passthrough/vtd/qinval.c | 33 +++++++++++++++++++++++++++++++--
 4 files changed, 66 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index a4bd3f12c5..c32a397a12 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1458,7 +1458,9 @@ The following options are specific to Intel VT-d hardware:
 *   The `qinval` boolean controls the Queued Invalidation sub-feature, and is
     active by default on compatible hardware.  Queued Invalidation is a
     feature in second-generation IOMMUs and is a functional prerequisite for
-    Interrupt Remapping.
+    Interrupt Remapping. Note that Xen disregards this setting for Intel VT-d
+    version 6 and greater as Registered-Based Invalidation isn't supported
+    by them.
 
 *   The `igfx` boolean is active by default, and controls whether the IOMMU in
     front of an Intel Graphics Device is enabled or not.
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index b2ca152e1f..82ae2f5e97 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1185,6 +1185,14 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
 
     iommu->cap = dmar_readq(iommu->reg, DMAR_CAP_REG);
     iommu->ecap = dmar_readq(iommu->reg, DMAR_ECAP_REG);
+    iommu->version = dmar_readl(iommu->reg, DMAR_VER_REG);
+
+    if ( !iommu_qinval && !has_register_based_invalidation(iommu) )
+    {
+        printk(XENLOG_WARNING VTDPREFIX "IOMMU %d: cannot disable Queued Invalidation\n",
+               iommu->index);
+        iommu_qinval = true;
+    }
 
     if ( iommu_verbose )
     {
@@ -2133,6 +2141,10 @@ static int __must_check init_vtd_hw(bool resume)
          */
         if ( enable_qinval(iommu) != 0 )
         {
+            /* Ensure register-based invalidation is available */
+            if ( !has_register_based_invalidation(iommu) )
+                return -EIO;
+
             iommu->flush.context = vtd_flush_context_reg;
             iommu->flush.iotlb   = vtd_flush_iotlb_reg;
         }
@@ -2227,6 +2239,7 @@ static int __init vtd_setup(void)
     struct acpi_drhd_unit *drhd;
     struct vtd_iommu *iommu;
     int ret;
+    bool reg_inval_supported = true;
 
     if ( list_empty(&acpi_drhd_units) )
     {
@@ -2255,8 +2268,8 @@ static int __init vtd_setup(void)
     }
 
     /* We enable the following features only if they are supported by all VT-d
-     * engines: Snoop Control, DMA passthrough, Queued Invalidation, Interrupt
-     * Remapping, and Posted Interrupt
+     * engines: Snoop Control, DMA passthrough, Register-based Invalidation,
+     * Queued Invalidation, Interrupt Remapping, and Posted Interrupt.
      */
     for_each_drhd_unit ( drhd )
     {
@@ -2278,6 +2291,9 @@ static int __init vtd_setup(void)
         if ( iommu_qinval && !ecap_queued_inval(iommu->ecap) )
             iommu_qinval = 0;
 
+        if ( !has_register_based_invalidation(iommu) )
+            reg_inval_supported = false;
+
         if ( iommu_intremap && !ecap_intr_remap(iommu->ecap) )
             iommu_intremap = iommu_intremap_off;
 
@@ -2304,6 +2320,13 @@ static int __init vtd_setup(void)
 
     softirq_tasklet_init(&vtd_fault_tasklet, do_iommu_page_fault, NULL);
 
+    if ( !iommu_qinval && !reg_inval_supported )
+    {
+        dprintk(XENLOG_ERR VTDPREFIX, "No available invalidation interface\n");
+        ret = -ENODEV;
+        goto error;
+    }
+
     if ( !iommu_qinval && iommu_intremap )
     {
         iommu_intremap = iommu_intremap_off;
diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h
index aaf9e864ff..68b3c76ea9 100644
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -526,6 +526,7 @@ struct vtd_iommu {
     struct list_head ats_devices;
     unsigned long *domid_bitmap;  /* domain id bitmap */
     u16 *domid_map;               /* domain id mapping array */
+    uint32_t version;
 };
 
 #define INTEL_IOMMU_DEBUG(fmt, args...) \
@@ -535,4 +536,10 @@ struct vtd_iommu {
             dprintk(XENLOG_WARNING VTDPREFIX, fmt, ## args);    \
     } while(0)
 
+/* Register-based invalidation isn't supported by VT-d version 6 and beyond. */
+static inline bool has_register_based_invalidation(const struct vtd_iommu *vtd)
+{
+    return VER_MAJOR(vtd->version) < 6;
+}
+
 #endif
diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c
index c0ea19d4bd..0976def43d 100644
--- a/xen/drivers/passthrough/vtd/qinval.c
+++ b/xen/drivers/passthrough/vtd/qinval.c
@@ -434,6 +434,23 @@ int enable_qinval(struct vtd_iommu *iommu)
     return 0;
 }
 
+static int vtd_flush_context_noop(struct vtd_iommu *iommu, uint16_t did,
+                                  uint16_t source_id, uint8_t function_mask,
+                                  uint64_t type, bool flush_non_present_entry)
+{
+    WARN();
+    return -EIO;
+}
+
+static int vtd_flush_iotlb_noop(struct vtd_iommu *iommu, uint16_t did,
+                                uint64_t addr, unsigned int size_order,
+                                uint64_t type, bool flush_non_present_entry,
+                                bool flush_dev_iotlb)
+{
+    WARN();
+    return -EIO;
+}
+
 void disable_qinval(struct vtd_iommu *iommu)
 {
     u32 sts;
@@ -455,6 +472,18 @@ void disable_qinval(struct vtd_iommu *iommu)
 out:
     spin_unlock_irqrestore(&iommu->register_lock, flags);
 
-    iommu->flush.context = vtd_flush_context_reg;
-    iommu->flush.iotlb   = vtd_flush_iotlb_reg;
+    /*
+     * Assign callbacks to noop to catch errors if register-based invalidation
+     * isn't supported.
+     */
+    if ( has_register_based_invalidation(iommu) )
+    {
+        iommu->flush.context = vtd_flush_context_reg;
+        iommu->flush.iotlb   = vtd_flush_iotlb_reg;
+    }
+    else
+    {
+        iommu->flush.context = vtd_flush_context_noop;
+        iommu->flush.iotlb   = vtd_flush_iotlb_noop;
+    }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 26 08:33:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Apr 2021 08:33:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.117511.223422 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lawg9-0002ns-90; Mon, 26 Apr 2021 08:33:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 117511.223422; Mon, 26 Apr 2021 08:33:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lawg9-0002nk-65; Mon, 26 Apr 2021 08:33:17 +0000
Received: by outflank-mailman (input) for mailman id 117511;
 Mon, 26 Apr 2021 08:33:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lawg7-0002nd-Iz
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08:33:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lawg7-0004Le-I3
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lawg7-0007yr-FE
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08:33:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SCePe4goLWNirWflbBZUIqUzOtIXBTh5/cr3DU+ZTQ8=; b=qHy6GeBJNtu4yJJxbdkMf+8YRo
	ePVrtUq78OT4AvOzaq6LCYL776cZLEMnUMBYLZcGjJp68GmzdGL42Uq7t7tvZA8nN4q2IzJvenORR
	f2BYCc3sLFK6sPrLYU9jvMxiFsYDT47tYmzZSfyiQe3B/NVw99Z6bnjWnBFDV4qzyHvM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vPMU: Extend vPMU support to version 5
Message-Id: <E1lawg7-0007yr-FE@xenbits.xenproject.org>
Date: Mon, 26 Apr 2021 08:33:15 +0000

commit fb23e8ba230481d2447672368550617e48cdb0aa
Author:     Igor Druzhinin <igor.druzhinin@citrix.com>
AuthorDate: Mon Apr 26 10:21:09 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 26 10:21:09 2021 +0200

    x86/vPMU: Extend vPMU support to version 5
    
    Version 5 is backwards compatible with version 3. This allows to enable
    vPMU on Ice Lake CPUs.
    
    Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/cpu/vpmu_intel.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
index 64334c5fab..f59cae5438 100644
--- a/xen/arch/x86/cpu/vpmu_intel.c
+++ b/xen/arch/x86/cpu/vpmu_intel.c
@@ -839,7 +839,7 @@ int vmx_vpmu_initialise(struct vcpu *v)
         return 0;
 
     if ( v->domain->arch.cpuid->basic.pmu_version <= 1 ||
-         v->domain->arch.cpuid->basic.pmu_version >= 5 )
+         v->domain->arch.cpuid->basic.pmu_version >= 6 )
         return -EINVAL;
 
     if ( (arch_pmc_cnt + fixed_pmc_cnt) == 0 )
@@ -909,8 +909,9 @@ int __init core2_vpmu_init(void)
     switch ( version )
     {
     case 4:
-        printk(XENLOG_INFO "VPMU: PMU version 4 is not fully supported. "
-               "Emulating version 3\n");
+    case 5:
+        printk(XENLOG_INFO "VPMU: PMU version %u is not fully supported. "
+               "Emulating version 3\n", version);
         /* FALLTHROUGH */
 
     case 2:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 26 08:33:27 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Apr 2021 08:33:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.117512.223425 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lawgJ-0002qe-BQ; Mon, 26 Apr 2021 08:33:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 117512.223425; Mon, 26 Apr 2021 08:33:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lawgJ-0002qW-7e; Mon, 26 Apr 2021 08:33:27 +0000
Received: by outflank-mailman (input) for mailman id 117512;
 Mon, 26 Apr 2021 08: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 1lawgH-0002qK-M2
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08: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 1lawgH-0004Lp-LC
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lawgH-000810-KO
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08:33:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=y/kRFPzREMLsJquYBs93qH4Zjm2Dfdmp4tykyHs1qc4=; b=k2XdsIiMrMx8tHEcxcus+rHbZR
	EiOjYNnqpIY2glISTHMQuI8nYpD1lL0NpWHpHcr6/296lYMt6JPOa5CDeL0PZB8hVMXeQswDySgAO
	EwCd5UlGiWglesHRqLJYn/0E74eo4tEEFqdAHjcfNCRRDi/CcvTAWNSajKQ5vfi4kMRo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vtx: add LBR_SELECT to the list of LBR MSRs
Message-Id: <E1lawgH-000810-KO@xenbits.xenproject.org>
Date: Mon, 26 Apr 2021 08:33:25 +0000

commit 08693c03e00ea3448adc4406c891e707f0068eb6
Author:     Igor Druzhinin <igor.druzhinin@citrix.com>
AuthorDate: Mon Apr 26 10:22:04 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 26 10:22:04 2021 +0200

    x86/vtx: add LBR_SELECT to the list of LBR MSRs
    
    This MSR exists since Nehalem / Silvermont and is actively used by Linux,
    for instance, to improve sampling efficiency.
    
    Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/hvm/vmx/vmx.c      | 20 ++++++++++++++++----
 xen/include/asm-x86/msr-index.h | 10 ++++++++--
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index b52824677e..8e0aa976c2 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2898,14 +2898,16 @@ static const struct lbr_info {
 }, nh_lbr[] = {
     { MSR_IA32_LASTINTFROMIP,       1 },
     { MSR_IA32_LASTINTTOIP,         1 },
-    { MSR_C2_LASTBRANCH_TOS,        1 },
+    { MSR_NHL_LBR_SELECT,           1 },
+    { MSR_NHL_LASTBRANCH_TOS,       1 },
     { MSR_P4_LASTBRANCH_0_FROM_LIP, NUM_MSR_P4_LASTBRANCH_FROM_TO },
     { MSR_P4_LASTBRANCH_0_TO_LIP,   NUM_MSR_P4_LASTBRANCH_FROM_TO },
     { 0, 0 }
 }, sk_lbr[] = {
     { MSR_IA32_LASTINTFROMIP,       1 },
     { MSR_IA32_LASTINTTOIP,         1 },
-    { MSR_SKL_LASTBRANCH_TOS,       1 },
+    { MSR_NHL_LBR_SELECT,           1 },
+    { MSR_NHL_LASTBRANCH_TOS,       1 },
     { MSR_SKL_LASTBRANCH_0_FROM_IP, NUM_MSR_SKL_LASTBRANCH },
     { MSR_SKL_LASTBRANCH_0_TO_IP,   NUM_MSR_SKL_LASTBRANCH },
     { MSR_SKL_LASTBRANCH_0_INFO,    NUM_MSR_SKL_LASTBRANCH },
@@ -2917,10 +2919,19 @@ static const struct lbr_info {
     { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
     { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
     { 0, 0 }
+}, sm_lbr[] = {
+    { MSR_IA32_LASTINTFROMIP,       1 },
+    { MSR_IA32_LASTINTTOIP,         1 },
+    { MSR_SM_LBR_SELECT,            1 },
+    { MSR_SM_LASTBRANCH_TOS,        1 },
+    { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
+    { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
+    { 0, 0 }
 }, gm_lbr[] = {
     { MSR_IA32_LASTINTFROMIP,       1 },
     { MSR_IA32_LASTINTTOIP,         1 },
-    { MSR_GM_LASTBRANCH_TOS,        1 },
+    { MSR_SM_LBR_SELECT,            1 },
+    { MSR_SM_LASTBRANCH_TOS,        1 },
     { MSR_GM_LASTBRANCH_0_FROM_IP,  NUM_MSR_GM_LASTBRANCH_FROM_TO },
     { MSR_GM_LASTBRANCH_0_TO_IP,    NUM_MSR_GM_LASTBRANCH_FROM_TO },
     { 0, 0 }
@@ -2974,6 +2985,7 @@ static const struct lbr_info *last_branch_msr_get(void)
             return sk_lbr;
         /* Atom */
         case 0x1c: case 0x26: case 0x27: case 0x35: case 0x36:
+            return at_lbr;
         /* Silvermont */
         case 0x37: case 0x4a: case 0x4d: case 0x5a: case 0x5d:
         /* Xeon Phi Knights Landing */
@@ -2982,7 +2994,7 @@ static const struct lbr_info *last_branch_msr_get(void)
         case 0x85:
         /* Airmont */
         case 0x4c:
-            return at_lbr;
+            return sm_lbr;
         /* Goldmont */
         case 0x5c: case 0x5f:
             return gm_lbr;
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index f2e34dd22b..bd3a3a1e7f 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -603,15 +603,21 @@
 #define NUM_MSR_C2_LASTBRANCH_FROM_TO	4
 #define NUM_MSR_ATOM_LASTBRANCH_FROM_TO	8
 
+/* Nehalem (and newer) last-branch recording */
+#define MSR_NHL_LBR_SELECT		0x000001c8
+#define MSR_NHL_LASTBRANCH_TOS		0x000001c9
+
 /* Skylake (and newer) last-branch recording */
-#define MSR_SKL_LASTBRANCH_TOS		0x000001c9
 #define MSR_SKL_LASTBRANCH_0_FROM_IP	0x00000680
 #define MSR_SKL_LASTBRANCH_0_TO_IP	0x000006c0
 #define MSR_SKL_LASTBRANCH_0_INFO	0x00000dc0
 #define NUM_MSR_SKL_LASTBRANCH		32
 
+/* Silvermont (and newer) last-branch recording */
+#define MSR_SM_LBR_SELECT		0x000001c8
+#define MSR_SM_LASTBRANCH_TOS		0x000001c9
+
 /* Goldmont last-branch recording */
-#define MSR_GM_LASTBRANCH_TOS		0x000001c9
 #define MSR_GM_LASTBRANCH_0_FROM_IP	0x00000680
 #define MSR_GM_LASTBRANCH_0_TO_IP	0x000006c0
 #define NUM_MSR_GM_LASTBRANCH_FROM_TO	32
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 26 08:33:37 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Apr 2021 08:33:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.117513.223430 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lawgT-0002sR-EC; Mon, 26 Apr 2021 08:33:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 117513.223430; Mon, 26 Apr 2021 08:33:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lawgT-0002sJ-Ay; Mon, 26 Apr 2021 08:33:37 +0000
Received: by outflank-mailman (input) for mailman id 117513;
 Mon, 26 Apr 2021 08: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 1lawgR-0002s5-Q8
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08: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 1lawgR-0004MC-PI
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08:33:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lawgR-00081j-Na
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08: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=d9nSKE8GwVl9VT6rxr8zLA6tjRbaRKhcK0Om8evj6Bs=; b=v00ryUikyJdZEaUh+j9VB/U/p6
	CXVD2zYqOZ/EW97edGYcabPuuz3EgS2VTkveSWHBC4vfDK3UUzpOqkbE/ACbIWXU9XWW3hPBN2uJV
	VfVtwmWdzyPMMU1/oD+SMkubSOEXy41AVCb3tnR7YeAHRsv0cPCIZTrSMfBZHGRj76RY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/intel: insert Ice Lake-SP and Ice Lake-D model numbers
Message-Id: <E1lawgR-00081j-Na@xenbits.xenproject.org>
Date: Mon, 26 Apr 2021 08:33:35 +0000

commit 95419adfd4b275cffe24b96edcc2f15bc4db8907
Author:     Igor Druzhinin <igor.druzhinin@citrix.com>
AuthorDate: Mon Apr 26 10:22:48 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 26 10:22:48 2021 +0200

    x86/intel: insert Ice Lake-SP and Ice Lake-D model numbers
    
    LBR, C-state MSRs should correspond to Ice Lake desktop according to
    SDM rev. 74 for both models.
    
    Ice Lake-SP is known to expose IF_PSCHANGE_MC_NO in IA32_ARCH_CAPABILITIES MSR
    (as advisory tells and Whitley SDP confirms) which means the erratum is fixed
    in hardware for that model and therefore it shouldn't be present in
    has_if_pschange_mc list. Provisionally assume the same to be the case
    for Ice Lake-D.
    
    Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/acpi/cpu_idle.c | 2 ++
 xen/arch/x86/hvm/vmx/vmx.c   | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index c092086b33..d788c8bffc 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -181,6 +181,8 @@ static void do_get_hw_residencies(void *arg)
     case 0x55:
     case 0x5E:
     /* Ice Lake */
+    case 0x6A:
+    case 0x6C:
     case 0x7D:
     case 0x7E:
     /* Tiger Lake */
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 8e0aa976c2..dde4f3b70d 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2973,7 +2973,7 @@ static const struct lbr_info *last_branch_msr_get(void)
         /* Goldmont Plus */
         case 0x7a:
         /* Ice Lake */
-        case 0x7d: case 0x7e:
+        case 0x6a: case 0x6c: case 0x7d: case 0x7e:
         /* Tiger Lake */
         case 0x8c: case 0x8d:
         /* Tremont */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 26 08:33:47 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Apr 2021 08:33:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.117514.223434 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lawgd-0002tt-Fb; Mon, 26 Apr 2021 08:33:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 117514.223434; Mon, 26 Apr 2021 08:33:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lawgd-0002tk-CW; Mon, 26 Apr 2021 08:33:47 +0000
Received: by outflank-mailman (input) for mailman id 117514;
 Mon, 26 Apr 2021 08: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 1lawgb-0002tV-Ti
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08: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 1lawgb-0004ML-Ss
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08:33:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lawgb-00082R-RM
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08: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=CeQVYcQpdmn8ITFBf0V2R/I3Qper+Ou0yp2GwxhqMEM=; b=xisRe9beWr9xUK7lb5LNni+WmP
	ekCJFCFd8Mk3XX0z9TLyZKs8WoJmN8QCmOqr978QumMOO8sAbRTr2YCm2jqwtqldD0E/f7d+RT16S
	TAo4xWuYFIk+xubz2IuMzhNWb/xQ/R7xBHQyvw5jjBtrF7ozZsyGFvgmjiYVfL/tO0yY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/EFI: sections may not live at VA 0 in PE binaries
Message-Id: <E1lawgb-00082R-RM@xenbits.xenproject.org>
Date: Mon, 26 Apr 2021 08:33:45 +0000

commit 940f22732ad1f018c87c8decf88b0efeaa3a2b0e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 26 10:24:20 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 26 10:24:20 2021 +0200

    x86/EFI: sections may not live at VA 0 in PE binaries
    
    PE binaries specify section addresses by (32-bit) RVA. GNU ld up to at
    least 2.36 would silently truncate the (negative) difference when a
    section is placed below the image base. Such sections would also be
    wrongly placed ahead of all "normal" ones. Since, for the time being,
    we build xen.efi with --strip-debug anyway, .stab* can't appear. And
    .comment has an entry in /DISCARD/ already anyway in the EFI case.
    
    Because of their unclear origin, keep the directives for the ELF case
    though.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/xen.lds.S | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 5fadb02b7f..6346862250 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -350,6 +350,7 @@ SECTIONS
 #endif
   }
 
+#ifndef EFI
   /* Stabs debugging sections.  */
   .stab 0 : { *(.stab) }
   .stabstr 0 : { *(.stabstr) }
@@ -358,6 +359,7 @@ SECTIONS
   .stab.index 0 : { *(.stab.index) }
   .stab.indexstr 0 : { *(.stab.indexstr) }
   .comment 0 : { *(.comment) }
+#endif
 }
 
 ASSERT(__2M_rwdata_end <= XEN_VIRT_END - XEN_VIRT_START + __XEN_VIRT_START -
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 26 08:33:57 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Apr 2021 08:33:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.117515.223438 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lawgn-0002vC-HO; Mon, 26 Apr 2021 08:33:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 117515.223438; Mon, 26 Apr 2021 08: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 1lawgn-0002v4-E4; Mon, 26 Apr 2021 08:33:57 +0000
Received: by outflank-mailman (input) for mailman id 117515;
 Mon, 26 Apr 2021 08:33:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lawgm-0002us-1B
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08:33:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lawgm-0004MV-0G
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08:33:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lawgl-00083B-V0
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08: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=CtcsZru+O5wRLRYEhTeXvoQxcQ9PzJKwaPEqAuQTQZk=; b=IjE5THKw70A+7FN0OcljjkgRMl
	AkzpzZNkCa+kjYgi0bOPRNOny/Z/+cjwlvWkr84EK5Q8guzs67nE0SmGb9Q1OyzzReXax7/Ij0H6i
	JVo81GJGv1TB+KBDSlSVfIClgLQNJ5VEAFy7OIiuJBo1ZLR+56emeC4zJfz4VfbFEiC4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/EFI: keep debug info in xen.efi
Message-Id: <E1lawgl-00083B-V0@xenbits.xenproject.org>
Date: Mon, 26 Apr 2021 08:33:55 +0000

commit 1df03bc5958e3d8d1f2669426cd5b1353690505b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 26 10:25:10 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 26 10:25:10 2021 +0200

    x86/EFI: keep debug info in xen.efi
    
    ... provided the linker supports it (which it does as of commit
    2dfa8341e079 ["ELF DWARF in PE output"]).
    
    Without mentioning debugging sections, the linker would put them at
    VA 0, thus making them unreachable by 32-bit (relative or absolute)
    relocations. If relocations were resolvable (or absent) the resulting
    binary would have invalid section RVAs (0 - __image_base__, truncated to
    32 bits). Mentioning debugging sections without specifying an address
    will result in the linker putting them all on the same RVA. A loader is,
    afaict, free to reject loading such an image, as sections shouldn't
    overlap. (The above describes GNU ld 2.36 behavior, which - if deemed
    buggy - could change.)
    
    Make sure our up-to-16Mb padding doesn't unnecessarily further extend
    the image.
    
    Take the opportunity and also switch to using $(call ld-option,...).
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/Makefile  | 13 ++++++++--
 xen/arch/x86/xen.lds.S | 68 +++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 75 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 5b47206ad1..ada085d17a 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -129,8 +129,14 @@ export XEN_BUILD_EFI := $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o efi/check.
 CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
 
 # Check if the linker supports PE.
-EFI_LDFLAGS = $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=10 --strip-debug
-XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) $(EFI_LDFLAGS) -o efi/check.efi efi/check.o 2>/dev/null && echo y))
+EFI_LDFLAGS = $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=10
+XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o efi/check.efi efi/check.o))
+# If the above failed, it may be merely because of the linker not dealing well
+# with debug info. Try again with stripping it.
+ifeq ($(CONFIG_DEBUG_INFO)-$(XEN_BUILD_PE),y-n)
+EFI_LDFLAGS += --strip-debug
+XEN_BUILD_PE := $(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o efi/check.efi efi/check.o)
+endif
 
 ifeq ($(XEN_BUILD_PE),y)
 
@@ -235,6 +241,9 @@ note_file_option ?= $(note_file)
 
 ifeq ($(XEN_BUILD_PE),y)
 $(TARGET).efi: prelink.o $(note_file) efi.lds efi/relocs-dummy.o efi/mkreloc
+ifeq ($(CONFIG_DEBUG_INFO),y)
+	$(if $(filter --strip-debug,$(EFI_LDFLAGS)),echo,:) "Will strip debug info from $(@F)"
+endif
 	$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
 	          $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< $(relocs-dummy) \
 	                $(BASEDIR)/common/symbols-dummy.o $(note_file_option) -o $(@D)/.$(@F).$(base).0 &&) :
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 6346862250..bc53ee4597 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -312,10 +312,70 @@ SECTIONS
     *(.reloc)
     __base_relocs_end = .;
   }
-  /* Trick the linker into setting the image size to exactly 16Mb. */
-  . = ALIGN(__section_alignment__);
-  DECL_SECTION(.pad) {
-    . = ALIGN(MB(16));
+  /*
+   * Explicitly list debug section for the PE output so that they don't end
+   * up at VA 0 which is below image base and thus invalid. Also use the
+   * NOLOAD directive, despite currently ignored by ld for PE output, in
+   * order to record that we'd prefer these sections to not be loaded into
+   * memory.
+   *
+   * Note that we're past _end here, so if these sections get loaded they'll
+   * be discarded at runtime anyway.
+   */
+  .debug_abbrev ALIGN(1) (NOLOAD) : {
+     *(.debug_abbrev)
+  }
+  .debug_info ALIGN(1) (NOLOAD) : {
+    *(.debug_info)
+    *(.gnu.linkonce.wi.*)
+  }
+  .debug_types ALIGN(1) (NOLOAD) : {
+    *(.debug_types)
+  }
+  .debug_str ALIGN(1) (NOLOAD) : {
+    *(.debug_str)
+  }
+  .debug_line ALIGN(1) (NOLOAD) : {
+    *(.debug_line)
+    *(.debug_line.*)
+  }
+  .debug_line_str ALIGN(1) (NOLOAD) : {
+    *(.debug_line_str)
+  }
+  .debug_names ALIGN(4) (NOLOAD) : {
+    *(.debug_names)
+  }
+  .debug_frame ALIGN(4) (NOLOAD) : {
+    *(.debug_frame)
+  }
+  .debug_loc ALIGN(1) (NOLOAD) : {
+    *(.debug_loc)
+  }
+  .debug_loclists ALIGN(4) (NOLOAD) : {
+    *(.debug_loclists)
+  }
+  .debug_ranges ALIGN(8) (NOLOAD) : {
+    *(.debug_ranges)
+  }
+  .debug_rnglists ALIGN(4) (NOLOAD) : {
+    *(.debug_rnglists)
+  }
+  .debug_addr ALIGN(8) (NOLOAD) : {
+    *(.debug_addr)
+  }
+  .debug_aranges ALIGN(1) (NOLOAD) : {
+    *(.debug_aranges)
+  }
+  .debug_pubnames ALIGN(1) (NOLOAD) : {
+    *(.debug_pubnames)
+  }
+  .debug_pubtypes ALIGN(1) (NOLOAD) : {
+    *(.debug_pubtypes)
+  }
+  /* Trick the linker into setting the image size to no less than 16Mb. */
+  __image_end__ = .;
+  .pad ALIGN(__section_alignment__) : {
+    . = __image_end__ < __image_base__ + MB(16) ? ALIGN(MB(16)) : .;
   }
 #elif defined(XEN_BUILD_EFI)
   /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Apr 26 08:34:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Apr 2021 08:34:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.117516.223443 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lawgx-0002wa-J8; Mon, 26 Apr 2021 08:34:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 117516.223443; Mon, 26 Apr 2021 08:34:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lawgx-0002wQ-Fg; Mon, 26 Apr 2021 08:34:07 +0000
Received: by outflank-mailman (input) for mailman id 117516;
 Mon, 26 Apr 2021 08:34:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lawgw-0002wE-41
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08:34:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lawgw-0004Mp-3E
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08:34:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lawgw-00084E-2R
 for xen-changelog@lists.xenproject.org; Mon, 26 Apr 2021 08:34:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6gCD32m3UIQCSPnS/XzPgTKRP5Xd6B30It0gLw55PKY=; b=jEgme+61lG6ijdfoiG/Di1mznQ
	zszPrviVsCTUsOCxEMqhRD+tN28hqrFuHW52iCeiyIjZvPdYlqproJDCkz8NiwL7VRBlosO3PKW+W
	YEkgmssJ8py52v3zuof/0y2QYaJDnwhm559aYcjgY1sITB5IfNOtbuodlyuX5N8SpiX8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/EFI: don't have an overly large image size
Message-Id: <E1lawgw-00084E-2R@xenbits.xenproject.org>
Date: Mon, 26 Apr 2021 08:34:06 +0000

commit 11e7f0fe72ca0060762d18268e0388731fe8ccb6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 26 10:26:04 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 26 10:26:04 2021 +0200

    x86/EFI: don't have an overly large image size
    
    While without debug info the difference is benign (so far), since we pad
    the image to 16Mb anyway, forcing the .reloc section to a 2Mb boundary
    causes subsequent .debug_* sections to go farther beyond 16Mb than
    needed. There's no reason to advance . for establishing __2M_rwdata_end,
    as all data past _end is of no interest at runtime anymore anyway.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/xen.lds.S | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index bc53ee4597..34f647a44e 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -303,8 +303,7 @@ SECTIONS
   } PHDR(text)
   _end = . ;
 
-  . = ALIGN(SECTION_ALIGN);
-  __2M_rwdata_end = .;
+  __2M_rwdata_end = ALIGN(SECTION_ALIGN);
 
 #ifdef EFI
   .reloc ALIGN(4) : {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 27 08:33:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Apr 2021 08:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.118093.224055 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbJ9T-0000ji-M9; Tue, 27 Apr 2021 08:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 118093.224055; Tue, 27 Apr 2021 08: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 1lbJ9T-0000ja-J7; Tue, 27 Apr 2021 08:33:03 +0000
Received: by outflank-mailman (input) for mailman id 118093;
 Tue, 27 Apr 2021 08: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 1lbJ9S-0000jV-Q2
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08: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 1lbJ9S-0002sS-PK
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbJ9S-0006os-OY
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08: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=fe9figToO+/bDs1NI1gU4UAh+YuJcnQWTSTlM4kGjq8=; b=2SleIY+2jSVhd9GanZw2GojvGX
	mNCqhePtXcK51OrGT44rn6DlxRkiqD9hnC5QoxjHsvT8R9daY/mKDdqNj7H8pcrtZZW1cPW6bkNNU
	g1HQLIKfA6ARDr1KnOHIj8YUL76qWUeUu4uIFzRPJrK8hNxkGy6zqCk+C16OrN5nwqkI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VT-d: Don't assume register-based invalidation is always supported
Message-Id: <E1lbJ9S-0006os-OY@xenbits.xenproject.org>
Date: Tue, 27 Apr 2021 08:33:02 +0000

commit 6773b1a7584a75a486e9774541ad5bd84c9aa5ee
Author:     Chao Gao <chao.gao@intel.com>
AuthorDate: Mon Apr 26 10:16:50 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 26 10:16:50 2021 +0200

    VT-d: Don't assume register-based invalidation is always supported
    
    According to Intel VT-d SPEC rev3.3 Section 6.5, Register-based Invalidation
    isn't supported by Intel VT-d version 6 and beyond.
    
    This hardware change impacts following two scenarios: admin can disable
    queued invalidation via 'qinval' cmdline and use register-based interface;
    VT-d switches to register-based invalidation when queued invalidation needs
    to be disabled, for example, during disabling x2apic or during system
    suspension or after enabling queued invalidation fails.
    
    To deal with this hardware change, if register-based invalidation isn't
    supported, queued invalidation cannot be disabled through Xen cmdline; and
    if queued invalidation has to be disabled temporarily in some scenarios,
    VT-d won't switch to register-based interface but use some dummy functions
    to catch errors in case there is any invalidation request issued when queued
    invalidation is disabled.
    
    Signed-off-by: Chao Gao <chao.gao@intel.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 docs/misc/xen-command-line.pandoc    |  4 +++-
 xen/drivers/passthrough/vtd/iommu.c  | 27 +++++++++++++++++++++++++--
 xen/drivers/passthrough/vtd/iommu.h  |  7 +++++++
 xen/drivers/passthrough/vtd/qinval.c | 33 +++++++++++++++++++++++++++++++--
 4 files changed, 66 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index a4bd3f12c5..c32a397a12 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1458,7 +1458,9 @@ The following options are specific to Intel VT-d hardware:
 *   The `qinval` boolean controls the Queued Invalidation sub-feature, and is
     active by default on compatible hardware.  Queued Invalidation is a
     feature in second-generation IOMMUs and is a functional prerequisite for
-    Interrupt Remapping.
+    Interrupt Remapping. Note that Xen disregards this setting for Intel VT-d
+    version 6 and greater as Registered-Based Invalidation isn't supported
+    by them.
 
 *   The `igfx` boolean is active by default, and controls whether the IOMMU in
     front of an Intel Graphics Device is enabled or not.
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index b2ca152e1f..82ae2f5e97 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1185,6 +1185,14 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
 
     iommu->cap = dmar_readq(iommu->reg, DMAR_CAP_REG);
     iommu->ecap = dmar_readq(iommu->reg, DMAR_ECAP_REG);
+    iommu->version = dmar_readl(iommu->reg, DMAR_VER_REG);
+
+    if ( !iommu_qinval && !has_register_based_invalidation(iommu) )
+    {
+        printk(XENLOG_WARNING VTDPREFIX "IOMMU %d: cannot disable Queued Invalidation\n",
+               iommu->index);
+        iommu_qinval = true;
+    }
 
     if ( iommu_verbose )
     {
@@ -2133,6 +2141,10 @@ static int __must_check init_vtd_hw(bool resume)
          */
         if ( enable_qinval(iommu) != 0 )
         {
+            /* Ensure register-based invalidation is available */
+            if ( !has_register_based_invalidation(iommu) )
+                return -EIO;
+
             iommu->flush.context = vtd_flush_context_reg;
             iommu->flush.iotlb   = vtd_flush_iotlb_reg;
         }
@@ -2227,6 +2239,7 @@ static int __init vtd_setup(void)
     struct acpi_drhd_unit *drhd;
     struct vtd_iommu *iommu;
     int ret;
+    bool reg_inval_supported = true;
 
     if ( list_empty(&acpi_drhd_units) )
     {
@@ -2255,8 +2268,8 @@ static int __init vtd_setup(void)
     }
 
     /* We enable the following features only if they are supported by all VT-d
-     * engines: Snoop Control, DMA passthrough, Queued Invalidation, Interrupt
-     * Remapping, and Posted Interrupt
+     * engines: Snoop Control, DMA passthrough, Register-based Invalidation,
+     * Queued Invalidation, Interrupt Remapping, and Posted Interrupt.
      */
     for_each_drhd_unit ( drhd )
     {
@@ -2278,6 +2291,9 @@ static int __init vtd_setup(void)
         if ( iommu_qinval && !ecap_queued_inval(iommu->ecap) )
             iommu_qinval = 0;
 
+        if ( !has_register_based_invalidation(iommu) )
+            reg_inval_supported = false;
+
         if ( iommu_intremap && !ecap_intr_remap(iommu->ecap) )
             iommu_intremap = iommu_intremap_off;
 
@@ -2304,6 +2320,13 @@ static int __init vtd_setup(void)
 
     softirq_tasklet_init(&vtd_fault_tasklet, do_iommu_page_fault, NULL);
 
+    if ( !iommu_qinval && !reg_inval_supported )
+    {
+        dprintk(XENLOG_ERR VTDPREFIX, "No available invalidation interface\n");
+        ret = -ENODEV;
+        goto error;
+    }
+
     if ( !iommu_qinval && iommu_intremap )
     {
         iommu_intremap = iommu_intremap_off;
diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h
index aaf9e864ff..68b3c76ea9 100644
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -526,6 +526,7 @@ struct vtd_iommu {
     struct list_head ats_devices;
     unsigned long *domid_bitmap;  /* domain id bitmap */
     u16 *domid_map;               /* domain id mapping array */
+    uint32_t version;
 };
 
 #define INTEL_IOMMU_DEBUG(fmt, args...) \
@@ -535,4 +536,10 @@ struct vtd_iommu {
             dprintk(XENLOG_WARNING VTDPREFIX, fmt, ## args);    \
     } while(0)
 
+/* Register-based invalidation isn't supported by VT-d version 6 and beyond. */
+static inline bool has_register_based_invalidation(const struct vtd_iommu *vtd)
+{
+    return VER_MAJOR(vtd->version) < 6;
+}
+
 #endif
diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c
index c0ea19d4bd..0976def43d 100644
--- a/xen/drivers/passthrough/vtd/qinval.c
+++ b/xen/drivers/passthrough/vtd/qinval.c
@@ -434,6 +434,23 @@ int enable_qinval(struct vtd_iommu *iommu)
     return 0;
 }
 
+static int vtd_flush_context_noop(struct vtd_iommu *iommu, uint16_t did,
+                                  uint16_t source_id, uint8_t function_mask,
+                                  uint64_t type, bool flush_non_present_entry)
+{
+    WARN();
+    return -EIO;
+}
+
+static int vtd_flush_iotlb_noop(struct vtd_iommu *iommu, uint16_t did,
+                                uint64_t addr, unsigned int size_order,
+                                uint64_t type, bool flush_non_present_entry,
+                                bool flush_dev_iotlb)
+{
+    WARN();
+    return -EIO;
+}
+
 void disable_qinval(struct vtd_iommu *iommu)
 {
     u32 sts;
@@ -455,6 +472,18 @@ void disable_qinval(struct vtd_iommu *iommu)
 out:
     spin_unlock_irqrestore(&iommu->register_lock, flags);
 
-    iommu->flush.context = vtd_flush_context_reg;
-    iommu->flush.iotlb   = vtd_flush_iotlb_reg;
+    /*
+     * Assign callbacks to noop to catch errors if register-based invalidation
+     * isn't supported.
+     */
+    if ( has_register_based_invalidation(iommu) )
+    {
+        iommu->flush.context = vtd_flush_context_reg;
+        iommu->flush.iotlb   = vtd_flush_iotlb_reg;
+    }
+    else
+    {
+        iommu->flush.context = vtd_flush_context_noop;
+        iommu->flush.iotlb   = vtd_flush_iotlb_noop;
+    }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Apr 27 08:33:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Apr 2021 08:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.118094.224059 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbJ9d-0000kb-O9; Tue, 27 Apr 2021 08:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 118094.224059; Tue, 27 Apr 2021 08: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 1lbJ9d-0000kT-Ki; Tue, 27 Apr 2021 08:33:13 +0000
Received: by outflank-mailman (input) for mailman id 118094;
 Tue, 27 Apr 2021 08: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 1lbJ9c-0000kN-Ti
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08: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 1lbJ9c-0002sc-T4
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbJ9c-0006pf-Rf
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08: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=pc1P4OhaXqdIsQanpMxBz7WX9nYnm0h1k7uEA+qn7rI=; b=HtY6R+Jx9cEubRYrlGsKGqu0Ut
	BxaG7W5snEeFJPFO4TG/1J2VDIFhX6hwL4cw7qg5xCKCAfmaETyayj18y41gFW2PlshKBWfT9XIib
	voBDXSJpIpeBplD50YONQlfOx7xNbGqewXbJbtIciuvKbrIv4e4Gmb0vsn1H7bKMVeCs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vPMU: Extend vPMU support to version 5
Message-Id: <E1lbJ9c-0006pf-Rf@xenbits.xenproject.org>
Date: Tue, 27 Apr 2021 08:33:12 +0000

commit fb23e8ba230481d2447672368550617e48cdb0aa
Author:     Igor Druzhinin <igor.druzhinin@citrix.com>
AuthorDate: Mon Apr 26 10:21:09 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 26 10:21:09 2021 +0200

    x86/vPMU: Extend vPMU support to version 5
    
    Version 5 is backwards compatible with version 3. This allows to enable
    vPMU on Ice Lake CPUs.
    
    Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/cpu/vpmu_intel.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
index 64334c5fab..f59cae5438 100644
--- a/xen/arch/x86/cpu/vpmu_intel.c
+++ b/xen/arch/x86/cpu/vpmu_intel.c
@@ -839,7 +839,7 @@ int vmx_vpmu_initialise(struct vcpu *v)
         return 0;
 
     if ( v->domain->arch.cpuid->basic.pmu_version <= 1 ||
-         v->domain->arch.cpuid->basic.pmu_version >= 5 )
+         v->domain->arch.cpuid->basic.pmu_version >= 6 )
         return -EINVAL;
 
     if ( (arch_pmc_cnt + fixed_pmc_cnt) == 0 )
@@ -909,8 +909,9 @@ int __init core2_vpmu_init(void)
     switch ( version )
     {
     case 4:
-        printk(XENLOG_INFO "VPMU: PMU version 4 is not fully supported. "
-               "Emulating version 3\n");
+    case 5:
+        printk(XENLOG_INFO "VPMU: PMU version %u is not fully supported. "
+               "Emulating version 3\n", version);
         /* FALLTHROUGH */
 
     case 2:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Apr 27 08:33:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Apr 2021 08:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.118095.224063 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbJ9n-0000lu-PN; Tue, 27 Apr 2021 08:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 118095.224063; Tue, 27 Apr 2021 08: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 1lbJ9n-0000lm-MG; Tue, 27 Apr 2021 08:33:23 +0000
Received: by outflank-mailman (input) for mailman id 118095;
 Tue, 27 Apr 2021 08:33:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbJ9n-0000lg-40
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08:33:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbJ9n-0002sq-0B
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08:33:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbJ9m-0006ry-VV
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08: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=yNt2lWMJMvwMZg9t6pN8Qlq+n8FaXM/qFlcgEG6jjcw=; b=ublQlc5AHKmKju55BfC2cjrGkk
	Ae4yLjS/cF0WPGNrpDwS+4wHai/gol8aTflQvQD0GPXoZidD37t2+yqDMjRZ3EVn8m0dwA4xY2lzr
	yMOVXkRQjP8KGPJ5p/chhXJX9A+VTg3yovvgw8NkGU0KepKXvgsPMQVrgd1Gi0kQHsTw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vtx: add LBR_SELECT to the list of LBR MSRs
Message-Id: <E1lbJ9m-0006ry-VV@xenbits.xenproject.org>
Date: Tue, 27 Apr 2021 08:33:22 +0000

commit 08693c03e00ea3448adc4406c891e707f0068eb6
Author:     Igor Druzhinin <igor.druzhinin@citrix.com>
AuthorDate: Mon Apr 26 10:22:04 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 26 10:22:04 2021 +0200

    x86/vtx: add LBR_SELECT to the list of LBR MSRs
    
    This MSR exists since Nehalem / Silvermont and is actively used by Linux,
    for instance, to improve sampling efficiency.
    
    Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/hvm/vmx/vmx.c      | 20 ++++++++++++++++----
 xen/include/asm-x86/msr-index.h | 10 ++++++++--
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index b52824677e..8e0aa976c2 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2898,14 +2898,16 @@ static const struct lbr_info {
 }, nh_lbr[] = {
     { MSR_IA32_LASTINTFROMIP,       1 },
     { MSR_IA32_LASTINTTOIP,         1 },
-    { MSR_C2_LASTBRANCH_TOS,        1 },
+    { MSR_NHL_LBR_SELECT,           1 },
+    { MSR_NHL_LASTBRANCH_TOS,       1 },
     { MSR_P4_LASTBRANCH_0_FROM_LIP, NUM_MSR_P4_LASTBRANCH_FROM_TO },
     { MSR_P4_LASTBRANCH_0_TO_LIP,   NUM_MSR_P4_LASTBRANCH_FROM_TO },
     { 0, 0 }
 }, sk_lbr[] = {
     { MSR_IA32_LASTINTFROMIP,       1 },
     { MSR_IA32_LASTINTTOIP,         1 },
-    { MSR_SKL_LASTBRANCH_TOS,       1 },
+    { MSR_NHL_LBR_SELECT,           1 },
+    { MSR_NHL_LASTBRANCH_TOS,       1 },
     { MSR_SKL_LASTBRANCH_0_FROM_IP, NUM_MSR_SKL_LASTBRANCH },
     { MSR_SKL_LASTBRANCH_0_TO_IP,   NUM_MSR_SKL_LASTBRANCH },
     { MSR_SKL_LASTBRANCH_0_INFO,    NUM_MSR_SKL_LASTBRANCH },
@@ -2917,10 +2919,19 @@ static const struct lbr_info {
     { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
     { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
     { 0, 0 }
+}, sm_lbr[] = {
+    { MSR_IA32_LASTINTFROMIP,       1 },
+    { MSR_IA32_LASTINTTOIP,         1 },
+    { MSR_SM_LBR_SELECT,            1 },
+    { MSR_SM_LASTBRANCH_TOS,        1 },
+    { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
+    { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
+    { 0, 0 }
 }, gm_lbr[] = {
     { MSR_IA32_LASTINTFROMIP,       1 },
     { MSR_IA32_LASTINTTOIP,         1 },
-    { MSR_GM_LASTBRANCH_TOS,        1 },
+    { MSR_SM_LBR_SELECT,            1 },
+    { MSR_SM_LASTBRANCH_TOS,        1 },
     { MSR_GM_LASTBRANCH_0_FROM_IP,  NUM_MSR_GM_LASTBRANCH_FROM_TO },
     { MSR_GM_LASTBRANCH_0_TO_IP,    NUM_MSR_GM_LASTBRANCH_FROM_TO },
     { 0, 0 }
@@ -2974,6 +2985,7 @@ static const struct lbr_info *last_branch_msr_get(void)
             return sk_lbr;
         /* Atom */
         case 0x1c: case 0x26: case 0x27: case 0x35: case 0x36:
+            return at_lbr;
         /* Silvermont */
         case 0x37: case 0x4a: case 0x4d: case 0x5a: case 0x5d:
         /* Xeon Phi Knights Landing */
@@ -2982,7 +2994,7 @@ static const struct lbr_info *last_branch_msr_get(void)
         case 0x85:
         /* Airmont */
         case 0x4c:
-            return at_lbr;
+            return sm_lbr;
         /* Goldmont */
         case 0x5c: case 0x5f:
             return gm_lbr;
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index f2e34dd22b..bd3a3a1e7f 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -603,15 +603,21 @@
 #define NUM_MSR_C2_LASTBRANCH_FROM_TO	4
 #define NUM_MSR_ATOM_LASTBRANCH_FROM_TO	8
 
+/* Nehalem (and newer) last-branch recording */
+#define MSR_NHL_LBR_SELECT		0x000001c8
+#define MSR_NHL_LASTBRANCH_TOS		0x000001c9
+
 /* Skylake (and newer) last-branch recording */
-#define MSR_SKL_LASTBRANCH_TOS		0x000001c9
 #define MSR_SKL_LASTBRANCH_0_FROM_IP	0x00000680
 #define MSR_SKL_LASTBRANCH_0_TO_IP	0x000006c0
 #define MSR_SKL_LASTBRANCH_0_INFO	0x00000dc0
 #define NUM_MSR_SKL_LASTBRANCH		32
 
+/* Silvermont (and newer) last-branch recording */
+#define MSR_SM_LBR_SELECT		0x000001c8
+#define MSR_SM_LASTBRANCH_TOS		0x000001c9
+
 /* Goldmont last-branch recording */
-#define MSR_GM_LASTBRANCH_TOS		0x000001c9
 #define MSR_GM_LASTBRANCH_0_FROM_IP	0x00000680
 #define MSR_GM_LASTBRANCH_0_TO_IP	0x000006c0
 #define NUM_MSR_GM_LASTBRANCH_FROM_TO	32
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Apr 27 08:33:33 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Apr 2021 08:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.118096.224066 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbJ9x-0000nL-Qu; Tue, 27 Apr 2021 08:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 118096.224066; Tue, 27 Apr 2021 08: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 1lbJ9x-0000nD-O6; Tue, 27 Apr 2021 08:33:33 +0000
Received: by outflank-mailman (input) for mailman id 118096;
 Tue, 27 Apr 2021 08:33:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbJ9x-0000n5-4N
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08:33:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbJ9x-0002t1-3a
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08:33:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbJ9x-0006si-2a
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08:33:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7U2Uepx6Il4m/JtiJSMuTNzmawy65lLXSFy+FD4VBjk=; b=ELfSv6PQMiVKvnkbULGX4udKR2
	Y95SSYdmpBoVC9xzbDwIOO0Hz+qnqf4kvfsrGICJb/kTID2wC89W8QX8J8qmvn7/WaVJ2Ysg1nEah
	c9hIja2iEr3mETlbI6WHwtyQH58utDXnZ8oIaxE7l4ah75B/sdJReqcjYc6ZtDzXr3FI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/intel: insert Ice Lake-SP and Ice Lake-D model numbers
Message-Id: <E1lbJ9x-0006si-2a@xenbits.xenproject.org>
Date: Tue, 27 Apr 2021 08:33:33 +0000

commit 95419adfd4b275cffe24b96edcc2f15bc4db8907
Author:     Igor Druzhinin <igor.druzhinin@citrix.com>
AuthorDate: Mon Apr 26 10:22:48 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 26 10:22:48 2021 +0200

    x86/intel: insert Ice Lake-SP and Ice Lake-D model numbers
    
    LBR, C-state MSRs should correspond to Ice Lake desktop according to
    SDM rev. 74 for both models.
    
    Ice Lake-SP is known to expose IF_PSCHANGE_MC_NO in IA32_ARCH_CAPABILITIES MSR
    (as advisory tells and Whitley SDP confirms) which means the erratum is fixed
    in hardware for that model and therefore it shouldn't be present in
    has_if_pschange_mc list. Provisionally assume the same to be the case
    for Ice Lake-D.
    
    Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/acpi/cpu_idle.c | 2 ++
 xen/arch/x86/hvm/vmx/vmx.c   | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index c092086b33..d788c8bffc 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -181,6 +181,8 @@ static void do_get_hw_residencies(void *arg)
     case 0x55:
     case 0x5E:
     /* Ice Lake */
+    case 0x6A:
+    case 0x6C:
     case 0x7D:
     case 0x7E:
     /* Tiger Lake */
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 8e0aa976c2..dde4f3b70d 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2973,7 +2973,7 @@ static const struct lbr_info *last_branch_msr_get(void)
         /* Goldmont Plus */
         case 0x7a:
         /* Ice Lake */
-        case 0x7d: case 0x7e:
+        case 0x6a: case 0x6c: case 0x7d: case 0x7e:
         /* Tiger Lake */
         case 0x8c: case 0x8d:
         /* Tremont */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Apr 27 08:33:43 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Apr 2021 08:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.118097.224070 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbJA7-0000pE-SX; Tue, 27 Apr 2021 08:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 118097.224070; Tue, 27 Apr 2021 08:33:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbJA7-0000p6-Pa; Tue, 27 Apr 2021 08:33:43 +0000
Received: by outflank-mailman (input) for mailman id 118097;
 Tue, 27 Apr 2021 08:33:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbJA7-0000oi-7c
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08:33:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbJA7-0002tF-6W
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08:33:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbJA7-0006tR-5h
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08:33:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=M3VGK5P5+YK7GgWNC6N8JxKVy62xEMfJJByzv8j1GYQ=; b=obp4Cl5JjiB/l0loiXNgv6eva4
	pvRgLrRJA03syMJ3w13N/ucoXtulV8ZyqEjLUQzFomW6LBLY0ud0A4oiwte69j3FoGNF9msEroi0M
	yXd2PPk8XukC3OuE2YSBRrpoOhSnCXWIdp3h5xBr7FIZ5laW8Yd18xFs5TqR43UeLOPE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/EFI: sections may not live at VA 0 in PE binaries
Message-Id: <E1lbJA7-0006tR-5h@xenbits.xenproject.org>
Date: Tue, 27 Apr 2021 08:33:43 +0000

commit 940f22732ad1f018c87c8decf88b0efeaa3a2b0e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 26 10:24:20 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 26 10:24:20 2021 +0200

    x86/EFI: sections may not live at VA 0 in PE binaries
    
    PE binaries specify section addresses by (32-bit) RVA. GNU ld up to at
    least 2.36 would silently truncate the (negative) difference when a
    section is placed below the image base. Such sections would also be
    wrongly placed ahead of all "normal" ones. Since, for the time being,
    we build xen.efi with --strip-debug anyway, .stab* can't appear. And
    .comment has an entry in /DISCARD/ already anyway in the EFI case.
    
    Because of their unclear origin, keep the directives for the ELF case
    though.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/xen.lds.S | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 5fadb02b7f..6346862250 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -350,6 +350,7 @@ SECTIONS
 #endif
   }
 
+#ifndef EFI
   /* Stabs debugging sections.  */
   .stab 0 : { *(.stab) }
   .stabstr 0 : { *(.stabstr) }
@@ -358,6 +359,7 @@ SECTIONS
   .stab.index 0 : { *(.stab.index) }
   .stab.indexstr 0 : { *(.stab.indexstr) }
   .comment 0 : { *(.comment) }
+#endif
 }
 
 ASSERT(__2M_rwdata_end <= XEN_VIRT_END - XEN_VIRT_START + __XEN_VIRT_START -
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Apr 27 08:33:53 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Apr 2021 08:33:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.118098.224075 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbJAH-0000qI-Ud; Tue, 27 Apr 2021 08:33:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 118098.224075; Tue, 27 Apr 2021 08:33:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbJAH-0000q5-R5; Tue, 27 Apr 2021 08:33:53 +0000
Received: by outflank-mailman (input) for mailman id 118098;
 Tue, 27 Apr 2021 08:33:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbJAH-0000q0-A2
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08:33:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbJAH-0002tg-9J
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08:33:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbJAH-0006uG-8c
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08:33:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KaJjrqegz8niBLhNdjFZu2edXbIPfOeTaNCAm/Ig+UE=; b=aegfYy3k3ZSbu0ks0hLYBOm2zR
	Wfr2DEBXpAWyqaGUktl9Yirc/0GH7LixZ2nzdiH48agLXVZRuzh6kurXYYm2nDGsr5CJDILLUUkhT
	R6UB2Fbc1ca/QCy2oDXpu2KUsYaVKrHJKKv1kRJlj5trZAzU+S965puTHQnceOm6t+Q4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/EFI: keep debug info in xen.efi
Message-Id: <E1lbJAH-0006uG-8c@xenbits.xenproject.org>
Date: Tue, 27 Apr 2021 08:33:53 +0000

commit 1df03bc5958e3d8d1f2669426cd5b1353690505b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 26 10:25:10 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 26 10:25:10 2021 +0200

    x86/EFI: keep debug info in xen.efi
    
    ... provided the linker supports it (which it does as of commit
    2dfa8341e079 ["ELF DWARF in PE output"]).
    
    Without mentioning debugging sections, the linker would put them at
    VA 0, thus making them unreachable by 32-bit (relative or absolute)
    relocations. If relocations were resolvable (or absent) the resulting
    binary would have invalid section RVAs (0 - __image_base__, truncated to
    32 bits). Mentioning debugging sections without specifying an address
    will result in the linker putting them all on the same RVA. A loader is,
    afaict, free to reject loading such an image, as sections shouldn't
    overlap. (The above describes GNU ld 2.36 behavior, which - if deemed
    buggy - could change.)
    
    Make sure our up-to-16Mb padding doesn't unnecessarily further extend
    the image.
    
    Take the opportunity and also switch to using $(call ld-option,...).
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/Makefile  | 13 ++++++++--
 xen/arch/x86/xen.lds.S | 68 +++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 75 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 5b47206ad1..ada085d17a 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -129,8 +129,14 @@ export XEN_BUILD_EFI := $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o efi/check.
 CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
 
 # Check if the linker supports PE.
-EFI_LDFLAGS = $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=10 --strip-debug
-XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) $(EFI_LDFLAGS) -o efi/check.efi efi/check.o 2>/dev/null && echo y))
+EFI_LDFLAGS = $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=10
+XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o efi/check.efi efi/check.o))
+# If the above failed, it may be merely because of the linker not dealing well
+# with debug info. Try again with stripping it.
+ifeq ($(CONFIG_DEBUG_INFO)-$(XEN_BUILD_PE),y-n)
+EFI_LDFLAGS += --strip-debug
+XEN_BUILD_PE := $(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o efi/check.efi efi/check.o)
+endif
 
 ifeq ($(XEN_BUILD_PE),y)
 
@@ -235,6 +241,9 @@ note_file_option ?= $(note_file)
 
 ifeq ($(XEN_BUILD_PE),y)
 $(TARGET).efi: prelink.o $(note_file) efi.lds efi/relocs-dummy.o efi/mkreloc
+ifeq ($(CONFIG_DEBUG_INFO),y)
+	$(if $(filter --strip-debug,$(EFI_LDFLAGS)),echo,:) "Will strip debug info from $(@F)"
+endif
 	$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
 	          $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< $(relocs-dummy) \
 	                $(BASEDIR)/common/symbols-dummy.o $(note_file_option) -o $(@D)/.$(@F).$(base).0 &&) :
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 6346862250..bc53ee4597 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -312,10 +312,70 @@ SECTIONS
     *(.reloc)
     __base_relocs_end = .;
   }
-  /* Trick the linker into setting the image size to exactly 16Mb. */
-  . = ALIGN(__section_alignment__);
-  DECL_SECTION(.pad) {
-    . = ALIGN(MB(16));
+  /*
+   * Explicitly list debug section for the PE output so that they don't end
+   * up at VA 0 which is below image base and thus invalid. Also use the
+   * NOLOAD directive, despite currently ignored by ld for PE output, in
+   * order to record that we'd prefer these sections to not be loaded into
+   * memory.
+   *
+   * Note that we're past _end here, so if these sections get loaded they'll
+   * be discarded at runtime anyway.
+   */
+  .debug_abbrev ALIGN(1) (NOLOAD) : {
+     *(.debug_abbrev)
+  }
+  .debug_info ALIGN(1) (NOLOAD) : {
+    *(.debug_info)
+    *(.gnu.linkonce.wi.*)
+  }
+  .debug_types ALIGN(1) (NOLOAD) : {
+    *(.debug_types)
+  }
+  .debug_str ALIGN(1) (NOLOAD) : {
+    *(.debug_str)
+  }
+  .debug_line ALIGN(1) (NOLOAD) : {
+    *(.debug_line)
+    *(.debug_line.*)
+  }
+  .debug_line_str ALIGN(1) (NOLOAD) : {
+    *(.debug_line_str)
+  }
+  .debug_names ALIGN(4) (NOLOAD) : {
+    *(.debug_names)
+  }
+  .debug_frame ALIGN(4) (NOLOAD) : {
+    *(.debug_frame)
+  }
+  .debug_loc ALIGN(1) (NOLOAD) : {
+    *(.debug_loc)
+  }
+  .debug_loclists ALIGN(4) (NOLOAD) : {
+    *(.debug_loclists)
+  }
+  .debug_ranges ALIGN(8) (NOLOAD) : {
+    *(.debug_ranges)
+  }
+  .debug_rnglists ALIGN(4) (NOLOAD) : {
+    *(.debug_rnglists)
+  }
+  .debug_addr ALIGN(8) (NOLOAD) : {
+    *(.debug_addr)
+  }
+  .debug_aranges ALIGN(1) (NOLOAD) : {
+    *(.debug_aranges)
+  }
+  .debug_pubnames ALIGN(1) (NOLOAD) : {
+    *(.debug_pubnames)
+  }
+  .debug_pubtypes ALIGN(1) (NOLOAD) : {
+    *(.debug_pubtypes)
+  }
+  /* Trick the linker into setting the image size to no less than 16Mb. */
+  __image_end__ = .;
+  .pad ALIGN(__section_alignment__) : {
+    . = __image_end__ < __image_base__ + MB(16) ? ALIGN(MB(16)) : .;
   }
 #elif defined(XEN_BUILD_EFI)
   /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Apr 27 08:34:04 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Apr 2021 08:34:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.118099.224078 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbJAS-0000rt-17; Tue, 27 Apr 2021 08:34:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 118099.224078; Tue, 27 Apr 2021 08:34:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbJAR-0000rk-UQ; Tue, 27 Apr 2021 08:34:03 +0000
Received: by outflank-mailman (input) for mailman id 118099;
 Tue, 27 Apr 2021 08:34:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbJAR-0000rf-Cx
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08:34:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbJAR-0002u6-CC
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08:34:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbJAR-0006v5-BM
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 08:34:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qDVICxl4zbbn5r/h1xnZxa81+fLemaBEBPuctLKS288=; b=wqCHQpVdhd/Z1ox7QSfVksCpc5
	FioUGwfQFH8ZBGtAZpIl1RQC6SmM2J54pzFIsFK0RppSNrNGQs7Qm3qIFkRv6QiHIyyStM+OPKbjt
	43QOvaMNgeAn2pMBsvHwWYZUXd/UOOLYvSgpaNMJg8c0rzK1jt+sIt48PRVoiXB/YiSE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/EFI: don't have an overly large image size
Message-Id: <E1lbJAR-0006v5-BM@xenbits.xenproject.org>
Date: Tue, 27 Apr 2021 08:34:03 +0000

commit 11e7f0fe72ca0060762d18268e0388731fe8ccb6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Apr 26 10:26:04 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Apr 26 10:26:04 2021 +0200

    x86/EFI: don't have an overly large image size
    
    While without debug info the difference is benign (so far), since we pad
    the image to 16Mb anyway, forcing the .reloc section to a 2Mb boundary
    causes subsequent .debug_* sections to go farther beyond 16Mb than
    needed. There's no reason to advance . for establishing __2M_rwdata_end,
    as all data past _end is of no interest at runtime anymore anyway.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/xen.lds.S | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index bc53ee4597..34f647a44e 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -303,8 +303,7 @@ SECTIONS
   } PHDR(text)
   _end = . ;
 
-  . = ALIGN(SECTION_ALIGN);
-  __2M_rwdata_end = .;
+  __2M_rwdata_end = ALIGN(SECTION_ALIGN);
 
 #ifdef EFI
   .reloc ALIGN(4) : {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Apr 27 12:44:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Apr 2021 12:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.118410.224500 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbN4P-0001pp-U7; Tue, 27 Apr 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 118410.224500; Tue, 27 Apr 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 1lbN4P-0001ph-RE; Tue, 27 Apr 2021 12:44:05 +0000
Received: by outflank-mailman (input) for mailman id 118410;
 Tue, 27 Apr 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 1lbN4O-0001pc-Sg
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 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 1lbN4O-0007Ci-PZ
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 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 1lbN4O-0007O3-Nx
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 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=UdL5pesos4FdA3wStmMvuIWlzqCUTXA9oAZ4/XODPFg=; b=nYQkInDZVYY/c0wlUVLcAMvuUN
	+dzse6wYKNgY+6OFg8X9K7ZK3uY+xMlgF81gn6IHiif/1u7g1xJcp1h6JkdHicjbUDm3DDjQOjAxD
	BQ/jpAjhTbTNhx44VYOeDP293PLkumtcuaosSmttVnxlCxOly4ZlzC4p++d1SP5Hgh/4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VMX: use a single, global APIC access page
Message-Id: <E1lbN4O-0007O3-Nx@xenbits.xenproject.org>
Date: Tue, 27 Apr 2021 12:44:04 +0000

commit 58850b9074d3e7affdf3bc94c84e417ecfa4d165
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 27 14:34:59 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 27 14:34:59 2021 +0200

    VMX: use a single, global APIC access page
    
    The address of this page is used by the CPU only to recognize when to
    access the virtual APIC page instead. No accesses would ever go to this
    page. It only needs to be present in the (CPU) page tables so that
    address translation will produce its address as result for respective
    accesses.
    
    By making this page global, we also eliminate the need to refcount it,
    or to assign it to any domain in the first place.
    
    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>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/hvm/vmx/vmx.c         | 71 ++++++++++++--------------------------
 xen/arch/x86/mm/shadow/set.c       |  9 +++++
 xen/arch/x86/mm/shadow/types.h     |  7 ++++
 xen/include/asm-x86/hvm/vmx/vmcs.h |  1 -
 xen/include/asm-x86/mm.h           | 20 ++++++++++-
 5 files changed, 58 insertions(+), 50 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index dde4f3b70d..1450fd1991 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -66,8 +66,7 @@ boolean_param("force-ept", opt_force_ept);
 static void vmx_ctxt_switch_from(struct vcpu *v);
 static void vmx_ctxt_switch_to(struct vcpu *v);
 
-static int  vmx_alloc_vlapic_mapping(struct domain *d);
-static void vmx_free_vlapic_mapping(struct domain *d);
+static int alloc_vlapic_mapping(void);
 static void vmx_install_vlapic_mapping(struct vcpu *v);
 static void vmx_update_guest_cr(struct vcpu *v, unsigned int cr,
                                 unsigned int flags);
@@ -78,6 +77,8 @@ static int vmx_msr_read_intercept(unsigned int msr, uint64_t *msr_content);
 static int vmx_msr_write_intercept(unsigned int msr, uint64_t msr_content);
 static void vmx_invlpg(struct vcpu *v, unsigned long linear);
 
+static mfn_t __read_mostly apic_access_mfn = INVALID_MFN_INITIALIZER;
+
 /* Values for domain's ->arch.hvm_domain.pi_ops.flags. */
 #define PI_CSW_FROM (1u << 0)
 #define PI_CSW_TO   (1u << 1)
@@ -401,7 +402,6 @@ static int vmx_domain_initialise(struct domain *d)
         .to   = vmx_ctxt_switch_to,
         .tail = vmx_do_resume,
     };
-    int rc;
 
     d->arch.ctxt_switch = &csw;
 
@@ -411,28 +411,22 @@ static int vmx_domain_initialise(struct domain *d)
      */
     d->arch.hvm.vmx.exec_sp = is_hardware_domain(d) || opt_ept_exec_sp;
 
-    if ( !has_vlapic(d) )
-        return 0;
-
-    if ( (rc = vmx_alloc_vlapic_mapping(d)) != 0 )
-        return rc;
-
     return 0;
 }
 
-static void vmx_domain_relinquish_resources(struct domain *d)
+static void domain_creation_finished(struct domain *d)
 {
-    if ( !has_vlapic(d) )
+    gfn_t gfn = gaddr_to_gfn(APIC_DEFAULT_PHYS_BASE);
+    uint8_t ipat;
+
+    if ( !has_vlapic(d) || mfn_eq(apic_access_mfn, INVALID_MFN) )
         return;
 
-    vmx_free_vlapic_mapping(d);
-}
+    ASSERT(epte_get_entry_emt(d, gfn_x(gfn), apic_access_mfn, 0, &ipat,
+                              true) == MTRR_TYPE_WRBACK);
+    ASSERT(ipat);
 
-static void domain_creation_finished(struct domain *d)
-{
-    if ( has_vlapic(d) && !mfn_eq(d->arch.hvm.vmx.apic_access_mfn, _mfn(0)) &&
-         set_mmio_p2m_entry(d, gaddr_to_gfn(APIC_DEFAULT_PHYS_BASE),
-                            d->arch.hvm.vmx.apic_access_mfn, PAGE_ORDER_4K) )
+    if ( set_mmio_p2m_entry(d, gfn, apic_access_mfn, PAGE_ORDER_4K) )
         domain_crash(d);
 }
 
@@ -2415,7 +2409,6 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .cpu_up_prepare       = vmx_cpu_up_prepare,
     .cpu_dead             = vmx_cpu_dead,
     .domain_initialise    = vmx_domain_initialise,
-    .domain_relinquish_resources = vmx_domain_relinquish_resources,
     .domain_creation_finished = domain_creation_finished,
     .vcpu_initialise      = vmx_vcpu_initialise,
     .vcpu_destroy         = vmx_vcpu_destroy,
@@ -2662,7 +2655,7 @@ const struct hvm_function_table * __init start_vmx(void)
 {
     set_in_cr4(X86_CR4_VMXE);
 
-    if ( vmx_vmcs_init() )
+    if ( vmx_vmcs_init() || alloc_vlapic_mapping() )
     {
         printk("VMX: failed to initialise.\n");
         return NULL;
@@ -3236,7 +3229,7 @@ gp_fault:
     return X86EMUL_EXCEPTION;
 }
 
-static int vmx_alloc_vlapic_mapping(struct domain *d)
+static int __init alloc_vlapic_mapping(void)
 {
     struct page_info *pg;
     mfn_t mfn;
@@ -3244,52 +3237,34 @@ static int vmx_alloc_vlapic_mapping(struct domain *d)
     if ( !cpu_has_vmx_virtualize_apic_accesses )
         return 0;
 
-    pg = alloc_domheap_page(d, MEMF_no_refcount);
+    pg = alloc_domheap_page(NULL, 0);
     if ( !pg )
         return -ENOMEM;
 
-    if ( !get_page_and_type(pg, d, PGT_writable_page) )
-    {
-        /*
-         * The domain can't possibly know about this page yet, so failure
-         * here is a clear indication of something fishy going on.
-         */
-        domain_crash(d);
-        return -ENODATA;
-    }
+    /*
+     * Signal to shadow code that this page cannot be refcounted. This also
+     * makes epte_get_entry_emt() recognize this page as "special".
+     */
+    page_suppress_refcounting(pg);
 
     mfn = page_to_mfn(pg);
     clear_domain_page(mfn);
-    d->arch.hvm.vmx.apic_access_mfn = mfn;
+    apic_access_mfn = mfn;
 
     return 0;
 }
 
-static void vmx_free_vlapic_mapping(struct domain *d)
-{
-    mfn_t mfn = d->arch.hvm.vmx.apic_access_mfn;
-
-    d->arch.hvm.vmx.apic_access_mfn = _mfn(0);
-    if ( !mfn_eq(mfn, _mfn(0)) )
-    {
-        struct page_info *pg = mfn_to_page(mfn);
-
-        put_page_alloc_ref(pg);
-        put_page_and_type(pg);
-    }
-}
-
 static void vmx_install_vlapic_mapping(struct vcpu *v)
 {
     paddr_t virt_page_ma, apic_page_ma;
 
-    if ( mfn_eq(v->domain->arch.hvm.vmx.apic_access_mfn, _mfn(0)) )
+    if ( !has_vlapic(v->domain) || mfn_eq(apic_access_mfn, INVALID_MFN) )
         return;
 
     ASSERT(cpu_has_vmx_virtualize_apic_accesses);
 
     virt_page_ma = page_to_maddr(vcpu_vlapic(v)->regs_page);
-    apic_page_ma = mfn_to_maddr(v->domain->arch.hvm.vmx.apic_access_mfn);
+    apic_page_ma = mfn_to_maddr(apic_access_mfn);
 
     vmx_vmcs_enter(v);
     __vmwrite(VIRTUAL_APIC_PAGE_ADDR, virt_page_ma);
diff --git a/xen/arch/x86/mm/shadow/set.c b/xen/arch/x86/mm/shadow/set.c
index fff4d1633c..7c95274994 100644
--- a/xen/arch/x86/mm/shadow/set.c
+++ b/xen/arch/x86/mm/shadow/set.c
@@ -94,6 +94,15 @@ shadow_get_page_from_l1e(shadow_l1e_t sl1e, struct domain *d, p2m_type_t type)
     ASSERT(!sh_l1e_is_magic(sl1e));
     ASSERT(shadow_mode_refcounts(d));
 
+    /*
+     * Check whether refcounting is suppressed on this page. For example,
+     * VMX'es APIC access MFN is just a surrogate page.  It doesn't actually
+     * get accessed, and hence there's no need to refcount it.
+     */
+    mfn = shadow_l1e_get_mfn(sl1e);
+    if ( mfn_valid(mfn) && page_refcounting_suppressed(mfn_to_page(mfn)) )
+        return 0;
+
     res = get_page_from_l1e(sl1e, d, d);
 
     /*
diff --git a/xen/arch/x86/mm/shadow/types.h b/xen/arch/x86/mm/shadow/types.h
index 814a401853..6970e7d6ea 100644
--- a/xen/arch/x86/mm/shadow/types.h
+++ b/xen/arch/x86/mm/shadow/types.h
@@ -276,9 +276,16 @@ int shadow_set_l4e(struct domain *d, shadow_l4e_t *sl4e,
 static void inline
 shadow_put_page_from_l1e(shadow_l1e_t sl1e, struct domain *d)
 {
+    mfn_t mfn = shadow_l1e_get_mfn(sl1e);
+
     if ( !shadow_mode_refcounts(d) )
         return;
 
+    if ( mfn_valid(mfn) &&
+         /* See the respective comment in shadow_get_page_from_l1e(). */
+         page_refcounting_suppressed(mfn_to_page(mfn)) )
+        return;
+
     put_page_from_l1e(sl1e, d);
 }
 
diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/asm-x86/hvm/vmx/vmcs.h
index 8073af323b..03c9ccf627 100644
--- a/xen/include/asm-x86/hvm/vmx/vmcs.h
+++ b/xen/include/asm-x86/hvm/vmx/vmcs.h
@@ -58,7 +58,6 @@ struct ept_data {
 #define _VMX_DOMAIN_PML_ENABLED    0
 #define VMX_DOMAIN_PML_ENABLED     (1ul << _VMX_DOMAIN_PML_ENABLED)
 struct vmx_domain {
-    mfn_t apic_access_mfn;
     /* VMX_DOMAIN_* */
     unsigned int status;
 
diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index 56d7a71a24..80b0ccffaa 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -82,7 +82,7 @@
 #define PGC_state_offlined PG_mask(2, 9)
 #define PGC_state_free    PG_mask(3, 9)
 #define page_state_is(pg, st) (((pg)->count_info&PGC_state) == PGC_state_##st)
-/* Page is not reference counted */
+/* Page is not reference counted (see below for caveats) */
 #define _PGC_extra        PG_shift(10)
 #define PGC_extra         PG_mask(1, 10)
 
@@ -374,6 +374,24 @@ void zap_ro_mpt(mfn_t mfn);
 
 bool is_iomem_page(mfn_t mfn);
 
+/*
+ * Pages with no owner which may get passed to functions wanting to
+ * refcount them can be marked PGC_extra to bypass this refcounting (which
+ * would fail due to the lack of an owner).
+ *
+ * (For pages with owner PGC_extra has different meaning.)
+ */
+static inline void page_suppress_refcounting(struct page_info *pg)
+{
+   ASSERT(!page_get_owner(pg));
+   pg->count_info |= PGC_extra;
+}
+
+static inline bool page_refcounting_suppressed(const struct page_info *pg)
+{
+    return !page_get_owner(pg) && (pg->count_info & PGC_extra);
+}
+
 struct platform_bad_page {
     unsigned long mfn;
     unsigned int order;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 27 12:44:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Apr 2021 12:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.118411.224504 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbN4Z-0001qh-Vg; Tue, 27 Apr 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 118411.224504; Tue, 27 Apr 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 1lbN4Z-0001qZ-Sm; Tue, 27 Apr 2021 12:44:15 +0000
Received: by outflank-mailman (input) for mailman id 118411;
 Tue, 27 Apr 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 1lbN4Y-0001qT-U7
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 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 1lbN4Y-0007Cl-TH
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 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 1lbN4Y-0007Oe-Rr
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 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=dIJjkWKwiMNygDsCZNzMmvh+SvKJi0J/1+O6tOgzH0E=; b=bfuAFPDro09elPhjW9GPv8jNWx
	xeQzH5Fi6Zsxtm2McduiazC8nnGWWwsRfByNU7xVVdCJcj/czJ7d80dJKzYnRkxZ6o5bF4uzIfjOn
	MEwcIf2CyJ+10uG6SwqnOgXOL+xHLguvl1QgPnywUyPvuNsT4SpUoldPfzXHya9lXpsI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: re-use variables in shadow_get_page_from_l1e()
Message-Id: <E1lbN4Y-0007Oe-Rr@xenbits.xenproject.org>
Date: Tue, 27 Apr 2021 12:44:14 +0000

commit a76f6ea1ebc67f5ce27ee4a19c226dc0fd390d6b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 27 14:35:49 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 27 14:35:49 2021 +0200

    x86/shadow: re-use variables in shadow_get_page_from_l1e()
    
    There's little point in doing multiple mfn_to_page() or page_get_owner()
    on all the same MFN. Calculate them once at the start of the function.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/set.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/set.c b/xen/arch/x86/mm/shadow/set.c
index 7c95274994..8ef37c6f11 100644
--- a/xen/arch/x86/mm/shadow/set.c
+++ b/xen/arch/x86/mm/shadow/set.c
@@ -88,19 +88,25 @@ static int inline
 shadow_get_page_from_l1e(shadow_l1e_t sl1e, struct domain *d, p2m_type_t type)
 {
     int res;
-    mfn_t mfn;
-    struct domain *owner;
+    mfn_t mfn = shadow_l1e_get_mfn(sl1e);
+    const struct page_info *pg = NULL;
+    struct domain *owner = NULL;
 
     ASSERT(!sh_l1e_is_magic(sl1e));
     ASSERT(shadow_mode_refcounts(d));
 
+    if ( mfn_valid(mfn) )
+    {
+        pg = mfn_to_page(mfn);
+        owner = page_get_owner(pg);
+    }
+
     /*
      * Check whether refcounting is suppressed on this page. For example,
      * VMX'es APIC access MFN is just a surrogate page.  It doesn't actually
      * get accessed, and hence there's no need to refcount it.
      */
-    mfn = shadow_l1e_get_mfn(sl1e);
-    if ( mfn_valid(mfn) && page_refcounting_suppressed(mfn_to_page(mfn)) )
+    if ( pg && page_refcounting_suppressed(pg) )
         return 0;
 
     res = get_page_from_l1e(sl1e, d, d);
@@ -111,9 +117,7 @@ shadow_get_page_from_l1e(shadow_l1e_t sl1e, struct domain *d, p2m_type_t type)
      */
     if ( unlikely(res < 0) &&
          !shadow_mode_translate(d) &&
-         mfn_valid(mfn = shadow_l1e_get_mfn(sl1e)) &&
-         (owner = page_get_owner(mfn_to_page(mfn))) &&
-         (d != owner) )
+         owner && (d != owner) )
     {
         res = xsm_priv_mapping(XSM_TARGET, d, owner);
         if ( !res )
@@ -136,9 +140,8 @@ shadow_get_page_from_l1e(shadow_l1e_t sl1e, struct domain *d, p2m_type_t type)
          * already have checked that we're supposed to have access, so
          * we can just grab a reference directly.
          */
-        mfn = shadow_l1e_get_mfn(sl1e);
-        if ( mfn_valid(mfn) )
-            res = get_page_from_l1e(sl1e, d, page_get_owner(mfn_to_page(mfn)));
+        if ( owner )
+            res = get_page_from_l1e(sl1e, d, owner);
     }
 
     if ( unlikely(res < 0) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 27 12:44:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Apr 2021 12:44:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.118412.224508 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbN4k-0001rt-1G; Tue, 27 Apr 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 118412.224508; Tue, 27 Apr 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 1lbN4j-0001rl-UW; Tue, 27 Apr 2021 12:44:25 +0000
Received: by outflank-mailman (input) for mailman id 118412;
 Tue, 27 Apr 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 1lbN4j-0001rd-1s
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 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 1lbN4i-0007Cy-WC
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 12:44:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbN4i-0007PX-VT
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 2021 12: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=zPshaShMwfuGYc7sy3IVf6xo4WHaNfKZ2X20dxubRZ4=; b=EY2RDoTu60/tldJoY7gv4Wzq16
	UCHJW105lVUl2xlAOU/NTRwYdbIDjjAm9V8nDQFRjaF6ANoIKsJ6jmWeIEexiE0+7FEz8UZ0akv6F
	BnoFCD9nnFqkppFcsPR+i3uCZWNJYYBifZKp/5ylDg//lhIHQT6JFT/szVID3Rq4OUsQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shadow: streamline shadow_get_page_from_l1e()
Message-Id: <E1lbN4i-0007PX-VT@xenbits.xenproject.org>
Date: Tue, 27 Apr 2021 12:44:24 +0000

commit 972ba1d1d4bcb77018b50fd2bb63c0e628859ed3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 27 14:36:13 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 27 14:36:13 2021 +0200

    x86/shadow: streamline shadow_get_page_from_l1e()
    
    Trying get_page_from_l1e() up to three times isn't helpful; in debug
    builds it may lead to log messages making things look as if there was a
    problem somewhere. And there's no need to have more than one try: The
    function can only possibly succeed for one domain passed as 3rd
    argument (unless the page is an MMIO one to which both have access,
    but MMIO pages should be "got" by specifying the requesting domain
    anyway). Re-arrange things so just the one call gets made which has a
    chance of succeeding.
    
    The code could in principle be arranged such that there's only a single
    call to get_page_from_l1e(), but the conditional would become pretty
    complex then and hence hard to follow / understand / adjust.
    
    The redundant (with shadow_mode_refcounts()) shadow_mode_translate()
    gets dropped.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/set.c | 34 +++++++++++++++-------------------
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/set.c b/xen/arch/x86/mm/shadow/set.c
index 8ef37c6f11..87e9c6eeb2 100644
--- a/xen/arch/x86/mm/shadow/set.c
+++ b/xen/arch/x86/mm/shadow/set.c
@@ -109,40 +109,36 @@ shadow_get_page_from_l1e(shadow_l1e_t sl1e, struct domain *d, p2m_type_t type)
     if ( pg && page_refcounting_suppressed(pg) )
         return 0;
 
-    res = get_page_from_l1e(sl1e, d, d);
+    if ( owner == dom_io )
+        owner = NULL;
 
     /*
      * If a privileged domain is attempting to install a map of a page it does
      * not own, we let it succeed anyway.
      */
-    if ( unlikely(res < 0) &&
-         !shadow_mode_translate(d) &&
-         owner && (d != owner) )
+    if ( owner && (d != owner) &&
+         !(res = xsm_priv_mapping(XSM_TARGET, d, owner)) )
     {
-        res = xsm_priv_mapping(XSM_TARGET, d, owner);
-        if ( !res )
-        {
-            res = get_page_from_l1e(sl1e, d, owner);
-            SHADOW_PRINTK("privileged %pd installs map of mfn %"PRI_mfn" owned by %pd: %s\n",
-                           d, mfn_x(mfn), owner,
-                           res >= 0 ? "success" : "failed");
-        }
+        res = get_page_from_l1e(sl1e, d, owner);
+        SHADOW_PRINTK("privileged %pd installs map of %pd's mfn %"PRI_mfn": %s\n",
+                      d, owner, mfn_x(mfn),
+                      res >= 0 ? "success" : "failed");
     }
-
     /* Okay, it might still be a grant mapping PTE.  Try it. */
-    if ( unlikely(res < 0) &&
-         (type == p2m_grant_map_rw ||
-          (type == p2m_grant_map_ro &&
-           !(shadow_l1e_get_flags(sl1e) & _PAGE_RW))) )
+    else if ( owner &&
+              (type == p2m_grant_map_rw ||
+               (type == p2m_grant_map_ro &&
+                !(shadow_l1e_get_flags(sl1e) & _PAGE_RW))) )
     {
         /*
          * It's a grant mapping.  The grant table implementation will
          * already have checked that we're supposed to have access, so
          * we can just grab a reference directly.
          */
-        if ( owner )
-            res = get_page_from_l1e(sl1e, d, owner);
+        res = get_page_from_l1e(sl1e, d, owner);
     }
+    else
+        res = get_page_from_l1e(sl1e, d, d);
 
     if ( unlikely(res < 0) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Apr 27 13:11:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Apr 2021 13:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.118479.224635 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbNUX-0005jf-Oa; Tue, 27 Apr 2021 13:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 118479.224635; Tue, 27 Apr 2021 13:11:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbNUX-0005jX-Lc; Tue, 27 Apr 2021 13:11:05 +0000
Received: by outflank-mailman (input) for mailman id 118479;
 Tue, 27 Apr 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 1lbNUW-0005jF-Dk
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 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 1lbNUW-0007iq-Cw
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 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 1lbNUW-0001Lk-Bx
 for xen-changelog@lists.xenproject.org; Tue, 27 Apr 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=MOhIAuKJutvVCF2yT0b/P2FvAtrpo70j3Kmrl/X0KLg=; b=OmPsawZBLK7NAA02/G1v+N1YLF
	WKLaYOT47Rfv+z39BOg/0bhRVp5GCNm/DKLuuJwa3dkZurEallv8X4shzg6nwd054cqV7cryBiSUI
	GQ93prWIKz3MPg8W+HqRu2VuQxahyXDbWFU552T//7SJ+Y2eE+dLswXA4FWna7duh6RY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.14] update Xen version to 4.14.2
Message-Id: <E1lbNUW-0001Lk-Bx@xenbits.xenproject.org>
Date: Tue, 27 Apr 2021 13:11:04 +0000

commit 207c70c5b622e87682152728b4ea4f0970ad2aad
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 27 15:00:16 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 27 15:00:16 2021 +0200

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

diff --git a/Config.mk b/Config.mk
index bc4ee6fe34..5c2eeef30f 100644
--- a/Config.mk
+++ b/Config.mk
@@ -245,15 +245,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 20d2e5a125e34fc8501026613a71549b2a1a3e54
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.14.1
-MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.14.1
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.14.2
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.14.2
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.13.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= xen-4.14.1
+QEMU_TRADITIONAL_REVISION ?= xen-4.14.2
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
diff --git a/xen/Makefile b/xen/Makefile
index 5ccbd64ad9..4ffa2ed7d5 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 14
-export XEN_EXTRAVERSION ?= .2-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .2$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Apr 28 06:55:08 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 28 Apr 2021 06:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.119029.225329 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbe6B-0003LT-6d; Wed, 28 Apr 2021 06:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 119029.225329; Wed, 28 Apr 2021 06: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 1lbe6B-0003LL-3W; Wed, 28 Apr 2021 06:55:03 +0000
Received: by outflank-mailman (input) for mailman id 119029;
 Wed, 28 Apr 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 1lbe69-0003LG-S3
 for xen-changelog@lists.xenproject.org; Wed, 28 Apr 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 1lbe69-0007PF-PG
 for xen-changelog@lists.xenproject.org; Wed, 28 Apr 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 1lbe69-0008EQ-Mf
 for xen-changelog@lists.xenproject.org; Wed, 28 Apr 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=3hWEqsZAVEGoXcMRl6Vv/FqpmkvBr8TIszdte4RF5Us=; b=ACSRi6pL7B6TEPwfX42V4cWFat
	1OY1t9tWqCYpL8Ie6kgR5h0Pj/3nhfGVFfAXABwLFbozpHvyGkctzZh5qTn6ciNO8Jpvyvptedwpj
	kf0YmFsOx6OyoHjt2t7sN6svU7skvP/ueXplWLtmgBpjFD+w2XkcNqAQWlie021iJQAk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] update Xen version to 4.14.2
Message-Id: <E1lbe69-0008EQ-Mf@xenbits.xenproject.org>
Date: Wed, 28 Apr 2021 06:55:01 +0000

commit 207c70c5b622e87682152728b4ea4f0970ad2aad
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 27 15:00:16 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 27 15:00:16 2021 +0200

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

diff --git a/Config.mk b/Config.mk
index bc4ee6fe34..5c2eeef30f 100644
--- a/Config.mk
+++ b/Config.mk
@@ -245,15 +245,15 @@ SEABIOS_UPSTREAM_URL ?= git://xenbits.xen.org/seabios.git
 MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 20d2e5a125e34fc8501026613a71549b2a1a3e54
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.14.1
-MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.14.1
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.14.2
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.14.2
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.13.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= xen-4.14.1
+QEMU_TRADITIONAL_REVISION ?= xen-4.14.2
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
diff --git a/xen/Makefile b/xen/Makefile
index 5ccbd64ad9..4ffa2ed7d5 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 14
-export XEN_EXTRAVERSION ?= .2-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .2$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Apr 28 23:33:10 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 28 Apr 2021 23:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.119604.226143 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbtfz-0002rj-6W; Wed, 28 Apr 2021 23:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 119604.226143; Wed, 28 Apr 2021 23:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbtfz-0002ra-3K; Wed, 28 Apr 2021 23:33:03 +0000
Received: by outflank-mailman (input) for mailman id 119604;
 Wed, 28 Apr 2021 23:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbtfy-0002rV-91
 for xen-changelog@lists.xenproject.org; Wed, 28 Apr 2021 23:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbtfy-0000bD-3h
 for xen-changelog@lists.xenproject.org; Wed, 28 Apr 2021 23:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbtfy-000890-17
 for xen-changelog@lists.xenproject.org; Wed, 28 Apr 2021 23:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aetRQxRIUMSMQcVXEUHfaVdFUrEnN4Thy/0opjYrBco=; b=Zo11hV3AQbWzkk8NyVO+8V4yhY
	3JKasRkO9h1RemVhqAwIN6DPJ+Irck5R3hySf+72eYZgSLjjXg65aJSQY3ImF/FJeEJtByh3cyNoE
	OAUKvaS2FcBDzJErAN9IdTXZInax4Y9svkkKyOXfDRqI0mH9E15u/5goY9kWQQRaBvg8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VMX: use a single, global APIC access page
Message-Id: <E1lbtfy-000890-17@xenbits.xenproject.org>
Date: Wed, 28 Apr 2021 23:33:02 +0000

commit 58850b9074d3e7affdf3bc94c84e417ecfa4d165
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 27 14:34:59 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 27 14:34:59 2021 +0200

    VMX: use a single, global APIC access page
    
    The address of this page is used by the CPU only to recognize when to
    access the virtual APIC page instead. No accesses would ever go to this
    page. It only needs to be present in the (CPU) page tables so that
    address translation will produce its address as result for respective
    accesses.
    
    By making this page global, we also eliminate the need to refcount it,
    or to assign it to any domain in the first place.
    
    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>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/hvm/vmx/vmx.c         | 71 ++++++++++++--------------------------
 xen/arch/x86/mm/shadow/set.c       |  9 +++++
 xen/arch/x86/mm/shadow/types.h     |  7 ++++
 xen/include/asm-x86/hvm/vmx/vmcs.h |  1 -
 xen/include/asm-x86/mm.h           | 20 ++++++++++-
 5 files changed, 58 insertions(+), 50 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index dde4f3b70d..1450fd1991 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -66,8 +66,7 @@ boolean_param("force-ept", opt_force_ept);
 static void vmx_ctxt_switch_from(struct vcpu *v);
 static void vmx_ctxt_switch_to(struct vcpu *v);
 
-static int  vmx_alloc_vlapic_mapping(struct domain *d);
-static void vmx_free_vlapic_mapping(struct domain *d);
+static int alloc_vlapic_mapping(void);
 static void vmx_install_vlapic_mapping(struct vcpu *v);
 static void vmx_update_guest_cr(struct vcpu *v, unsigned int cr,
                                 unsigned int flags);
@@ -78,6 +77,8 @@ static int vmx_msr_read_intercept(unsigned int msr, uint64_t *msr_content);
 static int vmx_msr_write_intercept(unsigned int msr, uint64_t msr_content);
 static void vmx_invlpg(struct vcpu *v, unsigned long linear);
 
+static mfn_t __read_mostly apic_access_mfn = INVALID_MFN_INITIALIZER;
+
 /* Values for domain's ->arch.hvm_domain.pi_ops.flags. */
 #define PI_CSW_FROM (1u << 0)
 #define PI_CSW_TO   (1u << 1)
@@ -401,7 +402,6 @@ static int vmx_domain_initialise(struct domain *d)
         .to   = vmx_ctxt_switch_to,
         .tail = vmx_do_resume,
     };
-    int rc;
 
     d->arch.ctxt_switch = &csw;
 
@@ -411,28 +411,22 @@ static int vmx_domain_initialise(struct domain *d)
      */
     d->arch.hvm.vmx.exec_sp = is_hardware_domain(d) || opt_ept_exec_sp;
 
-    if ( !has_vlapic(d) )
-        return 0;
-
-    if ( (rc = vmx_alloc_vlapic_mapping(d)) != 0 )
-        return rc;
-
     return 0;
 }
 
-static void vmx_domain_relinquish_resources(struct domain *d)
+static void domain_creation_finished(struct domain *d)
 {
-    if ( !has_vlapic(d) )
+    gfn_t gfn = gaddr_to_gfn(APIC_DEFAULT_PHYS_BASE);
+    uint8_t ipat;
+
+    if ( !has_vlapic(d) || mfn_eq(apic_access_mfn, INVALID_MFN) )
         return;
 
-    vmx_free_vlapic_mapping(d);
-}
+    ASSERT(epte_get_entry_emt(d, gfn_x(gfn), apic_access_mfn, 0, &ipat,
+                              true) == MTRR_TYPE_WRBACK);
+    ASSERT(ipat);
 
-static void domain_creation_finished(struct domain *d)
-{
-    if ( has_vlapic(d) && !mfn_eq(d->arch.hvm.vmx.apic_access_mfn, _mfn(0)) &&
-         set_mmio_p2m_entry(d, gaddr_to_gfn(APIC_DEFAULT_PHYS_BASE),
-                            d->arch.hvm.vmx.apic_access_mfn, PAGE_ORDER_4K) )
+    if ( set_mmio_p2m_entry(d, gfn, apic_access_mfn, PAGE_ORDER_4K) )
         domain_crash(d);
 }
 
@@ -2415,7 +2409,6 @@ static struct hvm_function_table __initdata vmx_function_table = {
     .cpu_up_prepare       = vmx_cpu_up_prepare,
     .cpu_dead             = vmx_cpu_dead,
     .domain_initialise    = vmx_domain_initialise,
-    .domain_relinquish_resources = vmx_domain_relinquish_resources,
     .domain_creation_finished = domain_creation_finished,
     .vcpu_initialise      = vmx_vcpu_initialise,
     .vcpu_destroy         = vmx_vcpu_destroy,
@@ -2662,7 +2655,7 @@ const struct hvm_function_table * __init start_vmx(void)
 {
     set_in_cr4(X86_CR4_VMXE);
 
-    if ( vmx_vmcs_init() )
+    if ( vmx_vmcs_init() || alloc_vlapic_mapping() )
     {
         printk("VMX: failed to initialise.\n");
         return NULL;
@@ -3236,7 +3229,7 @@ gp_fault:
     return X86EMUL_EXCEPTION;
 }
 
-static int vmx_alloc_vlapic_mapping(struct domain *d)
+static int __init alloc_vlapic_mapping(void)
 {
     struct page_info *pg;
     mfn_t mfn;
@@ -3244,52 +3237,34 @@ static int vmx_alloc_vlapic_mapping(struct domain *d)
     if ( !cpu_has_vmx_virtualize_apic_accesses )
         return 0;
 
-    pg = alloc_domheap_page(d, MEMF_no_refcount);
+    pg = alloc_domheap_page(NULL, 0);
     if ( !pg )
         return -ENOMEM;
 
-    if ( !get_page_and_type(pg, d, PGT_writable_page) )
-    {
-        /*
-         * The domain can't possibly know about this page yet, so failure
-         * here is a clear indication of something fishy going on.
-         */
-        domain_crash(d);
-        return -ENODATA;
-    }
+    /*
+     * Signal to shadow code that this page cannot be refcounted. This also
+     * makes epte_get_entry_emt() recognize this page as "special".
+     */
+    page_suppress_refcounting(pg);
 
     mfn = page_to_mfn(pg);
     clear_domain_page(mfn);
-    d->arch.hvm.vmx.apic_access_mfn = mfn;
+    apic_access_mfn = mfn;
 
     return 0;
 }
 
-static void vmx_free_vlapic_mapping(struct domain *d)
-{
-    mfn_t mfn = d->arch.hvm.vmx.apic_access_mfn;
-
-    d->arch.hvm.vmx.apic_access_mfn = _mfn(0);
-    if ( !mfn_eq(mfn, _mfn(0)) )
-    {
-        struct page_info *pg = mfn_to_page(mfn);
-
-        put_page_alloc_ref(pg);
-        put_page_and_type(pg);
-    }
-}
-
 static void vmx_install_vlapic_mapping(struct vcpu *v)
 {
     paddr_t virt_page_ma, apic_page_ma;
 
-    if ( mfn_eq(v->domain->arch.hvm.vmx.apic_access_mfn, _mfn(0)) )
+    if ( !has_vlapic(v->domain) || mfn_eq(apic_access_mfn, INVALID_MFN) )
         return;
 
     ASSERT(cpu_has_vmx_virtualize_apic_accesses);
 
     virt_page_ma = page_to_maddr(vcpu_vlapic(v)->regs_page);
-    apic_page_ma = mfn_to_maddr(v->domain->arch.hvm.vmx.apic_access_mfn);
+    apic_page_ma = mfn_to_maddr(apic_access_mfn);
 
     vmx_vmcs_enter(v);
     __vmwrite(VIRTUAL_APIC_PAGE_ADDR, virt_page_ma);
diff --git a/xen/arch/x86/mm/shadow/set.c b/xen/arch/x86/mm/shadow/set.c
index fff4d1633c..7c95274994 100644
--- a/xen/arch/x86/mm/shadow/set.c
+++ b/xen/arch/x86/mm/shadow/set.c
@@ -94,6 +94,15 @@ shadow_get_page_from_l1e(shadow_l1e_t sl1e, struct domain *d, p2m_type_t type)
     ASSERT(!sh_l1e_is_magic(sl1e));
     ASSERT(shadow_mode_refcounts(d));
 
+    /*
+     * Check whether refcounting is suppressed on this page. For example,
+     * VMX'es APIC access MFN is just a surrogate page.  It doesn't actually
+     * get accessed, and hence there's no need to refcount it.
+     */
+    mfn = shadow_l1e_get_mfn(sl1e);
+    if ( mfn_valid(mfn) && page_refcounting_suppressed(mfn_to_page(mfn)) )
+        return 0;
+
     res = get_page_from_l1e(sl1e, d, d);
 
     /*
diff --git a/xen/arch/x86/mm/shadow/types.h b/xen/arch/x86/mm/shadow/types.h
index 814a401853..6970e7d6ea 100644
--- a/xen/arch/x86/mm/shadow/types.h
+++ b/xen/arch/x86/mm/shadow/types.h
@@ -276,9 +276,16 @@ int shadow_set_l4e(struct domain *d, shadow_l4e_t *sl4e,
 static void inline
 shadow_put_page_from_l1e(shadow_l1e_t sl1e, struct domain *d)
 {
+    mfn_t mfn = shadow_l1e_get_mfn(sl1e);
+
     if ( !shadow_mode_refcounts(d) )
         return;
 
+    if ( mfn_valid(mfn) &&
+         /* See the respective comment in shadow_get_page_from_l1e(). */
+         page_refcounting_suppressed(mfn_to_page(mfn)) )
+        return;
+
     put_page_from_l1e(sl1e, d);
 }
 
diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/asm-x86/hvm/vmx/vmcs.h
index 8073af323b..03c9ccf627 100644
--- a/xen/include/asm-x86/hvm/vmx/vmcs.h
+++ b/xen/include/asm-x86/hvm/vmx/vmcs.h
@@ -58,7 +58,6 @@ struct ept_data {
 #define _VMX_DOMAIN_PML_ENABLED    0
 #define VMX_DOMAIN_PML_ENABLED     (1ul << _VMX_DOMAIN_PML_ENABLED)
 struct vmx_domain {
-    mfn_t apic_access_mfn;
     /* VMX_DOMAIN_* */
     unsigned int status;
 
diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index 56d7a71a24..80b0ccffaa 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -82,7 +82,7 @@
 #define PGC_state_offlined PG_mask(2, 9)
 #define PGC_state_free    PG_mask(3, 9)
 #define page_state_is(pg, st) (((pg)->count_info&PGC_state) == PGC_state_##st)
-/* Page is not reference counted */
+/* Page is not reference counted (see below for caveats) */
 #define _PGC_extra        PG_shift(10)
 #define PGC_extra         PG_mask(1, 10)
 
@@ -374,6 +374,24 @@ void zap_ro_mpt(mfn_t mfn);
 
 bool is_iomem_page(mfn_t mfn);
 
+/*
+ * Pages with no owner which may get passed to functions wanting to
+ * refcount them can be marked PGC_extra to bypass this refcounting (which
+ * would fail due to the lack of an owner).
+ *
+ * (For pages with owner PGC_extra has different meaning.)
+ */
+static inline void page_suppress_refcounting(struct page_info *pg)
+{
+   ASSERT(!page_get_owner(pg));
+   pg->count_info |= PGC_extra;
+}
+
+static inline bool page_refcounting_suppressed(const struct page_info *pg)
+{
+    return !page_get_owner(pg) && (pg->count_info & PGC_extra);
+}
+
 struct platform_bad_page {
     unsigned long mfn;
     unsigned int order;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 28 23:33:13 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 28 Apr 2021 23:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.119605.226147 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbtg9-0002uI-7h; Wed, 28 Apr 2021 23:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 119605.226147; Wed, 28 Apr 2021 23:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbtg9-0002uA-4t; Wed, 28 Apr 2021 23:33:13 +0000
Received: by outflank-mailman (input) for mailman id 119605;
 Wed, 28 Apr 2021 23:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbtg8-0002u4-8E
 for xen-changelog@lists.xenproject.org; Wed, 28 Apr 2021 23:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbtg8-0000ba-73
 for xen-changelog@lists.xenproject.org; Wed, 28 Apr 2021 23:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbtg8-00089k-60
 for xen-changelog@lists.xenproject.org; Wed, 28 Apr 2021 23:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eA7WPnhHnzZGtJXRw0UqdyTl1uq/u7hpzEHvgSdxpq8=; b=BIp0n58b5SWGhW/TyADFr0SGo9
	KRtTt3EmariijCPqD0vZFAtuN2FSs+q/+jFx4gWbZKpFJSyBKNReSAk7QYhm/FYJ7SyM76kJEFpC0
	+DcKcsd1zTP1hMmBRrasJFL9Rwr1+zcDe8XO2zyf3h+tzow29wAvFEWVOoNf/tywSpVA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: re-use variables in shadow_get_page_from_l1e()
Message-Id: <E1lbtg8-00089k-60@xenbits.xenproject.org>
Date: Wed, 28 Apr 2021 23:33:12 +0000

commit a76f6ea1ebc67f5ce27ee4a19c226dc0fd390d6b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 27 14:35:49 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 27 14:35:49 2021 +0200

    x86/shadow: re-use variables in shadow_get_page_from_l1e()
    
    There's little point in doing multiple mfn_to_page() or page_get_owner()
    on all the same MFN. Calculate them once at the start of the function.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/set.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/set.c b/xen/arch/x86/mm/shadow/set.c
index 7c95274994..8ef37c6f11 100644
--- a/xen/arch/x86/mm/shadow/set.c
+++ b/xen/arch/x86/mm/shadow/set.c
@@ -88,19 +88,25 @@ static int inline
 shadow_get_page_from_l1e(shadow_l1e_t sl1e, struct domain *d, p2m_type_t type)
 {
     int res;
-    mfn_t mfn;
-    struct domain *owner;
+    mfn_t mfn = shadow_l1e_get_mfn(sl1e);
+    const struct page_info *pg = NULL;
+    struct domain *owner = NULL;
 
     ASSERT(!sh_l1e_is_magic(sl1e));
     ASSERT(shadow_mode_refcounts(d));
 
+    if ( mfn_valid(mfn) )
+    {
+        pg = mfn_to_page(mfn);
+        owner = page_get_owner(pg);
+    }
+
     /*
      * Check whether refcounting is suppressed on this page. For example,
      * VMX'es APIC access MFN is just a surrogate page.  It doesn't actually
      * get accessed, and hence there's no need to refcount it.
      */
-    mfn = shadow_l1e_get_mfn(sl1e);
-    if ( mfn_valid(mfn) && page_refcounting_suppressed(mfn_to_page(mfn)) )
+    if ( pg && page_refcounting_suppressed(pg) )
         return 0;
 
     res = get_page_from_l1e(sl1e, d, d);
@@ -111,9 +117,7 @@ shadow_get_page_from_l1e(shadow_l1e_t sl1e, struct domain *d, p2m_type_t type)
      */
     if ( unlikely(res < 0) &&
          !shadow_mode_translate(d) &&
-         mfn_valid(mfn = shadow_l1e_get_mfn(sl1e)) &&
-         (owner = page_get_owner(mfn_to_page(mfn))) &&
-         (d != owner) )
+         owner && (d != owner) )
     {
         res = xsm_priv_mapping(XSM_TARGET, d, owner);
         if ( !res )
@@ -136,9 +140,8 @@ shadow_get_page_from_l1e(shadow_l1e_t sl1e, struct domain *d, p2m_type_t type)
          * already have checked that we're supposed to have access, so
          * we can just grab a reference directly.
          */
-        mfn = shadow_l1e_get_mfn(sl1e);
-        if ( mfn_valid(mfn) )
-            res = get_page_from_l1e(sl1e, d, page_get_owner(mfn_to_page(mfn)));
+        if ( owner )
+            res = get_page_from_l1e(sl1e, d, owner);
     }
 
     if ( unlikely(res < 0) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Apr 28 23:33:23 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 28 Apr 2021 23:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.119606.226151 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lbtgJ-0002vV-9Y; Wed, 28 Apr 2021 23:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 119606.226151; Wed, 28 Apr 2021 23: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 1lbtgJ-0002vJ-6K; Wed, 28 Apr 2021 23:33:23 +0000
Received: by outflank-mailman (input) for mailman id 119606;
 Wed, 28 Apr 2021 23: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 1lbtgI-0002vB-Ay
 for xen-changelog@lists.xenproject.org; Wed, 28 Apr 2021 23: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 1lbtgI-0000bj-AB
 for xen-changelog@lists.xenproject.org; Wed, 28 Apr 2021 23:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lbtgI-0008Bx-9J
 for xen-changelog@lists.xenproject.org; Wed, 28 Apr 2021 23: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=O2TX0K0ATR/4IK16Pq4pY9xqnjuxQ7pfJHr8RO7w4UM=; b=I7DToG14MDrCu55dMS0DGqFJp0
	DbywiTYdXPMDusz/mu2TyllJ4BD/sz7354OynqNWMlZXD/JsQWKelUfIdDIKcGwCfoZeabPZrYUqm
	QyQXxFR0bDfYl6G1rm4rkGtRXeaYCCZDGvdv5Aa69h1xf03gCxNdAxLviI672XUWJIoU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: streamline shadow_get_page_from_l1e()
Message-Id: <E1lbtgI-0008Bx-9J@xenbits.xenproject.org>
Date: Wed, 28 Apr 2021 23:33:22 +0000

commit 972ba1d1d4bcb77018b50fd2bb63c0e628859ed3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Apr 27 14:36:13 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Apr 27 14:36:13 2021 +0200

    x86/shadow: streamline shadow_get_page_from_l1e()
    
    Trying get_page_from_l1e() up to three times isn't helpful; in debug
    builds it may lead to log messages making things look as if there was a
    problem somewhere. And there's no need to have more than one try: The
    function can only possibly succeed for one domain passed as 3rd
    argument (unless the page is an MMIO one to which both have access,
    but MMIO pages should be "got" by specifying the requesting domain
    anyway). Re-arrange things so just the one call gets made which has a
    chance of succeeding.
    
    The code could in principle be arranged such that there's only a single
    call to get_page_from_l1e(), but the conditional would become pretty
    complex then and hence hard to follow / understand / adjust.
    
    The redundant (with shadow_mode_refcounts()) shadow_mode_translate()
    gets dropped.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/set.c | 34 +++++++++++++++-------------------
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/set.c b/xen/arch/x86/mm/shadow/set.c
index 8ef37c6f11..87e9c6eeb2 100644
--- a/xen/arch/x86/mm/shadow/set.c
+++ b/xen/arch/x86/mm/shadow/set.c
@@ -109,40 +109,36 @@ shadow_get_page_from_l1e(shadow_l1e_t sl1e, struct domain *d, p2m_type_t type)
     if ( pg && page_refcounting_suppressed(pg) )
         return 0;
 
-    res = get_page_from_l1e(sl1e, d, d);
+    if ( owner == dom_io )
+        owner = NULL;
 
     /*
      * If a privileged domain is attempting to install a map of a page it does
      * not own, we let it succeed anyway.
      */
-    if ( unlikely(res < 0) &&
-         !shadow_mode_translate(d) &&
-         owner && (d != owner) )
+    if ( owner && (d != owner) &&
+         !(res = xsm_priv_mapping(XSM_TARGET, d, owner)) )
     {
-        res = xsm_priv_mapping(XSM_TARGET, d, owner);
-        if ( !res )
-        {
-            res = get_page_from_l1e(sl1e, d, owner);
-            SHADOW_PRINTK("privileged %pd installs map of mfn %"PRI_mfn" owned by %pd: %s\n",
-                           d, mfn_x(mfn), owner,
-                           res >= 0 ? "success" : "failed");
-        }
+        res = get_page_from_l1e(sl1e, d, owner);
+        SHADOW_PRINTK("privileged %pd installs map of %pd's mfn %"PRI_mfn": %s\n",
+                      d, owner, mfn_x(mfn),
+                      res >= 0 ? "success" : "failed");
     }
-
     /* Okay, it might still be a grant mapping PTE.  Try it. */
-    if ( unlikely(res < 0) &&
-         (type == p2m_grant_map_rw ||
-          (type == p2m_grant_map_ro &&
-           !(shadow_l1e_get_flags(sl1e) & _PAGE_RW))) )
+    else if ( owner &&
+              (type == p2m_grant_map_rw ||
+               (type == p2m_grant_map_ro &&
+                !(shadow_l1e_get_flags(sl1e) & _PAGE_RW))) )
     {
         /*
          * It's a grant mapping.  The grant table implementation will
          * already have checked that we're supposed to have access, so
          * we can just grab a reference directly.
          */
-        if ( owner )
-            res = get_page_from_l1e(sl1e, d, owner);
+        res = get_page_from_l1e(sl1e, d, owner);
     }
+    else
+        res = get_page_from_l1e(sl1e, d, d);
 
     if ( unlikely(res < 0) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Apr 29 14:11:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Apr 2021 14:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120063.227022 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lc7Ni-0007dC-K4; Thu, 29 Apr 2021 14:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120063.227022; Thu, 29 Apr 2021 14:11:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lc7Ni-0007d5-HA; Thu, 29 Apr 2021 14:11:06 +0000
Received: by outflank-mailman (input) for mailman id 120063;
 Thu, 29 Apr 2021 14:11:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lc7Nh-0007cy-3S
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 14:11:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lc7Nh-0005rR-0v
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 14:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lc7Ng-0004nK-V6
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 14:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uPH81MBvpxlXSUOjhZ6NwBfsqe3CEh1gOvVQ3Eeowio=; b=DyaORGhA1cImQysN2A91m6J4km
	HrGyjdNc2ypYl8A+rBug0JHqvaQ+wBLRpdt7IoIhr6Gcn3/vpj8lIiPSOueLzsbxS3tFNQlHhLhSd
	JnnyBoCLHVo9tJc12lMCN2nauIrG9ms1vb9dMemvyf6/BmJcgJiWMvZB1LJaFcOqe3Ds=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] unzstd: replace INIT and STATIC
Message-Id: <E1lc7Ng-0004nK-V6@xenbits.xenproject.org>
Date: Thu, 29 Apr 2021 14:11:04 +0000

commit 2c6af6c7bbaa7c6b6945c0d4cd88aeebec5e85fd
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 29 16:02:59 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 29 16:02:59 2021 +0200

    unzstd: replace INIT and STATIC
    
    With xen/common/decompress.h now agreeing in both build modes about
    what STATIC expands to, there's no need for these abstractions anymore.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/unzstd.c              |  18 ++---
 xen/common/zstd/decompress.c     | 142 +++++++++++++++++++--------------------
 xen/common/zstd/entropy_common.c |  10 +--
 xen/common/zstd/error_private.h  |   8 +--
 xen/common/zstd/fse_decompress.c |  10 +--
 xen/common/zstd/huf_decompress.c |  52 +++++++-------
 xen/common/zstd/zstd_common.c    |  12 ++--
 xen/common/zstd/zstd_internal.h  |   2 +-
 8 files changed, 127 insertions(+), 127 deletions(-)

diff --git a/xen/common/unzstd.c b/xen/common/unzstd.c
index 915a07c21b..a034b69e86 100644
--- a/xen/common/unzstd.c
+++ b/xen/common/unzstd.c
@@ -71,7 +71,7 @@
  */
 #define ZSTD_IOBUF_SIZE		(1 << 17)
 
-static int INIT handle_zstd_error(size_t ret, void (*error)(const char *x))
+static int __init handle_zstd_error(size_t ret, void (*error)(const char *x))
 {
 	const int err = ZSTD_getErrorCode(ret);
 
@@ -102,9 +102,9 @@ static int INIT handle_zstd_error(size_t ret, void (*error)(const char *x))
  * We can allocate less memory (no circular buffer for the sliding window),
  * and avoid some memcpy() calls.
  */
-static int INIT decompress_single(const u8 *in_buf, long in_len, u8 *out_buf,
-				  long out_len, unsigned int *in_pos,
-				  void (*error)(const char *x))
+static int __init decompress_single(const u8 *in_buf, long in_len, u8 *out_buf,
+				    long out_len, unsigned int *in_pos,
+				    void (*error)(const char *x))
 {
 	const size_t wksp_size = ZSTD_DCtxWorkspaceBound();
 	void *wksp = large_malloc(wksp_size);
@@ -142,11 +142,11 @@ out:
 	return err;
 }
 
-int INIT unzstd(unsigned char *in_buf, unsigned int in_len,
-	        int (*fill)(void*, unsigned int),
-	        int (*flush)(void*, unsigned int),
-	        unsigned char *out_buf, unsigned int *in_pos,
-	        void (*error)(const char *x))
+int __init unzstd(unsigned char *in_buf, unsigned int in_len,
+		  int (*fill)(void*, unsigned int),
+		  int (*flush)(void*, unsigned int),
+		  unsigned char *out_buf, unsigned int *in_pos,
+		  void (*error)(const char *x))
 {
 	ZSTD_inBuffer in;
 	ZSTD_outBuffer out;
diff --git a/xen/common/zstd/decompress.c b/xen/common/zstd/decompress.c
index b024910814..1bfd58eb44 100644
--- a/xen/common/zstd/decompress.c
+++ b/xen/common/zstd/decompress.c
@@ -46,7 +46,7 @@
 /*_*******************************************************
 *  Memory operations
 **********************************************************/
-static void INIT ZSTD_copy4(void *dst, const void *src) { memcpy(dst, src, 4); }
+static void __init ZSTD_copy4(void *dst, const void *src) { memcpy(dst, src, 4); }
 
 /*-*************************************************************
 *   Context management
@@ -98,12 +98,12 @@ struct ZSTD_DCtx_s {
 	BYTE headerBuffer[ZSTD_FRAMEHEADERSIZE_MAX];
 }; /* typedef'd to ZSTD_DCtx within "zstd.h" */
 
-STATIC size_t INIT ZSTD_DCtxWorkspaceBound(void)
+static size_t __init ZSTD_DCtxWorkspaceBound(void)
 {
 	return ZSTD_ALIGN(sizeof(ZSTD_stack)) + ZSTD_ALIGN(sizeof(ZSTD_DCtx));
 }
 
-STATIC size_t INIT ZSTD_decompressBegin(ZSTD_DCtx *dctx)
+static size_t __init ZSTD_decompressBegin(ZSTD_DCtx *dctx)
 {
 	dctx->expected = ZSTD_frameHeaderSize_prefix;
 	dctx->stage = ZSTDds_getFrameHeaderSize;
@@ -123,7 +123,7 @@ STATIC size_t INIT ZSTD_decompressBegin(ZSTD_DCtx *dctx)
 	return 0;
 }
 
-STATIC ZSTD_DCtx *INIT ZSTD_createDCtx_advanced(ZSTD_customMem customMem)
+static ZSTD_DCtx *__init ZSTD_createDCtx_advanced(ZSTD_customMem customMem)
 {
 	ZSTD_DCtx *dctx;
 
@@ -138,13 +138,13 @@ STATIC ZSTD_DCtx *INIT ZSTD_createDCtx_advanced(ZSTD_customMem customMem)
 	return dctx;
 }
 
-STATIC ZSTD_DCtx *INIT ZSTD_initDCtx(void *workspace, size_t workspaceSize)
+static ZSTD_DCtx *__init ZSTD_initDCtx(void *workspace, size_t workspaceSize)
 {
 	ZSTD_customMem const stackMem = ZSTD_initStack(workspace, workspaceSize);
 	return ZSTD_createDCtx_advanced(stackMem);
 }
 
-size_t INIT ZSTD_freeDCtx(ZSTD_DCtx *dctx)
+size_t __init ZSTD_freeDCtx(ZSTD_DCtx *dctx)
 {
 	if (dctx == NULL)
 		return 0; /* support free on NULL */
@@ -153,15 +153,15 @@ size_t INIT ZSTD_freeDCtx(ZSTD_DCtx *dctx)
 }
 
 #ifdef BUILD_DEAD_CODE
-void INIT ZSTD_copyDCtx(ZSTD_DCtx *dstDCtx, const ZSTD_DCtx *srcDCtx)
+void __init ZSTD_copyDCtx(ZSTD_DCtx *dstDCtx, const ZSTD_DCtx *srcDCtx)
 {
 	size_t const workSpaceSize = (ZSTD_BLOCKSIZE_ABSOLUTEMAX + WILDCOPY_OVERLENGTH) + ZSTD_frameHeaderSize_max;
 	memcpy(dstDCtx, srcDCtx, sizeof(ZSTD_DCtx) - workSpaceSize); /* no need to copy workspace */
 }
 #endif
 
-STATIC size_t ZSTD_findFrameCompressedSize(const void *src, size_t srcSize);
-STATIC size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx *dctx, const void *dict,
+static size_t ZSTD_findFrameCompressedSize(const void *src, size_t srcSize);
+static size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx *dctx, const void *dict,
 	size_t dictSize);
 
 static void ZSTD_refDDict(ZSTD_DCtx *dstDCtx, const ZSTD_DDict *ddict);
@@ -176,7 +176,7 @@ static void ZSTD_refDDict(ZSTD_DCtx *dstDCtx, const ZSTD_DDict *ddict);
  *  Note : Frame Identifier is 4 bytes. If `size < 4`, @return will always be 0.
  *  Note 2 : Legacy Frame Identifiers are considered valid only if Legacy Support is enabled.
  *  Note 3 : Skippable Frame Identifiers are considered valid. */
-unsigned INIT ZSTD_isFrame(const void *buffer, size_t size)
+unsigned __init ZSTD_isFrame(const void *buffer, size_t size)
 {
 	if (size < 4)
 		return 0;
@@ -194,7 +194,7 @@ unsigned INIT ZSTD_isFrame(const void *buffer, size_t size)
 /** ZSTD_frameHeaderSize() :
 *   srcSize must be >= ZSTD_frameHeaderSize_prefix.
 *   @return : size of the Frame Header */
-static size_t INIT ZSTD_frameHeaderSize(const void *src, size_t srcSize)
+static size_t __init ZSTD_frameHeaderSize(const void *src, size_t srcSize)
 {
 	if (srcSize < ZSTD_frameHeaderSize_prefix)
 		return ERROR(srcSize_wrong);
@@ -212,7 +212,7 @@ static size_t INIT ZSTD_frameHeaderSize(const void *src, size_t srcSize)
 *   @return : 0, `fparamsPtr` is correctly filled,
 *            >0, `srcSize` is too small, result is expected `srcSize`,
 *             or an error code, which can be tested using ZSTD_isError() */
-STATIC size_t INIT ZSTD_getFrameParams(ZSTD_frameParams *fparamsPtr, const void *src, size_t srcSize)
+static size_t __init ZSTD_getFrameParams(ZSTD_frameParams *fparamsPtr, const void *src, size_t srcSize)
 {
 	const BYTE *ip = (const BYTE *)src;
 
@@ -303,7 +303,7 @@ STATIC size_t INIT ZSTD_getFrameParams(ZSTD_frameParams *fparamsPtr, const void
 *   @return : decompressed size of the single frame pointed to be `src` if known, otherwise
 *             - ZSTD_CONTENTSIZE_UNKNOWN if the size cannot be determined
 *             - ZSTD_CONTENTSIZE_ERROR if an error occurred (e.g. invalid magic number, srcSize too small) */
-unsigned long long INIT ZSTD_getFrameContentSize(const void *src, size_t srcSize)
+unsigned long long __init ZSTD_getFrameContentSize(const void *src, size_t srcSize)
 {
 	{
 		ZSTD_frameParams fParams;
@@ -325,7 +325,7 @@ unsigned long long INIT ZSTD_getFrameContentSize(const void *src, size_t srcSize
  *  `srcSize` must be the exact length of some number of ZSTD compressed and/or
  *      skippable frames
  *  @return : decompressed size of the frames contained */
-unsigned long long INIT ZSTD_findDecompressedSize(const void *src, size_t srcSize)
+unsigned long long __init ZSTD_findDecompressedSize(const void *src, size_t srcSize)
 {
 	{
 		unsigned long long totalDstSize = 0;
@@ -379,7 +379,7 @@ unsigned long long INIT ZSTD_findDecompressedSize(const void *src, size_t srcSiz
 /** ZSTD_decodeFrameHeader() :
 *   `headerSize` must be the size provided by ZSTD_frameHeaderSize().
 *   @return : 0 if success, or an error code, which can be tested using ZSTD_isError() */
-static size_t INIT ZSTD_decodeFrameHeader(ZSTD_DCtx *dctx, const void *src, size_t headerSize)
+static size_t __init ZSTD_decodeFrameHeader(ZSTD_DCtx *dctx, const void *src, size_t headerSize)
 {
 	size_t const result = ZSTD_getFrameParams(&(dctx->fParams), src, headerSize);
 	if (ZSTD_isError(result))
@@ -401,7 +401,7 @@ typedef struct {
 
 /*! ZSTD_getcBlockSize() :
 *   Provides the size of compressed block from block header `src` */
-STATIC size_t INIT ZSTD_getcBlockSize(const void *src, size_t srcSize, blockProperties_t *bpPtr)
+static size_t __init ZSTD_getcBlockSize(const void *src, size_t srcSize, blockProperties_t *bpPtr)
 {
 	if (srcSize < ZSTD_blockHeaderSize)
 		return ERROR(srcSize_wrong);
@@ -419,7 +419,7 @@ STATIC size_t INIT ZSTD_getcBlockSize(const void *src, size_t srcSize, blockProp
 	}
 }
 
-static size_t INIT ZSTD_copyRawBlock(void *dst, size_t dstCapacity, const void *src, size_t srcSize)
+static size_t __init ZSTD_copyRawBlock(void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 {
 	if (srcSize > dstCapacity)
 		return ERROR(dstSize_tooSmall);
@@ -427,7 +427,7 @@ static size_t INIT ZSTD_copyRawBlock(void *dst, size_t dstCapacity, const void *
 	return srcSize;
 }
 
-static size_t INIT ZSTD_setRleBlock(void *dst, size_t dstCapacity, const void *src, size_t srcSize, size_t regenSize)
+static size_t __init ZSTD_setRleBlock(void *dst, size_t dstCapacity, const void *src, size_t srcSize, size_t regenSize)
 {
 	if (srcSize != 1)
 		return ERROR(srcSize_wrong);
@@ -439,7 +439,7 @@ static size_t INIT ZSTD_setRleBlock(void *dst, size_t dstCapacity, const void *s
 
 /*! ZSTD_decodeLiteralsBlock() :
 	@return : nb of bytes read from src (< srcSize ) */
-STATIC size_t INIT ZSTD_decodeLiteralsBlock(ZSTD_DCtx *dctx, const void *src, size_t srcSize) /* note : srcSize < BLOCKSIZE */
+static size_t __init ZSTD_decodeLiteralsBlock(ZSTD_DCtx *dctx, const void *src, size_t srcSize) /* note : srcSize < BLOCKSIZE */
 {
 	if (srcSize < MIN_CBLOCK_SIZE)
 		return ERROR(corruption_detected);
@@ -759,10 +759,10 @@ static const FSE_decode_t4 OF_defaultDTable[(1 << OF_DEFAULTNORMLOG) + 1] = {
 	@return : nb bytes read from src,
 			  or an error code if it fails, testable with ZSTD_isError()
 */
-static size_t INIT ZSTD_buildSeqTable(FSE_DTable *DTableSpace, const FSE_DTable **DTablePtr,
-				      symbolEncodingType_e type, U32 max, U32 maxLog, const void *src,
-				      size_t srcSize, const FSE_decode_t4 *defaultTable,
-				      U32 flagRepeatTable, void *workspace, size_t workspaceSize)
+static size_t __init ZSTD_buildSeqTable(FSE_DTable *DTableSpace, const FSE_DTable **DTablePtr,
+					symbolEncodingType_e type, U32 max, U32 maxLog, const void *src,
+					size_t srcSize, const FSE_decode_t4 *defaultTable,
+					U32 flagRepeatTable, void *workspace, size_t workspaceSize)
 {
 	const void *const tmpPtr = defaultTable; /* bypass strict aliasing */
 	switch (type) {
@@ -803,7 +803,7 @@ static size_t INIT ZSTD_buildSeqTable(FSE_DTable *DTableSpace, const FSE_DTable
 	}
 }
 
-STATIC size_t INIT ZSTD_decodeSeqHeaders(ZSTD_DCtx *dctx, int *nbSeqPtr, const void *src, size_t srcSize)
+static size_t __init ZSTD_decodeSeqHeaders(ZSTD_DCtx *dctx, int *nbSeqPtr, const void *src, size_t srcSize)
 {
 	const BYTE *const istart = (const BYTE *const)src;
 	const BYTE *const iend = istart + srcSize;
@@ -940,7 +940,7 @@ size_t ZSTD_execSequenceLast7(BYTE *op, BYTE *const oend, seq_t sequence, const
 	return sequenceLength;
 }
 
-static seq_t INIT ZSTD_decodeSequence(seqState_t *seqState)
+static seq_t __init ZSTD_decodeSequence(seqState_t *seqState)
 {
 	seq_t seq;
 
@@ -1102,7 +1102,7 @@ size_t ZSTD_execSequence(BYTE *op, BYTE *const oend, seq_t sequence, const BYTE
 	return sequenceLength;
 }
 
-static size_t INIT ZSTD_decompressSequences(ZSTD_DCtx *dctx, void *dst, size_t maxDstSize, const void *seqStart, size_t seqSize)
+static size_t __init ZSTD_decompressSequences(ZSTD_DCtx *dctx, void *dst, size_t maxDstSize, const void *seqStart, size_t seqSize)
 {
 	const BYTE *ip = (const BYTE *)seqStart;
 	const BYTE *const iend = ip + seqSize;
@@ -1262,7 +1262,7 @@ FORCE_INLINE seq_t ZSTD_decodeSequenceLong_generic(seqState_t *seqState, int con
 	return seq;
 }
 
-static seq_t INIT ZSTD_decodeSequenceLong(seqState_t *seqState, unsigned const windowSize)
+static seq_t __init ZSTD_decodeSequenceLong(seqState_t *seqState, unsigned const windowSize)
 {
 	if (ZSTD_highbit32(windowSize) > STREAM_ACCUMULATOR_MIN) {
 		return ZSTD_decodeSequenceLong_generic(seqState, 1);
@@ -1272,9 +1272,9 @@ static seq_t INIT ZSTD_decodeSequenceLong(seqState_t *seqState, unsigned const w
 }
 
 FORCE_INLINE
-size_t INIT ZSTD_execSequenceLong(BYTE *op, BYTE *const oend, seq_t sequence, const BYTE **litPtr,
-				  const BYTE *const litLimit, const BYTE *const base,
-				  const BYTE *const vBase, const BYTE *const dictEnd)
+size_t __init ZSTD_execSequenceLong(BYTE *op, BYTE *const oend, seq_t sequence, const BYTE **litPtr,
+				    const BYTE *const litLimit, const BYTE *const base,
+				    const BYTE *const vBase, const BYTE *const dictEnd)
 {
 	BYTE *const oLitEnd = op + sequence.litLength;
 	size_t const sequenceLength = sequence.litLength + sequence.matchLength;
@@ -1358,7 +1358,7 @@ size_t INIT ZSTD_execSequenceLong(BYTE *op, BYTE *const oend, seq_t sequence, co
 	return sequenceLength;
 }
 
-static size_t INIT ZSTD_decompressSequencesLong(ZSTD_DCtx *dctx, void *dst, size_t maxDstSize, const void *seqStart, size_t seqSize)
+static size_t __init ZSTD_decompressSequencesLong(ZSTD_DCtx *dctx, void *dst, size_t maxDstSize, const void *seqStart, size_t seqSize)
 {
 	const BYTE *ip = (const BYTE *)seqStart;
 	const BYTE *const iend = ip + seqSize;
@@ -1455,7 +1455,7 @@ static size_t INIT ZSTD_decompressSequencesLong(ZSTD_DCtx *dctx, void *dst, size
 	return op - ostart;
 }
 
-static size_t INIT ZSTD_decompressBlock_internal(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
+static size_t __init ZSTD_decompressBlock_internal(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 { /* blockType == blockCompressed */
 	const BYTE *ip = (const BYTE *)src;
 
@@ -1479,7 +1479,7 @@ static size_t INIT ZSTD_decompressBlock_internal(ZSTD_DCtx *dctx, void *dst, siz
 	return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize);
 }
 
-static void INIT ZSTD_checkContinuity(ZSTD_DCtx *dctx, const void *dst)
+static void __init ZSTD_checkContinuity(ZSTD_DCtx *dctx, const void *dst)
 {
 	if (dst != dctx->previousDstEnd) { /* not contiguous */
 		dctx->dictEnd = dctx->previousDstEnd;
@@ -1490,7 +1490,7 @@ static void INIT ZSTD_checkContinuity(ZSTD_DCtx *dctx, const void *dst)
 }
 
 #ifdef BUILD_DEAD_CODE
-size_t INIT ZSTD_decompressBlock(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
+size_t __init ZSTD_decompressBlock(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 {
 	size_t dSize;
 	ZSTD_checkContinuity(dctx, dst);
@@ -1501,7 +1501,7 @@ size_t INIT ZSTD_decompressBlock(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity,
 
 /** ZSTD_insertBlock() :
 	insert `src` block into `dctx` history. Useful to track uncompressed blocks. */
-size_t INIT ZSTD_insertBlock(ZSTD_DCtx *dctx, const void *blockStart, size_t blockSize)
+size_t __init ZSTD_insertBlock(ZSTD_DCtx *dctx, const void *blockStart, size_t blockSize)
 {
 	ZSTD_checkContinuity(dctx, blockStart);
 	dctx->previousDstEnd = (const char *)blockStart + blockSize;
@@ -1509,7 +1509,7 @@ size_t INIT ZSTD_insertBlock(ZSTD_DCtx *dctx, const void *blockStart, size_t blo
 }
 #endif /* BUILD_DEAD_CODE */
 
-STATIC size_t INIT ZSTD_generateNxBytes(void *dst, size_t dstCapacity, BYTE byte, size_t length)
+static size_t __init ZSTD_generateNxBytes(void *dst, size_t dstCapacity, BYTE byte, size_t length)
 {
 	if (length > dstCapacity)
 		return ERROR(dstSize_tooSmall);
@@ -1522,7 +1522,7 @@ STATIC size_t INIT ZSTD_generateNxBytes(void *dst, size_t dstCapacity, BYTE byte
  *  `src` must point to the start of a ZSTD frame, ZSTD legacy frame, or skippable frame
  *  `srcSize` must be at least as large as the frame contained
  *  @return : the compressed size of the frame starting at `src` */
-STATIC size_t INIT ZSTD_findFrameCompressedSize(const void *src, size_t srcSize)
+static size_t __init ZSTD_findFrameCompressedSize(const void *src, size_t srcSize)
 {
 	if (srcSize >= ZSTD_skippableHeaderSize && (ZSTD_readLE32(src) & 0xFFFFFFF0U) == ZSTD_MAGIC_SKIPPABLE_START) {
 		return ZSTD_skippableHeaderSize + ZSTD_readLE32((const BYTE *)src + 4);
@@ -1578,7 +1578,7 @@ STATIC size_t INIT ZSTD_findFrameCompressedSize(const void *src, size_t srcSize)
 
 /*! ZSTD_decompressFrame() :
 *   @dctx must be properly initialized */
-static size_t INIT ZSTD_decompressFrame(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void **srcPtr, size_t *srcSizePtr)
+static size_t __init ZSTD_decompressFrame(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void **srcPtr, size_t *srcSizePtr)
 {
 	const BYTE *ip = (const BYTE *)(*srcPtr);
 	BYTE *const ostart = (BYTE * const)dst;
@@ -1655,7 +1655,7 @@ static size_t INIT ZSTD_decompressFrame(ZSTD_DCtx *dctx, void *dst, size_t dstCa
 static const void *ZSTD_DDictDictContent(const ZSTD_DDict *ddict);
 static size_t ZSTD_DDictDictSize(const ZSTD_DDict *ddict);
 
-static size_t INIT ZSTD_decompressMultiFrame(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const void *dict, size_t dictSize,
+static size_t __init ZSTD_decompressMultiFrame(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const void *dict, size_t dictSize,
 					const ZSTD_DDict *ddict)
 {
 	void *const dststart = dst;
@@ -1719,12 +1719,12 @@ static size_t INIT ZSTD_decompressMultiFrame(ZSTD_DCtx *dctx, void *dst, size_t
 	return (BYTE *)dst - (BYTE *)dststart;
 }
 
-STATIC size_t INIT ZSTD_decompress_usingDict(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const void *dict, size_t dictSize)
+static size_t __init ZSTD_decompress_usingDict(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const void *dict, size_t dictSize)
 {
 	return ZSTD_decompressMultiFrame(dctx, dst, dstCapacity, src, srcSize, dict, dictSize, NULL);
 }
 
-STATIC size_t INIT ZSTD_decompressDCtx(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
+static size_t __init ZSTD_decompressDCtx(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 {
 	return ZSTD_decompress_usingDict(dctx, dst, dstCapacity, src, srcSize, NULL, 0);
 }
@@ -1733,12 +1733,12 @@ STATIC size_t INIT ZSTD_decompressDCtx(ZSTD_DCtx *dctx, void *dst, size_t dstCap
 *   Advanced Streaming Decompression API
 *   Bufferless and synchronous
 ****************************************/
-STATIC size_t INIT ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx *dctx)
+static size_t __init ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx *dctx)
 {
 	return dctx->expected;
 }
 
-STATIC ZSTD_nextInputType_e INIT ZSTD_nextInputType(ZSTD_DCtx *dctx)
+static ZSTD_nextInputType_e __init ZSTD_nextInputType(ZSTD_DCtx *dctx)
 {
 	switch (dctx->stage) {
 	default: /* should not happen */
@@ -1753,12 +1753,12 @@ STATIC ZSTD_nextInputType_e INIT ZSTD_nextInputType(ZSTD_DCtx *dctx)
 	}
 }
 
-int INIT ZSTD_isSkipFrame(ZSTD_DCtx *dctx) { return dctx->stage == ZSTDds_skipFrame; } /* for zbuff */
+int __init ZSTD_isSkipFrame(ZSTD_DCtx *dctx) { return dctx->stage == ZSTDds_skipFrame; } /* for zbuff */
 
 /** ZSTD_decompressContinue() :
 *   @return : nb of bytes generated into `dst` (necessarily <= `dstCapacity)
 *             or an error code, which can be tested using ZSTD_isError() */
-STATIC size_t INIT ZSTD_decompressContinue(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
+static size_t __init ZSTD_decompressContinue(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 {
 	/* Sanity check */
 	if (srcSize != dctx->expected)
@@ -1877,7 +1877,7 @@ STATIC size_t INIT ZSTD_decompressContinue(ZSTD_DCtx *dctx, void *dst, size_t ds
 	}
 }
 
-static size_t INIT ZSTD_refDictContent(ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
+static size_t __init ZSTD_refDictContent(ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
 {
 	dctx->dictEnd = dctx->previousDstEnd;
 	dctx->vBase = (const char *)dict - ((const char *)(dctx->previousDstEnd) - (const char *)(dctx->base));
@@ -1889,7 +1889,7 @@ static size_t INIT ZSTD_refDictContent(ZSTD_DCtx *dctx, const void *dict, size_t
 /* ZSTD_loadEntropy() :
  * dict : must point at beginning of a valid zstd dictionary
  * @return : size of entropy tables read */
-static size_t INIT ZSTD_loadEntropy(ZSTD_entropyTables_t *entropy, const void *const dict, size_t const dictSize)
+static size_t __init ZSTD_loadEntropy(ZSTD_entropyTables_t *entropy, const void *const dict, size_t const dictSize)
 {
 	const BYTE *dictPtr = (const BYTE *)dict;
 	const BYTE *const dictEnd = dictPtr + dictSize;
@@ -1958,7 +1958,7 @@ static size_t INIT ZSTD_loadEntropy(ZSTD_entropyTables_t *entropy, const void *c
 	return dictPtr - (const BYTE *)dict;
 }
 
-static size_t INIT ZSTD_decompress_insertDictionary(ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
+static size_t __init ZSTD_decompress_insertDictionary(ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
 {
 	if (dictSize < 8)
 		return ZSTD_refDictContent(dctx, dict, dictSize);
@@ -1984,7 +1984,7 @@ static size_t INIT ZSTD_decompress_insertDictionary(ZSTD_DCtx *dctx, const void
 	return ZSTD_refDictContent(dctx, dict, dictSize);
 }
 
-STATIC size_t INIT ZSTD_decompressBegin_usingDict(ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
+static size_t __init ZSTD_decompressBegin_usingDict(ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
 {
 	CHECK_F(ZSTD_decompressBegin(dctx));
 	if (dict && dictSize)
@@ -2005,14 +2005,14 @@ struct ZSTD_DDict_s {
 }; /* typedef'd to ZSTD_DDict within "zstd.h" */
 
 #ifdef BUILD_DEAD_CODE
-size_t INIT ZSTD_DDictWorkspaceBound(void) { return ZSTD_ALIGN(sizeof(ZSTD_stack)) + ZSTD_ALIGN(sizeof(ZSTD_DDict)); }
+size_t __init ZSTD_DDictWorkspaceBound(void) { return ZSTD_ALIGN(sizeof(ZSTD_stack)) + ZSTD_ALIGN(sizeof(ZSTD_DDict)); }
 #endif
 
-static const void *INIT ZSTD_DDictDictContent(const ZSTD_DDict *ddict) { return ddict->dictContent; }
+static const void *__init ZSTD_DDictDictContent(const ZSTD_DDict *ddict) { return ddict->dictContent; }
 
-static size_t INIT ZSTD_DDictDictSize(const ZSTD_DDict *ddict) { return ddict->dictSize; }
+static size_t __init ZSTD_DDictDictSize(const ZSTD_DDict *ddict) { return ddict->dictSize; }
 
-static void INIT ZSTD_refDDict(ZSTD_DCtx *dstDCtx, const ZSTD_DDict *ddict)
+static void __init ZSTD_refDDict(ZSTD_DCtx *dstDCtx, const ZSTD_DDict *ddict)
 {
 	ZSTD_decompressBegin(dstDCtx); /* init */
 	if (ddict) {		       /* support refDDict on NULL */
@@ -2039,7 +2039,7 @@ static void INIT ZSTD_refDDict(ZSTD_DCtx *dstDCtx, const ZSTD_DDict *ddict)
 }
 
 #ifdef BUILD_DEAD_CODE
-static size_t INIT ZSTD_loadEntropy_inDDict(ZSTD_DDict *ddict)
+static size_t __init ZSTD_loadEntropy_inDDict(ZSTD_DDict *ddict)
 {
 	ddict->dictID = 0;
 	ddict->entropyPresent = 0;
@@ -2058,7 +2058,7 @@ static size_t INIT ZSTD_loadEntropy_inDDict(ZSTD_DDict *ddict)
 	return 0;
 }
 
-static ZSTD_DDict *INIT ZSTD_createDDict_advanced(const void *dict, size_t dictSize, unsigned byReference, ZSTD_customMem customMem)
+static ZSTD_DDict *__init ZSTD_createDDict_advanced(const void *dict, size_t dictSize, unsigned byReference, ZSTD_customMem customMem)
 {
 	if (!customMem.customAlloc || !customMem.customFree)
 		return NULL;
@@ -2101,14 +2101,14 @@ static ZSTD_DDict *INIT ZSTD_createDDict_advanced(const void *dict, size_t dictS
 *   Create a digested dictionary, to start decompression without startup delay.
 *   `dict` content is copied inside DDict.
 *   Consequently, `dict` can be released after `ZSTD_DDict` creation */
-ZSTD_DDict *INIT ZSTD_initDDict(const void *dict, size_t dictSize, void *workspace, size_t workspaceSize)
+ZSTD_DDict *__init ZSTD_initDDict(const void *dict, size_t dictSize, void *workspace, size_t workspaceSize)
 {
 	ZSTD_customMem const stackMem = ZSTD_initStack(workspace, workspaceSize);
 	return ZSTD_createDDict_advanced(dict, dictSize, 1, stackMem);
 }
 #endif /* BUILD_DEAD_CODE */
 
-size_t INIT ZSTD_freeDDict(ZSTD_DDict *ddict)
+size_t __init ZSTD_freeDDict(ZSTD_DDict *ddict)
 {
 	if (ddict == NULL)
 		return 0; /* support free on NULL */
@@ -2125,7 +2125,7 @@ size_t INIT ZSTD_freeDDict(ZSTD_DDict *ddict)
  *  Provides the dictID stored within dictionary.
  *  if @return == 0, the dictionary is not conformant with Zstandard specification.
  *  It can still be loaded, but as a content-only dictionary. */
-unsigned INIT ZSTD_getDictID_fromDict(const void *dict, size_t dictSize)
+unsigned __init ZSTD_getDictID_fromDict(const void *dict, size_t dictSize)
 {
 	if (dictSize < 8)
 		return 0;
@@ -2138,7 +2138,7 @@ unsigned INIT ZSTD_getDictID_fromDict(const void *dict, size_t dictSize)
  *  Provides the dictID of the dictionary loaded into `ddict`.
  *  If @return == 0, the dictionary is not conformant to Zstandard specification, or empty.
  *  Non-conformant dictionaries can still be loaded, but as content-only dictionaries. */
-unsigned INIT ZSTD_getDictID_fromDDict(const ZSTD_DDict *ddict)
+unsigned __init ZSTD_getDictID_fromDDict(const ZSTD_DDict *ddict)
 {
 	if (ddict == NULL)
 		return 0;
@@ -2155,7 +2155,7 @@ unsigned INIT ZSTD_getDictID_fromDDict(const ZSTD_DDict *ddict)
  *  - `srcSize` is too small, and as a result, the frame header could not be decoded (only possible if `srcSize < ZSTD_FRAMEHEADERSIZE_MAX`).
  *  - This is not a Zstandard frame.
  *  When identifying the exact failure cause, it's possible to used ZSTD_getFrameParams(), which will provide a more precise error code. */
-unsigned INIT ZSTD_getDictID_fromFrame(const void *src, size_t srcSize)
+unsigned __init ZSTD_getDictID_fromFrame(const void *src, size_t srcSize)
 {
 	ZSTD_frameParams zfp = {0, 0, 0, 0};
 	size_t const hError = ZSTD_getFrameParams(&zfp, src, srcSize);
@@ -2168,7 +2168,7 @@ unsigned INIT ZSTD_getDictID_fromFrame(const void *src, size_t srcSize)
 /*! ZSTD_decompress_usingDDict() :
 *   Decompression using a pre-digested Dictionary
 *   Use dictionary without significant overhead. */
-STATIC size_t INIT ZSTD_decompress_usingDDict(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const ZSTD_DDict *ddict)
+static size_t __init ZSTD_decompress_usingDDict(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const ZSTD_DDict *ddict)
 {
 	/* pass content and size in case legacy frames are encountered */
 	return ZSTD_decompressMultiFrame(dctx, dst, dstCapacity, src, srcSize, NULL, 0, ddict);
@@ -2205,7 +2205,7 @@ struct ZSTD_DStream_s {
 	U32 hostageByte;
 }; /* typedef'd to ZSTD_DStream within "zstd.h" */
 
-STATIC size_t INIT ZSTD_DStreamWorkspaceBound(size_t maxWindowSize)
+static size_t __init ZSTD_DStreamWorkspaceBound(size_t maxWindowSize)
 {
 	size_t const blockSize = MIN(maxWindowSize, ZSTD_BLOCKSIZE_ABSOLUTEMAX);
 	size_t const inBuffSize = blockSize;
@@ -2213,7 +2213,7 @@ STATIC size_t INIT ZSTD_DStreamWorkspaceBound(size_t maxWindowSize)
 	return ZSTD_DCtxWorkspaceBound() + ZSTD_ALIGN(sizeof(ZSTD_DStream)) + ZSTD_ALIGN(inBuffSize) + ZSTD_ALIGN(outBuffSize);
 }
 
-static ZSTD_DStream *INIT ZSTD_createDStream_advanced(ZSTD_customMem customMem)
+static ZSTD_DStream *__init ZSTD_createDStream_advanced(ZSTD_customMem customMem)
 {
 	ZSTD_DStream *zds;
 
@@ -2235,7 +2235,7 @@ static ZSTD_DStream *INIT ZSTD_createDStream_advanced(ZSTD_customMem customMem)
 	return zds;
 }
 
-STATIC ZSTD_DStream *INIT ZSTD_initDStream(size_t maxWindowSize, void *workspace, size_t workspaceSize)
+static ZSTD_DStream *__init ZSTD_initDStream(size_t maxWindowSize, void *workspace, size_t workspaceSize)
 {
 	ZSTD_customMem const stackMem = ZSTD_initStack(workspace, workspaceSize);
 	ZSTD_DStream *zds = ZSTD_createDStream_advanced(stackMem);
@@ -2269,7 +2269,7 @@ STATIC ZSTD_DStream *INIT ZSTD_initDStream(size_t maxWindowSize, void *workspace
 }
 
 #ifdef BUILD_DEAD_CODE
-ZSTD_DStream *INIT ZSTD_initDStream_usingDDict(size_t maxWindowSize, const ZSTD_DDict *ddict, void *workspace, size_t workspaceSize)
+ZSTD_DStream *__init ZSTD_initDStream_usingDDict(size_t maxWindowSize, const ZSTD_DDict *ddict, void *workspace, size_t workspaceSize)
 {
 	ZSTD_DStream *zds = ZSTD_initDStream(maxWindowSize, workspace, workspaceSize);
 	if (zds) {
@@ -2279,7 +2279,7 @@ ZSTD_DStream *INIT ZSTD_initDStream_usingDDict(size_t maxWindowSize, const ZSTD_
 }
 #endif
 
-size_t INIT ZSTD_freeDStream(ZSTD_DStream *zds)
+size_t __init ZSTD_freeDStream(ZSTD_DStream *zds)
 {
 	if (zds == NULL)
 		return 0; /* support free on null */
@@ -2301,11 +2301,11 @@ size_t INIT ZSTD_freeDStream(ZSTD_DStream *zds)
 /* *** Initialization *** */
 
 #ifdef BUILD_DEAD_CODE
-size_t INIT ZSTD_DStreamInSize(void) { return ZSTD_BLOCKSIZE_ABSOLUTEMAX + ZSTD_blockHeaderSize; }
-size_t INIT ZSTD_DStreamOutSize(void) { return ZSTD_BLOCKSIZE_ABSOLUTEMAX; }
+size_t __init ZSTD_DStreamInSize(void) { return ZSTD_BLOCKSIZE_ABSOLUTEMAX + ZSTD_blockHeaderSize; }
+size_t __init ZSTD_DStreamOutSize(void) { return ZSTD_BLOCKSIZE_ABSOLUTEMAX; }
 #endif
 
-STATIC size_t INIT ZSTD_resetDStream(ZSTD_DStream *zds)
+static size_t __init ZSTD_resetDStream(ZSTD_DStream *zds)
 {
 	zds->stage = zdss_loadHeader;
 	zds->lhSize = zds->inPos = zds->outStart = zds->outEnd = 0;
@@ -2316,14 +2316,14 @@ STATIC size_t INIT ZSTD_resetDStream(ZSTD_DStream *zds)
 
 /* *****   Decompression   ***** */
 
-ZSTD_STATIC size_t INIT ZSTD_limitCopy(void *dst, size_t dstCapacity, const void *src, size_t srcSize)
+ZSTD_STATIC size_t __init ZSTD_limitCopy(void *dst, size_t dstCapacity, const void *src, size_t srcSize)
 {
 	size_t const length = MIN(dstCapacity, srcSize);
 	memcpy(dst, src, length);
 	return length;
 }
 
-STATIC size_t INIT ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inBuffer *input)
+static size_t __init ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inBuffer *input)
 {
 	const char *const istart = (const char *)(input->src) + input->pos;
 	const char *const iend = (const char *)(input->src) + input->size;
diff --git a/xen/common/zstd/entropy_common.c b/xen/common/zstd/entropy_common.c
index bcdb57982b..d329cccc60 100644
--- a/xen/common/zstd/entropy_common.c
+++ b/xen/common/zstd/entropy_common.c
@@ -46,17 +46,17 @@
 #include "mem.h"
 
 /*===   Version   ===*/
-unsigned INIT FSE_versionNumber(void) { return FSE_VERSION_NUMBER; }
+unsigned __init FSE_versionNumber(void) { return FSE_VERSION_NUMBER; }
 
 /*===   Error Management   ===*/
-unsigned INIT FSE_isError(size_t code) { return ERR_isError(code); }
+unsigned __init FSE_isError(size_t code) { return ERR_isError(code); }
 
-unsigned INIT HUF_isError(size_t code) { return ERR_isError(code); }
+unsigned __init HUF_isError(size_t code) { return ERR_isError(code); }
 
 /*-**************************************************************
 *  FSE NCount encoding-decoding
 ****************************************************************/
-size_t INIT FSE_readNCount(short *normalizedCounter, unsigned *maxSVPtr, unsigned *tableLogPtr, const void *headerBuffer, size_t hbSize)
+size_t __init FSE_readNCount(short *normalizedCounter, unsigned *maxSVPtr, unsigned *tableLogPtr, const void *headerBuffer, size_t hbSize)
 {
 	const BYTE *const istart = (const BYTE *)headerBuffer;
 	const BYTE *const iend = istart + hbSize;
@@ -164,7 +164,7 @@ size_t INIT FSE_readNCount(short *normalizedCounter, unsigned *maxSVPtr, unsigne
 	@return : size read from `src` , or an error Code .
 	Note : Needed by HUF_readCTable() and HUF_readDTableX?() .
 */
-size_t INIT HUF_readStats_wksp(BYTE *huffWeight, size_t hwSize, U32 *rankStats, U32 *nbSymbolsPtr, U32 *tableLogPtr, const void *src, size_t srcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_readStats_wksp(BYTE *huffWeight, size_t hwSize, U32 *rankStats, U32 *nbSymbolsPtr, U32 *tableLogPtr, const void *src, size_t srcSize, void *workspace, size_t workspaceSize)
 {
 	U32 weightTotal;
 	const BYTE *ip = (const BYTE *)src;
diff --git a/xen/common/zstd/error_private.h b/xen/common/zstd/error_private.h
index 906d537e08..fa84ae4fef 100644
--- a/xen/common/zstd/error_private.h
+++ b/xen/common/zstd/error_private.h
@@ -67,9 +67,9 @@ typedef ZSTD_ErrorCode ERR_enum;
 ******************************************/
 #define ERROR(name) ((size_t)-PREFIX(name))
 
-ERR_STATIC unsigned INIT ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
+ERR_STATIC unsigned __init ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
 
-ERR_STATIC ERR_enum INIT ERR_getErrorCode(size_t code)
+ERR_STATIC ERR_enum __init ERR_getErrorCode(size_t code)
 {
 	if (!ERR_isError(code))
 		return (ERR_enum)0;
@@ -82,7 +82,7 @@ ERR_STATIC ERR_enum INIT ERR_getErrorCode(size_t code)
  *
  * Return: Non-zero iff the code is an error.
  */
-static __attribute__((unused)) unsigned int INIT ZSTD_isError(size_t code)
+static __attribute__((unused)) unsigned int __init ZSTD_isError(size_t code)
 {
 	return code > (size_t)-ZSTD_error_maxCode;
 }
@@ -94,7 +94,7 @@ static __attribute__((unused)) unsigned int INIT ZSTD_isError(size_t code)
  * Return:          The ZSTD_ErrorCode corresponding to the functionResult or 0
  *                  if the functionResult isn't an error.
  */
-static __attribute__((unused)) ZSTD_ErrorCode INIT ZSTD_getErrorCode(
+static __attribute__((unused)) ZSTD_ErrorCode __init ZSTD_getErrorCode(
 	size_t functionResult)
 {
 	if (!ZSTD_isError(functionResult))
diff --git a/xen/common/zstd/fse_decompress.c b/xen/common/zstd/fse_decompress.c
index 6c61e9002e..ba5f960eb3 100644
--- a/xen/common/zstd/fse_decompress.c
+++ b/xen/common/zstd/fse_decompress.c
@@ -82,7 +82,7 @@
 
 /* Function templates */
 
-size_t INIT FSE_buildDTable_wksp(FSE_DTable *dt, const short *normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void *workspace, size_t workspaceSize)
+size_t __init FSE_buildDTable_wksp(FSE_DTable *dt, const short *normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void *workspace, size_t workspaceSize)
 {
 	void *const tdPtr = dt + 1; /* because *dt is unsigned, 32-bits aligned on 32-bits */
 	FSE_DECODE_TYPE *const tableDecode = (FSE_DECODE_TYPE *)(tdPtr);
@@ -157,7 +157,7 @@ size_t INIT FSE_buildDTable_wksp(FSE_DTable *dt, const short *normalizedCounter,
 /*-*******************************************************
 *  Decompression (Byte symbols)
 *********************************************************/
-size_t INIT FSE_buildDTable_rle(FSE_DTable *dt, BYTE symbolValue)
+size_t __init FSE_buildDTable_rle(FSE_DTable *dt, BYTE symbolValue)
 {
 	void *ptr = dt;
 	FSE_DTableHeader *const DTableH = (FSE_DTableHeader *)ptr;
@@ -174,7 +174,7 @@ size_t INIT FSE_buildDTable_rle(FSE_DTable *dt, BYTE symbolValue)
 	return 0;
 }
 
-size_t INIT FSE_buildDTable_raw(FSE_DTable *dt, unsigned nbBits)
+size_t __init FSE_buildDTable_raw(FSE_DTable *dt, unsigned nbBits)
 {
 	void *ptr = dt;
 	FSE_DTableHeader *const DTableH = (FSE_DTableHeader *)ptr;
@@ -269,7 +269,7 @@ FORCE_INLINE size_t FSE_decompress_usingDTable_generic(void *dst, size_t maxDstS
 	return op - ostart;
 }
 
-size_t INIT FSE_decompress_usingDTable(void *dst, size_t originalSize, const void *cSrc, size_t cSrcSize, const FSE_DTable *dt)
+size_t __init FSE_decompress_usingDTable(void *dst, size_t originalSize, const void *cSrc, size_t cSrcSize, const FSE_DTable *dt)
 {
 	const void *ptr = dt;
 	const FSE_DTableHeader *DTableH = (const FSE_DTableHeader *)ptr;
@@ -281,7 +281,7 @@ size_t INIT FSE_decompress_usingDTable(void *dst, size_t originalSize, const voi
 	return FSE_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 0);
 }
 
-size_t INIT FSE_decompress_wksp(void *dst, size_t dstCapacity, const void *cSrc, size_t cSrcSize, unsigned maxLog, void *workspace, size_t workspaceSize)
+size_t __init FSE_decompress_wksp(void *dst, size_t dstCapacity, const void *cSrc, size_t cSrcSize, unsigned maxLog, void *workspace, size_t workspaceSize)
 {
 	const BYTE *const istart = (const BYTE *)cSrc;
 	const BYTE *ip = istart;
diff --git a/xen/common/zstd/huf_decompress.c b/xen/common/zstd/huf_decompress.c
index f6aca709a6..1bdfc695d0 100644
--- a/xen/common/zstd/huf_decompress.c
+++ b/xen/common/zstd/huf_decompress.c
@@ -68,7 +68,7 @@ typedef struct {
 	BYTE reserved;
 } DTableDesc;
 
-static DTableDesc INIT HUF_getDTableDesc(const HUF_DTable *table)
+static DTableDesc __init HUF_getDTableDesc(const HUF_DTable *table)
 {
 	DTableDesc dtd;
 	memcpy(&dtd, table, sizeof(dtd));
@@ -84,7 +84,7 @@ typedef struct {
 	BYTE nbBits;
 } HUF_DEltX2; /* single-symbol decoding */
 
-size_t INIT HUF_readDTableX2_wksp(HUF_DTable *DTable, const void *src, size_t srcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_readDTableX2_wksp(HUF_DTable *DTable, const void *src, size_t srcSize, void *workspace, size_t workspaceSize)
 {
 	U32 tableLog = 0;
 	U32 nbSymbols = 0;
@@ -152,7 +152,7 @@ size_t INIT HUF_readDTableX2_wksp(HUF_DTable *DTable, const void *src, size_t sr
 	return iSize;
 }
 
-static BYTE INIT HUF_decodeSymbolX2(BIT_DStream_t *Dstream, const HUF_DEltX2 *dt, const U32 dtLog)
+static BYTE __init HUF_decodeSymbolX2(BIT_DStream_t *Dstream, const HUF_DEltX2 *dt, const U32 dtLog)
 {
 	size_t const val = BIT_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */
 	BYTE const c = dt[val].byte;
@@ -193,7 +193,7 @@ FORCE_INLINE size_t HUF_decodeStreamX2(BYTE *p, BIT_DStream_t *const bitDPtr, BY
 	return pEnd - pStart;
 }
 
-static size_t INIT HUF_decompress1X2_usingDTable_internal(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+static size_t __init HUF_decompress1X2_usingDTable_internal(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	BYTE *op = (BYTE *)dst;
 	BYTE *const oend = op + dstSize;
@@ -218,7 +218,7 @@ static size_t INIT HUF_decompress1X2_usingDTable_internal(void *dst, size_t dstS
 	return dstSize;
 }
 
-size_t INIT HUF_decompress1X2_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+size_t __init HUF_decompress1X2_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	DTableDesc dtd = HUF_getDTableDesc(DTable);
 	if (dtd.tableType != 0)
@@ -226,7 +226,7 @@ size_t INIT HUF_decompress1X2_usingDTable(void *dst, size_t dstSize, const void
 	return HUF_decompress1X2_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable);
 }
 
-size_t INIT HUF_decompress1X2_DCtx_wksp(HUF_DTable *DCtx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_decompress1X2_DCtx_wksp(HUF_DTable *DCtx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
 {
 	const BYTE *ip = (const BYTE *)cSrc;
 
@@ -241,7 +241,7 @@ size_t INIT HUF_decompress1X2_DCtx_wksp(HUF_DTable *DCtx, void *dst, size_t dstS
 	return HUF_decompress1X2_usingDTable_internal(dst, dstSize, ip, cSrcSize, DCtx);
 }
 
-static size_t INIT HUF_decompress4X2_usingDTable_internal(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+static size_t __init HUF_decompress4X2_usingDTable_internal(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	/* Check */
 	if (cSrcSize < 10)
@@ -349,7 +349,7 @@ static size_t INIT HUF_decompress4X2_usingDTable_internal(void *dst, size_t dstS
 	}
 }
 
-size_t INIT HUF_decompress4X2_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+size_t __init HUF_decompress4X2_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	DTableDesc dtd = HUF_getDTableDesc(DTable);
 	if (dtd.tableType != 0)
@@ -357,7 +357,7 @@ size_t INIT HUF_decompress4X2_usingDTable(void *dst, size_t dstSize, const void
 	return HUF_decompress4X2_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable);
 }
 
-size_t INIT HUF_decompress4X2_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_decompress4X2_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
 {
 	const BYTE *ip = (const BYTE *)cSrc;
 
@@ -388,7 +388,7 @@ typedef struct {
 
 /* HUF_fillDTableX4Level2() :
  * `rankValOrigin` must be a table of at least (HUF_TABLELOG_MAX + 1) U32 */
-static void INIT HUF_fillDTableX4Level2(HUF_DEltX4 *DTable, U32 sizeLog, const U32 consumed, const U32 *rankValOrigin, const int minWeight,
+static void __init HUF_fillDTableX4Level2(HUF_DEltX4 *DTable, U32 sizeLog, const U32 consumed, const U32 *rankValOrigin, const int minWeight,
 					const sortedSymbol_t *sortedSymbols, const U32 sortedListSize, U32 nbBitsBaseline, U16 baseSeq)
 {
 	HUF_DEltX4 DElt;
@@ -434,7 +434,7 @@ static void INIT HUF_fillDTableX4Level2(HUF_DEltX4 *DTable, U32 sizeLog, const U
 typedef U32 rankVal_t[HUF_TABLELOG_MAX][HUF_TABLELOG_MAX + 1];
 typedef U32 rankValCol_t[HUF_TABLELOG_MAX + 1];
 
-static void INIT HUF_fillDTableX4(HUF_DEltX4 *DTable, const U32 targetLog, const sortedSymbol_t *sortedList,
+static void __init HUF_fillDTableX4(HUF_DEltX4 *DTable, const U32 targetLog, const sortedSymbol_t *sortedList,
 				  const U32 sortedListSize, const U32 *rankStart,
 			          rankVal_t rankValOrigin, const U32 maxWeight, const U32 nbBitsBaseline)
 {
@@ -477,7 +477,7 @@ static void INIT HUF_fillDTableX4(HUF_DEltX4 *DTable, const U32 targetLog, const
 	}
 }
 
-size_t INIT HUF_readDTableX4_wksp(HUF_DTable *DTable, const void *src, size_t srcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_readDTableX4_wksp(HUF_DTable *DTable, const void *src, size_t srcSize, void *workspace, size_t workspaceSize)
 {
 	U32 tableLog, maxW, sizeOfSort, nbSymbols;
 	DTableDesc dtd = HUF_getDTableDesc(DTable);
@@ -590,7 +590,7 @@ size_t INIT HUF_readDTableX4_wksp(HUF_DTable *DTable, const void *src, size_t sr
 	return iSize;
 }
 
-static U32 INIT HUF_decodeSymbolX4(void *op, BIT_DStream_t *DStream, const HUF_DEltX4 *dt, const U32 dtLog)
+static U32 __init HUF_decodeSymbolX4(void *op, BIT_DStream_t *DStream, const HUF_DEltX4 *dt, const U32 dtLog)
 {
 	size_t const val = BIT_lookBitsFast(DStream, dtLog); /* note : dtLog >= 1 */
 	memcpy(op, dt + val, 2);
@@ -598,7 +598,7 @@ static U32 INIT HUF_decodeSymbolX4(void *op, BIT_DStream_t *DStream, const HUF_D
 	return dt[val].length;
 }
 
-static U32 INIT HUF_decodeLastSymbolX4(void *op, BIT_DStream_t *DStream, const HUF_DEltX4 *dt, const U32 dtLog)
+static U32 __init HUF_decodeLastSymbolX4(void *op, BIT_DStream_t *DStream, const HUF_DEltX4 *dt, const U32 dtLog)
 {
 	size_t const val = BIT_lookBitsFast(DStream, dtLog); /* note : dtLog >= 1 */
 	memcpy(op, dt + val, 1);
@@ -650,7 +650,7 @@ FORCE_INLINE size_t HUF_decodeStreamX4(BYTE *p, BIT_DStream_t *bitDPtr, BYTE *co
 	return p - pStart;
 }
 
-static size_t INIT HUF_decompress1X4_usingDTable_internal(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+static size_t __init HUF_decompress1X4_usingDTable_internal(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	BIT_DStream_t bitD;
 
@@ -679,7 +679,7 @@ static size_t INIT HUF_decompress1X4_usingDTable_internal(void *dst, size_t dstS
 	return dstSize;
 }
 
-size_t INIT HUF_decompress1X4_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+size_t __init HUF_decompress1X4_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	DTableDesc dtd = HUF_getDTableDesc(DTable);
 	if (dtd.tableType != 1)
@@ -687,7 +687,7 @@ size_t INIT HUF_decompress1X4_usingDTable(void *dst, size_t dstSize, const void
 	return HUF_decompress1X4_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable);
 }
 
-size_t INIT HUF_decompress1X4_DCtx_wksp(HUF_DTable *DCtx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_decompress1X4_DCtx_wksp(HUF_DTable *DCtx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
 {
 	const BYTE *ip = (const BYTE *)cSrc;
 
@@ -702,7 +702,7 @@ size_t INIT HUF_decompress1X4_DCtx_wksp(HUF_DTable *DCtx, void *dst, size_t dstS
 	return HUF_decompress1X4_usingDTable_internal(dst, dstSize, ip, cSrcSize, DCtx);
 }
 
-static size_t INIT HUF_decompress4X4_usingDTable_internal(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+static size_t __init HUF_decompress4X4_usingDTable_internal(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	if (cSrcSize < 10)
 		return ERROR(corruption_detected); /* strict minimum : jump table + 1 byte per stream */
@@ -812,7 +812,7 @@ static size_t INIT HUF_decompress4X4_usingDTable_internal(void *dst, size_t dstS
 	}
 }
 
-size_t INIT HUF_decompress4X4_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+size_t __init HUF_decompress4X4_usingDTable(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	DTableDesc dtd = HUF_getDTableDesc(DTable);
 	if (dtd.tableType != 1)
@@ -820,7 +820,7 @@ size_t INIT HUF_decompress4X4_usingDTable(void *dst, size_t dstSize, const void
 	return HUF_decompress4X4_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable);
 }
 
-size_t INIT HUF_decompress4X4_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_decompress4X4_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
 {
 	const BYTE *ip = (const BYTE *)cSrc;
 
@@ -839,14 +839,14 @@ size_t INIT HUF_decompress4X4_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstS
 /* Generic decompression selector */
 /* ********************************/
 
-size_t INIT HUF_decompress1X_usingDTable(void *dst, size_t maxDstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+size_t __init HUF_decompress1X_usingDTable(void *dst, size_t maxDstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	DTableDesc const dtd = HUF_getDTableDesc(DTable);
 	return dtd.tableType ? HUF_decompress1X4_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable)
 			     : HUF_decompress1X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable);
 }
 
-size_t INIT HUF_decompress4X_usingDTable(void *dst, size_t maxDstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
+size_t __init HUF_decompress4X_usingDTable(void *dst, size_t maxDstSize, const void *cSrc, size_t cSrcSize, const HUF_DTable *DTable)
 {
 	DTableDesc const dtd = HUF_getDTableDesc(DTable);
 	return dtd.tableType ? HUF_decompress4X4_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable)
@@ -882,7 +882,7 @@ static const algo_time_t algoTime[16 /* Quantization */][3 /* single, double, qu
 *   based on a set of pre-determined metrics.
 *   @return : 0==HUF_decompress4X2, 1==HUF_decompress4X4 .
 *   Assumption : 0 < cSrcSize < dstSize <= 128 KB */
-U32 INIT HUF_selectDecoder(size_t dstSize, size_t cSrcSize)
+U32 __init HUF_selectDecoder(size_t dstSize, size_t cSrcSize)
 {
 	/* decoder timing evaluation */
 	U32 const Q = (U32)(cSrcSize * 16 / dstSize); /* Q < 16 since dstSize > cSrcSize */
@@ -896,7 +896,7 @@ U32 INIT HUF_selectDecoder(size_t dstSize, size_t cSrcSize)
 
 typedef size_t (*decompressionAlgo)(void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize);
 
-size_t INIT HUF_decompress4X_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_decompress4X_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
 {
 	/* validation checks */
 	if (dstSize == 0)
@@ -919,7 +919,7 @@ size_t INIT HUF_decompress4X_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSi
 	}
 }
 
-size_t INIT HUF_decompress4X_hufOnly_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_decompress4X_hufOnly_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
 {
 	/* validation checks */
 	if (dstSize == 0)
@@ -934,7 +934,7 @@ size_t INIT HUF_decompress4X_hufOnly_wksp(HUF_DTable *dctx, void *dst, size_t ds
 	}
 }
 
-size_t INIT HUF_decompress1X_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
+size_t __init HUF_decompress1X_DCtx_wksp(HUF_DTable *dctx, void *dst, size_t dstSize, const void *cSrc, size_t cSrcSize, void *workspace, size_t workspaceSize)
 {
 	/* validation checks */
 	if (dstSize == 0)
diff --git a/xen/common/zstd/zstd_common.c b/xen/common/zstd/zstd_common.c
index a35c4a5f14..9a85e938cd 100644
--- a/xen/common/zstd/zstd_common.c
+++ b/xen/common/zstd/zstd_common.c
@@ -31,7 +31,7 @@
 		(stack)->ptr <= (stack)->end ? ptr : NULL;      \
 	})
 
-ZSTD_customMem INIT ZSTD_initStack(void *workspace, size_t workspaceSize)
+ZSTD_customMem __init ZSTD_initStack(void *workspace, size_t workspaceSize)
 {
 	ZSTD_customMem stackMem = {ZSTD_stackAlloc, ZSTD_stackFree, workspace};
 	ZSTD_stack *stack = (ZSTD_stack *)workspace;
@@ -47,27 +47,27 @@ ZSTD_customMem INIT ZSTD_initStack(void *workspace, size_t workspaceSize)
 	return stackMem;
 }
 
-void *INIT ZSTD_stackAllocAll(void *opaque, size_t *size)
+void *__init ZSTD_stackAllocAll(void *opaque, size_t *size)
 {
 	ZSTD_stack *stack = (ZSTD_stack *)opaque;
 	*size = (BYTE const *)stack->end - (BYTE *)ZSTD_PTR_ALIGN(stack->ptr);
 	return stack_push(stack, *size);
 }
 
-void *INIT ZSTD_stackAlloc(void *opaque, size_t size)
+void *__init ZSTD_stackAlloc(void *opaque, size_t size)
 {
 	ZSTD_stack *stack = (ZSTD_stack *)opaque;
 	return stack_push(stack, size);
 }
-void INIT ZSTD_stackFree(void *opaque, void *address)
+void __init ZSTD_stackFree(void *opaque, void *address)
 {
 	(void)opaque;
 	(void)address;
 }
 
-void *INIT ZSTD_malloc(size_t size, ZSTD_customMem customMem) { return customMem.customAlloc(customMem.opaque, size); }
+void *__init ZSTD_malloc(size_t size, ZSTD_customMem customMem) { return customMem.customAlloc(customMem.opaque, size); }
 
-void INIT ZSTD_free(void *ptr, ZSTD_customMem customMem)
+void __init ZSTD_free(void *ptr, ZSTD_customMem customMem)
 {
 	if (ptr != NULL)
 		customMem.customFree(customMem.opaque, ptr);
diff --git a/xen/common/zstd/zstd_internal.h b/xen/common/zstd/zstd_internal.h
index caa7aab406..b7dd14f6ce 100644
--- a/xen/common/zstd/zstd_internal.h
+++ b/xen/common/zstd/zstd_internal.h
@@ -21,7 +21,7 @@
 *  Compiler specifics
 *********************************************************/
 #define FORCE_INLINE static always_inline
-#define FORCE_NOINLINE static noinline INIT
+#define FORCE_NOINLINE static noinline __init
 
 /*-*************************************
 *  Dependencies
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 29 14:11:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Apr 2021 14:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120064.227026 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lc7Ns-0007eF-NP; Thu, 29 Apr 2021 14:11:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120064.227026; Thu, 29 Apr 2021 14:11:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lc7Ns-0007e7-KQ; Thu, 29 Apr 2021 14:11:16 +0000
Received: by outflank-mailman (input) for mailman id 120064;
 Thu, 29 Apr 2021 14:11:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lc7Nr-0007dz-6y
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 14:11:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lc7Nr-0005rU-64
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 14:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lc7Nr-0004o0-3D
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 14:11:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PUpcXiTKJJw87JfoVgg9T/73k1veapv1sQG7qTzepNw=; b=s22rdpnpgNYQejEbZZF1F6+2vJ
	u8mVUodiVRKtXaFgQmMTOWQN9c3TbrmxBVuPKgcIS5VeoeRnu+vCHMnUt5l2moENtML9tDWut32Xc
	8qR7/kgay4/kGlfFbkT41CrMlv9xYxMrJcapUUwtYvXEj+RQbi2ho2EZWHzd5f2VgxWo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/decompress: drop STATIC and INIT
Message-Id: <E1lc7Nr-0004o0-3D@xenbits.xenproject.org>
Date: Thu, 29 Apr 2021 14:11:15 +0000

commit ec0ec164877be4e99dfef2ae27eea4ca6460cdf7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 29 16:03:38 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 29 16:03:38 2021 +0200

    xen/decompress: drop STATIC and INIT
    
    Except for one last instance, all users have been removed in earlier
    changes.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/efi/efi-dom0.c | 2 +-
 xen/common/decompress.h     | 6 ------
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/xen/arch/arm/efi/efi-dom0.c b/xen/arch/arm/efi/efi-dom0.c
index 1c356540f7..494420eaa2 100644
--- a/xen/arch/arm/efi/efi-dom0.c
+++ b/xen/arch/arm/efi/efi-dom0.c
@@ -28,7 +28,7 @@
 #include <asm/setup.h>
 #include <asm/acpi.h>
 #include "../../../common/decompress.h"
-#define XZ_EXTERN STATIC
+#define XZ_EXTERN static
 #include "../../../common/xz/crc32.c"
 
 /* Constant to indicate "Xen" in unicode u16 format */
diff --git a/xen/common/decompress.h b/xen/common/decompress.h
index 7144fb46ce..e8195b353a 100644
--- a/xen/common/decompress.h
+++ b/xen/common/decompress.h
@@ -7,9 +7,6 @@
 #include <xen/types.h>
 #include <xen/xmalloc.h>
 
-#define STATIC static
-#define INIT __init
-
 #define malloc xmalloc_bytes
 #define free xfree
 
@@ -18,9 +15,6 @@
 
 #else
 
-#define STATIC static
-#define INIT
-
 #undef __init /* tools/libs/guest/xg_private.h has its own one */
 #define __init
 #define __initdata
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 29 14:11:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Apr 2021 14:11:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120065.227030 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lc7O2-0007fm-Ot; Thu, 29 Apr 2021 14:11:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120065.227030; Thu, 29 Apr 2021 14:11:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lc7O2-0007fe-M2; Thu, 29 Apr 2021 14:11:26 +0000
Received: by outflank-mailman (input) for mailman id 120065;
 Thu, 29 Apr 2021 14:11:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lc7O1-0007fS-BQ
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 14:11:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lc7O1-0005rz-9q
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 14:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lc7O1-0004on-8D
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 14:11:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=m0tXpDJgnn6eevROmdxER5pQrOm0ZNrSUlvrxtImF5Q=; b=NVUwU+KNBka2/W9K0pedWq6Q92
	5zjLwgcOIB9vfpVjKEjchQNbNqW0oc0t6WYc7DGmrgmkGpx8HN834dF3TTXa7AutgSuS6Dt2pS0sC
	T1wNGRM/lsi98tblAlC7S56JVh9e+F4/2AbEbQegaluwButjASbE/xdx+TkUgGB7NBco=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cpuid: do not expand max leaves on restore
Message-Id: <E1lc7O1-0004on-8D@xenbits.xenproject.org>
Date: Thu, 29 Apr 2021 14:11:25 +0000

commit 111c8c33a8a18588f3da3c5dbb7f5c63ddb98ce5
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Apr 29 16:04:11 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 29 16:04:11 2021 +0200

    x86/cpuid: do not expand max leaves on restore
    
    When restoring limit the maximum leaves to the ones supported by Xen
    4.12 in order to not expand the maximum leaves a guests sees. Note
    this is unlikely to cause real issues.
    
    Guests restored from Xen versions 4.13 or greater will contain CPUID
    data on the stream that will override the values set by
    xc_cpuid_apply_policy.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/libs/guest/xg_cpuid_x86.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 5ea69ad3d5..bf9a3750b5 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -498,18 +498,23 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
         goto out;
     }
 
-    /*
-     * Account for feature which have been disabled by default since Xen 4.13,
-     * so migrated-in VM's don't risk seeing features disappearing.
-     */
     if ( restore )
     {
+        /*
+         * Account for feature which have been disabled by default since Xen 4.13,
+         * so migrated-in VM's don't risk seeing features disappearing.
+         */
         p->basic.rdrand = test_bit(X86_FEATURE_RDRAND, host_featureset);
 
         if ( di.hvm )
         {
             p->feat.mpx = test_bit(X86_FEATURE_MPX, host_featureset);
         }
+
+        /* Clamp maximum leaves to the ones supported on 4.12. */
+        p->basic.max_leaf = min(p->basic.max_leaf, 0xdu);
+        p->feat.max_subleaf = 0;
+        p->extd.max_leaf = min(p->extd.max_leaf, 0x1cu);
     }
 
     if ( featureset )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 29 14:11:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Apr 2021 14:11:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120066.227034 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lc7OC-0007hD-Qd; Thu, 29 Apr 2021 14:11:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120066.227034; Thu, 29 Apr 2021 14:11:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lc7OC-0007h5-NZ; Thu, 29 Apr 2021 14:11:36 +0000
Received: by outflank-mailman (input) for mailman id 120066;
 Thu, 29 Apr 2021 14:11:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lc7OB-0007gx-Dg
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 14:11:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lc7OB-0005sA-Cs
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 14:11:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lc7OB-0004pR-C4
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 14:11:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1Ztm/LFR+k0KsENW8b82pxJUBx8scMJQ7mW3qO7/EYM=; b=aZM3ch7J/Ti1rOvCbDFxtrKSg7
	Wrpc0fIXyAWetVEBA0A39IjS8LtBOntw53bqJ8T3xV0REcPAIMa3MfIkiuHyGN6Tn3Q3kez2F/h/d
	viGdVQuGc45Ea0yPoPdcQ48xpDtpBznhejTCtKoiqMX0a8SBcNjdNsFIWI4W//mYPDoA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: correct comment about alternatives ordering
Message-Id: <E1lc7OB-0004pR-C4@xenbits.xenproject.org>
Date: Thu, 29 Apr 2021 14:11:35 +0000

commit 9a5071e80be67e7a480ef9ba9680af6754198cdb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Apr 29 16:04:35 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 29 16:04:35 2021 +0200

    x86: correct comment about alternatives ordering
    
    Unlike Linux, Xen has never (so far) used alternatives patching for
    memcpy() or memset(), even less such utilizing multiple alternatives.
    Correct the Linux-inherited comment to match reality.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/alternative.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c
index 004e9ede25..1cb531c9df 100644
--- a/xen/arch/x86/alternative.c
+++ b/xen/arch/x86/alternative.c
@@ -194,8 +194,7 @@ static void init_or_livepatch _apply_alternatives(struct alt_instr *start,
     /*
      * The scan order should be from start to end. A later scanned
      * alternative code can overwrite a previous scanned alternative code.
-     * Some kernel functions (e.g. memcpy, memset, etc) use this order to
-     * patch code.
+     * Some code (e.g. ALTERNATIVE_2()) relies on this order of patching.
      *
      * So be careful if you want to change the scan order to any other
      * order.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 29 14:11:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Apr 2021 14:11:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120067.227038 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lc7OM-0007iT-SH; Thu, 29 Apr 2021 14:11:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120067.227038; Thu, 29 Apr 2021 14:11: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 1lc7OM-0007iK-P6; Thu, 29 Apr 2021 14:11:46 +0000
Received: by outflank-mailman (input) for mailman id 120067;
 Thu, 29 Apr 2021 14:11:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lc7OL-0007i7-HL
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 14:11:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lc7OL-0005sK-GT
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 14:11:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lc7OL-0004q2-Ey
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 14:11:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Dp6xJdurK+MVjP5xmTEw+hmWBNPMbuVhdGF91jieyn0=; b=CLltMDjc3UVWx0OoehxOohAv5r
	EIF3yq/IPhNUgSZwfryQgesaJ0NdSS+vqvMTIi4xkDTCxSfbAtxHR0RTMfKb9v85AQwnckp28ZXzd
	E9ozSwZJfqPgI53c2l0NGnTV4lKo7UyQKWay9PD88utOb9RiIKwoYVN0sXrLfCaN8tHQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/oprofile: remove compat accessors usage from backtrace
Message-Id: <E1lc7OL-0004q2-Ey@xenbits.xenproject.org>
Date: Thu, 29 Apr 2021 14:11:45 +0000

commit 39e7a942738f1ef48878fff67d140bbc0c83e7ff
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Apr 29 16:05:00 2021 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Apr 29 16:05:00 2021 +0200

    x86/oprofile: remove compat accessors usage from backtrace
    
    Remove the unneeded usage of the compat layer to copy frame pointers
    from guest address space. Instead just use raw_copy_from_guest.
    
    While there change the accessibility check of one frame_head beyond to
    be performed as part of the copy, like it's done in the Linux code in
    5.11 and earlier versions. Note it's unclear why this is needed.
    
    Also drop the explicit truncation of the head pointer in the 32bit
    case as all callers already pass a zero extended value. The first
    value being rsp from the guest registers, and further calls will use
    ebp from frame_head_32bit struct.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/oprofile/backtrace.c | 41 +++++++++++----------------------------
 1 file changed, 11 insertions(+), 30 deletions(-)

diff --git a/xen/arch/x86/oprofile/backtrace.c b/xen/arch/x86/oprofile/backtrace.c
index bd5d1b0f6c..61de18c8d5 100644
--- a/xen/arch/x86/oprofile/backtrace.c
+++ b/xen/arch/x86/oprofile/backtrace.c
@@ -20,7 +20,6 @@ struct __packed frame_head {
     unsigned long ret;
 };
 typedef struct frame_head frame_head_t;
-DEFINE_XEN_GUEST_HANDLE(frame_head_t);
 
 struct __packed frame_head_32bit {
     uint32_t ebp;
@@ -43,7 +42,6 @@ dump_hypervisor_backtrace(struct vcpu *vcpu, const struct frame_head *head,
     return head->ebp;
 }
 
-#ifdef CONFIG_COMPAT
 static inline int is_32bit_vcpu(struct vcpu *vcpu)
 {
     if (is_hvm_vcpu(vcpu))
@@ -51,52 +49,35 @@ static inline int is_32bit_vcpu(struct vcpu *vcpu)
     else
         return is_pv_32bit_vcpu(vcpu);
 }
-#endif
 
 static struct frame_head *
 dump_guest_backtrace(struct vcpu *vcpu, const struct frame_head *head,
                      int mode)
 {
-    frame_head_t bufhead;
+    /* Also check accessibility of one struct frame_head beyond. */
+    frame_head_t bufhead[2];
 
-#ifdef CONFIG_COMPAT
     if ( is_32bit_vcpu(vcpu) )
     {
-        DEFINE_COMPAT_HANDLE(frame_head32_t);
-        __compat_handle_const_frame_head32_t guest_head =
-            { .c = (unsigned long)head };
-        frame_head32_t bufhead32;
-
-        /* Also check accessibility of one struct frame_head beyond */
-        if (!compat_handle_okay(guest_head, 2))
-            return 0;
-        if (__copy_from_compat(&bufhead32, guest_head, 1))
-            return 0;
-        bufhead.ebp = (struct frame_head *)(unsigned long)bufhead32.ebp;
-        bufhead.ret = bufhead32.ret;
-    }
-    else
-#endif
-    {
-        XEN_GUEST_HANDLE_PARAM(const_frame_head_t) guest_head =
-            const_guest_handle_from_ptr(head, frame_head_t);
+        frame_head32_t bufhead32[2];
 
-        /* Also check accessibility of one struct frame_head beyond */
-        if (!guest_handle_okay(guest_head, 2))
-            return 0;
-        if (__copy_from_guest(&bufhead, guest_head, 1))
+        if ( raw_copy_from_guest(bufhead32, head, sizeof(bufhead32)) )
             return 0;
+        bufhead[0].ebp = (struct frame_head *)(unsigned long)bufhead32[0].ebp;
+        bufhead[0].ret = bufhead32[0].ret;
     }
+    else if ( raw_copy_from_guest(bufhead, head, sizeof(bufhead)) )
+        return 0;
     
-    if (!xenoprof_add_trace(vcpu, bufhead.ret, mode))
+    if ( !xenoprof_add_trace(vcpu, bufhead[0].ret, mode) )
         return 0;
     
     /* frame pointers should strictly progress back up the stack
      * (towards higher addresses) */
-    if (head >= bufhead.ebp)
+    if ( head >= bufhead[0].ebp )
         return NULL;
     
-    return bufhead.ebp;
+    return bufhead[0].ebp;
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 29 18:33:14 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Apr 2021 18:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120170.227240 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lcBTH-0006Fc-9P; Thu, 29 Apr 2021 18:33:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120170.227240; Thu, 29 Apr 2021 18:33:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lcBTH-0006FU-6T; Thu, 29 Apr 2021 18:33:07 +0000
Received: by outflank-mailman (input) for mailman id 120170;
 Thu, 29 Apr 2021 18:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBTF-0006FP-GV
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:33:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBTF-0002KH-CL
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBTF-00056c-Av
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iDGEBKr7hsS76GqpLPu9XOL21bj6eb8fQEUrhOHN82Q=; b=GQMw/JgQoa7kzTIlZtzcDHNX6n
	SZnWrYI3n7ONs4pkgQII2rtmhQblaRNmb+LGqqg567G/vz3rVUpbt0/eItXpaTyIr5GfM6gUXPfqx
	H4HHNVrefDtQgXhrOkLKwU6C9iKKdKiDcmTndVhL4QiTSR1wFDgsNoKiFz6NHrQCploo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libs/guest: rename xc_get_cpu_policy_size to xc_cpu_policy_get_size
Message-Id: <E1lcBTF-00056c-Av@xenbits.xenproject.org>
Date: Thu, 29 Apr 2021 18:33:05 +0000

commit 537ae417853233a103b761adfd5d191794018f0a
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Mar 22 10:37:35 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 29 19:27:21 2021 +0100

    libs/guest: rename xc_get_cpu_policy_size to xc_cpu_policy_get_size
    
    Preparatory change to introduce a new set of xc_cpu_policy_* functions
    that will replace the current CPUID/MSR helpers.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h             | 2 +-
 tools/libs/guest/xg_cpuid_x86.c     | 6 +++---
 tools/libs/guest/xg_sr_common_x86.c | 2 +-
 tools/misc/xen-cpuid.c              | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 318920166c..e91ff92b9b 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2594,7 +2594,7 @@ int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
 int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
                           uint32_t *nr_features, uint32_t *featureset);
 
-int xc_get_cpu_policy_size(xc_interface *xch, uint32_t *nr_leaves,
+int xc_cpu_policy_get_size(xc_interface *xch, uint32_t *nr_leaves,
                            uint32_t *nr_msrs);
 int xc_get_system_cpu_policy(xc_interface *xch, uint32_t index,
                              uint32_t *nr_leaves, xen_cpuid_leaf_t *leaves,
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index bf9a3750b5..4491a68bd7 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -109,7 +109,7 @@ const uint32_t *xc_get_static_cpu_featuremask(
     return masks[mask];
 }
 
-int xc_get_cpu_policy_size(xc_interface *xch, uint32_t *nr_leaves,
+int xc_cpu_policy_get_size(xc_interface *xch, uint32_t *nr_leaves,
                            uint32_t *nr_msrs)
 {
     struct xen_sysctl sysctl = {};
@@ -302,7 +302,7 @@ static int xc_cpuid_xend_policy(
         goto fail;
     }
 
-    rc = xc_get_cpu_policy_size(xch, &nr_leaves, &nr_msrs);
+    rc = xc_cpu_policy_get_size(xch, &nr_leaves, &nr_msrs);
     if ( rc )
     {
         PERROR("Failed to obtain policy info size");
@@ -448,7 +448,7 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
         goto out;
     }
 
-    rc = xc_get_cpu_policy_size(xch, &nr_leaves, &nr_msrs);
+    rc = xc_cpu_policy_get_size(xch, &nr_leaves, &nr_msrs);
     if ( rc )
     {
         PERROR("Failed to obtain policy info size");
diff --git a/tools/libs/guest/xg_sr_common_x86.c b/tools/libs/guest/xg_sr_common_x86.c
index 3168c5485f..4982519e05 100644
--- a/tools/libs/guest/xg_sr_common_x86.c
+++ b/tools/libs/guest/xg_sr_common_x86.c
@@ -50,7 +50,7 @@ int write_x86_cpu_policy_records(struct xc_sr_context *ctx)
     uint32_t nr_leaves = 0, nr_msrs = 0;
     int rc;
 
-    if ( xc_get_cpu_policy_size(xch, &nr_leaves, &nr_msrs) < 0 )
+    if ( xc_cpu_policy_get_size(xch, &nr_leaves, &nr_msrs) < 0 )
     {
         PERROR("Unable to get CPU Policy size");
         return -1;
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index a17ad07832..027b25ad01 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -472,7 +472,7 @@ int main(int argc, char **argv)
         if ( !xch )
             err(1, "xc_interface_open");
 
-        if ( xc_get_cpu_policy_size(xch, &max_leaves, &max_msrs) )
+        if ( xc_cpu_policy_get_size(xch, &max_leaves, &max_msrs) )
             err(1, "xc_get_cpu_policy_size(...)");
         if ( domid == -1 )
             printf("Xen reports there are maximum %u leaves and %u MSRs\n",
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 29 18:33:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Apr 2021 18:33:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120171.227244 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lcBTQ-0006GI-B6; Thu, 29 Apr 2021 18:33:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120171.227244; Thu, 29 Apr 2021 18: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 1lcBTQ-0006GA-7w; Thu, 29 Apr 2021 18:33:16 +0000
Received: by outflank-mailman (input) for mailman id 120171;
 Thu, 29 Apr 2021 18:33:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBTP-0006G5-KP
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:33:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBTP-0002KK-Jd
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBTP-00057N-Em
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:33:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9RID9166H0/lIY3vYQguJmtzPGkreYWbdU2ZsbqxKgc=; b=O1TZ22JI7Onpykc7B6XPrdYc04
	69rn0lz5J1UjdZFFn/8wVUn+vtzNf2LdnHsPdUrmhjNzsbsPH8mhsa/NGIr3V/JRyVf2NX5d7CSe2
	KXvpR63x3XWUl6f6Xac5CjACWlLTQKrcpxXtOh9AH3AZIFxqVspDAKZmQxejVCacF5Hg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libs/guest: introduce xc_cpu_policy_t
Message-Id: <E1lcBTP-00057N-Em@xenbits.xenproject.org>
Date: Thu, 29 Apr 2021 18:33:15 +0000

commit 989ec5bd1d790ef53db2cf0f12244d10b07bfa3a
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Mar 16 16:39:00 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 29 19:27:21 2021 +0100

    libs/guest: introduce xc_cpu_policy_t
    
    Introduce an opaque type that is used to store the CPUID and MSRs
    policies of a domain. Such type uses the existing {cpuid,msr}_policy
    structures to store the data, but doesn't expose the type to the users
    of the xenguest library. There are also two arrays to allow for easier
    serialization without requiring an allocation each time.
    
    Introduce an allocation (init) and freeing function (destroy) to
    manage the type.
    
    Note the type is not yet used anywhere.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h         |  6 ++++++
 tools/libs/guest/xg_cpuid_x86.c | 18 ++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index e91ff92b9b..1aba814f01 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2590,6 +2590,12 @@ int xc_psr_get_domain_data(xc_interface *xch, uint32_t domid,
 int xc_psr_get_hw_info(xc_interface *xch, uint32_t socket,
                        xc_psr_feat_type type, xc_psr_hw_info *hw_info);
 
+typedef struct xc_cpu_policy *xc_cpu_policy_t;
+
+/* Create and free a xc_cpu_policy object. */
+xc_cpu_policy_t xc_cpu_policy_init(void);
+void xc_cpu_policy_destroy(xc_cpu_policy_t policy);
+
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
 int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
                           uint32_t *nr_features, uint32_t *featureset);
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 4491a68bd7..39d62fe2f3 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -39,6 +39,13 @@ enum {
 #define bitmaskof(idx)      (1u << ((idx) & 31))
 #define featureword_of(idx) ((idx) >> 5)
 
+struct xc_cpu_policy {
+    struct cpuid_policy cpuid;
+    struct msr_policy msr;
+    xen_cpuid_leaf_t leaves[CPUID_MAX_SERIALISED_LEAVES];
+    xen_msr_entry_t entries[MSR_MAX_SERIALISED_ENTRIES];
+};
+
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps)
 {
     DECLARE_SYSCTL;
@@ -665,3 +672,14 @@ out:
 
     return rc;
 }
+
+xc_cpu_policy_t xc_cpu_policy_init(void)
+{
+    return calloc(1, sizeof(struct xc_cpu_policy));
+}
+
+void xc_cpu_policy_destroy(xc_cpu_policy_t policy)
+{
+    if ( policy )
+        free(policy);
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 29 18:33:26 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Apr 2021 18:33:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120172.227249 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lcBTa-0006Hf-Dp; Thu, 29 Apr 2021 18:33:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120172.227249; Thu, 29 Apr 2021 18: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 1lcBTa-0006HX-9j; Thu, 29 Apr 2021 18:33:26 +0000
Received: by outflank-mailman (input) for mailman id 120172;
 Thu, 29 Apr 2021 18: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 1lcBTZ-0006HP-OA
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18: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 1lcBTZ-0002Kq-Mt
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBTZ-00059z-Lt
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:33:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=G9NblZZ92j5vlYizU0exVap5BrbTX5Yv6q1R/QIsq2E=; b=tOQe9wXQfEb0zCO3hmfjolGdSF
	qX4rTBcCvIMFVasrCPLbCn1kc42G+riZASMt9Up5w9loDsfpsIDRBf9pCkI7nWKCatFirlVL0ltRp
	6hrccQnWA9Y0yEG/k3TreVMpMrjuk7LxiDQ3k5euo+UvRx1+P9GwqPlFc2X1boGAcZeI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libs/guest: introduce helper to fetch a system cpu policy
Message-Id: <E1lcBTZ-00059z-Lt@xenbits.xenproject.org>
Date: Thu, 29 Apr 2021 18:33:25 +0000

commit a877e31f9d6e6cb435c10e9c539b02bd451969a9
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 17 14:45:41 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 29 19:27:21 2021 +0100

    libs/guest: introduce helper to fetch a system cpu policy
    
    Such helper is based on the existing functions to fetch a CPUID and
    MSR policies, but uses the xc_cpu_policy_t type to return the data to
    the caller.
    
    Note some helper functions are introduced, those are split from
    xc_cpu_policy_get_system because they will be used by other functions
    also.
    
    No user of the interface introduced on the patch.
    
    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>
---
 tools/include/xenctrl.h         |  4 +++
 tools/libs/guest/xg_cpuid_x86.c | 54 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 1aba814f01..187df5c5d2 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2596,6 +2596,10 @@ typedef struct xc_cpu_policy *xc_cpu_policy_t;
 xc_cpu_policy_t xc_cpu_policy_init(void);
 void xc_cpu_policy_destroy(xc_cpu_policy_t policy);
 
+/* Retrieve a system policy, or get/set a domains policy. */
+int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
+                             xc_cpu_policy_t policy);
+
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
 int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
                           uint32_t *nr_features, uint32_t *featureset);
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 39d62fe2f3..dad560fb40 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -683,3 +683,57 @@ void xc_cpu_policy_destroy(xc_cpu_policy_t policy)
     if ( policy )
         free(policy);
 }
+
+static int deserialize_policy(xc_interface *xch, xc_cpu_policy_t policy,
+                              unsigned int nr_leaves, unsigned int nr_entries)
+{
+    uint32_t err_leaf = -1, err_subleaf = -1, err_msr = -1;
+    int rc;
+
+    rc = x86_cpuid_copy_from_buffer(&policy->cpuid, policy->leaves,
+                                    nr_leaves, &err_leaf, &err_subleaf);
+    if ( rc )
+    {
+        if ( err_leaf != -1 )
+            ERROR("Failed to deserialise CPUID (err leaf %#x, subleaf %#x) (%d = %s)",
+                  err_leaf, err_subleaf, -rc, strerror(-rc));
+        return rc;
+    }
+
+    rc = x86_msr_copy_from_buffer(&policy->msr, policy->entries,
+                                  nr_entries, &err_msr);
+    if ( rc )
+    {
+        if ( err_msr != -1 )
+            ERROR("Failed to deserialise MSR (err MSR %#x) (%d = %s)",
+                  err_msr, -rc, strerror(-rc));
+        return rc;
+    }
+
+    return 0;
+}
+
+int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
+                             xc_cpu_policy_t policy)
+{
+    unsigned int nr_leaves = ARRAY_SIZE(policy->leaves);
+    unsigned int nr_entries = ARRAY_SIZE(policy->entries);
+    int rc;
+
+    rc = xc_get_system_cpu_policy(xch, policy_idx, &nr_leaves, policy->leaves,
+                                  &nr_entries, policy->entries);
+    if ( rc )
+    {
+        PERROR("Failed to obtain %u policy", policy_idx);
+        return rc;
+    }
+
+    rc = deserialize_policy(xch, policy, nr_leaves, nr_entries);
+    if ( rc )
+    {
+        errno = -rc;
+        rc = -1;
+    }
+
+    return rc;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 29 18:33:36 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Apr 2021 18:33:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120173.227252 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lcBTk-0006JD-G9; Thu, 29 Apr 2021 18:33:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120173.227252; Thu, 29 Apr 2021 18: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 1lcBTk-0006J4-Cx; Thu, 29 Apr 2021 18:33:36 +0000
Received: by outflank-mailman (input) for mailman id 120173;
 Thu, 29 Apr 2021 18: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 1lcBTj-0006Iu-Qs
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18: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 1lcBTj-0002L2-Q4
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:33:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBTj-0005Az-P7
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18: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=e7Sc60fV2w0a6cEpPWPMomE2tfJFnzRTL2D/64ZqAN0=; b=d+zbUoU0QlwwMjYrgFDzU/wx4s
	4gT46+iRk2CYr2pfkkNgMu4Zdgf2kYasn3PTf6TwqCOeTc3R0888O6COq9y+Yaq9QfTugNgWIx+tj
	cazRgKQSSgiMrX8gwB1oZrMDka9ozMDfIHMhXHcJN6pVNM1q8qTdNN8Ecjp29sPEpHNY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libs/guest: introduce helper to fetch a domain cpu policy
Message-Id: <E1lcBTj-0005Az-P7@xenbits.xenproject.org>
Date: Thu, 29 Apr 2021 18:33:35 +0000

commit c79d253226de3466cbc41401014d9a35507bff33
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 17 14:46:11 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 29 19:27:21 2021 +0100

    libs/guest: introduce helper to fetch a domain cpu policy
    
    Such helper is based on the existing functions to fetch a CPUID and
    MSR policies, but uses the xc_cpu_policy_t type to return the data to
    the caller.
    
    No user of the interface introduced on the patch.
    
    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>
---
 tools/include/xenctrl.h         |  2 ++
 tools/libs/guest/xg_cpuid_x86.c | 25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 187df5c5d2..34d979d11d 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2599,6 +2599,8 @@ void xc_cpu_policy_destroy(xc_cpu_policy_t policy);
 /* Retrieve a system policy, or get/set a domains policy. */
 int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
                              xc_cpu_policy_t policy);
+int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
+                             xc_cpu_policy_t policy);
 
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
 int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index dad560fb40..2cbc4b550f 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -737,3 +737,28 @@ int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
 
     return rc;
 }
+
+int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
+                             xc_cpu_policy_t policy)
+{
+    unsigned int nr_leaves = ARRAY_SIZE(policy->leaves);
+    unsigned int nr_entries = ARRAY_SIZE(policy->entries);
+    int rc;
+
+    rc = xc_get_domain_cpu_policy(xch, domid, &nr_leaves, policy->leaves,
+                                  &nr_entries, policy->entries);
+    if ( rc )
+    {
+        PERROR("Failed to obtain domain %u policy", domid);
+        return rc;
+    }
+
+    rc = deserialize_policy(xch, policy, nr_leaves, nr_entries);
+    if ( rc )
+    {
+        errno = -rc;
+        rc = -1;
+    }
+
+    return rc;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 29 18:33:46 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Apr 2021 18:33:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120174.227255 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lcBTu-0006L4-He; Thu, 29 Apr 2021 18:33:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120174.227255; Thu, 29 Apr 2021 18: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 1lcBTu-0006Kw-EZ; Thu, 29 Apr 2021 18:33:46 +0000
Received: by outflank-mailman (input) for mailman id 120174;
 Thu, 29 Apr 2021 18:33:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBTt-0006Kp-Uj
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18: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 1lcBTt-0002LC-Tu
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:33:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBTt-0005C8-SW
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18: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=p3KyHWH/p0A598tu3TED0IBTNPfUYiedyuHlTkHL9jU=; b=RgrxW05VQR7nE4CEnshkQbesp3
	vEzOX52H5Nn/Js3otfiHfmXd+64o/XoZddfifLoQB0ilVK/kigUERFrZIkhR4JfjzPM6ve1e0uDiJ
	z3zuu3DB0URnAfNwnkmPBdoGFkPZ6265w339KigkbiNGgdKf79iD9OEL+H9HGV/S9hvs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libs/guest: introduce helper to serialize a cpu policy
Message-Id: <E1lcBTt-0005C8-SW@xenbits.xenproject.org>
Date: Thu, 29 Apr 2021 18:33:45 +0000

commit de75c946cfd3d65b4511c970f14e331a54544b12
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 17 15:31:50 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 29 19:27:21 2021 +0100

    libs/guest: introduce helper to serialize a cpu policy
    
    Such helper allow converting a cpu policy into an array of
    xen_cpuid_leaf_t and xen_msr_entry_t elements, which matches the
    current interface of the CPUID/MSR functions. This is required in
    order for the user to be able to parse the CPUID/MSR data.
    
    No user of the interface introduced in this patch.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/include/xenctrl.h         |  5 +++++
 tools/libs/guest/xg_cpuid_x86.c | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 34d979d11d..a4827b1ae6 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2602,6 +2602,11 @@ int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
 int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
                              xc_cpu_policy_t policy);
 
+/* Manipulate a policy via architectural representations. */
+int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t policy,
+                            xen_cpuid_leaf_t *leaves, uint32_t *nr_leaves,
+                            xen_msr_entry_t *msrs, uint32_t *nr_msrs);
+
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
 int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
                           uint32_t *nr_features, uint32_t *featureset);
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 2cbc4b550f..03884587b9 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -762,3 +762,35 @@ int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
 
     return rc;
 }
+
+int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t p,
+                            xen_cpuid_leaf_t *leaves, uint32_t *nr_leaves,
+                            xen_msr_entry_t *msrs, uint32_t *nr_msrs)
+{
+    int rc;
+
+    if ( leaves )
+    {
+        rc = x86_cpuid_copy_to_buffer(&p->cpuid, leaves, nr_leaves);
+        if ( rc )
+        {
+            ERROR("Failed to serialize CPUID policy");
+            errno = -rc;
+            return -1;
+        }
+    }
+
+    if ( msrs )
+    {
+        rc = x86_msr_copy_to_buffer(&p->msr, msrs, nr_msrs);
+        if ( rc )
+        {
+            ERROR("Failed to serialize MSR policy");
+            errno = -rc;
+            return -1;
+        }
+    }
+
+    errno = 0;
+    return 0;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 29 18:33:56 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Apr 2021 18:33:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120175.227260 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lcBU4-0006MM-JD; Thu, 29 Apr 2021 18:33:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120175.227260; Thu, 29 Apr 2021 18:33:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lcBU4-0006MC-G3; Thu, 29 Apr 2021 18:33:56 +0000
Received: by outflank-mailman (input) for mailman id 120175;
 Thu, 29 Apr 2021 18:33:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBU4-0006M6-1w
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:33:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBU4-0002LN-19
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:33:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBU4-0005D1-0C
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:33:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=havDb+dpO/MS0mYObUEck2tIBle25DLahJ3Zf+FBRuE=; b=5OyKkbklHlXBF1NSmIaOZB0wJP
	WvYYB5A6bxVbvy7UtQ9BAzwEAQO52Gov0EOwZY+TgkUtUN5ZKz78VcLqXkH/RgiRk6DCPhCRB5pDS
	lJUvSImiKXtdSCxCWCCIL8XxWiTCJFESzXFAC27VnRK+5hOPvFnq6QE/PFJuGviaPUQE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: switch existing users of xc_get_{system,domain}_cpu_policy
Message-Id: <E1lcBU4-0005D1-0C@xenbits.xenproject.org>
Date: Thu, 29 Apr 2021 18:33:56 +0000

commit 29736eaeae545b37e4fd97a4077de681920d57a0
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Mar 22 11:59:04 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 29 19:27:21 2021 +0100

    tools: switch existing users of xc_get_{system,domain}_cpu_policy
    
    With the introduction of xc_cpu_policy_get_{system,domain} and
    xc_cpu_policy_serialise the current users of
    xc_get_{system,domain}_cpu_policy can be switched to the new
    interface.
    
    Note that xc_get_{system,domain}_cpu_policy is removed from the public
    interface and the functions are made static, since there are still
    internal consumers in xg_cpuid_x86.c
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h             |  6 ------
 tools/libs/guest/xg_cpuid_x86.c     | 39 ++++++++++++++++++-------------------
 tools/libs/guest/xg_sr_common_x86.c | 15 +++++++++++---
 tools/misc/xen-cpuid.c              | 21 +++++++++++++-------
 4 files changed, 45 insertions(+), 36 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index a4827b1ae6..e9a86d63ba 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2613,12 +2613,6 @@ int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
 
 int xc_cpu_policy_get_size(xc_interface *xch, uint32_t *nr_leaves,
                            uint32_t *nr_msrs);
-int xc_get_system_cpu_policy(xc_interface *xch, uint32_t index,
-                             uint32_t *nr_leaves, xen_cpuid_leaf_t *leaves,
-                             uint32_t *nr_msrs, xen_msr_entry_t *msrs);
-int xc_get_domain_cpu_policy(xc_interface *xch, uint32_t domid,
-                             uint32_t *nr_leaves, xen_cpuid_leaf_t *leaves,
-                             uint32_t *nr_msrs, xen_msr_entry_t *msrs);
 int xc_set_domain_cpu_policy(xc_interface *xch, uint32_t domid,
                              uint32_t nr_leaves, xen_cpuid_leaf_t *leaves,
                              uint32_t nr_msrs, xen_msr_entry_t *msrs,
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 03884587b9..bbdabb3a63 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -135,9 +135,9 @@ int xc_cpu_policy_get_size(xc_interface *xch, uint32_t *nr_leaves,
     return ret;
 }
 
-int xc_get_system_cpu_policy(xc_interface *xch, uint32_t index,
-                             uint32_t *nr_leaves, xen_cpuid_leaf_t *leaves,
-                             uint32_t *nr_msrs, xen_msr_entry_t *msrs)
+static int get_system_cpu_policy(xc_interface *xch, uint32_t index,
+                                 uint32_t *nr_leaves, xen_cpuid_leaf_t *leaves,
+                                 uint32_t *nr_msrs, xen_msr_entry_t *msrs)
 {
     struct xen_sysctl sysctl = {};
     DECLARE_HYPERCALL_BOUNCE(leaves,
@@ -173,9 +173,9 @@ int xc_get_system_cpu_policy(xc_interface *xch, uint32_t index,
     return ret;
 }
 
-int xc_get_domain_cpu_policy(xc_interface *xch, uint32_t domid,
-                             uint32_t *nr_leaves, xen_cpuid_leaf_t *leaves,
-                             uint32_t *nr_msrs, xen_msr_entry_t *msrs)
+static int get_domain_cpu_policy(xc_interface *xch, uint32_t domid,
+                                 uint32_t *nr_leaves, xen_cpuid_leaf_t *leaves,
+                                 uint32_t *nr_msrs, xen_msr_entry_t *msrs)
 {
     DECLARE_DOMCTL;
     DECLARE_HYPERCALL_BOUNCE(leaves,
@@ -329,7 +329,7 @@ static int xc_cpuid_xend_policy(
     /* Get the domain's current policy. */
     nr_msrs = 0;
     nr_cur = nr_leaves;
-    rc = xc_get_domain_cpu_policy(xch, domid, &nr_cur, cur, &nr_msrs, NULL);
+    rc = get_domain_cpu_policy(xch, domid, &nr_cur, cur, &nr_msrs, NULL);
     if ( rc )
     {
         PERROR("Failed to obtain d%d current policy", domid);
@@ -340,10 +340,9 @@ static int xc_cpuid_xend_policy(
     /* Get the domain type's default policy. */
     nr_msrs = 0;
     nr_def = nr_leaves;
-    rc = xc_get_system_cpu_policy(xch,
-                                  di.hvm ? XEN_SYSCTL_cpu_policy_hvm_default
-                                         : XEN_SYSCTL_cpu_policy_pv_default,
-                                  &nr_def, def, &nr_msrs, NULL);
+    rc = get_system_cpu_policy(xch, di.hvm ? XEN_SYSCTL_cpu_policy_hvm_default
+                                           : XEN_SYSCTL_cpu_policy_pv_default,
+                               &nr_def, def, &nr_msrs, NULL);
     if ( rc )
     {
         PERROR("Failed to obtain %s def policy", di.hvm ? "hvm" : "pv");
@@ -354,8 +353,8 @@ static int xc_cpuid_xend_policy(
     /* Get the host policy. */
     nr_msrs = 0;
     nr_host = nr_leaves;
-    rc = xc_get_system_cpu_policy(xch, XEN_SYSCTL_cpu_policy_host,
-                                  &nr_host, host, &nr_msrs, NULL);
+    rc = get_system_cpu_policy(xch, XEN_SYSCTL_cpu_policy_host,
+                               &nr_host, host, &nr_msrs, NULL);
     if ( rc )
     {
         PERROR("Failed to obtain host policy");
@@ -486,9 +485,9 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
 
     /* Get the domain's default policy. */
     nr_msrs = 0;
-    rc = xc_get_system_cpu_policy(xch, di.hvm ? XEN_SYSCTL_cpu_policy_hvm_default
-                                              : XEN_SYSCTL_cpu_policy_pv_default,
-                                  &nr_leaves, leaves, &nr_msrs, NULL);
+    rc = get_system_cpu_policy(xch, di.hvm ? XEN_SYSCTL_cpu_policy_hvm_default
+                                           : XEN_SYSCTL_cpu_policy_pv_default,
+                               &nr_leaves, leaves, &nr_msrs, NULL);
     if ( rc )
     {
         PERROR("Failed to obtain %s default policy", di.hvm ? "hvm" : "pv");
@@ -720,8 +719,8 @@ int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
     unsigned int nr_entries = ARRAY_SIZE(policy->entries);
     int rc;
 
-    rc = xc_get_system_cpu_policy(xch, policy_idx, &nr_leaves, policy->leaves,
-                                  &nr_entries, policy->entries);
+    rc = get_system_cpu_policy(xch, policy_idx, &nr_leaves, policy->leaves,
+                               &nr_entries, policy->entries);
     if ( rc )
     {
         PERROR("Failed to obtain %u policy", policy_idx);
@@ -745,8 +744,8 @@ int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
     unsigned int nr_entries = ARRAY_SIZE(policy->entries);
     int rc;
 
-    rc = xc_get_domain_cpu_policy(xch, domid, &nr_leaves, policy->leaves,
-                                  &nr_entries, policy->entries);
+    rc = get_domain_cpu_policy(xch, domid, &nr_leaves, policy->leaves,
+                               &nr_entries, policy->entries);
     if ( rc )
     {
         PERROR("Failed to obtain domain %u policy", domid);
diff --git a/tools/libs/guest/xg_sr_common_x86.c b/tools/libs/guest/xg_sr_common_x86.c
index 4982519e05..15265e7a33 100644
--- a/tools/libs/guest/xg_sr_common_x86.c
+++ b/tools/libs/guest/xg_sr_common_x86.c
@@ -48,6 +48,7 @@ int write_x86_cpu_policy_records(struct xc_sr_context *ctx)
     struct xc_sr_record cpuid = { .type = REC_TYPE_X86_CPUID_POLICY, };
     struct xc_sr_record msrs  = { .type = REC_TYPE_X86_MSR_POLICY, };
     uint32_t nr_leaves = 0, nr_msrs = 0;
+    xc_cpu_policy_t policy = NULL;
     int rc;
 
     if ( xc_cpu_policy_get_size(xch, &nr_leaves, &nr_msrs) < 0 )
@@ -58,20 +59,27 @@ int write_x86_cpu_policy_records(struct xc_sr_context *ctx)
 
     cpuid.data = malloc(nr_leaves * sizeof(xen_cpuid_leaf_t));
     msrs.data  = malloc(nr_msrs   * sizeof(xen_msr_entry_t));
-    if ( !cpuid.data || !msrs.data )
+    policy = xc_cpu_policy_init();
+    if ( !cpuid.data || !msrs.data || !policy )
     {
         ERROR("Cannot allocate memory for CPU Policy");
         rc = -1;
         goto out;
     }
 
-    if ( xc_get_domain_cpu_policy(xch, ctx->domid, &nr_leaves, cpuid.data,
-                                  &nr_msrs, msrs.data) )
+    if ( xc_cpu_policy_get_domain(xch, ctx->domid, policy) )
     {
         PERROR("Unable to get d%d CPU Policy", ctx->domid);
         rc = -1;
         goto out;
     }
+    if ( xc_cpu_policy_serialise(xch, policy, cpuid.data, &nr_leaves,
+                                 msrs.data, &nr_msrs) )
+    {
+        PERROR("Unable to serialize d%d CPU Policy", ctx->domid);
+        rc = -1;
+        goto out;
+    }
 
     cpuid.length = nr_leaves * sizeof(xen_cpuid_leaf_t);
     if ( cpuid.length )
@@ -94,6 +102,7 @@ int write_x86_cpu_policy_records(struct xc_sr_context *ctx)
  out:
     free(cpuid.data);
     free(msrs.data);
+    xc_cpu_policy_destroy(policy);
 
     return rc;
 }
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 027b25ad01..b2a36deacc 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -468,9 +468,12 @@ int main(int argc, char **argv)
         uint32_t i, max_leaves, max_msrs;
 
         xc_interface *xch = xc_interface_open(0, 0, 0);
+        xc_cpu_policy_t policy = xc_cpu_policy_init();
 
         if ( !xch )
             err(1, "xc_interface_open");
+        if ( !policy )
+            err(1, "xc_cpu_policy_init");
 
         if ( xc_cpu_policy_get_size(xch, &max_leaves, &max_msrs) )
             err(1, "xc_get_cpu_policy_size(...)");
@@ -491,10 +494,11 @@ int main(int argc, char **argv)
             uint32_t nr_leaves = max_leaves;
             uint32_t nr_msrs = max_msrs;
 
-            if ( xc_get_domain_cpu_policy(xch, domid, &nr_leaves, leaves,
-                                          &nr_msrs, msrs) )
-                err(1, "xc_get_domain_cpu_policy(, %d, %d,, %d,)",
-                    domid, nr_leaves, nr_msrs);
+            if ( xc_cpu_policy_get_domain(xch, domid, policy) )
+                err(1, "xc_cpu_policy_get_domain(, %d, )", domid);
+            if ( xc_cpu_policy_serialise(xch, policy, leaves, &nr_leaves,
+                                         msrs, &nr_msrs) )
+                err(1, "xc_cpu_policy_serialise");
 
             snprintf(name, sizeof(name), "Domain %d", domid);
             print_policy(name, leaves, nr_leaves, msrs, nr_msrs);
@@ -507,8 +511,7 @@ int main(int argc, char **argv)
                 uint32_t nr_leaves = max_leaves;
                 uint32_t nr_msrs = max_msrs;
 
-                if ( xc_get_system_cpu_policy(xch, i, &nr_leaves, leaves,
-                                              &nr_msrs, msrs) )
+                if ( xc_cpu_policy_get_system(xch, i, policy) )
                 {
                     if ( errno == EOPNOTSUPP )
                     {
@@ -517,14 +520,18 @@ int main(int argc, char **argv)
                         continue;
                     }
 
-                    err(1, "xc_get_system_cpu_policy(, %s,,)", sys_policies[i]);
+                    err(1, "xc_cpu_policy_get_system(, %s, )", sys_policies[i]);
                 }
+                if ( xc_cpu_policy_serialise(xch, policy, leaves, &nr_leaves,
+                                             msrs, &nr_msrs) )
+                    err(1, "xc_cpu_policy_serialise");
 
                 print_policy(sys_policies[i], leaves, nr_leaves,
                              msrs, nr_msrs);
             }
         }
 
+        xc_cpu_policy_destroy(policy);
         free(leaves);
         free(msrs);
         xc_interface_close(xch);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 29 18:34:07 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Apr 2021 18:34:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120176.227264 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lcBUF-0006NV-Kn; Thu, 29 Apr 2021 18:34:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120176.227264; Thu, 29 Apr 2021 18:34:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lcBUF-0006NN-Hd; Thu, 29 Apr 2021 18:34:07 +0000
Received: by outflank-mailman (input) for mailman id 120176;
 Thu, 29 Apr 2021 18:34:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBUE-0006NC-5X
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:34:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBUE-0002Lg-4H
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:34:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBUE-0005Eb-3W
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:34:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RgkDQHTpevNznLYkyJ0gknpcNvlUIoO0D43gq1hLqxg=; b=xM4qENHjw+zydLcZ/UB+s1oAEJ
	AS1X8GpWxP8KjRXh+MJOOIsgzvdjn0CBTPZlWXkm2ujik9XIP7keRxuGSvc/SC6lEXTrnB1RuYn8c
	Oe8T+Zt7x+1NVagQnv3pBcR1N+7qIG0rsChXB6T6u/w+Kx8JQgnuagsTkoeFlCLfYWV4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libs/guest: introduce a helper to apply a cpu policy to a domain
Message-Id: <E1lcBUE-0005Eb-3W@xenbits.xenproject.org>
Date: Thu, 29 Apr 2021 18:34:06 +0000

commit 98e67163655a896855fdff1f894b355e57acef2d
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Mar 17 15:30:57 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 29 19:27:21 2021 +0100

    libs/guest: introduce a helper to apply a cpu policy to a domain
    
    Such helper is very similar to the existing xc_set_domain_cpu_policy
    interface, but takes an opaque xc_cpu_policy_t instead of arrays of
    CPUID leaves and MSRs.
    
    No callers of the interface introduced in this patch.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h         |  2 ++
 tools/libs/guest/xg_cpuid_x86.c | 29 +++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index e9a86d63ba..27cec1b93f 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2601,6 +2601,8 @@ int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
                              xc_cpu_policy_t policy);
 int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
                              xc_cpu_policy_t policy);
+int xc_cpu_policy_set_domain(xc_interface *xch, uint32_t domid,
+                             const xc_cpu_policy_t policy);
 
 /* Manipulate a policy via architectural representations. */
 int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t policy,
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index bbdabb3a63..0c9b3a960f 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -762,6 +762,35 @@ int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
     return rc;
 }
 
+int xc_cpu_policy_set_domain(xc_interface *xch, uint32_t domid,
+                             const xc_cpu_policy_t policy)
+{
+    uint32_t err_leaf = -1, err_subleaf = -1, err_msr = -1;
+    unsigned int nr_leaves = ARRAY_SIZE(policy->leaves);
+    unsigned int nr_entries = ARRAY_SIZE(policy->entries);
+    int rc;
+
+    rc = xc_cpu_policy_serialise(xch, policy, policy->leaves, &nr_leaves,
+                                 policy->entries, &nr_entries);
+    if ( rc )
+        return rc;
+
+    rc = xc_set_domain_cpu_policy(xch, domid, nr_leaves, policy->leaves,
+                                  nr_entries, policy->entries,
+                                  &err_leaf, &err_subleaf, &err_msr);
+    if ( rc )
+    {
+        ERROR("Failed to set domain %u policy (%d = %s)", domid, -rc,
+              strerror(-rc));
+        if ( err_leaf != -1 )
+            ERROR("CPUID leaf %u subleaf %u", err_leaf, err_subleaf);
+        if ( err_msr != -1 )
+            ERROR("MSR index %#x\n", err_msr);
+    }
+
+    return rc;
+}
+
 int xc_cpu_policy_serialise(xc_interface *xch, const xc_cpu_policy_t p,
                             xen_cpuid_leaf_t *leaves, uint32_t *nr_leaves,
                             xen_msr_entry_t *msrs, uint32_t *nr_msrs)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Apr 29 18:34:17 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Apr 2021 18:34:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120177.227268 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lcBUP-0006Oy-MQ; Thu, 29 Apr 2021 18:34:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120177.227268; Thu, 29 Apr 2021 18: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 1lcBUP-0006Op-JH; Thu, 29 Apr 2021 18:34:17 +0000
Received: by outflank-mailman (input) for mailman id 120177;
 Thu, 29 Apr 2021 18:34:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBUO-0006Oe-9I
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:34:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBUO-0002Lo-72
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:34:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcBUO-0005Fk-6S
 for xen-changelog@lists.xenproject.org; Thu, 29 Apr 2021 18:34:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MynIlvh4l5gDlOarEMvwkebYfHV30inb33sh67jzks8=; b=V1dZe2Uz1mVGByCBErdp35IW7c
	qqzwohUXeHJgPQd/coOF9PQSc8WZMAfYmlhqC7fwpzxrd3tbMqthiNnIKUTBOd4GAKm4lDOO75smS
	8PoLyLxkx3E+0suULa6QoB+1kpZtIPksDwmz8p8UQx4HnZ3tb/1u9aw6VlfMCD+byuzc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tests/cpu-policy: add sorted MSR test
Message-Id: <E1lcBUO-0005Fk-6S@xenbits.xenproject.org>
Date: Thu, 29 Apr 2021 18:34:16 +0000

commit b8e53a81ba538849b98b0d417436f8be653fa1ff
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Apr 13 14:51:44 2021 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 29 19:27:21 2021 +0100

    tests/cpu-policy: add sorted MSR test
    
    Further changes will rely on MSR entries being sorted, so add a test
    to assert it.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/cpu-policy/test-cpu-policy.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tools/tests/cpu-policy/test-cpu-policy.c b/tools/tests/cpu-policy/test-cpu-policy.c
index cb578ca6e5..75973298df 100644
--- a/tools/tests/cpu-policy/test-cpu-policy.c
+++ b/tools/tests/cpu-policy/test-cpu-policy.c
@@ -89,6 +89,16 @@ static bool leaves_are_sorted(const xen_cpuid_leaf_t *leaves, unsigned int nr)
     return true;
 }
 
+static bool msrs_are_sorted(const xen_msr_entry_t *entries, unsigned int nr)
+{
+    for ( unsigned int i = 1; i < nr; ++i )
+        /* MSR index went backwards => not sorted. */
+        if ( entries[i - 1].idx > entries[i].idx )
+            return false;
+
+    return true;
+}
+
 static void test_cpuid_current(void)
 {
     struct cpuid_policy p;
@@ -273,6 +283,13 @@ static void test_msr_serialise_success(void)
             goto test_done;
         }
 
+        if ( !msrs_are_sorted(msrs, nr) )
+        {
+            fail("  Test %s, MSR entries not sorted\n",
+                 t->name);
+            goto test_done;
+        }
+
     test_done:
         free(msrs);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 30 16:11:11 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Apr 2021 16:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120701.228264 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lcVjO-0004gA-1m; Fri, 30 Apr 2021 16:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120701.228264; Fri, 30 Apr 2021 16: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 1lcVjN-0004g2-V5; Fri, 30 Apr 2021 16:11:05 +0000
Received: by outflank-mailman (input) for mailman id 120701;
 Fri, 30 Apr 2021 16:11:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcVjM-0004fx-V4
 for xen-changelog@lists.xenproject.org; Fri, 30 Apr 2021 16: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 1lcVjM-0006Ub-Qm
 for xen-changelog@lists.xenproject.org; Fri, 30 Apr 2021 16:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcVjM-0003GU-No
 for xen-changelog@lists.xenproject.org; Fri, 30 Apr 2021 16: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=8CyAahflG7jFi84rXOYRd0Ruiu8CB1qZa8lylyw8DLk=; b=pq4TSXGEVSP4yUoPkY6OggiqC5
	kXdbobfRI7qtKM7gCgPaFKiNjxAGBrF2eKROJbKe+5w1VI23pmRCRYSzqG72LBa7AVbMstod1H6qu
	styi295fDjrAWABUvMcsvHGp1nO16nIJGdQ3CxL76P2BOV59xW99MHANVArrb0azNOdQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: Always have CR4.PKE set in HVM context
Message-Id: <E1lcVjM-0003GU-No@xenbits.xenproject.org>
Date: Fri, 30 Apr 2021 16:11:04 +0000

commit 95aaafb5e2a09cad2ab42223e4aa55f88833ef3c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 29 14:28:43 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Apr 30 17:07:29 2021 +0100

    x86: Always have CR4.PKE set in HVM context
    
    The sole user of read_pkru() is the emulated pagewalk, and guarded behind
    guest_pku_enabled() which restricts the path to HVM (hap, even) context only.
    
    The commentary in read_pkru() concerning _PAGE_GNTTAB overlapping with
    _PAGE_PKEY_BITS is only applicable to PV guests.
    
    The context switch path, via write_ptbase() unconditionally writes CR4 on any
    context switch.
    
    Therefore, we can guarantee to separate CR4.PKE between PV and HVM context at
    no extra cost.  Set PKE in mmu_cr4_features on boot, so it becomes set in HVM
    context, and clear it in pv_make_cr4().
    
    Rename read_pkru() to rdpkru() now that it is a simple wrapper around the
    instruction.  This saves two CR4 writes on every pagewalk, which typically
    occur more than one per emulation.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/guest_walk.c    |  2 +-
 xen/arch/x86/pv/domain.c        | 16 +++++++++++++++-
 xen/arch/x86/setup.c            |  3 +++
 xen/include/asm-x86/processor.h | 10 +---------
 4 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/mm/guest_walk.c b/xen/arch/x86/mm/guest_walk.c
index 1c601314f3..30d83cf1e0 100644
--- a/xen/arch/x86/mm/guest_walk.c
+++ b/xen/arch/x86/mm/guest_walk.c
@@ -416,7 +416,7 @@ guest_walk_tables(const struct vcpu *v, struct p2m_domain *p2m,
          guest_pku_enabled(v) )
     {
         unsigned int pkey = guest_l1e_get_pkey(gw->l1e);
-        unsigned int pkru = read_pkru();
+        unsigned int pkru = rdpkru();
 
         if ( read_pkru_ad(pkru, pkey) ||
              ((walk & PFEC_write_access) && read_pkru_wd(pkru, pkey) &&
diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index f1cb92585e..6ad533183b 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -182,7 +182,21 @@ unsigned long pv_make_cr4(const struct vcpu *v)
 {
     const struct domain *d = v->domain;
     unsigned long cr4 = mmu_cr4_features &
-        ~(X86_CR4_PCIDE | X86_CR4_PGE | X86_CR4_TSD);
+        ~(X86_CR4_PCIDE | X86_CR4_PGE | X86_CR4_TSD | X86_CR4_PKE);
+
+    /*
+     * We want CR4.PKE set in HVM context when available, but don't support it
+     * in PV context at all.
+     *
+     * _PAGE_PKEY_BITS where previously software available PTE bits.  In
+     * principle, we could let an aware PV guest enable PKE.
+     *
+     * However, Xen uses _PAGE_GNTTAB in debug builds which overlaps with
+     * _PAGE_PKEY_BITS, and the ownership of (and eligibility to move)
+     * software PTE bits is not considered in the PV ABI at all.  For now,
+     * punt the problem to whichever unluckly person finds a compelling
+     * usecase for PKRU in PV guests.
+     */
 
     /*
      * PCIDE or PGE depends on the PCID/XPTI settings, but must not both be
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index f2dff2ae6a..8105dc36bb 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1790,6 +1790,9 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     if ( boot_cpu_has(X86_FEATURE_FSGSBASE) )
         set_in_cr4(X86_CR4_FSGSBASE);
 
+    if ( boot_cpu_has(X86_FEATURE_PKU) )
+        set_in_cr4(X86_CR4_PKE);
+
     if ( opt_invpcid && cpu_has_invpcid )
         use_invpcid = true;
 
diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h
index d5f467d245..d8d0dc8034 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -367,20 +367,12 @@ static always_inline void set_in_cr4 (unsigned long mask)
     write_cr4(read_cr4() | mask);
 }
 
-static inline unsigned int read_pkru(void)
+static inline unsigned int rdpkru(void)
 {
     unsigned int pkru;
-    unsigned long cr4 = read_cr4();
 
-    /*
-     * _PAGE_PKEY_BITS have a conflict with _PAGE_GNTTAB used by PV guests,
-     * so that X86_CR4_PKE  is disabled on hypervisor. To use RDPKRU, CR4.PKE
-     * gets temporarily enabled.
-     */
-    write_cr4(cr4 | X86_CR4_PKE);
     asm volatile (".byte 0x0f,0x01,0xee"
         : "=a" (pkru) : "c" (0) : "dx");
-    write_cr4(cr4);
 
     return pkru;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 30 16:33:09 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Apr 2021 16:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120704.228274 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lcW4g-0006MO-NI; Fri, 30 Apr 2021 16:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120704.228274; Fri, 30 Apr 2021 16:33:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lcW4g-0006MG-KS; Fri, 30 Apr 2021 16:33:06 +0000
Received: by outflank-mailman (input) for mailman id 120704;
 Fri, 30 Apr 2021 16:33:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcW4f-0006MB-Ci
 for xen-changelog@lists.xenproject.org; Fri, 30 Apr 2021 16:33:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcW4f-0006ot-9A
 for xen-changelog@lists.xenproject.org; Fri, 30 Apr 2021 16:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcW4f-0004m5-6v
 for xen-changelog@lists.xenproject.org; Fri, 30 Apr 2021 16:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gBH9VEzZJ73anBippt97HLFh1xq4AYw5f1D6cjfetJA=; b=L62gzxz2gutH503jJovuidxUaA
	rLlEIuAyxM3QdfIubWzLMbEzBF5wnwafxzCr6UhK5ZWccRVRKtdV0t/OtYgjpD6VGwx2Z60KMJbIW
	xkpCYv2owXdbUyDhrnkKnttn7SP1wrFZVIufpilsxs+TogAEcmXPVGxWdUNdwZ/+tF/s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hvm: Introduce control register handling for CET
Message-Id: <E1lcW4f-0004m5-6v@xenbits.xenproject.org>
Date: Fri, 30 Apr 2021 16:33:05 +0000

commit 48f2a10a71bb4bc3053142996dd581ebcfa3e3ab
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Apr 21 17:43:56 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Apr 30 17:29:48 2021 +0100

    x86/hvm: Introduce control register handling for CET
    
    Allow CR4.CET to be set, based on the CPUID policy (although these bits are
    not selectable yet for VMs).  CR4.CET needs interlocing with CR0.WP to
    prohibit CET && !WP as a legal combination.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index ae37bc434a..28beacc45b 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -976,11 +976,12 @@ const char *hvm_efer_valid(const struct vcpu *v, uint64_t value,
 unsigned long hvm_cr4_guest_valid_bits(const struct domain *d)
 {
     const struct cpuid_policy *p = d->arch.cpuid;
-    bool mce, vmxe;
+    bool mce, vmxe, cet;
 
     /* Logic broken out simply to aid readability below. */
     mce  = p->basic.mce || p->basic.mca;
     vmxe = p->basic.vmx && nestedhvm_enabled(d);
+    cet  = p->feat.cet_ss || p->feat.cet_ibt;
 
     return ((p->basic.vme     ? X86_CR4_VME | X86_CR4_PVI : 0) |
             (p->basic.tsc     ? X86_CR4_TSD               : 0) |
@@ -999,7 +1000,8 @@ unsigned long hvm_cr4_guest_valid_bits(const struct domain *d)
             (p->basic.xsave   ? X86_CR4_OSXSAVE           : 0) |
             (p->feat.smep     ? X86_CR4_SMEP              : 0) |
             (p->feat.smap     ? X86_CR4_SMAP              : 0) |
-            (p->feat.pku      ? X86_CR4_PKE               : 0));
+            (p->feat.pku      ? X86_CR4_PKE               : 0) |
+            (cet              ? X86_CR4_CET               : 0));
 }
 
 static int hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
@@ -2289,6 +2291,12 @@ int hvm_set_cr0(unsigned long value, bool may_defer)
         }
     }
 
+    if ( !(value & X86_CR0_WP) && (v->arch.hvm.guest_cr[4] & X86_CR4_CET) )
+    {
+        gprintk(XENLOG_DEBUG, "Trying to clear WP with CET set\n");
+        return X86EMUL_EXCEPTION;
+    }
+
     if ( (value & X86_CR0_PG) && !(old_value & X86_CR0_PG) )
     {
         if ( v->arch.hvm.guest_efer & EFER_LME )
@@ -2444,6 +2452,12 @@ int hvm_set_cr4(unsigned long value, bool may_defer)
         }
     }
 
+    if ( (value & X86_CR4_CET) && !(v->arch.hvm.guest_cr[0] & X86_CR0_WP) )
+    {
+        gprintk(XENLOG_DEBUG, "Trying to set CET without WP\n");
+        return X86EMUL_EXCEPTION;
+    }
+
     old_cr = v->arch.hvm.guest_cr[4];
 
     if ( (value & X86_CR4_PCIDE) && !(old_cr & X86_CR4_PCIDE) &&
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Apr 30 16:33:16 2021
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Apr 2021 16:33:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.120705.228278 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lcW4q-0006NA-PM; Fri, 30 Apr 2021 16:33:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 120705.228278; Fri, 30 Apr 2021 16:33:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1lcW4q-0006N2-ML; Fri, 30 Apr 2021 16:33:16 +0000
Received: by outflank-mailman (input) for mailman id 120705;
 Fri, 30 Apr 2021 16:33:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcW4p-0006Mv-EL
 for xen-changelog@lists.xenproject.org; Fri, 30 Apr 2021 16:33:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcW4p-0006oz-Cc
 for xen-changelog@lists.xenproject.org; Fri, 30 Apr 2021 16:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1lcW4p-0004mi-Bn
 for xen-changelog@lists.xenproject.org; Fri, 30 Apr 2021 16:33:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Nd6bXBxBA9AmJv5PFRjDC8Zv4sZ1WHX3IpROs89Mspc=; b=e0jU0y7EHh41RCGmsN3sEk3svN
	X5QfblFcETJq16Hb5iLKWQqdln9lj2lyYbFdWLbD11z4bPVU4OMwixygeN2IkaMxRw3JvMUMhYq2Q
	VMmn7ConX+dVfxa8uvTg5aRj0a0VrkQeH6x0tV+rPQjlshbF3WsWeBbPURwetQv/5HEQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/svm: Enumeration for CET
Message-Id: <E1lcW4p-0004mi-Bn@xenbits.xenproject.org>
Date: Fri, 30 Apr 2021 16:33:15 +0000

commit 1f8ee4cb430e5a9da37096574c41632cf69a0bc7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Apr 21 17:43:56 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Apr 30 17:29:48 2021 +0100

    x86/svm: Enumeration for CET
    
    On CET-capable hardware, VMRUN/EXIT unconditionally swaps S_CET, SSP and
    ISST (subject to cleanbits) without further settings.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/svm/svm.c         |  1 +
 xen/arch/x86/hvm/svm/svmdebug.c    |  2 ++
 xen/include/asm-x86/hvm/svm/svm.h  |  2 ++
 xen/include/asm-x86/hvm/svm/vmcb.h | 13 +++++++++++--
 4 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 4585efe1f8..642a64b747 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1658,6 +1658,7 @@ const struct hvm_function_table * __init start_svm(void)
     P(cpu_has_pause_filter, "Pause-Intercept Filter");
     P(cpu_has_pause_thresh, "Pause-Intercept Filter Threshold");
     P(cpu_has_tsc_ratio, "TSC Rate MSR");
+    P(cpu_has_svm_sss, "NPT Supervisor Shadow Stack");
 #undef P
 
     if ( !printed )
diff --git a/xen/arch/x86/hvm/svm/svmdebug.c b/xen/arch/x86/hvm/svm/svmdebug.c
index f450391df4..bce86f0ef7 100644
--- a/xen/arch/x86/hvm/svm/svmdebug.c
+++ b/xen/arch/x86/hvm/svm/svmdebug.c
@@ -82,6 +82,8 @@ void svm_vmcb_dump(const char *from, const struct vmcb_struct *vmcb)
            vmcb->cstar, vmcb->sfmask);
     printk("KernGSBase = 0x%016"PRIx64" PAT = 0x%016"PRIx64"\n",
            vmcb->kerngsbase, vmcb_get_g_pat(vmcb));
+    printk("SSP = 0x%016"PRIx64" S_CET = 0x%016"PRIx64" ISST = 0x%016"PRIx64"\n",
+           vmcb->_ssp, vmcb->_msr_s_cet, vmcb->_msr_isst);
     printk("H_CR3 = 0x%016"PRIx64" CleanBits = %#x\n",
            vmcb_get_h_cr3(vmcb), vmcb->cleanbits.raw);
 
diff --git a/xen/include/asm-x86/hvm/svm/svm.h b/xen/include/asm-x86/hvm/svm/svm.h
index faeca40174..bee939156f 100644
--- a/xen/include/asm-x86/hvm/svm/svm.h
+++ b/xen/include/asm-x86/hvm/svm/svm.h
@@ -75,6 +75,7 @@ extern u32 svm_feature_flags;
 #define SVM_FEATURE_PAUSETHRESH   12 /* Pause intercept filter support */
 #define SVM_FEATURE_VLOADSAVE     15 /* virtual vmload/vmsave */
 #define SVM_FEATURE_VGIF          16 /* Virtual GIF */
+#define SVM_FEATURE_SSS           19 /* NPT Supervisor Shadow Stacks */
 
 #define cpu_has_svm_feature(f) (svm_feature_flags & (1u << (f)))
 #define cpu_has_svm_npt       cpu_has_svm_feature(SVM_FEATURE_NPT)
@@ -89,6 +90,7 @@ extern u32 svm_feature_flags;
 #define cpu_has_pause_thresh  cpu_has_svm_feature(SVM_FEATURE_PAUSETHRESH)
 #define cpu_has_tsc_ratio     cpu_has_svm_feature(SVM_FEATURE_TSCRATEMSR)
 #define cpu_has_svm_vloadsave cpu_has_svm_feature(SVM_FEATURE_VLOADSAVE)
+#define cpu_has_svm_sss       cpu_has_svm_feature(SVM_FEATURE_SSS)
 
 #define SVM_PAUSEFILTER_INIT    4000
 #define SVM_PAUSETHRESH_INIT    1000
diff --git a/xen/include/asm-x86/hvm/svm/vmcb.h b/xen/include/asm-x86/hvm/svm/vmcb.h
index 0b03a8f076..9e1e42f494 100644
--- a/xen/include/asm-x86/hvm/svm/vmcb.h
+++ b/xen/include/asm-x86/hvm/svm/vmcb.h
@@ -248,6 +248,8 @@ enum VMEXIT_EXITCODE
     VMEXIT_EXCEPTION_AC  =  81, /* 0x51, alignment-check */
     VMEXIT_EXCEPTION_MC  =  82, /* 0x52, machine-check */
     VMEXIT_EXCEPTION_XF  =  83, /* 0x53, simd floating-point */
+/*  VMEXIT_EXCEPTION_20  =  84,    0x54, #VE (Intel specific) */
+    VMEXIT_EXCEPTION_CP  =  85, /* 0x55, controlflow protection */
 
     /* exceptions 20-31 (exitcodes 84-95) are reserved */
 
@@ -397,6 +399,8 @@ typedef union
         bool seg:1;        /* 8:  cs, ds, es, ss, cpl */
         bool cr2:1;        /* 9:  cr2 */
         bool lbr:1;        /* 10: debugctlmsr, last{branch,int}{to,from}ip */
+        bool :1;
+        bool cet:1;        /* 12: msr_s_set, ssp, msr_isst */
     };
     uint32_t raw;
 } vmcbcleanbits_t;
@@ -451,7 +455,7 @@ struct vmcb_struct {
             bool _sev_enable    :1;
             bool _sev_es_enable :1;
             bool _gmet          :1;
-            bool                :1;
+            bool _np_sss        :1;
             bool _vte           :1;
         };
         uint64_t _np_ctrl;
@@ -497,7 +501,9 @@ struct vmcb_struct {
     u64 rip;
     u64 res14[11];
     u64 rsp;
-    u64 res15[3];
+    u64 _msr_s_cet;             /* offset 0x400 + 0x1E0 - cleanbit 12 */
+    u64 _ssp;                   /* offset 0x400 + 0x1E8   | */
+    u64 _msr_isst;              /* offset 0x400 + 0x1F0   v */
     u64 rax;
     u64 star;
     u64 lstar;
@@ -635,6 +641,9 @@ VMCB_ACCESSORS(lastbranchfromip, lbr)
 VMCB_ACCESSORS(lastbranchtoip, lbr)
 VMCB_ACCESSORS(lastintfromip, lbr)
 VMCB_ACCESSORS(lastinttoip, lbr)
+VMCB_ACCESSORS(msr_s_cet, cet)
+VMCB_ACCESSORS(ssp, cet)
+VMCB_ACCESSORS(msr_isst, cet)
 
 #undef VMCB_ACCESSORS
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


