From xen-changelog-bounces@lists.xenproject.org Wed Jul 01 10:55:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Jul 2020 10: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 1jqaOP-0005NC-BJ; Wed, 01 Jul 2020 10:55:05 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=FR8Y=AM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jqaON-0005N7-L8
 for xen-changelog@lists.xenproject.org; Wed, 01 Jul 2020 10:55:03 +0000
X-Inumbo-ID: 50ab6784-bb89-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 50ab6784-bb89-11ea-b7bb-bc764e2007e4;
 Wed, 01 Jul 2020 10:55:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=k2/GJFKMGPqXQ7Z+gpXy9VIEUUyJ5Wa1rnSdbBrjuyM=; b=Hx9A2avNwnTFt1Pf/HPm9U1y0w
 4eBVSe0kCvmV/mcZG7cDKjOhRJVpD8wnHsvVtdM+dDBGkhUQqMPaRd3rpwXhkoYKo3ukjt62o7vKN
 hd2tnxbqb58onavMW/z1jNVKo0Sf3lizSROaOEYpyZnT4DUodb8+dyUrC8LeVT2Qwpvc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqaOM-0008BN-Hy
 for xen-changelog@lists.xenproject.org; Wed, 01 Jul 2020 10:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqaOM-0002Jy-Gu
 for xen-changelog@lists.xenproject.org; Wed, 01 Jul 2020 10:55:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] mm: fix public declaration of struct
 xen_mem_acquire_resource
Message-Id: <E1jqaOM-0002Jy-Gu@xenbits.xenproject.org>
Date: Wed, 01 Jul 2020 10:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 0e2e54966af556f4047c1048855c4a071028a32d
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Mon Jun 29 18:03:49 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jun 29 18:03:49 2020 +0200

    mm: fix public declaration of struct xen_mem_acquire_resource
    
    XENMEM_acquire_resource and it's related structure is currently inside
    a __XEN__ or __XEN_TOOLS__ guarded section to limit it's scope to the
    hypervisor or the toolstack only. This is wrong as the hypercall is
    already being used by the Linux kernel at least, and as such needs to
    be public.
    
    Also switch the usage of uint64_aligned_t to plain uint64_t, as
    uint64_aligned_t is only to be used by the toolstack. Doing such
    change will reduce the size of the structure on 32bit x86 by 4bytes,
    since there will be no padding added after the frame_list handle.
    
    This is fine, as users of the previous layout will allocate 4bytes of
    padding that won't be read by Xen, and users of the new layout won't
    allocate those, which is also fine since Xen won't try to access them.
    
    Note that the structure already has compat handling, and such handling
    will take care of copying the right size (ie: minus the padding) when
    called from a 32bit x86 context. This is true for the compat code both
    before and after this patch, since the structures in the memory.h
    compat header are subject to a pragma pack(4), which already removed
    the trailing padding that would otherwise be introduced by the
    alignment of the frame field to 8 bytes.
    
    Fixes: 3f8f12281dd20 ('x86/mm: add HYPERVISOR_memory_op to acquire guest resources')
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/include/public/memory.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h
index 850bd72c52..21057ed78e 100644
--- a/xen/include/public/memory.h
+++ b/xen/include/public/memory.h
@@ -610,6 +610,8 @@ struct xen_reserved_device_memory_map {
 typedef struct xen_reserved_device_memory_map xen_reserved_device_memory_map_t;
 DEFINE_XEN_GUEST_HANDLE(xen_reserved_device_memory_map_t);
 
+#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
+
 /*
  * Get the pages for a particular guest resource, so that they can be
  * mapped directly by a tools domain.
@@ -648,7 +650,7 @@ struct xen_mem_acquire_resource {
      * IN - the index of the initial frame to be mapped. This parameter
      *      is ignored if nr_frames is 0.
      */
-    uint64_aligned_t frame;
+    uint64_t frame;
 
 #define XENMEM_resource_ioreq_server_frame_bufioreq 0
 #define XENMEM_resource_ioreq_server_frame_ioreq(n) (1 + (n))
@@ -669,8 +671,6 @@ struct xen_mem_acquire_resource {
 typedef struct xen_mem_acquire_resource xen_mem_acquire_resource_t;
 DEFINE_XEN_GUEST_HANDLE(xen_mem_acquire_resource_t);
 
-#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
-
 /*
  * XENMEM_get_vnumainfo used by guest to get
  * vNUMA topology from hypervisor.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 01 10:55:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Jul 2020 10: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 1jqaOY-0005Nn-Cr; Wed, 01 Jul 2020 10:55:14 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=FR8Y=AM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jqaOX-0005Nh-89
 for xen-changelog@lists.xenproject.org; Wed, 01 Jul 2020 10:55:13 +0000
X-Inumbo-ID: 56b47418-bb89-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 56b47418-bb89-11ea-b7bb-bc764e2007e4;
 Wed, 01 Jul 2020 10:55:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=q5dYAnLpzCIMvg2UOype3WqaAHewJurg3HkJX+GKvEE=; b=MJuKC7nGhfIdowb96MqQpqhbJ5
 qOsfXWhatKdEGDUulxUWd4gh3RokhSFCZzL2LCHk0LCID056fwsjKI9+IIX97mMjeixp+g8b8vK3w
 hEkDQnflliXoUF3Rs3AOrzQAyBtQAggPEDFbWc9eAhtM28RAVUWpSTOiyRYo/cIYijjc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqaOW-0008BT-M8
 for xen-changelog@lists.xenproject.org; Wed, 01 Jul 2020 10:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqaOW-0002KZ-KI
 for xen-changelog@lists.xenproject.org; Wed, 01 Jul 2020 10:55:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] kconfig: fix typo in XEN_SHSTK description
Message-Id: <E1jqaOW-0002KZ-KI@xenbits.xenproject.org>
Date: Wed, 01 Jul 2020 10:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 23ca7ec0ba620db52a646d80e22f9703a6589f66
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Tue Jun 30 12:21:19 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jun 30 10:52:44 2020 +0000

    kconfig: fix typo in XEN_SHSTK description
    
    Rename 'vai' to 'via'.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 4a2ec87ff5..a636a4bb1e 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -113,7 +113,7 @@ config XEN_SHSTK
 
 	  This option arranges for Xen to use CET-SS for its own protection.
 	  When CET-SS is active, 32bit PV guests cannot be used.  Backwards
-	  compatiblity can be provided vai the PV Shim mechanism.
+	  compatiblity can be provided via the PV Shim mechanism.
 
 config SHADOW_PAGING
         bool "Shadow Paging"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 01 16:11:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Jul 2020 16: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 1jqfKF-0001Rj-Rk; Wed, 01 Jul 2020 16:11:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=FR8Y=AM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jqfKE-0001Rc-9M
 for xen-changelog@lists.xenproject.org; Wed, 01 Jul 2020 16:11:06 +0000
X-Inumbo-ID: 76453c47-bbb5-11ea-8734-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 76453c47-bbb5-11ea-8734-12813bfff9fa;
 Wed, 01 Jul 2020 16:11:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=pDzEUSGWhHSGeESCrSv+WU23t56ROz1j9MtIzhqxN1k=; b=qurx5n0hkQnsqJ+8RfwIBNoWpS
 4kxstZ21JL5uOIezACoEgkgM8VxrCPvK0t0WMY7qyOLp4A0W54/OWqurWB7Fu+gYZoiFoBUg+oeDi
 fD28QCSaoaiEmMiQ1eS0m6vKR0BU3Gt9PYdkbNUJKMhuXmuqO/fFwrJPtpPzhOCyU/rk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqfKC-0006MN-T4
 for xen-changelog@lists.xenproject.org; Wed, 01 Jul 2020 16:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqfKC-0002SW-S4
 for xen-changelog@lists.xenproject.org; Wed, 01 Jul 2020 16:11:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/spec-ctrl: Protect against CALL/JMP straight-line
 speculation
Message-Id: <E1jqfKC-0002SW-S4@xenbits.xenproject.org>
Date: Wed, 01 Jul 2020 16:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 3b7dab93f2401b08c673244c9ae0f92e08bd03ba
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jul 1 12:39:59 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jul 1 17:01:24 2020 +0100

    x86/spec-ctrl: Protect against CALL/JMP straight-line speculation
    
    Some x86 CPUs speculatively execute beyond indirect CALL/JMP instructions.
    
    With CONFIG_INDIRECT_THUNK / Retpolines, indirect CALL/JMP instructions are
    converted to direct CALL/JMP's to __x86_indirect_thunk_REG(), leaving just a
    handful of indirect JMPs implementing those stubs.
    
    There is no architectrual execution beyond an indirect JMP, so use INT3 as
    recommended by vendors to halt speculative execution.  This is shorter than
    LFENCE (which would also work fine), but also shows up in logs if we do
    unexpected execute them.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/indirect-thunk.S | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/indirect-thunk.S b/xen/arch/x86/indirect-thunk.S
index 3c17f75c23..7392aee127 100644
--- a/xen/arch/x86/indirect-thunk.S
+++ b/xen/arch/x86/indirect-thunk.S
@@ -24,10 +24,12 @@
 .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
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jul 01 17:22:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Jul 2020 17:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jqgQy-0007Xj-5T; Wed, 01 Jul 2020 17:22:08 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=FR8Y=AM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jqgQw-0007Xe-Fx
 for xen-changelog@lists.xenproject.org; Wed, 01 Jul 2020 17:22:06 +0000
X-Inumbo-ID: 62689fec-bbbf-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 62689fec-bbbf-11ea-8496-bc764e2007e4;
 Wed, 01 Jul 2020 17:22:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=YbnJFQf7M47dCEcXi+lMQJa/n1jKp7LJigukBWbXxsM=; b=IRyG34UpLzxKy7RHeAOduPobPd
 JoqLLzNTZ5ctLo4VCO1ua+cgfV9QFvaQAak2GoWLgd7cqrE7dQ/ysLgGIosRhFoGSgrxoWsfXjgc4
 iEtUeKUJlzB+Q2WHXGEMRKPSrdv1I93MKcM7q4ESE+kHHLRYzqvJ4I3t2V6uKWMqYMIM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqgQv-0007g6-41
 for xen-changelog@lists.xenproject.org; Wed, 01 Jul 2020 17:22:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqgQv-0001br-2m
 for xen-changelog@lists.xenproject.org; Wed, 01 Jul 2020 17:22:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] optee: immediately free buffers that are released by
 OP-TEE
Message-Id: <E1jqgQv-0001br-2m@xenbits.xenproject.org>
Date: Wed, 01 Jul 2020 17:22:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 5b13eb1d978e9732fe2c9826b60885b687a5c4fc
Author:     Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
AuthorDate: Fri Jun 19 22:33:59 2020 +0000
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Wed Jul 1 10:09:38 2020 -0700

    optee: immediately free buffers that are released by OP-TEE
    
    Normal World can share a buffer with OP-TEE for two reasons:
    1. A client application wants to exchange data with TA
    2. OP-TEE asks for shared buffer for internal needs
    
    The second case was handled more strictly than necessary:
    
    1. In RPC request OP-TEE asks for buffer
    2. NW allocates buffer and provides it via RPC response
    3. Xen pins pages and translates data
    4. Xen provides buffer to OP-TEE
    5. OP-TEE uses it
    6. OP-TEE sends request to free the buffer
    7. NW frees the buffer and sends the RPC response
    8. Xen unpins pages and forgets about the buffer
    
    The problem is that Xen should forget about buffer in between stages 6
    and 7. I.e. the right flow should be like this:
    
    6. OP-TEE sends request to free the buffer
    7. Xen unpins pages and forgets about the buffer
    8. NW frees the buffer and sends the RPC response
    
    This is because OP-TEE internally frees the buffer before sending the
    "free SHM buffer" request. So we have no reason to hold reference for
    this buffer anymore. Moreover, in multiprocessor systems NW have time
    to reuse the buffer cookie for another buffer. Xen complained about this
    and denied the new buffer registration. I have seen this issue while
    running tests on iMX SoC.
    
    So, this patch basically corrects that behavior by freeing the buffer
    earlier, when handling RPC return from OP-TEE.
    
    Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/arm/tee/optee.c | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
index 6a035355db..780f37e527 100644
--- a/xen/arch/arm/tee/optee.c
+++ b/xen/arch/arm/tee/optee.c
@@ -1099,6 +1099,34 @@ static int handle_rpc_return(struct optee_domain *ctx,
         if ( shm_rpc->xen_arg->cmd == OPTEE_RPC_CMD_SHM_ALLOC )
             call->rpc_buffer_type = shm_rpc->xen_arg->params[0].u.value.a;
 
+        /*
+         * OP-TEE is signalling that it has freed the buffer that it
+         * requested before. This is the right time for us to do the
+         * same.
+         */
+        if ( shm_rpc->xen_arg->cmd == OPTEE_RPC_CMD_SHM_FREE )
+        {
+            uint64_t cookie = shm_rpc->xen_arg->params[0].u.value.b;
+
+            free_optee_shm_buf(ctx, cookie);
+
+            /*
+             * OP-TEE asks to free the buffer, but this is not the same
+             * buffer we previously allocated for it. While nothing
+             * prevents OP-TEE from asking this, it is the strange
+             * situation. This may or may not be caused by a bug in
+             * OP-TEE or mediator. But is better to print warning.
+             */
+            if ( call->rpc_data_cookie && call->rpc_data_cookie != cookie )
+            {
+                gprintk(XENLOG_ERR,
+                        "Saved RPC cookie does not corresponds to OP-TEE's (%"PRIx64" != %"PRIx64")\n",
+                        call->rpc_data_cookie, cookie);
+
+                WARN();
+            }
+            call->rpc_data_cookie = 0;
+        }
         unmap_domain_page(shm_rpc->xen_arg);
     }
 
@@ -1464,10 +1492,6 @@ static void handle_rpc_cmd(struct optee_domain *ctx, struct cpu_user_regs *regs,
             }
             break;
         case OPTEE_RPC_CMD_SHM_FREE:
-            free_optee_shm_buf(ctx, shm_rpc->xen_arg->params[0].u.value.b);
-            if ( call->rpc_data_cookie ==
-                 shm_rpc->xen_arg->params[0].u.value.b )
-                call->rpc_data_cookie = 0;
             break;
         default:
             break;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jul 01 17:22:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 01 Jul 2020 17: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 1jqgR7-0007YC-71; Wed, 01 Jul 2020 17:22:17 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=FR8Y=AM=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jqgR6-0007Y4-GF
 for xen-changelog@lists.xenproject.org; Wed, 01 Jul 2020 17:22:16 +0000
X-Inumbo-ID: 6872eb54-bbbf-11ea-874b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 6872eb54-bbbf-11ea-874b-12813bfff9fa;
 Wed, 01 Jul 2020 17:22:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=HebMwbd0bDEaE6llxXd/iz546VdO0PNWrUFbTUOgCsw=; b=s2+e0VHnEw4UzQwnwVWAodefbe
 uI3/+R7ROLdts+y77H/W7DFc1lvDZT+t4I/CIjHp47oCaPmM8jTKLbacUhifcY7aq4SYneMrbYsit
 l2t6oIS0R3dWmPdh5zBY1b9MG4Cp7p+RO4qc1BmowfQk+oOdQyntGO5D9C3o49CmH/LA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqgR5-0007g9-8F
 for xen-changelog@lists.xenproject.org; Wed, 01 Jul 2020 17:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqgR5-0001cd-6a
 for xen-changelog@lists.xenproject.org; Wed, 01 Jul 2020 17:22:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] optee: allow plain TMEM buffers with NULL address
Message-Id: <E1jqgR5-0001cd-6a@xenbits.xenproject.org>
Date: Wed, 01 Jul 2020 17:22:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 0dbed3ad3366734fd23ee3fd1f9989c8c96b6052
Author:     Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
AuthorDate: Fri Jun 19 22:34:01 2020 +0000
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Wed Jul 1 10:15:07 2020 -0700

    optee: allow plain TMEM buffers with NULL address
    
    Trusted Applications use a popular approach to determine the required
    size of a buffer: the client provides a memory reference with the NULL
    pointer to a buffer. This is so called "Null memory reference". TA
    updates the reference with the required size and returns it back to the
    client. Then the client allocates a buffer of the needed size and
    repeats the operation.
    
    This behavior is described in TEE Client API Specification, paragraph
    3.2.5. Memory References.
    
    OP-TEE represents this null memory reference as a TMEM parameter with
    buf_ptr = 0x0. This is the only case when we should allow a TMEM
    buffer without the OPTEE_MSG_ATTR_NONCONTIG flag. This also the
    special case for a buffer with OPTEE_MSG_ATTR_NONCONTIG flag.
    
    This could lead to a potential issue, because IPA 0x0 is a valid
    address, but OP-TEE will treat it as a special case. So, care should
    be taken when construction OP-TEE enabled guest to make sure that such
    guest have no memory at IPA 0x0 and none of its memory is mapped at PA
    0x0.
    
    Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/arm/tee/optee.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
index 780f37e527..8a39fe33b0 100644
--- a/xen/arch/arm/tee/optee.c
+++ b/xen/arch/arm/tee/optee.c
@@ -215,6 +215,15 @@ static bool optee_probe(void)
     return true;
 }
 
+/*
+ * TODO: There is a potential issue with guests that either have RAM
+ * at IPA of 0x0 or some of their memory is mapped at PA 0x0. This is
+ * because PA of 0x0 is considered as NULL pointer by OP-TEE. It will
+ * not be able to map buffer with such pointer to TA address space, or
+ * use such buffer for communication with the guest. We either need to
+ * check that guest have no such mappings or ensure that OP-TEE
+ * enabled guest will not be created with such mappings.
+ */
 static int optee_domain_init(struct domain *d)
 {
     struct arm_smccc_res resp;
@@ -725,6 +734,15 @@ static int translate_noncontig(struct optee_domain *ctx,
         uint64_t next_page_data;
     } *guest_data, *xen_data;
 
+    /*
+     * Special case: a buffer with buf_ptr == 0x0 is considered as a
+     * NULL pointer by OP-TEE. No translation is needed. This can lead
+     * to an issue as IPA 0x0 is a valid address for Xen. See the
+     * comment near optee_domain_init()
+     */
+    if ( !param->u.tmem.buf_ptr )
+        return 0;
+
     /* Offset of user buffer withing OPTEE_MSG_NONCONTIG_PAGE_SIZE-sized page */
     offset = param->u.tmem.buf_ptr & (OPTEE_MSG_NONCONTIG_PAGE_SIZE - 1);
 
@@ -865,9 +883,12 @@ static int translate_params(struct optee_domain *ctx,
             }
             else
             {
-                gdprintk(XENLOG_WARNING, "Guest tries to use old tmem arg\n");
-                ret = -EINVAL;
-                goto out;
+                if ( call->xen_arg->params[i].u.tmem.buf_ptr )
+                {
+                    gdprintk(XENLOG_WARNING, "Guest tries to use old tmem arg\n");
+                    ret = -EINVAL;
+                    goto out;
+                }
             }
             break;
         case OPTEE_MSG_ATTR_TYPE_NONE:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jul 02 09:22:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 02 Jul 2020 09:22: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 1jqvPz-0000T4-CH; Thu, 02 Jul 2020 09:22:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=NDOh=AN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jqvPy-0000Sz-3y
 for xen-changelog@lists.xenproject.org; Thu, 02 Jul 2020 09:22:06 +0000
X-Inumbo-ID: 7e60bf0a-bc45-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7e60bf0a-bc45-11ea-bca7-bc764e2007e4;
 Thu, 02 Jul 2020 09:22:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=zgMLns2NZIVDGnXhIAVZ0T6dB5/zKrVmVb4vCrm4P2w=; b=b8C8epeVa/Z9kJdd7Fcd+3QTbi
 X/tI8r8/uYTfBa0UzXCDQ0o7ldWdw+w9BjRkxjxdT5xFanekl3DJNDXzdJp1VQkJym2O8NXiiE2fp
 leHoCokaOH5Sa18aR4tp9eq1Acx9SobElv/7uIDIHuFmC4nHJtZ3hYjTwa4TUkbdj/AA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqvPw-0005u3-IZ
 for xen-changelog@lists.xenproject.org; Thu, 02 Jul 2020 09:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqvPw-0005ec-Hc
 for xen-changelog@lists.xenproject.org; Thu, 02 Jul 2020 09:22:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/tlb: fix assisted flush usage
Message-Id: <E1jqvPw-0005ec-Hc@xenbits.xenproject.org>
Date: Thu, 02 Jul 2020 09:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 5b718d24e88ceb2c28010c647836929b85b22b5d
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Thu Jul 2 11:05:53 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jul 2 11:09:33 2020 +0200

    x86/tlb: fix assisted flush usage
    
    Commit e9aca9470ed86 introduced a regression when avoiding sending
    IPIs for certain flush operations. Xen page fault handler
    (spurious_page_fault) relies on blocking interrupts in order to
    prevent handling TLB flush IPIs and thus preventing other CPUs from
    removing page tables pages. Switching to assisted flushing avoided such
    IPIs, and thus can result in pages belonging to the page tables being
    removed (and possibly re-used) while __page_fault_type is being
    executed.
    
    Force some of the TLB flushes to use IPIs, thus avoiding the assisted
    TLB flush. Those selected flushes are the page type change (when
    switching from a page table type to a different one, ie: a page that
    has been removed as a page table) and page allocation. This sadly has
    a negative performance impact on the pvshim, as less assisted flushes
    can be used. Note the flush in grant-table code is also switched to
    use an IPI even when not strictly needed. This is done so that a
    common arch_flush_tlb_mask can be introduced and always used in common
    code.
    
    Introduce a new flag (FLUSH_FORCE_IPI) and helper to force a TLB flush
    using an IPI (x86 only). Note that the flag is only meaningfully defined
    when the hypervisor supports PV or shadow paging mode, as otherwise
    hardware assisted paging domains are in charge of their page tables and
    won't share page tables with Xen, thus not influencing the result of
    page walks performed by the spurious fault handler.
    
    Just passing this new flag when calling flush_area_mask prevents the
    usage of the assisted flush without any other side effects.
    
    Note the flag is not defined on Arm.
    
    Fixes: e9aca9470ed86 ('x86/tlb: use Xen L0 assisted TLB flush when available')
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/arm/smp.c             |  2 +-
 xen/arch/x86/mm.c              | 12 +++++++++++-
 xen/common/grant_table.c       |  2 +-
 xen/include/asm-arm/flushtlb.h |  2 +-
 xen/include/asm-x86/flushtlb.h | 17 +++++++++++++++++
 xen/include/xen/mm.h           |  2 +-
 6 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/smp.c b/xen/arch/arm/smp.c
index ce1fcc8ef9..5823a69d3e 100644
--- a/xen/arch/arm/smp.c
+++ b/xen/arch/arm/smp.c
@@ -5,7 +5,7 @@
 #include <asm/gic.h>
 #include <asm/flushtlb.h>
 
-void flush_tlb_mask(const cpumask_t *mask)
+void arch_flush_tlb_mask(const cpumask_t *mask)
 {
     /* No need to IPI other processors on ARM, the processor takes care of it. */
     flush_all_guests_tlb();
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index e376fc7e8f..82bc676553 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -2894,7 +2894,17 @@ static int _get_page_type(struct page_info *page, unsigned long type,
                       ((nx & PGT_type_mask) == PGT_writable_page)) )
                 {
                     perfc_incr(need_flush_tlb_flush);
-                    flush_tlb_mask(mask);
+                    /*
+                     * If page was a page table make sure the flush is
+                     * performed using an IPI in order to avoid changing the
+                     * type of a page table page under the feet of
+                     * spurious_page_fault().
+                     */
+                    flush_mask(mask,
+                               (x & PGT_type_mask) &&
+                               (x & PGT_type_mask) <= PGT_root_page_table
+                               ? FLUSH_TLB | FLUSH_FORCE_IPI
+                               : FLUSH_TLB);
                 }
 
                 /* We lose existing type and validity. */
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index ece670e484..9f0cae52c0 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -393,7 +393,7 @@ static inline void grant_write_unlock(struct grant_table *gt)
 static inline void gnttab_flush_tlb(const struct domain *d)
 {
     if ( !paging_mode_external(d) )
-        flush_tlb_mask(d->dirty_cpumask);
+        arch_flush_tlb_mask(d->dirty_cpumask);
 }
 
 static inline unsigned int
diff --git a/xen/include/asm-arm/flushtlb.h b/xen/include/asm-arm/flushtlb.h
index ab1aae5c90..125a141975 100644
--- a/xen/include/asm-arm/flushtlb.h
+++ b/xen/include/asm-arm/flushtlb.h
@@ -26,7 +26,7 @@ static inline void page_set_tlbflush_timestamp(struct page_info *page)
 #endif
 
 /* Flush specified CPUs' TLBs */
-void flush_tlb_mask(const cpumask_t *mask);
+void arch_flush_tlb_mask(const cpumask_t *mask);
 
 /*
  * Flush a range of VA's hypervisor mappings from the TLB of the local
diff --git a/xen/include/asm-x86/flushtlb.h b/xen/include/asm-x86/flushtlb.h
index 8639427cce..0be2273387 100644
--- a/xen/include/asm-x86/flushtlb.h
+++ b/xen/include/asm-x86/flushtlb.h
@@ -126,6 +126,16 @@ void switch_cr3_cr4(unsigned long cr3, unsigned long cr4);
 #else
 #define FLUSH_HVM_ASID_CORE 0
 #endif
+#if defined(CONFIG_PV) || defined(CONFIG_SHADOW_PAGING)
+/*
+ * Force an IPI to be sent. Note that adding this to the flags passed to
+ * flush_area_mask will prevent using the assisted flush without having any
+ * other side effect.
+ */
+# define FLUSH_FORCE_IPI 0x8000
+#else
+# define FLUSH_FORCE_IPI 0
+#endif
 
 /* Flush local TLBs/caches. */
 unsigned int flush_area_local(const void *va, unsigned int flags);
@@ -151,6 +161,13 @@ void flush_area_mask(const cpumask_t *, const void *va, unsigned int flags);
 #define flush_tlb_one_mask(mask,v)              \
     flush_area_mask(mask, (const void *)(v), FLUSH_TLB|FLUSH_ORDER(0))
 
+/*
+ * Make the common code TLB flush helper force use of an IPI in order to be
+ * on the safe side. Note that not all calls from common code strictly require
+ * this.
+ */
+#define arch_flush_tlb_mask(mask) flush_mask(mask, FLUSH_TLB | FLUSH_FORCE_IPI)
+
 /* Flush all CPUs' TLBs */
 #define flush_tlb_all()                         \
     flush_tlb_mask(&cpu_online_map)
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index 9b62087be1..1061765bcd 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -648,7 +648,7 @@ static inline void filtered_flush_tlb_mask(uint32_t tlbflush_timestamp)
     if ( !cpumask_empty(&mask) )
     {
         perfc_incr(need_flush_tlb_flush);
-        flush_tlb_mask(&mask);
+        arch_flush_tlb_mask(&mask);
     }
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jul 02 09:22:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 02 Jul 2020 09: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 1jqvQ9-0000UJ-Ds; Thu, 02 Jul 2020 09:22:17 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=NDOh=AN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jqvQ8-0000U9-1e
 for xen-changelog@lists.xenproject.org; Thu, 02 Jul 2020 09:22:16 +0000
X-Inumbo-ID: 8382cc81-bc45-11ea-87f1-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8382cc81-bc45-11ea-87f1-12813bfff9fa;
 Thu, 02 Jul 2020 09:22:14 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=zLlwLpb97oVQyMC7DFiKGxTaqokT6LjKlDiBX7kFVJI=; b=V/55YAVRBYtVUqB8jbEg/jyRZj
 as0rweDy5X1r7bBcMdHkGZi+ZAQAOiMv9K4qwcTIAgpHOwWFxrR7pWcpyNSfpQnm14R4DvzCsypwT
 6Jjgkbz108ncZ6uF7tiyWpHlbYaTIzBbjS0oiw2PmqLGbf5x1q1kbObgGYnbQDGdLhZQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqvQ6-0005un-NK
 for xen-changelog@lists.xenproject.org; Thu, 02 Jul 2020 09:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jqvQ6-0005fB-Kv
 for xen-changelog@lists.xenproject.org; Thu, 02 Jul 2020 09:22:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] build: tweak variable exporting for make 3.82
Message-Id: <E1jqvQ6-0005fB-Kv@xenbits.xenproject.org>
Date: Thu, 02 Jul 2020 09:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit be63d9d47f571a60d70f8fb630c03871312d9655
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jul 2 11:11:40 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jul 2 11:11:40 2020 +0200

    build: tweak variable exporting for make 3.82
    
    While I've been running into an issue here only because of an additional
    local change I'm carrying, to be able to override just the compiler in
    $(XEN_ROOT)/.config (rather than the whole tool chain), in
    config/StdGNU.mk:
    
    ifeq ($(filter-out default undefined,$(origin CC)),)
    
    I'd like to propose to nevertheless correct the underlying issue:
    Exporting an unset variable changes its origin from "undefined" to
    "file". This comes into effect because of our adding of -rR to
    MAKEFLAGS, which make 3.82 wrongly applies also upon re-invoking itself
    after having updated auto.conf{,.cmd}.
    
    Move the export statement past $(XEN_ROOT)/config/$(XEN_OS).mk inclusion
    (which happens through $(XEN_ROOT)/Config.mk) such that the variables
    already have their designated values at that point, while retaining
    their initial origin up to the point they get defined.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index 0ade7f9517..2f3f8b9deb 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -17,8 +17,6 @@ export XEN_BUILD_HOST	?= $(shell hostname)
 PYTHON_INTERPRETER	:= $(word 1,$(shell which python3 python python2 2>/dev/null) python)
 export PYTHON		?= $(PYTHON_INTERPRETER)
 
-export CC CXX LD
-
 export BASEDIR := $(CURDIR)
 export XEN_ROOT := $(BASEDIR)/..
 
@@ -42,6 +40,8 @@ export TARGET_ARCH     := $(shell echo $(XEN_TARGET_ARCH) | \
 # Allow someone to change their config file
 export KCONFIG_CONFIG ?= .config
 
+export CC CXX LD
+
 .PHONY: default
 default: build
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jul 02 15:33:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 02 Jul 2020 15:33:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jr1D3-0007SX-Kl; Thu, 02 Jul 2020 15:33:09 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=NDOh=AN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jr1D2-0007SS-4B
 for xen-changelog@lists.xenproject.org; Thu, 02 Jul 2020 15:33:08 +0000
X-Inumbo-ID: 52da27ca-bc79-11ea-8852-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 52da27ca-bc79-11ea-8852-12813bfff9fa;
 Thu, 02 Jul 2020 15:33:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=5hvUDTOho7692R2wYHVs8pTQsJ7Mqk0An0dvmaox5fI=; b=bjhyQymBjvsdrzZESPXR0D3mkp
 zjLJxiIFDlNwmZIYcAbG6Hui+aHgDXwsTVjJuW1oksN9t/docuY6X0H+zNtE1ARs0GlkFbabeybHU
 hiiqajzbNg4YvMoygid30wWeYyzSm3ScODR6lIUcRIgxAV4Y6b9KNMtMolOjLyFICKOY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jr1Cz-0004QI-DG
 for xen-changelog@lists.xenproject.org; Thu, 02 Jul 2020 15:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jr1Cz-0000Ia-CB
 for xen-changelog@lists.xenproject.org; Thu, 02 Jul 2020 15:33:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [qemu-xen staging] xen: fix build without pci passthrough
Message-Id: <E1jr1Cz-0000Ia-CB@xenbits.xenproject.org>
Date: Thu, 02 Jul 2020 15:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 94b3474ff8b57298b55b3ac26f85723d600a5019
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Wed Jun 3 17:04:42 2020 +0100
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Thu Jul 2 16:30:27 2020 +0100

    xen: fix build without pci passthrough
    
    Xen PCI passthrough support may not be available and thus the global
    variable "has_igd_gfx_passthru" might be compiled out. Common code
    should not access it in that case.
    
    Unfortunately, we can't use CONFIG_XEN_PCI_PASSTHROUGH directly in
    xen-common.c so this patch instead move access to the
    has_igd_gfx_passthru variable via function and those functions are
    also implemented as stubs. The stubs will be used when QEMU is built
    without passthrough support.
    
    Now, when one will want to enable igd-passthru via the -machine
    property, they will get an error message if QEMU is built without
    passthrough support.
    
    Fixes: 46472d82322d0 ('xen: convert "-machine igd-passthru" to an accelerator property')
    Reported-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Message-Id: <20200603160442.3151170-1-anthony.perard@citrix.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    
    (cherry picked from commit acd0c9416d4846afc541605ee0e75ca163773e6c)
    [fix conflict in hw/xen/Makefile.objs]
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 hw/Makefile.objs     |  2 +-
 hw/i386/pc_piix.c    |  2 +-
 hw/xen/Makefile.objs |  3 ++-
 hw/xen/xen-common.c  |  4 ++--
 hw/xen/xen_pt.c      | 12 +++++++++++-
 hw/xen/xen_pt.h      |  6 ++++--
 hw/xen/xen_pt_stub.c | 22 ++++++++++++++++++++++
 7 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index 660e2b4373..4cbe5e4e57 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -35,7 +35,7 @@ devices-dirs-y += usb/
 devices-dirs-$(CONFIG_VFIO) += vfio/
 devices-dirs-y += virtio/
 devices-dirs-y += watchdog/
-devices-dirs-y += xen/
+devices-dirs-$(CONFIG_XEN) += xen/
 devices-dirs-$(CONFIG_MEM_DEVICE) += mem/
 devices-dirs-$(CONFIG_NUBUS) += nubus/
 devices-dirs-y += semihosting/
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 22dee0e76c..0440e655e2 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -373,7 +373,7 @@ static void pc_init_isa(MachineState *machine)
 #ifdef CONFIG_XEN
 static void pc_xen_hvm_init_pci(MachineState *machine)
 {
-    const char *pci_type = has_igd_gfx_passthru ?
+    const char *pci_type = xen_igd_gfx_pt_enabled() ?
                 TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE : TYPE_I440FX_PCI_DEVICE;
 
     pc_init1(machine,
diff --git a/hw/xen/Makefile.objs b/hw/xen/Makefile.objs
index 84df60a928..8f3048a1db 100644
--- a/hw/xen/Makefile.objs
+++ b/hw/xen/Makefile.objs
@@ -1,6 +1,7 @@
 # xen backend driver support
-common-obj-$(CONFIG_XEN) += xen-legacy-backend.o xen_devconfig.o xen_pvdev.o xen-common.o xen-bus.o xen-bus-helper.o xen-backend.o
+common-obj-y += xen-legacy-backend.o xen_devconfig.o xen_pvdev.o xen-common.o xen-bus.o xen-bus-helper.o xen-backend.o
 
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_graphics.o xen_pt_msi.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt_load_rom.o
+obj-$(call $(lnot, $(CONFIG_XEN_PCI_PASSTHROUGH))) += xen_pt_stub.o
diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c
index a15070f7f6..05e5fa17b2 100644
--- a/hw/xen/xen-common.c
+++ b/hw/xen/xen-common.c
@@ -129,12 +129,12 @@ static void xen_change_state_handler(void *opaque, int running,
 
 static bool xen_get_igd_gfx_passthru(Object *obj, Error **errp)
 {
-    return has_igd_gfx_passthru;
+    return xen_igd_gfx_pt_enabled();
 }
 
 static void xen_set_igd_gfx_passthru(Object *obj, bool value, Error **errp)
 {
-    has_igd_gfx_passthru = value;
+    xen_igd_gfx_pt_set(value, errp);
 }
 
 static void xen_setup_post(MachineState *ms, AccelState *accel)
diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c
index b91082cb8b..12a8232dc2 100644
--- a/hw/xen/xen_pt.c
+++ b/hw/xen/xen_pt.c
@@ -65,7 +65,17 @@
 #include "qemu/range.h"
 #include "exec/address-spaces.h"
 
-bool has_igd_gfx_passthru;
+static bool has_igd_gfx_passthru;
+
+bool xen_igd_gfx_pt_enabled(void)
+{
+    return has_igd_gfx_passthru;
+}
+
+void xen_igd_gfx_pt_set(bool value, Error **errp)
+{
+    has_igd_gfx_passthru = value;
+}
 
 #define XEN_PT_NR_IRQS (256)
 static uint8_t xen_pt_mapped_machine_irq[XEN_PT_NR_IRQS] = {0};
diff --git a/hw/xen/xen_pt.h b/hw/xen/xen_pt.h
index 179775db7b..6e9cec95f3 100644
--- a/hw/xen/xen_pt.h
+++ b/hw/xen/xen_pt.h
@@ -5,6 +5,9 @@
 #include "hw/pci/pci.h"
 #include "xen-host-pci-device.h"
 
+bool xen_igd_gfx_pt_enabled(void);
+void xen_igd_gfx_pt_set(bool value, Error **errp);
+
 void xen_pt_log(const PCIDevice *d, const char *f, ...) GCC_FMT_ATTR(2, 3);
 
 #define XEN_PT_ERR(d, _f, _a...) xen_pt_log(d, "%s: Error: "_f, __func__, ##_a)
@@ -322,10 +325,9 @@ extern void *pci_assign_dev_load_option_rom(PCIDevice *dev,
                                             unsigned int domain,
                                             unsigned int bus, unsigned int slot,
                                             unsigned int function);
-extern bool has_igd_gfx_passthru;
 static inline bool is_igd_vga_passthrough(XenHostPCIDevice *dev)
 {
-    return (has_igd_gfx_passthru
+    return (xen_igd_gfx_pt_enabled()
             && ((dev->class_code >> 0x8) == PCI_CLASS_DISPLAY_VGA));
 }
 int xen_pt_register_vga_regions(XenHostPCIDevice *dev);
diff --git a/hw/xen/xen_pt_stub.c b/hw/xen/xen_pt_stub.c
new file mode 100644
index 0000000000..2d8cac8d54
--- /dev/null
+++ b/hw/xen/xen_pt_stub.c
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020       Citrix Systems UK Ltd.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/xen/xen_pt.h"
+#include "qapi/error.h"
+
+bool xen_igd_gfx_pt_enabled(void)
+{
+    return false;
+}
+
+void xen_igd_gfx_pt_set(bool value, Error **errp)
+{
+    if (value) {
+        error_setg(errp, "Xen PCI passthrough support not built in");
+    }
+}
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jul 02 15:33:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 02 Jul 2020 15:33:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jr1DB-0007TX-MP; Thu, 02 Jul 2020 15:33:17 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=NDOh=AN=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jr1DA-0007Sn-KI
 for xen-changelog@lists.xenproject.org; Thu, 02 Jul 2020 15:33:16 +0000
X-Inumbo-ID: 58dc8028-bc79-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 58dc8028-bc79-11ea-bca7-bc764e2007e4;
 Thu, 02 Jul 2020 15:33:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=xwqHNUMq6LTSOHpV2TZuW6RMYv8Eyvg1GZZ783JXOAI=; b=Lla08QbxwMLkVCxzxNHWKBVDkJ
 bGrw8bea2OKt17sC6PoabZLMAf1g5YWvNPI1d1iDNrwvR+kNmYB+0wInbNtj+OfwhdZhOm0KppTLO
 eYl0RENpe68v3eVjL/rr3OjhiQtcopkA6jsNIdJMLMRP5wv1cKj/ufbVVIyuacnkYjYA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jr1D9-0004QO-HK
 for xen-changelog@lists.xenproject.org; Thu, 02 Jul 2020 15:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jr1D9-0000J3-Fb
 for xen-changelog@lists.xenproject.org; Thu, 02 Jul 2020 15:33:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [qemu-xen staging] xen: Actually fix build without passthrough
Message-Id: <E1jr1D9-0000J3-Fb@xenbits.xenproject.org>
Date: Thu, 02 Jul 2020 15:33:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ea6d3cd1ed79d824e605a70c3626bc437c386260
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Jun 19 11:31:15 2020 +0100
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Thu Jul 2 16:30:27 2020 +0100

    xen: Actually fix build without passthrough
    
    Fix typo.
    
    Fixes: acd0c9416d48 ("xen: fix build without pci passthrough")
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Message-Id: <20200619103115.254127-1-anthony.perard@citrix.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit b00de3a51fc8e86d1678c57e65d57aa9ed052422)
---
 hw/xen/Makefile.objs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/xen/Makefile.objs b/hw/xen/Makefile.objs
index 8f3048a1db..501d5f5a8f 100644
--- a/hw/xen/Makefile.objs
+++ b/hw/xen/Makefile.objs
@@ -4,4 +4,4 @@ common-obj-y += xen-legacy-backend.o xen_devconfig.o xen_pvdev.o xen-common.o xe
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_graphics.o xen_pt_msi.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt_load_rom.o
-obj-$(call $(lnot, $(CONFIG_XEN_PCI_PASSTHROUGH))) += xen_pt_stub.o
+obj-$(call lnot,$(CONFIG_XEN_PCI_PASSTHROUGH)) += xen_pt_stub.o
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jul 03 04:11:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Jul 2020 04:11: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 1jrD2W-0005pn-T5; Fri, 03 Jul 2020 04:11:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=8yXy=AO=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jrD2V-0005ph-Vb
 for xen-changelog@lists.xenproject.org; Fri, 03 Jul 2020 04:11:04 +0000
X-Inumbo-ID: 35851922-bce3-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 35851922-bce3-11ea-b7bb-bc764e2007e4;
 Fri, 03 Jul 2020 04:11:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=WbMYvzEF3O4G/zoh8SmMMaqMvTaBj7GVZMRTGXEMKHc=; b=QQhOSWm4mf/mBxknjasOtxOWI8
 SS+Kfx1Fbd5aFr7K8htDSieB8k4T7sbxkOdsArIVxlyHmMj125VlVPwKeEvgeUdxJipryKlTDSxdM
 gBIr0Jnjvd01flPtzpbHMWOg+iUTYOVUPLe2bdF7i4+XCaKkko0ltYWIwDQbGGCm9tYY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jrD2U-000503-RW
 for xen-changelog@lists.xenproject.org; Fri, 03 Jul 2020 04:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jrD2U-0001Pm-PV
 for xen-changelog@lists.xenproject.org; Fri, 03 Jul 2020 04:11:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [qemu-xen master] xen: fix build without pci passthrough
Message-Id: <E1jrD2U-0001Pm-PV@xenbits.xenproject.org>
Date: Fri, 03 Jul 2020 04:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 94b3474ff8b57298b55b3ac26f85723d600a5019
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Wed Jun 3 17:04:42 2020 +0100
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Thu Jul 2 16:30:27 2020 +0100

    xen: fix build without pci passthrough
    
    Xen PCI passthrough support may not be available and thus the global
    variable "has_igd_gfx_passthru" might be compiled out. Common code
    should not access it in that case.
    
    Unfortunately, we can't use CONFIG_XEN_PCI_PASSTHROUGH directly in
    xen-common.c so this patch instead move access to the
    has_igd_gfx_passthru variable via function and those functions are
    also implemented as stubs. The stubs will be used when QEMU is built
    without passthrough support.
    
    Now, when one will want to enable igd-passthru via the -machine
    property, they will get an error message if QEMU is built without
    passthrough support.
    
    Fixes: 46472d82322d0 ('xen: convert "-machine igd-passthru" to an accelerator property')
    Reported-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Message-Id: <20200603160442.3151170-1-anthony.perard@citrix.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    
    (cherry picked from commit acd0c9416d4846afc541605ee0e75ca163773e6c)
    [fix conflict in hw/xen/Makefile.objs]
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 hw/Makefile.objs     |  2 +-
 hw/i386/pc_piix.c    |  2 +-
 hw/xen/Makefile.objs |  3 ++-
 hw/xen/xen-common.c  |  4 ++--
 hw/xen/xen_pt.c      | 12 +++++++++++-
 hw/xen/xen_pt.h      |  6 ++++--
 hw/xen/xen_pt_stub.c | 22 ++++++++++++++++++++++
 7 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index 660e2b4373..4cbe5e4e57 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -35,7 +35,7 @@ devices-dirs-y += usb/
 devices-dirs-$(CONFIG_VFIO) += vfio/
 devices-dirs-y += virtio/
 devices-dirs-y += watchdog/
-devices-dirs-y += xen/
+devices-dirs-$(CONFIG_XEN) += xen/
 devices-dirs-$(CONFIG_MEM_DEVICE) += mem/
 devices-dirs-$(CONFIG_NUBUS) += nubus/
 devices-dirs-y += semihosting/
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 22dee0e76c..0440e655e2 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -373,7 +373,7 @@ static void pc_init_isa(MachineState *machine)
 #ifdef CONFIG_XEN
 static void pc_xen_hvm_init_pci(MachineState *machine)
 {
-    const char *pci_type = has_igd_gfx_passthru ?
+    const char *pci_type = xen_igd_gfx_pt_enabled() ?
                 TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE : TYPE_I440FX_PCI_DEVICE;
 
     pc_init1(machine,
diff --git a/hw/xen/Makefile.objs b/hw/xen/Makefile.objs
index 84df60a928..8f3048a1db 100644
--- a/hw/xen/Makefile.objs
+++ b/hw/xen/Makefile.objs
@@ -1,6 +1,7 @@
 # xen backend driver support
-common-obj-$(CONFIG_XEN) += xen-legacy-backend.o xen_devconfig.o xen_pvdev.o xen-common.o xen-bus.o xen-bus-helper.o xen-backend.o
+common-obj-y += xen-legacy-backend.o xen_devconfig.o xen_pvdev.o xen-common.o xen-bus.o xen-bus-helper.o xen-backend.o
 
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_graphics.o xen_pt_msi.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt_load_rom.o
+obj-$(call $(lnot, $(CONFIG_XEN_PCI_PASSTHROUGH))) += xen_pt_stub.o
diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c
index a15070f7f6..05e5fa17b2 100644
--- a/hw/xen/xen-common.c
+++ b/hw/xen/xen-common.c
@@ -129,12 +129,12 @@ static void xen_change_state_handler(void *opaque, int running,
 
 static bool xen_get_igd_gfx_passthru(Object *obj, Error **errp)
 {
-    return has_igd_gfx_passthru;
+    return xen_igd_gfx_pt_enabled();
 }
 
 static void xen_set_igd_gfx_passthru(Object *obj, bool value, Error **errp)
 {
-    has_igd_gfx_passthru = value;
+    xen_igd_gfx_pt_set(value, errp);
 }
 
 static void xen_setup_post(MachineState *ms, AccelState *accel)
diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c
index b91082cb8b..12a8232dc2 100644
--- a/hw/xen/xen_pt.c
+++ b/hw/xen/xen_pt.c
@@ -65,7 +65,17 @@
 #include "qemu/range.h"
 #include "exec/address-spaces.h"
 
-bool has_igd_gfx_passthru;
+static bool has_igd_gfx_passthru;
+
+bool xen_igd_gfx_pt_enabled(void)
+{
+    return has_igd_gfx_passthru;
+}
+
+void xen_igd_gfx_pt_set(bool value, Error **errp)
+{
+    has_igd_gfx_passthru = value;
+}
 
 #define XEN_PT_NR_IRQS (256)
 static uint8_t xen_pt_mapped_machine_irq[XEN_PT_NR_IRQS] = {0};
diff --git a/hw/xen/xen_pt.h b/hw/xen/xen_pt.h
index 179775db7b..6e9cec95f3 100644
--- a/hw/xen/xen_pt.h
+++ b/hw/xen/xen_pt.h
@@ -5,6 +5,9 @@
 #include "hw/pci/pci.h"
 #include "xen-host-pci-device.h"
 
+bool xen_igd_gfx_pt_enabled(void);
+void xen_igd_gfx_pt_set(bool value, Error **errp);
+
 void xen_pt_log(const PCIDevice *d, const char *f, ...) GCC_FMT_ATTR(2, 3);
 
 #define XEN_PT_ERR(d, _f, _a...) xen_pt_log(d, "%s: Error: "_f, __func__, ##_a)
@@ -322,10 +325,9 @@ extern void *pci_assign_dev_load_option_rom(PCIDevice *dev,
                                             unsigned int domain,
                                             unsigned int bus, unsigned int slot,
                                             unsigned int function);
-extern bool has_igd_gfx_passthru;
 static inline bool is_igd_vga_passthrough(XenHostPCIDevice *dev)
 {
-    return (has_igd_gfx_passthru
+    return (xen_igd_gfx_pt_enabled()
             && ((dev->class_code >> 0x8) == PCI_CLASS_DISPLAY_VGA));
 }
 int xen_pt_register_vga_regions(XenHostPCIDevice *dev);
diff --git a/hw/xen/xen_pt_stub.c b/hw/xen/xen_pt_stub.c
new file mode 100644
index 0000000000..2d8cac8d54
--- /dev/null
+++ b/hw/xen/xen_pt_stub.c
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020       Citrix Systems UK Ltd.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/xen/xen_pt.h"
+#include "qapi/error.h"
+
+bool xen_igd_gfx_pt_enabled(void)
+{
+    return false;
+}
+
+void xen_igd_gfx_pt_set(bool value, Error **errp)
+{
+    if (value) {
+        error_setg(errp, "Xen PCI passthrough support not built in");
+    }
+}
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jul 03 04:11:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 03 Jul 2020 04:11: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 1jrD2g-0005qV-Up; Fri, 03 Jul 2020 04:11:14 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=8yXy=AO=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jrD2f-0005qN-JQ
 for xen-changelog@lists.xenproject.org; Fri, 03 Jul 2020 04:11:13 +0000
X-Inumbo-ID: 3b83d8ae-bce3-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3b83d8ae-bce3-11ea-b7bb-bc764e2007e4;
 Fri, 03 Jul 2020 04:11:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=4L85WoI7HqJUF8MC764+3n9EIRdDL0ubOVVxC3OpELo=; b=1BhW6LODJlXzhs4Ic4IXNmKivd
 XMq2pLNb6IMCGd2CcKt43zRQDqfLjctjnMWnOYUd/UxORXM66VdmiRnCkB15+JjBBiiPmchvPiJO+
 ldY9T8ldE3TtUVZxb5yuKLpFS4L5R2Whb91tuGbpZfdiJLLchLeLSBsTATiaIs74ZU5I=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jrD2e-000509-Uc
 for xen-changelog@lists.xenproject.org; Fri, 03 Jul 2020 04:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jrD2e-0001Qb-Tr
 for xen-changelog@lists.xenproject.org; Fri, 03 Jul 2020 04:11:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [qemu-xen master] xen: Actually fix build without passthrough
Message-Id: <E1jrD2e-0001Qb-Tr@xenbits.xenproject.org>
Date: Fri, 03 Jul 2020 04:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ea6d3cd1ed79d824e605a70c3626bc437c386260
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Jun 19 11:31:15 2020 +0100
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Thu Jul 2 16:30:27 2020 +0100

    xen: Actually fix build without passthrough
    
    Fix typo.
    
    Fixes: acd0c9416d48 ("xen: fix build without pci passthrough")
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Message-Id: <20200619103115.254127-1-anthony.perard@citrix.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit b00de3a51fc8e86d1678c57e65d57aa9ed052422)
---
 hw/xen/Makefile.objs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/xen/Makefile.objs b/hw/xen/Makefile.objs
index 8f3048a1db..501d5f5a8f 100644
--- a/hw/xen/Makefile.objs
+++ b/hw/xen/Makefile.objs
@@ -4,4 +4,4 @@ common-obj-y += xen-legacy-backend.o xen_devconfig.o xen_pvdev.o xen-common.o xe
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_graphics.o xen_pt_msi.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt_load_rom.o
-obj-$(call $(lnot, $(CONFIG_XEN_PCI_PASSTHROUGH))) += xen_pt_stub.o
+obj-$(call lnot,$(CONFIG_XEN_PCI_PASSTHROUGH)) += xen_pt_stub.o
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jul 04 03:11:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 04 Jul 2020 03:11: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 1jrYZz-0005Zt-AW; Sat, 04 Jul 2020 03:11:03 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=g8qt=AP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jrYZy-0005Zo-RF
 for xen-changelog@lists.xenproject.org; Sat, 04 Jul 2020 03:11:02 +0000
X-Inumbo-ID: fdb6c2ea-bda3-11ea-8aaa-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id fdb6c2ea-bda3-11ea-8aaa-12813bfff9fa;
 Sat, 04 Jul 2020 03:11:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=sUR+EG3n4ja2ttx7QkbuvVpGDhP5zqIVQCgssX01kTY=; b=5U1g1uXZlFrT9Inry2cJKAvftn
 YoDzLZVNBijWiDPKZG1ksUXD9PGgAQ/duimiiN1wgNye1zo3FOS8u/Z+6yjV8NB0AYF24Tc1ZDDEX
 b4EZVeu4xDuabXbpjJoFsVARV7/yCEi50yRl6NfMhpTDw5fkaqRbM5pzxPpdxCJ16chs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jrYZy-0000XR-3k
 for xen-changelog@lists.xenproject.org; Sat, 04 Jul 2020 03:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jrYZy-0000cS-1B
 for xen-changelog@lists.xenproject.org; Sat, 04 Jul 2020 03:11:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/spec-ctrl: Protect against CALL/JMP straight-line
 speculation
Message-Id: <E1jrYZy-0000cS-1B@xenbits.xenproject.org>
Date: Sat, 04 Jul 2020 03:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 3b7dab93f2401b08c673244c9ae0f92e08bd03ba
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jul 1 12:39:59 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jul 1 17:01:24 2020 +0100

    x86/spec-ctrl: Protect against CALL/JMP straight-line speculation
    
    Some x86 CPUs speculatively execute beyond indirect CALL/JMP instructions.
    
    With CONFIG_INDIRECT_THUNK / Retpolines, indirect CALL/JMP instructions are
    converted to direct CALL/JMP's to __x86_indirect_thunk_REG(), leaving just a
    handful of indirect JMPs implementing those stubs.
    
    There is no architectrual execution beyond an indirect JMP, so use INT3 as
    recommended by vendors to halt speculative execution.  This is shorter than
    LFENCE (which would also work fine), but also shows up in logs if we do
    unexpected execute them.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/indirect-thunk.S | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/indirect-thunk.S b/xen/arch/x86/indirect-thunk.S
index 3c17f75c23..7392aee127 100644
--- a/xen/arch/x86/indirect-thunk.S
+++ b/xen/arch/x86/indirect-thunk.S
@@ -24,10 +24,12 @@
 .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
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jul 04 03:11:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 04 Jul 2020 03: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 1jrYa9-0005bI-CD; Sat, 04 Jul 2020 03:11:13 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=g8qt=AP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jrYa8-0005ak-NW
 for xen-changelog@lists.xenproject.org; Sat, 04 Jul 2020 03:11:12 +0000
X-Inumbo-ID: 03bc3cec-bda4-11ea-8aaa-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 03bc3cec-bda4-11ea-8aaa-12813bfff9fa;
 Sat, 04 Jul 2020 03:11:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=zeQUuLxDPY9CisGO08LjnGo9DStcjzk7pW9/ahmikvQ=; b=hyqYhOpwml1r/4YxeCe6v+TG7E
 5s3zcGOPx18uKPxfDPCUi4ROEgT4g3jLXuimrHlelCqt10YNZaWh/lgSGUDrnasWnX1ykadHdvZhu
 KeJRVYcKCoSd++N2tZTQ1FG5Mkf/7s/NelkGocBunQNxTmL1CATfKK19F7b1vl4Nz7ZQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jrYa8-0000XX-7m
 for xen-changelog@lists.xenproject.org; Sat, 04 Jul 2020 03:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jrYa8-0000dC-5z
 for xen-changelog@lists.xenproject.org; Sat, 04 Jul 2020 03:11:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] optee: immediately free buffers that are released by
 OP-TEE
Message-Id: <E1jrYa8-0000dC-5z@xenbits.xenproject.org>
Date: Sat, 04 Jul 2020 03:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 5b13eb1d978e9732fe2c9826b60885b687a5c4fc
Author:     Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
AuthorDate: Fri Jun 19 22:33:59 2020 +0000
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Wed Jul 1 10:09:38 2020 -0700

    optee: immediately free buffers that are released by OP-TEE
    
    Normal World can share a buffer with OP-TEE for two reasons:
    1. A client application wants to exchange data with TA
    2. OP-TEE asks for shared buffer for internal needs
    
    The second case was handled more strictly than necessary:
    
    1. In RPC request OP-TEE asks for buffer
    2. NW allocates buffer and provides it via RPC response
    3. Xen pins pages and translates data
    4. Xen provides buffer to OP-TEE
    5. OP-TEE uses it
    6. OP-TEE sends request to free the buffer
    7. NW frees the buffer and sends the RPC response
    8. Xen unpins pages and forgets about the buffer
    
    The problem is that Xen should forget about buffer in between stages 6
    and 7. I.e. the right flow should be like this:
    
    6. OP-TEE sends request to free the buffer
    7. Xen unpins pages and forgets about the buffer
    8. NW frees the buffer and sends the RPC response
    
    This is because OP-TEE internally frees the buffer before sending the
    "free SHM buffer" request. So we have no reason to hold reference for
    this buffer anymore. Moreover, in multiprocessor systems NW have time
    to reuse the buffer cookie for another buffer. Xen complained about this
    and denied the new buffer registration. I have seen this issue while
    running tests on iMX SoC.
    
    So, this patch basically corrects that behavior by freeing the buffer
    earlier, when handling RPC return from OP-TEE.
    
    Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/arm/tee/optee.c | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
index 6a035355db..780f37e527 100644
--- a/xen/arch/arm/tee/optee.c
+++ b/xen/arch/arm/tee/optee.c
@@ -1099,6 +1099,34 @@ static int handle_rpc_return(struct optee_domain *ctx,
         if ( shm_rpc->xen_arg->cmd == OPTEE_RPC_CMD_SHM_ALLOC )
             call->rpc_buffer_type = shm_rpc->xen_arg->params[0].u.value.a;
 
+        /*
+         * OP-TEE is signalling that it has freed the buffer that it
+         * requested before. This is the right time for us to do the
+         * same.
+         */
+        if ( shm_rpc->xen_arg->cmd == OPTEE_RPC_CMD_SHM_FREE )
+        {
+            uint64_t cookie = shm_rpc->xen_arg->params[0].u.value.b;
+
+            free_optee_shm_buf(ctx, cookie);
+
+            /*
+             * OP-TEE asks to free the buffer, but this is not the same
+             * buffer we previously allocated for it. While nothing
+             * prevents OP-TEE from asking this, it is the strange
+             * situation. This may or may not be caused by a bug in
+             * OP-TEE or mediator. But is better to print warning.
+             */
+            if ( call->rpc_data_cookie && call->rpc_data_cookie != cookie )
+            {
+                gprintk(XENLOG_ERR,
+                        "Saved RPC cookie does not corresponds to OP-TEE's (%"PRIx64" != %"PRIx64")\n",
+                        call->rpc_data_cookie, cookie);
+
+                WARN();
+            }
+            call->rpc_data_cookie = 0;
+        }
         unmap_domain_page(shm_rpc->xen_arg);
     }
 
@@ -1464,10 +1492,6 @@ static void handle_rpc_cmd(struct optee_domain *ctx, struct cpu_user_regs *regs,
             }
             break;
         case OPTEE_RPC_CMD_SHM_FREE:
-            free_optee_shm_buf(ctx, shm_rpc->xen_arg->params[0].u.value.b);
-            if ( call->rpc_data_cookie ==
-                 shm_rpc->xen_arg->params[0].u.value.b )
-                call->rpc_data_cookie = 0;
             break;
         default:
             break;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jul 04 03:11:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 04 Jul 2020 03:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jrYaK-0005ce-Dx; Sat, 04 Jul 2020 03:11:24 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=g8qt=AP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jrYaJ-0005cR-8s
 for xen-changelog@lists.xenproject.org; Sat, 04 Jul 2020 03:11:23 +0000
X-Inumbo-ID: 09beed6a-bda4-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 09beed6a-bda4-11ea-bca7-bc764e2007e4;
 Sat, 04 Jul 2020 03:11:22 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=dGUDD5Mk30OoTHmxdDkGMNHukKm2C7J45IAEoz4tAFU=; b=FZSvO6WLC5QKeJe3SyllGsbmvm
 VpCBmeSiogSMz7rdfdRlexDaz+i5zzJmhVlWJDnjjs75Oaqhi0mN4ipJanziUaxUshAJU/ZPJnpeq
 HpM8wRDQapXnrFc9YVKuIZijjZUXQffYXXcOskq1CVBPjLTYoAcgEdUiOP/7wutRnJXg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jrYaI-0000YN-Az
 for xen-changelog@lists.xenproject.org; Sat, 04 Jul 2020 03:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jrYaI-0000dt-9z
 for xen-changelog@lists.xenproject.org; Sat, 04 Jul 2020 03:11:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] optee: allow plain TMEM buffers with NULL address
Message-Id: <E1jrYaI-0000dt-9z@xenbits.xenproject.org>
Date: Sat, 04 Jul 2020 03:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 0dbed3ad3366734fd23ee3fd1f9989c8c96b6052
Author:     Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
AuthorDate: Fri Jun 19 22:34:01 2020 +0000
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Wed Jul 1 10:15:07 2020 -0700

    optee: allow plain TMEM buffers with NULL address
    
    Trusted Applications use a popular approach to determine the required
    size of a buffer: the client provides a memory reference with the NULL
    pointer to a buffer. This is so called "Null memory reference". TA
    updates the reference with the required size and returns it back to the
    client. Then the client allocates a buffer of the needed size and
    repeats the operation.
    
    This behavior is described in TEE Client API Specification, paragraph
    3.2.5. Memory References.
    
    OP-TEE represents this null memory reference as a TMEM parameter with
    buf_ptr = 0x0. This is the only case when we should allow a TMEM
    buffer without the OPTEE_MSG_ATTR_NONCONTIG flag. This also the
    special case for a buffer with OPTEE_MSG_ATTR_NONCONTIG flag.
    
    This could lead to a potential issue, because IPA 0x0 is a valid
    address, but OP-TEE will treat it as a special case. So, care should
    be taken when construction OP-TEE enabled guest to make sure that such
    guest have no memory at IPA 0x0 and none of its memory is mapped at PA
    0x0.
    
    Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/arm/tee/optee.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
index 780f37e527..8a39fe33b0 100644
--- a/xen/arch/arm/tee/optee.c
+++ b/xen/arch/arm/tee/optee.c
@@ -215,6 +215,15 @@ static bool optee_probe(void)
     return true;
 }
 
+/*
+ * TODO: There is a potential issue with guests that either have RAM
+ * at IPA of 0x0 or some of their memory is mapped at PA 0x0. This is
+ * because PA of 0x0 is considered as NULL pointer by OP-TEE. It will
+ * not be able to map buffer with such pointer to TA address space, or
+ * use such buffer for communication with the guest. We either need to
+ * check that guest have no such mappings or ensure that OP-TEE
+ * enabled guest will not be created with such mappings.
+ */
 static int optee_domain_init(struct domain *d)
 {
     struct arm_smccc_res resp;
@@ -725,6 +734,15 @@ static int translate_noncontig(struct optee_domain *ctx,
         uint64_t next_page_data;
     } *guest_data, *xen_data;
 
+    /*
+     * Special case: a buffer with buf_ptr == 0x0 is considered as a
+     * NULL pointer by OP-TEE. No translation is needed. This can lead
+     * to an issue as IPA 0x0 is a valid address for Xen. See the
+     * comment near optee_domain_init()
+     */
+    if ( !param->u.tmem.buf_ptr )
+        return 0;
+
     /* Offset of user buffer withing OPTEE_MSG_NONCONTIG_PAGE_SIZE-sized page */
     offset = param->u.tmem.buf_ptr & (OPTEE_MSG_NONCONTIG_PAGE_SIZE - 1);
 
@@ -865,9 +883,12 @@ static int translate_params(struct optee_domain *ctx,
             }
             else
             {
-                gdprintk(XENLOG_WARNING, "Guest tries to use old tmem arg\n");
-                ret = -EINVAL;
-                goto out;
+                if ( call->xen_arg->params[i].u.tmem.buf_ptr )
+                {
+                    gdprintk(XENLOG_WARNING, "Guest tries to use old tmem arg\n");
+                    ret = -EINVAL;
+                    goto out;
+                }
             }
             break;
         case OPTEE_MSG_ATTR_TYPE_NONE:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jul 04 03:11:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 04 Jul 2020 03: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 1jrYaU-0005do-Ff; Sat, 04 Jul 2020 03:11:34 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=g8qt=AP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jrYaT-0005de-CE
 for xen-changelog@lists.xenproject.org; Sat, 04 Jul 2020 03:11:33 +0000
X-Inumbo-ID: 0fca1de2-bda4-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 0fca1de2-bda4-11ea-8496-bc764e2007e4;
 Sat, 04 Jul 2020 03:11:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=L/eAfyGgxKM/5hUIMR95FMOpblImC1dJe7E1hAflJfg=; b=pawgDTu1tAZyVbLoZ2J9ahKTiv
 ukM5Y9HcM+5m+25Svams5zI2TOUPEyovEWzUtDgRuE6vXaX6dYfd1RF12MrE5NnkogeWinJs/rbHn
 MXAJyqk6d4hpTrLlgQmxun9n97M3Ud8I55NbeT1Neu2Yz+3if4pgE1a4hNOSgXYqrTgA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jrYaS-0000YZ-EY
 for xen-changelog@lists.xenproject.org; Sat, 04 Jul 2020 03:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jrYaS-0000ed-De
 for xen-changelog@lists.xenproject.org; Sat, 04 Jul 2020 03:11:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/tlb: fix assisted flush usage
Message-Id: <E1jrYaS-0000ed-De@xenbits.xenproject.org>
Date: Sat, 04 Jul 2020 03:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 5b718d24e88ceb2c28010c647836929b85b22b5d
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Thu Jul 2 11:05:53 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jul 2 11:09:33 2020 +0200

    x86/tlb: fix assisted flush usage
    
    Commit e9aca9470ed86 introduced a regression when avoiding sending
    IPIs for certain flush operations. Xen page fault handler
    (spurious_page_fault) relies on blocking interrupts in order to
    prevent handling TLB flush IPIs and thus preventing other CPUs from
    removing page tables pages. Switching to assisted flushing avoided such
    IPIs, and thus can result in pages belonging to the page tables being
    removed (and possibly re-used) while __page_fault_type is being
    executed.
    
    Force some of the TLB flushes to use IPIs, thus avoiding the assisted
    TLB flush. Those selected flushes are the page type change (when
    switching from a page table type to a different one, ie: a page that
    has been removed as a page table) and page allocation. This sadly has
    a negative performance impact on the pvshim, as less assisted flushes
    can be used. Note the flush in grant-table code is also switched to
    use an IPI even when not strictly needed. This is done so that a
    common arch_flush_tlb_mask can be introduced and always used in common
    code.
    
    Introduce a new flag (FLUSH_FORCE_IPI) and helper to force a TLB flush
    using an IPI (x86 only). Note that the flag is only meaningfully defined
    when the hypervisor supports PV or shadow paging mode, as otherwise
    hardware assisted paging domains are in charge of their page tables and
    won't share page tables with Xen, thus not influencing the result of
    page walks performed by the spurious fault handler.
    
    Just passing this new flag when calling flush_area_mask prevents the
    usage of the assisted flush without any other side effects.
    
    Note the flag is not defined on Arm.
    
    Fixes: e9aca9470ed86 ('x86/tlb: use Xen L0 assisted TLB flush when available')
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/arm/smp.c             |  2 +-
 xen/arch/x86/mm.c              | 12 +++++++++++-
 xen/common/grant_table.c       |  2 +-
 xen/include/asm-arm/flushtlb.h |  2 +-
 xen/include/asm-x86/flushtlb.h | 17 +++++++++++++++++
 xen/include/xen/mm.h           |  2 +-
 6 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/smp.c b/xen/arch/arm/smp.c
index ce1fcc8ef9..5823a69d3e 100644
--- a/xen/arch/arm/smp.c
+++ b/xen/arch/arm/smp.c
@@ -5,7 +5,7 @@
 #include <asm/gic.h>
 #include <asm/flushtlb.h>
 
-void flush_tlb_mask(const cpumask_t *mask)
+void arch_flush_tlb_mask(const cpumask_t *mask)
 {
     /* No need to IPI other processors on ARM, the processor takes care of it. */
     flush_all_guests_tlb();
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index e376fc7e8f..82bc676553 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -2894,7 +2894,17 @@ static int _get_page_type(struct page_info *page, unsigned long type,
                       ((nx & PGT_type_mask) == PGT_writable_page)) )
                 {
                     perfc_incr(need_flush_tlb_flush);
-                    flush_tlb_mask(mask);
+                    /*
+                     * If page was a page table make sure the flush is
+                     * performed using an IPI in order to avoid changing the
+                     * type of a page table page under the feet of
+                     * spurious_page_fault().
+                     */
+                    flush_mask(mask,
+                               (x & PGT_type_mask) &&
+                               (x & PGT_type_mask) <= PGT_root_page_table
+                               ? FLUSH_TLB | FLUSH_FORCE_IPI
+                               : FLUSH_TLB);
                 }
 
                 /* We lose existing type and validity. */
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index ece670e484..9f0cae52c0 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -393,7 +393,7 @@ static inline void grant_write_unlock(struct grant_table *gt)
 static inline void gnttab_flush_tlb(const struct domain *d)
 {
     if ( !paging_mode_external(d) )
-        flush_tlb_mask(d->dirty_cpumask);
+        arch_flush_tlb_mask(d->dirty_cpumask);
 }
 
 static inline unsigned int
diff --git a/xen/include/asm-arm/flushtlb.h b/xen/include/asm-arm/flushtlb.h
index ab1aae5c90..125a141975 100644
--- a/xen/include/asm-arm/flushtlb.h
+++ b/xen/include/asm-arm/flushtlb.h
@@ -26,7 +26,7 @@ static inline void page_set_tlbflush_timestamp(struct page_info *page)
 #endif
 
 /* Flush specified CPUs' TLBs */
-void flush_tlb_mask(const cpumask_t *mask);
+void arch_flush_tlb_mask(const cpumask_t *mask);
 
 /*
  * Flush a range of VA's hypervisor mappings from the TLB of the local
diff --git a/xen/include/asm-x86/flushtlb.h b/xen/include/asm-x86/flushtlb.h
index 8639427cce..0be2273387 100644
--- a/xen/include/asm-x86/flushtlb.h
+++ b/xen/include/asm-x86/flushtlb.h
@@ -126,6 +126,16 @@ void switch_cr3_cr4(unsigned long cr3, unsigned long cr4);
 #else
 #define FLUSH_HVM_ASID_CORE 0
 #endif
+#if defined(CONFIG_PV) || defined(CONFIG_SHADOW_PAGING)
+/*
+ * Force an IPI to be sent. Note that adding this to the flags passed to
+ * flush_area_mask will prevent using the assisted flush without having any
+ * other side effect.
+ */
+# define FLUSH_FORCE_IPI 0x8000
+#else
+# define FLUSH_FORCE_IPI 0
+#endif
 
 /* Flush local TLBs/caches. */
 unsigned int flush_area_local(const void *va, unsigned int flags);
@@ -151,6 +161,13 @@ void flush_area_mask(const cpumask_t *, const void *va, unsigned int flags);
 #define flush_tlb_one_mask(mask,v)              \
     flush_area_mask(mask, (const void *)(v), FLUSH_TLB|FLUSH_ORDER(0))
 
+/*
+ * Make the common code TLB flush helper force use of an IPI in order to be
+ * on the safe side. Note that not all calls from common code strictly require
+ * this.
+ */
+#define arch_flush_tlb_mask(mask) flush_mask(mask, FLUSH_TLB | FLUSH_FORCE_IPI)
+
 /* Flush all CPUs' TLBs */
 #define flush_tlb_all()                         \
     flush_tlb_mask(&cpu_online_map)
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index 9b62087be1..1061765bcd 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -648,7 +648,7 @@ static inline void filtered_flush_tlb_mask(uint32_t tlbflush_timestamp)
     if ( !cpumask_empty(&mask) )
     {
         perfc_incr(need_flush_tlb_flush);
-        flush_tlb_mask(&mask);
+        arch_flush_tlb_mask(&mask);
     }
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jul 04 03:11:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 04 Jul 2020 03:11:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jrYae-0005eg-HK; Sat, 04 Jul 2020 03:11:44 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=g8qt=AP=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jrYad-0005eW-9v
 for xen-changelog@lists.xenproject.org; Sat, 04 Jul 2020 03:11:43 +0000
X-Inumbo-ID: 15d0027e-bda4-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 15d0027e-bda4-11ea-bb8b-bc764e2007e4;
 Sat, 04 Jul 2020 03:11:42 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=vcQpuZdNiKh69gZJR4Ua0xbrxNRjZ5WmG3kImAokYp0=; b=mQ1tfBeqtIMlvClkOdDkxYf3je
 0+2cj4BaKMbn/b/mcP9wsWEkzl8KYBtj3bDy6h1qLFTzsOiNoKD8dNeBR8nHaPs6QYC85YgYiVuEi
 RIFTMGqX483BrzyuoynKtgG31Dykvylz1GiHIGBzkaT1wcYZRnOD/ZQ9XuSc+HvUFVbE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jrYac-0000Yl-Hz
 for xen-changelog@lists.xenproject.org; Sat, 04 Jul 2020 03:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jrYac-0000fP-Gi
 for xen-changelog@lists.xenproject.org; Sat, 04 Jul 2020 03:11:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] build: tweak variable exporting for make 3.82
Message-Id: <E1jrYac-0000fP-Gi@xenbits.xenproject.org>
Date: Sat, 04 Jul 2020 03:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit be63d9d47f571a60d70f8fb630c03871312d9655
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Jul 2 11:11:40 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jul 2 11:11:40 2020 +0200

    build: tweak variable exporting for make 3.82
    
    While I've been running into an issue here only because of an additional
    local change I'm carrying, to be able to override just the compiler in
    $(XEN_ROOT)/.config (rather than the whole tool chain), in
    config/StdGNU.mk:
    
    ifeq ($(filter-out default undefined,$(origin CC)),)
    
    I'd like to propose to nevertheless correct the underlying issue:
    Exporting an unset variable changes its origin from "undefined" to
    "file". This comes into effect because of our adding of -rR to
    MAKEFLAGS, which make 3.82 wrongly applies also upon re-invoking itself
    after having updated auto.conf{,.cmd}.
    
    Move the export statement past $(XEN_ROOT)/config/$(XEN_OS).mk inclusion
    (which happens through $(XEN_ROOT)/Config.mk) such that the variables
    already have their designated values at that point, while retaining
    their initial origin up to the point they get defined.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index 0ade7f9517..2f3f8b9deb 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -17,8 +17,6 @@ export XEN_BUILD_HOST	?= $(shell hostname)
 PYTHON_INTERPRETER	:= $(word 1,$(shell which python3 python python2 2>/dev/null) python)
 export PYTHON		?= $(PYTHON_INTERPRETER)
 
-export CC CXX LD
-
 export BASEDIR := $(CURDIR)
 export XEN_ROOT := $(BASEDIR)/..
 
@@ -42,6 +40,8 @@ export TARGET_ARCH     := $(shell echo $(XEN_TARGET_ARCH) | \
 # Allow someone to change their config file
 export KCONFIG_CONFIG ?= .config
 
+export CC CXX LD
+
 .PHONY: default
 default: build
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jul 06 08:55:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 06 Jul 2020 08: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 1jsMu2-0004b3-Kk; Mon, 06 Jul 2020 08:55:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=xB0m=AR=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsMu1-0004ay-Ft
 for xen-changelog@lists.xenproject.org; Mon, 06 Jul 2020 08:55:05 +0000
X-Inumbo-ID: 626517c8-bf66-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 626517c8-bf66-11ea-bca7-bc764e2007e4;
 Mon, 06 Jul 2020 08:55:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=MhwvzFn/KNwAuekQY4uM+jV+svvF43bY4O0KTzAsOkU=; b=oXIJJ0qyOA5tul0PutXEj7KIv8
 moNFicD6pTWqZ6iT4aaX/YoFnMufJnxa2QVzkRERB1oDqDoCf4rSkFpFndxBR3Y7Nl8rXypM4XG7x
 sAqBeGf3WMdcXsWFRSpVb+82YrcHhj6L1xTzTx44y1ojQRmaBOdgxqRnxDpWSLfVtKY4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsMu0-0001uZ-Ft
 for xen-changelog@lists.xenproject.org; Mon, 06 Jul 2020 08:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsMu0-0005LL-F0
 for xen-changelog@lists.xenproject.org; Mon, 06 Jul 2020 08:55:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] kdd: fix build again
Message-Id: <E1jsMu0-0005LL-F0@xenbits.xenproject.org>
Date: Mon, 06 Jul 2020 08:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit d44cbbe0f3243afcc56e47dcfa97bbfe23e46fbb
Author:     Wei Liu <wl@xen.org>
AuthorDate: Fri Jul 3 20:10:01 2020 +0000
Commit:     Wei Liu <wl@xen.org>
CommitDate: Mon Jul 6 08:38:03 2020 +0000

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

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


From xen-changelog-bounces@lists.xenproject.org Mon Jul 06 08:55:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 06 Jul 2020 08:55:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsMuB-0004bc-MP; Mon, 06 Jul 2020 08:55:15 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=xB0m=AR=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsMuB-0004bW-7z
 for xen-changelog@lists.xenproject.org; Mon, 06 Jul 2020 08:55:15 +0000
X-Inumbo-ID: 686535f4-bf66-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 686535f4-bf66-11ea-b7bb-bc764e2007e4;
 Mon, 06 Jul 2020 08:55:14 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=SWr1/F6TAfjfIqtASh3tKMh9WVN0rmHU/1xMaulnU04=; b=xQ6Ht+6Tu+QJYpsxxpVBUHXO3G
 cEkbNI4J6Cs+ZK+A/VCX7NhBitJwamRCjPBfnZF7ZD4yKcvAieQFG20J098iHLmHIe6CDgrLL+D5a
 qIiS33SXM+0WB/Ag0PrgncYiWb89Vi8WluNU8By9iHHyKhR4DYiR1reRjucI/szfqCqU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsMuA-0001uf-Ji
 for xen-changelog@lists.xenproject.org; Mon, 06 Jul 2020 08:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsMuA-0005M4-Hx
 for xen-changelog@lists.xenproject.org; Mon, 06 Jul 2020 08:55:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] Config: Update QEMU
Message-Id: <E1jsMuA-0005M4-Hx@xenbits.xenproject.org>
Date: Mon, 06 Jul 2020 08:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 158912a532fe98f448c688d3571241c9033553bd
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Jul 3 14:55:33 2020 +0100
Commit:     Wei Liu <wl@xen.org>
CommitDate: Mon Jul 6 08:38:45 2020 +0000

    Config: Update QEMU
    
    Backport 2 commits to fix building QEMU without PCI passthrough
    support.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index f7d10b7c4c..478928c178 100644
--- a/Config.mk
+++ b/Config.mk
@@ -245,7 +245,7 @@ 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 ?= 410cc30fdc590417ae730d635bbc70257adf6750
+QEMU_UPSTREAM_REVISION ?= ea6d3cd1ed79d824e605a70c3626bc437c386260
 MINIOS_UPSTREAM_REVISION ?= f57858b7e8ef8dd48394dd08cec2bef3c9fb92f5
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.13.0
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jul 06 18:22:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 06 Jul 2020 18:22:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsVkm-0005MD-6k; Mon, 06 Jul 2020 18:22:08 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=xB0m=AR=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsVkl-0005M8-27
 for xen-changelog@lists.xenproject.org; Mon, 06 Jul 2020 18:22:07 +0000
X-Inumbo-ID: 97d1e392-bfb5-11ea-8cbf-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 97d1e392-bfb5-11ea-8cbf-12813bfff9fa;
 Mon, 06 Jul 2020 18:22:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=u90OM9WaIvAaGfo3AaNpR0mw+nKFmeCFCCqpNqiwIRI=; b=EsSS/FdkMGHDQ3i7qp/RgFQM20
 8nKKI6kOURPthUNXuuSVXZ31e64MIwe9OtfvLAUnbi7NCJ70QqoqE9mlTphLXKXIaG3MSRvi65RWC
 G9k1QpWryS7eYBYrI6A41wc+SyIKNiqAFA/sQT88eQh0XP6eYo1hcplXjnvF7r4bJMbk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsVki-0004jb-EB
 for xen-changelog@lists.xenproject.org; Mon, 06 Jul 2020 18:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsVki-0008I8-CY
 for xen-changelog@lists.xenproject.org; Mon, 06 Jul 2020 18:22:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86emul: fix FXRSTOR test for most AMD CPUs
Message-Id: <E1jsVki-0008I8-CY@xenbits.xenproject.org>
Date: Mon, 06 Jul 2020 18:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit f97f99c8d88ebc108f6adc3ba74e87d53ba57c70
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jul 6 17:14:24 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Mon Jul 6 18:12:22 2020 +0000

    x86emul: fix FXRSTOR test for most AMD CPUs
    
    AMD CPUs that we classify as X86_BUG_FPU_PTRS don't touch the selector/
    offset portion of the save image during FXSAVE unless an unmasked
    exception is pending. Hence the selector zapping done between the
    initial FXSAVE and the emulated FXRSTOR needs to be mirrored onto the
    second FXSAVE, output of which gets fed into memcmp() to compare with
    the input image.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/tests/x86_emulator/test_x86_emulator.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index e7de37eaef..4b01fa8b8d 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -2577,6 +2577,7 @@ int main(int argc, char **argv)
         regs.ecx = (unsigned long)(res + 0x81);
         rc = x86_emulate(&ctxt, &emulops);
         asm volatile ( "fxsave %0" : "=m" (res[0x100]) :: "memory" );
+        zap_xfpsel(&res[0x100]);
         if ( (rc != X86EMUL_OKAY) ||
              memcmp(res + 0x100, res + 0x80, 0x200) ||
              (regs.eip != (unsigned long)&instr[4]) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 12:55:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 12:55: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 1jsn7q-0003Ch-6x; Tue, 07 Jul 2020 12:55:06 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsn7p-0003Ca-AV
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:55:05 +0000
X-Inumbo-ID: 1251468a-c051-11ea-8d65-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 1251468a-c051-11ea-8d65-12813bfff9fa;
 Tue, 07 Jul 2020 12:55:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=5XfZqmzvQyyxImyj4Gdg01bpDFQ/6qRKdlzzlWfIccw=; b=prvtzhhGJ5rmZa2S4CWi2HdpYx
 id11jX8N9hbqocHvtd2TWe6hsYJ3kIElp4rY5yFhOHWQwrt3xAbSyqkZQMWVZ7vY9RcF4KjxRbQGk
 I8veLX0kJDrnJ5fDW810B9Sda3b+vRPCKlBYiu8SfJ28QnJmtp2uyjJe3psEdffw5VLA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn7l-0003Uk-UL
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn7l-00006u-SL
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:55:01 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] kdd: fix build again
Message-Id: <E1jsn7l-00006u-SL@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 12:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit d44cbbe0f3243afcc56e47dcfa97bbfe23e46fbb
Author:     Wei Liu <wl@xen.org>
AuthorDate: Fri Jul 3 20:10:01 2020 +0000
Commit:     Wei Liu <wl@xen.org>
CommitDate: Mon Jul 6 08:38:03 2020 +0000

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

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


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 12:55:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 12: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 1jsn7y-0003Db-8h; Tue, 07 Jul 2020 12:55:14 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsn7x-0003DT-Df
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:55:13 +0000
X-Inumbo-ID: 184dbd5c-c051-11ea-8d65-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 184dbd5c-c051-11ea-8d65-12813bfff9fa;
 Tue, 07 Jul 2020 12:55:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=pP4+qMuswU1Xy4v//4jhlttgLd1+H8NY+K1dGK1nI78=; b=OT4JAQbe/t/2IJfXOoXDYQ2Icg
 LFLJRe90bt5QKXggAuKTn67/Bbw6pJeql0kJQlGfJPaBYQd11FdjH8htJB9f7m2MFGDpCvyBeVgQx
 8ADdMH5Wqye/FOADN54oexK0i8ojEAKvAa3mjxOvKb5XNok+32Z6RlW9kG5MGJV0SsVY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn7w-0003Uq-0s
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn7w-00007v-07
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:55:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] Config: Update QEMU
Message-Id: <E1jsn7w-00007v-07@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 12:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 158912a532fe98f448c688d3571241c9033553bd
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Jul 3 14:55:33 2020 +0100
Commit:     Wei Liu <wl@xen.org>
CommitDate: Mon Jul 6 08:38:45 2020 +0000

    Config: Update QEMU
    
    Backport 2 commits to fix building QEMU without PCI passthrough
    support.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index f7d10b7c4c..478928c178 100644
--- a/Config.mk
+++ b/Config.mk
@@ -245,7 +245,7 @@ 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 ?= 410cc30fdc590417ae730d635bbc70257adf6750
+QEMU_UPSTREAM_REVISION ?= ea6d3cd1ed79d824e605a70c3626bc437c386260
 MINIOS_UPSTREAM_REVISION ?= f57858b7e8ef8dd48394dd08cec2bef3c9fb92f5
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.13.0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 12:55:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 12: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 1jsn88-0003FX-Ab; Tue, 07 Jul 2020 12:55:24 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsn87-0003FK-8s
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:55:23 +0000
X-Inumbo-ID: 1e579114-c051-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 1e579114-c051-11ea-bca7-bc764e2007e4;
 Tue, 07 Jul 2020 12:55:22 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=zNIhmcJP1fu3X6UbecPeY4gcEr6XntdEFqJU6pKZEbA=; b=VK+PrBs/1F7NCX+8zntn7q+2HM
 iPf8Hd9DwS04Pkx6W68x6X/dhGkyLNRNTfEHMXw04n6sag5M5f0MW8wCKnKtSP3a47mJr68QkRNM3
 wG3/j2M3WnnIePxR2lO9Kvc40ye/tlTPqydKKpr6vhEdRASp//HnpXowTs8/ZYva1M9E=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn86-0003V6-3x
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn86-00008b-3A
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:55:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86emul: fix FXRSTOR test for most AMD CPUs
Message-Id: <E1jsn86-00008b-3A@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 12:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit f97f99c8d88ebc108f6adc3ba74e87d53ba57c70
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Jul 6 17:14:24 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Mon Jul 6 18:12:22 2020 +0000

    x86emul: fix FXRSTOR test for most AMD CPUs
    
    AMD CPUs that we classify as X86_BUG_FPU_PTRS don't touch the selector/
    offset portion of the save image during FXSAVE unless an unmasked
    exception is pending. Hence the selector zapping done between the
    initial FXSAVE and the emulated FXRSTOR needs to be mirrored onto the
    second FXSAVE, output of which gets fed into memcmp() to compare with
    the input image.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 tools/tests/x86_emulator/test_x86_emulator.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index e7de37eaef..4b01fa8b8d 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -2577,6 +2577,7 @@ int main(int argc, char **argv)
         regs.ecx = (unsigned long)(res + 0x81);
         rc = x86_emulate(&ctxt, &emulops);
         asm volatile ( "fxsave %0" : "=m" (res[0x100]) :: "memory" );
+        zap_xfpsel(&res[0x100]);
         if ( (rc != X86EMUL_OKAY) ||
              memcmp(res + 0x100, res + 0x80, 0x200) ||
              (regs.eip != (unsigned long)&instr[4]) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 12:55:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 12: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 1jsn8L-0003Gw-CF; Tue, 07 Jul 2020 12:55:37 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsn8K-0003Gp-Oh
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:55:36 +0000
X-Inumbo-ID: 25b88685-c051-11ea-8d65-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 25b88685-c051-11ea-8d65-12813bfff9fa;
 Tue, 07 Jul 2020 12:55:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=n22rVFlbCRi5ayjOsonpo57Jtha00vtWT3KYJgsM7nk=; b=QkLS+zbAiJNNsQFXoH3FPpKrl1
 VySKTe55nadMnCq9kkiQ4RLVm/zPEqTM4BqgNWvWpmtfJ8dTCf6QfBJSO3/ornmZnhtkY96QjhJzH
 gvFdqdf9sf2kSKNrIfwGaDE3FC4AcniwgQo5dFSbMv5pyhukg0HdqJb1On78/2Rz6Fk4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn8J-0003Vs-Ie
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:55:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn8J-0000Iy-Hw
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:55:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] xen/common: event_channel: Don't ignore error in
 get_free_port()
Message-Id: <E1jsn8J-0000Iy-Hw@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 12:55:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 2e9c2bc292231823a3a021d2e0a9f1956bf00b3c
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Mar 19 13:17:31 2020 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:35:36 2020 +0200

    xen/common: event_channel: Don't ignore error in get_free_port()
    
    Currently, get_free_port() is assuming that the port has been allocated
    when evtchn_allocate_port() is not return -EBUSY.
    
    However, the function may return an error when:
        - We exhausted all the event channels. This can happen if the limit
        configured by the administrator for the guest ('max_event_channels'
        in xl cfg) is higher than the ABI used by the guest. For instance,
        if the guest is using 2L, the limit should not be higher than 4095.
        - We cannot allocate memory (e.g Xen has not more memory).
    
    Users of get_free_port() (such as EVTCHNOP_alloc_unbound) will validly
    assuming the port was valid and will next call evtchn_from_port(). This
    will result to a crash as the memory backing the event channel structure
    is not present.
    
    Fixes: 368ae9a05fe ("xen/pvshim: forward evtchn ops between L0 Xen and L2 DomU")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/event_channel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index e86e2bfab0..a8d182b584 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -195,10 +195,10 @@ static int get_free_port(struct domain *d)
     {
         int rc = evtchn_allocate_port(d, port);
 
-        if ( rc == -EBUSY )
-            continue;
-
-        return port;
+        if ( rc == 0 )
+            return port;
+        else if ( rc != -EBUSY )
+            return rc;
     }
 
     return -ENOSPC;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 12:55:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 12:55:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsn8V-0003IT-Dk; Tue, 07 Jul 2020 12:55:47 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsn8U-0003IB-A5
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:55:46 +0000
X-Inumbo-ID: 2c631e90-c051-11ea-8d65-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 2c631e90-c051-11ea-8d65-12813bfff9fa;
 Tue, 07 Jul 2020 12:55:45 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Smkqyp1S6zHqNBvC0oHS8l14NrJH5sRm2sc3GCqMf9s=; b=JvBYASpfoAd22LHSD57KCtuMKN
 ea5vr59/u5Wllwydo+K96K5BrH9psZWZvX+a9Z0nQHD0EurCax5qhBHiTsR05mdsTipoVU3uBOhUw
 Cpk2ktTygj2uu+Cgwy5XVGWylXGQgv3PGU0YhoHv35ozfA4JwUQmyhbbiDlAhjLhv9dg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn8T-0003Ws-Mb
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:55:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn8T-0000KX-Kx
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:55:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/shadow: correct an inverted conditional in dirty
 VRAM tracking
Message-Id: <E1jsn8T-0000KX-Kx@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 12:55:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 23a216f99d40fbfbc2318ade89d8213eea6ba1f8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 14:36:24 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:36:24 2020 +0200

    x86/shadow: correct an inverted conditional in dirty VRAM tracking
    
    This originally was "mfn_x(mfn) == INVALID_MFN". Make it like this
    again, taking the opportunity to also drop the unnecessary nearby
    braces.
    
    This is XSA-319.
    
    Fixes: 246a5a3377c2 ("xen: Use a typesafe to define INVALID_MFN")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 5fcb04ce8b..773777321f 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3253,10 +3253,8 @@ int shadow_track_dirty_vram(struct domain *d,
             int dirty = 0;
             paddr_t sl1ma = dirty_vram->sl1ma[i];
 
-            if ( !mfn_eq(mfn, INVALID_MFN) )
-            {
+            if ( mfn_eq(mfn, INVALID_MFN) )
                 dirty = 1;
-            }
             else
             {
                 page = mfn_to_page(mfn);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 12:56:01 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 12: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 1jsn8j-0003K2-FP; Tue, 07 Jul 2020 12:56:01 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsn8i-0003Jt-HS
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:00 +0000
X-Inumbo-ID: 31bcf885-c051-11ea-8d65-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 31bcf885-c051-11ea-8d65-12813bfff9fa;
 Tue, 07 Jul 2020 12:55:55 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=E/B6M9YUjfvBvrUOEZQjRI4HHqEqV51aqfOZkyUt2Uw=; b=OPNU6qIq7v1g+Xwbk3P/EH5xZA
 3RQO7hQVEy4DoPf2HzXbQM9nL+K+x4JZQ7G1vAw62mjP+j5vwXzVsIOdDHqVhnFT+t6BPdDkI/+XT
 7oo6z9gSEJjYDTrTwvlS1tMjuwo7QkGOPZthDsSV6m8k2oWvO7rEoJnE5WqODRygX5TQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn8d-0003X3-Q2
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:55:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn8d-0000Lf-Oo
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:55:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/EPT: ept_set_middle_entry() related adjustments
Message-Id: <E1jsn8d-0000Lf-Oo@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 12:55:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 1104288186ee73a7f9bfa41cbaa5bb7611521028
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 14:36:52 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:36:52 2020 +0200

    x86/EPT: ept_set_middle_entry() related adjustments
    
    ept_split_super_page() wants to further modify the newly allocated
    table, so have ept_set_middle_entry() return the mapped pointer rather
    than tearing it down and then getting re-established right again.
    
    Similarly ept_next_level() wants to hand back a mapped pointer of
    the next level page, so re-use the one established by
    ept_set_middle_entry() in case that path was taken.
    
    Pull the setting of suppress_ve ahead of insertion into the higher level
    table, and don't have ept_split_super_page() set the field a 2nd time.
    
    This is part of XSA-328.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m-ept.c | 41 ++++++++++++++++++-----------------------
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 293f3e9419..d9913a6c97 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -186,8 +186,9 @@ static void ept_p2m_type_to_flags(const struct p2m_domain *p2m,
 #define GUEST_TABLE_SUPER_PAGE  2
 #define GUEST_TABLE_POD_PAGE    3
 
-/* Fill in middle levels of ept table */
-static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
+/* Fill in middle level of ept table; return pointer to mapped new table. */
+static ept_entry_t *ept_set_middle_entry(struct p2m_domain *p2m,
+                                         ept_entry_t *ept_entry)
 {
     mfn_t mfn;
     ept_entry_t *table;
@@ -195,7 +196,12 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     mfn = p2m_alloc_ptp(p2m, 0);
     if ( mfn_eq(mfn, INVALID_MFN) )
-        return 0;
+        return NULL;
+
+    table = map_domain_page(mfn);
+
+    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
+        table[i].suppress_ve = 1;
 
     ept_entry->epte = 0;
     ept_entry->mfn = mfn_x(mfn);
@@ -207,14 +213,7 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     ept_entry->suppress_ve = 1;
 
-    table = map_domain_page(mfn);
-
-    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
-        table[i].suppress_ve = 1;
-
-    unmap_domain_page(table);
-
-    return 1;
+    return table;
 }
 
 /* free ept sub tree behind an entry */
@@ -252,10 +251,10 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
 
     ASSERT(is_epte_superpage(ept_entry));
 
-    if ( !ept_set_middle_entry(p2m, &new_ept) )
+    table = ept_set_middle_entry(p2m, &new_ept);
+    if ( !table )
         return 0;
 
-    table = map_domain_page(_mfn(new_ept.mfn));
     trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER);
 
     for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
@@ -266,7 +265,6 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
         epte->sp = (level > 1);
         epte->mfn += i * trunk;
         epte->snp = is_iommu_enabled(p2m->domain) && iommu_snoop;
-        epte->suppress_ve = 1;
 
         ept_p2m_type_to_flags(p2m, epte);
 
@@ -305,8 +303,7 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
                           ept_entry_t **table, unsigned long *gfn_remainder,
                           int next_level)
 {
-    unsigned long mfn;
-    ept_entry_t *ept_entry, e;
+    ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
     shift = next_level * EPT_TABLE_ORDER;
@@ -331,19 +328,17 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        if ( !ept_set_middle_entry(p2m, ept_entry) )
+        next = ept_set_middle_entry(p2m, ept_entry);
+        if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        else
-            e = atomic_read_ept_entry(ept_entry); /* Refresh */
+        /* e is now stale and hence may not be used anymore below. */
     }
-
     /* The only time sp would be set here is if we had hit a superpage */
-    if ( is_epte_superpage(&e) )
+    else if ( is_epte_superpage(&e) )
         return GUEST_TABLE_SUPER_PAGE;
 
-    mfn = e.mfn;
     unmap_domain_page(*table);
-    *table = map_domain_page(_mfn(mfn));
+    *table = next ?: map_domain_page(_mfn(e.mfn));
     *gfn_remainder &= (1UL << shift) - 1;
     return GUEST_TABLE_NORMAL_PAGE;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 12:56:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 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 1jsn8p-0003Ku-H7; Tue, 07 Jul 2020 12:56:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsn8o-0003Km-Go
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:06 +0000
X-Inumbo-ID: 386b73ae-c051-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 386b73ae-c051-11ea-b7bb-bc764e2007e4;
 Tue, 07 Jul 2020 12:56:06 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=mG7fYzmnN/bC6u3WzNKVpQN7ghBr2j2QzH9sACkcmxg=; b=5wEZnzLJiJsl30qR1Z+fY8jO6h
 sQTU8Z8R3VUASyCM27cqd8ee6hoHf1wioqWkITw+If6ewzcsbBuGKNkiosyCyT2c26myRrMUVecw7
 7KHOt5JMx0uhYb7LCpfxnxXvoHOoAF7J/tE0VbOT9IMJo9o3PAWxZiDAAej8F4nuoI/Y=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn8n-0003XM-TH
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn8n-0000Mm-SJ
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/ept: atomically modify entries in ept_next_level
Message-Id: <E1jsn8n-0000Mm-SJ@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 12:56:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit bc3d9f95d661372b059a5539ae6cb1e79435bb95
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 14:37:12 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:37:12 2020 +0200

    x86/ept: atomically modify entries in ept_next_level
    
    ept_next_level was passing a live PTE pointer to ept_set_middle_entry,
    which was then modified without taking into account that the PTE could
    be part of a live EPT table. This wasn't a security issue because the
    pages returned by p2m_alloc_ptp are zeroed, so adding such an entry
    before actually initializing it didn't allow a guest to access
    physical memory addresses it wasn't supposed to access.
    
    This is part of XSA-328.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/p2m-ept.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index d9913a6c97..87a14f6f22 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -306,6 +306,8 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
     ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
+    ASSERT(next_level);
+
     shift = next_level * EPT_TABLE_ORDER;
 
     index = *gfn_remainder >> shift;
@@ -322,16 +324,20 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
 
     if ( !is_epte_present(&e) )
     {
+        int rc;
+
         if ( e.sa_p2mt == p2m_populate_on_demand )
             return GUEST_TABLE_POD_PAGE;
 
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        next = ept_set_middle_entry(p2m, ept_entry);
+        next = ept_set_middle_entry(p2m, &e);
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        /* e is now stale and hence may not be used anymore below. */
+
+        rc = atomic_write_ept_entry(p2m, ept_entry, e, next_level);
+        ASSERT(rc == 0);
     }
     /* The only time sp would be set here is if we had hit a superpage */
     else if ( is_epte_superpage(&e) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 12:56:19 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 12:56: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 1jsn91-0003Mt-KW; Tue, 07 Jul 2020 12:56:19 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsn90-0003Mm-TJ
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:18 +0000
X-Inumbo-ID: 3e76285c-c051-11ea-8d65-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3e76285c-c051-11ea-8d65-12813bfff9fa;
 Tue, 07 Jul 2020 12:56:16 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=pmRHGknB3Fxf0mlDIjYeR17wozXpkipjnK56LD02Vi0=; b=MtK7qKnFeS2oocX2/12REv89JT
 BdKvYLR1g6EL9qJC+MBXoT7kOVvT5CxobJq3FZ+78Pzk4NwxELOTHxd5oZKOSU1bFsGsxo53Hb0RR
 qkBlSF4UtXVaFC383Xbv7qM9zCocUoelDDp8eN2WJSSLLwadCz586DEy7DYk+2ZYLIPU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn8y-0003XW-02
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn8x-0000NT-VX
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] vtd: improve IOMMU TLB flush
Message-Id: <E1jsn8x-0000NT-VX@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 12:56:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 5fe515a0fede07543f2a3b049167b1fd8b873caf
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 14:37:46 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:37:46 2020 +0200

    vtd: improve IOMMU TLB flush
    
    Do not limit PSI flushes to order 0 pages, in order to avoid doing a
    full TLB flush if the passed in page has an order greater than 0 and
    is aligned. Should increase the performance of IOMMU TLB flushes when
    dealing with page orders greater than 0.
    
    This is part of XSA-321.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 208b33c0e4..dcc9b7a35e 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -576,13 +576,14 @@ static int __must_check iommu_flush_iotlb(struct domain *d, dfn_t dfn,
         if ( iommu_domid == -1 )
             continue;
 
-        if ( page_count != 1 || dfn_eq(dfn, INVALID_DFN) )
+        if ( !page_count || (page_count & (page_count - 1)) ||
+             dfn_eq(dfn, INVALID_DFN) || !IS_ALIGNED(dfn_x(dfn), page_count) )
             rc = iommu_flush_iotlb_dsi(iommu, iommu_domid,
                                        0, flush_dev_iotlb);
         else
             rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
                                        dfn_to_daddr(dfn),
-                                       PAGE_ORDER_4K,
+                                       get_order_from_pages(page_count),
                                        !dma_old_pte_present,
                                        flush_dev_iotlb);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 12:56:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 12:56: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 1jsn9A-0003Op-MF; Tue, 07 Jul 2020 12:56:28 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsn99-0003Od-Du
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:27 +0000
X-Inumbo-ID: 447492b6-c051-11ea-8d65-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 447492b6-c051-11ea-8d65-12813bfff9fa;
 Tue, 07 Jul 2020 12:56:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=S0sxz4WWHJtF8EMDNINZh61dpuJrSDTM9p2m4jWbvz8=; b=eMUGYcAcgHk0poc7fkxbF/GSE4
 yrmx28oN+QSRMsCFLpkOJn9OG4/WCepFwQWB3Rkv70XSwQqUxjQzV/pmTauvtBTG1pjy/nNukjeRR
 /HtDSPbQHuqiVdFNHfCM4s8vgL2i+PUvKncxum4+rWs6fk0leY/RLF4tEG5VylP+rUKE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn98-0003Xd-3G
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn98-0000OE-2a
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] vtd: prune (and rename) cache flush functions
Message-Id: <E1jsn98-0000OE-2a@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 12:56:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 62298825b9a44f45761acbd758138b5ba059ebd1
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 14:38:13 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:38:13 2020 +0200

    vtd: prune (and rename) cache flush functions
    
    Rename __iommu_flush_cache to iommu_sync_cache and remove
    iommu_flush_cache_page. Also remove the iommu_flush_cache_entry
    wrapper and just use iommu_sync_cache instead. Note the _entry suffix
    was meaningless as the wrapper was already taking a size parameter in
    bytes. While there also constify the addr parameter.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/vtd/extern.h   |  3 +--
 xen/drivers/passthrough/vtd/intremap.c |  6 +++---
 xen/drivers/passthrough/vtd/iommu.c    | 33 ++++++++++++---------------------
 3 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 994d360e90..52b5e1c60d 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -43,8 +43,7 @@ void disable_qinval(struct vtd_iommu *iommu);
 int enable_intremap(struct vtd_iommu *iommu, int eim);
 void disable_intremap(struct vtd_iommu *iommu);
 
-void iommu_flush_cache_entry(void *addr, unsigned int size);
-void iommu_flush_cache_page(void *addr, unsigned long npages);
+void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index bf846195c4..a2f02c1bea 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -230,7 +230,7 @@ static void free_remap_entry(struct vtd_iommu *iommu, int index)
                      iremap_entries, iremap_entry);
 
     update_irte(iommu, iremap_entry, &new_ire, false);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -406,7 +406,7 @@ static int ioapic_rte_to_remap_entry(struct vtd_iommu *iommu,
     }
 
     update_irte(iommu, iremap_entry, &new_ire, !init);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -695,7 +695,7 @@ static int msi_msg_to_remap_entry(
     update_irte(iommu, iremap_entry, &new_ire, msi_desc->irte_initialized);
     msi_desc->irte_initialized = true;
 
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index dcc9b7a35e..55eb140033 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -146,7 +146,8 @@ static int context_get_domain_id(struct context_entry *context,
 }
 
 static int iommus_incoherent;
-static void __iommu_flush_cache(void *addr, unsigned int size)
+
+void iommu_sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -161,16 +162,6 @@ static void __iommu_flush_cache(void *addr, unsigned int size)
         cacheline_flush((char *)addr + i);
 }
 
-void iommu_flush_cache_entry(void *addr, unsigned int size)
-{
-    __iommu_flush_cache(addr, size);
-}
-
-void iommu_flush_cache_page(void *addr, unsigned long npages)
-{
-    __iommu_flush_cache(addr, PAGE_SIZE * npages);
-}
-
 /* Allocate page table, return its machine address */
 uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
 {
@@ -189,7 +180,7 @@ uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_flush_cache_page(vaddr, 1);
+        iommu_sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -222,7 +213,7 @@ static u64 bus_to_context_maddr(struct vtd_iommu *iommu, u8 bus)
         }
         set_root_value(*root, maddr);
         set_root_present(*root);
-        iommu_flush_cache_entry(root, sizeof(struct root_entry));
+        iommu_sync_cache(root, sizeof(struct root_entry));
     }
     maddr = (u64) get_context_addr(*root);
     unmap_vtd_domain_page(root_entries);
@@ -269,7 +260,7 @@ static u64 addr_to_dma_page_maddr(struct domain *domain, u64 addr, int alloc)
              */
             dma_set_pte_readable(*pte);
             dma_set_pte_writable(*pte);
-            iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+            iommu_sync_cache(pte, sizeof(struct dma_pte));
         }
 
         if ( level == 2 )
@@ -645,7 +636,7 @@ static void dma_pte_clear_one(struct domain *domain, uint64_t addr,
     *flush_flags |= IOMMU_FLUSHF_modified;
 
     spin_unlock(&hd->arch.mapping_lock);
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     unmap_vtd_domain_page(page);
 }
@@ -682,7 +673,7 @@ static void iommu_free_page_table(struct page_info *pg)
             iommu_free_pagetable(dma_pte_addr(*pte), next_level);
 
         dma_clear_pte(*pte);
-        iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+        iommu_sync_cache(pte, sizeof(struct dma_pte));
     }
 
     unmap_vtd_domain_page(pt_vaddr);
@@ -1401,7 +1392,7 @@ int domain_context_mapping_one(
     context_set_address_width(*context, agaw);
     context_set_fault_enable(*context);
     context_set_present(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
     spin_unlock(&iommu->lock);
 
     /* Context entry was previously non-present (with domid 0). */
@@ -1565,7 +1556,7 @@ int domain_context_unmap_one(
 
     context_clear_present(*context);
     context_clear_entry(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
 
     iommu_domid= domain_iommu_domid(domain, iommu);
     if ( iommu_domid == -1 )
@@ -1792,7 +1783,7 @@ static int __must_check intel_iommu_map_page(struct domain *d, dfn_t dfn,
 
     *pte = new;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
     spin_unlock(&hd->arch.mapping_lock);
     unmap_vtd_domain_page(page);
 
@@ -1869,7 +1860,7 @@ int iommu_pte_flush(struct domain *d, uint64_t dfn, uint64_t *pte,
     int iommu_domid;
     int rc = 0;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     for_each_drhd_unit ( drhd )
     {
@@ -2739,7 +2730,7 @@ static int __init intel_iommu_quarantine_init(struct domain *d)
             dma_set_pte_addr(*pte, maddr);
             dma_set_pte_readable(*pte);
         }
-        iommu_flush_cache_page(parent, 1);
+        iommu_sync_cache(parent, PAGE_SIZE);
 
         unmap_vtd_domain_page(parent);
         parent = map_vtd_domain_page(maddr);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 12:56:38 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 12:56: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 1jsn9K-0003Q0-O4; Tue, 07 Jul 2020 12:56:38 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsn9J-0003Pm-MO
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:37 +0000
X-Inumbo-ID: 4a7c1dfa-c051-11ea-8d65-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 4a7c1dfa-c051-11ea-8d65-12813bfff9fa;
 Tue, 07 Jul 2020 12:56:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=cmwMLh0xvlk7EtMu+ZVF2TGxPWb7LSFHrJjRrPcqxhw=; b=b3PQzK0eIlTv3+x2gBPQ+tgG0J
 vk4j0gVQVewhKH5wMiFJRf7drqxTSt7jQXh/2BNge8xp/mkHED74KlJQd7JMewkPvTn9opeDfCcFu
 tezvTasX4lFmdc1h3aTac25sgbXJFIhqnXKsc4g0GLDBP+6m8s3bNyFDrrkxlxlJeuKk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn9I-0003YB-6M
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn9I-0000Os-5W
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:36 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/iommu: introduce a cache sync hook
Message-Id: <E1jsn9I-0000Os-5W@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 12:56:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 91526b460e5009fc56edbd6809e66c327281faba
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 14:38:34 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:38:34 2020 +0200

    x86/iommu: introduce a cache sync hook
    
    The hook is only implemented for VT-d and it uses the already existing
    iommu_sync_cache function present in VT-d code. The new hook is
    added so that the cache can be flushed by code outside of VT-d when
    using shared page tables.
    
    Note that alloc_pgtable_maddr must use the now locally defined
    sync_cache function, because IOMMU ops are not yet setup the first
    time the function gets called during IOMMU initialization.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/vtd/extern.h | 1 -
 xen/drivers/passthrough/vtd/iommu.c  | 5 +++--
 xen/include/asm-x86/iommu.h          | 7 +++++++
 xen/include/xen/iommu.h              | 1 +
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 52b5e1c60d..f15947af1f 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -43,7 +43,6 @@ void disable_qinval(struct vtd_iommu *iommu);
 int enable_intremap(struct vtd_iommu *iommu, int eim);
 void disable_intremap(struct vtd_iommu *iommu);
 
-void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 55eb140033..93bcd72f84 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -147,7 +147,7 @@ static int context_get_domain_id(struct context_entry *context,
 
 static int iommus_incoherent;
 
-void iommu_sync_cache(const void *addr, unsigned int size)
+static void sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -180,7 +180,7 @@ uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_sync_cache(vaddr, PAGE_SIZE);
+        sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -2778,6 +2778,7 @@ const struct iommu_ops __initconstrel intel_iommu_ops = {
     .iotlb_flush_all = iommu_flush_iotlb_all,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_p2m_table = vtd_dump_p2m_table,
+    .sync_cache = sync_cache,
 };
 
 const struct iommu_init_ops __initconstrel intel_iommu_init_ops = {
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 85741f7c96..864e025078 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -121,6 +121,13 @@ extern bool untrusted_msi;
 int pi_update_irte(const struct pi_desc *pi_desc, const struct pirq *pirq,
                    const uint8_t gvec);
 
+#define iommu_sync_cache(addr, size) ({                 \
+    const struct iommu_ops *ops = iommu_get_ops();      \
+                                                        \
+    if ( ops->sync_cache )                              \
+        iommu_vcall(ops, sync_cache, addr, size);       \
+})
+
 #endif /* !__ARCH_X86_IOMMU_H__ */
 /*
  * Local variables:
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 6264d3d07f..3272874958 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -275,6 +275,7 @@ struct iommu_ops {
     int (*setup_hpet_msi)(struct msi_desc *);
 
     int (*adjust_irq_affinities)(void);
+    void (*sync_cache)(const void *addr, unsigned int size);
 #endif /* CONFIG_X86 */
 
     int __must_check (*suspend)(void);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 12:56:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 12:56:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsn9T-0003R0-Pc; Tue, 07 Jul 2020 12:56:47 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsn9S-0003Qr-TC
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:46 +0000
X-Inumbo-ID: 50834926-c051-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 50834926-c051-11ea-8496-bc764e2007e4;
 Tue, 07 Jul 2020 12:56:46 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Qx+A1r3ywAh+kBixwCcukrtBxC8xc1fzEIQpotMFj+s=; b=uOomT9cnGh+MKSdjsuKYU8VWLl
 6k1GuNVnuUrhoMMYTGCbEglbGl1FxGNLM+NzC+XxEU8cr64r3uuZ2ObAw1NGx7SXvoTf0Rw+BZFJE
 Noh9AUqh5VV6sAauVTC0i7ev1MuGjPmWSb0BmNytXyZ4Siiniryndzei59VmPR5Zo4H4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn9S-0003YK-9r
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn9S-0000Pz-8R
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:46 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] vtd: don't assume addresses are aligned in sync_cache
Message-Id: <E1jsn9S-0000Pz-8R@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 12:56:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit b6d9398144f21718d25daaf8d72669a75592abc5
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 14:39:05 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:39:05 2020 +0200

    vtd: don't assume addresses are aligned in sync_cache
    
    Current code in sync_cache assume that the address passed in is
    aligned to a cache line size. Fix the code to support passing in
    arbitrary addresses not necessarily aligned to a cache line size.
    
    This is part of XSA-321.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 93bcd72f84..8a2c105f72 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -149,8 +149,8 @@ static int iommus_incoherent;
 
 static void sync_cache(const void *addr, unsigned int size)
 {
-    int i;
-    static unsigned int clflush_size = 0;
+    static unsigned long clflush_size = 0;
+    const void *end = addr + size;
 
     if ( !iommus_incoherent )
         return;
@@ -158,8 +158,9 @@ static void sync_cache(const void *addr, unsigned int size)
     if ( clflush_size == 0 )
         clflush_size = get_cache_line_size();
 
-    for ( i = 0; i < size; i += clflush_size )
-        cacheline_flush((char *)addr + i);
+    addr -= (unsigned long)addr & (clflush_size - 1);
+    for ( ; addr < end; addr += clflush_size )
+        cacheline_flush((char *)addr);
 }
 
 /* Allocate page table, return its machine address */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 12:56:57 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 12:56:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsn9d-0003SO-RR; Tue, 07 Jul 2020 12:56:57 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsn9c-0003SE-VL
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:56 +0000
X-Inumbo-ID: 56842b92-c051-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 56842b92-c051-11ea-bb8b-bc764e2007e4;
 Tue, 07 Jul 2020 12:56:56 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=z0EddMOQkyUb5+ZoNr25W+lqtd4yjCCX8zchonpSx2A=; b=gRptJmxFAhoNgwpTiTVjXGgTbB
 HkuU0RLsEAtlLsjOxZL2OXyNrLdz6MdFfBZpx1HpAINhU1kgqbtUQxb3JGuoB69D3lQk/ZTn5G58/
 dG3iq5PZMcE1hVYJW8ZZNTy8lLwztahIGq5Mvg0PxXMZAmM9LlDlI5WuuNYmqEGF4sWw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn9c-0003Yc-D8
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn9c-0000Qw-C0
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:56:56 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/alternative: introduce alternative_2
Message-Id: <E1jsn9c-0000Qw-C0@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 12:56:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 23570bce00ee6ba2139ece978ab6f03ff166e21d
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 14:39:25 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:39:25 2020 +0200

    x86/alternative: introduce alternative_2
    
    It's based on alternative_io_2 without inputs or outputs but with an
    added memory clobber.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/asm-x86/alternative.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h
index 92e3581bc2..8e78cc91c3 100644
--- a/xen/include/asm-x86/alternative.h
+++ b/xen/include/asm-x86/alternative.h
@@ -114,6 +114,11 @@ extern void alternative_branches(void);
 #define alternative(oldinstr, newinstr, feature)                        \
         asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) : : : "memory")
 
+#define alternative_2(oldinstr, newinstr1, feature1, newinstr2, feature2) \
+	asm volatile (ALTERNATIVE_2(oldinstr, newinstr1, feature1,	\
+				    newinstr2, feature2)		\
+		      : : : "memory")
+
 /*
  * Alternative inline assembly with input.
  *
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 12:57:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 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 1jsn9y-0003WH-At; Tue, 07 Jul 2020 12:57:18 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsn9w-0003SE-Ub
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:57:16 +0000
X-Inumbo-ID: 5c87364c-c051-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5c87364c-c051-11ea-bb8b-bc764e2007e4;
 Tue, 07 Jul 2020 12:57:06 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=fjall3aqzggqQQPjom608Ygi1Qw684/MOER6uHbGc2Q=; b=ERo4sBH+q1Dshu8ODjTf1UgM1K
 7S+982pogj55YQyNpDkrdNZsuKoyHnyl7NqtPfrSCNG9A+yp5WBvSYof1rLVTqmdtoPDRAO7mpQxq
 B1LGwZg9pjVT2J2uL+/py221LljfR6IoVF3Ci5q5NxlbRg8g7cZGZckTmmLicA8OxJjk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn9m-0003Z1-G6
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:57:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn9m-0000Ro-FV
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:57:06 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] vtd: optimize CPU cache sync
Message-Id: <E1jsn9m-0000Ro-FV@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 12:57:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a64ea16522a73a13a0d66cfa4b66a9d3b95dd9d6
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 14:39:54 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:39:54 2020 +0200

    vtd: optimize CPU cache sync
    
    Some VT-d IOMMUs are non-coherent, which requires a cache write back
    in order for the changes made by the CPU to be visible to the IOMMU.
    This cache write back was unconditionally done using clflush, but there are
    other more efficient instructions to do so, hence implement support
    for them using the alternative framework.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/vtd/extern.h  |  1 -
 xen/drivers/passthrough/vtd/iommu.c   | 38 ++++++++++++++++++++++++++++++++++-
 xen/drivers/passthrough/vtd/x86/vtd.c |  5 -----
 3 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index f15947af1f..f776feefe6 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -68,7 +68,6 @@ int __must_check qinval_device_iotlb_sync(struct vtd_iommu *iommu,
                                           u16 did, u16 size, u64 addr);
 
 unsigned int get_cache_line_size(void);
-void cacheline_flush(char *);
 void flush_all_cache(void);
 
 uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 8a2c105f72..cf651fba34 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -31,6 +31,7 @@
 #include <xen/pci_regs.h>
 #include <xen/keyhandler.h>
 #include <asm/msi.h>
+#include <asm/nops.h>
 #include <asm/irq.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/p2m.h>
@@ -160,7 +161,42 @@ static void sync_cache(const void *addr, unsigned int size)
 
     addr -= (unsigned long)addr & (clflush_size - 1);
     for ( ; addr < end; addr += clflush_size )
-        cacheline_flush((char *)addr);
+/*
+ * The arguments to a macro must not include preprocessor directives. Doing so
+ * results in undefined behavior, so we have to create some defines here in
+ * order to avoid it.
+ */
+#if defined(HAVE_AS_CLWB)
+# define CLWB_ENCODING "clwb %[p]"
+#elif defined(HAVE_AS_XSAVEOPT)
+# define CLWB_ENCODING "data16 xsaveopt %[p]" /* clwb */
+#else
+# define CLWB_ENCODING ".byte 0x66, 0x0f, 0xae, 0x30" /* clwb (%%rax) */
+#endif
+
+#define BASE_INPUT(addr) [p] "m" (*(const char *)(addr))
+#if defined(HAVE_AS_CLWB) || defined(HAVE_AS_XSAVEOPT)
+# define INPUT BASE_INPUT
+#else
+# define INPUT(addr) "a" (addr), BASE_INPUT(addr)
+#endif
+        /*
+         * Note regarding the use of NOP_DS_PREFIX: it's faster to do a clflush
+         * + prefix than a clflush + nop, and hence the prefix is added instead
+         * of letting the alternative framework fill the gap by appending nops.
+         */
+        alternative_io_2(".byte " __stringify(NOP_DS_PREFIX) "; clflush %[p]",
+                         "data16 clflush %[p]", /* clflushopt */
+                         X86_FEATURE_CLFLUSHOPT,
+                         CLWB_ENCODING,
+                         X86_FEATURE_CLWB, /* no outputs */,
+                         INPUT(addr));
+#undef INPUT
+#undef BASE_INPUT
+#undef CLWB_ENCODING
+
+    alternative_2("", "sfence", X86_FEATURE_CLFLUSHOPT,
+                      "sfence", X86_FEATURE_CLWB);
 }
 
 /* Allocate page table, return its machine address */
diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c
index f379afac03..bbe358dc36 100644
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -52,11 +52,6 @@ unsigned int get_cache_line_size(void)
     return ((cpuid_ebx(1) >> 8) & 0xff) * 8;
 }
 
-void cacheline_flush(char * addr)
-{
-    clflush(addr);
-}
-
 void flush_all_cache()
 {
     wbinvd();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 12:57:19 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 12:57: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 1jsn9z-0003Wy-DY; Tue, 07 Jul 2020 12:57:19 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsn9x-0003W8-Mf
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:57:17 +0000
X-Inumbo-ID: 628cfe6e-c051-11ea-8d66-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 628cfe6e-c051-11ea-8d66-12813bfff9fa;
 Tue, 07 Jul 2020 12:57:16 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=37mtLbDuPKNs9lAKMoTL7G7VV5IPVneroSJlr6csVyc=; b=c66fef6IAjTcO/YM/gOiQh1L5a
 pHunJK9W4AQFre0jV/MrAt7PbAkwKW8p1edD2y6ly4unXKjNM5hDkena8jFCGStSrXENgHZXNaZnU
 EyQr5ZjpP8ogDErMfI0GdEDRSWHtyb2+ivanIqbodW5pO2b4DRibEnBqJCghKSuuVgaE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn9w-0003Z4-JE
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:57:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsn9w-0000ST-IL
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:57:16 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/ept: flush cache when modifying PTEs and sharing
 page tables
Message-Id: <E1jsn9w-0000ST-IL@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 12:57:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit c23274fd0412381bd75068ebc9f8f8c90a4be748
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 14:40:11 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:40:11 2020 +0200

    x86/ept: flush cache when modifying PTEs and sharing page tables
    
    Modifications made to the page tables by EPT code need to be written
    to memory when the page tables are shared with the IOMMU, as Intel
    IOMMUs can be non-coherent and thus require changes to be written to
    memory in order to be visible to the IOMMU.
    
    In order to achieve this make sure data is written back to memory
    after writing an EPT entry when the recalc bit is not set in
    atomic_write_ept_entry. If such bit is set, the entry will be
    adjusted and atomic_write_ept_entry will be called a second time
    without the recalc bit set. Note that when splitting a super page the
    new tables resulting of the split should also be written back.
    
    Failure to do so can allow devices behind the IOMMU access to the
    stale super page, or cause coherency issues as changes made by the
    processor to the page tables are not visible to the IOMMU.
    
    This allows to remove the VT-d specific iommu_pte_flush helper, since
    the cache write back is now performed by atomic_write_ept_entry, and
    hence iommu_iotlb_flush can be used to flush the IOMMU TLB. The newly
    used method (iommu_iotlb_flush) can result in less flushes, since it
    might sometimes be called rightly with 0 flags, in which case it
    becomes a no-op.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/p2m-ept.c           | 24 ++++++++++++++++++-
 xen/drivers/passthrough/vtd/iommu.c | 47 -------------------------------------
 xen/include/asm-x86/iommu.h         |  4 ----
 3 files changed, 23 insertions(+), 52 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 87a14f6f22..b8154a7ecc 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -58,6 +58,19 @@ static int atomic_write_ept_entry(struct p2m_domain *p2m,
 
     write_atomic(&entryptr->epte, new.epte);
 
+    /*
+     * The recalc field on the EPT is used to signal either that a
+     * recalculation of the EMT field is required (which doesn't effect the
+     * IOMMU), or a type change. Type changes can only be between ram_rw,
+     * logdirty and ioreq_server: changes to/from logdirty won't work well with
+     * an IOMMU anyway, as IOMMU #PFs are not synchronous and will lead to
+     * aborts, and changes to/from ioreq_server are already fully flushed
+     * before returning to guest context (see
+     * XEN_DMOP_map_mem_type_to_ioreq_server).
+     */
+    if ( !new.recalc && iommu_use_hap_pt(p2m->domain) )
+        iommu_sync_cache(entryptr, sizeof(*entryptr));
+
     return 0;
 }
 
@@ -277,6 +290,9 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
             break;
     }
 
+    if ( iommu_use_hap_pt(p2m->domain) )
+        iommu_sync_cache(table, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
     unmap_domain_page(table);
 
     /* Even failed we should install the newly allocated ept page. */
@@ -336,6 +352,9 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
 
+        if ( iommu_use_hap_pt(p2m->domain) )
+            iommu_sync_cache(next, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
         rc = atomic_write_ept_entry(p2m, ept_entry, e, next_level);
         ASSERT(rc == 0);
     }
@@ -824,7 +843,10 @@ out:
          need_modify_vtd_table )
     {
         if ( iommu_use_hap_pt(d) )
-            rc = iommu_pte_flush(d, gfn, &ept_entry->epte, order, vtd_pte_present);
+            rc = iommu_iotlb_flush(d, _dfn(gfn), (1u << order),
+                                   (iommu_flags ? IOMMU_FLUSHF_added : 0) |
+                                   (vtd_pte_present ? IOMMU_FLUSHF_modified
+                                                    : 0));
         else if ( need_iommu_pt_sync(d) )
             rc = iommu_flags ?
                 iommu_legacy_map(d, _dfn(gfn), mfn, order, iommu_flags) :
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index cf651fba34..2a99cd208f 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1887,53 +1887,6 @@ static int intel_iommu_lookup_page(struct domain *d, dfn_t dfn, mfn_t *mfn,
     return 0;
 }
 
-int iommu_pte_flush(struct domain *d, uint64_t dfn, uint64_t *pte,
-                    int order, int present)
-{
-    struct acpi_drhd_unit *drhd;
-    struct vtd_iommu *iommu = NULL;
-    struct domain_iommu *hd = dom_iommu(d);
-    bool_t flush_dev_iotlb;
-    int iommu_domid;
-    int rc = 0;
-
-    iommu_sync_cache(pte, sizeof(struct dma_pte));
-
-    for_each_drhd_unit ( drhd )
-    {
-        iommu = drhd->iommu;
-        if ( !test_bit(iommu->index, &hd->arch.iommu_bitmap) )
-            continue;
-
-        flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
-        iommu_domid= domain_iommu_domid(d, iommu);
-        if ( iommu_domid == -1 )
-            continue;
-
-        rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
-                                   __dfn_to_daddr(dfn),
-                                   order, !present, flush_dev_iotlb);
-        if ( rc > 0 )
-        {
-            iommu_flush_write_buffer(iommu);
-            rc = 0;
-        }
-    }
-
-    if ( unlikely(rc) )
-    {
-        if ( !d->is_shutting_down && printk_ratelimit() )
-            printk(XENLOG_ERR VTDPREFIX
-                   " d%d: IOMMU pages flush failed: %d\n",
-                   d->domain_id, rc);
-
-        if ( !is_hardware_domain(d) )
-            domain_crash(d);
-    }
-
-    return rc;
-}
-
 static int __init vtd_ept_page_compatible(struct vtd_iommu *iommu)
 {
     u64 ept_cap, vtd_cap = iommu->cap;
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 864e025078..6c9d5e5632 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -97,10 +97,6 @@ static inline int iommu_adjust_irq_affinities(void)
            : 0;
 }
 
-/* While VT-d specific, this must get declared in a generic header. */
-int __must_check iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
-                                 int order, int present);
-
 static inline bool iommu_supports_x2apic(void)
 {
     return iommu_init_ops && iommu_init_ops->supports_x2apic
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 12:57:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 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 1jsnA8-0003ZP-FB; Tue, 07 Jul 2020 12:57:28 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnA7-0003Z6-BY
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:57:27 +0000
X-Inumbo-ID: 6895b4e0-c051-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6895b4e0-c051-11ea-bb8b-bc764e2007e4;
 Tue, 07 Jul 2020 12:57:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=IRfTVCU9DRc3lEKyolbd4ZLE4GtCOWlpPNt3dCEzdhc=; b=RdRgAK8tse3wfSDCaKyaeXW3es
 qCjPWi7KcP8dPiYJqDDQfcGGliHvvzZjaKlmAcMRDU+6EGgjK0Xtr0IObsFnrxd4IUn+xbibUOkn4
 gHN/wRGH6FJtFBvD5GsPp/qTkyXssdyuR1lbhdKVq6GluQ0UZgNXiuhLCRBSHjvfnVno=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnA6-0003ZD-MY
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:57:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnA6-0000T7-LN
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 12:57:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] xen: Check the alignment of the offset pased via
 VCPUOP_register_vcpu_info
Message-Id: <E1jsnA6-0000T7-LN@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 12:57:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 3fdc211b01b29f252166937238efe02d15cb5780
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue May 26 18:31:33 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:41:00 2020 +0200

    xen: Check the alignment of the offset pased via VCPUOP_register_vcpu_info
    
    Currently a guest is able to register any guest physical address to use
    for the vcpu_info structure as long as the structure can fits in the
    rest of the frame.
    
    This means a guest can provide an address that is not aligned to the
    natural alignment of the structure.
    
    On Arm 32-bit, unaligned access are completely forbidden by the
    hypervisor. This will result to a data abort which is fatal.
    
    On Arm 64-bit, unaligned access are only forbidden when used for atomic
    access. As the structure contains fields (such as evtchn_pending_self)
    that are updated using atomic operations, any unaligned access will be
    fatal as well.
    
    While the misalignment is only fatal on Arm, a generic check is added
    as an x86 guest shouldn't sensibly pass an unaligned address (this
    would result to a split lock).
    
    This is XSA-327.
    
    Reported-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/domain.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 7cc9526139..e9be05f1d0 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1227,10 +1227,20 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
     void *mapping;
     vcpu_info_t *new_info;
     struct page_info *page;
+    unsigned int align;
 
     if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
         return -EINVAL;
 
+#ifdef CONFIG_COMPAT
+    if ( has_32bit_shinfo(d) )
+        align = alignof(new_info->compat);
+    else
+#endif
+        align = alignof(*new_info);
+    if ( offset & (align - 1) )
+        return -EINVAL;
+
     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 Jul 07 13:11:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:11: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 1jsnNJ-0005Ge-IS; Tue, 07 Jul 2020 13:11:05 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnNJ-0005GZ-90
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:11:05 +0000
X-Inumbo-ID: 5000b02c-c053-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5000b02c-c053-11ea-8496-bc764e2007e4;
 Tue, 07 Jul 2020 13:11:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=PYtvO5GdhCATTB4dFvcu1n0fuCt/8NroAvasZ8Y0OK8=; b=K1nVYz4a9JaXZcb1kGT+10OLs4
 8HMacBzFANVniJhkTiS1jHD9tRT+qQHkpdW1KQgygeTvOG8l2uWf8k/A+5VWwQ9YhRAskh0AE3CwM
 UOH5VHh12c5Evsf8soiDfbEs/aaQL72UDiRQRIcQk6yvdamM3R1mmcWGTxdRJRL2Pj58=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnNI-0003rH-D6
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnNI-0001sj-BF
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:11:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] xen/common: event_channel: Don't ignore error in
 get_free_port()
Message-Id: <E1jsnNI-0001sj-BF@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 3e41b727f7836d851026e17224ea2a3b177feb6f
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jul 7 15:00:10 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:00:10 2020 +0200

    xen/common: event_channel: Don't ignore error in get_free_port()
    
    Currently, get_free_port() is assuming that the port has been allocated
    when evtchn_allocate_port() is not return -EBUSY.
    
    However, the function may return an error when:
        - We exhausted all the event channels. This can happen if the limit
        configured by the administrator for the guest ('max_event_channels'
        in xl cfg) is higher than the ABI used by the guest. For instance,
        if the guest is using 2L, the limit should not be higher than 4095.
        - We cannot allocate memory (e.g Xen has not more memory).
    
    Users of get_free_port() (such as EVTCHNOP_alloc_unbound) will validly
    assuming the port was valid and will next call evtchn_from_port(). This
    will result to a crash as the memory backing the event channel structure
    is not present.
    
    Fixes: 368ae9a05fe ("xen/pvshim: forward evtchn ops between L0 Xen and L2 DomU")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2e9c2bc292231823a3a021d2e0a9f1956bf00b3c
    master date: 2020-07-07 14:35:36 +0200
---
 xen/common/event_channel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index e86e2bfab0..a8d182b584 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -195,10 +195,10 @@ static int get_free_port(struct domain *d)
     {
         int rc = evtchn_allocate_port(d, port);
 
-        if ( rc == -EBUSY )
-            continue;
-
-        return port;
+        if ( rc == 0 )
+            return port;
+        else if ( rc != -EBUSY )
+            return rc;
     }
 
     return -ENOSPC;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:11:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:11:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsnNT-0005HJ-K9; Tue, 07 Jul 2020 13:11:15 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnNT-0005HD-C1
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:11:15 +0000
X-Inumbo-ID: 5605450a-c053-11ea-8d66-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5605450a-c053-11ea-8d66-12813bfff9fa;
 Tue, 07 Jul 2020 13:11:14 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=fjwDzEPOndcfg2/sH5Q/8q2LUMakhGVrwfJXzj5kveE=; b=UtZgrXDYKy4kvJh5JlHw2LWBLS
 xRIHZajmLrR873+JpkvCnihl0xjfAwSN7OzE2+kye4wk3XHmQ14ySuAAU3myCkCHUw6fH4wTsNSDk
 JzFDSsiZOA3/Pq1+JTi65LLkP6fsOCPBSCLSQzerKitP5qDLZBFHimpbUUJ3XgboLBCE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnNS-0003rP-HX
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:11:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnNS-0001uE-FP
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:11:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/shadow: correct an inverted conditional in
 dirty VRAM tracking
Message-Id: <E1jsnNS-0001uE-FP@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:11:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 7a76deb101c8e3d7f6667448f1620957405c0930
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:00:37 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:00:37 2020 +0200

    x86/shadow: correct an inverted conditional in dirty VRAM tracking
    
    This originally was "mfn_x(mfn) == INVALID_MFN". Make it like this
    again, taking the opportunity to also drop the unnecessary nearby
    braces.
    
    This is XSA-319.
    
    Fixes: 246a5a3377c2 ("xen: Use a typesafe to define INVALID_MFN")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 23a216f99d40fbfbc2318ade89d8213eea6ba1f8
    master date: 2020-07-07 14:36:24 +0200
---
 xen/arch/x86/mm/shadow/common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 314d837602..dd8d9240ea 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3249,10 +3249,8 @@ int shadow_track_dirty_vram(struct domain *d,
             int dirty = 0;
             paddr_t sl1ma = dirty_vram->sl1ma[i];
 
-            if ( !mfn_eq(mfn, INVALID_MFN) )
-            {
+            if ( mfn_eq(mfn, INVALID_MFN) )
                 dirty = 1;
-            }
             else
             {
                 page = mfn_to_page(mfn);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:11:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnNe-0005Im-Lx; Tue, 07 Jul 2020 13:11:26 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnNd-0005Ig-Dj
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:11:25 +0000
X-Inumbo-ID: 5c09ca70-c053-11ea-8d66-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5c09ca70-c053-11ea-8d66-12813bfff9fa;
 Tue, 07 Jul 2020 13:11:24 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Ft3t1ocwa5rapTefYTCpHMnop0pJgtVzj6GBxjcKTMg=; b=Q7aSlq2xv7WNJ6F82ltY6EXu8R
 kMJM15KfuyygwQmFvkIUHedTkulo+5FbNiIW2ILax1rLxygvTx1ARaGHTLI9+yNyEwZwYpTvJmYg1
 boMZIJTuWF13jT43V8H9BfVa1rMEDey9S6hHT5nVLY3/QuGihRil5V4lUk4XKseGg9Pc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnNc-0003rW-LG
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:11:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnNc-0001vO-Ji
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:11:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/EPT: ept_set_middle_entry() related adjustments
Message-Id: <E1jsnNc-0001vO-Ji@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:11:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 56e117f504f83d1576bf62b53bf70e4a82e2a877
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:01:08 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:01:08 2020 +0200

    x86/EPT: ept_set_middle_entry() related adjustments
    
    ept_split_super_page() wants to further modify the newly allocated
    table, so have ept_set_middle_entry() return the mapped pointer rather
    than tearing it down and then getting re-established right again.
    
    Similarly ept_next_level() wants to hand back a mapped pointer of
    the next level page, so re-use the one established by
    ept_set_middle_entry() in case that path was taken.
    
    Pull the setting of suppress_ve ahead of insertion into the higher level
    table, and don't have ept_split_super_page() set the field a 2nd time.
    
    This is part of XSA-328.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 1104288186ee73a7f9bfa41cbaa5bb7611521028
    master date: 2020-07-07 14:36:52 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 41 ++++++++++++++++++-----------------------
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index b5517769c9..9abbd9e680 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -187,8 +187,9 @@ static void ept_p2m_type_to_flags(struct p2m_domain *p2m, ept_entry_t *entry,
 #define GUEST_TABLE_SUPER_PAGE  2
 #define GUEST_TABLE_POD_PAGE    3
 
-/* Fill in middle levels of ept table */
-static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
+/* Fill in middle level of ept table; return pointer to mapped new table. */
+static ept_entry_t *ept_set_middle_entry(struct p2m_domain *p2m,
+                                         ept_entry_t *ept_entry)
 {
     mfn_t mfn;
     ept_entry_t *table;
@@ -196,7 +197,12 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     mfn = p2m_alloc_ptp(p2m, 0);
     if ( mfn_eq(mfn, INVALID_MFN) )
-        return 0;
+        return NULL;
+
+    table = map_domain_page(mfn);
+
+    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
+        table[i].suppress_ve = 1;
 
     ept_entry->epte = 0;
     ept_entry->mfn = mfn_x(mfn);
@@ -208,14 +214,7 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     ept_entry->suppress_ve = 1;
 
-    table = map_domain_page(mfn);
-
-    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
-        table[i].suppress_ve = 1;
-
-    unmap_domain_page(table);
-
-    return 1;
+    return table;
 }
 
 /* free ept sub tree behind an entry */
@@ -253,10 +252,10 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
 
     ASSERT(is_epte_superpage(ept_entry));
 
-    if ( !ept_set_middle_entry(p2m, &new_ept) )
+    table = ept_set_middle_entry(p2m, &new_ept);
+    if ( !table )
         return 0;
 
-    table = map_domain_page(_mfn(new_ept.mfn));
     trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER);
 
     for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
@@ -267,7 +266,6 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
         epte->sp = (level > 1);
         epte->mfn += i * trunk;
         epte->snp = is_iommu_enabled(p2m->domain) && iommu_snoop;
-        epte->suppress_ve = 1;
 
         ept_p2m_type_to_flags(p2m, epte, epte->sa_p2mt, epte->access);
 
@@ -306,8 +304,7 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
                           ept_entry_t **table, unsigned long *gfn_remainder,
                           int next_level)
 {
-    unsigned long mfn;
-    ept_entry_t *ept_entry, e;
+    ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
     shift = next_level * EPT_TABLE_ORDER;
@@ -332,19 +329,17 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        if ( !ept_set_middle_entry(p2m, ept_entry) )
+        next = ept_set_middle_entry(p2m, ept_entry);
+        if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        else
-            e = atomic_read_ept_entry(ept_entry); /* Refresh */
+        /* e is now stale and hence may not be used anymore below. */
     }
-
     /* The only time sp would be set here is if we had hit a superpage */
-    if ( is_epte_superpage(&e) )
+    else if ( is_epte_superpage(&e) )
         return GUEST_TABLE_SUPER_PAGE;
 
-    mfn = e.mfn;
     unmap_domain_page(*table);
-    *table = map_domain_page(_mfn(mfn));
+    *table = next ?: map_domain_page(_mfn(e.mfn));
     *gfn_remainder &= (1UL << shift) - 1;
     return GUEST_TABLE_NORMAL_PAGE;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:11:36 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnNo-0005Jh-Nk; Tue, 07 Jul 2020 13:11:36 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnNn-0005JZ-GQ
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:11:35 +0000
X-Inumbo-ID: 6217ee24-c053-11ea-8d66-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 6217ee24-c053-11ea-8d66-12813bfff9fa;
 Tue, 07 Jul 2020 13:11:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=MjToPAEbziRDcNNNj0NgVlVbSXimBx3b2chqfZ2LxS0=; b=OegG06A0mYS/70Eo2bYQoNzl1N
 7Pyv4d2qs1wOw3SGbApCxIqhTp0pVSoGk8G/7NQjzx9rwrcmpfSqFcxlx4aMwZIZITUmefL737kd1
 cOamaESjYtqqxCqY6XuDuXLMJDJGz0H8OxqOksRwIftvvluvv1S3mPQb5nUFsX2zJ8+c=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnNm-0003sH-OH
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:11:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnNm-0001wB-NO
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:11:34 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/ept: atomically modify entries in
 ept_next_level
Message-Id: <E1jsnNm-0001wB-NO@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:11:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 2b34d8cd734a46f59e8a697d339b10e64514ab3d
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:01:30 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:01:30 2020 +0200

    x86/ept: atomically modify entries in ept_next_level
    
    ept_next_level was passing a live PTE pointer to ept_set_middle_entry,
    which was then modified without taking into account that the PTE could
    be part of a live EPT table. This wasn't a security issue because the
    pages returned by p2m_alloc_ptp are zeroed, so adding such an entry
    before actually initializing it didn't allow a guest to access
    physical memory addresses it wasn't supposed to access.
    
    This is part of XSA-328.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: bc3d9f95d661372b059a5539ae6cb1e79435bb95
    master date: 2020-07-07 14:37:12 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 9abbd9e680..07236e963d 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -307,6 +307,8 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
     ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
+    ASSERT(next_level);
+
     shift = next_level * EPT_TABLE_ORDER;
 
     index = *gfn_remainder >> shift;
@@ -323,16 +325,20 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
 
     if ( !is_epte_present(&e) )
     {
+        int rc;
+
         if ( e.sa_p2mt == p2m_populate_on_demand )
             return GUEST_TABLE_POD_PAGE;
 
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        next = ept_set_middle_entry(p2m, ept_entry);
+        next = ept_set_middle_entry(p2m, &e);
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        /* e is now stale and hence may not be used anymore below. */
+
+        rc = atomic_write_ept_entry(p2m, ept_entry, e, next_level);
+        ASSERT(rc == 0);
     }
     /* The only time sp would be set here is if we had hit a superpage */
     else if ( is_epte_superpage(&e) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:11:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnNy-0005L0-R1; Tue, 07 Jul 2020 13:11:46 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnNx-0005Ko-GB
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:11:45 +0000
X-Inumbo-ID: 6813e6b6-c053-11ea-8d66-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 6813e6b6-c053-11ea-8d66-12813bfff9fa;
 Tue, 07 Jul 2020 13:11:45 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=QxmJQIQp3zD2xW//Yg5MMFC+K33vib7q3hdgn6sJWsg=; b=0L4OGZ3ud16SV0zBTdULV9mArg
 M8J9FjYdRh2Kaep8cYiBOM/J2kGJ2/RdpgJqcfPmr2C2ScEsLT5qFMNB28xVv2rTx916njZRoYYe+
 A/XQkesz/+4poePL+NhY+cSC+u03mW2ihNe5HpvseFcxad8f0Czwn9BMgC8qL/9GvejU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnNw-0003sT-R6
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:11:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnNw-0001y0-QP
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:11:44 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] vtd: improve IOMMU TLB flush
Message-Id: <E1jsnNw-0001y0-QP@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:11:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 1c7a98cab9101d8fedadd0bb0ccafc4498b37560
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:01:57 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:01:57 2020 +0200

    vtd: improve IOMMU TLB flush
    
    Do not limit PSI flushes to order 0 pages, in order to avoid doing a
    full TLB flush if the passed in page has an order greater than 0 and
    is aligned. Should increase the performance of IOMMU TLB flushes when
    dealing with page orders greater than 0.
    
    This is part of XSA-321.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 5fe515a0fede07543f2a3b049167b1fd8b873caf
    master date: 2020-07-07 14:37:46 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 26401c7e64..77cdc21837 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -570,13 +570,14 @@ static int __must_check iommu_flush_iotlb(struct domain *d, dfn_t dfn,
         if ( iommu_domid == -1 )
             continue;
 
-        if ( page_count != 1 || dfn_eq(dfn, INVALID_DFN) )
+        if ( !page_count || (page_count & (page_count - 1)) ||
+             dfn_eq(dfn, INVALID_DFN) || !IS_ALIGNED(dfn_x(dfn), page_count) )
             rc = iommu_flush_iotlb_dsi(iommu, iommu_domid,
                                        0, flush_dev_iotlb);
         else
             rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
                                        dfn_to_daddr(dfn),
-                                       PAGE_ORDER_4K,
+                                       get_order_from_pages(page_count),
                                        !dma_old_pte_present,
                                        flush_dev_iotlb);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:11:56 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnO8-0005Ls-SS; Tue, 07 Jul 2020 13:11:56 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnO7-0005Lk-P9
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:11:55 +0000
X-Inumbo-ID: 6e13ea16-c053-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6e13ea16-c053-11ea-b7bb-bc764e2007e4;
 Tue, 07 Jul 2020 13:11:55 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=l1m9pvpskMSiRpntNZIpxdKrLakhL4Ux5Qe4Sg0fkuc=; b=j0+2pGtaao3zXiDb1WTorxAnk3
 QpluUo9XvbOVph4Q5VvheUHcF65Jo/hlkC0CIt7UDKZdZ6UFVvF1gPRRV2q/cMg2QOXmVMqHyt1x+
 j+AL0SZkLgTOqkT7VGFMQt6kkGyotggnbo7rKmn/XxezZ5bG7fvGIg5v3OI6KHN+JBGg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnO6-0003sg-UC
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:11:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnO6-0001yl-TQ
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:11:54 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] vtd: prune (and rename) cache flush functions
Message-Id: <E1jsnO6-0001yl-TQ@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:11:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 005d5eaa458df4bb781998442997e8a3acef4d08
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:02:27 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:02:27 2020 +0200

    vtd: prune (and rename) cache flush functions
    
    Rename __iommu_flush_cache to iommu_sync_cache and remove
    iommu_flush_cache_page. Also remove the iommu_flush_cache_entry
    wrapper and just use iommu_sync_cache instead. Note the _entry suffix
    was meaningless as the wrapper was already taking a size parameter in
    bytes. While there also constify the addr parameter.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 62298825b9a44f45761acbd758138b5ba059ebd1
    master date: 2020-07-07 14:38:13 +0200
---
 xen/drivers/passthrough/vtd/extern.h   |  3 +--
 xen/drivers/passthrough/vtd/intremap.c |  6 +++---
 xen/drivers/passthrough/vtd/iommu.c    | 33 ++++++++++++---------------------
 3 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 994d360e90..52b5e1c60d 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -43,8 +43,7 @@ void disable_qinval(struct vtd_iommu *iommu);
 int enable_intremap(struct vtd_iommu *iommu, int eim);
 void disable_intremap(struct vtd_iommu *iommu);
 
-void iommu_flush_cache_entry(void *addr, unsigned int size);
-void iommu_flush_cache_page(void *addr, unsigned long npages);
+void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index bf846195c4..a2f02c1bea 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -230,7 +230,7 @@ static void free_remap_entry(struct vtd_iommu *iommu, int index)
                      iremap_entries, iremap_entry);
 
     update_irte(iommu, iremap_entry, &new_ire, false);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -406,7 +406,7 @@ static int ioapic_rte_to_remap_entry(struct vtd_iommu *iommu,
     }
 
     update_irte(iommu, iremap_entry, &new_ire, !init);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -695,7 +695,7 @@ static int msi_msg_to_remap_entry(
     update_irte(iommu, iremap_entry, &new_ire, msi_desc->irte_initialized);
     msi_desc->irte_initialized = true;
 
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 77cdc21837..d74f3323a4 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -140,7 +140,8 @@ static int context_get_domain_id(struct context_entry *context,
 }
 
 static int iommus_incoherent;
-static void __iommu_flush_cache(void *addr, unsigned int size)
+
+void iommu_sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -155,16 +156,6 @@ static void __iommu_flush_cache(void *addr, unsigned int size)
         cacheline_flush((char *)addr + i);
 }
 
-void iommu_flush_cache_entry(void *addr, unsigned int size)
-{
-    __iommu_flush_cache(addr, size);
-}
-
-void iommu_flush_cache_page(void *addr, unsigned long npages)
-{
-    __iommu_flush_cache(addr, PAGE_SIZE * npages);
-}
-
 /* Allocate page table, return its machine address */
 uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
 {
@@ -183,7 +174,7 @@ uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_flush_cache_page(vaddr, 1);
+        iommu_sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -216,7 +207,7 @@ static u64 bus_to_context_maddr(struct vtd_iommu *iommu, u8 bus)
         }
         set_root_value(*root, maddr);
         set_root_present(*root);
-        iommu_flush_cache_entry(root, sizeof(struct root_entry));
+        iommu_sync_cache(root, sizeof(struct root_entry));
     }
     maddr = (u64) get_context_addr(*root);
     unmap_vtd_domain_page(root_entries);
@@ -263,7 +254,7 @@ static u64 addr_to_dma_page_maddr(struct domain *domain, u64 addr, int alloc)
              */
             dma_set_pte_readable(*pte);
             dma_set_pte_writable(*pte);
-            iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+            iommu_sync_cache(pte, sizeof(struct dma_pte));
         }
 
         if ( level == 2 )
@@ -640,7 +631,7 @@ static int __must_check dma_pte_clear_one(struct domain *domain, u64 addr,
     *flush_flags |= IOMMU_FLUSHF_modified;
 
     spin_unlock(&hd->arch.mapping_lock);
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     unmap_vtd_domain_page(page);
 
@@ -679,7 +670,7 @@ static void iommu_free_page_table(struct page_info *pg)
             iommu_free_pagetable(dma_pte_addr(*pte), next_level);
 
         dma_clear_pte(*pte);
-        iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+        iommu_sync_cache(pte, sizeof(struct dma_pte));
     }
 
     unmap_vtd_domain_page(pt_vaddr);
@@ -1400,7 +1391,7 @@ int domain_context_mapping_one(
     context_set_address_width(*context, agaw);
     context_set_fault_enable(*context);
     context_set_present(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
     spin_unlock(&iommu->lock);
 
     /* Context entry was previously non-present (with domid 0). */
@@ -1564,7 +1555,7 @@ int domain_context_unmap_one(
 
     context_clear_present(*context);
     context_clear_entry(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
 
     iommu_domid= domain_iommu_domid(domain, iommu);
     if ( iommu_domid == -1 )
@@ -1791,7 +1782,7 @@ static int __must_check intel_iommu_map_page(struct domain *d, dfn_t dfn,
 
     *pte = new;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
     spin_unlock(&hd->arch.mapping_lock);
     unmap_vtd_domain_page(page);
 
@@ -1866,7 +1857,7 @@ int iommu_pte_flush(struct domain *d, uint64_t dfn, uint64_t *pte,
     int iommu_domid;
     int rc = 0;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     for_each_drhd_unit ( drhd )
     {
@@ -2724,7 +2715,7 @@ static int __init intel_iommu_quarantine_init(struct domain *d)
             dma_set_pte_addr(*pte, maddr);
             dma_set_pte_readable(*pte);
         }
-        iommu_flush_cache_page(parent, 1);
+        iommu_sync_cache(parent, PAGE_SIZE);
 
         unmap_vtd_domain_page(parent);
         parent = map_vtd_domain_page(maddr);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:12:06 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:12: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 1jsnOI-0005N3-U5; Tue, 07 Jul 2020 13:12:06 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnOI-0005Mu-Bp
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:12:06 +0000
X-Inumbo-ID: 741f144e-c053-11ea-8d66-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 741f144e-c053-11ea-8d66-12813bfff9fa;
 Tue, 07 Jul 2020 13:12:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=tgHLM+BGtzTTh30Cpzr3Dt2BI1pSUcpAIK0hgzNMlRI=; b=K5hyTpH9/gQs7bJGgNeSXD/WXw
 OveCJlEY51J7kyNxn9W+fb8snEKRH2DdisaSxdxwEiNh8227yQ3lQK5vqcLEzL1cOSnCqqcvIvlQ4
 dbDpcE05ZTTmVsPC5yEaM1hv4yl6D8XVe4CrToo3fQzVvLHSf0k0Xn/Ox+RY2HBetAbU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnOH-0003t6-1Y
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:12:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnOH-0001zn-0G
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:12:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/iommu: introduce a cache sync hook
Message-Id: <E1jsnOH-0001zn-0G@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:12:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit f1055a202d49839412e99374b97001d56bcaa118
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:02:56 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:02:56 2020 +0200

    x86/iommu: introduce a cache sync hook
    
    The hook is only implemented for VT-d and it uses the already existing
    iommu_sync_cache function present in VT-d code. The new hook is
    added so that the cache can be flushed by code outside of VT-d when
    using shared page tables.
    
    Note that alloc_pgtable_maddr must use the now locally defined
    sync_cache function, because IOMMU ops are not yet setup the first
    time the function gets called during IOMMU initialization.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 91526b460e5009fc56edbd6809e66c327281faba
    master date: 2020-07-07 14:38:34 +0200
---
 xen/drivers/passthrough/vtd/extern.h | 1 -
 xen/drivers/passthrough/vtd/iommu.c  | 5 +++--
 xen/include/asm-x86/iommu.h          | 7 +++++++
 xen/include/xen/iommu.h              | 1 +
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 52b5e1c60d..f15947af1f 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -43,7 +43,6 @@ void disable_qinval(struct vtd_iommu *iommu);
 int enable_intremap(struct vtd_iommu *iommu, int eim);
 void disable_intremap(struct vtd_iommu *iommu);
 
-void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index d74f3323a4..5e57bc61a3 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -141,7 +141,7 @@ static int context_get_domain_id(struct context_entry *context,
 
 static int iommus_incoherent;
 
-void iommu_sync_cache(const void *addr, unsigned int size)
+static void sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -174,7 +174,7 @@ uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_sync_cache(vaddr, PAGE_SIZE);
+        sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -2763,6 +2763,7 @@ const struct iommu_ops __initconstrel intel_iommu_ops = {
     .iotlb_flush_all = iommu_flush_iotlb_all,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_p2m_table = vtd_dump_p2m_table,
+    .sync_cache = sync_cache,
 };
 
 const struct iommu_init_ops __initconstrel intel_iommu_init_ops = {
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 85741f7c96..864e025078 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -121,6 +121,13 @@ extern bool untrusted_msi;
 int pi_update_irte(const struct pi_desc *pi_desc, const struct pirq *pirq,
                    const uint8_t gvec);
 
+#define iommu_sync_cache(addr, size) ({                 \
+    const struct iommu_ops *ops = iommu_get_ops();      \
+                                                        \
+    if ( ops->sync_cache )                              \
+        iommu_vcall(ops, sync_cache, addr, size);       \
+})
+
 #endif /* !__ARCH_X86_IOMMU_H__ */
 /*
  * Local variables:
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 6f79fb79f3..041a7cf5e5 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -250,6 +250,7 @@ struct iommu_ops {
     int (*setup_hpet_msi)(struct msi_desc *);
 
     int (*adjust_irq_affinities)(void);
+    void (*sync_cache)(const void *addr, unsigned int size);
 #endif /* CONFIG_X86 */
 
     int __must_check (*suspend)(void);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:12:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnOS-0005OC-Vn; Tue, 07 Jul 2020 13:12:16 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnOR-0005Nz-V8
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:12:15 +0000
X-Inumbo-ID: 7a241cd6-c053-11ea-8d66-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7a241cd6-c053-11ea-8d66-12813bfff9fa;
 Tue, 07 Jul 2020 13:12:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=EKsChfibUTb+VzozpNDPMiwGq8HbXha/9wLauRHL3Ks=; b=d2ryLorJzMQ/mi2fHd1uKyz0EE
 5jj4fYndQHJkoQn6wN0yQMfZ1X7gjloyePljDE3/TXY6Fjgezu7a/KYV5vAaZcS5KAu6BK/O7NywQ
 vlmHnrhnnTkhpHHTqWBMMciYwPIBPiFdXBVc5fWwX2lFMXh/oYneLbFYmB1yrvOEx6Ig=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnOR-0003tE-5O
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:12:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnOR-00021H-3s
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:12:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] vtd: don't assume addresses are aligned in
 sync_cache
Message-Id: <E1jsnOR-00021H-3s@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:12:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 8b9be8f415f2a5c6cdca5ac84e8c40a273c03e32
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:03:33 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:03:33 2020 +0200

    vtd: don't assume addresses are aligned in sync_cache
    
    Current code in sync_cache assume that the address passed in is
    aligned to a cache line size. Fix the code to support passing in
    arbitrary addresses not necessarily aligned to a cache line size.
    
    This is part of XSA-321.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b6d9398144f21718d25daaf8d72669a75592abc5
    master date: 2020-07-07 14:39:05 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 5e57bc61a3..81545861d6 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -143,8 +143,8 @@ static int iommus_incoherent;
 
 static void sync_cache(const void *addr, unsigned int size)
 {
-    int i;
-    static unsigned int clflush_size = 0;
+    static unsigned long clflush_size = 0;
+    const void *end = addr + size;
 
     if ( !iommus_incoherent )
         return;
@@ -152,8 +152,9 @@ static void sync_cache(const void *addr, unsigned int size)
     if ( clflush_size == 0 )
         clflush_size = get_cache_line_size();
 
-    for ( i = 0; i < size; i += clflush_size )
-        cacheline_flush((char *)addr + i);
+    addr -= (unsigned long)addr & (clflush_size - 1);
+    for ( ; addr < end; addr += clflush_size )
+        cacheline_flush((char *)addr);
 }
 
 /* Allocate page table, return its machine address */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:12:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:12: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 1jsnOd-0005Pr-14; Tue, 07 Jul 2020 13:12:27 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnOb-0005Pj-RG
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:12:25 +0000
X-Inumbo-ID: 802bc458-c053-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 802bc458-c053-11ea-bb8b-bc764e2007e4;
 Tue, 07 Jul 2020 13:12:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=pajU0qx//PXvJjzbrmyECPWqy2f7GpM8DoJ6IJ7NPow=; b=Cz/H6RR48+nRb7S1O5dpuA6xIK
 Mwce83N+UymfOP21fSVhVhJzx4s1IW3szl1wEYFL2e4GZfvamtaniCVLzIeQy/bzAtP2R0t/MoVSv
 FH5CmHLvhgvSwzVWGtdFFN8azomrb0L+S6CtCZPctCQY1gcM2GIRkNInjblKkUh0kpgA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnOb-0003tN-95
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:12:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnOb-00022i-83
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:12:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/alternative: introduce alternative_2
Message-Id: <E1jsnOb-00022i-83@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:12:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 493e143a8289f7826363b52e9b9a46b49150cfae
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:03:56 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:03:56 2020 +0200

    x86/alternative: introduce alternative_2
    
    It's based on alternative_io_2 without inputs or outputs but with an
    added memory clobber.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 23570bce00ee6ba2139ece978ab6f03ff166e21d
    master date: 2020-07-07 14:39:25 +0200
---
 xen/include/asm-x86/alternative.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h
index 92e3581bc2..8e78cc91c3 100644
--- a/xen/include/asm-x86/alternative.h
+++ b/xen/include/asm-x86/alternative.h
@@ -114,6 +114,11 @@ extern void alternative_branches(void);
 #define alternative(oldinstr, newinstr, feature)                        \
         asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) : : : "memory")
 
+#define alternative_2(oldinstr, newinstr1, feature1, newinstr2, feature2) \
+	asm volatile (ALTERNATIVE_2(oldinstr, newinstr1, feature1,	\
+				    newinstr2, feature2)		\
+		      : : : "memory")
+
 /*
  * Alternative inline assembly with input.
  *
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:12:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:12:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsnOn-0005Qx-2j; Tue, 07 Jul 2020 13:12:37 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnOm-0005Qp-6k
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:12:36 +0000
X-Inumbo-ID: 8635f04e-c053-11ea-8d66-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8635f04e-c053-11ea-8d66-12813bfff9fa;
 Tue, 07 Jul 2020 13:12:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=h/zEWDgH9efv8CCvJZp0zdcVPepCSJeG8Pc+B4TlENM=; b=H5QVbGAb/NOmxY8oiLZ8gmZ1Qo
 19KgZylLB0JdEaMlls2oJPtyO6Ctedke5KvX4XaRVslKmTT0AScWv5A8oD/8Gyo+iEiqJ0DuwvnCD
 sIx/DM88H/p8FYJ7uVYImrdniK7XqR2E+kO++4ImglyJjPU/9f8s8zPk6S2GzLUKiEjQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnOl-0003ty-DR
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:12:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnOl-00023T-Bv
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:12:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] vtd: optimize CPU cache sync
Message-Id: <E1jsnOl-00023T-Bv@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:12:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 0c8c10d12e98372f698cbfed6c08e4bff0937f1a
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:04:29 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:04:29 2020 +0200

    vtd: optimize CPU cache sync
    
    Some VT-d IOMMUs are non-coherent, which requires a cache write back
    in order for the changes made by the CPU to be visible to the IOMMU.
    This cache write back was unconditionally done using clflush, but there are
    other more efficient instructions to do so, hence implement support
    for them using the alternative framework.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a64ea16522a73a13a0d66cfa4b66a9d3b95dd9d6
    master date: 2020-07-07 14:39:54 +0200
---
 xen/drivers/passthrough/vtd/extern.h  |  1 -
 xen/drivers/passthrough/vtd/iommu.c   | 38 ++++++++++++++++++++++++++++++++++-
 xen/drivers/passthrough/vtd/x86/vtd.c |  5 -----
 3 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index f15947af1f..f776feefe6 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -68,7 +68,6 @@ int __must_check qinval_device_iotlb_sync(struct vtd_iommu *iommu,
                                           u16 did, u16 size, u64 addr);
 
 unsigned int get_cache_line_size(void);
-void cacheline_flush(char *);
 void flush_all_cache(void);
 
 uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 81545861d6..2919ada738 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -31,6 +31,7 @@
 #include <xen/pci_regs.h>
 #include <xen/keyhandler.h>
 #include <asm/msi.h>
+#include <asm/nops.h>
 #include <asm/irq.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/p2m.h>
@@ -154,7 +155,42 @@ static void sync_cache(const void *addr, unsigned int size)
 
     addr -= (unsigned long)addr & (clflush_size - 1);
     for ( ; addr < end; addr += clflush_size )
-        cacheline_flush((char *)addr);
+/*
+ * The arguments to a macro must not include preprocessor directives. Doing so
+ * results in undefined behavior, so we have to create some defines here in
+ * order to avoid it.
+ */
+#if defined(HAVE_AS_CLWB)
+# define CLWB_ENCODING "clwb %[p]"
+#elif defined(HAVE_AS_XSAVEOPT)
+# define CLWB_ENCODING "data16 xsaveopt %[p]" /* clwb */
+#else
+# define CLWB_ENCODING ".byte 0x66, 0x0f, 0xae, 0x30" /* clwb (%%rax) */
+#endif
+
+#define BASE_INPUT(addr) [p] "m" (*(const char *)(addr))
+#if defined(HAVE_AS_CLWB) || defined(HAVE_AS_XSAVEOPT)
+# define INPUT BASE_INPUT
+#else
+# define INPUT(addr) "a" (addr), BASE_INPUT(addr)
+#endif
+        /*
+         * Note regarding the use of NOP_DS_PREFIX: it's faster to do a clflush
+         * + prefix than a clflush + nop, and hence the prefix is added instead
+         * of letting the alternative framework fill the gap by appending nops.
+         */
+        alternative_io_2(".byte " __stringify(NOP_DS_PREFIX) "; clflush %[p]",
+                         "data16 clflush %[p]", /* clflushopt */
+                         X86_FEATURE_CLFLUSHOPT,
+                         CLWB_ENCODING,
+                         X86_FEATURE_CLWB, /* no outputs */,
+                         INPUT(addr));
+#undef INPUT
+#undef BASE_INPUT
+#undef CLWB_ENCODING
+
+    alternative_2("", "sfence", X86_FEATURE_CLFLUSHOPT,
+                      "sfence", X86_FEATURE_CLWB);
 }
 
 /* Allocate page table, return its machine address */
diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c
index ff456e1e70..229938f3a8 100644
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -51,11 +51,6 @@ unsigned int get_cache_line_size(void)
     return ((cpuid_ebx(1) >> 8) & 0xff) * 8;
 }
 
-void cacheline_flush(char * addr)
-{
-    clflush(addr);
-}
-
 void flush_all_cache()
 {
     wbinvd();
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:12:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:12:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsnOx-0005SI-5V; Tue, 07 Jul 2020 13:12:47 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnOw-0005S8-FR
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:12:46 +0000
X-Inumbo-ID: 8c429762-c053-11ea-8d66-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8c429762-c053-11ea-8d66-12813bfff9fa;
 Tue, 07 Jul 2020 13:12:45 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=z/gtiizkeGN0l3EHFuYRx2+ztfu2K94UokpkqsVG2wQ=; b=hiYLcGUXrKsLPhqAWQFTW93cUL
 xPNlO8RjrcLDKGZO4yQVhLf9/yjwVreuukdWjs+J2FhbARNVntoo+H2cZ3xOQekK09Xd4oleLRJOP
 d1oC08Svnkew0wKnVZWarhl4oPMiFqTad0eGkzF5XlVlfn7ZgntrAoKlH4L7495Sxs9I=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnOv-0003u6-HM
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:12:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnOv-00024Z-G2
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:12:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] x86/ept: flush cache when modifying PTEs and
 sharing page tables
Message-Id: <E1jsnOv-00024Z-G2@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:12:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 572e349de17e001b385b6eba1a5104d1b38b3960
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:04:57 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:04:57 2020 +0200

    x86/ept: flush cache when modifying PTEs and sharing page tables
    
    Modifications made to the page tables by EPT code need to be written
    to memory when the page tables are shared with the IOMMU, as Intel
    IOMMUs can be non-coherent and thus require changes to be written to
    memory in order to be visible to the IOMMU.
    
    In order to achieve this make sure data is written back to memory
    after writing an EPT entry when the recalc bit is not set in
    atomic_write_ept_entry. If such bit is set, the entry will be
    adjusted and atomic_write_ept_entry will be called a second time
    without the recalc bit set. Note that when splitting a super page the
    new tables resulting of the split should also be written back.
    
    Failure to do so can allow devices behind the IOMMU access to the
    stale super page, or cause coherency issues as changes made by the
    processor to the page tables are not visible to the IOMMU.
    
    This allows to remove the VT-d specific iommu_pte_flush helper, since
    the cache write back is now performed by atomic_write_ept_entry, and
    hence iommu_iotlb_flush can be used to flush the IOMMU TLB. The newly
    used method (iommu_iotlb_flush) can result in less flushes, since it
    might sometimes be called rightly with 0 flags, in which case it
    becomes a no-op.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c23274fd0412381bd75068ebc9f8f8c90a4be748
    master date: 2020-07-07 14:40:11 +0200
---
 xen/arch/x86/mm/p2m-ept.c           | 24 ++++++++++++++++++-
 xen/drivers/passthrough/vtd/iommu.c | 47 -------------------------------------
 xen/include/asm-x86/iommu.h         |  4 ----
 3 files changed, 23 insertions(+), 52 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 07236e963d..9c1627dbb3 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -58,6 +58,19 @@ static int atomic_write_ept_entry(struct p2m_domain *p2m,
 
     write_atomic(&entryptr->epte, new.epte);
 
+    /*
+     * The recalc field on the EPT is used to signal either that a
+     * recalculation of the EMT field is required (which doesn't effect the
+     * IOMMU), or a type change. Type changes can only be between ram_rw,
+     * logdirty and ioreq_server: changes to/from logdirty won't work well with
+     * an IOMMU anyway, as IOMMU #PFs are not synchronous and will lead to
+     * aborts, and changes to/from ioreq_server are already fully flushed
+     * before returning to guest context (see
+     * XEN_DMOP_map_mem_type_to_ioreq_server).
+     */
+    if ( !new.recalc && iommu_use_hap_pt(p2m->domain) )
+        iommu_sync_cache(entryptr, sizeof(*entryptr));
+
     return 0;
 }
 
@@ -278,6 +291,9 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
             break;
     }
 
+    if ( iommu_use_hap_pt(p2m->domain) )
+        iommu_sync_cache(table, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
     unmap_domain_page(table);
 
     /* Even failed we should install the newly allocated ept page. */
@@ -337,6 +353,9 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
 
+        if ( iommu_use_hap_pt(p2m->domain) )
+            iommu_sync_cache(next, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
         rc = atomic_write_ept_entry(p2m, ept_entry, e, next_level);
         ASSERT(rc == 0);
     }
@@ -821,7 +840,10 @@ out:
          need_modify_vtd_table )
     {
         if ( iommu_use_hap_pt(d) )
-            rc = iommu_pte_flush(d, gfn, &ept_entry->epte, order, vtd_pte_present);
+            rc = iommu_iotlb_flush(d, _dfn(gfn), (1u << order),
+                                   (iommu_flags ? IOMMU_FLUSHF_added : 0) |
+                                   (vtd_pte_present ? IOMMU_FLUSHF_modified
+                                                    : 0));
         else if ( need_iommu_pt_sync(d) )
             rc = iommu_flags ?
                 iommu_legacy_map(d, _dfn(gfn), mfn, order, iommu_flags) :
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 2919ada738..1e61e93d3f 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1884,53 +1884,6 @@ static int intel_iommu_lookup_page(struct domain *d, dfn_t dfn, mfn_t *mfn,
     return 0;
 }
 
-int iommu_pte_flush(struct domain *d, uint64_t dfn, uint64_t *pte,
-                    int order, int present)
-{
-    struct acpi_drhd_unit *drhd;
-    struct vtd_iommu *iommu = NULL;
-    struct domain_iommu *hd = dom_iommu(d);
-    bool_t flush_dev_iotlb;
-    int iommu_domid;
-    int rc = 0;
-
-    iommu_sync_cache(pte, sizeof(struct dma_pte));
-
-    for_each_drhd_unit ( drhd )
-    {
-        iommu = drhd->iommu;
-        if ( !test_bit(iommu->index, &hd->arch.iommu_bitmap) )
-            continue;
-
-        flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
-        iommu_domid= domain_iommu_domid(d, iommu);
-        if ( iommu_domid == -1 )
-            continue;
-
-        rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
-                                   __dfn_to_daddr(dfn),
-                                   order, !present, flush_dev_iotlb);
-        if ( rc > 0 )
-        {
-            iommu_flush_write_buffer(iommu);
-            rc = 0;
-        }
-    }
-
-    if ( unlikely(rc) )
-    {
-        if ( !d->is_shutting_down && printk_ratelimit() )
-            printk(XENLOG_ERR VTDPREFIX
-                   " d%d: IOMMU pages flush failed: %d\n",
-                   d->domain_id, rc);
-
-        if ( !is_hardware_domain(d) )
-            domain_crash(d);
-    }
-
-    return rc;
-}
-
 static int __init vtd_ept_page_compatible(struct vtd_iommu *iommu)
 {
     u64 ept_cap, vtd_cap = iommu->cap;
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 864e025078..6c9d5e5632 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -97,10 +97,6 @@ static inline int iommu_adjust_irq_affinities(void)
            : 0;
 }
 
-/* While VT-d specific, this must get declared in a generic header. */
-int __must_check iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
-                                 int order, int present);
-
 static inline bool iommu_supports_x2apic(void)
 {
     return iommu_init_ops && iommu_init_ops->supports_x2apic
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:12:57 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:12: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 1jsnP7-0005TC-72; Tue, 07 Jul 2020 13:12:57 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnP6-0005T2-Go
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:12:56 +0000
X-Inumbo-ID: 9244bcb2-c053-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9244bcb2-c053-11ea-bb8b-bc764e2007e4;
 Tue, 07 Jul 2020 13:12:55 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=D05SeaMNT2lEcIWbIPKAuL081XNDoTW/AKWFaK7qQvM=; b=nV0H55gFRFdrnZ/gDrtXhsg6QX
 HmgpIrm2IpfXuZDU9zOW8tEj3AHfoIMJlR0BAimp43tVG+d7IYoygJYNHyY4B/csY8PJxaQYLlbTv
 E54WuCJKSdUwcXeIgx8dAaL/W50BU7rp9G2gyrLWPeFNPhc00GYhixh0I7vxYiqVuog8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnP5-0003uE-KI
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:12:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnP5-00025p-Jb
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:12:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.13] xen: Check the alignment of the offset pased via
 VCPUOP_register_vcpu_info
Message-Id: <E1jsnP5-00025p-Jb@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:12:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 378321bb1fd5272653ae64f0306827614a3bd196
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jul 7 15:05:36 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:05:36 2020 +0200

    xen: Check the alignment of the offset pased via VCPUOP_register_vcpu_info
    
    Currently a guest is able to register any guest physical address to use
    for the vcpu_info structure as long as the structure can fits in the
    rest of the frame.
    
    This means a guest can provide an address that is not aligned to the
    natural alignment of the structure.
    
    On Arm 32-bit, unaligned access are completely forbidden by the
    hypervisor. This will result to a data abort which is fatal.
    
    On Arm 64-bit, unaligned access are only forbidden when used for atomic
    access. As the structure contains fields (such as evtchn_pending_self)
    that are updated using atomic operations, any unaligned access will be
    fatal as well.
    
    While the misalignment is only fatal on Arm, a generic check is added
    as an x86 guest shouldn't sensibly pass an unaligned address (this
    would result to a split lock).
    
    This is XSA-327.
    
    Reported-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    master commit: 3fdc211b01b29f252166937238efe02d15cb5780
    master date: 2020-07-07 14:41:00 +0200
---
 xen/common/domain.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 0902a15e8d..30b5f7f898 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1300,10 +1300,20 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
     void *mapping;
     vcpu_info_t *new_info;
     struct page_info *page;
+    unsigned int align;
 
     if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
         return -EINVAL;
 
+#ifdef CONFIG_COMPAT
+    if ( has_32bit_shinfo(d) )
+        align = alignof(new_info->compat);
+    else
+#endif
+        align = alignof(*new_info);
+    if ( offset & (align - 1) )
+        return -EINVAL;
+
     if ( !mfn_eq(v->vcpu_info_mfn, INVALID_MFN) )
         return -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:22:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:22: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 1jsnXy-0006Im-TK; Tue, 07 Jul 2020 13:22:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnXx-0006Ih-H5
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:22:05 +0000
X-Inumbo-ID: d99d3048-c054-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d99d3048-c054-11ea-bca7-bc764e2007e4;
 Tue, 07 Jul 2020 13:22:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=2aHioqQ8wm3j9KYJ+4SGBmOXWfCKIfDAobP6666Q52Q=; b=HIzToG3NuDzBBTq6yYQjpK/dYE
 ydWov+xlA5m6JLkLTNVFpeO8HzOMrMmHybTK2hox/zN1sCbOstRVt3t+4oHsQ95u3D6jSdVPkESeD
 /16CL3rG/Wlz4wOHwi9D0ZcQOuhnXLb0zimIuvZn7DxpQFvwtwgp8w7NgTCpbT0HAKdI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnXw-00044o-Pa
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnXw-0002ka-O8
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:22:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] xen/common: event_channel: Don't ignore error in
 get_free_port()
Message-Id: <E1jsnXw-0002ka-O8@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a634229ecf67e3e06c5dc26701d0561c4e4698d7
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jul 7 15:08:59 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:08:59 2020 +0200

    xen/common: event_channel: Don't ignore error in get_free_port()
    
    Currently, get_free_port() is assuming that the port has been allocated
    when evtchn_allocate_port() is not return -EBUSY.
    
    However, the function may return an error when:
        - We exhausted all the event channels. This can happen if the limit
        configured by the administrator for the guest ('max_event_channels'
        in xl cfg) is higher than the ABI used by the guest. For instance,
        if the guest is using 2L, the limit should not be higher than 4095.
        - We cannot allocate memory (e.g Xen has not more memory).
    
    Users of get_free_port() (such as EVTCHNOP_alloc_unbound) will validly
    assuming the port was valid and will next call evtchn_from_port(). This
    will result to a crash as the memory backing the event channel structure
    is not present.
    
    Fixes: 368ae9a05fe ("xen/pvshim: forward evtchn ops between L0 Xen and L2 DomU")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2e9c2bc292231823a3a021d2e0a9f1956bf00b3c
    master date: 2020-07-07 14:35:36 +0200
---
 xen/common/event_channel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index e86e2bfab0..a8d182b584 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -195,10 +195,10 @@ static int get_free_port(struct domain *d)
     {
         int rc = evtchn_allocate_port(d, port);
 
-        if ( rc == -EBUSY )
-            continue;
-
-        return port;
+        if ( rc == 0 )
+            return port;
+        else if ( rc != -EBUSY )
+            return rc;
     }
 
     return -ENOSPC;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:22:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:22:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsnY8-0006JY-Ut; Tue, 07 Jul 2020 13:22:16 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnY7-0006JM-R3
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:22:15 +0000
X-Inumbo-ID: dfa06d16-c054-11ea-8d6b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id dfa06d16-c054-11ea-8d6b-12813bfff9fa;
 Tue, 07 Jul 2020 13:22:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=uHBXIxD3eQutcm4nQX1BBPHs7O2gPxKTx29nQla9uz0=; b=INO3QeRtXcHm3niq7zdAPBLZZA
 wowo4jnNEG73nnlnzyFz4evI7c3ljCYwCl9OhIXQkD/hNvvXmiSJiblI/kL+GfHs/d/vCDlBi9fpJ
 ee0t9fczS1hJSi/yxCFE9QAvBH0J71s1Gp5KqBKK9iNWsmJ0TChyLj5cJga8LOLWeKCA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnY6-00044u-So
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnY6-0002l8-Rq
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:22:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/shadow: correct an inverted conditional in
 dirty VRAM tracking
Message-Id: <E1jsnY6-0002l8-Rq@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ec57b9af279318c4aee8ca2c60a8ee39563521a5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:09:25 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:09:25 2020 +0200

    x86/shadow: correct an inverted conditional in dirty VRAM tracking
    
    This originally was "mfn_x(mfn) == INVALID_MFN". Make it like this
    again, taking the opportunity to also drop the unnecessary nearby
    braces.
    
    This is XSA-319.
    
    Fixes: 246a5a3377c2 ("xen: Use a typesafe to define INVALID_MFN")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 23a216f99d40fbfbc2318ade89d8213eea6ba1f8
    master date: 2020-07-07 14:36:24 +0200
---
 xen/arch/x86/mm/shadow/common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 1ac5b22028..6595fba04c 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3373,10 +3373,8 @@ int shadow_track_dirty_vram(struct domain *d,
             int dirty = 0;
             paddr_t sl1ma = dirty_vram->sl1ma[i];
 
-            if ( !mfn_eq(mfn, INVALID_MFN) )
-            {
+            if ( mfn_eq(mfn, INVALID_MFN) )
                 dirty = 1;
-            }
             else
             {
                 page = mfn_to_page(mfn);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:22:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnYJ-0006LE-0T; Tue, 07 Jul 2020 13:22:27 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnYH-0006L6-VX
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:22:26 +0000
X-Inumbo-ID: e5a93d0a-c054-11ea-8d6b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e5a93d0a-c054-11ea-8d6b-12813bfff9fa;
 Tue, 07 Jul 2020 13:22:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=9tocKKec8CnZlQ6v2S5BrGuCOl+J3MeDttBQL9Rs6VM=; b=x0lu0JWovkYf5tr4+by8s7LbYD
 hoQgYYsxmabTiy+eRAl6Lci4ThCOoceIfYU3vFHoVMOo4dfEMAUEnjoQqw2u+nQ/exk0W8mfaCMYj
 aKNHw8PM++F8Yhi2tEPr7p+Pq1Z08/kriTwE9U1w7AJcOnGbH/8ElMl2RouOF3OcPNNw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnYH-000455-0r
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:22:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnYG-0002lr-V3
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:22:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/EPT: ept_set_middle_entry() related adjustments
Message-Id: <E1jsnYG-0002lr-V3@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:22:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 731bdaf416800809bc71f19dbdeb726203a2b3ef
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:09:50 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:09:50 2020 +0200

    x86/EPT: ept_set_middle_entry() related adjustments
    
    ept_split_super_page() wants to further modify the newly allocated
    table, so have ept_set_middle_entry() return the mapped pointer rather
    than tearing it down and then getting re-established right again.
    
    Similarly ept_next_level() wants to hand back a mapped pointer of
    the next level page, so re-use the one established by
    ept_set_middle_entry() in case that path was taken.
    
    Pull the setting of suppress_ve ahead of insertion into the higher level
    table, and don't have ept_split_super_page() set the field a 2nd time.
    
    This is part of XSA-328.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 1104288186ee73a7f9bfa41cbaa5bb7611521028
    master date: 2020-07-07 14:36:52 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 41 ++++++++++++++++++-----------------------
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 7937a2214a..eb42248d56 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -187,8 +187,9 @@ static void ept_p2m_type_to_flags(struct p2m_domain *p2m, ept_entry_t *entry,
 #define GUEST_TABLE_SUPER_PAGE  2
 #define GUEST_TABLE_POD_PAGE    3
 
-/* Fill in middle levels of ept table */
-static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
+/* Fill in middle level of ept table; return pointer to mapped new table. */
+static ept_entry_t *ept_set_middle_entry(struct p2m_domain *p2m,
+                                         ept_entry_t *ept_entry)
 {
     mfn_t mfn;
     ept_entry_t *table;
@@ -196,7 +197,12 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     mfn = p2m_alloc_ptp(p2m, 0);
     if ( mfn_eq(mfn, INVALID_MFN) )
-        return 0;
+        return NULL;
+
+    table = map_domain_page(mfn);
+
+    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
+        table[i].suppress_ve = 1;
 
     ept_entry->epte = 0;
     ept_entry->mfn = mfn_x(mfn);
@@ -208,14 +214,7 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     ept_entry->suppress_ve = 1;
 
-    table = map_domain_page(mfn);
-
-    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
-        table[i].suppress_ve = 1;
-
-    unmap_domain_page(table);
-
-    return 1;
+    return table;
 }
 
 /* free ept sub tree behind an entry */
@@ -253,10 +252,10 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
 
     ASSERT(is_epte_superpage(ept_entry));
 
-    if ( !ept_set_middle_entry(p2m, &new_ept) )
+    table = ept_set_middle_entry(p2m, &new_ept);
+    if ( !table )
         return 0;
 
-    table = map_domain_page(_mfn(new_ept.mfn));
     trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER);
 
     for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
@@ -267,7 +266,6 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
         epte->sp = (level > 1);
         epte->mfn += i * trunk;
         epte->snp = (iommu_enabled && iommu_snoop);
-        epte->suppress_ve = 1;
 
         ept_p2m_type_to_flags(p2m, epte, epte->sa_p2mt, epte->access);
 
@@ -306,8 +304,7 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
                           ept_entry_t **table, unsigned long *gfn_remainder,
                           int next_level)
 {
-    unsigned long mfn;
-    ept_entry_t *ept_entry, e;
+    ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
     shift = next_level * EPT_TABLE_ORDER;
@@ -332,19 +329,17 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        if ( !ept_set_middle_entry(p2m, ept_entry) )
+        next = ept_set_middle_entry(p2m, ept_entry);
+        if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        else
-            e = atomic_read_ept_entry(ept_entry); /* Refresh */
+        /* e is now stale and hence may not be used anymore below. */
     }
-
     /* The only time sp would be set here is if we had hit a superpage */
-    if ( is_epte_superpage(&e) )
+    else if ( is_epte_superpage(&e) )
         return GUEST_TABLE_SUPER_PAGE;
 
-    mfn = e.mfn;
     unmap_domain_page(*table);
-    *table = map_domain_page(_mfn(mfn));
+    *table = next ?: map_domain_page(_mfn(e.mfn));
     *gfn_remainder &= (1UL << shift) - 1;
     return GUEST_TABLE_NORMAL_PAGE;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:22:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnYT-0006MO-3H; Tue, 07 Jul 2020 13:22:37 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnYR-0006MC-Vh
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:22:36 +0000
X-Inumbo-ID: ebac408a-c054-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ebac408a-c054-11ea-8496-bc764e2007e4;
 Tue, 07 Jul 2020 13:22:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=VVn3N/J1Uw/nH15tZnhH6lkOTUR3HjVN0sEtXSs4KbA=; b=FmH4qTmcAy/3xcvRSLJpf/3cA8
 N71707ZN05wSm7rwxkrZWsCZA6rQg2EIdk1C3cS4WZN37Bj7FMwI7NCuCwl4hrQohDyBtA5UkVKJV
 x4nMWe/q65YNFKcE4+t2iaIB23x7NPZHAlsEix0B0woaAztg/5kw5kxe3/jRt6+9NKCU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnYR-00045g-3n
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:22:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnYR-0002mc-32
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:22:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/ept: atomically modify entries in
 ept_next_level
Message-Id: <E1jsnYR-0002mc-32@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:22:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 8faa45e25e8b97570b81b46a6b48bdbc8b489b4f
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:10:14 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:10:14 2020 +0200

    x86/ept: atomically modify entries in ept_next_level
    
    ept_next_level was passing a live PTE pointer to ept_set_middle_entry,
    which was then modified without taking into account that the PTE could
    be part of a live EPT table. This wasn't a security issue because the
    pages returned by p2m_alloc_ptp are zeroed, so adding such an entry
    before actually initializing it didn't allow a guest to access
    physical memory addresses it wasn't supposed to access.
    
    This is part of XSA-328.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: bc3d9f95d661372b059a5539ae6cb1e79435bb95
    master date: 2020-07-07 14:37:12 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index eb42248d56..61fc39bac5 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -307,6 +307,8 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
     ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
+    ASSERT(next_level);
+
     shift = next_level * EPT_TABLE_ORDER;
 
     index = *gfn_remainder >> shift;
@@ -323,16 +325,20 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
 
     if ( !is_epte_present(&e) )
     {
+        int rc;
+
         if ( e.sa_p2mt == p2m_populate_on_demand )
             return GUEST_TABLE_POD_PAGE;
 
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        next = ept_set_middle_entry(p2m, ept_entry);
+        next = ept_set_middle_entry(p2m, &e);
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        /* e is now stale and hence may not be used anymore below. */
+
+        rc = atomic_write_ept_entry(p2m, ept_entry, e, next_level);
+        ASSERT(rc == 0);
     }
     /* The only time sp would be set here is if we had hit a superpage */
     else if ( is_epte_superpage(&e) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:22:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnYd-0006NW-52; Tue, 07 Jul 2020 13:22:47 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnYb-0006NJ-S2
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:22:45 +0000
X-Inumbo-ID: f1b87ed0-c054-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f1b87ed0-c054-11ea-bca7-bc764e2007e4;
 Tue, 07 Jul 2020 13:22:45 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=tv8o/44i6nmU6BX26yn/VsMunsHa9jkJ8LytkqJDzGk=; b=6fhN+weLjt6M1ixw37ezH0KR9w
 xOR/HhPoLAOivSpc+0okYa2RRCmAoOlWE8r1V05szdGou5r0g3Rvq6doJ1bjCS/eyXkxm07qybD/f
 OK5af2iscq5AcI3gYB4aDGxtpY9tn0wh/N9aR5MyMS83i0GlN1+G4W8OU05daXK9jgAg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnYb-00045o-77
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:22:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnYb-0002nu-5v
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:22:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] vtd: improve IOMMU TLB flush
Message-Id: <E1jsnYb-0002nu-5v@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:22:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit d69f3058d8357b2c348d37e30d13cf655883cfff
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:10:34 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:10:34 2020 +0200

    vtd: improve IOMMU TLB flush
    
    Do not limit PSI flushes to order 0 pages, in order to avoid doing a
    full TLB flush if the passed in page has an order greater than 0 and
    is aligned. Should increase the performance of IOMMU TLB flushes when
    dealing with page orders greater than 0.
    
    This is part of XSA-321.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 5fe515a0fede07543f2a3b049167b1fd8b873caf
    master date: 2020-07-07 14:37:46 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index ed50d34c91..90cc70b2e1 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -611,13 +611,14 @@ static int __must_check iommu_flush_iotlb(struct domain *d, dfn_t dfn,
         if ( iommu_domid == -1 )
             continue;
 
-        if ( page_count != 1 || dfn_eq(dfn, INVALID_DFN) )
+        if ( !page_count || (page_count & (page_count - 1)) ||
+             dfn_eq(dfn, INVALID_DFN) || !IS_ALIGNED(dfn_x(dfn), page_count) )
             rc = iommu_flush_iotlb_dsi(iommu, iommu_domid,
                                        0, flush_dev_iotlb);
         else
             rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
                                        dfn_to_daddr(dfn),
-                                       PAGE_ORDER_4K,
+                                       get_order_from_pages(page_count),
                                        !dma_old_pte_present,
                                        flush_dev_iotlb);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:22:57 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnYn-0006OO-6e; Tue, 07 Jul 2020 13:22:57 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnYm-0006OG-6g
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:22:56 +0000
X-Inumbo-ID: f7b55a2e-c054-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f7b55a2e-c054-11ea-b7bb-bc764e2007e4;
 Tue, 07 Jul 2020 13:22:55 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=fu5Oyj+bgINXQOPEUz8B1VEMq2eoQ7ulfheHb3ar8TQ=; b=0v5BzK7Lx0HqWjM34Sksy5peOL
 8TM3cuiGhsb8wg+UnhJSviZ/xapgSnFjXlE4pvkOd/r20boO8PgmvLzkaJXaimGqMbLeWMv2ieSGM
 KTvLgM5opV7MUqvx2S/ZA38iS6uyQSVow7wSSzDE1ab3iCLHnYBehJHIa+O5JmHBT+Xg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnYl-00045w-Ad
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:22:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnYl-0002om-9N
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:22:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] vtd: prune (and rename) cache flush functions
Message-Id: <E1jsnYl-0002om-9N@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:22:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 5733de6b88a087ff111ba520cd35d0a79663e5e6
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:10:57 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:10:57 2020 +0200

    vtd: prune (and rename) cache flush functions
    
    Rename __iommu_flush_cache to iommu_sync_cache and remove
    iommu_flush_cache_page. Also remove the iommu_flush_cache_entry
    wrapper and just use iommu_sync_cache instead. Note the _entry suffix
    was meaningless as the wrapper was already taking a size parameter in
    bytes. While there also constify the addr parameter.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 62298825b9a44f45761acbd758138b5ba059ebd1
    master date: 2020-07-07 14:38:13 +0200
---
 xen/drivers/passthrough/vtd/extern.h   |  3 +--
 xen/drivers/passthrough/vtd/intremap.c |  6 +++---
 xen/drivers/passthrough/vtd/iommu.c    | 33 ++++++++++++---------------------
 3 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index a71c8b0f84..d6ffe804a4 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -38,8 +38,7 @@ void disable_qinval(struct iommu *iommu);
 int enable_intremap(struct iommu *iommu, int eim);
 void disable_intremap(struct iommu *iommu);
 
-void iommu_flush_cache_entry(void *addr, unsigned int size);
-void iommu_flush_cache_page(void *addr, unsigned long npages);
+void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index c9927e4706..95782a1f52 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -231,7 +231,7 @@ static void free_remap_entry(struct iommu *iommu, int index)
                      iremap_entries, iremap_entry);
 
     update_irte(iommu, iremap_entry, &new_ire, false);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -403,7 +403,7 @@ static int ioapic_rte_to_remap_entry(struct iommu *iommu,
     }
 
     update_irte(iommu, iremap_entry, &new_ire, !init);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -694,7 +694,7 @@ static int msi_msg_to_remap_entry(
     update_irte(iommu, iremap_entry, &new_ire, msi_desc->irte_initialized);
     msi_desc->irte_initialized = true;
 
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 90cc70b2e1..274d035fb5 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -158,7 +158,8 @@ static void __init free_intel_iommu(struct intel_iommu *intel)
 }
 
 static int iommus_incoherent;
-static void __iommu_flush_cache(void *addr, unsigned int size)
+
+void iommu_sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -173,16 +174,6 @@ static void __iommu_flush_cache(void *addr, unsigned int size)
         cacheline_flush((char *)addr + i);
 }
 
-void iommu_flush_cache_entry(void *addr, unsigned int size)
-{
-    __iommu_flush_cache(addr, size);
-}
-
-void iommu_flush_cache_page(void *addr, unsigned long npages)
-{
-    __iommu_flush_cache(addr, PAGE_SIZE * npages);
-}
-
 /* Allocate page table, return its machine address */
 u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
 {
@@ -207,7 +198,7 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_flush_cache_page(vaddr, 1);
+        iommu_sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -242,7 +233,7 @@ static u64 bus_to_context_maddr(struct iommu *iommu, u8 bus)
         }
         set_root_value(*root, maddr);
         set_root_present(*root);
-        iommu_flush_cache_entry(root, sizeof(struct root_entry));
+        iommu_sync_cache(root, sizeof(struct root_entry));
     }
     maddr = (u64) get_context_addr(*root);
     unmap_vtd_domain_page(root_entries);
@@ -300,7 +291,7 @@ static u64 addr_to_dma_page_maddr(struct domain *domain, u64 addr, int alloc)
              */
             dma_set_pte_readable(*pte);
             dma_set_pte_writable(*pte);
-            iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+            iommu_sync_cache(pte, sizeof(struct dma_pte));
         }
 
         if ( level == 2 )
@@ -681,7 +672,7 @@ static int __must_check dma_pte_clear_one(struct domain *domain, u64 addr,
     *flush_flags |= IOMMU_FLUSHF_modified;
 
     spin_unlock(&hd->arch.mapping_lock);
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     unmap_vtd_domain_page(page);
 
@@ -720,7 +711,7 @@ static void iommu_free_page_table(struct page_info *pg)
             iommu_free_pagetable(dma_pte_addr(*pte), next_level);
 
         dma_clear_pte(*pte);
-        iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+        iommu_sync_cache(pte, sizeof(struct dma_pte));
     }
 
     unmap_vtd_domain_page(pt_vaddr);
@@ -1449,7 +1440,7 @@ int domain_context_mapping_one(
     context_set_address_width(*context, agaw);
     context_set_fault_enable(*context);
     context_set_present(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
     spin_unlock(&iommu->lock);
 
     /* Context entry was previously non-present (with domid 0). */
@@ -1602,7 +1593,7 @@ int domain_context_unmap_one(
 
     context_clear_present(*context);
     context_clear_entry(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
 
     iommu_domid= domain_iommu_domid(domain, iommu);
     if ( iommu_domid == -1 )
@@ -1837,7 +1828,7 @@ static int __must_check intel_iommu_map_page(struct domain *d, dfn_t dfn,
 
     *pte = new;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
     spin_unlock(&hd->arch.mapping_lock);
     unmap_vtd_domain_page(page);
 
@@ -1912,7 +1903,7 @@ int iommu_pte_flush(struct domain *d, uint64_t dfn, uint64_t *pte,
     int iommu_domid;
     int rc = 0;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     for_each_drhd_unit ( drhd )
     {
@@ -2777,7 +2768,7 @@ static int __init intel_iommu_quarantine_init(struct domain *d)
             dma_set_pte_addr(*pte, maddr);
             dma_set_pte_readable(*pte);
         }
-        iommu_flush_cache_page(parent, 1);
+        iommu_sync_cache(parent, PAGE_SIZE);
 
         unmap_vtd_domain_page(parent);
         parent = map_vtd_domain_page(maddr);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:23:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnYx-0006QC-8M; Tue, 07 Jul 2020 13:23:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnYw-0006PB-5v
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:23:06 +0000
X-Inumbo-ID: fdbe3850-c054-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id fdbe3850-c054-11ea-bb8b-bc764e2007e4;
 Tue, 07 Jul 2020 13:23:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=nOsVa4Un9q0VlYP331PxqXccJz8zMI2nlG0BJytBims=; b=m5Awta8gz7bdecalfDMk7foiJI
 1+0r1eSvLjrkknAdMXWpwpycyPEcWPE2r2K3xNkMKjVgi/OC2lXRADihFtA2B4OMGdJvqRKJ5o/Gf
 1SM4UwIC6bR4rGJgK2N4D9wCwSCBQccHcqYjYQvsARQcqr8LO9Ttb2zqT34IaKQHGqnc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnYv-00046N-EJ
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:23:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnYv-0002qD-D4
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:23:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/iommu: introduce a cache sync hook
Message-Id: <E1jsnYv-0002qD-D4@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:23:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 38dc269ea444fb02a054423cb430ea6c717cd906
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:11:18 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:11:18 2020 +0200

    x86/iommu: introduce a cache sync hook
    
    The hook is only implemented for VT-d and it uses the already existing
    iommu_sync_cache function present in VT-d code. The new hook is
    added so that the cache can be flushed by code outside of VT-d when
    using shared page tables.
    
    Note that alloc_pgtable_maddr must use the now locally defined
    sync_cache function, because IOMMU ops are not yet setup the first
    time the function gets called during IOMMU initialization.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 91526b460e5009fc56edbd6809e66c327281faba
    master date: 2020-07-07 14:38:34 +0200
---
 xen/drivers/passthrough/vtd/extern.h | 1 -
 xen/drivers/passthrough/vtd/iommu.c  | 5 +++--
 xen/include/asm-x86/iommu.h          | 7 +++++++
 xen/include/xen/iommu.h              | 1 +
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index d6ffe804a4..01d60a4644 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -38,7 +38,6 @@ void disable_qinval(struct iommu *iommu);
 int enable_intremap(struct iommu *iommu, int eim);
 void disable_intremap(struct iommu *iommu);
 
-void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 274d035fb5..02a57a3da6 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -159,7 +159,7 @@ static void __init free_intel_iommu(struct intel_iommu *intel)
 
 static int iommus_incoherent;
 
-void iommu_sync_cache(const void *addr, unsigned int size)
+static void sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -198,7 +198,7 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_sync_cache(vaddr, PAGE_SIZE);
+        sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -2813,6 +2813,7 @@ const struct iommu_ops __initconstrel intel_iommu_ops = {
     .iotlb_flush_all = iommu_flush_iotlb_all,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_p2m_table = vtd_dump_p2m_table,
+    .sync_cache = sync_cache,
 };
 
 /*
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 8dc392473d..f5cb04d032 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -101,6 +101,13 @@ extern bool untrusted_msi;
 int pi_update_irte(const struct pi_desc *pi_desc, const struct pirq *pirq,
                    const uint8_t gvec);
 
+#define iommu_sync_cache(addr, size) ({                 \
+    const struct iommu_ops *ops = iommu_get_ops();      \
+                                                        \
+    if ( ops->sync_cache )                              \
+        ops->sync_cache(addr, size);                    \
+})
+
 #endif /* !__ARCH_X86_IOMMU_H__ */
 /*
  * Local variables:
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 617c993f50..262679485d 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -221,6 +221,7 @@ struct iommu_ops {
     void (*update_ire_from_apic)(unsigned int apic, unsigned int reg, unsigned int value);
     unsigned int (*read_apic_from_ire)(unsigned int apic, unsigned int reg);
     int (*setup_hpet_msi)(struct msi_desc *);
+    void (*sync_cache)(const void *addr, unsigned int size);
 #endif /* CONFIG_X86 */
     int __must_check (*suspend)(void);
     void (*resume)(void);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:23:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnZ7-0006RA-A5; Tue, 07 Jul 2020 13:23:17 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnZ6-0006R0-5B
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:23:16 +0000
X-Inumbo-ID: 03c7a2cc-c055-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 03c7a2cc-c055-11ea-bb8b-bc764e2007e4;
 Tue, 07 Jul 2020 13:23:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=E6sSa4FBxw1L7YWVduQ/XZEY8xSG4jvhfqLoiWn5m8U=; b=lM6Opt4W7gkB8cB0xWea6ofBFB
 p902Gi0N6AlM24YPNYIvyeIKz7vCNxOpop+LQLt2tXw25ruesHILTfwrGntjfOrCKxGFEBIF1pnvf
 xUAmoZrzWvZqcks0kYWv8pqGsj3StsbuACCN2bA3a92K+EzXXVAbVlRTGWTIdSrhrisY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnZ5-00046U-HF
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:23:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnZ5-0002rH-Ga
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:23:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] vtd: don't assume addresses are aligned in
 sync_cache
Message-Id: <E1jsnZ5-0002rH-Ga@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:23:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit b292255ea232625a8e872db15bf49f527dfe12ae
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:11:55 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:11:55 2020 +0200

    vtd: don't assume addresses are aligned in sync_cache
    
    Current code in sync_cache assume that the address passed in is
    aligned to a cache line size. Fix the code to support passing in
    arbitrary addresses not necessarily aligned to a cache line size.
    
    This is part of XSA-321.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b6d9398144f21718d25daaf8d72669a75592abc5
    master date: 2020-07-07 14:39:05 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 02a57a3da6..4cb90633dc 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -161,8 +161,8 @@ static int iommus_incoherent;
 
 static void sync_cache(const void *addr, unsigned int size)
 {
-    int i;
-    static unsigned int clflush_size = 0;
+    static unsigned long clflush_size = 0;
+    const void *end = addr + size;
 
     if ( !iommus_incoherent )
         return;
@@ -170,8 +170,9 @@ static void sync_cache(const void *addr, unsigned int size)
     if ( clflush_size == 0 )
         clflush_size = get_cache_line_size();
 
-    for ( i = 0; i < size; i += clflush_size )
-        cacheline_flush((char *)addr + i);
+    addr -= (unsigned long)addr & (clflush_size - 1);
+    for ( ; addr < end; addr += clflush_size )
+        cacheline_flush((char *)addr);
 }
 
 /* Allocate page table, return its machine address */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:23:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnZI-0006Su-DF; Tue, 07 Jul 2020 13:23:28 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnZG-0006Sk-N4
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:23:26 +0000
X-Inumbo-ID: 09c55ebc-c055-11ea-8d6b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 09c55ebc-c055-11ea-8d6b-12813bfff9fa;
 Tue, 07 Jul 2020 13:23:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=wxLQDfcOvlv1wyhipDag0Ehb/Ytv6GW8tCPE+HrFB40=; b=JCAKnCCeHwuKm29vol4C+Rxfvw
 SGIY3yqJlx0mkEEbUibRiU71NwGgpAhhOi+eW9+Phmy1cbhN/fuiO37HiMXZcqcp0KvZtjG9gEd1Q
 lBfopS96quIxX+z0kFOmsFsUVbnCZdtPSnGoMjJH4aRv1jaxDgWWahQPQNZZ+1eXmQkE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnZF-00046f-KM
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:23:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnZF-0002sT-JU
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:23:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/alternative: introduce alternative_2
Message-Id: <E1jsnZF-0002sT-JU@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:23:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 26072a508d07e347eb9b59167325c9a54707baab
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:12:16 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:12:16 2020 +0200

    x86/alternative: introduce alternative_2
    
    It's based on alternative_io_2 without inputs or outputs but with an
    added memory clobber.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 23570bce00ee6ba2139ece978ab6f03ff166e21d
    master date: 2020-07-07 14:39:25 +0200
---
 xen/include/asm-x86/alternative.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h
index d96411f0f3..6e827cf34f 100644
--- a/xen/include/asm-x86/alternative.h
+++ b/xen/include/asm-x86/alternative.h
@@ -113,6 +113,11 @@ extern void alternative_instructions(void);
 #define alternative(oldinstr, newinstr, feature)                        \
         asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) : : : "memory")
 
+#define alternative_2(oldinstr, newinstr1, feature1, newinstr2, feature2) \
+	asm volatile (ALTERNATIVE_2(oldinstr, newinstr1, feature1,	\
+				    newinstr2, feature2)		\
+		      : : : "memory")
+
 /*
  * Alternative inline assembly with input.
  *
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:23:38 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnZS-0006UA-Ej; Tue, 07 Jul 2020 13:23:38 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnZQ-0006Tx-Uf
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:23:36 +0000
X-Inumbo-ID: 0fca1e1a-c055-11ea-8d6b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 0fca1e1a-c055-11ea-8d6b-12813bfff9fa;
 Tue, 07 Jul 2020 13:23:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=yf62JQxYsrR7WGJnYv0wQFtMcCxGkTDIYvbP2lgGN1U=; b=aEjHX+SJHUcOndKrwodIBSy1iE
 vKTZY8L2uikE8bd4sN4PNp1toAczX2ng2XYbvIoXYfrhOJAybZDM9qcPXZC0TfXQqOhBKpv3Ctrp1
 AOpfUamdVtqdggA9lXts3VTZiUx3cvIQyASEwBNimyKP0WyM6oJ145hEFHaTLfRN21BI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnZP-00047S-NS
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:23:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnZP-0002tE-Md
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:23:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] vtd: optimize CPU cache sync
Message-Id: <E1jsnZP-0002tE-Md@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:23:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 653811e2d276eafd0d2199c7db40a04176a25599
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:12:46 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:12:46 2020 +0200

    vtd: optimize CPU cache sync
    
    Some VT-d IOMMUs are non-coherent, which requires a cache write back
    in order for the changes made by the CPU to be visible to the IOMMU.
    This cache write back was unconditionally done using clflush, but there are
    other more efficient instructions to do so, hence implement support
    for them using the alternative framework.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a64ea16522a73a13a0d66cfa4b66a9d3b95dd9d6
    master date: 2020-07-07 14:39:54 +0200
---
 xen/drivers/passthrough/vtd/extern.h  |  1 -
 xen/drivers/passthrough/vtd/iommu.c   | 38 ++++++++++++++++++++++++++++++++++-
 xen/drivers/passthrough/vtd/x86/vtd.c |  5 -----
 3 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 01d60a4644..97181757ac 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -64,7 +64,6 @@ int __must_check qinval_device_iotlb_sync(struct iommu *iommu,
                                           u16 did, u16 size, u64 addr);
 
 unsigned int get_cache_line_size(void);
-void cacheline_flush(char *);
 void flush_all_cache(void);
 
 u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 4cb90633dc..19f51026a4 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -31,6 +31,7 @@
 #include <xen/pci_regs.h>
 #include <xen/keyhandler.h>
 #include <asm/msi.h>
+#include <asm/nops.h>
 #include <asm/irq.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/p2m.h>
@@ -172,7 +173,42 @@ static void sync_cache(const void *addr, unsigned int size)
 
     addr -= (unsigned long)addr & (clflush_size - 1);
     for ( ; addr < end; addr += clflush_size )
-        cacheline_flush((char *)addr);
+/*
+ * The arguments to a macro must not include preprocessor directives. Doing so
+ * results in undefined behavior, so we have to create some defines here in
+ * order to avoid it.
+ */
+#if defined(HAVE_AS_CLWB)
+# define CLWB_ENCODING "clwb %[p]"
+#elif defined(HAVE_AS_XSAVEOPT)
+# define CLWB_ENCODING "data16 xsaveopt %[p]" /* clwb */
+#else
+# define CLWB_ENCODING ".byte 0x66, 0x0f, 0xae, 0x30" /* clwb (%%rax) */
+#endif
+
+#define BASE_INPUT(addr) [p] "m" (*(const char *)(addr))
+#if defined(HAVE_AS_CLWB) || defined(HAVE_AS_XSAVEOPT)
+# define INPUT BASE_INPUT
+#else
+# define INPUT(addr) "a" (addr), BASE_INPUT(addr)
+#endif
+        /*
+         * Note regarding the use of NOP_DS_PREFIX: it's faster to do a clflush
+         * + prefix than a clflush + nop, and hence the prefix is added instead
+         * of letting the alternative framework fill the gap by appending nops.
+         */
+        alternative_io_2(".byte " __stringify(NOP_DS_PREFIX) "; clflush %[p]",
+                         "data16 clflush %[p]", /* clflushopt */
+                         X86_FEATURE_CLFLUSHOPT,
+                         CLWB_ENCODING,
+                         X86_FEATURE_CLWB, /* no outputs */,
+                         INPUT(addr));
+#undef INPUT
+#undef BASE_INPUT
+#undef CLWB_ENCODING
+
+    alternative_2("", "sfence", X86_FEATURE_CLFLUSHOPT,
+                      "sfence", X86_FEATURE_CLWB);
 }
 
 /* Allocate page table, return its machine address */
diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c
index ff456e1e70..229938f3a8 100644
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -51,11 +51,6 @@ unsigned int get_cache_line_size(void)
     return ((cpuid_ebx(1) >> 8) & 0xff) * 8;
 }
 
-void cacheline_flush(char * addr)
-{
-    clflush(addr);
-}
-
 void flush_all_cache()
 {
     wbinvd();
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:23:48 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnZc-0006VH-GN; Tue, 07 Jul 2020 13:23:48 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnZa-0006V4-QC
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:23:46 +0000
X-Inumbo-ID: 15d2f818-c055-11ea-8d6b-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 15d2f818-c055-11ea-8d6b-12813bfff9fa;
 Tue, 07 Jul 2020 13:23:46 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=k0M/mSNXwxWc75YO0tARtSITiFh4EHU0HtSXnhnghHc=; b=BoPu/CH6ijABKTD0eFeUnHV+AH
 5vEMI8W654jOpfvbjgA/pCLPKzx/ZpDiBL+wlzfc9NhBy60qSoXe2PRKZIJFvB8bxfw2ChWiAv2Iy
 zMU4ybiB8OVE3LvHu6rz2TtSFEKZ7oqtq+k1/h+WHdTtRdB47hj6GvTfldiCib2cIkRc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnZZ-00047a-RP
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:23:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnZZ-0002uJ-Pr
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:23:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] x86/ept: flush cache when modifying PTEs and
 sharing page tables
Message-Id: <E1jsnZZ-0002uJ-Pr@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:23:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit d96c0f1ed540cf78e2f83d29d30e4f155c4b1cb4
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:13:07 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:13:07 2020 +0200

    x86/ept: flush cache when modifying PTEs and sharing page tables
    
    Modifications made to the page tables by EPT code need to be written
    to memory when the page tables are shared with the IOMMU, as Intel
    IOMMUs can be non-coherent and thus require changes to be written to
    memory in order to be visible to the IOMMU.
    
    In order to achieve this make sure data is written back to memory
    after writing an EPT entry when the recalc bit is not set in
    atomic_write_ept_entry. If such bit is set, the entry will be
    adjusted and atomic_write_ept_entry will be called a second time
    without the recalc bit set. Note that when splitting a super page the
    new tables resulting of the split should also be written back.
    
    Failure to do so can allow devices behind the IOMMU access to the
    stale super page, or cause coherency issues as changes made by the
    processor to the page tables are not visible to the IOMMU.
    
    This allows to remove the VT-d specific iommu_pte_flush helper, since
    the cache write back is now performed by atomic_write_ept_entry, and
    hence iommu_iotlb_flush can be used to flush the IOMMU TLB. The newly
    used method (iommu_iotlb_flush) can result in less flushes, since it
    might sometimes be called rightly with 0 flags, in which case it
    becomes a no-op.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c23274fd0412381bd75068ebc9f8f8c90a4be748
    master date: 2020-07-07 14:40:11 +0200
---
 xen/arch/x86/mm/p2m-ept.c           | 24 ++++++++++++++++++-
 xen/drivers/passthrough/vtd/iommu.c | 47 -------------------------------------
 xen/include/asm-x86/iommu.h         |  2 --
 3 files changed, 23 insertions(+), 50 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 61fc39bac5..5822ca77ca 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -58,6 +58,19 @@ static int atomic_write_ept_entry(struct p2m_domain *p2m,
 
     write_atomic(&entryptr->epte, new.epte);
 
+    /*
+     * The recalc field on the EPT is used to signal either that a
+     * recalculation of the EMT field is required (which doesn't effect the
+     * IOMMU), or a type change. Type changes can only be between ram_rw,
+     * logdirty and ioreq_server: changes to/from logdirty won't work well with
+     * an IOMMU anyway, as IOMMU #PFs are not synchronous and will lead to
+     * aborts, and changes to/from ioreq_server are already fully flushed
+     * before returning to guest context (see
+     * XEN_DMOP_map_mem_type_to_ioreq_server).
+     */
+    if ( !new.recalc && iommu_use_hap_pt(p2m->domain) )
+        iommu_sync_cache(entryptr, sizeof(*entryptr));
+
     return 0;
 }
 
@@ -278,6 +291,9 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
             break;
     }
 
+    if ( iommu_use_hap_pt(p2m->domain) )
+        iommu_sync_cache(table, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
     unmap_domain_page(table);
 
     /* Even failed we should install the newly allocated ept page. */
@@ -337,6 +353,9 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
 
+        if ( iommu_use_hap_pt(p2m->domain) )
+            iommu_sync_cache(next, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
         rc = atomic_write_ept_entry(p2m, ept_entry, e, next_level);
         ASSERT(rc == 0);
     }
@@ -815,7 +834,10 @@ out:
          need_modify_vtd_table )
     {
         if ( iommu_use_hap_pt(d) )
-            rc = iommu_pte_flush(d, gfn, &ept_entry->epte, order, vtd_pte_present);
+            rc = iommu_iotlb_flush(d, _dfn(gfn), (1u << order),
+                                   (iommu_flags ? IOMMU_FLUSHF_added : 0) |
+                                   (vtd_pte_present ? IOMMU_FLUSHF_modified
+                                                    : 0));
         else if ( need_iommu_pt_sync(d) )
             rc = iommu_flags ?
                 iommu_legacy_map(d, _dfn(gfn), mfn, order, iommu_flags) :
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 19f51026a4..f36fded6fe 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1930,53 +1930,6 @@ static int intel_iommu_lookup_page(struct domain *d, dfn_t dfn, mfn_t *mfn,
     return 0;
 }
 
-int iommu_pte_flush(struct domain *d, uint64_t dfn, uint64_t *pte,
-                    int order, int present)
-{
-    struct acpi_drhd_unit *drhd;
-    struct iommu *iommu = NULL;
-    struct domain_iommu *hd = dom_iommu(d);
-    bool_t flush_dev_iotlb;
-    int iommu_domid;
-    int rc = 0;
-
-    iommu_sync_cache(pte, sizeof(struct dma_pte));
-
-    for_each_drhd_unit ( drhd )
-    {
-        iommu = drhd->iommu;
-        if ( !test_bit(iommu->index, &hd->arch.iommu_bitmap) )
-            continue;
-
-        flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
-        iommu_domid= domain_iommu_domid(d, iommu);
-        if ( iommu_domid == -1 )
-            continue;
-
-        rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
-                                   __dfn_to_daddr(dfn),
-                                   order, !present, flush_dev_iotlb);
-        if ( rc > 0 )
-        {
-            iommu_flush_write_buffer(iommu);
-            rc = 0;
-        }
-    }
-
-    if ( unlikely(rc) )
-    {
-        if ( !d->is_shutting_down && printk_ratelimit() )
-            printk(XENLOG_ERR VTDPREFIX
-                   " d%d: IOMMU pages flush failed: %d\n",
-                   d->domain_id, rc);
-
-        if ( !is_hardware_domain(d) )
-            domain_crash(d);
-    }
-
-    return rc;
-}
-
 static int __init vtd_ept_page_compatible(struct iommu *iommu)
 {
     u64 ept_cap, vtd_cap = iommu->cap;
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index f5cb04d032..fc51508e9d 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -90,8 +90,6 @@ int iommu_setup_hpet_msi(struct msi_desc *);
 
 /* While VT-d specific, this must get declared in a generic header. */
 int adjust_vtd_irq_affinities(void);
-int __must_check iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
-                                 int order, int present);
 bool_t iommu_supports_eim(void);
 int iommu_enable_x2apic_IR(void);
 void iommu_disable_x2apic_IR(void);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:23:58 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnZm-0006WF-I1; Tue, 07 Jul 2020 13:23:58 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnZk-0006W1-IP
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:23:56 +0000
X-Inumbo-ID: 1bd81252-c055-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 1bd81252-c055-11ea-b7bb-bc764e2007e4;
 Tue, 07 Jul 2020 13:23:56 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=8yBqWoBqKJa8mnnxO6uXd6ehOTjDs+GEVCV6+j41LPU=; b=yq2yOEQ2RdIedNMTFesbopeje3
 8sJlPjI5ECWGGjYqo3WrdMDvULIYEOkz1qnsgMbWvUoBAU7gAxE0BG/PTIKeA4UZ57LDeilfD16bv
 5/PFxa6eabcnEgpLziVTpeR8uZxBWQJNk7RIs64kWg5x//4yy9PzP2zs5sqCcW/sq+xI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnZj-00047i-Uo
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:23:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnZj-0002vL-Tc
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:23:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.12] xen: Check the alignment of the offset pased via
 VCPUOP_register_vcpu_info
Message-Id: <E1jsnZj-0002vL-Tc@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:23:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 19e0bbb4eba8d781b972448ec01ede6ca7fa22cb
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jul 7 15:13:40 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:13:40 2020 +0200

    xen: Check the alignment of the offset pased via VCPUOP_register_vcpu_info
    
    Currently a guest is able to register any guest physical address to use
    for the vcpu_info structure as long as the structure can fits in the
    rest of the frame.
    
    This means a guest can provide an address that is not aligned to the
    natural alignment of the structure.
    
    On Arm 32-bit, unaligned access are completely forbidden by the
    hypervisor. This will result to a data abort which is fatal.
    
    On Arm 64-bit, unaligned access are only forbidden when used for atomic
    access. As the structure contains fields (such as evtchn_pending_self)
    that are updated using atomic operations, any unaligned access will be
    fatal as well.
    
    While the misalignment is only fatal on Arm, a generic check is added
    as an x86 guest shouldn't sensibly pass an unaligned address (this
    would result to a split lock).
    
    This is XSA-327.
    
    Reported-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    master commit: 3fdc211b01b29f252166937238efe02d15cb5780
    master date: 2020-07-07 14:41:00 +0200
---
 xen/common/domain.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 7f8fc43cbe..5f94651f11 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1253,10 +1253,20 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
     void *mapping;
     vcpu_info_t *new_info;
     struct page_info *page;
+    unsigned int align;
 
     if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
         return -EINVAL;
 
+#ifdef CONFIG_COMPAT
+    if ( has_32bit_shinfo(d) )
+        align = alignof(new_info->compat);
+    else
+#endif
+        align = alignof(*new_info);
+    if ( offset & (align - 1) )
+        return -EINVAL;
+
     if ( !mfn_eq(v->vcpu_info_mfn, INVALID_MFN) )
         return -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.12


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:33:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:33: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 1jsnic-0007Ql-HJ; Tue, 07 Jul 2020 13:33:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnib-0007Pv-Vy
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:33:06 +0000
X-Inumbo-ID: 633d0714-c056-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 633d0714-c056-11ea-b7bb-bc764e2007e4;
 Tue, 07 Jul 2020 13:33:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=+IDVFEfvflyl31My2+aEfSJp0xpFuURSVY0n8OS7Co0=; b=VkXvz9+MRYWlcTq/c+gjt2THdk
 mxtz/2QM7zj5kKSn3Sx698SNNrRRBnEe8HZPlGnqX7o0gnZZ3g2WeVPOBceB0H4UyPdo29OPDLmmI
 m68IyRZnUlauwXRCyQEzN9lXb1sDTXzzRWnlQh1WADHvGI6YcumXsWxWUe/SM86Bi8cE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnib-0004IB-5t
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnib-0003bh-3E
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:33:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.11] xen/common: event_channel: Don't ignore error in
 get_free_port()
Message-Id: <E1jsnib-0003bh-3E@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:33:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit e96cdba338e9f14e745a2725f181f5deec848b55
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jul 7 15:18:59 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:18:59 2020 +0200

    xen/common: event_channel: Don't ignore error in get_free_port()
    
    Currently, get_free_port() is assuming that the port has been allocated
    when evtchn_allocate_port() is not return -EBUSY.
    
    However, the function may return an error when:
        - We exhausted all the event channels. This can happen if the limit
        configured by the administrator for the guest ('max_event_channels'
        in xl cfg) is higher than the ABI used by the guest. For instance,
        if the guest is using 2L, the limit should not be higher than 4095.
        - We cannot allocate memory (e.g Xen has not more memory).
    
    Users of get_free_port() (such as EVTCHNOP_alloc_unbound) will validly
    assuming the port was valid and will next call evtchn_from_port(). This
    will result to a crash as the memory backing the event channel structure
    is not present.
    
    Fixes: 368ae9a05fe ("xen/pvshim: forward evtchn ops between L0 Xen and L2 DomU")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2e9c2bc292231823a3a021d2e0a9f1956bf00b3c
    master date: 2020-07-07 14:35:36 +0200
---
 xen/common/event_channel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index c62046590b..c692bd2175 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -195,10 +195,10 @@ static int get_free_port(struct domain *d)
     {
         int rc = evtchn_allocate_port(d, port);
 
-        if ( rc == -EBUSY )
-            continue;
-
-        return port;
+        if ( rc == 0 )
+            return port;
+        else if ( rc != -EBUSY )
+            return rc;
     }
 
     return -ENOSPC;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:33:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnim-0007Rt-J2; Tue, 07 Jul 2020 13:33:16 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnil-0007Pv-UX
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:33:15 +0000
X-Inumbo-ID: 693e83e0-c056-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 693e83e0-c056-11ea-bca7-bc764e2007e4;
 Tue, 07 Jul 2020 13:33:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=p336jW8As7jO8xbS2jg46iEZBwR5ltAzrbWoFJPaKlk=; b=FmFG2ocFjUA3Vc2gVs1auFbaRz
 DyU/Xq/1QwRrUTMlEcS9V7Sg9gm08dAmkVq4dzTVmIlXoGCGw1CTU0FzVYTQ38Q2Kw6zEYLdu5V6c
 RsmrzOEDqPb7w6eoF6DddXjSKw25QnP9V5+RTOvxnoDR+JHmxHvy/y4c3EqDYv1sHjfI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnil-0004IL-9C
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnil-0003ck-8K
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:33:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.11] x86/shadow: correct an inverted conditional in
 dirty VRAM tracking
Message-Id: <E1jsnil-0003ck-8K@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:33:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a3a392ef21ee562cead19d6fe34ac260aa9c0788
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:19:40 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:19:40 2020 +0200

    x86/shadow: correct an inverted conditional in dirty VRAM tracking
    
    This originally was "mfn_x(mfn) == INVALID_MFN". Make it like this
    again, taking the opportunity to also drop the unnecessary nearby
    braces.
    
    This is XSA-319.
    
    Fixes: 246a5a3377c2 ("xen: Use a typesafe to define INVALID_MFN")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 23a216f99d40fbfbc2318ade89d8213eea6ba1f8
    master date: 2020-07-07 14:36:24 +0200
---
 xen/arch/x86/mm/shadow/common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 34913c1ade..0b8682d7a9 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3881,10 +3881,8 @@ int shadow_track_dirty_vram(struct domain *d,
             int dirty = 0;
             paddr_t sl1ma = dirty_vram->sl1ma[i];
 
-            if ( !mfn_eq(mfn, INVALID_MFN) )
-            {
+            if ( mfn_eq(mfn, INVALID_MFN) )
                 dirty = 1;
-            }
             else
             {
                 page = mfn_to_page(mfn);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:33:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsniw-0007Tf-M6; Tue, 07 Jul 2020 13:33:26 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsniw-0007TY-5N
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:33:26 +0000
X-Inumbo-ID: 6f4172d4-c056-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6f4172d4-c056-11ea-bb8b-bc764e2007e4;
 Tue, 07 Jul 2020 13:33:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=0hfzOn8PelGT9GmcLMMlteLnuKbIQ8YPmnMMq1+f7so=; b=vyZRJW4wjswgwN4OSmz4NwhC1y
 O5ufLObLVRpObKcmWoR9OwyF5zfUFrKUCCPwMIwv7VsS/jxT//mqStaZ2X4KsSNjzaa8hT6lyzRub
 xz6Zgq6hUQPZZd4cpYMtZYEPjWPb89K6FVPIScMIhlASVWv1wlh52LhQPboYfkySKPCY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsniv-0004IV-CM
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsniv-0003dZ-BO
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:33:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.11] x86/EPT: ept_set_middle_entry() related adjustments
Message-Id: <E1jsniv-0003dZ-BO@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:33:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 18be3aabd83fa9f683e8ddb0bca2066dd302c20e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:20:10 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:20:10 2020 +0200

    x86/EPT: ept_set_middle_entry() related adjustments
    
    ept_split_super_page() wants to further modify the newly allocated
    table, so have ept_set_middle_entry() return the mapped pointer rather
    than tearing it down and then getting re-established right again.
    
    Similarly ept_next_level() wants to hand back a mapped pointer of
    the next level page, so re-use the one established by
    ept_set_middle_entry() in case that path was taken.
    
    Pull the setting of suppress_ve ahead of insertion into the higher level
    table, and don't have ept_split_super_page() set the field a 2nd time.
    
    This is part of XSA-328.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 1104288186ee73a7f9bfa41cbaa5bb7611521028
    master date: 2020-07-07 14:36:52 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 41 ++++++++++++++++++-----------------------
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index ca18e43580..2ec66c21f8 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -228,8 +228,9 @@ static void ept_p2m_type_to_flags(struct p2m_domain *p2m, ept_entry_t *entry,
 #define GUEST_TABLE_SUPER_PAGE  2
 #define GUEST_TABLE_POD_PAGE    3
 
-/* Fill in middle levels of ept table */
-static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
+/* Fill in middle level of ept table; return pointer to mapped new table. */
+static ept_entry_t *ept_set_middle_entry(struct p2m_domain *p2m,
+                                         ept_entry_t *ept_entry)
 {
     mfn_t mfn;
     ept_entry_t *table;
@@ -237,7 +238,12 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     mfn = p2m_alloc_ptp(p2m, 0);
     if ( mfn_eq(mfn, INVALID_MFN) )
-        return 0;
+        return NULL;
+
+    table = map_domain_page(mfn);
+
+    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
+        table[i].suppress_ve = 1;
 
     ept_entry->epte = 0;
     ept_entry->mfn = mfn_x(mfn);
@@ -249,14 +255,7 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     ept_entry->suppress_ve = 1;
 
-    table = map_domain_page(mfn);
-
-    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
-        table[i].suppress_ve = 1;
-
-    unmap_domain_page(table);
-
-    return 1;
+    return table;
 }
 
 /* free ept sub tree behind an entry */
@@ -294,10 +293,10 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
 
     ASSERT(is_epte_superpage(ept_entry));
 
-    if ( !ept_set_middle_entry(p2m, &new_ept) )
+    table = ept_set_middle_entry(p2m, &new_ept);
+    if ( !table )
         return 0;
 
-    table = map_domain_page(_mfn(new_ept.mfn));
     trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER);
 
     for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
@@ -308,7 +307,6 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
         epte->sp = (level > 1);
         epte->mfn += i * trunk;
         epte->snp = (iommu_enabled && iommu_snoop);
-        epte->suppress_ve = 1;
 
         ept_p2m_type_to_flags(p2m, epte, epte->sa_p2mt, epte->access);
 
@@ -347,8 +345,7 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
                           ept_entry_t **table, unsigned long *gfn_remainder,
                           int next_level)
 {
-    unsigned long mfn;
-    ept_entry_t *ept_entry, e;
+    ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
     shift = next_level * EPT_TABLE_ORDER;
@@ -373,19 +370,17 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        if ( !ept_set_middle_entry(p2m, ept_entry) )
+        next = ept_set_middle_entry(p2m, ept_entry);
+        if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        else
-            e = atomic_read_ept_entry(ept_entry); /* Refresh */
+        /* e is now stale and hence may not be used anymore below. */
     }
-
     /* The only time sp would be set here is if we had hit a superpage */
-    if ( is_epte_superpage(&e) )
+    else if ( is_epte_superpage(&e) )
         return GUEST_TABLE_SUPER_PAGE;
 
-    mfn = e.mfn;
     unmap_domain_page(*table);
-    *table = map_domain_page(_mfn(mfn));
+    *table = next ?: map_domain_page(_mfn(e.mfn));
     *gfn_remainder &= (1UL << shift) - 1;
     return GUEST_TABLE_NORMAL_PAGE;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:33:36 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnj6-0007Ur-Ni; Tue, 07 Jul 2020 13:33:36 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnj6-0007Uj-2y
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:33:36 +0000
X-Inumbo-ID: 75446dc6-c056-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 75446dc6-c056-11ea-8496-bc764e2007e4;
 Tue, 07 Jul 2020 13:33:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=r1GBqdvrLS0gpv5n4pZgipCYt3PM//jaF+QgCMUYscQ=; b=V3og8/ruJcqrnc3old7vY4NjLE
 B//ch7wkm4PdKIPXYkaed1UelFE91PceHanek1sm1FSuDrCFZe10+LTrLhxSkDp2tf+3GoKRMLtF7
 zXn/dLIi6/t3iHCPWegxKLmydVbEvMeC55kxYeWhD5+A/ZuJa0sahwP5wS24YNDZ694U=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnj5-0004JK-Fd
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:33:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnj5-0003eb-ES
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:33:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.11] x86/ept: atomically modify entries in
 ept_next_level
Message-Id: <E1jsnj5-0003eb-ES@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:33:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 7def72c0de00b4f833da4896fd5f07ecec5c3fa9
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:20:36 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:20:36 2020 +0200

    x86/ept: atomically modify entries in ept_next_level
    
    ept_next_level was passing a live PTE pointer to ept_set_middle_entry,
    which was then modified without taking into account that the PTE could
    be part of a live EPT table. This wasn't a security issue because the
    pages returned by p2m_alloc_ptp are zeroed, so adding such an entry
    before actually initializing it didn't allow a guest to access
    physical memory addresses it wasn't supposed to access.
    
    This is part of XSA-328.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: bc3d9f95d661372b059a5539ae6cb1e79435bb95
    master date: 2020-07-07 14:37:12 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 2ec66c21f8..fb2dfdb985 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -348,6 +348,8 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
     ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
+    ASSERT(next_level);
+
     shift = next_level * EPT_TABLE_ORDER;
 
     index = *gfn_remainder >> shift;
@@ -364,16 +366,20 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
 
     if ( !is_epte_present(&e) )
     {
+        int rc;
+
         if ( e.sa_p2mt == p2m_populate_on_demand )
             return GUEST_TABLE_POD_PAGE;
 
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        next = ept_set_middle_entry(p2m, ept_entry);
+        next = ept_set_middle_entry(p2m, &e);
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        /* e is now stale and hence may not be used anymore below. */
+
+        rc = atomic_write_ept_entry(ept_entry, e, next_level);
+        ASSERT(rc == 0);
     }
     /* The only time sp would be set here is if we had hit a superpage */
     else if ( is_epte_superpage(&e) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:33:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnjH-0007WB-PM; Tue, 07 Jul 2020 13:33:47 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnjG-0007W1-Ep
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:33:46 +0000
X-Inumbo-ID: 7a608f7f-c056-11ea-8d72-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7a608f7f-c056-11ea-8d72-12813bfff9fa;
 Tue, 07 Jul 2020 13:33:45 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=N8y9hffz2naVuywibFaFU0UHDufsZcIvPgRt3WW/sTM=; b=xA1SFtsPA3Jiv3WeSNYoBQXm1c
 SKlhSNeb37TBOI4FDwfpC/xB9+v9Vxc817jyjWQoGCdp0EfGo/Tf2aNeJyVLReX0PTTOp2xCZu2pJ
 +Tw+zhqx80hYHw0zR4ET19uikY0hWBvOj1ui7FZQNtdscQw6y1SXgsP/S3SLxPvDfPjY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnjF-0004JW-KB
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:33:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnjF-0003g1-Ix
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:33:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.11] vtd: improve IOMMU TLB flush
Message-Id: <E1jsnjF-0003g1-Ix@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:33:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 4ed000741e34431fa53d21ebdb93e50f5d407033
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:21:34 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:21:34 2020 +0200

    vtd: improve IOMMU TLB flush
    
    Do not limit PSI flushes to order 0 pages, in order to avoid doing a
    full TLB flush if the passed in page has an order greater than 0 and
    is aligned. Should increase the performance of IOMMU TLB flushes when
    dealing with page orders greater than 0.
    
    This is part of XSA-321.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 5fe515a0fede07543f2a3b049167b1fd8b873caf
    master date: 2020-07-07 14:37:46 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 4e5e2342df..52bf0d9d23 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -612,13 +612,14 @@ static int __must_check iommu_flush_iotlb(struct domain *d,
         if ( iommu_domid == -1 )
             continue;
 
-        if ( page_count != 1 || gfn == gfn_x(INVALID_GFN) )
+        if ( !page_count || (page_count & (page_count - 1)) ||
+             gfn == gfn_x(INVALID_GFN) || !IS_ALIGNED(gfn, page_count) )
             rc = iommu_flush_iotlb_dsi(iommu, iommu_domid,
                                        0, flush_dev_iotlb);
         else
             rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
                                        (paddr_t)gfn << PAGE_SHIFT_4K,
-                                       PAGE_ORDER_4K,
+                                       get_order_from_pages(page_count),
                                        !dma_old_pte_present,
                                        flush_dev_iotlb);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:33:56 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnjQ-0007XD-R5; Tue, 07 Jul 2020 13:33:56 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnjQ-0007X3-5w
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:33:56 +0000
X-Inumbo-ID: 81578418-c056-11ea-8d72-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 81578418-c056-11ea-8d72-12813bfff9fa;
 Tue, 07 Jul 2020 13:33:55 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Hfw/Y0UgLqjaR6JuU4/PPp85gIMZhZxME1ZchAKKElg=; b=0y+UOHpQ+7uS8p6uzuqkN3c9xU
 0lLFb2nMI6RDcjDBuAabRAJl/KZvvwruZVhbrbPfsSIFVRc2iQYShTC/L+uy2IAcYeTFU/alDBvmp
 oTczPwVD1ArPuR6aP4XTF9rvJkG9yT5uMyTZeIIqEVLN2WF61zV741PdkTwXuHv5TQ7I=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnjP-0004Ji-Nk
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:33:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnjP-0003h7-Mv
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:33:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.11] vtd: prune (and rename) cache flush functions
Message-Id: <E1jsnjP-0003h7-Mv@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:33:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 2d11e6d694877620d7784a0bcebf9e869d41a14c
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:22:16 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:22:16 2020 +0200

    vtd: prune (and rename) cache flush functions
    
    Rename __iommu_flush_cache to iommu_sync_cache and remove
    iommu_flush_cache_page. Also remove the iommu_flush_cache_entry
    wrapper and just use iommu_sync_cache instead. Note the _entry suffix
    was meaningless as the wrapper was already taking a size parameter in
    bytes. While there also constify the addr parameter.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 62298825b9a44f45761acbd758138b5ba059ebd1
    master date: 2020-07-07 14:38:13 +0200
---
 xen/drivers/passthrough/vtd/extern.h   |  3 +--
 xen/drivers/passthrough/vtd/intremap.c |  6 +++---
 xen/drivers/passthrough/vtd/iommu.c    | 33 ++++++++++++---------------------
 3 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index d698b1d50a..87d5ed78a2 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -37,8 +37,7 @@ void disable_qinval(struct iommu *iommu);
 int enable_intremap(struct iommu *iommu, int eim);
 void disable_intremap(struct iommu *iommu);
 
-void iommu_flush_cache_entry(void *addr, unsigned int size);
-void iommu_flush_cache_page(void *addr, unsigned long npages);
+void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index 5f620c3202..eac20ede31 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -231,7 +231,7 @@ static void free_remap_entry(struct iommu *iommu, int index)
                      iremap_entries, iremap_entry);
 
     update_irte(iommu, iremap_entry, &new_ire, false);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -403,7 +403,7 @@ static int ioapic_rte_to_remap_entry(struct iommu *iommu,
     }
 
     update_irte(iommu, iremap_entry, &new_ire, !init);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -694,7 +694,7 @@ static int msi_msg_to_remap_entry(
     update_irte(iommu, iremap_entry, &new_ire, msi_desc->irte_initialized);
     msi_desc->irte_initialized = true;
 
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 52bf0d9d23..ff9151a54b 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -158,7 +158,8 @@ static void __init free_intel_iommu(struct intel_iommu *intel)
 }
 
 static int iommus_incoherent;
-static void __iommu_flush_cache(void *addr, unsigned int size)
+
+void iommu_sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -173,16 +174,6 @@ static void __iommu_flush_cache(void *addr, unsigned int size)
         cacheline_flush((char *)addr + i);
 }
 
-void iommu_flush_cache_entry(void *addr, unsigned int size)
-{
-    __iommu_flush_cache(addr, size);
-}
-
-void iommu_flush_cache_page(void *addr, unsigned long npages)
-{
-    __iommu_flush_cache(addr, PAGE_SIZE * npages);
-}
-
 /* Allocate page table, return its machine address */
 u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
 {
@@ -207,7 +198,7 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_flush_cache_page(vaddr, 1);
+        iommu_sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -242,7 +233,7 @@ static u64 bus_to_context_maddr(struct iommu *iommu, u8 bus)
         }
         set_root_value(*root, maddr);
         set_root_present(*root);
-        iommu_flush_cache_entry(root, sizeof(struct root_entry));
+        iommu_sync_cache(root, sizeof(struct root_entry));
     }
     maddr = (u64) get_context_addr(*root);
     unmap_vtd_domain_page(root_entries);
@@ -300,7 +291,7 @@ static u64 addr_to_dma_page_maddr(struct domain *domain, u64 addr, int alloc)
              */
             dma_set_pte_readable(*pte);
             dma_set_pte_writable(*pte);
-            iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+            iommu_sync_cache(pte, sizeof(struct dma_pte));
         }
 
         if ( level == 2 )
@@ -674,7 +665,7 @@ static int __must_check dma_pte_clear_one(struct domain *domain, u64 addr)
 
     dma_clear_pte(*pte);
     spin_unlock(&hd->arch.mapping_lock);
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     if ( !this_cpu(iommu_dont_flush_iotlb) )
         rc = iommu_flush_iotlb_pages(domain, addr >> PAGE_SHIFT_4K, 1);
@@ -716,7 +707,7 @@ static void iommu_free_page_table(struct page_info *pg)
             iommu_free_pagetable(dma_pte_addr(*pte), next_level);
 
         dma_clear_pte(*pte);
-        iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+        iommu_sync_cache(pte, sizeof(struct dma_pte));
     }
 
     unmap_vtd_domain_page(pt_vaddr);
@@ -1449,7 +1440,7 @@ int domain_context_mapping_one(
     context_set_address_width(*context, agaw);
     context_set_fault_enable(*context);
     context_set_present(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
     spin_unlock(&iommu->lock);
 
     /* Context entry was previously non-present (with domid 0). */
@@ -1602,7 +1593,7 @@ int domain_context_unmap_one(
 
     context_clear_present(*context);
     context_clear_entry(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
 
     iommu_domid= domain_iommu_domid(domain, iommu);
     if ( iommu_domid == -1 )
@@ -1828,7 +1819,7 @@ static int __must_check intel_iommu_map_page(struct domain *d,
 
     *pte = new;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
     spin_unlock(&hd->arch.mapping_lock);
     unmap_vtd_domain_page(page);
 
@@ -1862,7 +1853,7 @@ int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
     int iommu_domid;
     int rc = 0;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     for_each_drhd_unit ( drhd )
     {
@@ -2725,7 +2716,7 @@ static int __init intel_iommu_quarantine_init(struct domain *d)
             dma_set_pte_addr(*pte, maddr);
             dma_set_pte_readable(*pte);
         }
-        iommu_flush_cache_page(parent, 1);
+        iommu_sync_cache(parent, PAGE_SIZE);
 
         unmap_vtd_domain_page(parent);
         parent = map_vtd_domain_page(maddr);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:34:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jsnjb-0007YW-Sf; Tue, 07 Jul 2020 13:34:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnja-0007YK-Ic
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:34:06 +0000
X-Inumbo-ID: 875d847a-c056-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 875d847a-c056-11ea-b7bb-bc764e2007e4;
 Tue, 07 Jul 2020 13:34:06 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=peQRa/jDU2gd0Qpk94LGSfaviqOibCEUT4KG1b5bG/4=; b=GOckejjzpG1IRtN1AvCAV/mvy5
 1DvxXw8gZLkswBCfmtPazcHjf+jDQVDSD5qSm9OknFi1SXBYvBJY0ifwMWjphQYjCbzB55kVgwQfW
 68cwxiS8fTsDnT3M8DvXwzFc2ttndHO9k/Uk3/dF78xPCI/tMiJv1zN0AvHpbj70BJ+o=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnjZ-0004K2-RI
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:34:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnjZ-0003hx-Q2
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:34:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.11] x86/iommu: introduce a cache sync hook
Message-Id: <E1jsnjZ-0003hx-Q2@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:34:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 8bf72ea432bb078d9483639d4bf9b756333374a9
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:22:47 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:22:47 2020 +0200

    x86/iommu: introduce a cache sync hook
    
    The hook is only implemented for VT-d and it uses the already existing
    iommu_sync_cache function present in VT-d code. The new hook is
    added so that the cache can be flushed by code outside of VT-d when
    using shared page tables.
    
    Note that alloc_pgtable_maddr must use the now locally defined
    sync_cache function, because IOMMU ops are not yet setup the first
    time the function gets called during IOMMU initialization.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 91526b460e5009fc56edbd6809e66c327281faba
    master date: 2020-07-07 14:38:34 +0200
---
 xen/drivers/passthrough/vtd/extern.h | 1 -
 xen/drivers/passthrough/vtd/iommu.c  | 5 +++--
 xen/include/asm-x86/iommu.h          | 7 +++++++
 xen/include/xen/iommu.h              | 1 +
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 87d5ed78a2..00a73d63ea 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -37,7 +37,6 @@ void disable_qinval(struct iommu *iommu);
 int enable_intremap(struct iommu *iommu, int eim);
 void disable_intremap(struct iommu *iommu);
 
-void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index ff9151a54b..facd84ffc8 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -159,7 +159,7 @@ static void __init free_intel_iommu(struct intel_iommu *intel)
 
 static int iommus_incoherent;
 
-void iommu_sync_cache(const void *addr, unsigned int size)
+static void sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -198,7 +198,7 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_sync_cache(vaddr, PAGE_SIZE);
+        sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -2760,6 +2760,7 @@ const struct iommu_ops intel_iommu_ops = {
     .iotlb_flush_all = iommu_flush_iotlb_all,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_p2m_table = vtd_dump_p2m_table,
+    .sync_cache = sync_cache,
 };
 
 /*
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index dcf2e21402..16ff2e94c2 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -98,6 +98,13 @@ extern bool untrusted_msi;
 int pi_update_irte(const struct pi_desc *pi_desc, const struct pirq *pirq,
                    const uint8_t gvec);
 
+#define iommu_sync_cache(addr, size) ({                 \
+    const struct iommu_ops *ops = iommu_get_ops();      \
+                                                        \
+    if ( ops->sync_cache )                              \
+        ops->sync_cache(addr, size);                    \
+})
+
 #endif /* !__ARCH_X86_IOMMU_H__ */
 /*
  * Local variables:
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index a0573b659c..bd8379a7d9 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -161,6 +161,7 @@ struct iommu_ops {
     void (*update_ire_from_apic)(unsigned int apic, unsigned int reg, unsigned int value);
     unsigned int (*read_apic_from_ire)(unsigned int apic, unsigned int reg);
     int (*setup_hpet_msi)(struct msi_desc *);
+    void (*sync_cache)(const void *addr, unsigned int size);
 #endif /* CONFIG_X86 */
     int __must_check (*suspend)(void);
     void (*resume)(void);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:34:19 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:34: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 1jsnjm-0007Zz-Vk; Tue, 07 Jul 2020 13:34:18 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnjl-0007Zj-Fh
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:34:17 +0000
X-Inumbo-ID: 8d65c166-c056-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8d65c166-c056-11ea-8496-bc764e2007e4;
 Tue, 07 Jul 2020 13:34:16 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=CJFfLb3r5KDkC0vwMf5sq5BDSmMMXMr1GWwwO975Vns=; b=wBuli3GkvQix2MB9DeiC75F27y
 XPlIoCr5wtiWGiuRsihmCsfJ2sQSl2hqKufYMP6/wfCoDB7WAKtq+PxERhZe8pFh4m7e44cF+e9eJ
 mo0a2qHkLF6U0PRdyIFJDlMcPVjSIDxd/0LQperJ5ZZKvAWXzHv+vHLi+X9go7e5yQyo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnjj-0004KE-UU
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:34:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnjj-0003jA-Td
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:34:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.11] vtd: don't assume addresses are aligned in
 sync_cache
Message-Id: <E1jsnjj-0003jA-Td@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:34:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 37c853a0bcb214f3de66cc44622287ef89cb51d1
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:23:26 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:23:26 2020 +0200

    vtd: don't assume addresses are aligned in sync_cache
    
    Current code in sync_cache assume that the address passed in is
    aligned to a cache line size. Fix the code to support passing in
    arbitrary addresses not necessarily aligned to a cache line size.
    
    This is part of XSA-321.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b6d9398144f21718d25daaf8d72669a75592abc5
    master date: 2020-07-07 14:39:05 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index facd84ffc8..270eb1c31a 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -161,8 +161,8 @@ static int iommus_incoherent;
 
 static void sync_cache(const void *addr, unsigned int size)
 {
-    int i;
-    static unsigned int clflush_size = 0;
+    static unsigned long clflush_size = 0;
+    const void *end = addr + size;
 
     if ( !iommus_incoherent )
         return;
@@ -170,8 +170,9 @@ static void sync_cache(const void *addr, unsigned int size)
     if ( clflush_size == 0 )
         clflush_size = get_cache_line_size();
 
-    for ( i = 0; i < size; i += clflush_size )
-        cacheline_flush((char *)addr + i);
+    addr -= (unsigned long)addr & (clflush_size - 1);
+    for ( ; addr < end; addr += clflush_size )
+        cacheline_flush((char *)addr);
 }
 
 /* Allocate page table, return its machine address */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:34:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:34:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsnjw-0007bW-11; Tue, 07 Jul 2020 13:34:28 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnju-0007bK-Jd
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:34:26 +0000
X-Inumbo-ID: 93662402-c056-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 93662402-c056-11ea-bca7-bc764e2007e4;
 Tue, 07 Jul 2020 13:34:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=jhsobbd0YXit/gWVhUA2YDTt8w+hC8My7GOH2e6tKQw=; b=N9jWFEhgFysavjGgoDYEXi3OKU
 RopZzC2qcWM3OoVh3NGOAlJI4+zpk0eDUhJNGHYnFYBtLZYrDNW76i+ZdB0JMK95RINQBT4+N2Wrb
 AlLRlZ+g1SQT+WIuQYRXaCfBiADiWoZVrBXGxSxXf+MxTbXAf0S9etzWi2uS7hxPdGNw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnju-0004KH-1C
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:34:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnju-0003kz-0O
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:34:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.11] x86/alternative: introduce alternative_2
Message-Id: <E1jsnju-0003kz-0O@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:34:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit d62365801ae339f00708cd66aef7d53caea685ad
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:23:55 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:23:55 2020 +0200

    x86/alternative: introduce alternative_2
    
    It's based on alternative_io_2 without inputs or outputs but with an
    added memory clobber.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 23570bce00ee6ba2139ece978ab6f03ff166e21d
    master date: 2020-07-07 14:39:25 +0200
---
 xen/include/asm-x86/alternative.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h
index 619472efcb..3e608e8633 100644
--- a/xen/include/asm-x86/alternative.h
+++ b/xen/include/asm-x86/alternative.h
@@ -113,6 +113,11 @@ extern void alternative_instructions(void);
 #define alternative(oldinstr, newinstr, feature)                        \
         asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) : : : "memory")
 
+#define alternative_2(oldinstr, newinstr1, feature1, newinstr2, feature2) \
+	asm volatile (ALTERNATIVE_2(oldinstr, newinstr1, feature1,	\
+				    newinstr2, feature2)		\
+		      : : : "memory")
+
 /*
  * Alternative inline assembly with input.
  *
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:34:38 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:34:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsnk6-0007cl-2U; Tue, 07 Jul 2020 13:34:38 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnk4-0007ca-Ht
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:34:36 +0000
X-Inumbo-ID: 996b6790-c056-11ea-8d72-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 996b6790-c056-11ea-8d72-12813bfff9fa;
 Tue, 07 Jul 2020 13:34:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Ne3j5hI2lsuv/f85wLo+s9Kk/jD+YPr+eGfo/umoMds=; b=IfK9N+Rqb/wcOSGy0NrUY+kCT1
 oaHMNME8af3tAKbtpN6cC4ojJDPgDj4BUBQvxXh6IaIU0KtMlJ/Cbe/IV1nkMhFZpfeZAjzRZ4XNg
 ou/qZo72LG3pwgadRS6szwn7PJ8cDt5gizJbur9kNFmE33n0VPY/8Tjq+eY85IHG9gpk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnk4-0004Kl-4G
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:34:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnk4-0003lo-3U
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:34:36 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.11] vtd: optimize CPU cache sync
Message-Id: <E1jsnk4-0003lo-3U@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:34:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit f2bc74c120bdb25446684c5375d1cc51d4702da4
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:24:30 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:24:30 2020 +0200

    vtd: optimize CPU cache sync
    
    Some VT-d IOMMUs are non-coherent, which requires a cache write back
    in order for the changes made by the CPU to be visible to the IOMMU.
    This cache write back was unconditionally done using clflush, but there are
    other more efficient instructions to do so, hence implement support
    for them using the alternative framework.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a64ea16522a73a13a0d66cfa4b66a9d3b95dd9d6
    master date: 2020-07-07 14:39:54 +0200
---
 xen/drivers/passthrough/vtd/extern.h  |  1 -
 xen/drivers/passthrough/vtd/iommu.c   | 38 ++++++++++++++++++++++++++++++++++-
 xen/drivers/passthrough/vtd/x86/vtd.c |  5 -----
 3 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 00a73d63ea..065d768b52 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -63,7 +63,6 @@ int __must_check qinval_device_iotlb_sync(struct iommu *iommu,
                                           u16 did, u16 size, u64 addr);
 
 unsigned int get_cache_line_size(void);
-void cacheline_flush(char *);
 void flush_all_cache(void);
 
 u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 270eb1c31a..05fe61f69e 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -31,6 +31,7 @@
 #include <xen/pci_regs.h>
 #include <xen/keyhandler.h>
 #include <asm/msi.h>
+#include <asm/nops.h>
 #include <asm/irq.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/p2m.h>
@@ -172,7 +173,42 @@ static void sync_cache(const void *addr, unsigned int size)
 
     addr -= (unsigned long)addr & (clflush_size - 1);
     for ( ; addr < end; addr += clflush_size )
-        cacheline_flush((char *)addr);
+/*
+ * The arguments to a macro must not include preprocessor directives. Doing so
+ * results in undefined behavior, so we have to create some defines here in
+ * order to avoid it.
+ */
+#if defined(HAVE_AS_CLWB)
+# define CLWB_ENCODING "clwb %[p]"
+#elif defined(HAVE_AS_XSAVEOPT)
+# define CLWB_ENCODING "data16 xsaveopt %[p]" /* clwb */
+#else
+# define CLWB_ENCODING ".byte 0x66, 0x0f, 0xae, 0x30" /* clwb (%%rax) */
+#endif
+
+#define BASE_INPUT(addr) [p] "m" (*(const char *)(addr))
+#if defined(HAVE_AS_CLWB) || defined(HAVE_AS_XSAVEOPT)
+# define INPUT BASE_INPUT
+#else
+# define INPUT(addr) "a" (addr), BASE_INPUT(addr)
+#endif
+        /*
+         * Note regarding the use of NOP_DS_PREFIX: it's faster to do a clflush
+         * + prefix than a clflush + nop, and hence the prefix is added instead
+         * of letting the alternative framework fill the gap by appending nops.
+         */
+        alternative_io_2(".byte " __stringify(NOP_DS_PREFIX) "; clflush %[p]",
+                         "data16 clflush %[p]", /* clflushopt */
+                         X86_FEATURE_CLFLUSHOPT,
+                         CLWB_ENCODING,
+                         X86_FEATURE_CLWB, /* no outputs */,
+                         INPUT(addr));
+#undef INPUT
+#undef BASE_INPUT
+#undef CLWB_ENCODING
+
+    alternative_2("", "sfence", X86_FEATURE_CLFLUSHOPT,
+                      "sfence", X86_FEATURE_CLWB);
 }
 
 /* Allocate page table, return its machine address */
diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c
index 88a60b3307..7f96b91dd4 100644
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -53,11 +53,6 @@ unsigned int get_cache_line_size(void)
     return ((cpuid_ebx(1) >> 8) & 0xff) * 8;
 }
 
-void cacheline_flush(char * addr)
-{
-    clflush(addr);
-}
-
 void flush_all_cache()
 {
     wbinvd();
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:34:48 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:34:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsnkG-0007dr-45; Tue, 07 Jul 2020 13:34:48 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnkE-0007dc-L0
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:34:46 +0000
X-Inumbo-ID: 9f487312-c056-11ea-8d72-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 9f487312-c056-11ea-8d72-12813bfff9fa;
 Tue, 07 Jul 2020 13:34:46 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=mhcmLOi1f8Os04wSUzdU24zMBXwJIAjKMmuLO+raYe4=; b=N1R8AyCRPxgHKUGVeiPnGhQfHL
 CjpMDIYNcdOOm8G++D3EagwZt/P3D7LIzXvWcgQkXs2wWBGQF7+YHGeSvumd+XQAprTEgbvRgWjQu
 0LQvyw97sd38oeP2yTzmC51mCmZgyhYmoR+TAZxuZRabKfKHcyZeP++lLnCfg0NxqLxE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnkE-0004Kt-7L
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:34:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnkE-0003mr-6a
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:34:46 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.11] x86/ept: flush cache when modifying PTEs and
 sharing page tables
Message-Id: <E1jsnkE-0003mr-6a@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:34:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit e6ddf4a1bd8ab88f6fec83a57d64e9bbc8cca9b8
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:24:55 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:24:55 2020 +0200

    x86/ept: flush cache when modifying PTEs and sharing page tables
    
    Modifications made to the page tables by EPT code need to be written
    to memory when the page tables are shared with the IOMMU, as Intel
    IOMMUs can be non-coherent and thus require changes to be written to
    memory in order to be visible to the IOMMU.
    
    In order to achieve this make sure data is written back to memory
    after writing an EPT entry when the recalc bit is not set in
    atomic_write_ept_entry. If such bit is set, the entry will be
    adjusted and atomic_write_ept_entry will be called a second time
    without the recalc bit set. Note that when splitting a super page the
    new tables resulting of the split should also be written back.
    
    Failure to do so can allow devices behind the IOMMU access to the
    stale super page, or cause coherency issues as changes made by the
    processor to the page tables are not visible to the IOMMU.
    
    This allows to remove the VT-d specific iommu_pte_flush helper, since
    the cache write back is now performed by atomic_write_ept_entry, and
    hence iommu_iotlb_flush can be used to flush the IOMMU TLB. The newly
    used method (iommu_iotlb_flush) can result in less flushes, since it
    might sometimes be called rightly with 0 flags, in which case it
    becomes a no-op.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c23274fd0412381bd75068ebc9f8f8c90a4be748
    master date: 2020-07-07 14:40:11 +0200
---
 xen/arch/x86/mm/p2m-ept.c           | 21 ++++++++++++++-
 xen/drivers/passthrough/vtd/iommu.c | 53 ++-----------------------------------
 xen/include/asm-x86/iommu.h         |  5 ++--
 3 files changed, 25 insertions(+), 54 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index fb2dfdb985..02071752e8 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -90,6 +90,19 @@ static int atomic_write_ept_entry(ept_entry_t *entryptr, ept_entry_t new,
 
     write_atomic(&entryptr->epte, new.epte);
 
+    /*
+     * The recalc field on the EPT is used to signal either that a
+     * recalculation of the EMT field is required (which doesn't effect the
+     * IOMMU), or a type change. Type changes can only be between ram_rw,
+     * logdirty and ioreq_server: changes to/from logdirty won't work well with
+     * an IOMMU anyway, as IOMMU #PFs are not synchronous and will lead to
+     * aborts, and changes to/from ioreq_server are already fully flushed
+     * before returning to guest context (see
+     * XEN_DMOP_map_mem_type_to_ioreq_server).
+     */
+    if ( !new.recalc && iommu_hap_pt_share )
+        iommu_sync_cache(entryptr, sizeof(*entryptr));
+
     if ( unlikely(oldmfn != mfn_x(INVALID_MFN)) )
         put_page(mfn_to_page(_mfn(oldmfn)));
 
@@ -319,6 +332,9 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
             break;
     }
 
+    if ( iommu_hap_pt_share )
+        iommu_sync_cache(table, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
     unmap_domain_page(table);
 
     /* Even failed we should install the newly allocated ept page. */
@@ -378,6 +394,9 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
 
+        if ( iommu_hap_pt_share )
+            iommu_sync_cache(next, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
         rc = atomic_write_ept_entry(ept_entry, e, next_level);
         ASSERT(rc == 0);
     }
@@ -875,7 +894,7 @@ out:
          need_modify_vtd_table )
     {
         if ( iommu_hap_pt_share )
-            rc = iommu_pte_flush(d, gfn, &ept_entry->epte, order, vtd_pte_present);
+            rc = iommu_flush_iotlb(d, gfn, vtd_pte_present, 1u << order);
         else
         {
             if ( iommu_flags )
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 05fe61f69e..f499c6f430 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -612,10 +612,8 @@ static int __must_check iommu_flush_all(void)
     return rc;
 }
 
-static int __must_check iommu_flush_iotlb(struct domain *d,
-                                          unsigned long gfn,
-                                          bool_t dma_old_pte_present,
-                                          unsigned int page_count)
+int iommu_flush_iotlb(struct domain *d, unsigned long gfn,
+                      bool dma_old_pte_present, unsigned int page_count)
 {
     struct domain_iommu *hd = dom_iommu(d);
     struct acpi_drhd_unit *drhd;
@@ -1880,53 +1878,6 @@ static int __must_check intel_iommu_unmap_page(struct domain *d,
     return dma_pte_clear_one(d, (paddr_t)gfn << PAGE_SHIFT_4K);
 }
 
-int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
-                    int order, int present)
-{
-    struct acpi_drhd_unit *drhd;
-    struct iommu *iommu = NULL;
-    struct domain_iommu *hd = dom_iommu(d);
-    bool_t flush_dev_iotlb;
-    int iommu_domid;
-    int rc = 0;
-
-    iommu_sync_cache(pte, sizeof(struct dma_pte));
-
-    for_each_drhd_unit ( drhd )
-    {
-        iommu = drhd->iommu;
-        if ( !test_bit(iommu->index, &hd->arch.iommu_bitmap) )
-            continue;
-
-        flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
-        iommu_domid= domain_iommu_domid(d, iommu);
-        if ( iommu_domid == -1 )
-            continue;
-
-        rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
-                                   (paddr_t)gfn << PAGE_SHIFT_4K,
-                                   order, !present, flush_dev_iotlb);
-        if ( rc > 0 )
-        {
-            iommu_flush_write_buffer(iommu);
-            rc = 0;
-        }
-    }
-
-    if ( unlikely(rc) )
-    {
-        if ( !d->is_shutting_down && printk_ratelimit() )
-            printk(XENLOG_ERR VTDPREFIX
-                   " d%d: IOMMU pages flush failed: %d\n",
-                   d->domain_id, rc);
-
-        if ( !is_hardware_domain(d) )
-            domain_crash(d);
-    }
-
-    return rc;
-}
-
 static int __init vtd_ept_page_compatible(struct iommu *iommu)
 {
     u64 ept_cap, vtd_cap = iommu->cap;
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 16ff2e94c2..dfc9b77594 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -87,8 +87,9 @@ int iommu_setup_hpet_msi(struct msi_desc *);
 
 /* While VT-d specific, this must get declared in a generic header. */
 int adjust_vtd_irq_affinities(void);
-int __must_check iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
-                                 int order, int present);
+int __must_check iommu_flush_iotlb(struct domain *d, unsigned long gfn,
+                                   bool dma_old_pte_present,
+                                   unsigned int page_count);
 bool_t iommu_supports_eim(void);
 int iommu_enable_x2apic_IR(void);
 void iommu_disable_x2apic_IR(void);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:34:58 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:34:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsnkQ-0007es-5t; Tue, 07 Jul 2020 13:34:58 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnkO-0007ef-QQ
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:34:56 +0000
X-Inumbo-ID: a57e791e-c056-11ea-8d72-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a57e791e-c056-11ea-8d72-12813bfff9fa;
 Tue, 07 Jul 2020 13:34:56 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=VPR5Qb8BF/vq0Uyz2E8MqlooVe3PXq+Gc4tzS4Fjw00=; b=eJVQtmAFrc+diFRVOamtouvan2
 S0NfFSbu0Qur7tQiyXk4obELikhrkRvx0s4RdssMruPZ9uq0BDIZe462AkxSfSsexGf7eXoYdqmjP
 63jhRgCm0434YZpeCDQCBtc/DmV5gt/btLb3rtBuHRN7RsEkvtj6tglFgifyHPWt94so=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnkO-0004L1-Ay
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:34:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnkO-0003o2-9Y
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:34:56 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.11] xen: Check the alignment of the offset pased via
 VCPUOP_register_vcpu_info
Message-Id: <E1jsnkO-0003o2-9Y@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:34:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ddaaccbbab6b19bf21ed2c097f3055a3c2544c8d
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jul 7 15:25:34 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:25:34 2020 +0200

    xen: Check the alignment of the offset pased via VCPUOP_register_vcpu_info
    
    Currently a guest is able to register any guest physical address to use
    for the vcpu_info structure as long as the structure can fits in the
    rest of the frame.
    
    This means a guest can provide an address that is not aligned to the
    natural alignment of the structure.
    
    On Arm 32-bit, unaligned access are completely forbidden by the
    hypervisor. This will result to a data abort which is fatal.
    
    On Arm 64-bit, unaligned access are only forbidden when used for atomic
    access. As the structure contains fields (such as evtchn_pending_self)
    that are updated using atomic operations, any unaligned access will be
    fatal as well.
    
    While the misalignment is only fatal on Arm, a generic check is added
    as an x86 guest shouldn't sensibly pass an unaligned address (this
    would result to a split lock).
    
    This is XSA-327.
    
    Reported-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    master commit: 3fdc211b01b29f252166937238efe02d15cb5780
    master date: 2020-07-07 14:41:00 +0200
---
 xen/common/domain.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 24377011b0..2ddd7986c1 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1186,10 +1186,20 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
     void *mapping;
     vcpu_info_t *new_info;
     struct page_info *page;
+    unsigned int align;
 
     if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
         return -EINVAL;
 
+#ifdef CONFIG_COMPAT
+    if ( has_32bit_shinfo(d) )
+        align = alignof(new_info->compat);
+    else
+#endif
+        align = alignof(*new_info);
+    if ( offset & (align - 1) )
+        return -EINVAL;
+
     if ( !mfn_eq(v->vcpu_info_mfn, INVALID_MFN) )
         return -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.11


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:35:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:35: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 1jsnkb-0007g3-7c; Tue, 07 Jul 2020 13:35:09 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnka-0007fr-1e
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:35:08 +0000
X-Inumbo-ID: abf561a4-c056-11ea-8d73-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id abf561a4-c056-11ea-8d73-12813bfff9fa;
 Tue, 07 Jul 2020 13:35:07 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=aTaWNhzndctTRjWJ00qtoN95XxAuK4F3kNI894EPwNE=; b=VyyfUUXiS2cIX0/2OuZP/BjTPW
 oQy6q2gwtdzCNzW8yOPvIMfGYvQHc5daXx7RvpzlxX1VzDuRU0v2PaGbfPqP6kRk7rSPaCv7KUikx
 GRCRbmGAp+VXtF++o8DaQqDsYkf1XePV49EEm59T6wGL+NzZw3PBIo/F4sUOjMNxE1mk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnkZ-0004LM-7Z
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:35:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnkZ-0003qq-70
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:35:07 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] xen/common: event_channel: Don't ignore error in
 get_free_port()
Message-Id: <E1jsnkZ-0003qq-70@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:35:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 6261a06d990cc50ea8765356d296a61cc2d4a3e5
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jul 7 15:27:47 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:27:47 2020 +0200

    xen/common: event_channel: Don't ignore error in get_free_port()
    
    Currently, get_free_port() is assuming that the port has been allocated
    when evtchn_allocate_port() is not return -EBUSY.
    
    However, the function may return an error when:
        - We exhausted all the event channels. This can happen if the limit
        configured by the administrator for the guest ('max_event_channels'
        in xl cfg) is higher than the ABI used by the guest. For instance,
        if the guest is using 2L, the limit should not be higher than 4095.
        - We cannot allocate memory (e.g Xen has not more memory).
    
    Users of get_free_port() (such as EVTCHNOP_alloc_unbound) will validly
    assuming the port was valid and will next call evtchn_from_port(). This
    will result to a crash as the memory backing the event channel structure
    is not present.
    
    Fixes: 368ae9a05fe ("xen/pvshim: forward evtchn ops between L0 Xen and L2 DomU")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2e9c2bc292231823a3a021d2e0a9f1956bf00b3c
    master date: 2020-07-07 14:35:36 +0200
---
 xen/common/event_channel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index be834c5c78..07ef45a140 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -202,10 +202,10 @@ static int get_free_port(struct domain *d)
     {
         int rc = evtchn_allocate_port(d, port);
 
-        if ( rc == -EBUSY )
-            continue;
-
-        return port;
+        if ( rc == 0 )
+            return port;
+        else if ( rc != -EBUSY )
+            return rc;
     }
 
     return -ENOSPC;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:35:19 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:35:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsnkl-0007hM-AW; Tue, 07 Jul 2020 13:35:19 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnkj-0007hB-Sn
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:35:17 +0000
X-Inumbo-ID: b1fd66d2-c056-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b1fd66d2-c056-11ea-bb8b-bc764e2007e4;
 Tue, 07 Jul 2020 13:35:17 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=TJQ1Flx5roqbRHh23RKvgQc59Q3QcjvRQsZtoROpySU=; b=1QWUL86uzKfzUmubAvPc1O9qLX
 emmHjmizRTH+oeKBnAtKEkS84MEu93ny9Z84zVDbaWK12TQ20HFugmbsYj3OnsPTmmcqpO5uYbB+O
 gBadvTtU5ptf3TZoo6R7Ze6YrDIzzmypXnB4Psp4e98xuZR9pguROfHYSuPRLvQGo0ew=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnkj-0004Lb-BH
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:35:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnkj-0003rn-9w
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:35:17 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] x86/shadow: correct an inverted conditional in
 dirty VRAM tracking
Message-Id: <E1jsnkj-0003rn-9w@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:35:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit c1a4914323eecce82a664896845947fa1dd73ce4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:28:25 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:28:25 2020 +0200

    x86/shadow: correct an inverted conditional in dirty VRAM tracking
    
    This originally was "mfn_x(mfn) == INVALID_MFN". Make it like this
    again, taking the opportunity to also drop the unnecessary nearby
    braces.
    
    This is XSA-319.
    
    Fixes: 246a5a3377c2 ("xen: Use a typesafe to define INVALID_MFN")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 23a216f99d40fbfbc2318ade89d8213eea6ba1f8
    master date: 2020-07-07 14:36:24 +0200
---
 xen/arch/x86/mm/shadow/common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 48f03b3beb..8ee61f8784 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3758,10 +3758,8 @@ int shadow_track_dirty_vram(struct domain *d,
             int dirty = 0;
             paddr_t sl1ma = dirty_vram->sl1ma[i];
 
-            if ( !mfn_eq(mfn, INVALID_MFN) )
-            {
+            if ( mfn_eq(mfn, INVALID_MFN) )
                 dirty = 1;
-            }
             else
             {
                 page = mfn_to_page(mfn);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:35:29 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:35:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsnkv-0007it-C2; Tue, 07 Jul 2020 13:35:29 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnkt-0007ig-UQ
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:35:27 +0000
X-Inumbo-ID: b8005ce2-c056-11ea-8d73-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b8005ce2-c056-11ea-8d73-12813bfff9fa;
 Tue, 07 Jul 2020 13:35:27 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=By4vIhrJ/W6DyKDq4zys50MGwLs4sTO5b42o481xXvM=; b=LqUz4sxIeUSKYbapHLXdnNY0c5
 SGntJvW98SSl39Td1lDOMXJe7kOA2K+4SX9DcXss0A8In2bOz8jF7uRmlw+8qGeADniaCacnyoFgA
 hfGgwHF+GpAM92JuBjK5jWtqh+uO3bGOuigdKKsVDAkr59/NHYPMiyw5yxJaAJD7PcXE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnkt-0004Lj-E8
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:35:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnkt-0003sp-DV
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:35:27 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] x86/EPT: ept_set_middle_entry() related adjustments
Message-Id: <E1jsnkt-0003sp-DV@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:35:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a380168a5672cc3bf3066f630bab3c9355e4e1cf
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:28:53 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:28:53 2020 +0200

    x86/EPT: ept_set_middle_entry() related adjustments
    
    ept_split_super_page() wants to further modify the newly allocated
    table, so have ept_set_middle_entry() return the mapped pointer rather
    than tearing it down and then getting re-established right again.
    
    Similarly ept_next_level() wants to hand back a mapped pointer of
    the next level page, so re-use the one established by
    ept_set_middle_entry() in case that path was taken.
    
    Pull the setting of suppress_ve ahead of insertion into the higher level
    table, and don't have ept_split_super_page() set the field a 2nd time.
    
    This is part of XSA-328.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 1104288186ee73a7f9bfa41cbaa5bb7611521028
    master date: 2020-07-07 14:36:52 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 41 ++++++++++++++++++-----------------------
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index a4c841cc71..e78f220592 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -228,8 +228,9 @@ static void ept_p2m_type_to_flags(struct p2m_domain *p2m, ept_entry_t *entry,
 #define GUEST_TABLE_SUPER_PAGE  2
 #define GUEST_TABLE_POD_PAGE    3
 
-/* Fill in middle levels of ept table */
-static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
+/* Fill in middle level of ept table; return pointer to mapped new table. */
+static ept_entry_t *ept_set_middle_entry(struct p2m_domain *p2m,
+                                         ept_entry_t *ept_entry)
 {
     mfn_t mfn;
     ept_entry_t *table;
@@ -237,7 +238,12 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     mfn = p2m_alloc_ptp(p2m, 0);
     if ( mfn_eq(mfn, INVALID_MFN) )
-        return 0;
+        return NULL;
+
+    table = map_domain_page(mfn);
+
+    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
+        table[i].suppress_ve = 1;
 
     ept_entry->epte = 0;
     ept_entry->mfn = mfn_x(mfn);
@@ -249,14 +255,7 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     ept_entry->suppress_ve = 1;
 
-    table = map_domain_page(mfn);
-
-    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
-        table[i].suppress_ve = 1;
-
-    unmap_domain_page(table);
-
-    return 1;
+    return table;
 }
 
 /* free ept sub tree behind an entry */
@@ -294,10 +293,10 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
 
     ASSERT(is_epte_superpage(ept_entry));
 
-    if ( !ept_set_middle_entry(p2m, &new_ept) )
+    table = ept_set_middle_entry(p2m, &new_ept);
+    if ( !table )
         return 0;
 
-    table = map_domain_page(_mfn(new_ept.mfn));
     trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER);
 
     for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
@@ -308,7 +307,6 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
         epte->sp = (level > 1);
         epte->mfn += i * trunk;
         epte->snp = (iommu_enabled && iommu_snoop);
-        epte->suppress_ve = 1;
 
         ept_p2m_type_to_flags(p2m, epte, epte->sa_p2mt, epte->access);
 
@@ -347,8 +345,7 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
                           ept_entry_t **table, unsigned long *gfn_remainder,
                           int next_level)
 {
-    unsigned long mfn;
-    ept_entry_t *ept_entry, e;
+    ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
     shift = next_level * EPT_TABLE_ORDER;
@@ -373,19 +370,17 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        if ( !ept_set_middle_entry(p2m, ept_entry) )
+        next = ept_set_middle_entry(p2m, ept_entry);
+        if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        else
-            e = atomic_read_ept_entry(ept_entry); /* Refresh */
+        /* e is now stale and hence may not be used anymore below. */
     }
-
     /* The only time sp would be set here is if we had hit a superpage */
-    if ( is_epte_superpage(&e) )
+    else if ( is_epte_superpage(&e) )
         return GUEST_TABLE_SUPER_PAGE;
 
-    mfn = e.mfn;
     unmap_domain_page(*table);
-    *table = map_domain_page(_mfn(mfn));
+    *table = next ?: map_domain_page(_mfn(e.mfn));
     *gfn_remainder &= (1UL << shift) - 1;
     return GUEST_TABLE_NORMAL_PAGE;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:35:39 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:35:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsnl5-0007jq-Dl; Tue, 07 Jul 2020 13:35:39 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnl4-0007jf-65
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:35:38 +0000
X-Inumbo-ID: be065bdc-c056-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id be065bdc-c056-11ea-8496-bc764e2007e4;
 Tue, 07 Jul 2020 13:35:37 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=7cZNrHSdYPlnrTsCxiQg8SROycPoXmmMxjPwUbvGWPk=; b=DNNWAyzO3DbPAJOPOD2nABWKOQ
 7fAapEECCbiUU2gauPB58kj5VS5xEBjoDKFlfXni5iW+HUcd/0kcL1ETXuq7dusP7vO43BLDBy5UJ
 +NNnLxKzNboS0YFP2rq+3hob/QbGX+R29ACbFw04uymdnybe5TOguP/7RKazAFflg0UQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnl3-0004NN-Hn
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:35:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnl3-0003u5-GO
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:35:37 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] x86/ept: atomically modify entries in
 ept_next_level
Message-Id: <E1jsnl3-0003u5-GO@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:35:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a9bda69c6bf7da2933891f3e18f77f8a18f874bb
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:29:19 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:29:19 2020 +0200

    x86/ept: atomically modify entries in ept_next_level
    
    ept_next_level was passing a live PTE pointer to ept_set_middle_entry,
    which was then modified without taking into account that the PTE could
    be part of a live EPT table. This wasn't a security issue because the
    pages returned by p2m_alloc_ptp are zeroed, so adding such an entry
    before actually initializing it didn't allow a guest to access
    physical memory addresses it wasn't supposed to access.
    
    This is part of XSA-328.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: bc3d9f95d661372b059a5539ae6cb1e79435bb95
    master date: 2020-07-07 14:37:12 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index e78f220592..514f022549 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -348,6 +348,8 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
     ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
+    ASSERT(next_level);
+
     shift = next_level * EPT_TABLE_ORDER;
 
     index = *gfn_remainder >> shift;
@@ -364,16 +366,20 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
 
     if ( !is_epte_present(&e) )
     {
+        int rc;
+
         if ( e.sa_p2mt == p2m_populate_on_demand )
             return GUEST_TABLE_POD_PAGE;
 
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        next = ept_set_middle_entry(p2m, ept_entry);
+        next = ept_set_middle_entry(p2m, &e);
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        /* e is now stale and hence may not be used anymore below. */
+
+        rc = atomic_write_ept_entry(ept_entry, e, next_level);
+        ASSERT(rc == 0);
     }
     /* The only time sp would be set here is if we had hit a superpage */
     else if ( is_epte_superpage(&e) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:35:49 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:35:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsnlF-0007kw-FN; Tue, 07 Jul 2020 13:35:49 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnlE-0007kj-2Y
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:35:48 +0000
X-Inumbo-ID: c40e17ea-c056-11ea-8d73-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c40e17ea-c056-11ea-8d73-12813bfff9fa;
 Tue, 07 Jul 2020 13:35:47 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=FRbOD1zFEDkYmhSWc3PJGYhHq28l9F0UdHJkTje7jYg=; b=raBMIZrbhdkPhBQqtqXiR1NW71
 Z2CGVbegmBmnGJLdQjAohp+0dtLEaz1Fp4xMNX6NDT9Xl3XPyGy1wKmvsBluEFba3Rp1qOQW0/WRr
 byuFxlEDHXk3wIV5sUqXR40JOfdva1d2kdHyWj6WJu9KB5caBl8SRZ8gVSeYs5eHVpJ4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnlD-0004NV-Kn
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:35:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnlD-0003ut-K6
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:35:47 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] vtd: improve IOMMU TLB flush
Message-Id: <E1jsnlD-0003ut-K6@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:35:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit fd5703813f92451b39fdd8257596de0c45ebb160
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:29:44 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:29:44 2020 +0200

    vtd: improve IOMMU TLB flush
    
    Do not limit PSI flushes to order 0 pages, in order to avoid doing a
    full TLB flush if the passed in page has an order greater than 0 and
    is aligned. Should increase the performance of IOMMU TLB flushes when
    dealing with page orders greater than 0.
    
    This is part of XSA-321.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 5fe515a0fede07543f2a3b049167b1fd8b873caf
    master date: 2020-07-07 14:37:46 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 17cf87ccf1..3e10f24b44 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -612,13 +612,14 @@ static int __must_check iommu_flush_iotlb(struct domain *d,
         if ( iommu_domid == -1 )
             continue;
 
-        if ( page_count != 1 || gfn == gfn_x(INVALID_GFN) )
+        if ( !page_count || (page_count & (page_count - 1)) ||
+             gfn == gfn_x(INVALID_GFN) || !IS_ALIGNED(gfn, page_count) )
             rc = iommu_flush_iotlb_dsi(iommu, iommu_domid,
                                        0, flush_dev_iotlb);
         else
             rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
                                        (paddr_t)gfn << PAGE_SHIFT_4K,
-                                       PAGE_ORDER_4K,
+                                       get_order_from_pages(page_count),
                                        !dma_old_pte_present,
                                        flush_dev_iotlb);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:35:59 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:35:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsnlP-0007ls-H7; Tue, 07 Jul 2020 13:35:59 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnlO-0007lj-Kd
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:35:58 +0000
X-Inumbo-ID: ca0ebf96-c056-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ca0ebf96-c056-11ea-b7bb-bc764e2007e4;
 Tue, 07 Jul 2020 13:35:57 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=UEaJwg8otCyxAzqWGiL4YlALlmTLzzIcKdNht/EVNas=; b=nHWjfG0y2E+71U+rCASCGBEVQc
 Hak/CUrxcXuLC+QsBqwxlu3AFs/tg1FjnthmuWtO93kB8voP004YxbzB1IGfaI+VQVygjkVulDNTK
 4ZNEmX9xQGyL0MnMx5SYPDPDXEIcq5qy7bP13/R0OXl+tbNS5Y+sd4u5S382YZIGDtJ4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnlN-0004Nf-Nk
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:35:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnlN-0003vP-N6
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:35:57 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] vtd: prune (and rename) cache flush functions
Message-Id: <E1jsnlN-0003vP-N6@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:35:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 9df4399c7900d82592cc4fe889a96f1b3078a301
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:30:03 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:30:03 2020 +0200

    vtd: prune (and rename) cache flush functions
    
    Rename __iommu_flush_cache to iommu_sync_cache and remove
    iommu_flush_cache_page. Also remove the iommu_flush_cache_entry
    wrapper and just use iommu_sync_cache instead. Note the _entry suffix
    was meaningless as the wrapper was already taking a size parameter in
    bytes. While there also constify the addr parameter.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 62298825b9a44f45761acbd758138b5ba059ebd1
    master date: 2020-07-07 14:38:13 +0200
---
 xen/drivers/passthrough/vtd/extern.h   |  3 +--
 xen/drivers/passthrough/vtd/intremap.c |  6 +++---
 xen/drivers/passthrough/vtd/iommu.c    | 31 +++++++++++--------------------
 3 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index d698b1d50a..87d5ed78a2 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -37,8 +37,7 @@ void disable_qinval(struct iommu *iommu);
 int enable_intremap(struct iommu *iommu, int eim);
 void disable_intremap(struct iommu *iommu);
 
-void iommu_flush_cache_entry(void *addr, unsigned int size);
-void iommu_flush_cache_page(void *addr, unsigned long npages);
+void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index 5f620c3202..eac20ede31 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -231,7 +231,7 @@ static void free_remap_entry(struct iommu *iommu, int index)
                      iremap_entries, iremap_entry);
 
     update_irte(iommu, iremap_entry, &new_ire, false);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -403,7 +403,7 @@ static int ioapic_rte_to_remap_entry(struct iommu *iommu,
     }
 
     update_irte(iommu, iremap_entry, &new_ire, !init);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -694,7 +694,7 @@ static int msi_msg_to_remap_entry(
     update_irte(iommu, iremap_entry, &new_ire, msi_desc->irte_initialized);
     msi_desc->irte_initialized = true;
 
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 3e10f24b44..2fa57190d8 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -158,7 +158,8 @@ static void __init free_intel_iommu(struct intel_iommu *intel)
 }
 
 static int iommus_incoherent;
-static void __iommu_flush_cache(void *addr, unsigned int size)
+
+void iommu_sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -173,16 +174,6 @@ static void __iommu_flush_cache(void *addr, unsigned int size)
         cacheline_flush((char *)addr + i);
 }
 
-void iommu_flush_cache_entry(void *addr, unsigned int size)
-{
-    __iommu_flush_cache(addr, size);
-}
-
-void iommu_flush_cache_page(void *addr, unsigned long npages)
-{
-    __iommu_flush_cache(addr, PAGE_SIZE * npages);
-}
-
 /* Allocate page table, return its machine address */
 u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
 {
@@ -207,7 +198,7 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_flush_cache_page(vaddr, 1);
+        iommu_sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -242,7 +233,7 @@ static u64 bus_to_context_maddr(struct iommu *iommu, u8 bus)
         }
         set_root_value(*root, maddr);
         set_root_present(*root);
-        iommu_flush_cache_entry(root, sizeof(struct root_entry));
+        iommu_sync_cache(root, sizeof(struct root_entry));
     }
     maddr = (u64) get_context_addr(*root);
     unmap_vtd_domain_page(root_entries);
@@ -300,7 +291,7 @@ static u64 addr_to_dma_page_maddr(struct domain *domain, u64 addr, int alloc)
              */
             dma_set_pte_readable(*pte);
             dma_set_pte_writable(*pte);
-            iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+            iommu_sync_cache(pte, sizeof(struct dma_pte));
         }
 
         if ( level == 2 )
@@ -674,7 +665,7 @@ static int __must_check dma_pte_clear_one(struct domain *domain, u64 addr)
 
     dma_clear_pte(*pte);
     spin_unlock(&hd->arch.mapping_lock);
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     if ( !this_cpu(iommu_dont_flush_iotlb) )
         rc = iommu_flush_iotlb_pages(domain, addr >> PAGE_SHIFT_4K, 1);
@@ -716,7 +707,7 @@ static void iommu_free_page_table(struct page_info *pg)
             iommu_free_pagetable(dma_pte_addr(*pte), next_level);
 
         dma_clear_pte(*pte);
-        iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+        iommu_sync_cache(pte, sizeof(struct dma_pte));
     }
 
     unmap_vtd_domain_page(pt_vaddr);
@@ -1447,7 +1438,7 @@ int domain_context_mapping_one(
     context_set_address_width(*context, agaw);
     context_set_fault_enable(*context);
     context_set_present(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
     spin_unlock(&iommu->lock);
 
     /* Context entry was previously non-present (with domid 0). */
@@ -1594,7 +1585,7 @@ int domain_context_unmap_one(
 
     context_clear_present(*context);
     context_clear_entry(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
 
     iommu_domid= domain_iommu_domid(domain, iommu);
     if ( iommu_domid == -1 )
@@ -1824,7 +1815,7 @@ static int __must_check intel_iommu_map_page(struct domain *d,
 
     *pte = new;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
     spin_unlock(&hd->arch.mapping_lock);
     unmap_vtd_domain_page(page);
 
@@ -1858,7 +1849,7 @@ int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
     int iommu_domid;
     int rc = 0;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     for_each_drhd_unit ( drhd )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:36:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:36:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsnlZ-0007nI-KA; Tue, 07 Jul 2020 13:36:09 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnlY-0007n5-8a
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:36:08 +0000
X-Inumbo-ID: d01434b6-c056-11ea-8d73-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d01434b6-c056-11ea-8d73-12813bfff9fa;
 Tue, 07 Jul 2020 13:36:08 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=/ZaNrPjMQ+XctzbftHvXa/3X5456dm36a6VNkP3GIXI=; b=Olfef1scE8BqHT1955KCDLZCrS
 lClDBWononAW4w2eZgMpaQBoQt9wYpKRvri4EGES3N/zMJgyOkFYwGHXuqRwEKjqIGSxlFOyR6wtF
 62tMJ1UDm9Ib9osQH9li6/+u4hDmJIjRh61qXq3udfSzpZ3Jk+2fXNRHIqh3V1FF0NA8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnlX-0004O0-Qy
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:36:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnlX-0003x5-QD
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:36:07 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] x86/iommu: introduce a cache sync hook
Message-Id: <E1jsnlX-0003x5-QD@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:36:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 0b0a15580757e8103746941e4a558a745fc553f1
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:30:23 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:30:23 2020 +0200

    x86/iommu: introduce a cache sync hook
    
    The hook is only implemented for VT-d and it uses the already existing
    iommu_sync_cache function present in VT-d code. The new hook is
    added so that the cache can be flushed by code outside of VT-d when
    using shared page tables.
    
    Note that alloc_pgtable_maddr must use the now locally defined
    sync_cache function, because IOMMU ops are not yet setup the first
    time the function gets called during IOMMU initialization.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 91526b460e5009fc56edbd6809e66c327281faba
    master date: 2020-07-07 14:38:34 +0200
---
 xen/drivers/passthrough/vtd/extern.h | 1 -
 xen/drivers/passthrough/vtd/iommu.c  | 5 +++--
 xen/include/asm-x86/iommu.h          | 7 +++++++
 xen/include/xen/iommu.h              | 1 +
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 87d5ed78a2..00a73d63ea 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -37,7 +37,6 @@ void disable_qinval(struct iommu *iommu);
 int enable_intremap(struct iommu *iommu, int eim);
 void disable_intremap(struct iommu *iommu);
 
-void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 2fa57190d8..6ab48260df 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -159,7 +159,7 @@ static void __init free_intel_iommu(struct intel_iommu *intel)
 
 static int iommus_incoherent;
 
-void iommu_sync_cache(const void *addr, unsigned int size)
+static void sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -198,7 +198,7 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_sync_cache(vaddr, PAGE_SIZE);
+        sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -2696,6 +2696,7 @@ const struct iommu_ops intel_iommu_ops = {
     .iotlb_flush_all = iommu_flush_iotlb_all,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_p2m_table = vtd_dump_p2m_table,
+    .sync_cache = sync_cache,
 };
 
 /*
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index dcf2e21402..16ff2e94c2 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -98,6 +98,13 @@ extern bool untrusted_msi;
 int pi_update_irte(const struct pi_desc *pi_desc, const struct pirq *pirq,
                    const uint8_t gvec);
 
+#define iommu_sync_cache(addr, size) ({                 \
+    const struct iommu_ops *ops = iommu_get_ops();      \
+                                                        \
+    if ( ops->sync_cache )                              \
+        ops->sync_cache(addr, size);                    \
+})
+
 #endif /* !__ARCH_X86_IOMMU_H__ */
 /*
  * Local variables:
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 235d2a620b..64e32f539a 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -160,6 +160,7 @@ struct iommu_ops {
     void (*update_ire_from_apic)(unsigned int apic, unsigned int reg, unsigned int value);
     unsigned int (*read_apic_from_ire)(unsigned int apic, unsigned int reg);
     int (*setup_hpet_msi)(struct msi_desc *);
+    void (*sync_cache)(const void *addr, unsigned int size);
 #endif /* CONFIG_X86 */
     int __must_check (*suspend)(void);
     void (*resume)(void);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:36:19 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:36:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jsnlj-0007ob-Lb; Tue, 07 Jul 2020 13:36:19 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnli-0007o9-AD
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:36:18 +0000
X-Inumbo-ID: d617517c-c056-11ea-8d73-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d617517c-c056-11ea-8d73-12813bfff9fa;
 Tue, 07 Jul 2020 13:36:18 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=a6/nUeJqtpUNUj0709VlgBsJ2tM9DQQem/Dt4G7btaI=; b=FzpRd4nof05krGD+TJZ9+GYYJy
 T+lB3bQ1RRN10V2CrXSyVwWssNDXlrpvSH3jox1bT72ujKKA+PYseNXRPpqCzymkSqfqtZ73jscwX
 2ZShCYL0smhhmmrfK0bHqE5eFY9m0oTJ4KvAIvt4CUbooYxELe4OnLEdDDjnRqCJdmgc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnlh-0004O8-Tq
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:36:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnlh-0003yX-TC
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:36:17 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] vtd: don't assume addresses are aligned in
 sync_cache
Message-Id: <E1jsnlh-0003yX-TC@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:36:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 388e303baaa695f8167d040e33d9b8daa63a08dd
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:30:56 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:30:56 2020 +0200

    vtd: don't assume addresses are aligned in sync_cache
    
    Current code in sync_cache assume that the address passed in is
    aligned to a cache line size. Fix the code to support passing in
    arbitrary addresses not necessarily aligned to a cache line size.
    
    This is part of XSA-321.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b6d9398144f21718d25daaf8d72669a75592abc5
    master date: 2020-07-07 14:39:05 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 6ab48260df..5163933e04 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -161,8 +161,8 @@ static int iommus_incoherent;
 
 static void sync_cache(const void *addr, unsigned int size)
 {
-    int i;
-    static unsigned int clflush_size = 0;
+    static unsigned long clflush_size = 0;
+    const void *end = addr + size;
 
     if ( !iommus_incoherent )
         return;
@@ -170,8 +170,9 @@ static void sync_cache(const void *addr, unsigned int size)
     if ( clflush_size == 0 )
         clflush_size = get_cache_line_size();
 
-    for ( i = 0; i < size; i += clflush_size )
-        cacheline_flush((char *)addr + i);
+    addr -= (unsigned long)addr & (clflush_size - 1);
+    for ( ; addr < end; addr += clflush_size )
+        cacheline_flush((char *)addr);
 }
 
 /* Allocate page table, return its machine address */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:36:30 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:36: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 1jsnlt-0007qd-N3; Tue, 07 Jul 2020 13:36:29 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnls-0007qC-Hc
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:36:28 +0000
X-Inumbo-ID: dc1a06b4-c056-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id dc1a06b4-c056-11ea-b7bb-bc764e2007e4;
 Tue, 07 Jul 2020 13:36:28 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=bHaalpuH+NBu2+KLe3xl+mTxOqhOKCiRyIz3TuEpods=; b=G7IivWrdgI6LlsWNehM+BAkXh4
 w4F76NxIZA2IqvDAn0nVABtlPOkONZtbnlsLYM2WfE5O4g3V35GDmSOmtNj4fyA7AMq8au1cczzXx
 wvSD8WVQX+UR8/DtsPZDdjtJel8wbptlWWCTG9CaooHVkhSMiWZbCV3m9zv27LJhSOlE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnls-0004Og-0N
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:36:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnlr-0003zp-Vy
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:36:27 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] x86/alternative: introduce alternative_2
Message-Id: <E1jsnlr-0003zp-Vy@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:36:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 8976bab464775e2713ec8b6c910986d13891df3a
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:31:20 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:31:20 2020 +0200

    x86/alternative: introduce alternative_2
    
    It's based on alternative_io_2 without inputs or outputs but with an
    added memory clobber.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 23570bce00ee6ba2139ece978ab6f03ff166e21d
    master date: 2020-07-07 14:39:25 +0200
---
 xen/include/asm-x86/alternative.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h
index ba537d6b7e..7c34504f89 100644
--- a/xen/include/asm-x86/alternative.h
+++ b/xen/include/asm-x86/alternative.h
@@ -85,6 +85,11 @@ extern void alternative_instructions(void);
 #define alternative(oldinstr, newinstr, feature)                        \
         asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) : : : "memory")
 
+#define alternative_2(oldinstr, newinstr1, feature1, newinstr2, feature2) \
+	asm volatile (ALTERNATIVE_2(oldinstr, newinstr1, feature1,	\
+				    newinstr2, feature2)		\
+		      : : : "memory")
+
 /*
  * Alternative inline assembly with input.
  *
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:36:40 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:36: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 1jsnm4-0007rm-Od; Tue, 07 Jul 2020 13:36:40 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnm2-0007rY-R5
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:36:38 +0000
X-Inumbo-ID: e2250a0e-c056-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e2250a0e-c056-11ea-b7bb-bc764e2007e4;
 Tue, 07 Jul 2020 13:36:38 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=IAyCFcc46hJz14ZsA3JJPTNXJWCyHulAk9lH9SD10ug=; b=08xfRULxn68Uv1qQF4sbYjznc5
 gE07+DpHFcM0QOpPII+uXQu0HE+9X3c3NtF6hyJjz9+eycL3jdYYPR6jV0hZqZWKH5eq/VikgswKL
 jziQGazwq7/4VjuG/fKz19SAJLs1oyh8SsMhLBaFICUaJjrV9TjzEFwm/IYlqBkRcljw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnm2-0004Oq-4y
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:36:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnm2-00041R-2u
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:36:38 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] vtd: optimize CPU cache sync
Message-Id: <E1jsnm2-00041R-2u@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:36:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit d9c67d382a60eaad717e06746f5bcce7d16e2e83
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:31:54 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:31:54 2020 +0200

    vtd: optimize CPU cache sync
    
    Some VT-d IOMMUs are non-coherent, which requires a cache write back
    in order for the changes made by the CPU to be visible to the IOMMU.
    This cache write back was unconditionally done using clflush, but there are
    other more efficient instructions to do so, hence implement support
    for them using the alternative framework.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a64ea16522a73a13a0d66cfa4b66a9d3b95dd9d6
    master date: 2020-07-07 14:39:54 +0200
---
 xen/drivers/passthrough/vtd/extern.h  |  1 -
 xen/drivers/passthrough/vtd/iommu.c   | 38 ++++++++++++++++++++++++++++++++++-
 xen/drivers/passthrough/vtd/x86/vtd.c |  5 -----
 3 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 00a73d63ea..065d768b52 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -63,7 +63,6 @@ int __must_check qinval_device_iotlb_sync(struct iommu *iommu,
                                           u16 did, u16 size, u64 addr);
 
 unsigned int get_cache_line_size(void);
-void cacheline_flush(char *);
 void flush_all_cache(void);
 
 u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 5163933e04..166c52862f 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -31,6 +31,7 @@
 #include <xen/pci_regs.h>
 #include <xen/keyhandler.h>
 #include <asm/msi.h>
+#include <asm/nops.h>
 #include <asm/irq.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/p2m.h>
@@ -172,7 +173,42 @@ static void sync_cache(const void *addr, unsigned int size)
 
     addr -= (unsigned long)addr & (clflush_size - 1);
     for ( ; addr < end; addr += clflush_size )
-        cacheline_flush((char *)addr);
+/*
+ * The arguments to a macro must not include preprocessor directives. Doing so
+ * results in undefined behavior, so we have to create some defines here in
+ * order to avoid it.
+ */
+#if defined(HAVE_AS_CLWB)
+# define CLWB_ENCODING "clwb %[p]"
+#elif defined(HAVE_AS_XSAVEOPT)
+# define CLWB_ENCODING "data16 xsaveopt %[p]" /* clwb */
+#else
+# define CLWB_ENCODING ".byte 0x66, 0x0f, 0xae, 0x30" /* clwb (%%rax) */
+#endif
+
+#define BASE_INPUT(addr) [p] "m" (*(const char *)(addr))
+#if defined(HAVE_AS_CLWB) || defined(HAVE_AS_XSAVEOPT)
+# define INPUT BASE_INPUT
+#else
+# define INPUT(addr) "a" (addr), BASE_INPUT(addr)
+#endif
+        /*
+         * Note regarding the use of NOP_DS_PREFIX: it's faster to do a clflush
+         * + prefix than a clflush + nop, and hence the prefix is added instead
+         * of letting the alternative framework fill the gap by appending nops.
+         */
+        alternative_io_2(".byte " __stringify(NOP_DS_PREFIX) "; clflush %[p]",
+                         "data16 clflush %[p]", /* clflushopt */
+                         X86_FEATURE_CLFLUSHOPT,
+                         CLWB_ENCODING,
+                         X86_FEATURE_CLWB, /* no outputs */,
+                         INPUT(addr));
+#undef INPUT
+#undef BASE_INPUT
+#undef CLWB_ENCODING
+
+    alternative_2(ASM_NOP3, "sfence", X86_FEATURE_CLFLUSHOPT,
+                            "sfence", X86_FEATURE_CLWB);
 }
 
 /* Allocate page table, return its machine address */
diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c
index 88a60b3307..7f96b91dd4 100644
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -53,11 +53,6 @@ unsigned int get_cache_line_size(void)
     return ((cpuid_ebx(1) >> 8) & 0xff) * 8;
 }
 
-void cacheline_flush(char * addr)
-{
-    clflush(addr);
-}
-
 void flush_all_cache()
 {
     wbinvd();
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:36:50 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:36: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 1jsnmE-0007sf-QC; Tue, 07 Jul 2020 13:36:50 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnmC-0007sR-Ub
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:36:48 +0000
X-Inumbo-ID: e83f5462-c056-11ea-8d73-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e83f5462-c056-11ea-8d73-12813bfff9fa;
 Tue, 07 Jul 2020 13:36:48 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=JA1u1IjRr77fj8l2oVgoGBSoiqjSX7Q7uFyYLMyQ1OU=; b=uLxJo+/Ml2UTJhmaTUAYIb5EJh
 HGLx3+9FNa/U4vJeN5BTqfJZbplI9wnUv28coRQ0pgoPa1wJDhii0yB+/Ng0KvldEVPhsTnzGwG2j
 72E/OVZQ7Sx6l+JU9SNIy0ZHAKsIticUn/BnhvS5BlaV7xJr3BZ2JMRdnQVryyoYJ2/4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnmC-0004P0-Bg
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:36:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnmC-00042k-94
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:36:48 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] x86/ept: flush cache when modifying PTEs and
 sharing page tables
Message-Id: <E1jsnmC-00042k-94@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:36:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 4418841aa620071a86a70f1ad5ad6e1f8c3c2636
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:32:21 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:32:21 2020 +0200

    x86/ept: flush cache when modifying PTEs and sharing page tables
    
    Modifications made to the page tables by EPT code need to be written
    to memory when the page tables are shared with the IOMMU, as Intel
    IOMMUs can be non-coherent and thus require changes to be written to
    memory in order to be visible to the IOMMU.
    
    In order to achieve this make sure data is written back to memory
    after writing an EPT entry when the recalc bit is not set in
    atomic_write_ept_entry. If such bit is set, the entry will be
    adjusted and atomic_write_ept_entry will be called a second time
    without the recalc bit set. Note that when splitting a super page the
    new tables resulting of the split should also be written back.
    
    Failure to do so can allow devices behind the IOMMU access to the
    stale super page, or cause coherency issues as changes made by the
    processor to the page tables are not visible to the IOMMU.
    
    This allows to remove the VT-d specific iommu_pte_flush helper, since
    the cache write back is now performed by atomic_write_ept_entry, and
    hence iommu_iotlb_flush can be used to flush the IOMMU TLB. The newly
    used method (iommu_iotlb_flush) can result in less flushes, since it
    might sometimes be called rightly with 0 flags, in which case it
    becomes a no-op.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c23274fd0412381bd75068ebc9f8f8c90a4be748
    master date: 2020-07-07 14:40:11 +0200
---
 xen/arch/x86/mm/p2m-ept.c           | 21 ++++++++++++++-
 xen/drivers/passthrough/vtd/iommu.c | 53 ++-----------------------------------
 xen/include/asm-x86/iommu.h         |  5 ++--
 3 files changed, 25 insertions(+), 54 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 514f022549..cfbf7174fd 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -90,6 +90,19 @@ static int atomic_write_ept_entry(ept_entry_t *entryptr, ept_entry_t new,
 
     write_atomic(&entryptr->epte, new.epte);
 
+    /*
+     * The recalc field on the EPT is used to signal either that a
+     * recalculation of the EMT field is required (which doesn't effect the
+     * IOMMU), or a type change. Type changes can only be between ram_rw,
+     * logdirty and ioreq_server: changes to/from logdirty won't work well with
+     * an IOMMU anyway, as IOMMU #PFs are not synchronous and will lead to
+     * aborts, and changes to/from ioreq_server are already fully flushed
+     * before returning to guest context (see
+     * XEN_DMOP_map_mem_type_to_ioreq_server).
+     */
+    if ( !new.recalc && iommu_hap_pt_share )
+        iommu_sync_cache(entryptr, sizeof(*entryptr));
+
     if ( unlikely(oldmfn != mfn_x(INVALID_MFN)) )
         put_page(mfn_to_page(oldmfn));
 
@@ -319,6 +332,9 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
             break;
     }
 
+    if ( iommu_hap_pt_share )
+        iommu_sync_cache(table, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
     unmap_domain_page(table);
 
     /* Even failed we should install the newly allocated ept page. */
@@ -378,6 +394,9 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
 
+        if ( iommu_hap_pt_share )
+            iommu_sync_cache(next, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
         rc = atomic_write_ept_entry(ept_entry, e, next_level);
         ASSERT(rc == 0);
     }
@@ -874,7 +893,7 @@ out:
          need_modify_vtd_table )
     {
         if ( iommu_hap_pt_share )
-            rc = iommu_pte_flush(d, gfn, &ept_entry->epte, order, vtd_pte_present);
+            rc = iommu_flush_iotlb(d, gfn, vtd_pte_present, 1u << order);
         else
         {
             if ( iommu_flags )
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 166c52862f..2df927fe0f 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -612,10 +612,8 @@ static int __must_check iommu_flush_all(void)
     return rc;
 }
 
-static int __must_check iommu_flush_iotlb(struct domain *d,
-                                          unsigned long gfn,
-                                          bool_t dma_old_pte_present,
-                                          unsigned int page_count)
+int iommu_flush_iotlb(struct domain *d, unsigned long gfn,
+                      bool dma_old_pte_present, unsigned int page_count)
 {
     struct domain_iommu *hd = dom_iommu(d);
     struct acpi_drhd_unit *drhd;
@@ -1876,53 +1874,6 @@ static int __must_check intel_iommu_unmap_page(struct domain *d,
     return dma_pte_clear_one(d, (paddr_t)gfn << PAGE_SHIFT_4K);
 }
 
-int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
-                    int order, int present)
-{
-    struct acpi_drhd_unit *drhd;
-    struct iommu *iommu = NULL;
-    struct domain_iommu *hd = dom_iommu(d);
-    bool_t flush_dev_iotlb;
-    int iommu_domid;
-    int rc = 0;
-
-    iommu_sync_cache(pte, sizeof(struct dma_pte));
-
-    for_each_drhd_unit ( drhd )
-    {
-        iommu = drhd->iommu;
-        if ( !test_bit(iommu->index, &hd->arch.iommu_bitmap) )
-            continue;
-
-        flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
-        iommu_domid= domain_iommu_domid(d, iommu);
-        if ( iommu_domid == -1 )
-            continue;
-
-        rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
-                                   (paddr_t)gfn << PAGE_SHIFT_4K,
-                                   order, !present, flush_dev_iotlb);
-        if ( rc > 0 )
-        {
-            iommu_flush_write_buffer(iommu);
-            rc = 0;
-        }
-    }
-
-    if ( unlikely(rc) )
-    {
-        if ( !d->is_shutting_down && printk_ratelimit() )
-            printk(XENLOG_ERR VTDPREFIX
-                   " d%d: IOMMU pages flush failed: %d\n",
-                   d->domain_id, rc);
-
-        if ( !is_hardware_domain(d) )
-            domain_crash(d);
-    }
-
-    return rc;
-}
-
 static int __init vtd_ept_page_compatible(struct iommu *iommu)
 {
     u64 ept_cap, vtd_cap = iommu->cap;
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 16ff2e94c2..dfc9b77594 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -87,8 +87,9 @@ int iommu_setup_hpet_msi(struct msi_desc *);
 
 /* While VT-d specific, this must get declared in a generic header. */
 int adjust_vtd_irq_affinities(void);
-int __must_check iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
-                                 int order, int present);
+int __must_check iommu_flush_iotlb(struct domain *d, unsigned long gfn,
+                                   bool dma_old_pte_present,
+                                   unsigned int page_count);
 bool_t iommu_supports_eim(void);
 int iommu_enable_x2apic_IR(void);
 void iommu_disable_x2apic_IR(void);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:37:00 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:37: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 1jsnmO-0007uV-TL; Tue, 07 Jul 2020 13:37:00 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsnmM-0007ti-TD
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:36:58 +0000
X-Inumbo-ID: ee44e20a-c056-11ea-8d73-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ee44e20a-c056-11ea-8d73-12813bfff9fa;
 Tue, 07 Jul 2020 13:36:58 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=0V4wT898vAZlflSs7WkF0nFcK41L8XWSL1jdFCyesK8=; b=mpqxuI3QXD6DrcgvmdbLJ2dvpI
 xYkIY8McClvxDdtKpUeR75vLET4Whz+hCb963NlZ41geyoIks+XtEAryCr4wN8CKAYr6qjfvA6MoJ
 7mQOA/2oDwRFqf6sp3IFaWnURGbI3ZAGnu7KAQ9v/aqC/DkZ0HIFb2PlzUwW6glaQipk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnmM-0004PG-Fk
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:36:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsnmM-000445-EH
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:36:58 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.10] xen: Check the alignment of the offset pased via
 VCPUOP_register_vcpu_info
Message-Id: <E1jsnmM-000445-EH@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:36:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 93be943e7d759015bd5db41a48f6dce58e580d5a
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jul 7 15:32:54 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:32:54 2020 +0200

    xen: Check the alignment of the offset pased via VCPUOP_register_vcpu_info
    
    Currently a guest is able to register any guest physical address to use
    for the vcpu_info structure as long as the structure can fits in the
    rest of the frame.
    
    This means a guest can provide an address that is not aligned to the
    natural alignment of the structure.
    
    On Arm 32-bit, unaligned access are completely forbidden by the
    hypervisor. This will result to a data abort which is fatal.
    
    On Arm 64-bit, unaligned access are only forbidden when used for atomic
    access. As the structure contains fields (such as evtchn_pending_self)
    that are updated using atomic operations, any unaligned access will be
    fatal as well.
    
    While the misalignment is only fatal on Arm, a generic check is added
    as an x86 guest shouldn't sensibly pass an unaligned address (this
    would result to a split lock).
    
    This is XSA-327.
    
    Reported-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    master commit: 3fdc211b01b29f252166937238efe02d15cb5780
    master date: 2020-07-07 14:41:00 +0200
---
 xen/common/domain.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 4efe4bf46a..15529d768b 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1167,10 +1167,20 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
     void *mapping;
     vcpu_info_t *new_info;
     struct page_info *page;
+    unsigned int align;
 
     if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
         return -EINVAL;
 
+#ifdef CONFIG_COMPAT
+    if ( has_32bit_shinfo(d) )
+        align = alignof(new_info->compat);
+    else
+#endif
+        align = alignof(*new_info);
+    if ( offset & (align - 1) )
+        return -EINVAL;
+
     if ( !mfn_eq(v->vcpu_info_mfn, INVALID_MFN) )
         return -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:55:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:55: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 1jso3u-00018b-9d; Tue, 07 Jul 2020 13:55:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jso3t-00018W-RD
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:55:05 +0000
X-Inumbo-ID: 75f51858-c059-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 75f51858-c059-11ea-8496-bc764e2007e4;
 Tue, 07 Jul 2020 13:55:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=PGY9Ykmez+mqmRArK6MEkt7/8IiDTrBVMYvydMaqWE0=; b=Cthayqi4ndVN9w8lQdfpc1WwRz
 4tQ9yS8XUjro7a2SrHctgfnJ8XIpQSdsTwTG5yDqJlYIB/zCaZNwKvv75RwNfjUEWNU2fFRFdTTpT
 DGh8M5XHeowlrTiZ8Q9DzYbI1WFdfzhKl8yOlVqpNsC2L2/WI5zZH1cqWXhsJUlN8dmY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso3t-0004iw-1b
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso3s-0005Hw-W4
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:55:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] x86/shadow: correct an inverted conditional in
 dirty VRAM tracking
Message-Id: <E1jso3s-0005Hw-W4@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 715453066082072b38eaa754840c558e7a9edf88
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:39:47 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:39:47 2020 +0200

    x86/shadow: correct an inverted conditional in dirty VRAM tracking
    
    This originally was "mfn_x(mfn) == INVALID_MFN". Make it like this
    again, taking the opportunity to also drop the unnecessary nearby
    braces.
    
    This is XSA-319.
    
    Fixes: 246a5a3377c2 ("xen: Use a typesafe to define INVALID_MFN")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 23a216f99d40fbfbc2318ade89d8213eea6ba1f8
    master date: 2020-07-07 14:36:24 +0200
---
 xen/arch/x86/mm/shadow/common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index abaa97e8b0..be4f2ee01f 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3758,10 +3758,8 @@ int shadow_track_dirty_vram(struct domain *d,
             int dirty = 0;
             paddr_t sl1ma = dirty_vram->sl1ma[i];
 
-            if ( !mfn_eq(mfn, INVALID_MFN) )
-            {
+            if ( mfn_eq(mfn, INVALID_MFN) )
                 dirty = 1;
-            }
             else
             {
                 page = mfn_to_page(mfn);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:55:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jso44-000198-BH; Tue, 07 Jul 2020 13:55:16 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jso43-000191-RM
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:55:15 +0000
X-Inumbo-ID: 7bf67170-c059-11ea-8d75-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7bf67170-c059-11ea-8d75-12813bfff9fa;
 Tue, 07 Jul 2020 13:55:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=1Zr0Y8gIdnTF1j6QwPmtsJzavNSBUp2SyJYjcgnBFys=; b=yO7xCv1VlZglIHRwCwWvAdsVRi
 jEdJBhta/IKCtE9c1TAo9iLtL+rENmOpfUIiBhh6HHxE2pA9cvLY/KHpqL5p3++jnNAmZrqgj5dTU
 vGfP8qWK0xXoHifzyStZkzXBLCx8+81MkdccuQhqudTzhHaHcXDty95ZO+lUD0whU9f8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso43-0004j2-5b
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso43-0005Ie-3k
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:55:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] x86/EPT: ept_set_middle_entry() related adjustments
Message-Id: <E1jso43-0005Ie-3k@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:55:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 098d95995564f38f5415dd7b30096785db9e2337
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:40:11 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:40:11 2020 +0200

    x86/EPT: ept_set_middle_entry() related adjustments
    
    ept_split_super_page() wants to further modify the newly allocated
    table, so have ept_set_middle_entry() return the mapped pointer rather
    than tearing it down and then getting re-established right again.
    
    Similarly ept_next_level() wants to hand back a mapped pointer of
    the next level page, so re-use the one established by
    ept_set_middle_entry() in case that path was taken.
    
    Pull the setting of suppress_ve ahead of insertion into the higher level
    table, and don't have ept_split_super_page() set the field a 2nd time.
    
    This is part of XSA-328.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 1104288186ee73a7f9bfa41cbaa5bb7611521028
    master date: 2020-07-07 14:36:52 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 41 ++++++++++++++++++-----------------------
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 46f044b011..1126a58b83 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -228,8 +228,9 @@ static void ept_p2m_type_to_flags(struct p2m_domain *p2m, ept_entry_t *entry,
 #define GUEST_TABLE_SUPER_PAGE  2
 #define GUEST_TABLE_POD_PAGE    3
 
-/* Fill in middle levels of ept table */
-static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
+/* Fill in middle level of ept table; return pointer to mapped new table. */
+static ept_entry_t *ept_set_middle_entry(struct p2m_domain *p2m,
+                                         ept_entry_t *ept_entry)
 {
     struct page_info *pg;
     ept_entry_t *table;
@@ -237,7 +238,12 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     pg = p2m_alloc_ptp(p2m, 0);
     if ( pg == NULL )
-        return 0;
+        return NULL;
+
+    table = __map_domain_page(pg);
+
+    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
+        table[i].suppress_ve = 1;
 
     ept_entry->epte = 0;
     ept_entry->mfn = page_to_mfn(pg);
@@ -249,14 +255,7 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     ept_entry->suppress_ve = 1;
 
-    table = __map_domain_page(pg);
-
-    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
-        table[i].suppress_ve = 1;
-
-    unmap_domain_page(table);
-
-    return 1;
+    return table;
 }
 
 /* free ept sub tree behind an entry */
@@ -294,10 +293,10 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
 
     ASSERT(is_epte_superpage(ept_entry));
 
-    if ( !ept_set_middle_entry(p2m, &new_ept) )
+    table = ept_set_middle_entry(p2m, &new_ept);
+    if ( !table )
         return 0;
 
-    table = map_domain_page(_mfn(new_ept.mfn));
     trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER);
 
     for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
@@ -308,7 +307,6 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
         epte->sp = (level > 1);
         epte->mfn += i * trunk;
         epte->snp = (iommu_enabled && iommu_snoop);
-        epte->suppress_ve = 1;
 
         ept_p2m_type_to_flags(p2m, epte, epte->sa_p2mt, epte->access);
 
@@ -347,8 +345,7 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
                           ept_entry_t **table, unsigned long *gfn_remainder,
                           int next_level)
 {
-    unsigned long mfn;
-    ept_entry_t *ept_entry, e;
+    ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
     shift = next_level * EPT_TABLE_ORDER;
@@ -373,19 +370,17 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        if ( !ept_set_middle_entry(p2m, ept_entry) )
+        next = ept_set_middle_entry(p2m, ept_entry);
+        if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        else
-            e = atomic_read_ept_entry(ept_entry); /* Refresh */
+        /* e is now stale and hence may not be used anymore below. */
     }
-
     /* The only time sp would be set here is if we had hit a superpage */
-    if ( is_epte_superpage(&e) )
+    else if ( is_epte_superpage(&e) )
         return GUEST_TABLE_SUPER_PAGE;
 
-    mfn = e.mfn;
     unmap_domain_page(*table);
-    *table = map_domain_page(_mfn(mfn));
+    *table = next ?: map_domain_page(_mfn(e.mfn));
     *gfn_remainder &= (1UL << shift) - 1;
     return GUEST_TABLE_NORMAL_PAGE;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:55:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:55:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jso4E-0001AY-Cu; Tue, 07 Jul 2020 13:55:26 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jso4D-0001AR-Ta
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:55:25 +0000
X-Inumbo-ID: 81ffd656-c059-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 81ffd656-c059-11ea-bb8b-bc764e2007e4;
 Tue, 07 Jul 2020 13:55:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=j/CRG3cp3cvaNLaekWd4pbvkwaS0fOpSnyq9mUEhd60=; b=KMOVsTEDTcYOw8Sw9nPMLuDhNA
 ZCjWThdnRXTJMZcPcvbdX158CVZ2X6GiJw5biL64rpCSw7dUlXiexicWO8GQZCPVCLKQ0VbeVIvdd
 Z6kZAXfhGBJZuBIupl+rQVGeW1WtpzmG3AtyXEe8q9G39H2PPAbaLab6O6NB7eQIZpOs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso4D-0004jI-8l
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso4D-0005JQ-7n
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:55:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] x86/ept: atomically modify entries in ept_next_level
Message-Id: <E1jso4D-0005JQ-7n@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:55:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 6ee71c98e35054045d47e65cb10587b0f60cae52
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:40:33 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:40:33 2020 +0200

    x86/ept: atomically modify entries in ept_next_level
    
    ept_next_level was passing a live PTE pointer to ept_set_middle_entry,
    which was then modified without taking into account that the PTE could
    be part of a live EPT table. This wasn't a security issue because the
    pages returned by p2m_alloc_ptp are zeroed, so adding such an entry
    before actually initializing it didn't allow a guest to access
    physical memory addresses it wasn't supposed to access.
    
    This is part of XSA-328.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: bc3d9f95d661372b059a5539ae6cb1e79435bb95
    master date: 2020-07-07 14:37:12 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 1126a58b83..6bd0cd4ff7 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -348,6 +348,8 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
     ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
+    ASSERT(next_level);
+
     shift = next_level * EPT_TABLE_ORDER;
 
     index = *gfn_remainder >> shift;
@@ -364,16 +366,20 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
 
     if ( !is_epte_present(&e) )
     {
+        int rc;
+
         if ( e.sa_p2mt == p2m_populate_on_demand )
             return GUEST_TABLE_POD_PAGE;
 
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        next = ept_set_middle_entry(p2m, ept_entry);
+        next = ept_set_middle_entry(p2m, &e);
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        /* e is now stale and hence may not be used anymore below. */
+
+        rc = atomic_write_ept_entry(ept_entry, e, next_level);
+        ASSERT(rc == 0);
     }
     /* The only time sp would be set here is if we had hit a superpage */
     else if ( is_epte_superpage(&e) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:55:36 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jso4O-0001Bj-Em; Tue, 07 Jul 2020 13:55:36 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jso4N-0001Bb-PP
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:55:35 +0000
X-Inumbo-ID: 87fe8e30-c059-11ea-8d75-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 87fe8e30-c059-11ea-8d75-12813bfff9fa;
 Tue, 07 Jul 2020 13:55:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=9U5n2rvBMmqU/+ZIHfQNud+D/vfyEkCcO/2jdI5JjoE=; b=319LVCXhU4xOnTVO24sOrTav9e
 HoW/4N3OrKIPZGMjBJtL+eppsTZIeuFmhehx/SXVExGzr98JHxRs8z3ovnITLrk3oNLIjpdmCpKQf
 7/Y0PznETMZ9SFRLmI4ueBw99sPKh86LexrA0ZgZ7LA6RrAoggjxCcEqrx12HubC3sYU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso4N-0004k3-CT
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:55:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso4N-0005K0-Aw
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:55:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] vtd: improve IOMMU TLB flush
Message-Id: <E1jso4N-0005K0-Aw@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:55:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 6fe2c30d483c7c02db1d517edd1c708f81e62bd9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:40:56 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:40:56 2020 +0200

    vtd: improve IOMMU TLB flush
    
    Do not limit PSI flushes to order 0 pages, in order to avoid doing a
    full TLB flush if the passed in page has an order greater than 0 and
    is aligned. Should increase the performance of IOMMU TLB flushes when
    dealing with page orders greater than 0.
    
    This is part of XSA-321.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 5fe515a0fede07543f2a3b049167b1fd8b873caf
    master date: 2020-07-07 14:37:46 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 336b778c81..2180f0e899 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -612,13 +612,14 @@ static int __must_check iommu_flush_iotlb(struct domain *d,
         if ( iommu_domid == -1 )
             continue;
 
-        if ( page_count != 1 || gfn == gfn_x(INVALID_GFN) )
+        if ( !page_count || (page_count & (page_count - 1)) ||
+             gfn == gfn_x(INVALID_GFN) || !IS_ALIGNED(gfn, page_count) )
             rc = iommu_flush_iotlb_dsi(iommu, iommu_domid,
                                        0, flush_dev_iotlb);
         else
             rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
                                        (paddr_t)gfn << PAGE_SHIFT_4K,
-                                       PAGE_ORDER_4K,
+                                       get_order_from_pages(page_count),
                                        !dma_old_pte_present,
                                        flush_dev_iotlb);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:55:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jso4Y-0001Co-GU; Tue, 07 Jul 2020 13:55:46 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jso4X-0001Ci-W0
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:55:46 +0000
X-Inumbo-ID: 8e0c5082-c059-11ea-8d75-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8e0c5082-c059-11ea-8d75-12813bfff9fa;
 Tue, 07 Jul 2020 13:55:45 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=PxGbWGr1lhJ6CZjnMsy+az+fZkMhREefQLkZolapzO0=; b=IVsdrm2aLTeBS1RGCcO80h/QG9
 KyttB1k8q3QKRkJk4F6QP77JVPocylPoogW8a8L3XZsoD8nZRWVQ6XzMm6qoDb7cZpVxXbF3meUu7
 KxidWz67Xt7N3a/565WtCLuEEmrzqa0gdD4TMNvVGkTP09tCvsSkuPvaL6mEf8p3LGQM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso4X-0004l2-Fq
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:55:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso4X-0005KU-Ep
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:55:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] vtd: prune (and rename) cache flush functions
Message-Id: <E1jso4X-0005KU-Ep@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:55:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 7338b3371c0535944346fb3336a5e28b5c080658
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:41:18 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:41:18 2020 +0200

    vtd: prune (and rename) cache flush functions
    
    Rename __iommu_flush_cache to iommu_sync_cache and remove
    iommu_flush_cache_page. Also remove the iommu_flush_cache_entry
    wrapper and just use iommu_sync_cache instead. Note the _entry suffix
    was meaningless as the wrapper was already taking a size parameter in
    bytes. While there also constify the addr parameter.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 62298825b9a44f45761acbd758138b5ba059ebd1
    master date: 2020-07-07 14:38:13 +0200
---
 xen/drivers/passthrough/vtd/extern.h   |  3 +--
 xen/drivers/passthrough/vtd/intremap.c |  6 +++---
 xen/drivers/passthrough/vtd/iommu.c    | 31 +++++++++++--------------------
 3 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index d698b1d50a..87d5ed78a2 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -37,8 +37,7 @@ void disable_qinval(struct iommu *iommu);
 int enable_intremap(struct iommu *iommu, int eim);
 void disable_intremap(struct iommu *iommu);
 
-void iommu_flush_cache_entry(void *addr, unsigned int size);
-void iommu_flush_cache_page(void *addr, unsigned long npages);
+void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index 1e0317c47a..1b741a2bdb 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -231,7 +231,7 @@ static void free_remap_entry(struct iommu *iommu, int index)
                      iremap_entries, iremap_entry);
 
     update_irte(iommu, iremap_entry, &new_ire, false);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -403,7 +403,7 @@ static int ioapic_rte_to_remap_entry(struct iommu *iommu,
     }
 
     update_irte(iommu, iremap_entry, &new_ire, !init);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -694,7 +694,7 @@ static int msi_msg_to_remap_entry(
     update_irte(iommu, iremap_entry, &new_ire, msi_desc->irte_initialized);
     msi_desc->irte_initialized = true;
 
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 2180f0e899..8ff1a4d8f7 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -158,7 +158,8 @@ static void __init free_intel_iommu(struct intel_iommu *intel)
 }
 
 static int iommus_incoherent;
-static void __iommu_flush_cache(void *addr, unsigned int size)
+
+void iommu_sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -173,16 +174,6 @@ static void __iommu_flush_cache(void *addr, unsigned int size)
         cacheline_flush((char *)addr + i);
 }
 
-void iommu_flush_cache_entry(void *addr, unsigned int size)
-{
-    __iommu_flush_cache(addr, size);
-}
-
-void iommu_flush_cache_page(void *addr, unsigned long npages)
-{
-    __iommu_flush_cache(addr, PAGE_SIZE * npages);
-}
-
 /* Allocate page table, return its machine address */
 u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
 {
@@ -207,7 +198,7 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_flush_cache_page(vaddr, 1);
+        iommu_sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -242,7 +233,7 @@ static u64 bus_to_context_maddr(struct iommu *iommu, u8 bus)
         }
         set_root_value(*root, maddr);
         set_root_present(*root);
-        iommu_flush_cache_entry(root, sizeof(struct root_entry));
+        iommu_sync_cache(root, sizeof(struct root_entry));
     }
     maddr = (u64) get_context_addr(*root);
     unmap_vtd_domain_page(root_entries);
@@ -300,7 +291,7 @@ static u64 addr_to_dma_page_maddr(struct domain *domain, u64 addr, int alloc)
              */
             dma_set_pte_readable(*pte);
             dma_set_pte_writable(*pte);
-            iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+            iommu_sync_cache(pte, sizeof(struct dma_pte));
         }
 
         if ( level == 2 )
@@ -674,7 +665,7 @@ static int __must_check dma_pte_clear_one(struct domain *domain, u64 addr)
 
     dma_clear_pte(*pte);
     spin_unlock(&hd->arch.mapping_lock);
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     if ( !this_cpu(iommu_dont_flush_iotlb) )
         rc = iommu_flush_iotlb_pages(domain, addr >> PAGE_SHIFT_4K, 1);
@@ -716,7 +707,7 @@ static void iommu_free_page_table(struct page_info *pg)
             iommu_free_pagetable(dma_pte_addr(*pte), next_level);
 
         dma_clear_pte(*pte);
-        iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+        iommu_sync_cache(pte, sizeof(struct dma_pte));
     }
 
     unmap_vtd_domain_page(pt_vaddr);
@@ -1447,7 +1438,7 @@ int domain_context_mapping_one(
     context_set_address_width(*context, agaw);
     context_set_fault_enable(*context);
     context_set_present(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
     spin_unlock(&iommu->lock);
 
     /* Context entry was previously non-present (with domid 0). */
@@ -1594,7 +1585,7 @@ int domain_context_unmap_one(
 
     context_clear_present(*context);
     context_clear_entry(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
 
     iommu_domid= domain_iommu_domid(domain, iommu);
     if ( iommu_domid == -1 )
@@ -1824,7 +1815,7 @@ static int __must_check intel_iommu_map_page(struct domain *d,
 
     *pte = new;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
     spin_unlock(&hd->arch.mapping_lock);
     unmap_vtd_domain_page(page);
 
@@ -1858,7 +1849,7 @@ int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
     int iommu_domid;
     int rc = 0;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     for_each_drhd_unit ( drhd )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:55:57 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:55:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jso4j-0001E6-Jj; Tue, 07 Jul 2020 13:55:57 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jso4i-0001Ds-Aj
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:55:56 +0000
X-Inumbo-ID: 940caf54-c059-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 940caf54-c059-11ea-bca7-bc764e2007e4;
 Tue, 07 Jul 2020 13:55:55 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=gLoPo6WFG8D1isdmDO/S8O8pBLk9WLVVmNli7Z+fKAk=; b=DqbCfF6ZCNGyUe5cIq3L3t4qux
 /ge7NdiSrSs6euIF+gqf2zMfM/YnR47tpMlFRaDhWY761sSIAUk/sNUGbTfc43D6PD5P+zyqFZNw7
 qsCcLHMu2o1bbMEY0HdtDmDF3RyzsO7+o1PBxVFSI7ccBBqf0NhGu8hcWcxQP0RXsLs0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso4h-0004lD-Iz
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:55:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso4h-0005LF-IC
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:55:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] x86/iommu: introduce a cache sync hook
Message-Id: <E1jso4h-0005LF-IC@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:55:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 1c51a292788e3e006dd9b14ec987c5da662d4a50
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:41:49 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:41:49 2020 +0200

    x86/iommu: introduce a cache sync hook
    
    The hook is only implemented for VT-d and it uses the already existing
    iommu_sync_cache function present in VT-d code. The new hook is
    added so that the cache can be flushed by code outside of VT-d when
    using shared page tables.
    
    Note that alloc_pgtable_maddr must use the now locally defined
    sync_cache function, because IOMMU ops are not yet setup the first
    time the function gets called during IOMMU initialization.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 91526b460e5009fc56edbd6809e66c327281faba
    master date: 2020-07-07 14:38:34 +0200
---
 xen/drivers/passthrough/vtd/extern.h | 1 -
 xen/drivers/passthrough/vtd/iommu.c  | 5 +++--
 xen/include/asm-x86/iommu.h          | 7 +++++++
 xen/include/xen/iommu.h              | 1 +
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 87d5ed78a2..00a73d63ea 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -37,7 +37,6 @@ void disable_qinval(struct iommu *iommu);
 int enable_intremap(struct iommu *iommu, int eim);
 void disable_intremap(struct iommu *iommu);
 
-void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 8ff1a4d8f7..6b9a1b6145 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -159,7 +159,7 @@ static void __init free_intel_iommu(struct intel_iommu *intel)
 
 static int iommus_incoherent;
 
-void iommu_sync_cache(const void *addr, unsigned int size)
+static void sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -198,7 +198,7 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_sync_cache(vaddr, PAGE_SIZE);
+        sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -2696,6 +2696,7 @@ const struct iommu_ops intel_iommu_ops = {
     .iotlb_flush_all = iommu_flush_iotlb_all,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_p2m_table = vtd_dump_p2m_table,
+    .sync_cache = sync_cache,
 };
 
 /*
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index dcf2e21402..16ff2e94c2 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -98,6 +98,13 @@ extern bool untrusted_msi;
 int pi_update_irte(const struct pi_desc *pi_desc, const struct pirq *pirq,
                    const uint8_t gvec);
 
+#define iommu_sync_cache(addr, size) ({                 \
+    const struct iommu_ops *ops = iommu_get_ops();      \
+                                                        \
+    if ( ops->sync_cache )                              \
+        ops->sync_cache(addr, size);                    \
+})
+
 #endif /* !__ARCH_X86_IOMMU_H__ */
 /*
  * Local variables:
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 5f9f82ea22..0e3e49e685 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -176,6 +176,7 @@ struct iommu_ops {
     void (*update_ire_from_apic)(unsigned int apic, unsigned int reg, unsigned int value);
     unsigned int (*read_apic_from_ire)(unsigned int apic, unsigned int reg);
     int (*setup_hpet_msi)(struct msi_desc *);
+    void (*sync_cache)(const void *addr, unsigned int size);
 #endif /* CONFIG_X86 */
     int __must_check (*suspend)(void);
     void (*resume)(void);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:56:06 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:56:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jso4s-0001FF-TA; Tue, 07 Jul 2020 13:56:06 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jso4s-0001F6-3L
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:56:06 +0000
X-Inumbo-ID: 9a0d0b6a-c059-11ea-8d75-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 9a0d0b6a-c059-11ea-8d75-12813bfff9fa;
 Tue, 07 Jul 2020 13:56:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=0kbkdANXF9S/XG3EmrmiyyVCbvRrc3UC5wuNnWHCnII=; b=yDpGez1BvYk72ai9yVh0v1tDN8
 1WtsbzaEkCs+zGpyZkh8X4vhss90nRv9RKBMUDgB4RPjpjwgHxk7oPU2XVg93AiTfRVmcKUmmxYwD
 YWMQP2m/7h1ta6u93DhokVE9QZcmuie8zBN50ReaVK/bECJ6j2Li2WLcbBftExwTQFXY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso4r-0004lY-M2
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:56:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso4r-0005Lx-LC
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:56:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] vtd: don't assume addresses are aligned in
 sync_cache
Message-Id: <E1jso4r-0005Lx-LC@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:56:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 83917016f87ca5feeb32f2fdcae32e560bb8d283
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:42:15 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:42:15 2020 +0200

    vtd: don't assume addresses are aligned in sync_cache
    
    Current code in sync_cache assume that the address passed in is
    aligned to a cache line size. Fix the code to support passing in
    arbitrary addresses not necessarily aligned to a cache line size.
    
    This is part of XSA-321.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b6d9398144f21718d25daaf8d72669a75592abc5
    master date: 2020-07-07 14:39:05 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 6b9a1b6145..2c6a69dfbe 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -161,8 +161,8 @@ static int iommus_incoherent;
 
 static void sync_cache(const void *addr, unsigned int size)
 {
-    int i;
-    static unsigned int clflush_size = 0;
+    static unsigned long clflush_size = 0;
+    const void *end = addr + size;
 
     if ( !iommus_incoherent )
         return;
@@ -170,8 +170,9 @@ static void sync_cache(const void *addr, unsigned int size)
     if ( clflush_size == 0 )
         clflush_size = get_cache_line_size();
 
-    for ( i = 0; i < size; i += clflush_size )
-        cacheline_flush((char *)addr + i);
+    addr -= (unsigned long)addr & (clflush_size - 1);
+    for ( ; addr < end; addr += clflush_size )
+        cacheline_flush((char *)addr);
 }
 
 /* Allocate page table, return its machine address */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:56:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jso53-0001Gr-Ul; Tue, 07 Jul 2020 13:56:17 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jso52-0001GU-Bb
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:56:16 +0000
X-Inumbo-ID: a00f8f4c-c059-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a00f8f4c-c059-11ea-bb8b-bc764e2007e4;
 Tue, 07 Jul 2020 13:56:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=ZqAGOBO1y52aCDIXSEy5dmTCcxejBCWGqc31q4Gtaxw=; b=wsulC7kbnAqQq3At53pQ4Vb0AH
 qETQKEoeyB4AkkUDdt225yx30B5Yh3nDbFItfXTBHCNIxwQ3+sD+ZiDxdEitYTBP6HY75ThIYE8BS
 tGlG1YIRTXYunF/o+eyLPaFMZPM6mJ3+ai48WPbe9HcTBYFnsLjqhF/ssP9fdhXyx5DA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso51-0004lf-Oq
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:56:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso51-0005MR-O6
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:56:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] x86/alternative: introduce alternative_2
Message-Id: <E1jso51-0005MR-O6@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:56:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 46d6a0721405149ace209cdf23fa009fd366dbf2
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:42:34 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:42:34 2020 +0200

    x86/alternative: introduce alternative_2
    
    It's based on alternative_io_2 without inputs or outputs but with an
    added memory clobber.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 23570bce00ee6ba2139ece978ab6f03ff166e21d
    master date: 2020-07-07 14:39:25 +0200
---
 xen/include/asm-x86/alternative.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h
index ba537d6b7e..7c34504f89 100644
--- a/xen/include/asm-x86/alternative.h
+++ b/xen/include/asm-x86/alternative.h
@@ -85,6 +85,11 @@ extern void alternative_instructions(void);
 #define alternative(oldinstr, newinstr, feature)                        \
         asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) : : : "memory")
 
+#define alternative_2(oldinstr, newinstr1, feature1, newinstr2, feature2) \
+	asm volatile (ALTERNATIVE_2(oldinstr, newinstr1, feature1,	\
+				    newinstr2, feature2)		\
+		      : : : "memory")
+
 /*
  * Alternative inline assembly with input.
  *
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:56:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:56: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 1jso5E-0001JQ-01; Tue, 07 Jul 2020 13:56:28 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jso5C-0001J8-JK
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:56:26 +0000
X-Inumbo-ID: a6166992-c059-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a6166992-c059-11ea-bb8b-bc764e2007e4;
 Tue, 07 Jul 2020 13:56:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=o++ramJL+MwkcJEyDDB4IfiRZTGvtXfCLsD4O32qzOc=; b=os7bhjPSsFrJmC1OzrsbgveMEJ
 WJYoEUC6DQSjAkj3cIV1r0bZ/1tW6xeGTM59xoDrfSNYeiyYFsqbbs+DU3gJNh0enBuKwZwKRfg/o
 H/X2bHI1EcPjdiiYpNsBhV10amo5KWh8NXODOPvfbY71IOVkGiQUkkd5tjMeihwPz2uw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso5B-0004lr-SK
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:56:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso5B-0005N8-RU
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:56:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] vtd: optimize CPU cache sync
Message-Id: <E1jso5B-0005N8-RU@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:56:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 3c9a98410be01236f1de1ad171885552fae5397a
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:42:59 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:42:59 2020 +0200

    vtd: optimize CPU cache sync
    
    Some VT-d IOMMUs are non-coherent, which requires a cache write back
    in order for the changes made by the CPU to be visible to the IOMMU.
    This cache write back was unconditionally done using clflush, but there are
    other more efficient instructions to do so, hence implement support
    for them using the alternative framework.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a64ea16522a73a13a0d66cfa4b66a9d3b95dd9d6
    master date: 2020-07-07 14:39:54 +0200
---
 xen/drivers/passthrough/vtd/extern.h  |  1 -
 xen/drivers/passthrough/vtd/iommu.c   | 38 ++++++++++++++++++++++++++++++++++-
 xen/drivers/passthrough/vtd/x86/vtd.c |  5 -----
 3 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 00a73d63ea..065d768b52 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -63,7 +63,6 @@ int __must_check qinval_device_iotlb_sync(struct iommu *iommu,
                                           u16 did, u16 size, u64 addr);
 
 unsigned int get_cache_line_size(void);
-void cacheline_flush(char *);
 void flush_all_cache(void);
 
 u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 2c6a69dfbe..2d80d5836c 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -31,6 +31,7 @@
 #include <xen/pci_regs.h>
 #include <xen/keyhandler.h>
 #include <asm/msi.h>
+#include <asm/nops.h>
 #include <asm/irq.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/p2m.h>
@@ -172,7 +173,42 @@ static void sync_cache(const void *addr, unsigned int size)
 
     addr -= (unsigned long)addr & (clflush_size - 1);
     for ( ; addr < end; addr += clflush_size )
-        cacheline_flush((char *)addr);
+/*
+ * The arguments to a macro must not include preprocessor directives. Doing so
+ * results in undefined behavior, so we have to create some defines here in
+ * order to avoid it.
+ */
+#if defined(HAVE_AS_CLWB)
+# define CLWB_ENCODING "clwb %[p]"
+#elif defined(HAVE_AS_XSAVEOPT)
+# define CLWB_ENCODING "data16 xsaveopt %[p]" /* clwb */
+#else
+# define CLWB_ENCODING ".byte 0x66, 0x0f, 0xae, 0x30" /* clwb (%%rax) */
+#endif
+
+#define BASE_INPUT(addr) [p] "m" (*(const char *)(addr))
+#if defined(HAVE_AS_CLWB) || defined(HAVE_AS_XSAVEOPT)
+# define INPUT BASE_INPUT
+#else
+# define INPUT(addr) "a" (addr), BASE_INPUT(addr)
+#endif
+        /*
+         * Note regarding the use of NOP_DS_PREFIX: it's faster to do a clflush
+         * + prefix than a clflush + nop, and hence the prefix is added instead
+         * of letting the alternative framework fill the gap by appending nops.
+         */
+        alternative_io_2(".byte " __stringify(NOP_DS_PREFIX) "; clflush %[p]",
+                         "data16 clflush %[p]", /* clflushopt */
+                         X86_FEATURE_CLFLUSHOPT,
+                         CLWB_ENCODING,
+                         X86_FEATURE_CLWB, /* no outputs */,
+                         INPUT(addr));
+#undef INPUT
+#undef BASE_INPUT
+#undef CLWB_ENCODING
+
+    alternative_2(ASM_NOP3, "sfence", X86_FEATURE_CLFLUSHOPT,
+                            "sfence", X86_FEATURE_CLWB);
 }
 
 /* Allocate page table, return its machine address */
diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c
index 88a60b3307..7f96b91dd4 100644
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -53,11 +53,6 @@ unsigned int get_cache_line_size(void)
     return ((cpuid_ebx(1) >> 8) & 0xff) * 8;
 }
 
-void cacheline_flush(char * addr)
-{
-    clflush(addr);
-}
-
 void flush_all_cache()
 {
     wbinvd();
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:56:38 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13:56: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 1jso5O-0001L7-1x; Tue, 07 Jul 2020 13:56:38 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jso5M-0001Kn-FR
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:56:36 +0000
X-Inumbo-ID: ac1e97e2-c059-11ea-8d75-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ac1e97e2-c059-11ea-8d75-12813bfff9fa;
 Tue, 07 Jul 2020 13:56:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Texu3LBmk6RhGeLboGZIpkU2UuWlCdR/TCvYX2zVQwQ=; b=DpFicTw7PcxkVdZxdoJM/4XUc2
 TtU8VM2V2brqvZoFMcX5v1eafIRvc4DHOK1FES+mddYKAtosrZC+C520UBrVL1gcRjWPnA1AFaYFA
 xaE2yWIxIM3ox7ScLLGFjlK1elWzA3GgFhtV6JgM+rN4tTgkSnsUqCIxxtvT0un3SC/E=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso5L-0004mQ-VO
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:56:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso5L-0005Nv-Uf
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:56:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] x86/ept: flush cache when modifying PTEs and
 sharing page tables
Message-Id: <E1jso5L-0005Nv-Uf@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:56:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a852040fe3ab6658ab0dd4fa8f86f50db9d08874
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:43:29 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:43:29 2020 +0200

    x86/ept: flush cache when modifying PTEs and sharing page tables
    
    Modifications made to the page tables by EPT code need to be written
    to memory when the page tables are shared with the IOMMU, as Intel
    IOMMUs can be non-coherent and thus require changes to be written to
    memory in order to be visible to the IOMMU.
    
    In order to achieve this make sure data is written back to memory
    after writing an EPT entry when the recalc bit is not set in
    atomic_write_ept_entry. If such bit is set, the entry will be
    adjusted and atomic_write_ept_entry will be called a second time
    without the recalc bit set. Note that when splitting a super page the
    new tables resulting of the split should also be written back.
    
    Failure to do so can allow devices behind the IOMMU access to the
    stale super page, or cause coherency issues as changes made by the
    processor to the page tables are not visible to the IOMMU.
    
    This allows to remove the VT-d specific iommu_pte_flush helper, since
    the cache write back is now performed by atomic_write_ept_entry, and
    hence iommu_iotlb_flush can be used to flush the IOMMU TLB. The newly
    used method (iommu_iotlb_flush) can result in less flushes, since it
    might sometimes be called rightly with 0 flags, in which case it
    becomes a no-op.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c23274fd0412381bd75068ebc9f8f8c90a4be748
    master date: 2020-07-07 14:40:11 +0200
---
 xen/arch/x86/mm/p2m-ept.c           | 21 ++++++++++++++-
 xen/drivers/passthrough/vtd/iommu.c | 53 ++-----------------------------------
 xen/include/asm-x86/iommu.h         |  5 ++--
 3 files changed, 25 insertions(+), 54 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 6bd0cd4ff7..036771f43c 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -90,6 +90,19 @@ static int atomic_write_ept_entry(ept_entry_t *entryptr, ept_entry_t new,
 
     write_atomic(&entryptr->epte, new.epte);
 
+    /*
+     * The recalc field on the EPT is used to signal either that a
+     * recalculation of the EMT field is required (which doesn't effect the
+     * IOMMU), or a type change. Type changes can only be between ram_rw,
+     * logdirty and ioreq_server: changes to/from logdirty won't work well with
+     * an IOMMU anyway, as IOMMU #PFs are not synchronous and will lead to
+     * aborts, and changes to/from ioreq_server are already fully flushed
+     * before returning to guest context (see
+     * XEN_DMOP_map_mem_type_to_ioreq_server).
+     */
+    if ( !new.recalc && iommu_hap_pt_share )
+        iommu_sync_cache(entryptr, sizeof(*entryptr));
+
     if ( unlikely(oldmfn != mfn_x(INVALID_MFN)) )
         put_page(mfn_to_page(oldmfn));
 
@@ -319,6 +332,9 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
             break;
     }
 
+    if ( iommu_hap_pt_share )
+        iommu_sync_cache(table, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
     unmap_domain_page(table);
 
     /* Even failed we should install the newly allocated ept page. */
@@ -378,6 +394,9 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
 
+        if ( iommu_hap_pt_share )
+            iommu_sync_cache(next, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
         rc = atomic_write_ept_entry(ept_entry, e, next_level);
         ASSERT(rc == 0);
     }
@@ -873,7 +892,7 @@ out:
          need_modify_vtd_table )
     {
         if ( iommu_hap_pt_share )
-            rc = iommu_pte_flush(d, gfn, &ept_entry->epte, order, vtd_pte_present);
+            rc = iommu_flush_iotlb(d, gfn, vtd_pte_present, 1u << order);
         else
         {
             if ( iommu_flags )
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 2d80d5836c..1cd00dca40 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -612,10 +612,8 @@ static int __must_check iommu_flush_all(void)
     return rc;
 }
 
-static int __must_check iommu_flush_iotlb(struct domain *d,
-                                          unsigned long gfn,
-                                          bool_t dma_old_pte_present,
-                                          unsigned int page_count)
+int iommu_flush_iotlb(struct domain *d, unsigned long gfn,
+                      bool dma_old_pte_present, unsigned int page_count)
 {
     struct domain_iommu *hd = dom_iommu(d);
     struct acpi_drhd_unit *drhd;
@@ -1876,53 +1874,6 @@ static int __must_check intel_iommu_unmap_page(struct domain *d,
     return dma_pte_clear_one(d, (paddr_t)gfn << PAGE_SHIFT_4K);
 }
 
-int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
-                    int order, int present)
-{
-    struct acpi_drhd_unit *drhd;
-    struct iommu *iommu = NULL;
-    struct domain_iommu *hd = dom_iommu(d);
-    bool_t flush_dev_iotlb;
-    int iommu_domid;
-    int rc = 0;
-
-    iommu_sync_cache(pte, sizeof(struct dma_pte));
-
-    for_each_drhd_unit ( drhd )
-    {
-        iommu = drhd->iommu;
-        if ( !test_bit(iommu->index, &hd->arch.iommu_bitmap) )
-            continue;
-
-        flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
-        iommu_domid= domain_iommu_domid(d, iommu);
-        if ( iommu_domid == -1 )
-            continue;
-
-        rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
-                                   (paddr_t)gfn << PAGE_SHIFT_4K,
-                                   order, !present, flush_dev_iotlb);
-        if ( rc > 0 )
-        {
-            iommu_flush_write_buffer(iommu);
-            rc = 0;
-        }
-    }
-
-    if ( unlikely(rc) )
-    {
-        if ( !d->is_shutting_down && printk_ratelimit() )
-            printk(XENLOG_ERR VTDPREFIX
-                   " d%d: IOMMU pages flush failed: %d\n",
-                   d->domain_id, rc);
-
-        if ( !is_hardware_domain(d) )
-            domain_crash(d);
-    }
-
-    return rc;
-}
-
 static int __init vtd_ept_page_compatible(struct iommu *iommu)
 {
     u64 ept_cap, vtd_cap = iommu->cap;
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 16ff2e94c2..dfc9b77594 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -87,8 +87,9 @@ int iommu_setup_hpet_msi(struct msi_desc *);
 
 /* While VT-d specific, this must get declared in a generic header. */
 int adjust_vtd_irq_affinities(void);
-int __must_check iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
-                                 int order, int present);
+int __must_check iommu_flush_iotlb(struct domain *d, unsigned long gfn,
+                                   bool dma_old_pte_present,
+                                   unsigned int page_count);
 bool_t iommu_supports_eim(void);
 int iommu_enable_x2apic_IR(void);
 void iommu_disable_x2apic_IR(void);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 13:56:48 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 13: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 1jso5Y-0001Nc-4z; Tue, 07 Jul 2020 13:56:48 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jso5W-0001NJ-Ml
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:56:46 +0000
X-Inumbo-ID: b223022c-c059-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b223022c-c059-11ea-8496-bc764e2007e4;
 Tue, 07 Jul 2020 13:56:46 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=/CgccdmhkH+AGeTvx2VyFwm5YDqgqq/jzSfYLYlR9VQ=; b=Cs/k2zB7nQh0imJVV1FnVjDbwM
 ty4lF/TJLnUEQRuZeuHphmdHZ1ZvCv37AOLIcJgvFslrn+n14uRJ0ngTtlPuFITtEcfnr8yn1TiaK
 vJDHjeQY+XNgBsD34dh2/9ZZHMC4w+w3Ii/K3f5O5HC7W0sHUVSqpm+feWkII8jdOS2k=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso5W-0004ma-2p
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:56:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jso5W-0005OR-1I
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 13:56:46 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.9] xen: Check the alignment of the offset pased via
 VCPUOP_register_vcpu_info
Message-Id: <E1jso5W-0005OR-1I@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 13:56:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 4597fc97b3b8870c39214e3aa4132ab711a40691
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jul 7 15:43:59 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:43:59 2020 +0200

    xen: Check the alignment of the offset pased via VCPUOP_register_vcpu_info
    
    Currently a guest is able to register any guest physical address to use
    for the vcpu_info structure as long as the structure can fits in the
    rest of the frame.
    
    This means a guest can provide an address that is not aligned to the
    natural alignment of the structure.
    
    On Arm 32-bit, unaligned access are completely forbidden by the
    hypervisor. This will result to a data abort which is fatal.
    
    On Arm 64-bit, unaligned access are only forbidden when used for atomic
    access. As the structure contains fields (such as evtchn_pending_self)
    that are updated using atomic operations, any unaligned access will be
    fatal as well.
    
    While the misalignment is only fatal on Arm, a generic check is added
    as an x86 guest shouldn't sensibly pass an unaligned address (this
    would result to a split lock).
    
    This is XSA-327.
    
    Reported-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    master commit: 3fdc211b01b29f252166937238efe02d15cb5780
    master date: 2020-07-07 14:41:00 +0200
---
 xen/common/domain.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index a49545121b..3bd4875349 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1150,10 +1150,20 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
     void *mapping;
     vcpu_info_t *new_info;
     struct page_info *page;
+    unsigned int align;
 
     if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
         return -EINVAL;
 
+#ifdef CONFIG_COMPAT
+    if ( has_32bit_shinfo(d) )
+        align = alignof(new_info->compat);
+    else
+#endif
+        align = alignof(*new_info);
+    if ( offset & (align - 1) )
+        return -EINVAL;
+
     if ( !mfn_eq(v->vcpu_info_mfn, INVALID_MFN) )
         return -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.9


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 22:00:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 22:00: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 1jsvdF-00047l-8H; Tue, 07 Jul 2020 22:00:05 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsvdD-0003wp-WC
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:00:04 +0000
X-Inumbo-ID: 356311d4-c09d-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 356311d4-c09d-11ea-bca7-bc764e2007e4;
 Tue, 07 Jul 2020 22:00:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Rl2oJCFwOL2lAn7G1ugNe5g9Kv7zukFVAbevxf3MDi0=; b=3KZZ4oCGkNah2GfMGMN/H0ErPN
 Oe2KS573Q7O2gzQ9g43K58hfXJHz8xAkwEwwsUE5SjUTfafruDO3a5S3xLG+Iy/GEjuF6NrO68uXa
 TW8SKQjUG/+csumk8btf+sHoMLyJfgM3TN5P1l40k0KaOIWXBWfia8Noe8g4n9+Yt57U=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsvdC-000649-Fe
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsvdC-0006T6-E1
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:00:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] xen/common: event_channel: Don't ignore error in
 get_free_port()
Message-Id: <E1jsvdC-0006T6-E1@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 22:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 3e41b727f7836d851026e17224ea2a3b177feb6f
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jul 7 15:00:10 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:00:10 2020 +0200

    xen/common: event_channel: Don't ignore error in get_free_port()
    
    Currently, get_free_port() is assuming that the port has been allocated
    when evtchn_allocate_port() is not return -EBUSY.
    
    However, the function may return an error when:
        - We exhausted all the event channels. This can happen if the limit
        configured by the administrator for the guest ('max_event_channels'
        in xl cfg) is higher than the ABI used by the guest. For instance,
        if the guest is using 2L, the limit should not be higher than 4095.
        - We cannot allocate memory (e.g Xen has not more memory).
    
    Users of get_free_port() (such as EVTCHNOP_alloc_unbound) will validly
    assuming the port was valid and will next call evtchn_from_port(). This
    will result to a crash as the memory backing the event channel structure
    is not present.
    
    Fixes: 368ae9a05fe ("xen/pvshim: forward evtchn ops between L0 Xen and L2 DomU")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2e9c2bc292231823a3a021d2e0a9f1956bf00b3c
    master date: 2020-07-07 14:35:36 +0200
---
 xen/common/event_channel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index e86e2bfab0..a8d182b584 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -195,10 +195,10 @@ static int get_free_port(struct domain *d)
     {
         int rc = evtchn_allocate_port(d, port);
 
-        if ( rc == -EBUSY )
-            continue;
-
-        return port;
+        if ( rc == 0 )
+            return port;
+        else if ( rc != -EBUSY )
+            return rc;
     }
 
     return -ENOSPC;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 22:00:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 22:00: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 1jsvdO-0004Bl-9v; Tue, 07 Jul 2020 22:00:14 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsvdN-0004Bg-8H
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:00:13 +0000
X-Inumbo-ID: 3b5f389c-c09d-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3b5f389c-c09d-11ea-b7bb-bc764e2007e4;
 Tue, 07 Jul 2020 22:00:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=z+sP0Ey4hVnzGX+3HvxOqerFD+FQYvNupLE7NnOblJ8=; b=3ZwBcGCw8T0uCubsBeLhMClfB9
 3WYLQ53z9sze/t/MA3MeI18P6vo+bJFb3lVLEvq0n/85te9MLcdvrzvVZ0yc9HD71F+hZpcetMmo5
 hSZZRedoeOveW/Ooes8pu57vyquIjWy8gI60fKqpJV2LJBetgVIlb0SUHkmcV//qYCqs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsvdM-00064D-J9
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsvdM-0006VP-Ho
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:00:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/shadow: correct an inverted conditional in
 dirty VRAM tracking
Message-Id: <E1jsvdM-0006VP-Ho@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 22:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 7a76deb101c8e3d7f6667448f1620957405c0930
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:00:37 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:00:37 2020 +0200

    x86/shadow: correct an inverted conditional in dirty VRAM tracking
    
    This originally was "mfn_x(mfn) == INVALID_MFN". Make it like this
    again, taking the opportunity to also drop the unnecessary nearby
    braces.
    
    This is XSA-319.
    
    Fixes: 246a5a3377c2 ("xen: Use a typesafe to define INVALID_MFN")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 23a216f99d40fbfbc2318ade89d8213eea6ba1f8
    master date: 2020-07-07 14:36:24 +0200
---
 xen/arch/x86/mm/shadow/common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 314d837602..dd8d9240ea 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3249,10 +3249,8 @@ int shadow_track_dirty_vram(struct domain *d,
             int dirty = 0;
             paddr_t sl1ma = dirty_vram->sl1ma[i];
 
-            if ( !mfn_eq(mfn, INVALID_MFN) )
-            {
+            if ( mfn_eq(mfn, INVALID_MFN) )
                 dirty = 1;
-            }
             else
             {
                 page = mfn_to_page(mfn);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 22:00:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 22:00: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 1jsvda-0004Cs-Bl; Tue, 07 Jul 2020 22:00:26 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsvdZ-0004Cn-Cm
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:00:25 +0000
X-Inumbo-ID: 41666134-c09d-11ea-8df7-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 41666134-c09d-11ea-8df7-12813bfff9fa;
 Tue, 07 Jul 2020 22:00:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=dXfBDjlqXUGPtu5z6o7BeEEpPlE/KS8KQFFIwAWOXh4=; b=5iSJtMXi+QuPHRYKEMqO0HNYq/
 gOZYesyFS2zxKllBKGMbCaLFjrP7gUJjjCZuqZO17gWDHzj0JIlzqOtJ4Tdx4VE01n2gXihdjC/8V
 7WDgIw3fdVLZZFDyx4S7xoYV4yCb5Lt0hMC65Ln3ZXN40Tk1L9sjKYkzxqBTNPJOEoVM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsvdW-00064S-MA
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsvdW-0006XO-LF
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:00:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/EPT: ept_set_middle_entry() related adjustments
Message-Id: <E1jsvdW-0006XO-LF@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 22:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 56e117f504f83d1576bf62b53bf70e4a82e2a877
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:01:08 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:01:08 2020 +0200

    x86/EPT: ept_set_middle_entry() related adjustments
    
    ept_split_super_page() wants to further modify the newly allocated
    table, so have ept_set_middle_entry() return the mapped pointer rather
    than tearing it down and then getting re-established right again.
    
    Similarly ept_next_level() wants to hand back a mapped pointer of
    the next level page, so re-use the one established by
    ept_set_middle_entry() in case that path was taken.
    
    Pull the setting of suppress_ve ahead of insertion into the higher level
    table, and don't have ept_split_super_page() set the field a 2nd time.
    
    This is part of XSA-328.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 1104288186ee73a7f9bfa41cbaa5bb7611521028
    master date: 2020-07-07 14:36:52 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 41 ++++++++++++++++++-----------------------
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index b5517769c9..9abbd9e680 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -187,8 +187,9 @@ static void ept_p2m_type_to_flags(struct p2m_domain *p2m, ept_entry_t *entry,
 #define GUEST_TABLE_SUPER_PAGE  2
 #define GUEST_TABLE_POD_PAGE    3
 
-/* Fill in middle levels of ept table */
-static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
+/* Fill in middle level of ept table; return pointer to mapped new table. */
+static ept_entry_t *ept_set_middle_entry(struct p2m_domain *p2m,
+                                         ept_entry_t *ept_entry)
 {
     mfn_t mfn;
     ept_entry_t *table;
@@ -196,7 +197,12 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     mfn = p2m_alloc_ptp(p2m, 0);
     if ( mfn_eq(mfn, INVALID_MFN) )
-        return 0;
+        return NULL;
+
+    table = map_domain_page(mfn);
+
+    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
+        table[i].suppress_ve = 1;
 
     ept_entry->epte = 0;
     ept_entry->mfn = mfn_x(mfn);
@@ -208,14 +214,7 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     ept_entry->suppress_ve = 1;
 
-    table = map_domain_page(mfn);
-
-    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
-        table[i].suppress_ve = 1;
-
-    unmap_domain_page(table);
-
-    return 1;
+    return table;
 }
 
 /* free ept sub tree behind an entry */
@@ -253,10 +252,10 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
 
     ASSERT(is_epte_superpage(ept_entry));
 
-    if ( !ept_set_middle_entry(p2m, &new_ept) )
+    table = ept_set_middle_entry(p2m, &new_ept);
+    if ( !table )
         return 0;
 
-    table = map_domain_page(_mfn(new_ept.mfn));
     trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER);
 
     for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
@@ -267,7 +266,6 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
         epte->sp = (level > 1);
         epte->mfn += i * trunk;
         epte->snp = is_iommu_enabled(p2m->domain) && iommu_snoop;
-        epte->suppress_ve = 1;
 
         ept_p2m_type_to_flags(p2m, epte, epte->sa_p2mt, epte->access);
 
@@ -306,8 +304,7 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
                           ept_entry_t **table, unsigned long *gfn_remainder,
                           int next_level)
 {
-    unsigned long mfn;
-    ept_entry_t *ept_entry, e;
+    ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
     shift = next_level * EPT_TABLE_ORDER;
@@ -332,19 +329,17 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        if ( !ept_set_middle_entry(p2m, ept_entry) )
+        next = ept_set_middle_entry(p2m, ept_entry);
+        if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        else
-            e = atomic_read_ept_entry(ept_entry); /* Refresh */
+        /* e is now stale and hence may not be used anymore below. */
     }
-
     /* The only time sp would be set here is if we had hit a superpage */
-    if ( is_epte_superpage(&e) )
+    else if ( is_epte_superpage(&e) )
         return GUEST_TABLE_SUPER_PAGE;
 
-    mfn = e.mfn;
     unmap_domain_page(*table);
-    *table = map_domain_page(_mfn(mfn));
+    *table = next ?: map_domain_page(_mfn(e.mfn));
     *gfn_remainder &= (1UL << shift) - 1;
     return GUEST_TABLE_NORMAL_PAGE;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 22:00:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 22:00: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 1jsvdi-0004EO-Dq; Tue, 07 Jul 2020 22:00:34 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsvdh-0004Dd-Hd
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:00:33 +0000
X-Inumbo-ID: 4766952c-c09d-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4766952c-c09d-11ea-bb8b-bc764e2007e4;
 Tue, 07 Jul 2020 22:00:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=V+4eXnv0HpxegYmznGKn7Qrcn/sNJADpiuHuEnYlsxc=; b=uXeOQkc1n3T4EXmhpTFtaOS98H
 RcOb4gN5BIP5aWu631ti6mNJIa56gBOgbDDqX2e9U+4CqrlBRsZfd09j/hTkSBiTTc3HJX4qpLLww
 OwRzG4uaMd4W+R3P5/XKzyZWbICkF7x9Xku18ogkrG20NOzFUzyaIlB+NyuAZbgjlRIk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsvdg-00064a-PC
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsvdg-0006ZZ-OK
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:00:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/ept: atomically modify entries in ept_next_level
Message-Id: <E1jsvdg-0006ZZ-OK@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 22:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 2b34d8cd734a46f59e8a697d339b10e64514ab3d
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:01:30 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:01:30 2020 +0200

    x86/ept: atomically modify entries in ept_next_level
    
    ept_next_level was passing a live PTE pointer to ept_set_middle_entry,
    which was then modified without taking into account that the PTE could
    be part of a live EPT table. This wasn't a security issue because the
    pages returned by p2m_alloc_ptp are zeroed, so adding such an entry
    before actually initializing it didn't allow a guest to access
    physical memory addresses it wasn't supposed to access.
    
    This is part of XSA-328.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: bc3d9f95d661372b059a5539ae6cb1e79435bb95
    master date: 2020-07-07 14:37:12 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 9abbd9e680..07236e963d 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -307,6 +307,8 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
     ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
+    ASSERT(next_level);
+
     shift = next_level * EPT_TABLE_ORDER;
 
     index = *gfn_remainder >> shift;
@@ -323,16 +325,20 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
 
     if ( !is_epte_present(&e) )
     {
+        int rc;
+
         if ( e.sa_p2mt == p2m_populate_on_demand )
             return GUEST_TABLE_POD_PAGE;
 
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        next = ept_set_middle_entry(p2m, ept_entry);
+        next = ept_set_middle_entry(p2m, &e);
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        /* e is now stale and hence may not be used anymore below. */
+
+        rc = atomic_write_ept_entry(p2m, ept_entry, e, next_level);
+        ASSERT(rc == 0);
     }
     /* The only time sp would be set here is if we had hit a superpage */
     else if ( is_epte_superpage(&e) )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 22:00:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 22:00: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 1jsvds-0004FK-Ft; Tue, 07 Jul 2020 22:00:44 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsvdr-0004FA-Ge
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:00:43 +0000
X-Inumbo-ID: 4d711d5c-c09d-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4d711d5c-c09d-11ea-b7bb-bc764e2007e4;
 Tue, 07 Jul 2020 22:00:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=wQ45Zw4EsSKSf/KWWjvpT3zvjaR3ZFjV3PUGg6SGQ9A=; b=BqPr+wRiDZVPOq1SgpWV6S+ik/
 TE/c5/jUh3n0xUpexqSAKLxtRw/qNjLo3ItWGtMbZdshXqgccf5cBftx1odIUfjomYMo5y62lPRIS
 0tSDPSqrF2buimQUx6ySpfh0xulm08o3n8gwZj6lea88dwb3j0OM2gMEXVYvwqfv0aeM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsvdq-000662-TP
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsvdq-0006bP-RL
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:00:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] vtd: improve IOMMU TLB flush
Message-Id: <E1jsvdq-0006bP-RL@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 22:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 1c7a98cab9101d8fedadd0bb0ccafc4498b37560
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:01:57 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:01:57 2020 +0200

    vtd: improve IOMMU TLB flush
    
    Do not limit PSI flushes to order 0 pages, in order to avoid doing a
    full TLB flush if the passed in page has an order greater than 0 and
    is aligned. Should increase the performance of IOMMU TLB flushes when
    dealing with page orders greater than 0.
    
    This is part of XSA-321.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 5fe515a0fede07543f2a3b049167b1fd8b873caf
    master date: 2020-07-07 14:37:46 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 26401c7e64..77cdc21837 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -570,13 +570,14 @@ static int __must_check iommu_flush_iotlb(struct domain *d, dfn_t dfn,
         if ( iommu_domid == -1 )
             continue;
 
-        if ( page_count != 1 || dfn_eq(dfn, INVALID_DFN) )
+        if ( !page_count || (page_count & (page_count - 1)) ||
+             dfn_eq(dfn, INVALID_DFN) || !IS_ALIGNED(dfn_x(dfn), page_count) )
             rc = iommu_flush_iotlb_dsi(iommu, iommu_domid,
                                        0, flush_dev_iotlb);
         else
             rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
                                        dfn_to_daddr(dfn),
-                                       PAGE_ORDER_4K,
+                                       get_order_from_pages(page_count),
                                        !dma_old_pte_present,
                                        flush_dev_iotlb);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 22:00:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 22:00: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 1jsve3-0004GS-JU; Tue, 07 Jul 2020 22:00:55 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsve1-0004GK-U0
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:00:53 +0000
X-Inumbo-ID: 5375c9b4-c09d-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5375c9b4-c09d-11ea-8496-bc764e2007e4;
 Tue, 07 Jul 2020 22:00:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=3ay1OHjSoU5haf9b4DOfYf4FgX1Pa8WGzvZZ1pBRGbY=; b=QCxdzGCw6RXEVC7mKcSayoug6/
 bsOGZ5VvrFF7zMkXATTJU1lIN38PUnZoVxLItAzfrTO9B4XpnArqVVfNhpBUVgL2frLHYzRnqsynP
 Kc+682vaJaEZyWxoagtRSOdjLt53HjZ4J/8TFlkTpqWeVfmQgZOOdsm8zkN/O67taxWo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsve1-00066F-0l
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:00:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsve0-0006d5-Vh
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:00:52 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] vtd: prune (and rename) cache flush functions
Message-Id: <E1jsve0-0006d5-Vh@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 22:00:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 005d5eaa458df4bb781998442997e8a3acef4d08
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:02:27 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:02:27 2020 +0200

    vtd: prune (and rename) cache flush functions
    
    Rename __iommu_flush_cache to iommu_sync_cache and remove
    iommu_flush_cache_page. Also remove the iommu_flush_cache_entry
    wrapper and just use iommu_sync_cache instead. Note the _entry suffix
    was meaningless as the wrapper was already taking a size parameter in
    bytes. While there also constify the addr parameter.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 62298825b9a44f45761acbd758138b5ba059ebd1
    master date: 2020-07-07 14:38:13 +0200
---
 xen/drivers/passthrough/vtd/extern.h   |  3 +--
 xen/drivers/passthrough/vtd/intremap.c |  6 +++---
 xen/drivers/passthrough/vtd/iommu.c    | 33 ++++++++++++---------------------
 3 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 994d360e90..52b5e1c60d 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -43,8 +43,7 @@ void disable_qinval(struct vtd_iommu *iommu);
 int enable_intremap(struct vtd_iommu *iommu, int eim);
 void disable_intremap(struct vtd_iommu *iommu);
 
-void iommu_flush_cache_entry(void *addr, unsigned int size);
-void iommu_flush_cache_page(void *addr, unsigned long npages);
+void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index bf846195c4..a2f02c1bea 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -230,7 +230,7 @@ static void free_remap_entry(struct vtd_iommu *iommu, int index)
                      iremap_entries, iremap_entry);
 
     update_irte(iommu, iremap_entry, &new_ire, false);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -406,7 +406,7 @@ static int ioapic_rte_to_remap_entry(struct vtd_iommu *iommu,
     }
 
     update_irte(iommu, iremap_entry, &new_ire, !init);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -695,7 +695,7 @@ static int msi_msg_to_remap_entry(
     update_irte(iommu, iremap_entry, &new_ire, msi_desc->irte_initialized);
     msi_desc->irte_initialized = true;
 
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 77cdc21837..d74f3323a4 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -140,7 +140,8 @@ static int context_get_domain_id(struct context_entry *context,
 }
 
 static int iommus_incoherent;
-static void __iommu_flush_cache(void *addr, unsigned int size)
+
+void iommu_sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -155,16 +156,6 @@ static void __iommu_flush_cache(void *addr, unsigned int size)
         cacheline_flush((char *)addr + i);
 }
 
-void iommu_flush_cache_entry(void *addr, unsigned int size)
-{
-    __iommu_flush_cache(addr, size);
-}
-
-void iommu_flush_cache_page(void *addr, unsigned long npages)
-{
-    __iommu_flush_cache(addr, PAGE_SIZE * npages);
-}
-
 /* Allocate page table, return its machine address */
 uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
 {
@@ -183,7 +174,7 @@ uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_flush_cache_page(vaddr, 1);
+        iommu_sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -216,7 +207,7 @@ static u64 bus_to_context_maddr(struct vtd_iommu *iommu, u8 bus)
         }
         set_root_value(*root, maddr);
         set_root_present(*root);
-        iommu_flush_cache_entry(root, sizeof(struct root_entry));
+        iommu_sync_cache(root, sizeof(struct root_entry));
     }
     maddr = (u64) get_context_addr(*root);
     unmap_vtd_domain_page(root_entries);
@@ -263,7 +254,7 @@ static u64 addr_to_dma_page_maddr(struct domain *domain, u64 addr, int alloc)
              */
             dma_set_pte_readable(*pte);
             dma_set_pte_writable(*pte);
-            iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+            iommu_sync_cache(pte, sizeof(struct dma_pte));
         }
 
         if ( level == 2 )
@@ -640,7 +631,7 @@ static int __must_check dma_pte_clear_one(struct domain *domain, u64 addr,
     *flush_flags |= IOMMU_FLUSHF_modified;
 
     spin_unlock(&hd->arch.mapping_lock);
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     unmap_vtd_domain_page(page);
 
@@ -679,7 +670,7 @@ static void iommu_free_page_table(struct page_info *pg)
             iommu_free_pagetable(dma_pte_addr(*pte), next_level);
 
         dma_clear_pte(*pte);
-        iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+        iommu_sync_cache(pte, sizeof(struct dma_pte));
     }
 
     unmap_vtd_domain_page(pt_vaddr);
@@ -1400,7 +1391,7 @@ int domain_context_mapping_one(
     context_set_address_width(*context, agaw);
     context_set_fault_enable(*context);
     context_set_present(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
     spin_unlock(&iommu->lock);
 
     /* Context entry was previously non-present (with domid 0). */
@@ -1564,7 +1555,7 @@ int domain_context_unmap_one(
 
     context_clear_present(*context);
     context_clear_entry(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
 
     iommu_domid= domain_iommu_domid(domain, iommu);
     if ( iommu_domid == -1 )
@@ -1791,7 +1782,7 @@ static int __must_check intel_iommu_map_page(struct domain *d, dfn_t dfn,
 
     *pte = new;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
     spin_unlock(&hd->arch.mapping_lock);
     unmap_vtd_domain_page(page);
 
@@ -1866,7 +1857,7 @@ int iommu_pte_flush(struct domain *d, uint64_t dfn, uint64_t *pte,
     int iommu_domid;
     int rc = 0;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     for_each_drhd_unit ( drhd )
     {
@@ -2724,7 +2715,7 @@ static int __init intel_iommu_quarantine_init(struct domain *d)
             dma_set_pte_addr(*pte, maddr);
             dma_set_pte_readable(*pte);
         }
-        iommu_flush_cache_page(parent, 1);
+        iommu_sync_cache(parent, PAGE_SIZE);
 
         unmap_vtd_domain_page(parent);
         parent = map_vtd_domain_page(maddr);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 22:01:05 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 22:01: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 1jsveD-0004Hb-LB; Tue, 07 Jul 2020 22:01:05 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsveB-0004HO-SK
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:01:03 +0000
X-Inumbo-ID: 5979c770-c09d-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5979c770-c09d-11ea-bca7-bc764e2007e4;
 Tue, 07 Jul 2020 22:01:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=b855Di6cl/16/G/F5j4EUDXV9NrZbr5p2KS6r0uCqoE=; b=5+ID8RzHr+Mcy3BPPpg/3iDnDz
 R2Ph5SfZOgJsQ14OX12waOgdmDQ8KseqsKx+IgBdcwnnXbPYXsK/GkAkpsSpDzO11nj4yVu71GiOM
 PtRKIIqji5Ngj5R+uAvUXCSoeEKIDW3/YBe2JHsbfO/7LIzvMTCvb1gNtN2+Q7rFRkMo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsveB-00066a-43
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:01:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsveB-0006fD-31
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:01:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/iommu: introduce a cache sync hook
Message-Id: <E1jsveB-0006fD-31@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 22:01:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit f1055a202d49839412e99374b97001d56bcaa118
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:02:56 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:02:56 2020 +0200

    x86/iommu: introduce a cache sync hook
    
    The hook is only implemented for VT-d and it uses the already existing
    iommu_sync_cache function present in VT-d code. The new hook is
    added so that the cache can be flushed by code outside of VT-d when
    using shared page tables.
    
    Note that alloc_pgtable_maddr must use the now locally defined
    sync_cache function, because IOMMU ops are not yet setup the first
    time the function gets called during IOMMU initialization.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 91526b460e5009fc56edbd6809e66c327281faba
    master date: 2020-07-07 14:38:34 +0200
---
 xen/drivers/passthrough/vtd/extern.h | 1 -
 xen/drivers/passthrough/vtd/iommu.c  | 5 +++--
 xen/include/asm-x86/iommu.h          | 7 +++++++
 xen/include/xen/iommu.h              | 1 +
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 52b5e1c60d..f15947af1f 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -43,7 +43,6 @@ void disable_qinval(struct vtd_iommu *iommu);
 int enable_intremap(struct vtd_iommu *iommu, int eim);
 void disable_intremap(struct vtd_iommu *iommu);
 
-void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index d74f3323a4..5e57bc61a3 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -141,7 +141,7 @@ static int context_get_domain_id(struct context_entry *context,
 
 static int iommus_incoherent;
 
-void iommu_sync_cache(const void *addr, unsigned int size)
+static void sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -174,7 +174,7 @@ uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_sync_cache(vaddr, PAGE_SIZE);
+        sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -2763,6 +2763,7 @@ const struct iommu_ops __initconstrel intel_iommu_ops = {
     .iotlb_flush_all = iommu_flush_iotlb_all,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_p2m_table = vtd_dump_p2m_table,
+    .sync_cache = sync_cache,
 };
 
 const struct iommu_init_ops __initconstrel intel_iommu_init_ops = {
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 85741f7c96..864e025078 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -121,6 +121,13 @@ extern bool untrusted_msi;
 int pi_update_irte(const struct pi_desc *pi_desc, const struct pirq *pirq,
                    const uint8_t gvec);
 
+#define iommu_sync_cache(addr, size) ({                 \
+    const struct iommu_ops *ops = iommu_get_ops();      \
+                                                        \
+    if ( ops->sync_cache )                              \
+        iommu_vcall(ops, sync_cache, addr, size);       \
+})
+
 #endif /* !__ARCH_X86_IOMMU_H__ */
 /*
  * Local variables:
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 6f79fb79f3..041a7cf5e5 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -250,6 +250,7 @@ struct iommu_ops {
     int (*setup_hpet_msi)(struct msi_desc *);
 
     int (*adjust_irq_affinities)(void);
+    void (*sync_cache)(const void *addr, unsigned int size);
 #endif /* CONFIG_X86 */
 
     int __must_check (*suspend)(void);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 22:01:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 22:01: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 1jsveN-0004Iw-Mt; Tue, 07 Jul 2020 22:01:15 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsveL-0004Ih-So
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:01:13 +0000
X-Inumbo-ID: 5ecda05d-c09d-11ea-8df7-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5ecda05d-c09d-11ea-8df7-12813bfff9fa;
 Tue, 07 Jul 2020 22:01:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=U0wdC1hGP6SJ07DeV25caWs1wspRT5zVa9egscH1J4Q=; b=QNqGG4uJyKNUXNHwcN4fzVmEnF
 dRInWOOiYCK+qscf99ssjZjR0CcEY34Aa96x8FLFtQTzvDR/aTGAImAyfCTHzJSAAQp8zhz4Fzksm
 P2RKIYH/sbWz3OtRhP1dxDB1YcIB33NWr7y4tcelIGBH8HrIoOdyD6HOz9S9Hdq1z1eU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsveL-00066i-7a
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:01:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsveL-0006gt-6G
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:01:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] vtd: don't assume addresses are aligned in
 sync_cache
Message-Id: <E1jsveL-0006gt-6G@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 22:01:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 8b9be8f415f2a5c6cdca5ac84e8c40a273c03e32
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:03:33 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:03:33 2020 +0200

    vtd: don't assume addresses are aligned in sync_cache
    
    Current code in sync_cache assume that the address passed in is
    aligned to a cache line size. Fix the code to support passing in
    arbitrary addresses not necessarily aligned to a cache line size.
    
    This is part of XSA-321.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b6d9398144f21718d25daaf8d72669a75592abc5
    master date: 2020-07-07 14:39:05 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 5e57bc61a3..81545861d6 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -143,8 +143,8 @@ static int iommus_incoherent;
 
 static void sync_cache(const void *addr, unsigned int size)
 {
-    int i;
-    static unsigned int clflush_size = 0;
+    static unsigned long clflush_size = 0;
+    const void *end = addr + size;
 
     if ( !iommus_incoherent )
         return;
@@ -152,8 +152,9 @@ static void sync_cache(const void *addr, unsigned int size)
     if ( clflush_size == 0 )
         clflush_size = get_cache_line_size();
 
-    for ( i = 0; i < size; i += clflush_size )
-        cacheline_flush((char *)addr + i);
+    addr -= (unsigned long)addr & (clflush_size - 1);
+    for ( ; addr < end; addr += clflush_size )
+        cacheline_flush((char *)addr);
 }
 
 /* Allocate page table, return its machine address */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 22:01:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 22:01: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 1jsveX-0004K2-OZ; Tue, 07 Jul 2020 22:01:25 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsveV-0004Jq-WE
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:01:24 +0000
X-Inumbo-ID: 658fd3ec-c09d-11ea-8df7-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 658fd3ec-c09d-11ea-8df7-12813bfff9fa;
 Tue, 07 Jul 2020 22:01:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=v+PHejb1qSbMqiBCgsBsZWbA44EW6dAAqHqQmPcCRPc=; b=dPHLbyOABgcPkSUTF/PzoJMKj1
 vvMrAzZWlmQHGn9Aq+zJ1k3FD9ouAjJU1smQqlgHUNfGk4XC+Yab1vI1YYyYYZyGgXnU6uUD8vHa0
 V81j+YlI7TFdFjEaTTfKkz6LnmT2lDC8OsE8GAdbS0mjFRlE/lUB8TY74HDR35G81fu4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsveV-00066s-Ae
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:01:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsveV-0006iV-9n
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:01:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/alternative: introduce alternative_2
Message-Id: <E1jsveV-0006iV-9n@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 22:01:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 493e143a8289f7826363b52e9b9a46b49150cfae
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:03:56 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:03:56 2020 +0200

    x86/alternative: introduce alternative_2
    
    It's based on alternative_io_2 without inputs or outputs but with an
    added memory clobber.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 23570bce00ee6ba2139ece978ab6f03ff166e21d
    master date: 2020-07-07 14:39:25 +0200
---
 xen/include/asm-x86/alternative.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h
index 92e3581bc2..8e78cc91c3 100644
--- a/xen/include/asm-x86/alternative.h
+++ b/xen/include/asm-x86/alternative.h
@@ -114,6 +114,11 @@ extern void alternative_branches(void);
 #define alternative(oldinstr, newinstr, feature)                        \
         asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) : : : "memory")
 
+#define alternative_2(oldinstr, newinstr1, feature1, newinstr2, feature2) \
+	asm volatile (ALTERNATIVE_2(oldinstr, newinstr1, feature1,	\
+				    newinstr2, feature2)		\
+		      : : : "memory")
+
 /*
  * Alternative inline assembly with input.
  *
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 22:01:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 22:01: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 1jsveh-0004LV-QN; Tue, 07 Jul 2020 22:01:35 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsveg-0004LJ-6t
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:01:34 +0000
X-Inumbo-ID: 6b899d6e-c09d-11ea-8df7-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 6b899d6e-c09d-11ea-8df7-12813bfff9fa;
 Tue, 07 Jul 2020 22:01:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=EeBAFeOne3dScsGst7siQQvxxnQdpHkoAGJ6xYW/Hqg=; b=4+ZYR5Ug5rHXPbtAQaIMXjsrIj
 lnhJoau9OKSluNGV9RVUWtrAJ/bLRftzZRrHH7V6RHvgYBqjPtrveMJu20J+/FUsxrnRHNm5s375w
 Ld9kB4xgF3+uUZUUp++6sqWQe1fVPEEOcLdmECG7zivGlnM9SQjKKVIK2TpdTRTsD5IU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsvef-00066z-Dd
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:01:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsvef-0006jx-Cv
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:01:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] vtd: optimize CPU cache sync
Message-Id: <E1jsvef-0006jx-Cv@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 22:01:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 0c8c10d12e98372f698cbfed6c08e4bff0937f1a
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:04:29 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:04:29 2020 +0200

    vtd: optimize CPU cache sync
    
    Some VT-d IOMMUs are non-coherent, which requires a cache write back
    in order for the changes made by the CPU to be visible to the IOMMU.
    This cache write back was unconditionally done using clflush, but there are
    other more efficient instructions to do so, hence implement support
    for them using the alternative framework.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a64ea16522a73a13a0d66cfa4b66a9d3b95dd9d6
    master date: 2020-07-07 14:39:54 +0200
---
 xen/drivers/passthrough/vtd/extern.h  |  1 -
 xen/drivers/passthrough/vtd/iommu.c   | 38 ++++++++++++++++++++++++++++++++++-
 xen/drivers/passthrough/vtd/x86/vtd.c |  5 -----
 3 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index f15947af1f..f776feefe6 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -68,7 +68,6 @@ int __must_check qinval_device_iotlb_sync(struct vtd_iommu *iommu,
                                           u16 did, u16 size, u64 addr);
 
 unsigned int get_cache_line_size(void);
-void cacheline_flush(char *);
 void flush_all_cache(void);
 
 uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 81545861d6..2919ada738 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -31,6 +31,7 @@
 #include <xen/pci_regs.h>
 #include <xen/keyhandler.h>
 #include <asm/msi.h>
+#include <asm/nops.h>
 #include <asm/irq.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/p2m.h>
@@ -154,7 +155,42 @@ static void sync_cache(const void *addr, unsigned int size)
 
     addr -= (unsigned long)addr & (clflush_size - 1);
     for ( ; addr < end; addr += clflush_size )
-        cacheline_flush((char *)addr);
+/*
+ * The arguments to a macro must not include preprocessor directives. Doing so
+ * results in undefined behavior, so we have to create some defines here in
+ * order to avoid it.
+ */
+#if defined(HAVE_AS_CLWB)
+# define CLWB_ENCODING "clwb %[p]"
+#elif defined(HAVE_AS_XSAVEOPT)
+# define CLWB_ENCODING "data16 xsaveopt %[p]" /* clwb */
+#else
+# define CLWB_ENCODING ".byte 0x66, 0x0f, 0xae, 0x30" /* clwb (%%rax) */
+#endif
+
+#define BASE_INPUT(addr) [p] "m" (*(const char *)(addr))
+#if defined(HAVE_AS_CLWB) || defined(HAVE_AS_XSAVEOPT)
+# define INPUT BASE_INPUT
+#else
+# define INPUT(addr) "a" (addr), BASE_INPUT(addr)
+#endif
+        /*
+         * Note regarding the use of NOP_DS_PREFIX: it's faster to do a clflush
+         * + prefix than a clflush + nop, and hence the prefix is added instead
+         * of letting the alternative framework fill the gap by appending nops.
+         */
+        alternative_io_2(".byte " __stringify(NOP_DS_PREFIX) "; clflush %[p]",
+                         "data16 clflush %[p]", /* clflushopt */
+                         X86_FEATURE_CLFLUSHOPT,
+                         CLWB_ENCODING,
+                         X86_FEATURE_CLWB, /* no outputs */,
+                         INPUT(addr));
+#undef INPUT
+#undef BASE_INPUT
+#undef CLWB_ENCODING
+
+    alternative_2("", "sfence", X86_FEATURE_CLFLUSHOPT,
+                      "sfence", X86_FEATURE_CLWB);
 }
 
 /* Allocate page table, return its machine address */
diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c
index ff456e1e70..229938f3a8 100644
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -51,11 +51,6 @@ unsigned int get_cache_line_size(void)
     return ((cpuid_ebx(1) >> 8) & 0xff) * 8;
 }
 
-void cacheline_flush(char * addr)
-{
-    clflush(addr);
-}
-
 void flush_all_cache()
 {
     wbinvd();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 22:01:45 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 22:01: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 1jsver-0004Mm-TQ; Tue, 07 Jul 2020 22:01:45 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsveq-0004MX-Eq
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:01:44 +0000
X-Inumbo-ID: 7190d04c-c09d-11ea-8df7-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7190d04c-c09d-11ea-8df7-12813bfff9fa;
 Tue, 07 Jul 2020 22:01:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=dxuR8St7lMSGsBErSSAFrf8dZGHvN1hO1dm2+SMaHLA=; b=xW0Nfg3qNaxpG0I2y5JJK2QHOz
 lCfYu9cQsnPrc3B82DceP1BH0YeNbCd4Y2tCn+pT+nPbtZpjfXHdz0hcyaiAn6ZVe1NhSGlHeJ2oK
 Q8lLtKAWN/j26ZDs0GaF6m5vxSn4kJPg/ZmKLKGrbx2lcnumKGlebpx5fOphL7f8PUCY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsvep-00067o-Go
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:01:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsvep-0006lg-Fn
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:01:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] x86/ept: flush cache when modifying PTEs and
 sharing page tables
Message-Id: <E1jsvep-0006lg-Fn@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 22:01:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 572e349de17e001b385b6eba1a5104d1b38b3960
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:04:57 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:04:57 2020 +0200

    x86/ept: flush cache when modifying PTEs and sharing page tables
    
    Modifications made to the page tables by EPT code need to be written
    to memory when the page tables are shared with the IOMMU, as Intel
    IOMMUs can be non-coherent and thus require changes to be written to
    memory in order to be visible to the IOMMU.
    
    In order to achieve this make sure data is written back to memory
    after writing an EPT entry when the recalc bit is not set in
    atomic_write_ept_entry. If such bit is set, the entry will be
    adjusted and atomic_write_ept_entry will be called a second time
    without the recalc bit set. Note that when splitting a super page the
    new tables resulting of the split should also be written back.
    
    Failure to do so can allow devices behind the IOMMU access to the
    stale super page, or cause coherency issues as changes made by the
    processor to the page tables are not visible to the IOMMU.
    
    This allows to remove the VT-d specific iommu_pte_flush helper, since
    the cache write back is now performed by atomic_write_ept_entry, and
    hence iommu_iotlb_flush can be used to flush the IOMMU TLB. The newly
    used method (iommu_iotlb_flush) can result in less flushes, since it
    might sometimes be called rightly with 0 flags, in which case it
    becomes a no-op.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c23274fd0412381bd75068ebc9f8f8c90a4be748
    master date: 2020-07-07 14:40:11 +0200
---
 xen/arch/x86/mm/p2m-ept.c           | 24 ++++++++++++++++++-
 xen/drivers/passthrough/vtd/iommu.c | 47 -------------------------------------
 xen/include/asm-x86/iommu.h         |  4 ----
 3 files changed, 23 insertions(+), 52 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 07236e963d..9c1627dbb3 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -58,6 +58,19 @@ static int atomic_write_ept_entry(struct p2m_domain *p2m,
 
     write_atomic(&entryptr->epte, new.epte);
 
+    /*
+     * The recalc field on the EPT is used to signal either that a
+     * recalculation of the EMT field is required (which doesn't effect the
+     * IOMMU), or a type change. Type changes can only be between ram_rw,
+     * logdirty and ioreq_server: changes to/from logdirty won't work well with
+     * an IOMMU anyway, as IOMMU #PFs are not synchronous and will lead to
+     * aborts, and changes to/from ioreq_server are already fully flushed
+     * before returning to guest context (see
+     * XEN_DMOP_map_mem_type_to_ioreq_server).
+     */
+    if ( !new.recalc && iommu_use_hap_pt(p2m->domain) )
+        iommu_sync_cache(entryptr, sizeof(*entryptr));
+
     return 0;
 }
 
@@ -278,6 +291,9 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
             break;
     }
 
+    if ( iommu_use_hap_pt(p2m->domain) )
+        iommu_sync_cache(table, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
     unmap_domain_page(table);
 
     /* Even failed we should install the newly allocated ept page. */
@@ -337,6 +353,9 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
 
+        if ( iommu_use_hap_pt(p2m->domain) )
+            iommu_sync_cache(next, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
         rc = atomic_write_ept_entry(p2m, ept_entry, e, next_level);
         ASSERT(rc == 0);
     }
@@ -821,7 +840,10 @@ out:
          need_modify_vtd_table )
     {
         if ( iommu_use_hap_pt(d) )
-            rc = iommu_pte_flush(d, gfn, &ept_entry->epte, order, vtd_pte_present);
+            rc = iommu_iotlb_flush(d, _dfn(gfn), (1u << order),
+                                   (iommu_flags ? IOMMU_FLUSHF_added : 0) |
+                                   (vtd_pte_present ? IOMMU_FLUSHF_modified
+                                                    : 0));
         else if ( need_iommu_pt_sync(d) )
             rc = iommu_flags ?
                 iommu_legacy_map(d, _dfn(gfn), mfn, order, iommu_flags) :
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 2919ada738..1e61e93d3f 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1884,53 +1884,6 @@ static int intel_iommu_lookup_page(struct domain *d, dfn_t dfn, mfn_t *mfn,
     return 0;
 }
 
-int iommu_pte_flush(struct domain *d, uint64_t dfn, uint64_t *pte,
-                    int order, int present)
-{
-    struct acpi_drhd_unit *drhd;
-    struct vtd_iommu *iommu = NULL;
-    struct domain_iommu *hd = dom_iommu(d);
-    bool_t flush_dev_iotlb;
-    int iommu_domid;
-    int rc = 0;
-
-    iommu_sync_cache(pte, sizeof(struct dma_pte));
-
-    for_each_drhd_unit ( drhd )
-    {
-        iommu = drhd->iommu;
-        if ( !test_bit(iommu->index, &hd->arch.iommu_bitmap) )
-            continue;
-
-        flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
-        iommu_domid= domain_iommu_domid(d, iommu);
-        if ( iommu_domid == -1 )
-            continue;
-
-        rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
-                                   __dfn_to_daddr(dfn),
-                                   order, !present, flush_dev_iotlb);
-        if ( rc > 0 )
-        {
-            iommu_flush_write_buffer(iommu);
-            rc = 0;
-        }
-    }
-
-    if ( unlikely(rc) )
-    {
-        if ( !d->is_shutting_down && printk_ratelimit() )
-            printk(XENLOG_ERR VTDPREFIX
-                   " d%d: IOMMU pages flush failed: %d\n",
-                   d->domain_id, rc);
-
-        if ( !is_hardware_domain(d) )
-            domain_crash(d);
-    }
-
-    return rc;
-}
-
 static int __init vtd_ept_page_compatible(struct vtd_iommu *iommu)
 {
     u64 ept_cap, vtd_cap = iommu->cap;
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 864e025078..6c9d5e5632 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -97,10 +97,6 @@ static inline int iommu_adjust_irq_affinities(void)
            : 0;
 }
 
-/* While VT-d specific, this must get declared in a generic header. */
-int __must_check iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
-                                 int order, int present);
-
 static inline bool iommu_supports_x2apic(void)
 {
     return iommu_init_ops && iommu_init_ops->supports_x2apic
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Tue Jul 07 22:01:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 07 Jul 2020 22:01: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 1jsvf1-0004Ns-Uu; Tue, 07 Jul 2020 22:01:55 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kg4o=AS=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jsvf0-0004Nc-7o
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:01:54 +0000
X-Inumbo-ID: 77915264-c09d-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 77915264-c09d-11ea-bb8b-bc764e2007e4;
 Tue, 07 Jul 2020 22:01:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=ca8vKq9DxU8FLtXbb6ZOoRJ/Gyl09uVEu1lfQl75WVQ=; b=0Cg9Tq50vi4mr4wCPK0By5D2QN
 V5fJXkJIYY2KU4yjr8y8oAs74IkvYCe2kYQdmCZf5U3gu0PKtZNH9ELTgS7V2hXknao4Qhun4/1qL
 2A/4blmiuz1AMJk2/PhYFYqE8AIBg6ba/Voz6SW5esP4l1URu6XN2L1PrBnAy+C5rWRc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsvez-000682-Je
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:01:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jsvez-0006mz-Iz
 for xen-changelog@lists.xenproject.org; Tue, 07 Jul 2020 22:01:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.13] xen: Check the alignment of the offset pased via
 VCPUOP_register_vcpu_info
Message-Id: <E1jsvez-0006mz-Iz@xenbits.xenproject.org>
Date: Tue, 07 Jul 2020 22:01:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 378321bb1fd5272653ae64f0306827614a3bd196
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jul 7 15:05:36 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:05:36 2020 +0200

    xen: Check the alignment of the offset pased via VCPUOP_register_vcpu_info
    
    Currently a guest is able to register any guest physical address to use
    for the vcpu_info structure as long as the structure can fits in the
    rest of the frame.
    
    This means a guest can provide an address that is not aligned to the
    natural alignment of the structure.
    
    On Arm 32-bit, unaligned access are completely forbidden by the
    hypervisor. This will result to a data abort which is fatal.
    
    On Arm 64-bit, unaligned access are only forbidden when used for atomic
    access. As the structure contains fields (such as evtchn_pending_self)
    that are updated using atomic operations, any unaligned access will be
    fatal as well.
    
    While the misalignment is only fatal on Arm, a generic check is added
    as an x86 guest shouldn't sensibly pass an unaligned address (this
    would result to a split lock).
    
    This is XSA-327.
    
    Reported-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    master commit: 3fdc211b01b29f252166937238efe02d15cb5780
    master date: 2020-07-07 14:41:00 +0200
---
 xen/common/domain.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 0902a15e8d..30b5f7f898 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1300,10 +1300,20 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
     void *mapping;
     vcpu_info_t *new_info;
     struct page_info *page;
+    unsigned int align;
 
     if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
         return -EINVAL;
 
+#ifdef CONFIG_COMPAT
+    if ( has_32bit_shinfo(d) )
+        align = alignof(new_info->compat);
+    else
+#endif
+        align = alignof(*new_info);
+    if ( offset & (align - 1) )
+        return -EINVAL;
+
     if ( !mfn_eq(v->vcpu_info_mfn, INVALID_MFN) )
         return -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.13


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 04:22:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 04:22: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 1jt1av-0003Sq-C3; Wed, 08 Jul 2020 04:22:05 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt1at-0003Sl-BV
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:22:03 +0000
X-Inumbo-ID: 92c0f032-c0d2-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 92c0f032-c0d2-11ea-bb8b-bc764e2007e4;
 Wed, 08 Jul 2020 04:22:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=gT7QowcK0eAM6Pz84A8/61zWO1r2GMDUOLE+kJzNVpw=; b=TyXro5RgFZuHC5SIlr0ZtFyejN
 an2XlpKFuEneOrFd3LPo0ZNmACY162IgC9CA3JEsNN0Mp4sJ8zxSNsffTbQ8e/6xTvbRDNK+dZt5A
 BPNzIgDWYBqxn9NSN68EhX/mDkcz3rHVh9/xn1xhXLA3q1tw5B7IgohFtVwMJCcKkivY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1as-0007KV-Er
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1as-00032E-DB
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:22:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.11] xen/common: event_channel: Don't ignore error in
 get_free_port()
Message-Id: <E1jt1as-00032E-DB@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 04:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit e96cdba338e9f14e745a2725f181f5deec848b55
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jul 7 15:18:59 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:18:59 2020 +0200

    xen/common: event_channel: Don't ignore error in get_free_port()
    
    Currently, get_free_port() is assuming that the port has been allocated
    when evtchn_allocate_port() is not return -EBUSY.
    
    However, the function may return an error when:
        - We exhausted all the event channels. This can happen if the limit
        configured by the administrator for the guest ('max_event_channels'
        in xl cfg) is higher than the ABI used by the guest. For instance,
        if the guest is using 2L, the limit should not be higher than 4095.
        - We cannot allocate memory (e.g Xen has not more memory).
    
    Users of get_free_port() (such as EVTCHNOP_alloc_unbound) will validly
    assuming the port was valid and will next call evtchn_from_port(). This
    will result to a crash as the memory backing the event channel structure
    is not present.
    
    Fixes: 368ae9a05fe ("xen/pvshim: forward evtchn ops between L0 Xen and L2 DomU")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2e9c2bc292231823a3a021d2e0a9f1956bf00b3c
    master date: 2020-07-07 14:35:36 +0200
---
 xen/common/event_channel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index c62046590b..c692bd2175 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -195,10 +195,10 @@ static int get_free_port(struct domain *d)
     {
         int rc = evtchn_allocate_port(d, port);
 
-        if ( rc == -EBUSY )
-            continue;
-
-        return port;
+        if ( rc == 0 )
+            return port;
+        else if ( rc != -EBUSY )
+            return rc;
     }
 
     return -ENOSPC;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 04:22:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 04: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 1jt1b5-0003TG-DX; Wed, 08 Jul 2020 04:22:15 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt1b4-0003TB-1c
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:22:14 +0000
X-Inumbo-ID: 98c8c25c-c0d2-11ea-8e16-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 98c8c25c-c0d2-11ea-8e16-12813bfff9fa;
 Wed, 08 Jul 2020 04:22:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=y4zpqazpFSgTFo3Fpdrrf6C2nCrwBch9B9rNmbIzzk4=; b=2TScYHc6wTQUS1/43uqX+5rGtI
 ErtwkcF/SGyzHnvqGl5V5eYtA/Hhku5EBc+56MRaDBXqb0L68B4v2LO+kLMoN3n04RbIsjGs6QwCG
 TwBhr7+63Rp5M+mNamB7ahT5LK7K07MyoaRbvCkqvZlNFczAy4t1VNZMKYngGYDrvwnU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1b2-0007Kd-K2
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1b2-00032n-HA
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:22:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.11] x86/shadow: correct an inverted conditional in
 dirty VRAM tracking
Message-Id: <E1jt1b2-00032n-HA@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 04:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a3a392ef21ee562cead19d6fe34ac260aa9c0788
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:19:40 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:19:40 2020 +0200

    x86/shadow: correct an inverted conditional in dirty VRAM tracking
    
    This originally was "mfn_x(mfn) == INVALID_MFN". Make it like this
    again, taking the opportunity to also drop the unnecessary nearby
    braces.
    
    This is XSA-319.
    
    Fixes: 246a5a3377c2 ("xen: Use a typesafe to define INVALID_MFN")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 23a216f99d40fbfbc2318ade89d8213eea6ba1f8
    master date: 2020-07-07 14:36:24 +0200
---
 xen/arch/x86/mm/shadow/common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 34913c1ade..0b8682d7a9 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3881,10 +3881,8 @@ int shadow_track_dirty_vram(struct domain *d,
             int dirty = 0;
             paddr_t sl1ma = dirty_vram->sl1ma[i];
 
-            if ( !mfn_eq(mfn, INVALID_MFN) )
-            {
+            if ( mfn_eq(mfn, INVALID_MFN) )
                 dirty = 1;
-            }
             else
             {
                 page = mfn_to_page(mfn);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 04:22:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 04:22:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jt1bF-0003UL-F8; Wed, 08 Jul 2020 04:22:25 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt1bD-0003U9-Jl
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:22:23 +0000
X-Inumbo-ID: 9eca4112-c0d2-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9eca4112-c0d2-11ea-b7bb-bc764e2007e4;
 Wed, 08 Jul 2020 04:22:22 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=x9BXhAA932JUXRjwvOwBvLJsDh+U5Mtj8/JKHLxHW3M=; b=pfRQ9JXwrhedlIgTtgCnDvWxMz
 dGsmFerof4GTuwKcUxWzPjNPp3UJkj6YkeF6q1HuhvkWaLWNTlQtx5LXvmvcxYwnUfOKm3N+ilUiu
 JuhcF7oW2VvbggNfGvOMqBE95yuskCzgpPKOArvd2zlH/rq+yzsvr3dc32lRYVPW43c4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1bC-0007Kq-ND
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1bC-00033J-MF
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:22:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.11] x86/EPT: ept_set_middle_entry() related adjustments
Message-Id: <E1jt1bC-00033J-MF@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 04:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 18be3aabd83fa9f683e8ddb0bca2066dd302c20e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:20:10 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:20:10 2020 +0200

    x86/EPT: ept_set_middle_entry() related adjustments
    
    ept_split_super_page() wants to further modify the newly allocated
    table, so have ept_set_middle_entry() return the mapped pointer rather
    than tearing it down and then getting re-established right again.
    
    Similarly ept_next_level() wants to hand back a mapped pointer of
    the next level page, so re-use the one established by
    ept_set_middle_entry() in case that path was taken.
    
    Pull the setting of suppress_ve ahead of insertion into the higher level
    table, and don't have ept_split_super_page() set the field a 2nd time.
    
    This is part of XSA-328.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 1104288186ee73a7f9bfa41cbaa5bb7611521028
    master date: 2020-07-07 14:36:52 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 41 ++++++++++++++++++-----------------------
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index ca18e43580..2ec66c21f8 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -228,8 +228,9 @@ static void ept_p2m_type_to_flags(struct p2m_domain *p2m, ept_entry_t *entry,
 #define GUEST_TABLE_SUPER_PAGE  2
 #define GUEST_TABLE_POD_PAGE    3
 
-/* Fill in middle levels of ept table */
-static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
+/* Fill in middle level of ept table; return pointer to mapped new table. */
+static ept_entry_t *ept_set_middle_entry(struct p2m_domain *p2m,
+                                         ept_entry_t *ept_entry)
 {
     mfn_t mfn;
     ept_entry_t *table;
@@ -237,7 +238,12 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     mfn = p2m_alloc_ptp(p2m, 0);
     if ( mfn_eq(mfn, INVALID_MFN) )
-        return 0;
+        return NULL;
+
+    table = map_domain_page(mfn);
+
+    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
+        table[i].suppress_ve = 1;
 
     ept_entry->epte = 0;
     ept_entry->mfn = mfn_x(mfn);
@@ -249,14 +255,7 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     ept_entry->suppress_ve = 1;
 
-    table = map_domain_page(mfn);
-
-    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
-        table[i].suppress_ve = 1;
-
-    unmap_domain_page(table);
-
-    return 1;
+    return table;
 }
 
 /* free ept sub tree behind an entry */
@@ -294,10 +293,10 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
 
     ASSERT(is_epte_superpage(ept_entry));
 
-    if ( !ept_set_middle_entry(p2m, &new_ept) )
+    table = ept_set_middle_entry(p2m, &new_ept);
+    if ( !table )
         return 0;
 
-    table = map_domain_page(_mfn(new_ept.mfn));
     trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER);
 
     for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
@@ -308,7 +307,6 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
         epte->sp = (level > 1);
         epte->mfn += i * trunk;
         epte->snp = (iommu_enabled && iommu_snoop);
-        epte->suppress_ve = 1;
 
         ept_p2m_type_to_flags(p2m, epte, epte->sa_p2mt, epte->access);
 
@@ -347,8 +345,7 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
                           ept_entry_t **table, unsigned long *gfn_remainder,
                           int next_level)
 {
-    unsigned long mfn;
-    ept_entry_t *ept_entry, e;
+    ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
     shift = next_level * EPT_TABLE_ORDER;
@@ -373,19 +370,17 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        if ( !ept_set_middle_entry(p2m, ept_entry) )
+        next = ept_set_middle_entry(p2m, ept_entry);
+        if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        else
-            e = atomic_read_ept_entry(ept_entry); /* Refresh */
+        /* e is now stale and hence may not be used anymore below. */
     }
-
     /* The only time sp would be set here is if we had hit a superpage */
-    if ( is_epte_superpage(&e) )
+    else if ( is_epte_superpage(&e) )
         return GUEST_TABLE_SUPER_PAGE;
 
-    mfn = e.mfn;
     unmap_domain_page(*table);
-    *table = map_domain_page(_mfn(mfn));
+    *table = next ?: map_domain_page(_mfn(e.mfn));
     *gfn_remainder &= (1UL << shift) - 1;
     return GUEST_TABLE_NORMAL_PAGE;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 04:22:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 04:22: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 1jt1bP-0003Va-I9; Wed, 08 Jul 2020 04:22:35 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt1bN-0003VK-Ea
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:22:33 +0000
X-Inumbo-ID: a4cc41f0-c0d2-11ea-8e16-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a4cc41f0-c0d2-11ea-8e16-12813bfff9fa;
 Wed, 08 Jul 2020 04:22:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=770UARkpbH85ycOD1LsqPBuxAUcIT6dCHw90KvAX11c=; b=AnVLijUQpogzI6Wwn/hdxq3lH1
 d63Y8FH1IPWsmRZBKfmJOoESn4TOg5dO1fadPeQpvXZpWc7x/v3kwkAzpIM+OxPYKxLEN2IFI1UWY
 1bY+2//whFLYbmkYWlGMCfHc4e3nWtqXnORH3q2FPpUNBKRWtQuMs1XMtUaKVL4JJv7w=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1bM-0007L1-QK
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1bM-00033r-PT
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:22:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.11] x86/ept: atomically modify entries in ept_next_level
Message-Id: <E1jt1bM-00033r-PT@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 04:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 7def72c0de00b4f833da4896fd5f07ecec5c3fa9
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:20:36 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:20:36 2020 +0200

    x86/ept: atomically modify entries in ept_next_level
    
    ept_next_level was passing a live PTE pointer to ept_set_middle_entry,
    which was then modified without taking into account that the PTE could
    be part of a live EPT table. This wasn't a security issue because the
    pages returned by p2m_alloc_ptp are zeroed, so adding such an entry
    before actually initializing it didn't allow a guest to access
    physical memory addresses it wasn't supposed to access.
    
    This is part of XSA-328.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: bc3d9f95d661372b059a5539ae6cb1e79435bb95
    master date: 2020-07-07 14:37:12 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 2ec66c21f8..fb2dfdb985 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -348,6 +348,8 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
     ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
+    ASSERT(next_level);
+
     shift = next_level * EPT_TABLE_ORDER;
 
     index = *gfn_remainder >> shift;
@@ -364,16 +366,20 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
 
     if ( !is_epte_present(&e) )
     {
+        int rc;
+
         if ( e.sa_p2mt == p2m_populate_on_demand )
             return GUEST_TABLE_POD_PAGE;
 
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        next = ept_set_middle_entry(p2m, ept_entry);
+        next = ept_set_middle_entry(p2m, &e);
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        /* e is now stale and hence may not be used anymore below. */
+
+        rc = atomic_write_ept_entry(ept_entry, e, next_level);
+        ASSERT(rc == 0);
     }
     /* The only time sp would be set here is if we had hit a superpage */
     else if ( is_epte_superpage(&e) )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 04:22:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 04:22:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jt1bY-0003X9-Ja; Wed, 08 Jul 2020 04:22:44 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt1bX-0003WN-Hq
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:22:43 +0000
X-Inumbo-ID: aad6cc82-c0d2-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id aad6cc82-c0d2-11ea-b7bb-bc764e2007e4;
 Wed, 08 Jul 2020 04:22:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=X/Opy6SyRhiMCkOzbIYkOHLUZm1t2vAOaIm81ppdGOc=; b=B5ajMgh6Glj3pKIVf78PbOODLw
 q9iQO8IiQXqbccDAUYDGwAgThhLmv9NZUCl8XUlW7pRFyyCENoynQeeHsRCZuPYKooZCrxpkFo98f
 Qe03eXPfWLgCmaMFv+5EkzP7dlUxOkvf+v3Z80sqgpK63j5s4nlVNHDlGQMt9jSg9OW4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1bW-0007LA-UI
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1bW-00034V-Sa
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:22:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.11] vtd: improve IOMMU TLB flush
Message-Id: <E1jt1bW-00034V-Sa@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 04:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 4ed000741e34431fa53d21ebdb93e50f5d407033
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:21:34 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:21:34 2020 +0200

    vtd: improve IOMMU TLB flush
    
    Do not limit PSI flushes to order 0 pages, in order to avoid doing a
    full TLB flush if the passed in page has an order greater than 0 and
    is aligned. Should increase the performance of IOMMU TLB flushes when
    dealing with page orders greater than 0.
    
    This is part of XSA-321.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 5fe515a0fede07543f2a3b049167b1fd8b873caf
    master date: 2020-07-07 14:37:46 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 4e5e2342df..52bf0d9d23 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -612,13 +612,14 @@ static int __must_check iommu_flush_iotlb(struct domain *d,
         if ( iommu_domid == -1 )
             continue;
 
-        if ( page_count != 1 || gfn == gfn_x(INVALID_GFN) )
+        if ( !page_count || (page_count & (page_count - 1)) ||
+             gfn == gfn_x(INVALID_GFN) || !IS_ALIGNED(gfn, page_count) )
             rc = iommu_flush_iotlb_dsi(iommu, iommu_domid,
                                        0, flush_dev_iotlb);
         else
             rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
                                        (paddr_t)gfn << PAGE_SHIFT_4K,
-                                       PAGE_ORDER_4K,
+                                       get_order_from_pages(page_count),
                                        !dma_old_pte_present,
                                        flush_dev_iotlb);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 04:22:54 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 04:22:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jt1bi-0003YT-LE; Wed, 08 Jul 2020 04:22:54 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt1bh-0003YJ-V4
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:22:53 +0000
X-Inumbo-ID: b0db9d9c-c0d2-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b0db9d9c-c0d2-11ea-bb8b-bc764e2007e4;
 Wed, 08 Jul 2020 04:22:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=sOCyT/1x9fi8bSwjnwOg4gmifw0hfqlBoaFS3oO3R70=; b=Pe2YcyIMYeRlK7Iw/70Gczqecw
 APjn1hJFZhjxmxJyE+XmIFHlsUWfxXhcoZb/tgLqzbdCYaX1GsN5RqIkHdu7CguH9jvTPqVpLxf/G
 iLCETHweZLajZi0xkGCYo/2tmlFJ1yofj2Aq4Iv70/vjXT9Vf92QLAH0xc93cjAgIi5I=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1bh-0007Lk-14
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:22:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1bh-000359-0J
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:22:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.11] vtd: prune (and rename) cache flush functions
Message-Id: <E1jt1bh-000359-0J@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 04:22:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 2d11e6d694877620d7784a0bcebf9e869d41a14c
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:22:16 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:22:16 2020 +0200

    vtd: prune (and rename) cache flush functions
    
    Rename __iommu_flush_cache to iommu_sync_cache and remove
    iommu_flush_cache_page. Also remove the iommu_flush_cache_entry
    wrapper and just use iommu_sync_cache instead. Note the _entry suffix
    was meaningless as the wrapper was already taking a size parameter in
    bytes. While there also constify the addr parameter.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 62298825b9a44f45761acbd758138b5ba059ebd1
    master date: 2020-07-07 14:38:13 +0200
---
 xen/drivers/passthrough/vtd/extern.h   |  3 +--
 xen/drivers/passthrough/vtd/intremap.c |  6 +++---
 xen/drivers/passthrough/vtd/iommu.c    | 33 ++++++++++++---------------------
 3 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index d698b1d50a..87d5ed78a2 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -37,8 +37,7 @@ void disable_qinval(struct iommu *iommu);
 int enable_intremap(struct iommu *iommu, int eim);
 void disable_intremap(struct iommu *iommu);
 
-void iommu_flush_cache_entry(void *addr, unsigned int size);
-void iommu_flush_cache_page(void *addr, unsigned long npages);
+void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index 5f620c3202..eac20ede31 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -231,7 +231,7 @@ static void free_remap_entry(struct iommu *iommu, int index)
                      iremap_entries, iremap_entry);
 
     update_irte(iommu, iremap_entry, &new_ire, false);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -403,7 +403,7 @@ static int ioapic_rte_to_remap_entry(struct iommu *iommu,
     }
 
     update_irte(iommu, iremap_entry, &new_ire, !init);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -694,7 +694,7 @@ static int msi_msg_to_remap_entry(
     update_irte(iommu, iremap_entry, &new_ire, msi_desc->irte_initialized);
     msi_desc->irte_initialized = true;
 
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 52bf0d9d23..ff9151a54b 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -158,7 +158,8 @@ static void __init free_intel_iommu(struct intel_iommu *intel)
 }
 
 static int iommus_incoherent;
-static void __iommu_flush_cache(void *addr, unsigned int size)
+
+void iommu_sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -173,16 +174,6 @@ static void __iommu_flush_cache(void *addr, unsigned int size)
         cacheline_flush((char *)addr + i);
 }
 
-void iommu_flush_cache_entry(void *addr, unsigned int size)
-{
-    __iommu_flush_cache(addr, size);
-}
-
-void iommu_flush_cache_page(void *addr, unsigned long npages)
-{
-    __iommu_flush_cache(addr, PAGE_SIZE * npages);
-}
-
 /* Allocate page table, return its machine address */
 u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
 {
@@ -207,7 +198,7 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_flush_cache_page(vaddr, 1);
+        iommu_sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -242,7 +233,7 @@ static u64 bus_to_context_maddr(struct iommu *iommu, u8 bus)
         }
         set_root_value(*root, maddr);
         set_root_present(*root);
-        iommu_flush_cache_entry(root, sizeof(struct root_entry));
+        iommu_sync_cache(root, sizeof(struct root_entry));
     }
     maddr = (u64) get_context_addr(*root);
     unmap_vtd_domain_page(root_entries);
@@ -300,7 +291,7 @@ static u64 addr_to_dma_page_maddr(struct domain *domain, u64 addr, int alloc)
              */
             dma_set_pte_readable(*pte);
             dma_set_pte_writable(*pte);
-            iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+            iommu_sync_cache(pte, sizeof(struct dma_pte));
         }
 
         if ( level == 2 )
@@ -674,7 +665,7 @@ static int __must_check dma_pte_clear_one(struct domain *domain, u64 addr)
 
     dma_clear_pte(*pte);
     spin_unlock(&hd->arch.mapping_lock);
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     if ( !this_cpu(iommu_dont_flush_iotlb) )
         rc = iommu_flush_iotlb_pages(domain, addr >> PAGE_SHIFT_4K, 1);
@@ -716,7 +707,7 @@ static void iommu_free_page_table(struct page_info *pg)
             iommu_free_pagetable(dma_pte_addr(*pte), next_level);
 
         dma_clear_pte(*pte);
-        iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+        iommu_sync_cache(pte, sizeof(struct dma_pte));
     }
 
     unmap_vtd_domain_page(pt_vaddr);
@@ -1449,7 +1440,7 @@ int domain_context_mapping_one(
     context_set_address_width(*context, agaw);
     context_set_fault_enable(*context);
     context_set_present(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
     spin_unlock(&iommu->lock);
 
     /* Context entry was previously non-present (with domid 0). */
@@ -1602,7 +1593,7 @@ int domain_context_unmap_one(
 
     context_clear_present(*context);
     context_clear_entry(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
 
     iommu_domid= domain_iommu_domid(domain, iommu);
     if ( iommu_domid == -1 )
@@ -1828,7 +1819,7 @@ static int __must_check intel_iommu_map_page(struct domain *d,
 
     *pte = new;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
     spin_unlock(&hd->arch.mapping_lock);
     unmap_vtd_domain_page(page);
 
@@ -1862,7 +1853,7 @@ int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
     int iommu_domid;
     int rc = 0;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     for_each_drhd_unit ( drhd )
     {
@@ -2725,7 +2716,7 @@ static int __init intel_iommu_quarantine_init(struct domain *d)
             dma_set_pte_addr(*pte, maddr);
             dma_set_pte_readable(*pte);
         }
-        iommu_flush_cache_page(parent, 1);
+        iommu_sync_cache(parent, PAGE_SIZE);
 
         unmap_vtd_domain_page(parent);
         parent = map_vtd_domain_page(maddr);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 04:23:04 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 04:23:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jt1bs-0003Zj-N8; Wed, 08 Jul 2020 04:23:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt1br-0003ZY-Rh
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:23:03 +0000
X-Inumbo-ID: b6e0229e-c0d2-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b6e0229e-c0d2-11ea-bb8b-bc764e2007e4;
 Wed, 08 Jul 2020 04:23:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=gQCggZaVhj+na3aBJdIM2z524dv7rQnToQd/9BUxMl8=; b=irjkgHzCrmxWORXyXFCM0zFwgy
 xtTU+LT6a181a5Gbdu68NmUdU0Dhgf7lLKjju7s1t+rsisfJqivrMVe9zImrGdZBANMDGjabexhYv
 w14xEF73Xf6O4tQjUiZNg68Te9nD8Bkuhs5rBSugnSdCIppCMGO58V++vdpRq0dGu634=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1br-0007M8-4s
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:23:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1br-000369-3L
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:23:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.11] x86/iommu: introduce a cache sync hook
Message-Id: <E1jt1br-000369-3L@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 04:23:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 8bf72ea432bb078d9483639d4bf9b756333374a9
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:22:47 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:22:47 2020 +0200

    x86/iommu: introduce a cache sync hook
    
    The hook is only implemented for VT-d and it uses the already existing
    iommu_sync_cache function present in VT-d code. The new hook is
    added so that the cache can be flushed by code outside of VT-d when
    using shared page tables.
    
    Note that alloc_pgtable_maddr must use the now locally defined
    sync_cache function, because IOMMU ops are not yet setup the first
    time the function gets called during IOMMU initialization.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 91526b460e5009fc56edbd6809e66c327281faba
    master date: 2020-07-07 14:38:34 +0200
---
 xen/drivers/passthrough/vtd/extern.h | 1 -
 xen/drivers/passthrough/vtd/iommu.c  | 5 +++--
 xen/include/asm-x86/iommu.h          | 7 +++++++
 xen/include/xen/iommu.h              | 1 +
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 87d5ed78a2..00a73d63ea 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -37,7 +37,6 @@ void disable_qinval(struct iommu *iommu);
 int enable_intremap(struct iommu *iommu, int eim);
 void disable_intremap(struct iommu *iommu);
 
-void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index ff9151a54b..facd84ffc8 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -159,7 +159,7 @@ static void __init free_intel_iommu(struct intel_iommu *intel)
 
 static int iommus_incoherent;
 
-void iommu_sync_cache(const void *addr, unsigned int size)
+static void sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -198,7 +198,7 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_sync_cache(vaddr, PAGE_SIZE);
+        sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -2760,6 +2760,7 @@ const struct iommu_ops intel_iommu_ops = {
     .iotlb_flush_all = iommu_flush_iotlb_all,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_p2m_table = vtd_dump_p2m_table,
+    .sync_cache = sync_cache,
 };
 
 /*
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index dcf2e21402..16ff2e94c2 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -98,6 +98,13 @@ extern bool untrusted_msi;
 int pi_update_irte(const struct pi_desc *pi_desc, const struct pirq *pirq,
                    const uint8_t gvec);
 
+#define iommu_sync_cache(addr, size) ({                 \
+    const struct iommu_ops *ops = iommu_get_ops();      \
+                                                        \
+    if ( ops->sync_cache )                              \
+        ops->sync_cache(addr, size);                    \
+})
+
 #endif /* !__ARCH_X86_IOMMU_H__ */
 /*
  * Local variables:
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index a0573b659c..bd8379a7d9 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -161,6 +161,7 @@ struct iommu_ops {
     void (*update_ire_from_apic)(unsigned int apic, unsigned int reg, unsigned int value);
     unsigned int (*read_apic_from_ire)(unsigned int apic, unsigned int reg);
     int (*setup_hpet_msi)(struct msi_desc *);
+    void (*sync_cache)(const void *addr, unsigned int size);
 #endif /* CONFIG_X86 */
     int __must_check (*suspend)(void);
     void (*resume)(void);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 04:23:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 04:23:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jt1c2-0003bV-PI; Wed, 08 Jul 2020 04:23:14 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt1c2-0003bN-4p
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:23:14 +0000
X-Inumbo-ID: bce52fea-c0d2-11ea-8e16-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id bce52fea-c0d2-11ea-8e16-12813bfff9fa;
 Wed, 08 Jul 2020 04:23:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=GA1YHurjve6OnP8Sv9uzt6CADo7KtW86V/C3QzHcOPQ=; b=AJEKvrg+x1f6/djBP51OAXwakZ
 G/c3YREwj3kxCrKhQrfeTQmwdk2RA2SH6shNVQK+A8s49O8XnF/HoCSZHAl2E7pdaHiqK4SDZP3Tu
 2cv3imrydcJTAYBnKJamaKfbgpBcKrgawE5QEyfF5lTRCFA/6gEAQafQ+LBDCkEt6jxE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1c1-0007MJ-7s
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:23:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1c1-00036n-76
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:23:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.11] vtd: don't assume addresses are aligned in
 sync_cache
Message-Id: <E1jt1c1-00036n-76@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 04:23:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 37c853a0bcb214f3de66cc44622287ef89cb51d1
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:23:26 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:23:26 2020 +0200

    vtd: don't assume addresses are aligned in sync_cache
    
    Current code in sync_cache assume that the address passed in is
    aligned to a cache line size. Fix the code to support passing in
    arbitrary addresses not necessarily aligned to a cache line size.
    
    This is part of XSA-321.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b6d9398144f21718d25daaf8d72669a75592abc5
    master date: 2020-07-07 14:39:05 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index facd84ffc8..270eb1c31a 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -161,8 +161,8 @@ static int iommus_incoherent;
 
 static void sync_cache(const void *addr, unsigned int size)
 {
-    int i;
-    static unsigned int clflush_size = 0;
+    static unsigned long clflush_size = 0;
+    const void *end = addr + size;
 
     if ( !iommus_incoherent )
         return;
@@ -170,8 +170,9 @@ static void sync_cache(const void *addr, unsigned int size)
     if ( clflush_size == 0 )
         clflush_size = get_cache_line_size();
 
-    for ( i = 0; i < size; i += clflush_size )
-        cacheline_flush((char *)addr + i);
+    addr -= (unsigned long)addr & (clflush_size - 1);
+    for ( ; addr < end; addr += clflush_size )
+        cacheline_flush((char *)addr);
 }
 
 /* Allocate page table, return its machine address */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 04:23:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 04:23:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jt1cC-0003cj-SS; Wed, 08 Jul 2020 04:23:24 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt1cB-0003cY-VO
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:23:23 +0000
X-Inumbo-ID: c2e8c960-c0d2-11ea-8e16-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c2e8c960-c0d2-11ea-8e16-12813bfff9fa;
 Wed, 08 Jul 2020 04:23:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=bB4/0CQ9mPj+j674fa90chVWfjbf7bgZmoBDrD1r4Ig=; b=CdVZIalfxeMZXKgyGXB1eY0l6d
 qUQf+LXsJRpwCQ0dxAY6kSxWi5RwtVzyzx9qbKvhyHQqa8OjrE7P6smcnLFUZaYkDE4Q8nyEDJZ7p
 180ietskLLjIFuEfyPxHlRR9ugbHiQRjeDDc6RzDxotePe7zbFMLy20yanNPfVYzIZcw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1cB-0007MU-Au
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:23:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1cB-00037J-9z
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:23:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.11] x86/alternative: introduce alternative_2
Message-Id: <E1jt1cB-00037J-9z@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 04:23:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit d62365801ae339f00708cd66aef7d53caea685ad
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:23:55 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:23:55 2020 +0200

    x86/alternative: introduce alternative_2
    
    It's based on alternative_io_2 without inputs or outputs but with an
    added memory clobber.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 23570bce00ee6ba2139ece978ab6f03ff166e21d
    master date: 2020-07-07 14:39:25 +0200
---
 xen/include/asm-x86/alternative.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h
index 619472efcb..3e608e8633 100644
--- a/xen/include/asm-x86/alternative.h
+++ b/xen/include/asm-x86/alternative.h
@@ -113,6 +113,11 @@ extern void alternative_instructions(void);
 #define alternative(oldinstr, newinstr, feature)                        \
         asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) : : : "memory")
 
+#define alternative_2(oldinstr, newinstr1, feature1, newinstr2, feature2) \
+	asm volatile (ALTERNATIVE_2(oldinstr, newinstr1, feature1,	\
+				    newinstr2, feature2)		\
+		      : : : "memory")
+
 /*
  * Alternative inline assembly with input.
  *
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 04:23:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 04:23:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jt1cM-0003dz-UC; Wed, 08 Jul 2020 04:23:34 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt1cM-0003dr-BW
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:23:34 +0000
X-Inumbo-ID: c8f16060-c0d2-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c8f16060-c0d2-11ea-8496-bc764e2007e4;
 Wed, 08 Jul 2020 04:23:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=flZfUXAwEnPi/7wRdUUI8Uf6imjCoVSg/q5MoLOmzF8=; b=zAuU8CBUTLztnJsnRTkAHHoAft
 MtjjhB8mfooswKj8CVIiyFGJS70R0EJ6e8/eL+aOFyj8SMSp2Gw78FFIZWQRM7/hPhonUsC5xLCzK
 uAdqFUTmpjUP97gUypcL/cpR4TXMo4k8YY0oNzdRV1Ot0bb6QBsNDe28vgRHWxqblOho=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1cL-0007Md-EL
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:23:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1cL-00037x-DI
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:23:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.11] vtd: optimize CPU cache sync
Message-Id: <E1jt1cL-00037x-DI@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 04:23:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit f2bc74c120bdb25446684c5375d1cc51d4702da4
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:24:30 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:24:30 2020 +0200

    vtd: optimize CPU cache sync
    
    Some VT-d IOMMUs are non-coherent, which requires a cache write back
    in order for the changes made by the CPU to be visible to the IOMMU.
    This cache write back was unconditionally done using clflush, but there are
    other more efficient instructions to do so, hence implement support
    for them using the alternative framework.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a64ea16522a73a13a0d66cfa4b66a9d3b95dd9d6
    master date: 2020-07-07 14:39:54 +0200
---
 xen/drivers/passthrough/vtd/extern.h  |  1 -
 xen/drivers/passthrough/vtd/iommu.c   | 38 ++++++++++++++++++++++++++++++++++-
 xen/drivers/passthrough/vtd/x86/vtd.c |  5 -----
 3 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 00a73d63ea..065d768b52 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -63,7 +63,6 @@ int __must_check qinval_device_iotlb_sync(struct iommu *iommu,
                                           u16 did, u16 size, u64 addr);
 
 unsigned int get_cache_line_size(void);
-void cacheline_flush(char *);
 void flush_all_cache(void);
 
 u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 270eb1c31a..05fe61f69e 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -31,6 +31,7 @@
 #include <xen/pci_regs.h>
 #include <xen/keyhandler.h>
 #include <asm/msi.h>
+#include <asm/nops.h>
 #include <asm/irq.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/p2m.h>
@@ -172,7 +173,42 @@ static void sync_cache(const void *addr, unsigned int size)
 
     addr -= (unsigned long)addr & (clflush_size - 1);
     for ( ; addr < end; addr += clflush_size )
-        cacheline_flush((char *)addr);
+/*
+ * The arguments to a macro must not include preprocessor directives. Doing so
+ * results in undefined behavior, so we have to create some defines here in
+ * order to avoid it.
+ */
+#if defined(HAVE_AS_CLWB)
+# define CLWB_ENCODING "clwb %[p]"
+#elif defined(HAVE_AS_XSAVEOPT)
+# define CLWB_ENCODING "data16 xsaveopt %[p]" /* clwb */
+#else
+# define CLWB_ENCODING ".byte 0x66, 0x0f, 0xae, 0x30" /* clwb (%%rax) */
+#endif
+
+#define BASE_INPUT(addr) [p] "m" (*(const char *)(addr))
+#if defined(HAVE_AS_CLWB) || defined(HAVE_AS_XSAVEOPT)
+# define INPUT BASE_INPUT
+#else
+# define INPUT(addr) "a" (addr), BASE_INPUT(addr)
+#endif
+        /*
+         * Note regarding the use of NOP_DS_PREFIX: it's faster to do a clflush
+         * + prefix than a clflush + nop, and hence the prefix is added instead
+         * of letting the alternative framework fill the gap by appending nops.
+         */
+        alternative_io_2(".byte " __stringify(NOP_DS_PREFIX) "; clflush %[p]",
+                         "data16 clflush %[p]", /* clflushopt */
+                         X86_FEATURE_CLFLUSHOPT,
+                         CLWB_ENCODING,
+                         X86_FEATURE_CLWB, /* no outputs */,
+                         INPUT(addr));
+#undef INPUT
+#undef BASE_INPUT
+#undef CLWB_ENCODING
+
+    alternative_2("", "sfence", X86_FEATURE_CLFLUSHOPT,
+                      "sfence", X86_FEATURE_CLWB);
 }
 
 /* Allocate page table, return its machine address */
diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c
index 88a60b3307..7f96b91dd4 100644
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -53,11 +53,6 @@ unsigned int get_cache_line_size(void)
     return ((cpuid_ebx(1) >> 8) & 0xff) * 8;
 }
 
-void cacheline_flush(char * addr)
-{
-    clflush(addr);
-}
-
 void flush_all_cache()
 {
     wbinvd();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 04:23:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 04:23: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 1jt1cX-0003fT-Vm; Wed, 08 Jul 2020 04:23:45 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt1cW-0003fJ-PZ
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:23:44 +0000
X-Inumbo-ID: cef38f38-c0d2-11ea-8e16-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id cef38f38-c0d2-11ea-8e16-12813bfff9fa;
 Wed, 08 Jul 2020 04:23:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=rjA7uL2lvYktbo978hUCGZDF+ZRnPdZcp+h7hbZ6C8E=; b=DNXGKTBoF/R4ALPJmfM4zK4BhH
 0LryWJkC14iGYHVWM4+tL8t0vEjmpKXR1quXwPSuoroKtvmh8i6JQapIHuzQgXL/942ruV/irQwnU
 hE9O62ISbyw2qBgZiFE9SQ5w49IypC9PPmA3o9dciErwSvNa+ok/1+HONz2iED9lmneM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1cV-0007Ml-HR
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:23:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1cV-00038i-Gf
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:23:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.11] x86/ept: flush cache when modifying PTEs and
 sharing page tables
Message-Id: <E1jt1cV-00038i-Gf@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 04:23:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit e6ddf4a1bd8ab88f6fec83a57d64e9bbc8cca9b8
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:24:55 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:24:55 2020 +0200

    x86/ept: flush cache when modifying PTEs and sharing page tables
    
    Modifications made to the page tables by EPT code need to be written
    to memory when the page tables are shared with the IOMMU, as Intel
    IOMMUs can be non-coherent and thus require changes to be written to
    memory in order to be visible to the IOMMU.
    
    In order to achieve this make sure data is written back to memory
    after writing an EPT entry when the recalc bit is not set in
    atomic_write_ept_entry. If such bit is set, the entry will be
    adjusted and atomic_write_ept_entry will be called a second time
    without the recalc bit set. Note that when splitting a super page the
    new tables resulting of the split should also be written back.
    
    Failure to do so can allow devices behind the IOMMU access to the
    stale super page, or cause coherency issues as changes made by the
    processor to the page tables are not visible to the IOMMU.
    
    This allows to remove the VT-d specific iommu_pte_flush helper, since
    the cache write back is now performed by atomic_write_ept_entry, and
    hence iommu_iotlb_flush can be used to flush the IOMMU TLB. The newly
    used method (iommu_iotlb_flush) can result in less flushes, since it
    might sometimes be called rightly with 0 flags, in which case it
    becomes a no-op.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c23274fd0412381bd75068ebc9f8f8c90a4be748
    master date: 2020-07-07 14:40:11 +0200
---
 xen/arch/x86/mm/p2m-ept.c           | 21 ++++++++++++++-
 xen/drivers/passthrough/vtd/iommu.c | 53 ++-----------------------------------
 xen/include/asm-x86/iommu.h         |  5 ++--
 3 files changed, 25 insertions(+), 54 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index fb2dfdb985..02071752e8 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -90,6 +90,19 @@ static int atomic_write_ept_entry(ept_entry_t *entryptr, ept_entry_t new,
 
     write_atomic(&entryptr->epte, new.epte);
 
+    /*
+     * The recalc field on the EPT is used to signal either that a
+     * recalculation of the EMT field is required (which doesn't effect the
+     * IOMMU), or a type change. Type changes can only be between ram_rw,
+     * logdirty and ioreq_server: changes to/from logdirty won't work well with
+     * an IOMMU anyway, as IOMMU #PFs are not synchronous and will lead to
+     * aborts, and changes to/from ioreq_server are already fully flushed
+     * before returning to guest context (see
+     * XEN_DMOP_map_mem_type_to_ioreq_server).
+     */
+    if ( !new.recalc && iommu_hap_pt_share )
+        iommu_sync_cache(entryptr, sizeof(*entryptr));
+
     if ( unlikely(oldmfn != mfn_x(INVALID_MFN)) )
         put_page(mfn_to_page(_mfn(oldmfn)));
 
@@ -319,6 +332,9 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
             break;
     }
 
+    if ( iommu_hap_pt_share )
+        iommu_sync_cache(table, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
     unmap_domain_page(table);
 
     /* Even failed we should install the newly allocated ept page. */
@@ -378,6 +394,9 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
 
+        if ( iommu_hap_pt_share )
+            iommu_sync_cache(next, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
         rc = atomic_write_ept_entry(ept_entry, e, next_level);
         ASSERT(rc == 0);
     }
@@ -875,7 +894,7 @@ out:
          need_modify_vtd_table )
     {
         if ( iommu_hap_pt_share )
-            rc = iommu_pte_flush(d, gfn, &ept_entry->epte, order, vtd_pte_present);
+            rc = iommu_flush_iotlb(d, gfn, vtd_pte_present, 1u << order);
         else
         {
             if ( iommu_flags )
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 05fe61f69e..f499c6f430 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -612,10 +612,8 @@ static int __must_check iommu_flush_all(void)
     return rc;
 }
 
-static int __must_check iommu_flush_iotlb(struct domain *d,
-                                          unsigned long gfn,
-                                          bool_t dma_old_pte_present,
-                                          unsigned int page_count)
+int iommu_flush_iotlb(struct domain *d, unsigned long gfn,
+                      bool dma_old_pte_present, unsigned int page_count)
 {
     struct domain_iommu *hd = dom_iommu(d);
     struct acpi_drhd_unit *drhd;
@@ -1880,53 +1878,6 @@ static int __must_check intel_iommu_unmap_page(struct domain *d,
     return dma_pte_clear_one(d, (paddr_t)gfn << PAGE_SHIFT_4K);
 }
 
-int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
-                    int order, int present)
-{
-    struct acpi_drhd_unit *drhd;
-    struct iommu *iommu = NULL;
-    struct domain_iommu *hd = dom_iommu(d);
-    bool_t flush_dev_iotlb;
-    int iommu_domid;
-    int rc = 0;
-
-    iommu_sync_cache(pte, sizeof(struct dma_pte));
-
-    for_each_drhd_unit ( drhd )
-    {
-        iommu = drhd->iommu;
-        if ( !test_bit(iommu->index, &hd->arch.iommu_bitmap) )
-            continue;
-
-        flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
-        iommu_domid= domain_iommu_domid(d, iommu);
-        if ( iommu_domid == -1 )
-            continue;
-
-        rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
-                                   (paddr_t)gfn << PAGE_SHIFT_4K,
-                                   order, !present, flush_dev_iotlb);
-        if ( rc > 0 )
-        {
-            iommu_flush_write_buffer(iommu);
-            rc = 0;
-        }
-    }
-
-    if ( unlikely(rc) )
-    {
-        if ( !d->is_shutting_down && printk_ratelimit() )
-            printk(XENLOG_ERR VTDPREFIX
-                   " d%d: IOMMU pages flush failed: %d\n",
-                   d->domain_id, rc);
-
-        if ( !is_hardware_domain(d) )
-            domain_crash(d);
-    }
-
-    return rc;
-}
-
 static int __init vtd_ept_page_compatible(struct iommu *iommu)
 {
     u64 ept_cap, vtd_cap = iommu->cap;
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 16ff2e94c2..dfc9b77594 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -87,8 +87,9 @@ int iommu_setup_hpet_msi(struct msi_desc *);
 
 /* While VT-d specific, this must get declared in a generic header. */
 int adjust_vtd_irq_affinities(void);
-int __must_check iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
-                                 int order, int present);
+int __must_check iommu_flush_iotlb(struct domain *d, unsigned long gfn,
+                                   bool dma_old_pte_present,
+                                   unsigned int page_count);
 bool_t iommu_supports_eim(void);
 int iommu_enable_x2apic_IR(void);
 void iommu_disable_x2apic_IR(void);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 04:23:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 04:23: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 1jt1ch-0003gv-9G; Wed, 08 Jul 2020 04:23:55 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt1cg-0003gi-6t
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:23:54 +0000
X-Inumbo-ID: d4f7c9b2-c0d2-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d4f7c9b2-c0d2-11ea-bb8b-bc764e2007e4;
 Wed, 08 Jul 2020 04:23:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=BhhKy2WXon64s8utRU2xP5yX4jCh22Ftq2VThWn9jmw=; b=Lrds2mXpX8dUgCTCfOclMpMvQ+
 1gagCAzvgecBVnZLaHxBE0oHo6Qzt5gHwFt9MtI4S57G0LlAvfrZ1hQpnM1k0dG7uXoVCnmLe4xMd
 +U+vCrWTuB2MTgGh4Z64XIOGPgGho/jUa1/6DJWgaixYqohRfhH2MnYXe+ke4KSirISM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1cf-0007Nb-KS
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:23:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt1cf-00039M-Jb
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 04:23:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.11] xen: Check the alignment of the offset pased via
 VCPUOP_register_vcpu_info
Message-Id: <E1jt1cf-00039M-Jb@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 04:23:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ddaaccbbab6b19bf21ed2c097f3055a3c2544c8d
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jul 7 15:25:34 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:25:34 2020 +0200

    xen: Check the alignment of the offset pased via VCPUOP_register_vcpu_info
    
    Currently a guest is able to register any guest physical address to use
    for the vcpu_info structure as long as the structure can fits in the
    rest of the frame.
    
    This means a guest can provide an address that is not aligned to the
    natural alignment of the structure.
    
    On Arm 32-bit, unaligned access are completely forbidden by the
    hypervisor. This will result to a data abort which is fatal.
    
    On Arm 64-bit, unaligned access are only forbidden when used for atomic
    access. As the structure contains fields (such as evtchn_pending_self)
    that are updated using atomic operations, any unaligned access will be
    fatal as well.
    
    While the misalignment is only fatal on Arm, a generic check is added
    as an x86 guest shouldn't sensibly pass an unaligned address (this
    would result to a split lock).
    
    This is XSA-327.
    
    Reported-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    master commit: 3fdc211b01b29f252166937238efe02d15cb5780
    master date: 2020-07-07 14:41:00 +0200
---
 xen/common/domain.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 24377011b0..2ddd7986c1 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1186,10 +1186,20 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
     void *mapping;
     vcpu_info_t *new_info;
     struct page_info *page;
+    unsigned int align;
 
     if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
         return -EINVAL;
 
+#ifdef CONFIG_COMPAT
+    if ( has_32bit_shinfo(d) )
+        align = alignof(new_info->compat);
+    else
+#endif
+        align = alignof(*new_info);
+    if ( offset & (align - 1) )
+        return -EINVAL;
+
     if ( !mfn_eq(v->vcpu_info_mfn, INVALID_MFN) )
         return -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 09:22:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 09: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 1jt6HG-0003fW-M6; Wed, 08 Jul 2020 09:22:06 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt6HG-0003fR-7y
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:22:06 +0000
X-Inumbo-ID: 7ba194e0-c0fc-11ea-8e24-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7ba194e0-c0fc-11ea-8e24-12813bfff9fa;
 Wed, 08 Jul 2020 09:22:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=lrU9Q1EH3wHc8mApKg1Iuuz+WIWH5YmbTRXe4bSwTOE=; b=ZL2qDWaTbS9Phte7WdLiSSX5cE
 f5FHC9imDMsxFxf60SFp4JDNJsuTpwjv9WdsjU/c/gFCwOnRZH+bVe/yH/dbqb30nBlLWmEjVM7N1
 RI8Iild3ySK3CjA/xBlutTatQjGj7KQDGLIR2Y6F6IenrIwDvI1noLqMXv0iuWo3UDUA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6HC-0005Qu-Hi
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6HC-0002z9-GP
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:22:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] xen/common: event_channel: Don't ignore error in
 get_free_port()
Message-Id: <E1jt6HC-0002z9-GP@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 09:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a634229ecf67e3e06c5dc26701d0561c4e4698d7
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jul 7 15:08:59 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:08:59 2020 +0200

    xen/common: event_channel: Don't ignore error in get_free_port()
    
    Currently, get_free_port() is assuming that the port has been allocated
    when evtchn_allocate_port() is not return -EBUSY.
    
    However, the function may return an error when:
        - We exhausted all the event channels. This can happen if the limit
        configured by the administrator for the guest ('max_event_channels'
        in xl cfg) is higher than the ABI used by the guest. For instance,
        if the guest is using 2L, the limit should not be higher than 4095.
        - We cannot allocate memory (e.g Xen has not more memory).
    
    Users of get_free_port() (such as EVTCHNOP_alloc_unbound) will validly
    assuming the port was valid and will next call evtchn_from_port(). This
    will result to a crash as the memory backing the event channel structure
    is not present.
    
    Fixes: 368ae9a05fe ("xen/pvshim: forward evtchn ops between L0 Xen and L2 DomU")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2e9c2bc292231823a3a021d2e0a9f1956bf00b3c
    master date: 2020-07-07 14:35:36 +0200
---
 xen/common/event_channel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index e86e2bfab0..a8d182b584 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -195,10 +195,10 @@ static int get_free_port(struct domain *d)
     {
         int rc = evtchn_allocate_port(d, port);
 
-        if ( rc == -EBUSY )
-            continue;
-
-        return port;
+        if ( rc == 0 )
+            return port;
+        else if ( rc != -EBUSY )
+            return rc;
     }
 
     return -ENOSPC;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 09:22:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 09:22:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jt6HO-0003g9-P7; Wed, 08 Jul 2020 09:22:14 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt6HN-0003g2-QC
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:22:13 +0000
X-Inumbo-ID: 81a75032-c0fc-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 81a75032-c0fc-11ea-bca7-bc764e2007e4;
 Wed, 08 Jul 2020 09:22:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Quw5JXweBOKMd+0DPtECr3r8WbY+9Ins7vkyghorj6s=; b=HKLsEOljLctRbjjS5XAKb089yP
 n8m1W54LFVKRisZ7pKAF7apirIjYWtsqZSriNdl5A61QGr3Ovi4/uzNETAa5rMoM6W+mgk3Yp5E6k
 xfE9ONW6eNQKR2u5FDTyfTOyPLZjThPkIqIcJdxonRaqFSMJQHT5z3vHn/lZ20VrBCZw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6HM-0005R0-M8
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6HM-0002zg-K0
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:22:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/shadow: correct an inverted conditional in
 dirty VRAM tracking
Message-Id: <E1jt6HM-0002zg-K0@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 09:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ec57b9af279318c4aee8ca2c60a8ee39563521a5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:09:25 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:09:25 2020 +0200

    x86/shadow: correct an inverted conditional in dirty VRAM tracking
    
    This originally was "mfn_x(mfn) == INVALID_MFN". Make it like this
    again, taking the opportunity to also drop the unnecessary nearby
    braces.
    
    This is XSA-319.
    
    Fixes: 246a5a3377c2 ("xen: Use a typesafe to define INVALID_MFN")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 23a216f99d40fbfbc2318ade89d8213eea6ba1f8
    master date: 2020-07-07 14:36:24 +0200
---
 xen/arch/x86/mm/shadow/common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 1ac5b22028..6595fba04c 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3373,10 +3373,8 @@ int shadow_track_dirty_vram(struct domain *d,
             int dirty = 0;
             paddr_t sl1ma = dirty_vram->sl1ma[i];
 
-            if ( !mfn_eq(mfn, INVALID_MFN) )
-            {
+            if ( mfn_eq(mfn, INVALID_MFN) )
                 dirty = 1;
-            }
             else
             {
                 page = mfn_to_page(mfn);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 09:22:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 09: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 1jt6HY-0003h4-Qw; Wed, 08 Jul 2020 09:22:24 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt6HX-0003gp-Ip
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:22:23 +0000
X-Inumbo-ID: 87a7ac66-c0fc-11ea-8e24-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 87a7ac66-c0fc-11ea-8e24-12813bfff9fa;
 Wed, 08 Jul 2020 09:22:22 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=uBAkvl8Bsk87edFteYOIqHv0g/q0jNfLqQTWfiqiM88=; b=yBlJGJZAO9tNbYt7kaKhkwSrBK
 jN21gqhRifVgAMhWbyNBoyHPzY6Z7RHbjbaXLeOvh2GWZvfRzpexn/A/zagbySPkO8JscfPPeZiUF
 HplZrYi5MF1msqfSw+YLWPL4RS2Lc3gCAUSwSvTSb7LfevZToRy4D8t7tfdrqY7TQdSo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6HW-0005RD-PP
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6HW-00030A-OK
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:22:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/EPT: ept_set_middle_entry() related adjustments
Message-Id: <E1jt6HW-00030A-OK@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 09:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 731bdaf416800809bc71f19dbdeb726203a2b3ef
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:09:50 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:09:50 2020 +0200

    x86/EPT: ept_set_middle_entry() related adjustments
    
    ept_split_super_page() wants to further modify the newly allocated
    table, so have ept_set_middle_entry() return the mapped pointer rather
    than tearing it down and then getting re-established right again.
    
    Similarly ept_next_level() wants to hand back a mapped pointer of
    the next level page, so re-use the one established by
    ept_set_middle_entry() in case that path was taken.
    
    Pull the setting of suppress_ve ahead of insertion into the higher level
    table, and don't have ept_split_super_page() set the field a 2nd time.
    
    This is part of XSA-328.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 1104288186ee73a7f9bfa41cbaa5bb7611521028
    master date: 2020-07-07 14:36:52 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 41 ++++++++++++++++++-----------------------
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 7937a2214a..eb42248d56 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -187,8 +187,9 @@ static void ept_p2m_type_to_flags(struct p2m_domain *p2m, ept_entry_t *entry,
 #define GUEST_TABLE_SUPER_PAGE  2
 #define GUEST_TABLE_POD_PAGE    3
 
-/* Fill in middle levels of ept table */
-static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
+/* Fill in middle level of ept table; return pointer to mapped new table. */
+static ept_entry_t *ept_set_middle_entry(struct p2m_domain *p2m,
+                                         ept_entry_t *ept_entry)
 {
     mfn_t mfn;
     ept_entry_t *table;
@@ -196,7 +197,12 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     mfn = p2m_alloc_ptp(p2m, 0);
     if ( mfn_eq(mfn, INVALID_MFN) )
-        return 0;
+        return NULL;
+
+    table = map_domain_page(mfn);
+
+    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
+        table[i].suppress_ve = 1;
 
     ept_entry->epte = 0;
     ept_entry->mfn = mfn_x(mfn);
@@ -208,14 +214,7 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     ept_entry->suppress_ve = 1;
 
-    table = map_domain_page(mfn);
-
-    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
-        table[i].suppress_ve = 1;
-
-    unmap_domain_page(table);
-
-    return 1;
+    return table;
 }
 
 /* free ept sub tree behind an entry */
@@ -253,10 +252,10 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
 
     ASSERT(is_epte_superpage(ept_entry));
 
-    if ( !ept_set_middle_entry(p2m, &new_ept) )
+    table = ept_set_middle_entry(p2m, &new_ept);
+    if ( !table )
         return 0;
 
-    table = map_domain_page(_mfn(new_ept.mfn));
     trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER);
 
     for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
@@ -267,7 +266,6 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
         epte->sp = (level > 1);
         epte->mfn += i * trunk;
         epte->snp = (iommu_enabled && iommu_snoop);
-        epte->suppress_ve = 1;
 
         ept_p2m_type_to_flags(p2m, epte, epte->sa_p2mt, epte->access);
 
@@ -306,8 +304,7 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
                           ept_entry_t **table, unsigned long *gfn_remainder,
                           int next_level)
 {
-    unsigned long mfn;
-    ept_entry_t *ept_entry, e;
+    ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
     shift = next_level * EPT_TABLE_ORDER;
@@ -332,19 +329,17 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        if ( !ept_set_middle_entry(p2m, ept_entry) )
+        next = ept_set_middle_entry(p2m, ept_entry);
+        if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        else
-            e = atomic_read_ept_entry(ept_entry); /* Refresh */
+        /* e is now stale and hence may not be used anymore below. */
     }
-
     /* The only time sp would be set here is if we had hit a superpage */
-    if ( is_epte_superpage(&e) )
+    else if ( is_epte_superpage(&e) )
         return GUEST_TABLE_SUPER_PAGE;
 
-    mfn = e.mfn;
     unmap_domain_page(*table);
-    *table = map_domain_page(_mfn(mfn));
+    *table = next ?: map_domain_page(_mfn(e.mfn));
     *gfn_remainder &= (1UL << shift) - 1;
     return GUEST_TABLE_NORMAL_PAGE;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 09:22:33 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 09:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jt6Hh-0003iA-Sb; Wed, 08 Jul 2020 09:22:33 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt6Hh-0003i4-GM
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:22:33 +0000
X-Inumbo-ID: 8dad60a6-c0fc-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8dad60a6-c0fc-11ea-8496-bc764e2007e4;
 Wed, 08 Jul 2020 09:22:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=ihvdB0kEp2MTDQSRtNQfJEtTNzeCgaofpcy1bqD/0BM=; b=Nv8fJw9tdcOCgsaT0cqtfFGHgr
 jT75UAnaxTMrUxJUCqfooatBC4J6+CIKc7WFZniVZq/FD46vo//0+foXgyuUCfdRi/NIdO1T3CBId
 QZnpT9yo8hMwwOJ3TSwgrVWcwWccm8QXHSXyyIVzpVfwDv1T4tIMNars5QDZIVTPwCOc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6Hg-0005RM-SK
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6Hg-00030e-RX
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:22:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/ept: atomically modify entries in ept_next_level
Message-Id: <E1jt6Hg-00030e-RX@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 09:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 8faa45e25e8b97570b81b46a6b48bdbc8b489b4f
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:10:14 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:10:14 2020 +0200

    x86/ept: atomically modify entries in ept_next_level
    
    ept_next_level was passing a live PTE pointer to ept_set_middle_entry,
    which was then modified without taking into account that the PTE could
    be part of a live EPT table. This wasn't a security issue because the
    pages returned by p2m_alloc_ptp are zeroed, so adding such an entry
    before actually initializing it didn't allow a guest to access
    physical memory addresses it wasn't supposed to access.
    
    This is part of XSA-328.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: bc3d9f95d661372b059a5539ae6cb1e79435bb95
    master date: 2020-07-07 14:37:12 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index eb42248d56..61fc39bac5 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -307,6 +307,8 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
     ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
+    ASSERT(next_level);
+
     shift = next_level * EPT_TABLE_ORDER;
 
     index = *gfn_remainder >> shift;
@@ -323,16 +325,20 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
 
     if ( !is_epte_present(&e) )
     {
+        int rc;
+
         if ( e.sa_p2mt == p2m_populate_on_demand )
             return GUEST_TABLE_POD_PAGE;
 
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        next = ept_set_middle_entry(p2m, ept_entry);
+        next = ept_set_middle_entry(p2m, &e);
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        /* e is now stale and hence may not be used anymore below. */
+
+        rc = atomic_write_ept_entry(p2m, ept_entry, e, next_level);
+        ASSERT(rc == 0);
     }
     /* The only time sp would be set here is if we had hit a superpage */
     else if ( is_epte_superpage(&e) )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 09:22:45 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 09:22: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 1jt6Ht-0003jI-UM; Wed, 08 Jul 2020 09:22:45 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt6Hs-0003jC-Ob
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:22:44 +0000
X-Inumbo-ID: 93b08bc2-c0fc-11ea-8e24-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 93b08bc2-c0fc-11ea-8e24-12813bfff9fa;
 Wed, 08 Jul 2020 09:22:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=poJTgpNiyuEG7q1ReoAnmECUJvF2Tw5gfVNYm+PssZM=; b=ZYqasU5pIp/OUGsFQ7kyKoMGtS
 Rh86qFPBpSanKU7k11hQNHwwcLLoNfQ2U9f4FTkXqJ3PfC4Z9i4zbOVPA1Fcy81S5emGMU+sKNPuk
 cSqHUduL1gWI8zus/yHR2cWjuqTLYsWFoGZLzQnhrtCv1e+7HJw+43ODX31Y3NwJkCKo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6Hq-0005RW-Vb
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6Hq-00031A-Ug
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:22:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] vtd: improve IOMMU TLB flush
Message-Id: <E1jt6Hq-00031A-Ug@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 09:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit d69f3058d8357b2c348d37e30d13cf655883cfff
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:10:34 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:10:34 2020 +0200

    vtd: improve IOMMU TLB flush
    
    Do not limit PSI flushes to order 0 pages, in order to avoid doing a
    full TLB flush if the passed in page has an order greater than 0 and
    is aligned. Should increase the performance of IOMMU TLB flushes when
    dealing with page orders greater than 0.
    
    This is part of XSA-321.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 5fe515a0fede07543f2a3b049167b1fd8b873caf
    master date: 2020-07-07 14:37:46 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index ed50d34c91..90cc70b2e1 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -611,13 +611,14 @@ static int __must_check iommu_flush_iotlb(struct domain *d, dfn_t dfn,
         if ( iommu_domid == -1 )
             continue;
 
-        if ( page_count != 1 || dfn_eq(dfn, INVALID_DFN) )
+        if ( !page_count || (page_count & (page_count - 1)) ||
+             dfn_eq(dfn, INVALID_DFN) || !IS_ALIGNED(dfn_x(dfn), page_count) )
             rc = iommu_flush_iotlb_dsi(iommu, iommu_domid,
                                        0, flush_dev_iotlb);
         else
             rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
                                        dfn_to_daddr(dfn),
-                                       PAGE_ORDER_4K,
+                                       get_order_from_pages(page_count),
                                        !dma_old_pte_present,
                                        flush_dev_iotlb);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 09:22:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 09:22: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 1jt6I2-0003km-Vt; Wed, 08 Jul 2020 09:22:54 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt6I1-0003kd-Va
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:22:54 +0000
X-Inumbo-ID: 99bb2338-c0fc-11ea-8e24-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 99bb2338-c0fc-11ea-8e24-12813bfff9fa;
 Wed, 08 Jul 2020 09:22:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=JR2PklRc5s5sn45beoorWM31v2eTtjX7AwP2jOD0z9o=; b=qfNBafyG9dqnfIB0GjUdZkdGJ/
 WjVZxTm0L0NkrfeaSyU9xtb1MwFDCGS2ozAdTqDBQPd6P+cXj7TvtYLr9p3d31zunyhPhe/V4K8ZS
 5R2zCzvrT8MCHgFzZKKaINDPS5aAr09miGNLLeWnaNRRb1ZMZEGtWHdNbkVYQRqKLFqY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6I1-0005Rc-2v
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:22:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6I1-00031z-1e
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:22:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] vtd: prune (and rename) cache flush functions
Message-Id: <E1jt6I1-00031z-1e@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 09:22:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 5733de6b88a087ff111ba520cd35d0a79663e5e6
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:10:57 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:10:57 2020 +0200

    vtd: prune (and rename) cache flush functions
    
    Rename __iommu_flush_cache to iommu_sync_cache and remove
    iommu_flush_cache_page. Also remove the iommu_flush_cache_entry
    wrapper and just use iommu_sync_cache instead. Note the _entry suffix
    was meaningless as the wrapper was already taking a size parameter in
    bytes. While there also constify the addr parameter.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 62298825b9a44f45761acbd758138b5ba059ebd1
    master date: 2020-07-07 14:38:13 +0200
---
 xen/drivers/passthrough/vtd/extern.h   |  3 +--
 xen/drivers/passthrough/vtd/intremap.c |  6 +++---
 xen/drivers/passthrough/vtd/iommu.c    | 33 ++++++++++++---------------------
 3 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index a71c8b0f84..d6ffe804a4 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -38,8 +38,7 @@ void disable_qinval(struct iommu *iommu);
 int enable_intremap(struct iommu *iommu, int eim);
 void disable_intremap(struct iommu *iommu);
 
-void iommu_flush_cache_entry(void *addr, unsigned int size);
-void iommu_flush_cache_page(void *addr, unsigned long npages);
+void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index c9927e4706..95782a1f52 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -231,7 +231,7 @@ static void free_remap_entry(struct iommu *iommu, int index)
                      iremap_entries, iremap_entry);
 
     update_irte(iommu, iremap_entry, &new_ire, false);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -403,7 +403,7 @@ static int ioapic_rte_to_remap_entry(struct iommu *iommu,
     }
 
     update_irte(iommu, iremap_entry, &new_ire, !init);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -694,7 +694,7 @@ static int msi_msg_to_remap_entry(
     update_irte(iommu, iremap_entry, &new_ire, msi_desc->irte_initialized);
     msi_desc->irte_initialized = true;
 
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 90cc70b2e1..274d035fb5 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -158,7 +158,8 @@ static void __init free_intel_iommu(struct intel_iommu *intel)
 }
 
 static int iommus_incoherent;
-static void __iommu_flush_cache(void *addr, unsigned int size)
+
+void iommu_sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -173,16 +174,6 @@ static void __iommu_flush_cache(void *addr, unsigned int size)
         cacheline_flush((char *)addr + i);
 }
 
-void iommu_flush_cache_entry(void *addr, unsigned int size)
-{
-    __iommu_flush_cache(addr, size);
-}
-
-void iommu_flush_cache_page(void *addr, unsigned long npages)
-{
-    __iommu_flush_cache(addr, PAGE_SIZE * npages);
-}
-
 /* Allocate page table, return its machine address */
 u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
 {
@@ -207,7 +198,7 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_flush_cache_page(vaddr, 1);
+        iommu_sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -242,7 +233,7 @@ static u64 bus_to_context_maddr(struct iommu *iommu, u8 bus)
         }
         set_root_value(*root, maddr);
         set_root_present(*root);
-        iommu_flush_cache_entry(root, sizeof(struct root_entry));
+        iommu_sync_cache(root, sizeof(struct root_entry));
     }
     maddr = (u64) get_context_addr(*root);
     unmap_vtd_domain_page(root_entries);
@@ -300,7 +291,7 @@ static u64 addr_to_dma_page_maddr(struct domain *domain, u64 addr, int alloc)
              */
             dma_set_pte_readable(*pte);
             dma_set_pte_writable(*pte);
-            iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+            iommu_sync_cache(pte, sizeof(struct dma_pte));
         }
 
         if ( level == 2 )
@@ -681,7 +672,7 @@ static int __must_check dma_pte_clear_one(struct domain *domain, u64 addr,
     *flush_flags |= IOMMU_FLUSHF_modified;
 
     spin_unlock(&hd->arch.mapping_lock);
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     unmap_vtd_domain_page(page);
 
@@ -720,7 +711,7 @@ static void iommu_free_page_table(struct page_info *pg)
             iommu_free_pagetable(dma_pte_addr(*pte), next_level);
 
         dma_clear_pte(*pte);
-        iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+        iommu_sync_cache(pte, sizeof(struct dma_pte));
     }
 
     unmap_vtd_domain_page(pt_vaddr);
@@ -1449,7 +1440,7 @@ int domain_context_mapping_one(
     context_set_address_width(*context, agaw);
     context_set_fault_enable(*context);
     context_set_present(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
     spin_unlock(&iommu->lock);
 
     /* Context entry was previously non-present (with domid 0). */
@@ -1602,7 +1593,7 @@ int domain_context_unmap_one(
 
     context_clear_present(*context);
     context_clear_entry(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
 
     iommu_domid= domain_iommu_domid(domain, iommu);
     if ( iommu_domid == -1 )
@@ -1837,7 +1828,7 @@ static int __must_check intel_iommu_map_page(struct domain *d, dfn_t dfn,
 
     *pte = new;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
     spin_unlock(&hd->arch.mapping_lock);
     unmap_vtd_domain_page(page);
 
@@ -1912,7 +1903,7 @@ int iommu_pte_flush(struct domain *d, uint64_t dfn, uint64_t *pte,
     int iommu_domid;
     int rc = 0;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     for_each_drhd_unit ( drhd )
     {
@@ -2777,7 +2768,7 @@ static int __init intel_iommu_quarantine_init(struct domain *d)
             dma_set_pte_addr(*pte, maddr);
             dma_set_pte_readable(*pte);
         }
-        iommu_flush_cache_page(parent, 1);
+        iommu_sync_cache(parent, PAGE_SIZE);
 
         unmap_vtd_domain_page(parent);
         parent = map_vtd_domain_page(maddr);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 09:23:05 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 09:23: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 1jt6ID-0003ly-31; Wed, 08 Jul 2020 09:23:05 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt6IB-0003lm-UX
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:23:03 +0000
X-Inumbo-ID: 9fbd4f0e-c0fc-11ea-8e24-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 9fbd4f0e-c0fc-11ea-8e24-12813bfff9fa;
 Wed, 08 Jul 2020 09:23:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=v8pwD0juWQuS/WjdG9se1RE3TaXL5FlaW1HTPAXxc78=; b=CTu/TI2atD8F3lboC5tbuM1xrL
 pUPcugfIFHdSssFDHnUFYRiCttnYkklKjalGodxVADnB+ktdM7tBqx4fWkHdqUbnCtrUfjWGxvpHh
 AL5rmYJX9vRt2/7DdLGlSnNfaOkfbAd85MwurQOgN9D1L8tNAk7QUHIvm51e11jKwYaE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6IB-0005SQ-6D
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:23:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6IB-00032n-5I
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:23:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/iommu: introduce a cache sync hook
Message-Id: <E1jt6IB-00032n-5I@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 09:23:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 38dc269ea444fb02a054423cb430ea6c717cd906
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:11:18 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:11:18 2020 +0200

    x86/iommu: introduce a cache sync hook
    
    The hook is only implemented for VT-d and it uses the already existing
    iommu_sync_cache function present in VT-d code. The new hook is
    added so that the cache can be flushed by code outside of VT-d when
    using shared page tables.
    
    Note that alloc_pgtable_maddr must use the now locally defined
    sync_cache function, because IOMMU ops are not yet setup the first
    time the function gets called during IOMMU initialization.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 91526b460e5009fc56edbd6809e66c327281faba
    master date: 2020-07-07 14:38:34 +0200
---
 xen/drivers/passthrough/vtd/extern.h | 1 -
 xen/drivers/passthrough/vtd/iommu.c  | 5 +++--
 xen/include/asm-x86/iommu.h          | 7 +++++++
 xen/include/xen/iommu.h              | 1 +
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index d6ffe804a4..01d60a4644 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -38,7 +38,6 @@ void disable_qinval(struct iommu *iommu);
 int enable_intremap(struct iommu *iommu, int eim);
 void disable_intremap(struct iommu *iommu);
 
-void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 274d035fb5..02a57a3da6 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -159,7 +159,7 @@ static void __init free_intel_iommu(struct intel_iommu *intel)
 
 static int iommus_incoherent;
 
-void iommu_sync_cache(const void *addr, unsigned int size)
+static void sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -198,7 +198,7 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_sync_cache(vaddr, PAGE_SIZE);
+        sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -2813,6 +2813,7 @@ const struct iommu_ops __initconstrel intel_iommu_ops = {
     .iotlb_flush_all = iommu_flush_iotlb_all,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_p2m_table = vtd_dump_p2m_table,
+    .sync_cache = sync_cache,
 };
 
 /*
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 8dc392473d..f5cb04d032 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -101,6 +101,13 @@ extern bool untrusted_msi;
 int pi_update_irte(const struct pi_desc *pi_desc, const struct pirq *pirq,
                    const uint8_t gvec);
 
+#define iommu_sync_cache(addr, size) ({                 \
+    const struct iommu_ops *ops = iommu_get_ops();      \
+                                                        \
+    if ( ops->sync_cache )                              \
+        ops->sync_cache(addr, size);                    \
+})
+
 #endif /* !__ARCH_X86_IOMMU_H__ */
 /*
  * Local variables:
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 617c993f50..262679485d 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -221,6 +221,7 @@ struct iommu_ops {
     void (*update_ire_from_apic)(unsigned int apic, unsigned int reg, unsigned int value);
     unsigned int (*read_apic_from_ire)(unsigned int apic, unsigned int reg);
     int (*setup_hpet_msi)(struct msi_desc *);
+    void (*sync_cache)(const void *addr, unsigned int size);
 #endif /* CONFIG_X86 */
     int __must_check (*suspend)(void);
     void (*resume)(void);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 09:23:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 09:23: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 1jt6IN-0003ns-4a; Wed, 08 Jul 2020 09:23:15 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt6IL-0003nd-Rn
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:23:13 +0000
X-Inumbo-ID: a5c1378a-c0fc-11ea-8e24-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a5c1378a-c0fc-11ea-8e24-12813bfff9fa;
 Wed, 08 Jul 2020 09:23:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=aTfolNYkyBrUif1YSUXOZlHV393YEzV/57+7u1oGUtg=; b=yfEn0QXLfRFoETXjrDmqo1C6R1
 qfKzQL0/x1gm/pgj3pwRjQrVYRrvf4ZSGq4WAs2cSQAY8nzy60HmBA1ChjIWz8ZbBfusM6iLXbs7s
 m0TU+c/LB9WqgO5wlj8VqSC8Giz5URDFxPIjSJq+z6YtHgF4Wv9SWUaweNCHb7esTKqU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6IL-0005Sd-9G
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:23:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6IL-00033H-8Q
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:23:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] vtd: don't assume addresses are aligned in
 sync_cache
Message-Id: <E1jt6IL-00033H-8Q@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 09:23:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit b292255ea232625a8e872db15bf49f527dfe12ae
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:11:55 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:11:55 2020 +0200

    vtd: don't assume addresses are aligned in sync_cache
    
    Current code in sync_cache assume that the address passed in is
    aligned to a cache line size. Fix the code to support passing in
    arbitrary addresses not necessarily aligned to a cache line size.
    
    This is part of XSA-321.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b6d9398144f21718d25daaf8d72669a75592abc5
    master date: 2020-07-07 14:39:05 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 02a57a3da6..4cb90633dc 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -161,8 +161,8 @@ static int iommus_incoherent;
 
 static void sync_cache(const void *addr, unsigned int size)
 {
-    int i;
-    static unsigned int clflush_size = 0;
+    static unsigned long clflush_size = 0;
+    const void *end = addr + size;
 
     if ( !iommus_incoherent )
         return;
@@ -170,8 +170,9 @@ static void sync_cache(const void *addr, unsigned int size)
     if ( clflush_size == 0 )
         clflush_size = get_cache_line_size();
 
-    for ( i = 0; i < size; i += clflush_size )
-        cacheline_flush((char *)addr + i);
+    addr -= (unsigned long)addr & (clflush_size - 1);
+    for ( ; addr < end; addr += clflush_size )
+        cacheline_flush((char *)addr);
 }
 
 /* Allocate page table, return its machine address */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 09:23:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 09:23: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 1jt6IX-0003pY-6K; Wed, 08 Jul 2020 09:23:25 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt6IW-0003pM-D9
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:23:24 +0000
X-Inumbo-ID: abc42bf6-c0fc-11ea-8e24-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id abc42bf6-c0fc-11ea-8e24-12813bfff9fa;
 Wed, 08 Jul 2020 09:23:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=RD1t6k6HWJjpqiGtv6ZHi4p4V9WO+LZfzbwTn1fG8uY=; b=NDHUjx6glzXLdoKKtzR2Yfmfo6
 1ZMm20UDDR/Jps3oenWBf1IsGpin4aiJHLa2y9sXGgLXqELJtn9qQm0eRMirYHcsHz6wgqCQFmioe
 SdVVuYtNUG5IMmDLlMnogsUALF+DIhRrO6Oe1gKr2DaDDFr7YG7vLLsnX7muVqSDRGe4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6IV-0005Sq-By
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:23:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6IV-00033h-BK
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:23:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/alternative: introduce alternative_2
Message-Id: <E1jt6IV-00033h-BK@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 09:23:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 26072a508d07e347eb9b59167325c9a54707baab
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:12:16 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:12:16 2020 +0200

    x86/alternative: introduce alternative_2
    
    It's based on alternative_io_2 without inputs or outputs but with an
    added memory clobber.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 23570bce00ee6ba2139ece978ab6f03ff166e21d
    master date: 2020-07-07 14:39:25 +0200
---
 xen/include/asm-x86/alternative.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h
index d96411f0f3..6e827cf34f 100644
--- a/xen/include/asm-x86/alternative.h
+++ b/xen/include/asm-x86/alternative.h
@@ -113,6 +113,11 @@ extern void alternative_instructions(void);
 #define alternative(oldinstr, newinstr, feature)                        \
         asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) : : : "memory")
 
+#define alternative_2(oldinstr, newinstr1, feature1, newinstr2, feature2) \
+	asm volatile (ALTERNATIVE_2(oldinstr, newinstr1, feature1,	\
+				    newinstr2, feature2)		\
+		      : : : "memory")
+
 /*
  * Alternative inline assembly with input.
  *
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 09:23:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 09: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 1jt6Ij-0003rX-KJ; Wed, 08 Jul 2020 09:23:37 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt6Ii-0003q0-Fe
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:23:36 +0000
X-Inumbo-ID: b1d8e284-c0fc-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b1d8e284-c0fc-11ea-bb8b-bc764e2007e4;
 Wed, 08 Jul 2020 09:23:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=UKOKhcj//pMNeOHZi+fedbNr+U7PKrjFc+Og50UXhog=; b=gEaFkotRJewu5mHU7Jx8bsVhzB
 qKj5PemQ2oMzvOcK9vYDVn0ojnshj/Fd8TtgZkxf5j9LWhMNKhyLCfwZhmqjd+GTVj7iXmjLKcBcA
 y6smg2No5Nud7BovLnx1g8ustxi3XN20Pqae/d+iewm4/ao5KlTTevMraenJIZoMYjXw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6If-0005T3-Ii
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:23:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6If-00034J-EE
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:23:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] vtd: optimize CPU cache sync
Message-Id: <E1jt6If-00034J-EE@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 09:23:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 653811e2d276eafd0d2199c7db40a04176a25599
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:12:46 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:12:46 2020 +0200

    vtd: optimize CPU cache sync
    
    Some VT-d IOMMUs are non-coherent, which requires a cache write back
    in order for the changes made by the CPU to be visible to the IOMMU.
    This cache write back was unconditionally done using clflush, but there are
    other more efficient instructions to do so, hence implement support
    for them using the alternative framework.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a64ea16522a73a13a0d66cfa4b66a9d3b95dd9d6
    master date: 2020-07-07 14:39:54 +0200
---
 xen/drivers/passthrough/vtd/extern.h  |  1 -
 xen/drivers/passthrough/vtd/iommu.c   | 38 ++++++++++++++++++++++++++++++++++-
 xen/drivers/passthrough/vtd/x86/vtd.c |  5 -----
 3 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 01d60a4644..97181757ac 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -64,7 +64,6 @@ int __must_check qinval_device_iotlb_sync(struct iommu *iommu,
                                           u16 did, u16 size, u64 addr);
 
 unsigned int get_cache_line_size(void);
-void cacheline_flush(char *);
 void flush_all_cache(void);
 
 u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 4cb90633dc..19f51026a4 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -31,6 +31,7 @@
 #include <xen/pci_regs.h>
 #include <xen/keyhandler.h>
 #include <asm/msi.h>
+#include <asm/nops.h>
 #include <asm/irq.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/p2m.h>
@@ -172,7 +173,42 @@ static void sync_cache(const void *addr, unsigned int size)
 
     addr -= (unsigned long)addr & (clflush_size - 1);
     for ( ; addr < end; addr += clflush_size )
-        cacheline_flush((char *)addr);
+/*
+ * The arguments to a macro must not include preprocessor directives. Doing so
+ * results in undefined behavior, so we have to create some defines here in
+ * order to avoid it.
+ */
+#if defined(HAVE_AS_CLWB)
+# define CLWB_ENCODING "clwb %[p]"
+#elif defined(HAVE_AS_XSAVEOPT)
+# define CLWB_ENCODING "data16 xsaveopt %[p]" /* clwb */
+#else
+# define CLWB_ENCODING ".byte 0x66, 0x0f, 0xae, 0x30" /* clwb (%%rax) */
+#endif
+
+#define BASE_INPUT(addr) [p] "m" (*(const char *)(addr))
+#if defined(HAVE_AS_CLWB) || defined(HAVE_AS_XSAVEOPT)
+# define INPUT BASE_INPUT
+#else
+# define INPUT(addr) "a" (addr), BASE_INPUT(addr)
+#endif
+        /*
+         * Note regarding the use of NOP_DS_PREFIX: it's faster to do a clflush
+         * + prefix than a clflush + nop, and hence the prefix is added instead
+         * of letting the alternative framework fill the gap by appending nops.
+         */
+        alternative_io_2(".byte " __stringify(NOP_DS_PREFIX) "; clflush %[p]",
+                         "data16 clflush %[p]", /* clflushopt */
+                         X86_FEATURE_CLFLUSHOPT,
+                         CLWB_ENCODING,
+                         X86_FEATURE_CLWB, /* no outputs */,
+                         INPUT(addr));
+#undef INPUT
+#undef BASE_INPUT
+#undef CLWB_ENCODING
+
+    alternative_2("", "sfence", X86_FEATURE_CLFLUSHOPT,
+                      "sfence", X86_FEATURE_CLWB);
 }
 
 /* Allocate page table, return its machine address */
diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c
index ff456e1e70..229938f3a8 100644
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -51,11 +51,6 @@ unsigned int get_cache_line_size(void)
     return ((cpuid_ebx(1) >> 8) & 0xff) * 8;
 }
 
-void cacheline_flush(char * addr)
-{
-    clflush(addr);
-}
-
 void flush_all_cache()
 {
     wbinvd();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 09:23:45 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 09:23: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 1jt6Ir-0003sc-MA; Wed, 08 Jul 2020 09:23:45 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt6Iq-0003sL-K8
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:23:44 +0000
X-Inumbo-ID: b7de37ba-c0fc-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b7de37ba-c0fc-11ea-bca7-bc764e2007e4;
 Wed, 08 Jul 2020 09:23:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=YoA/4KhVW4hDtvAu6rmATtF1Om/i2/7T8MtInLI+JQ8=; b=omXBabdLb1qbPxn39q14ZbAKg7
 HnNOT4D4+e7+Zmmg5X0gBy2ObQaXAEpeHTg79h9ESatXZ1fAAuO1vE0hRNCSJAGWdbvpuS84rNNvS
 FZSMbhOFV9PmgF4hEiFQ39aYUxW2yC2Laef3oivjh5bSkzhNlwNe0DAxe3sQDJzotPj8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6Ip-0005TE-Le
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:23:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6Ip-00035E-L0
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:23:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] x86/ept: flush cache when modifying PTEs and
 sharing page tables
Message-Id: <E1jt6Ip-00035E-L0@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 09:23:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit d96c0f1ed540cf78e2f83d29d30e4f155c4b1cb4
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:13:07 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:13:07 2020 +0200

    x86/ept: flush cache when modifying PTEs and sharing page tables
    
    Modifications made to the page tables by EPT code need to be written
    to memory when the page tables are shared with the IOMMU, as Intel
    IOMMUs can be non-coherent and thus require changes to be written to
    memory in order to be visible to the IOMMU.
    
    In order to achieve this make sure data is written back to memory
    after writing an EPT entry when the recalc bit is not set in
    atomic_write_ept_entry. If such bit is set, the entry will be
    adjusted and atomic_write_ept_entry will be called a second time
    without the recalc bit set. Note that when splitting a super page the
    new tables resulting of the split should also be written back.
    
    Failure to do so can allow devices behind the IOMMU access to the
    stale super page, or cause coherency issues as changes made by the
    processor to the page tables are not visible to the IOMMU.
    
    This allows to remove the VT-d specific iommu_pte_flush helper, since
    the cache write back is now performed by atomic_write_ept_entry, and
    hence iommu_iotlb_flush can be used to flush the IOMMU TLB. The newly
    used method (iommu_iotlb_flush) can result in less flushes, since it
    might sometimes be called rightly with 0 flags, in which case it
    becomes a no-op.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c23274fd0412381bd75068ebc9f8f8c90a4be748
    master date: 2020-07-07 14:40:11 +0200
---
 xen/arch/x86/mm/p2m-ept.c           | 24 ++++++++++++++++++-
 xen/drivers/passthrough/vtd/iommu.c | 47 -------------------------------------
 xen/include/asm-x86/iommu.h         |  2 --
 3 files changed, 23 insertions(+), 50 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 61fc39bac5..5822ca77ca 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -58,6 +58,19 @@ static int atomic_write_ept_entry(struct p2m_domain *p2m,
 
     write_atomic(&entryptr->epte, new.epte);
 
+    /*
+     * The recalc field on the EPT is used to signal either that a
+     * recalculation of the EMT field is required (which doesn't effect the
+     * IOMMU), or a type change. Type changes can only be between ram_rw,
+     * logdirty and ioreq_server: changes to/from logdirty won't work well with
+     * an IOMMU anyway, as IOMMU #PFs are not synchronous and will lead to
+     * aborts, and changes to/from ioreq_server are already fully flushed
+     * before returning to guest context (see
+     * XEN_DMOP_map_mem_type_to_ioreq_server).
+     */
+    if ( !new.recalc && iommu_use_hap_pt(p2m->domain) )
+        iommu_sync_cache(entryptr, sizeof(*entryptr));
+
     return 0;
 }
 
@@ -278,6 +291,9 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
             break;
     }
 
+    if ( iommu_use_hap_pt(p2m->domain) )
+        iommu_sync_cache(table, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
     unmap_domain_page(table);
 
     /* Even failed we should install the newly allocated ept page. */
@@ -337,6 +353,9 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
 
+        if ( iommu_use_hap_pt(p2m->domain) )
+            iommu_sync_cache(next, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
         rc = atomic_write_ept_entry(p2m, ept_entry, e, next_level);
         ASSERT(rc == 0);
     }
@@ -815,7 +834,10 @@ out:
          need_modify_vtd_table )
     {
         if ( iommu_use_hap_pt(d) )
-            rc = iommu_pte_flush(d, gfn, &ept_entry->epte, order, vtd_pte_present);
+            rc = iommu_iotlb_flush(d, _dfn(gfn), (1u << order),
+                                   (iommu_flags ? IOMMU_FLUSHF_added : 0) |
+                                   (vtd_pte_present ? IOMMU_FLUSHF_modified
+                                                    : 0));
         else if ( need_iommu_pt_sync(d) )
             rc = iommu_flags ?
                 iommu_legacy_map(d, _dfn(gfn), mfn, order, iommu_flags) :
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 19f51026a4..f36fded6fe 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1930,53 +1930,6 @@ static int intel_iommu_lookup_page(struct domain *d, dfn_t dfn, mfn_t *mfn,
     return 0;
 }
 
-int iommu_pte_flush(struct domain *d, uint64_t dfn, uint64_t *pte,
-                    int order, int present)
-{
-    struct acpi_drhd_unit *drhd;
-    struct iommu *iommu = NULL;
-    struct domain_iommu *hd = dom_iommu(d);
-    bool_t flush_dev_iotlb;
-    int iommu_domid;
-    int rc = 0;
-
-    iommu_sync_cache(pte, sizeof(struct dma_pte));
-
-    for_each_drhd_unit ( drhd )
-    {
-        iommu = drhd->iommu;
-        if ( !test_bit(iommu->index, &hd->arch.iommu_bitmap) )
-            continue;
-
-        flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
-        iommu_domid= domain_iommu_domid(d, iommu);
-        if ( iommu_domid == -1 )
-            continue;
-
-        rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
-                                   __dfn_to_daddr(dfn),
-                                   order, !present, flush_dev_iotlb);
-        if ( rc > 0 )
-        {
-            iommu_flush_write_buffer(iommu);
-            rc = 0;
-        }
-    }
-
-    if ( unlikely(rc) )
-    {
-        if ( !d->is_shutting_down && printk_ratelimit() )
-            printk(XENLOG_ERR VTDPREFIX
-                   " d%d: IOMMU pages flush failed: %d\n",
-                   d->domain_id, rc);
-
-        if ( !is_hardware_domain(d) )
-            domain_crash(d);
-    }
-
-    return rc;
-}
-
 static int __init vtd_ept_page_compatible(struct iommu *iommu)
 {
     u64 ept_cap, vtd_cap = iommu->cap;
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index f5cb04d032..fc51508e9d 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -90,8 +90,6 @@ int iommu_setup_hpet_msi(struct msi_desc *);
 
 /* While VT-d specific, this must get declared in a generic header. */
 int adjust_vtd_irq_affinities(void);
-int __must_check iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
-                                 int order, int present);
 bool_t iommu_supports_eim(void);
 int iommu_enable_x2apic_IR(void);
 void iommu_disable_x2apic_IR(void);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 09:23:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 09:23: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 1jt6J1-0003vK-P4; Wed, 08 Jul 2020 09:23:55 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jt6J0-0003v4-CY
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:23:54 +0000
X-Inumbo-ID: bde18a9a-c0fc-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id bde18a9a-c0fc-11ea-bca7-bc764e2007e4;
 Wed, 08 Jul 2020 09:23:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=AXUyNrxmTvz6JhCXKPqzMM/bQCj+lmo9M+7D3rqifO8=; b=k2Z4B8sG/r7axS4Fc/Qnv5yHXA
 5ESH3otfBriIzY6YFhnQSLD3kPar0/dvO3I1x8INFpeN8xUdjxVbQhSxVAUANU/0J84j6+BvP/+Zj
 qViMFi3J+jrwfiVX2oQ0ytwEC/XbDb2EB4x5yOvvu62Z4JEcFfTAqDBJCjA8CTUOf1a4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6Iz-0005TM-OY
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:23:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jt6Iz-00035g-Nk
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 09:23:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.12] xen: Check the alignment of the offset pased via
 VCPUOP_register_vcpu_info
Message-Id: <E1jt6Iz-00035g-Nk@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 09:23:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 19e0bbb4eba8d781b972448ec01ede6ca7fa22cb
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jul 7 15:13:40 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:13:40 2020 +0200

    xen: Check the alignment of the offset pased via VCPUOP_register_vcpu_info
    
    Currently a guest is able to register any guest physical address to use
    for the vcpu_info structure as long as the structure can fits in the
    rest of the frame.
    
    This means a guest can provide an address that is not aligned to the
    natural alignment of the structure.
    
    On Arm 32-bit, unaligned access are completely forbidden by the
    hypervisor. This will result to a data abort which is fatal.
    
    On Arm 64-bit, unaligned access are only forbidden when used for atomic
    access. As the structure contains fields (such as evtchn_pending_self)
    that are updated using atomic operations, any unaligned access will be
    fatal as well.
    
    While the misalignment is only fatal on Arm, a generic check is added
    as an x86 guest shouldn't sensibly pass an unaligned address (this
    would result to a split lock).
    
    This is XSA-327.
    
    Reported-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    master commit: 3fdc211b01b29f252166937238efe02d15cb5780
    master date: 2020-07-07 14:41:00 +0200
---
 xen/common/domain.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 7f8fc43cbe..5f94651f11 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1253,10 +1253,20 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
     void *mapping;
     vcpu_info_t *new_info;
     struct page_info *page;
+    unsigned int align;
 
     if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
         return -EINVAL;
 
+#ifdef CONFIG_COMPAT
+    if ( has_32bit_shinfo(d) )
+        align = alignof(new_info->compat);
+    else
+#endif
+        align = alignof(*new_info);
+    if ( offset & (align - 1) )
+        return -EINVAL;
+
     if ( !mfn_eq(v->vcpu_info_mfn, INVALID_MFN) )
         return -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 17:00:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 17:00:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jtDQR-0000vs-Kr; Wed, 08 Jul 2020 17:00:03 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtDQQ-0000nr-Rj
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:00:02 +0000
X-Inumbo-ID: 76a3fa60-c13c-11ea-bca7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 76a3fa60-c13c-11ea-bca7-bc764e2007e4;
 Wed, 08 Jul 2020 17:00:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=6/eLbBVrOAJmdmNCo5R9rTfAdVkCCKgjqWrrxgD+A/w=; b=YXZpSRcV08qV7fhH8oA4MSpOcG
 VRJKQVEcjLlwQXsbuMXnLC429jmzbR8e10+/FENBxWQe5Pu4sDPf1+K7UIUHQBcWiKKwkUnlu/s9F
 4qf5kM+ziNjfkbIUgWn/Rwao/K0jw4cdD3r/cbMOih5bZ9jyDpkacQjmnK+5mxdTpQsI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDQP-00068k-WD
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDQP-0006tO-US
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:00:01 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen/common: event_channel: Don't ignore error in
 get_free_port()
Message-Id: <E1jtDQP-0006tO-US@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 17:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 2e9c2bc292231823a3a021d2e0a9f1956bf00b3c
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Mar 19 13:17:31 2020 +0000
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:35:36 2020 +0200

    xen/common: event_channel: Don't ignore error in get_free_port()
    
    Currently, get_free_port() is assuming that the port has been allocated
    when evtchn_allocate_port() is not return -EBUSY.
    
    However, the function may return an error when:
        - We exhausted all the event channels. This can happen if the limit
        configured by the administrator for the guest ('max_event_channels'
        in xl cfg) is higher than the ABI used by the guest. For instance,
        if the guest is using 2L, the limit should not be higher than 4095.
        - We cannot allocate memory (e.g Xen has not more memory).
    
    Users of get_free_port() (such as EVTCHNOP_alloc_unbound) will validly
    assuming the port was valid and will next call evtchn_from_port(). This
    will result to a crash as the memory backing the event channel structure
    is not present.
    
    Fixes: 368ae9a05fe ("xen/pvshim: forward evtchn ops between L0 Xen and L2 DomU")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/event_channel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index e86e2bfab0..a8d182b584 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -195,10 +195,10 @@ static int get_free_port(struct domain *d)
     {
         int rc = evtchn_allocate_port(d, port);
 
-        if ( rc == -EBUSY )
-            continue;
-
-        return port;
+        if ( rc == 0 )
+            return port;
+        else if ( rc != -EBUSY )
+            return rc;
     }
 
     return -ENOSPC;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 17:00:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 17:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jtDQb-0001Jl-Mb; Wed, 08 Jul 2020 17:00:13 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtDQa-0001Jd-OE
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:00:12 +0000
X-Inumbo-ID: 7cb0a7d2-c13c-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 7cb0a7d2-c13c-11ea-b7bb-bc764e2007e4;
 Wed, 08 Jul 2020 17:00:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=vkRdly8/la0k5py//LhRZGONLi9ZpBS+UPKR2JrSoeI=; b=dTUmC9hwr8M3jwQNlaft45Nh+L
 Dns9Jgs6g+J61umc/LM0/kjP98oXDe724zKKQGvq2lXXp7bRGPCtlSTUNo8xFeHNcRm4EoSkkis+Y
 7nBpel3I4KAXcUFwqM6PNIJnzaLjmw1HqgNp37oNLm903AnTneNls5QhgLtRVJUKtcNY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDQa-00068q-47
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDQa-0006up-2O
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:00:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/shadow: correct an inverted conditional in dirty
 VRAM tracking
Message-Id: <E1jtDQa-0006up-2O@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 17:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 23a216f99d40fbfbc2318ade89d8213eea6ba1f8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 14:36:24 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:36:24 2020 +0200

    x86/shadow: correct an inverted conditional in dirty VRAM tracking
    
    This originally was "mfn_x(mfn) == INVALID_MFN". Make it like this
    again, taking the opportunity to also drop the unnecessary nearby
    braces.
    
    This is XSA-319.
    
    Fixes: 246a5a3377c2 ("xen: Use a typesafe to define INVALID_MFN")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 5fcb04ce8b..773777321f 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3253,10 +3253,8 @@ int shadow_track_dirty_vram(struct domain *d,
             int dirty = 0;
             paddr_t sl1ma = dirty_vram->sl1ma[i];
 
-            if ( !mfn_eq(mfn, INVALID_MFN) )
-            {
+            if ( mfn_eq(mfn, INVALID_MFN) )
                 dirty = 1;
-            }
             else
             {
                 page = mfn_to_page(mfn);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 17:00:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 17:00:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jtDQn-0001Kl-OL; Wed, 08 Jul 2020 17:00:25 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtDQm-0001Ke-9O
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:00:24 +0000
X-Inumbo-ID: 82b35472-c13c-11ea-8e54-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 82b35472-c13c-11ea-8e54-12813bfff9fa;
 Wed, 08 Jul 2020 17:00:22 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=ybqQ0oS1vJkFZiYg6EZFV7E/YLGf4LFMHJcpg6Xq8yM=; b=btPtMP+dwFZyEwYLttRx+VgpnQ
 w+yiqKyWiJL4yX5mPXmP6Z/lvO9aVt6K5IKjB0Ercve8UyptU4ezBT4IA3r3Xby0uo5kfmfDhDPUO
 TrAuvmSVFTpW7KJsPJ86tOMOEfBGSVgYm8i9gkJaqZ7kY3QLu6V+h/xe+08oegwYwtc4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDQk-00069h-73
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDQk-0006ve-6I
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:00:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/EPT: ept_set_middle_entry() related adjustments
Message-Id: <E1jtDQk-0006ve-6I@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 17:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 1104288186ee73a7f9bfa41cbaa5bb7611521028
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 14:36:52 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:36:52 2020 +0200

    x86/EPT: ept_set_middle_entry() related adjustments
    
    ept_split_super_page() wants to further modify the newly allocated
    table, so have ept_set_middle_entry() return the mapped pointer rather
    than tearing it down and then getting re-established right again.
    
    Similarly ept_next_level() wants to hand back a mapped pointer of
    the next level page, so re-use the one established by
    ept_set_middle_entry() in case that path was taken.
    
    Pull the setting of suppress_ve ahead of insertion into the higher level
    table, and don't have ept_split_super_page() set the field a 2nd time.
    
    This is part of XSA-328.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m-ept.c | 41 ++++++++++++++++++-----------------------
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 293f3e9419..d9913a6c97 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -186,8 +186,9 @@ static void ept_p2m_type_to_flags(const struct p2m_domain *p2m,
 #define GUEST_TABLE_SUPER_PAGE  2
 #define GUEST_TABLE_POD_PAGE    3
 
-/* Fill in middle levels of ept table */
-static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
+/* Fill in middle level of ept table; return pointer to mapped new table. */
+static ept_entry_t *ept_set_middle_entry(struct p2m_domain *p2m,
+                                         ept_entry_t *ept_entry)
 {
     mfn_t mfn;
     ept_entry_t *table;
@@ -195,7 +196,12 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     mfn = p2m_alloc_ptp(p2m, 0);
     if ( mfn_eq(mfn, INVALID_MFN) )
-        return 0;
+        return NULL;
+
+    table = map_domain_page(mfn);
+
+    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
+        table[i].suppress_ve = 1;
 
     ept_entry->epte = 0;
     ept_entry->mfn = mfn_x(mfn);
@@ -207,14 +213,7 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     ept_entry->suppress_ve = 1;
 
-    table = map_domain_page(mfn);
-
-    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
-        table[i].suppress_ve = 1;
-
-    unmap_domain_page(table);
-
-    return 1;
+    return table;
 }
 
 /* free ept sub tree behind an entry */
@@ -252,10 +251,10 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
 
     ASSERT(is_epte_superpage(ept_entry));
 
-    if ( !ept_set_middle_entry(p2m, &new_ept) )
+    table = ept_set_middle_entry(p2m, &new_ept);
+    if ( !table )
         return 0;
 
-    table = map_domain_page(_mfn(new_ept.mfn));
     trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER);
 
     for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
@@ -266,7 +265,6 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
         epte->sp = (level > 1);
         epte->mfn += i * trunk;
         epte->snp = is_iommu_enabled(p2m->domain) && iommu_snoop;
-        epte->suppress_ve = 1;
 
         ept_p2m_type_to_flags(p2m, epte);
 
@@ -305,8 +303,7 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
                           ept_entry_t **table, unsigned long *gfn_remainder,
                           int next_level)
 {
-    unsigned long mfn;
-    ept_entry_t *ept_entry, e;
+    ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
     shift = next_level * EPT_TABLE_ORDER;
@@ -331,19 +328,17 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        if ( !ept_set_middle_entry(p2m, ept_entry) )
+        next = ept_set_middle_entry(p2m, ept_entry);
+        if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        else
-            e = atomic_read_ept_entry(ept_entry); /* Refresh */
+        /* e is now stale and hence may not be used anymore below. */
     }
-
     /* The only time sp would be set here is if we had hit a superpage */
-    if ( is_epte_superpage(&e) )
+    else if ( is_epte_superpage(&e) )
         return GUEST_TABLE_SUPER_PAGE;
 
-    mfn = e.mfn;
     unmap_domain_page(*table);
-    *table = map_domain_page(_mfn(mfn));
+    *table = next ?: map_domain_page(_mfn(e.mfn));
     *gfn_remainder &= (1UL << shift) - 1;
     return GUEST_TABLE_NORMAL_PAGE;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 17:00:33 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 17:00:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jtDQv-0001Ln-Pp; Wed, 08 Jul 2020 17:00:33 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtDQv-0001Lg-1n
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:00:33 +0000
X-Inumbo-ID: 88bdb92a-c13c-11ea-8e54-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 88bdb92a-c13c-11ea-8e54-12813bfff9fa;
 Wed, 08 Jul 2020 17:00:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=inZU5icYNimmvTpTFMpcpmcj2V+0z+BgLmF6dQgfBUQ=; b=j4KhqCQT5Y8+BRL+ZxX1g//fDW
 4HFyBR4yuEYANMHWjvv7Lbb7u0tOXGdp0K4cnUDUISHznvXW2qPIX7Lw8dfmXmsQ1xSe7wUK8U3NI
 uQGrB5RulxpQK0uGXhMB+JAdxvfwuM4LTyR5yBS80kKi63T2oIUCxFM/hXDe8d33xYBg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDQu-00069p-Ct
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDQu-0006wY-9I
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:00:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/ept: atomically modify entries in ept_next_level
Message-Id: <E1jtDQu-0006wY-9I@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 17:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit bc3d9f95d661372b059a5539ae6cb1e79435bb95
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 14:37:12 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:37:12 2020 +0200

    x86/ept: atomically modify entries in ept_next_level
    
    ept_next_level was passing a live PTE pointer to ept_set_middle_entry,
    which was then modified without taking into account that the PTE could
    be part of a live EPT table. This wasn't a security issue because the
    pages returned by p2m_alloc_ptp are zeroed, so adding such an entry
    before actually initializing it didn't allow a guest to access
    physical memory addresses it wasn't supposed to access.
    
    This is part of XSA-328.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/p2m-ept.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index d9913a6c97..87a14f6f22 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -306,6 +306,8 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
     ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
+    ASSERT(next_level);
+
     shift = next_level * EPT_TABLE_ORDER;
 
     index = *gfn_remainder >> shift;
@@ -322,16 +324,20 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
 
     if ( !is_epte_present(&e) )
     {
+        int rc;
+
         if ( e.sa_p2mt == p2m_populate_on_demand )
             return GUEST_TABLE_POD_PAGE;
 
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        next = ept_set_middle_entry(p2m, ept_entry);
+        next = ept_set_middle_entry(p2m, &e);
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        /* e is now stale and hence may not be used anymore below. */
+
+        rc = atomic_write_ept_entry(p2m, ept_entry, e, next_level);
+        ASSERT(rc == 0);
     }
     /* The only time sp would be set here is if we had hit a superpage */
     else if ( is_epte_superpage(&e) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 17:00:43 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 17:00:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jtDR5-0001Mo-RM; Wed, 08 Jul 2020 17:00:43 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtDR5-0001Mi-2P
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:00:43 +0000
X-Inumbo-ID: 8ec14210-c13c-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 8ec14210-c13c-11ea-b7bb-bc764e2007e4;
 Wed, 08 Jul 2020 17:00:42 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=TvbXYNSfTltqhVhTtACp6lRuOnnf1bDAJ3sE5TJSj7g=; b=knwtiJ0HEr8sMIk+zMQmaKWMWm
 GgWM4ldUEl/TLNqEw9rL2SAu1AaninSi1oL+ya/PRMbqV0MJtYWTaVV7NJqsZZ83JVrZ/d5ydc4RJ
 /524yuxVTMX71P+TgGjCPINkINZ5ElHvzTfDtrZ4GlzH2P4kvfj/6HsndfzdK7n4NZIc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDR4-0006Ar-Fl
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDR4-0006xN-F3
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:00:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] vtd: improve IOMMU TLB flush
Message-Id: <E1jtDR4-0006xN-F3@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 17:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 5fe515a0fede07543f2a3b049167b1fd8b873caf
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 14:37:46 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:37:46 2020 +0200

    vtd: improve IOMMU TLB flush
    
    Do not limit PSI flushes to order 0 pages, in order to avoid doing a
    full TLB flush if the passed in page has an order greater than 0 and
    is aligned. Should increase the performance of IOMMU TLB flushes when
    dealing with page orders greater than 0.
    
    This is part of XSA-321.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 208b33c0e4..dcc9b7a35e 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -576,13 +576,14 @@ static int __must_check iommu_flush_iotlb(struct domain *d, dfn_t dfn,
         if ( iommu_domid == -1 )
             continue;
 
-        if ( page_count != 1 || dfn_eq(dfn, INVALID_DFN) )
+        if ( !page_count || (page_count & (page_count - 1)) ||
+             dfn_eq(dfn, INVALID_DFN) || !IS_ALIGNED(dfn_x(dfn), page_count) )
             rc = iommu_flush_iotlb_dsi(iommu, iommu_domid,
                                        0, flush_dev_iotlb);
         else
             rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
                                        dfn_to_daddr(dfn),
-                                       PAGE_ORDER_4K,
+                                       get_order_from_pages(page_count),
                                        !dma_old_pte_present,
                                        flush_dev_iotlb);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 17:00:54 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 17:00: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 1jtDRG-0001Ng-Su; Wed, 08 Jul 2020 17:00:54 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtDRF-0001NZ-Ek
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:00:53 +0000
X-Inumbo-ID: 94c64ee4-c13c-11ea-8e54-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 94c64ee4-c13c-11ea-8e54-12813bfff9fa;
 Wed, 08 Jul 2020 17:00:52 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=qzflSFM1gCkHYFBcp0q5MeWW9eP2w+iN1/mQ02OtL5k=; b=dD4aPcFRpR1KwVCE2SWjFpMFhJ
 9cKCCstH/FsG9Lcfzfnns91Dq77Fgc+ZOYXHieeX0S1gwv8OUakPafUXi0LDT0byqsFW0rrZjjx86
 sxMl4PAYc3IjzuylWhplm+MDT5nmyoF79a/0LIZMo4bwFW2lOaQV7o/kI+P2GKwIIwTU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDRE-0006B4-Iq
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDRE-0006y8-Hy
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:00:52 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] vtd: prune (and rename) cache flush functions
Message-Id: <E1jtDRE-0006y8-Hy@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 17:00:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 62298825b9a44f45761acbd758138b5ba059ebd1
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 14:38:13 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:38:13 2020 +0200

    vtd: prune (and rename) cache flush functions
    
    Rename __iommu_flush_cache to iommu_sync_cache and remove
    iommu_flush_cache_page. Also remove the iommu_flush_cache_entry
    wrapper and just use iommu_sync_cache instead. Note the _entry suffix
    was meaningless as the wrapper was already taking a size parameter in
    bytes. While there also constify the addr parameter.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/vtd/extern.h   |  3 +--
 xen/drivers/passthrough/vtd/intremap.c |  6 +++---
 xen/drivers/passthrough/vtd/iommu.c    | 33 ++++++++++++---------------------
 3 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 994d360e90..52b5e1c60d 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -43,8 +43,7 @@ void disable_qinval(struct vtd_iommu *iommu);
 int enable_intremap(struct vtd_iommu *iommu, int eim);
 void disable_intremap(struct vtd_iommu *iommu);
 
-void iommu_flush_cache_entry(void *addr, unsigned int size);
-void iommu_flush_cache_page(void *addr, unsigned long npages);
+void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index bf846195c4..a2f02c1bea 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -230,7 +230,7 @@ static void free_remap_entry(struct vtd_iommu *iommu, int index)
                      iremap_entries, iremap_entry);
 
     update_irte(iommu, iremap_entry, &new_ire, false);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -406,7 +406,7 @@ static int ioapic_rte_to_remap_entry(struct vtd_iommu *iommu,
     }
 
     update_irte(iommu, iremap_entry, &new_ire, !init);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -695,7 +695,7 @@ static int msi_msg_to_remap_entry(
     update_irte(iommu, iremap_entry, &new_ire, msi_desc->irte_initialized);
     msi_desc->irte_initialized = true;
 
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index dcc9b7a35e..55eb140033 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -146,7 +146,8 @@ static int context_get_domain_id(struct context_entry *context,
 }
 
 static int iommus_incoherent;
-static void __iommu_flush_cache(void *addr, unsigned int size)
+
+void iommu_sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -161,16 +162,6 @@ static void __iommu_flush_cache(void *addr, unsigned int size)
         cacheline_flush((char *)addr + i);
 }
 
-void iommu_flush_cache_entry(void *addr, unsigned int size)
-{
-    __iommu_flush_cache(addr, size);
-}
-
-void iommu_flush_cache_page(void *addr, unsigned long npages)
-{
-    __iommu_flush_cache(addr, PAGE_SIZE * npages);
-}
-
 /* Allocate page table, return its machine address */
 uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
 {
@@ -189,7 +180,7 @@ uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_flush_cache_page(vaddr, 1);
+        iommu_sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -222,7 +213,7 @@ static u64 bus_to_context_maddr(struct vtd_iommu *iommu, u8 bus)
         }
         set_root_value(*root, maddr);
         set_root_present(*root);
-        iommu_flush_cache_entry(root, sizeof(struct root_entry));
+        iommu_sync_cache(root, sizeof(struct root_entry));
     }
     maddr = (u64) get_context_addr(*root);
     unmap_vtd_domain_page(root_entries);
@@ -269,7 +260,7 @@ static u64 addr_to_dma_page_maddr(struct domain *domain, u64 addr, int alloc)
              */
             dma_set_pte_readable(*pte);
             dma_set_pte_writable(*pte);
-            iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+            iommu_sync_cache(pte, sizeof(struct dma_pte));
         }
 
         if ( level == 2 )
@@ -645,7 +636,7 @@ static void dma_pte_clear_one(struct domain *domain, uint64_t addr,
     *flush_flags |= IOMMU_FLUSHF_modified;
 
     spin_unlock(&hd->arch.mapping_lock);
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     unmap_vtd_domain_page(page);
 }
@@ -682,7 +673,7 @@ static void iommu_free_page_table(struct page_info *pg)
             iommu_free_pagetable(dma_pte_addr(*pte), next_level);
 
         dma_clear_pte(*pte);
-        iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+        iommu_sync_cache(pte, sizeof(struct dma_pte));
     }
 
     unmap_vtd_domain_page(pt_vaddr);
@@ -1401,7 +1392,7 @@ int domain_context_mapping_one(
     context_set_address_width(*context, agaw);
     context_set_fault_enable(*context);
     context_set_present(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
     spin_unlock(&iommu->lock);
 
     /* Context entry was previously non-present (with domid 0). */
@@ -1565,7 +1556,7 @@ int domain_context_unmap_one(
 
     context_clear_present(*context);
     context_clear_entry(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
 
     iommu_domid= domain_iommu_domid(domain, iommu);
     if ( iommu_domid == -1 )
@@ -1792,7 +1783,7 @@ static int __must_check intel_iommu_map_page(struct domain *d, dfn_t dfn,
 
     *pte = new;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
     spin_unlock(&hd->arch.mapping_lock);
     unmap_vtd_domain_page(page);
 
@@ -1869,7 +1860,7 @@ int iommu_pte_flush(struct domain *d, uint64_t dfn, uint64_t *pte,
     int iommu_domid;
     int rc = 0;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     for_each_drhd_unit ( drhd )
     {
@@ -2739,7 +2730,7 @@ static int __init intel_iommu_quarantine_init(struct domain *d)
             dma_set_pte_addr(*pte, maddr);
             dma_set_pte_readable(*pte);
         }
-        iommu_flush_cache_page(parent, 1);
+        iommu_sync_cache(parent, PAGE_SIZE);
 
         unmap_vtd_domain_page(parent);
         parent = map_vtd_domain_page(maddr);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 17:01:05 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 17:01: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 1jtDRQ-0001Pz-Vn; Wed, 08 Jul 2020 17:01:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtDRP-0001Ov-ED
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:01:03 +0000
X-Inumbo-ID: 9ad000a0-c13c-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 9ad000a0-c13c-11ea-bb8b-bc764e2007e4;
 Wed, 08 Jul 2020 17:01:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=z0JWpWWBZV1V2MsP9RoAHHMQt1DkriFFBMNTCkcxgWo=; b=gRaW0/9ZZiYp9VdXgZgFMzfRQo
 5D7qIEVxaKQi71ZpsU+yqQLzCMlXUesTVroS6IkKgG2gkW3UFVeKLn+4MOlQKpzWlcIBTODk63ZHt
 vWQd80Rzgoe/qxFAk+WSciEl343U0JFidDH21OWlAiZIWNOSlIscIUHlWd7jOdtJGNAY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDRO-0006BP-Mz
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:01:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDRO-0006zB-LG
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:01:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/iommu: introduce a cache sync hook
Message-Id: <E1jtDRO-0006zB-LG@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 17:01:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 91526b460e5009fc56edbd6809e66c327281faba
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 14:38:34 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:38:34 2020 +0200

    x86/iommu: introduce a cache sync hook
    
    The hook is only implemented for VT-d and it uses the already existing
    iommu_sync_cache function present in VT-d code. The new hook is
    added so that the cache can be flushed by code outside of VT-d when
    using shared page tables.
    
    Note that alloc_pgtable_maddr must use the now locally defined
    sync_cache function, because IOMMU ops are not yet setup the first
    time the function gets called during IOMMU initialization.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/vtd/extern.h | 1 -
 xen/drivers/passthrough/vtd/iommu.c  | 5 +++--
 xen/include/asm-x86/iommu.h          | 7 +++++++
 xen/include/xen/iommu.h              | 1 +
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 52b5e1c60d..f15947af1f 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -43,7 +43,6 @@ void disable_qinval(struct vtd_iommu *iommu);
 int enable_intremap(struct vtd_iommu *iommu, int eim);
 void disable_intremap(struct vtd_iommu *iommu);
 
-void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 55eb140033..93bcd72f84 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -147,7 +147,7 @@ static int context_get_domain_id(struct context_entry *context,
 
 static int iommus_incoherent;
 
-void iommu_sync_cache(const void *addr, unsigned int size)
+static void sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -180,7 +180,7 @@ uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_sync_cache(vaddr, PAGE_SIZE);
+        sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -2778,6 +2778,7 @@ const struct iommu_ops __initconstrel intel_iommu_ops = {
     .iotlb_flush_all = iommu_flush_iotlb_all,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_p2m_table = vtd_dump_p2m_table,
+    .sync_cache = sync_cache,
 };
 
 const struct iommu_init_ops __initconstrel intel_iommu_init_ops = {
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 85741f7c96..864e025078 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -121,6 +121,13 @@ extern bool untrusted_msi;
 int pi_update_irte(const struct pi_desc *pi_desc, const struct pirq *pirq,
                    const uint8_t gvec);
 
+#define iommu_sync_cache(addr, size) ({                 \
+    const struct iommu_ops *ops = iommu_get_ops();      \
+                                                        \
+    if ( ops->sync_cache )                              \
+        iommu_vcall(ops, sync_cache, addr, size);       \
+})
+
 #endif /* !__ARCH_X86_IOMMU_H__ */
 /*
  * Local variables:
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 6264d3d07f..3272874958 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -275,6 +275,7 @@ struct iommu_ops {
     int (*setup_hpet_msi)(struct msi_desc *);
 
     int (*adjust_irq_affinities)(void);
+    void (*sync_cache)(const void *addr, unsigned int size);
 #endif /* CONFIG_X86 */
 
     int __must_check (*suspend)(void);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 17:01:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 17:01: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 1jtDRb-0001R6-16; Wed, 08 Jul 2020 17:01:15 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtDRZ-0001Qw-GX
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:01:13 +0000
X-Inumbo-ID: a0d2fed0-c13c-11ea-8e54-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a0d2fed0-c13c-11ea-8e54-12813bfff9fa;
 Wed, 08 Jul 2020 17:01:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=qzFsXkYhIU4Z+p/8VcpHunk82m0ReZLA6EqmiZiaS70=; b=eQ2CANNKVKh2w2a/3hYns3KWHH
 GpNasc4g5hwSZmGgOFHRsY0TeA6mNiY9puvbhdvkuDYhCS0xJfBZ5s6Dcq4qg1jUaT9sNeDM+iNjN
 wde9GyaizI4llZZbPiFNjL/oZATVwJKGQeD4aMXLBtpMcFUWWe55Gelb1nKmKS1tuvcg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDRY-0006By-Py
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:01:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDRY-0006zp-PE
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:01:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] vtd: don't assume addresses are aligned in sync_cache
Message-Id: <E1jtDRY-0006zp-PE@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 17:01:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit b6d9398144f21718d25daaf8d72669a75592abc5
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 14:39:05 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:39:05 2020 +0200

    vtd: don't assume addresses are aligned in sync_cache
    
    Current code in sync_cache assume that the address passed in is
    aligned to a cache line size. Fix the code to support passing in
    arbitrary addresses not necessarily aligned to a cache line size.
    
    This is part of XSA-321.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 93bcd72f84..8a2c105f72 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -149,8 +149,8 @@ static int iommus_incoherent;
 
 static void sync_cache(const void *addr, unsigned int size)
 {
-    int i;
-    static unsigned int clflush_size = 0;
+    static unsigned long clflush_size = 0;
+    const void *end = addr + size;
 
     if ( !iommus_incoherent )
         return;
@@ -158,8 +158,9 @@ static void sync_cache(const void *addr, unsigned int size)
     if ( clflush_size == 0 )
         clflush_size = get_cache_line_size();
 
-    for ( i = 0; i < size; i += clflush_size )
-        cacheline_flush((char *)addr + i);
+    addr -= (unsigned long)addr & (clflush_size - 1);
+    for ( ; addr < end; addr += clflush_size )
+        cacheline_flush((char *)addr);
 }
 
 /* Allocate page table, return its machine address */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 17:01:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 17:01: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 1jtDRl-0001SB-2n; Wed, 08 Jul 2020 17:01:25 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtDRj-0001Rw-Ja
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:01:23 +0000
X-Inumbo-ID: a6da3eec-c13c-11ea-8e54-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a6da3eec-c13c-11ea-8e54-12813bfff9fa;
 Wed, 08 Jul 2020 17:01:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=dFLpQvRiUzsui/lzM0Obc1Y24ND54ie/hvfr992eUIs=; b=LasnN2CYtZW3TNLovxYvWeCHvt
 M/ujGXSekStvLU4+S9sOo6a/4QS4SsqNgQCRvp/IsSG130dozqcJUpyqS/Nac7t709tKZqdgdGDrc
 QMyU9fDeqoGQwdrJpO1knLVdYLN2jHu8Myuc/qCFlNAioyfTKqjZoG0tTa4rn1Pofv/Y=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDRi-0006C9-TY
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:01:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDRi-00070Z-S8
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:01:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/alternative: introduce alternative_2
Message-Id: <E1jtDRi-00070Z-S8@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 17:01:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 23570bce00ee6ba2139ece978ab6f03ff166e21d
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 14:39:25 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:39:25 2020 +0200

    x86/alternative: introduce alternative_2
    
    It's based on alternative_io_2 without inputs or outputs but with an
    added memory clobber.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/asm-x86/alternative.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h
index 92e3581bc2..8e78cc91c3 100644
--- a/xen/include/asm-x86/alternative.h
+++ b/xen/include/asm-x86/alternative.h
@@ -114,6 +114,11 @@ extern void alternative_branches(void);
 #define alternative(oldinstr, newinstr, feature)                        \
         asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) : : : "memory")
 
+#define alternative_2(oldinstr, newinstr1, feature1, newinstr2, feature2) \
+	asm volatile (ALTERNATIVE_2(oldinstr, newinstr1, feature1,	\
+				    newinstr2, feature2)		\
+		      : : : "memory")
+
 /*
  * Alternative inline assembly with input.
  *
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 17:01:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 17:01: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 1jtDRu-0001Tw-I0; Wed, 08 Jul 2020 17:01:34 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtDRt-0001Tl-Tf
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:01:33 +0000
X-Inumbo-ID: acde20f6-c13c-11ea-8e54-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id acde20f6-c13c-11ea-8e54-12813bfff9fa;
 Wed, 08 Jul 2020 17:01:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=mG9Meqi8p5iea7tIkn8RhRljjGfAkPWzIuHxq60q/oY=; b=kTC80P55F39vHHetF3bLULHxOE
 cKNgpGyKoEnl2C1z4H4AZyk/RAtIwMepl4mrQOtqT4OEnHZm+7933jdebi+D1/3+3MTovTMlLTYmO
 ic6qLiHxFvOo3QCxaDGyrCOuzReNxiQQ9JUInx/Tja17rwofBflRWkCxbuJphvYz2goo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDRt-0006CJ-0J
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:01:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDRs-00071o-Vp
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:01:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] vtd: optimize CPU cache sync
Message-Id: <E1jtDRs-00071o-Vp@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 17:01:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a64ea16522a73a13a0d66cfa4b66a9d3b95dd9d6
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 14:39:54 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:39:54 2020 +0200

    vtd: optimize CPU cache sync
    
    Some VT-d IOMMUs are non-coherent, which requires a cache write back
    in order for the changes made by the CPU to be visible to the IOMMU.
    This cache write back was unconditionally done using clflush, but there are
    other more efficient instructions to do so, hence implement support
    for them using the alternative framework.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/vtd/extern.h  |  1 -
 xen/drivers/passthrough/vtd/iommu.c   | 38 ++++++++++++++++++++++++++++++++++-
 xen/drivers/passthrough/vtd/x86/vtd.c |  5 -----
 3 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index f15947af1f..f776feefe6 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -68,7 +68,6 @@ int __must_check qinval_device_iotlb_sync(struct vtd_iommu *iommu,
                                           u16 did, u16 size, u64 addr);
 
 unsigned int get_cache_line_size(void);
-void cacheline_flush(char *);
 void flush_all_cache(void);
 
 uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 8a2c105f72..cf651fba34 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -31,6 +31,7 @@
 #include <xen/pci_regs.h>
 #include <xen/keyhandler.h>
 #include <asm/msi.h>
+#include <asm/nops.h>
 #include <asm/irq.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/p2m.h>
@@ -160,7 +161,42 @@ static void sync_cache(const void *addr, unsigned int size)
 
     addr -= (unsigned long)addr & (clflush_size - 1);
     for ( ; addr < end; addr += clflush_size )
-        cacheline_flush((char *)addr);
+/*
+ * The arguments to a macro must not include preprocessor directives. Doing so
+ * results in undefined behavior, so we have to create some defines here in
+ * order to avoid it.
+ */
+#if defined(HAVE_AS_CLWB)
+# define CLWB_ENCODING "clwb %[p]"
+#elif defined(HAVE_AS_XSAVEOPT)
+# define CLWB_ENCODING "data16 xsaveopt %[p]" /* clwb */
+#else
+# define CLWB_ENCODING ".byte 0x66, 0x0f, 0xae, 0x30" /* clwb (%%rax) */
+#endif
+
+#define BASE_INPUT(addr) [p] "m" (*(const char *)(addr))
+#if defined(HAVE_AS_CLWB) || defined(HAVE_AS_XSAVEOPT)
+# define INPUT BASE_INPUT
+#else
+# define INPUT(addr) "a" (addr), BASE_INPUT(addr)
+#endif
+        /*
+         * Note regarding the use of NOP_DS_PREFIX: it's faster to do a clflush
+         * + prefix than a clflush + nop, and hence the prefix is added instead
+         * of letting the alternative framework fill the gap by appending nops.
+         */
+        alternative_io_2(".byte " __stringify(NOP_DS_PREFIX) "; clflush %[p]",
+                         "data16 clflush %[p]", /* clflushopt */
+                         X86_FEATURE_CLFLUSHOPT,
+                         CLWB_ENCODING,
+                         X86_FEATURE_CLWB, /* no outputs */,
+                         INPUT(addr));
+#undef INPUT
+#undef BASE_INPUT
+#undef CLWB_ENCODING
+
+    alternative_2("", "sfence", X86_FEATURE_CLFLUSHOPT,
+                      "sfence", X86_FEATURE_CLWB);
 }
 
 /* Allocate page table, return its machine address */
diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c
index f379afac03..bbe358dc36 100644
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -52,11 +52,6 @@ unsigned int get_cache_line_size(void)
     return ((cpuid_ebx(1) >> 8) & 0xff) * 8;
 }
 
-void cacheline_flush(char * addr)
-{
-    clflush(addr);
-}
-
 void flush_all_cache()
 {
     wbinvd();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 17:01:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 17:01: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 1jtDS4-0001VQ-Ji; Wed, 08 Jul 2020 17:01:44 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtDS3-0001V9-T3
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:01:43 +0000
X-Inumbo-ID: b2e3b9d4-c13c-11ea-8e54-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b2e3b9d4-c13c-11ea-8e54-12813bfff9fa;
 Wed, 08 Jul 2020 17:01:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Zw6tcMHV207rpZ0ddwUOLneSeCXLkXht+HfML8jLtnc=; b=DCjJ4vzyBR7fJCLQQanVItmLgt
 10t7kqmeOPtgrf5UniVC7YvGDqK3/WaBWujq8TIT3iG3/NWkREFcTr7BB9ke+q8DQ8KyFOWq7GwFE
 gRoUS1wSCw3EXhl2iU2lJm6t/lNaTgjZdHiQ9wOYQCEcNliiRxio2jyUe00xtmz7MmlY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDS3-0006CS-3M
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:01:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDS3-00072n-2d
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:01:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/ept: flush cache when modifying PTEs and sharing
 page tables
Message-Id: <E1jtDS3-00072n-2d@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 17:01:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit c23274fd0412381bd75068ebc9f8f8c90a4be748
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 14:40:11 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:40:11 2020 +0200

    x86/ept: flush cache when modifying PTEs and sharing page tables
    
    Modifications made to the page tables by EPT code need to be written
    to memory when the page tables are shared with the IOMMU, as Intel
    IOMMUs can be non-coherent and thus require changes to be written to
    memory in order to be visible to the IOMMU.
    
    In order to achieve this make sure data is written back to memory
    after writing an EPT entry when the recalc bit is not set in
    atomic_write_ept_entry. If such bit is set, the entry will be
    adjusted and atomic_write_ept_entry will be called a second time
    without the recalc bit set. Note that when splitting a super page the
    new tables resulting of the split should also be written back.
    
    Failure to do so can allow devices behind the IOMMU access to the
    stale super page, or cause coherency issues as changes made by the
    processor to the page tables are not visible to the IOMMU.
    
    This allows to remove the VT-d specific iommu_pte_flush helper, since
    the cache write back is now performed by atomic_write_ept_entry, and
    hence iommu_iotlb_flush can be used to flush the IOMMU TLB. The newly
    used method (iommu_iotlb_flush) can result in less flushes, since it
    might sometimes be called rightly with 0 flags, in which case it
    becomes a no-op.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/p2m-ept.c           | 24 ++++++++++++++++++-
 xen/drivers/passthrough/vtd/iommu.c | 47 -------------------------------------
 xen/include/asm-x86/iommu.h         |  4 ----
 3 files changed, 23 insertions(+), 52 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 87a14f6f22..b8154a7ecc 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -58,6 +58,19 @@ static int atomic_write_ept_entry(struct p2m_domain *p2m,
 
     write_atomic(&entryptr->epte, new.epte);
 
+    /*
+     * The recalc field on the EPT is used to signal either that a
+     * recalculation of the EMT field is required (which doesn't effect the
+     * IOMMU), or a type change. Type changes can only be between ram_rw,
+     * logdirty and ioreq_server: changes to/from logdirty won't work well with
+     * an IOMMU anyway, as IOMMU #PFs are not synchronous and will lead to
+     * aborts, and changes to/from ioreq_server are already fully flushed
+     * before returning to guest context (see
+     * XEN_DMOP_map_mem_type_to_ioreq_server).
+     */
+    if ( !new.recalc && iommu_use_hap_pt(p2m->domain) )
+        iommu_sync_cache(entryptr, sizeof(*entryptr));
+
     return 0;
 }
 
@@ -277,6 +290,9 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
             break;
     }
 
+    if ( iommu_use_hap_pt(p2m->domain) )
+        iommu_sync_cache(table, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
     unmap_domain_page(table);
 
     /* Even failed we should install the newly allocated ept page. */
@@ -336,6 +352,9 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
 
+        if ( iommu_use_hap_pt(p2m->domain) )
+            iommu_sync_cache(next, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
         rc = atomic_write_ept_entry(p2m, ept_entry, e, next_level);
         ASSERT(rc == 0);
     }
@@ -824,7 +843,10 @@ out:
          need_modify_vtd_table )
     {
         if ( iommu_use_hap_pt(d) )
-            rc = iommu_pte_flush(d, gfn, &ept_entry->epte, order, vtd_pte_present);
+            rc = iommu_iotlb_flush(d, _dfn(gfn), (1u << order),
+                                   (iommu_flags ? IOMMU_FLUSHF_added : 0) |
+                                   (vtd_pte_present ? IOMMU_FLUSHF_modified
+                                                    : 0));
         else if ( need_iommu_pt_sync(d) )
             rc = iommu_flags ?
                 iommu_legacy_map(d, _dfn(gfn), mfn, order, iommu_flags) :
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index cf651fba34..2a99cd208f 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1887,53 +1887,6 @@ static int intel_iommu_lookup_page(struct domain *d, dfn_t dfn, mfn_t *mfn,
     return 0;
 }
 
-int iommu_pte_flush(struct domain *d, uint64_t dfn, uint64_t *pte,
-                    int order, int present)
-{
-    struct acpi_drhd_unit *drhd;
-    struct vtd_iommu *iommu = NULL;
-    struct domain_iommu *hd = dom_iommu(d);
-    bool_t flush_dev_iotlb;
-    int iommu_domid;
-    int rc = 0;
-
-    iommu_sync_cache(pte, sizeof(struct dma_pte));
-
-    for_each_drhd_unit ( drhd )
-    {
-        iommu = drhd->iommu;
-        if ( !test_bit(iommu->index, &hd->arch.iommu_bitmap) )
-            continue;
-
-        flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
-        iommu_domid= domain_iommu_domid(d, iommu);
-        if ( iommu_domid == -1 )
-            continue;
-
-        rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
-                                   __dfn_to_daddr(dfn),
-                                   order, !present, flush_dev_iotlb);
-        if ( rc > 0 )
-        {
-            iommu_flush_write_buffer(iommu);
-            rc = 0;
-        }
-    }
-
-    if ( unlikely(rc) )
-    {
-        if ( !d->is_shutting_down && printk_ratelimit() )
-            printk(XENLOG_ERR VTDPREFIX
-                   " d%d: IOMMU pages flush failed: %d\n",
-                   d->domain_id, rc);
-
-        if ( !is_hardware_domain(d) )
-            domain_crash(d);
-    }
-
-    return rc;
-}
-
 static int __init vtd_ept_page_compatible(struct vtd_iommu *iommu)
 {
     u64 ept_cap, vtd_cap = iommu->cap;
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 864e025078..6c9d5e5632 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -97,10 +97,6 @@ static inline int iommu_adjust_irq_affinities(void)
            : 0;
 }
 
-/* While VT-d specific, this must get declared in a generic header. */
-int __must_check iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
-                                 int order, int present);
-
 static inline bool iommu_supports_x2apic(void)
 {
     return iommu_init_ops && iommu_init_ops->supports_x2apic
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 08 17:01:54 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Jul 2020 17:01:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jtDSE-0001XL-N2; Wed, 08 Jul 2020 17:01:54 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=ukW+=AT=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtDSD-0001XB-Si
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:01:53 +0000
X-Inumbo-ID: b8eee4a2-c13c-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b8eee4a2-c13c-11ea-8496-bc764e2007e4;
 Wed, 08 Jul 2020 17:01:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=bFWlGMB5pAzdD4GfQKe4L/PCuQ5oRMA7YwQAKlWw8Ls=; b=kdtZYVAXinZOVkvJPOA9pNrZHH
 WQ6v1P4hXXGOGVaNL/x0ucPiBuhOmRvtvXHv8r7tAd8OOmBDme67evrCjxwLi7p/r2d3SI0EK+JXo
 OprmpzT0rKc2gMAW4U5X5W1TpduJsdPF8H7g8fTrECHP/QPKbTPHxhaqTv7jLWodjKvE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDSD-0006Cb-7I
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:01:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtDSD-00073V-5d
 for xen-changelog@lists.xenproject.org; Wed, 08 Jul 2020 17:01:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen: Check the alignment of the offset pased via
 VCPUOP_register_vcpu_info
Message-Id: <E1jtDSD-00073V-5d@xenbits.xenproject.org>
Date: Wed, 08 Jul 2020 17:01:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 3fdc211b01b29f252166937238efe02d15cb5780
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue May 26 18:31:33 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 14:41:00 2020 +0200

    xen: Check the alignment of the offset pased via VCPUOP_register_vcpu_info
    
    Currently a guest is able to register any guest physical address to use
    for the vcpu_info structure as long as the structure can fits in the
    rest of the frame.
    
    This means a guest can provide an address that is not aligned to the
    natural alignment of the structure.
    
    On Arm 32-bit, unaligned access are completely forbidden by the
    hypervisor. This will result to a data abort which is fatal.
    
    On Arm 64-bit, unaligned access are only forbidden when used for atomic
    access. As the structure contains fields (such as evtchn_pending_self)
    that are updated using atomic operations, any unaligned access will be
    fatal as well.
    
    While the misalignment is only fatal on Arm, a generic check is added
    as an x86 guest shouldn't sensibly pass an unaligned address (this
    would result to a split lock).
    
    This is XSA-327.
    
    Reported-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/domain.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 7cc9526139..e9be05f1d0 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1227,10 +1227,20 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
     void *mapping;
     vcpu_info_t *new_info;
     struct page_info *page;
+    unsigned int align;
 
     if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
         return -EINVAL;
 
+#ifdef CONFIG_COMPAT
+    if ( has_32bit_shinfo(d) )
+        align = alignof(new_info->compat);
+    else
+#endif
+        align = alignof(*new_info);
+    if ( offset & (align - 1) )
+        return -EINVAL;
+
     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 Thu Jul 09 01:22:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 01:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jtLGI-0001oS-Sy; Thu, 09 Jul 2020 01:22:06 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtLGH-0001oN-FO
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:22:05 +0000
X-Inumbo-ID: 980b8ad8-c182-11ea-8e92-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 980b8ad8-c182-11ea-8e92-12813bfff9fa;
 Thu, 09 Jul 2020 01:22:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=e/1cDX4vPOz5giCcKiNaoEwiBZlk2FaMSNujg6L2m8w=; b=chy/5vWYlJk4118VH0hv83b+C4
 y1yvF6ib4l87GPVYM7pTDElU20iZPplQ6pyGtyVWXmXWVVi8EGvc9Zhep3hyCHsvy8AUt2tr3267h
 sGDkART/N5Bh+Y+WrmU9QsnCfFaxQ1zaKx12yRSZ9rK0y4BSAn20iLOfzcmixw69ws2M=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLGE-0000jI-Qg
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLGE-0008Vj-Pq
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:22:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] xen/common: event_channel: Don't ignore error in
 get_free_port()
Message-Id: <E1jtLGE-0008Vj-Pq@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 01:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 6261a06d990cc50ea8765356d296a61cc2d4a3e5
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jul 7 15:27:47 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:27:47 2020 +0200

    xen/common: event_channel: Don't ignore error in get_free_port()
    
    Currently, get_free_port() is assuming that the port has been allocated
    when evtchn_allocate_port() is not return -EBUSY.
    
    However, the function may return an error when:
        - We exhausted all the event channels. This can happen if the limit
        configured by the administrator for the guest ('max_event_channels'
        in xl cfg) is higher than the ABI used by the guest. For instance,
        if the guest is using 2L, the limit should not be higher than 4095.
        - We cannot allocate memory (e.g Xen has not more memory).
    
    Users of get_free_port() (such as EVTCHNOP_alloc_unbound) will validly
    assuming the port was valid and will next call evtchn_from_port(). This
    will result to a crash as the memory backing the event channel structure
    is not present.
    
    Fixes: 368ae9a05fe ("xen/pvshim: forward evtchn ops between L0 Xen and L2 DomU")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2e9c2bc292231823a3a021d2e0a9f1956bf00b3c
    master date: 2020-07-07 14:35:36 +0200
---
 xen/common/event_channel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index be834c5c78..07ef45a140 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -202,10 +202,10 @@ static int get_free_port(struct domain *d)
     {
         int rc = evtchn_allocate_port(d, port);
 
-        if ( rc == -EBUSY )
-            continue;
-
-        return port;
+        if ( rc == 0 )
+            return port;
+        else if ( rc != -EBUSY )
+            return rc;
     }
 
     return -ENOSPC;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 01:22:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 01:22:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jtLGQ-0001ov-UP; Thu, 09 Jul 2020 01:22:14 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtLGP-0001oq-U8
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:22:13 +0000
X-Inumbo-ID: 9e1806ae-c182-11ea-8e92-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 9e1806ae-c182-11ea-8e92-12813bfff9fa;
 Thu, 09 Jul 2020 01:22:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Z6YWn2nJueLVWs2pphPIPQkI8egBvtunP6ocJXREHTo=; b=MhiNp5wFQwbr7fT8R1QkE2LCqs
 QkgSujTPTBE5EJraFgJ/fvwJV94sQ/S+cfSx75YCUaP7/+470by7SddfVzDQp16zmvLFuBd4T+SzG
 c3x94dCVgEHy5XzKwjujo4gxvQNoQXF2nchySvr6EIQXlR7yuUT1pmLaBt/JeJbuVjTQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLGO-0000jO-Tx
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLGO-0008WA-T3
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:22:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] x86/shadow: correct an inverted conditional in
 dirty VRAM tracking
Message-Id: <E1jtLGO-0008WA-T3@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 01:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit c1a4914323eecce82a664896845947fa1dd73ce4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:28:25 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:28:25 2020 +0200

    x86/shadow: correct an inverted conditional in dirty VRAM tracking
    
    This originally was "mfn_x(mfn) == INVALID_MFN". Make it like this
    again, taking the opportunity to also drop the unnecessary nearby
    braces.
    
    This is XSA-319.
    
    Fixes: 246a5a3377c2 ("xen: Use a typesafe to define INVALID_MFN")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 23a216f99d40fbfbc2318ade89d8213eea6ba1f8
    master date: 2020-07-07 14:36:24 +0200
---
 xen/arch/x86/mm/shadow/common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 48f03b3beb..8ee61f8784 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3758,10 +3758,8 @@ int shadow_track_dirty_vram(struct domain *d,
             int dirty = 0;
             paddr_t sl1ma = dirty_vram->sl1ma[i];
 
-            if ( !mfn_eq(mfn, INVALID_MFN) )
-            {
+            if ( mfn_eq(mfn, INVALID_MFN) )
                 dirty = 1;
-            }
             else
             {
                 page = mfn_to_page(mfn);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 01:22:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 01: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 1jtLGb-0001qT-Vt; Thu, 09 Jul 2020 01:22:25 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtLGa-0001qE-Fe
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:22:24 +0000
X-Inumbo-ID: a418a5ea-c182-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id a418a5ea-c182-11ea-b7bb-bc764e2007e4;
 Thu, 09 Jul 2020 01:22:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=bvsHD+AceUb8UWp4LOv4M/0JgAogDfCg3/D3ah0+izs=; b=y8je0OM2B/UbeMZ9mTkkEl6Rh9
 zlK0fVl++f84CBa0wKH852JgO0DP0FuUyxt5DOJSaTcq6t7nx+VZx4Apkcv46QiYWkuHFeBHxuQq/
 joCqbT2rG2TfnV9i7MO2XcSFWsmsiqfWNBOxuEtNHAV0pTqst7R6Dj4c3PoXQ4Egynjk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLGZ-0000jd-1S
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:22:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLGY-000051-W1
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:22:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] x86/EPT: ept_set_middle_entry() related adjustments
Message-Id: <E1jtLGY-000051-W1@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 01:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a380168a5672cc3bf3066f630bab3c9355e4e1cf
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:28:53 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:28:53 2020 +0200

    x86/EPT: ept_set_middle_entry() related adjustments
    
    ept_split_super_page() wants to further modify the newly allocated
    table, so have ept_set_middle_entry() return the mapped pointer rather
    than tearing it down and then getting re-established right again.
    
    Similarly ept_next_level() wants to hand back a mapped pointer of
    the next level page, so re-use the one established by
    ept_set_middle_entry() in case that path was taken.
    
    Pull the setting of suppress_ve ahead of insertion into the higher level
    table, and don't have ept_split_super_page() set the field a 2nd time.
    
    This is part of XSA-328.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 1104288186ee73a7f9bfa41cbaa5bb7611521028
    master date: 2020-07-07 14:36:52 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 41 ++++++++++++++++++-----------------------
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index a4c841cc71..e78f220592 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -228,8 +228,9 @@ static void ept_p2m_type_to_flags(struct p2m_domain *p2m, ept_entry_t *entry,
 #define GUEST_TABLE_SUPER_PAGE  2
 #define GUEST_TABLE_POD_PAGE    3
 
-/* Fill in middle levels of ept table */
-static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
+/* Fill in middle level of ept table; return pointer to mapped new table. */
+static ept_entry_t *ept_set_middle_entry(struct p2m_domain *p2m,
+                                         ept_entry_t *ept_entry)
 {
     mfn_t mfn;
     ept_entry_t *table;
@@ -237,7 +238,12 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     mfn = p2m_alloc_ptp(p2m, 0);
     if ( mfn_eq(mfn, INVALID_MFN) )
-        return 0;
+        return NULL;
+
+    table = map_domain_page(mfn);
+
+    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
+        table[i].suppress_ve = 1;
 
     ept_entry->epte = 0;
     ept_entry->mfn = mfn_x(mfn);
@@ -249,14 +255,7 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     ept_entry->suppress_ve = 1;
 
-    table = map_domain_page(mfn);
-
-    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
-        table[i].suppress_ve = 1;
-
-    unmap_domain_page(table);
-
-    return 1;
+    return table;
 }
 
 /* free ept sub tree behind an entry */
@@ -294,10 +293,10 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
 
     ASSERT(is_epte_superpage(ept_entry));
 
-    if ( !ept_set_middle_entry(p2m, &new_ept) )
+    table = ept_set_middle_entry(p2m, &new_ept);
+    if ( !table )
         return 0;
 
-    table = map_domain_page(_mfn(new_ept.mfn));
     trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER);
 
     for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
@@ -308,7 +307,6 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
         epte->sp = (level > 1);
         epte->mfn += i * trunk;
         epte->snp = (iommu_enabled && iommu_snoop);
-        epte->suppress_ve = 1;
 
         ept_p2m_type_to_flags(p2m, epte, epte->sa_p2mt, epte->access);
 
@@ -347,8 +345,7 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
                           ept_entry_t **table, unsigned long *gfn_remainder,
                           int next_level)
 {
-    unsigned long mfn;
-    ept_entry_t *ept_entry, e;
+    ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
     shift = next_level * EPT_TABLE_ORDER;
@@ -373,19 +370,17 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        if ( !ept_set_middle_entry(p2m, ept_entry) )
+        next = ept_set_middle_entry(p2m, ept_entry);
+        if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        else
-            e = atomic_read_ept_entry(ept_entry); /* Refresh */
+        /* e is now stale and hence may not be used anymore below. */
     }
-
     /* The only time sp would be set here is if we had hit a superpage */
-    if ( is_epte_superpage(&e) )
+    else if ( is_epte_superpage(&e) )
         return GUEST_TABLE_SUPER_PAGE;
 
-    mfn = e.mfn;
     unmap_domain_page(*table);
-    *table = map_domain_page(_mfn(mfn));
+    *table = next ?: map_domain_page(_mfn(e.mfn));
     *gfn_remainder &= (1UL << shift) - 1;
     return GUEST_TABLE_NORMAL_PAGE;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 01:22:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 01:22: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 1jtLGl-0001rV-1J; Thu, 09 Jul 2020 01:22:35 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtLGj-0001rN-VQ
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:22:34 +0000
X-Inumbo-ID: aa22b5f2-c182-11ea-8e92-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id aa22b5f2-c182-11ea-8e92-12813bfff9fa;
 Thu, 09 Jul 2020 01:22:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=tcWZ6h/h6FDVwaSUCvxQWAiClrHAzR8FAiPZspT3384=; b=Rth3VkNmtl91euU6xUku1bQ2ql
 V83glXzBWtmNZlMrXb5uZDCqz9RA+2ew/Dy0vc3Nc43X8bBfxky6m4gMDX8rI2GX+hG3v7tus6fkQ
 Rff4OAAlagNsu+GNGS/LModLG6cqErql6khyJ6Iig8hh1h79faxQgGG0qMfvOuoDLHZU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLGj-0000kS-4o
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:22:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLGj-00005X-3c
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:22:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] x86/ept: atomically modify entries in ept_next_level
Message-Id: <E1jtLGj-00005X-3c@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 01:22:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a9bda69c6bf7da2933891f3e18f77f8a18f874bb
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:29:19 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:29:19 2020 +0200

    x86/ept: atomically modify entries in ept_next_level
    
    ept_next_level was passing a live PTE pointer to ept_set_middle_entry,
    which was then modified without taking into account that the PTE could
    be part of a live EPT table. This wasn't a security issue because the
    pages returned by p2m_alloc_ptp are zeroed, so adding such an entry
    before actually initializing it didn't allow a guest to access
    physical memory addresses it wasn't supposed to access.
    
    This is part of XSA-328.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: bc3d9f95d661372b059a5539ae6cb1e79435bb95
    master date: 2020-07-07 14:37:12 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index e78f220592..514f022549 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -348,6 +348,8 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
     ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
+    ASSERT(next_level);
+
     shift = next_level * EPT_TABLE_ORDER;
 
     index = *gfn_remainder >> shift;
@@ -364,16 +366,20 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
 
     if ( !is_epte_present(&e) )
     {
+        int rc;
+
         if ( e.sa_p2mt == p2m_populate_on_demand )
             return GUEST_TABLE_POD_PAGE;
 
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        next = ept_set_middle_entry(p2m, ept_entry);
+        next = ept_set_middle_entry(p2m, &e);
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        /* e is now stale and hence may not be used anymore below. */
+
+        rc = atomic_write_ept_entry(ept_entry, e, next_level);
+        ASSERT(rc == 0);
     }
     /* The only time sp would be set here is if we had hit a superpage */
     else if ( is_epte_superpage(&e) )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 01:22:45 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 01:22: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 1jtLGv-0001sR-33; Thu, 09 Jul 2020 01:22:45 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtLGt-0001sF-QP
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:22:43 +0000
X-Inumbo-ID: b021c4b6-c182-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b021c4b6-c182-11ea-bb8b-bc764e2007e4;
 Thu, 09 Jul 2020 01:22:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=N+2q7NviBHaW/7TJn8M4rKn6DRb75OVFCxSyHjV6TSM=; b=hZlQeLfew2Tchou5VtVbIdm34e
 aL4cVwixGl8xdebuk/sZmCr8ETNJKSQWnLrjRw//zlYWlcupaIshHCuv3UUN0n07S1jxGN43sN0uO
 IOC3+0YMdEVQvoN1WwHG12vGn7vryOsm4goYPqJM9+scXcbb72BCkoL7bs6vsH4JsiPM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLGt-0000ka-7q
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:22:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLGt-000063-70
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:22:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] vtd: improve IOMMU TLB flush
Message-Id: <E1jtLGt-000063-70@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 01:22:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit fd5703813f92451b39fdd8257596de0c45ebb160
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:29:44 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:29:44 2020 +0200

    vtd: improve IOMMU TLB flush
    
    Do not limit PSI flushes to order 0 pages, in order to avoid doing a
    full TLB flush if the passed in page has an order greater than 0 and
    is aligned. Should increase the performance of IOMMU TLB flushes when
    dealing with page orders greater than 0.
    
    This is part of XSA-321.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 5fe515a0fede07543f2a3b049167b1fd8b873caf
    master date: 2020-07-07 14:37:46 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 17cf87ccf1..3e10f24b44 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -612,13 +612,14 @@ static int __must_check iommu_flush_iotlb(struct domain *d,
         if ( iommu_domid == -1 )
             continue;
 
-        if ( page_count != 1 || gfn == gfn_x(INVALID_GFN) )
+        if ( !page_count || (page_count & (page_count - 1)) ||
+             gfn == gfn_x(INVALID_GFN) || !IS_ALIGNED(gfn, page_count) )
             rc = iommu_flush_iotlb_dsi(iommu, iommu_domid,
                                        0, flush_dev_iotlb);
         else
             rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
                                        (paddr_t)gfn << PAGE_SHIFT_4K,
-                                       PAGE_ORDER_4K,
+                                       get_order_from_pages(page_count),
                                        !dma_old_pte_present,
                                        flush_dev_iotlb);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 01:22:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 01:22: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 1jtLH5-0001tk-63; Thu, 09 Jul 2020 01:22:55 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtLH4-0001ta-57
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:22:54 +0000
X-Inumbo-ID: b624a3a6-c182-11ea-8e92-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b624a3a6-c182-11ea-8e92-12813bfff9fa;
 Thu, 09 Jul 2020 01:22:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=yb06K8xD19YCnhAWKdCKD8aug9pFE8IoT5OLswYuOK0=; b=ovOl5Y0S5zug5Zzb59blU2zV3M
 SZXZK8jUgp/GAY1si5dHDEM6kP5SS4KHIxcXdFQ50GUFflQPJMAFyDia0Nf3WGMwKPGhQiVKL0xNR
 vq9pxQa2gSD8yqRGniBcNu3r35cSbPEJvKgiQsPb75zwSTMOX1CxEjjn2Um0rWq8rNxU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLH3-0000ki-B2
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:22:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLH3-00006d-A8
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:22:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] vtd: prune (and rename) cache flush functions
Message-Id: <E1jtLH3-00006d-A8@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 01:22:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 9df4399c7900d82592cc4fe889a96f1b3078a301
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:30:03 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:30:03 2020 +0200

    vtd: prune (and rename) cache flush functions
    
    Rename __iommu_flush_cache to iommu_sync_cache and remove
    iommu_flush_cache_page. Also remove the iommu_flush_cache_entry
    wrapper and just use iommu_sync_cache instead. Note the _entry suffix
    was meaningless as the wrapper was already taking a size parameter in
    bytes. While there also constify the addr parameter.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 62298825b9a44f45761acbd758138b5ba059ebd1
    master date: 2020-07-07 14:38:13 +0200
---
 xen/drivers/passthrough/vtd/extern.h   |  3 +--
 xen/drivers/passthrough/vtd/intremap.c |  6 +++---
 xen/drivers/passthrough/vtd/iommu.c    | 31 +++++++++++--------------------
 3 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index d698b1d50a..87d5ed78a2 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -37,8 +37,7 @@ void disable_qinval(struct iommu *iommu);
 int enable_intremap(struct iommu *iommu, int eim);
 void disable_intremap(struct iommu *iommu);
 
-void iommu_flush_cache_entry(void *addr, unsigned int size);
-void iommu_flush_cache_page(void *addr, unsigned long npages);
+void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index 5f620c3202..eac20ede31 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -231,7 +231,7 @@ static void free_remap_entry(struct iommu *iommu, int index)
                      iremap_entries, iremap_entry);
 
     update_irte(iommu, iremap_entry, &new_ire, false);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -403,7 +403,7 @@ static int ioapic_rte_to_remap_entry(struct iommu *iommu,
     }
 
     update_irte(iommu, iremap_entry, &new_ire, !init);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -694,7 +694,7 @@ static int msi_msg_to_remap_entry(
     update_irte(iommu, iremap_entry, &new_ire, msi_desc->irte_initialized);
     msi_desc->irte_initialized = true;
 
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 3e10f24b44..2fa57190d8 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -158,7 +158,8 @@ static void __init free_intel_iommu(struct intel_iommu *intel)
 }
 
 static int iommus_incoherent;
-static void __iommu_flush_cache(void *addr, unsigned int size)
+
+void iommu_sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -173,16 +174,6 @@ static void __iommu_flush_cache(void *addr, unsigned int size)
         cacheline_flush((char *)addr + i);
 }
 
-void iommu_flush_cache_entry(void *addr, unsigned int size)
-{
-    __iommu_flush_cache(addr, size);
-}
-
-void iommu_flush_cache_page(void *addr, unsigned long npages)
-{
-    __iommu_flush_cache(addr, PAGE_SIZE * npages);
-}
-
 /* Allocate page table, return its machine address */
 u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
 {
@@ -207,7 +198,7 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_flush_cache_page(vaddr, 1);
+        iommu_sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -242,7 +233,7 @@ static u64 bus_to_context_maddr(struct iommu *iommu, u8 bus)
         }
         set_root_value(*root, maddr);
         set_root_present(*root);
-        iommu_flush_cache_entry(root, sizeof(struct root_entry));
+        iommu_sync_cache(root, sizeof(struct root_entry));
     }
     maddr = (u64) get_context_addr(*root);
     unmap_vtd_domain_page(root_entries);
@@ -300,7 +291,7 @@ static u64 addr_to_dma_page_maddr(struct domain *domain, u64 addr, int alloc)
              */
             dma_set_pte_readable(*pte);
             dma_set_pte_writable(*pte);
-            iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+            iommu_sync_cache(pte, sizeof(struct dma_pte));
         }
 
         if ( level == 2 )
@@ -674,7 +665,7 @@ static int __must_check dma_pte_clear_one(struct domain *domain, u64 addr)
 
     dma_clear_pte(*pte);
     spin_unlock(&hd->arch.mapping_lock);
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     if ( !this_cpu(iommu_dont_flush_iotlb) )
         rc = iommu_flush_iotlb_pages(domain, addr >> PAGE_SHIFT_4K, 1);
@@ -716,7 +707,7 @@ static void iommu_free_page_table(struct page_info *pg)
             iommu_free_pagetable(dma_pte_addr(*pte), next_level);
 
         dma_clear_pte(*pte);
-        iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+        iommu_sync_cache(pte, sizeof(struct dma_pte));
     }
 
     unmap_vtd_domain_page(pt_vaddr);
@@ -1447,7 +1438,7 @@ int domain_context_mapping_one(
     context_set_address_width(*context, agaw);
     context_set_fault_enable(*context);
     context_set_present(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
     spin_unlock(&iommu->lock);
 
     /* Context entry was previously non-present (with domid 0). */
@@ -1594,7 +1585,7 @@ int domain_context_unmap_one(
 
     context_clear_present(*context);
     context_clear_entry(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
 
     iommu_domid= domain_iommu_domid(domain, iommu);
     if ( iommu_domid == -1 )
@@ -1824,7 +1815,7 @@ static int __must_check intel_iommu_map_page(struct domain *d,
 
     *pte = new;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
     spin_unlock(&hd->arch.mapping_lock);
     unmap_vtd_domain_page(page);
 
@@ -1858,7 +1849,7 @@ int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
     int iommu_domid;
     int rc = 0;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     for_each_drhd_unit ( drhd )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 01:23:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 01:23: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 1jtLHJ-0001wa-HH; Thu, 09 Jul 2020 01:23:09 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtLHJ-0001ul-4J
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:23:09 +0000
X-Inumbo-ID: bc28db8c-c182-11ea-8e92-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id bc28db8c-c182-11ea-8e92-12813bfff9fa;
 Thu, 09 Jul 2020 01:23:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=XvXa9NP1vzv4B/QWH8bSDzpOKzcDAzs2RT0Gql+8tAU=; b=lycLbrnbd80DzNaKDA5DXNWJpv
 yEFWNWEzugY/Ukg/zny7/HiOAHNYZMYMHFwrsFOw9SRpVf3h0U0q9F48Ad2Esn6HCvg65pfAS8u9B
 YpXgEa6qGB/GfTvFtUWpb1Pr57EGSxkAMj2Wa7xn5u0WE15+218uHvCwiGTUv65CDCMI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLHD-0000lA-E1
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:23:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLHD-00007S-DJ
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:23:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] x86/iommu: introduce a cache sync hook
Message-Id: <E1jtLHD-00007S-DJ@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 01:23:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 0b0a15580757e8103746941e4a558a745fc553f1
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:30:23 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:30:23 2020 +0200

    x86/iommu: introduce a cache sync hook
    
    The hook is only implemented for VT-d and it uses the already existing
    iommu_sync_cache function present in VT-d code. The new hook is
    added so that the cache can be flushed by code outside of VT-d when
    using shared page tables.
    
    Note that alloc_pgtable_maddr must use the now locally defined
    sync_cache function, because IOMMU ops are not yet setup the first
    time the function gets called during IOMMU initialization.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 91526b460e5009fc56edbd6809e66c327281faba
    master date: 2020-07-07 14:38:34 +0200
---
 xen/drivers/passthrough/vtd/extern.h | 1 -
 xen/drivers/passthrough/vtd/iommu.c  | 5 +++--
 xen/include/asm-x86/iommu.h          | 7 +++++++
 xen/include/xen/iommu.h              | 1 +
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 87d5ed78a2..00a73d63ea 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -37,7 +37,6 @@ void disable_qinval(struct iommu *iommu);
 int enable_intremap(struct iommu *iommu, int eim);
 void disable_intremap(struct iommu *iommu);
 
-void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 2fa57190d8..6ab48260df 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -159,7 +159,7 @@ static void __init free_intel_iommu(struct intel_iommu *intel)
 
 static int iommus_incoherent;
 
-void iommu_sync_cache(const void *addr, unsigned int size)
+static void sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -198,7 +198,7 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_sync_cache(vaddr, PAGE_SIZE);
+        sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -2696,6 +2696,7 @@ const struct iommu_ops intel_iommu_ops = {
     .iotlb_flush_all = iommu_flush_iotlb_all,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_p2m_table = vtd_dump_p2m_table,
+    .sync_cache = sync_cache,
 };
 
 /*
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index dcf2e21402..16ff2e94c2 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -98,6 +98,13 @@ extern bool untrusted_msi;
 int pi_update_irte(const struct pi_desc *pi_desc, const struct pirq *pirq,
                    const uint8_t gvec);
 
+#define iommu_sync_cache(addr, size) ({                 \
+    const struct iommu_ops *ops = iommu_get_ops();      \
+                                                        \
+    if ( ops->sync_cache )                              \
+        ops->sync_cache(addr, size);                    \
+})
+
 #endif /* !__ARCH_X86_IOMMU_H__ */
 /*
  * Local variables:
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 235d2a620b..64e32f539a 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -160,6 +160,7 @@ struct iommu_ops {
     void (*update_ire_from_apic)(unsigned int apic, unsigned int reg, unsigned int value);
     unsigned int (*read_apic_from_ire)(unsigned int apic, unsigned int reg);
     int (*setup_hpet_msi)(struct msi_desc *);
+    void (*sync_cache)(const void *addr, unsigned int size);
 #endif /* CONFIG_X86 */
     int __must_check (*suspend)(void);
     void (*resume)(void);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 01:23:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 01:23:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jtLHO-0001yE-Iv; Thu, 09 Jul 2020 01:23:14 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtLHO-0001y4-3D
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:23:14 +0000
X-Inumbo-ID: c22c5108-c182-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c22c5108-c182-11ea-bb8b-bc764e2007e4;
 Thu, 09 Jul 2020 01:23:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=4Dvckj9bMj0a2BiG4CuI36RSftFMNo5vbuliN+AlWgQ=; b=V5tAFD5XSKkNzvJJp3p5azC8sb
 awyvtfxfhzR1N1Ck0ymtJugYIiaD8wW/6khax/5kkamUbANXVX+bTCJAcewnwkwWHqq+82YMfiRj3
 2N8ndehDzpyAYkOntxPNXPYU8ZLJcKotbjmr0eY6wvNk3ApnUdg2CI/BrQLBmIJD0c6c=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLHN-0000lL-H4
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:23:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLHN-00008L-GH
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:23:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] vtd: don't assume addresses are aligned in
 sync_cache
Message-Id: <E1jtLHN-00008L-GH@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 01:23:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 388e303baaa695f8167d040e33d9b8daa63a08dd
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:30:56 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:30:56 2020 +0200

    vtd: don't assume addresses are aligned in sync_cache
    
    Current code in sync_cache assume that the address passed in is
    aligned to a cache line size. Fix the code to support passing in
    arbitrary addresses not necessarily aligned to a cache line size.
    
    This is part of XSA-321.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b6d9398144f21718d25daaf8d72669a75592abc5
    master date: 2020-07-07 14:39:05 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 6ab48260df..5163933e04 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -161,8 +161,8 @@ static int iommus_incoherent;
 
 static void sync_cache(const void *addr, unsigned int size)
 {
-    int i;
-    static unsigned int clflush_size = 0;
+    static unsigned long clflush_size = 0;
+    const void *end = addr + size;
 
     if ( !iommus_incoherent )
         return;
@@ -170,8 +170,9 @@ static void sync_cache(const void *addr, unsigned int size)
     if ( clflush_size == 0 )
         clflush_size = get_cache_line_size();
 
-    for ( i = 0; i < size; i += clflush_size )
-        cacheline_flush((char *)addr + i);
+    addr -= (unsigned long)addr & (clflush_size - 1);
+    for ( ; addr < end; addr += clflush_size )
+        cacheline_flush((char *)addr);
 }
 
 /* Allocate page table, return its machine address */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 01:23:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 01:23: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 1jtLHZ-00020r-KU; Thu, 09 Jul 2020 01:23:25 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtLHY-00020g-KX
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:23:24 +0000
X-Inumbo-ID: c833a59c-c182-11ea-8e92-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c833a59c-c182-11ea-8e92-12813bfff9fa;
 Thu, 09 Jul 2020 01:23:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=txtD95z4U0iEMUYzGHN0lAvOm4S2ZyFBhhjXP71vflo=; b=r7ojbRuY0v/xmRnEUZ0SBH9tkS
 WjfCP1A9NMOnE4PoeAqzNwcGbQUK4nbC6Y+4hCBfvv2k0q890/jv5j2MHfc7qnWm/wmCpiUo3weFK
 qcXRrwE5JEQa1HIf7xn4j0QGzTY7KGEMcfN0bbnfzZ+MshlflmCjU25A3MVw0sr3ol0E=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLHX-0000lX-K0
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:23:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLHX-00008r-J7
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:23:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] x86/alternative: introduce alternative_2
Message-Id: <E1jtLHX-00008r-J7@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 01:23:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 8976bab464775e2713ec8b6c910986d13891df3a
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:31:20 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:31:20 2020 +0200

    x86/alternative: introduce alternative_2
    
    It's based on alternative_io_2 without inputs or outputs but with an
    added memory clobber.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 23570bce00ee6ba2139ece978ab6f03ff166e21d
    master date: 2020-07-07 14:39:25 +0200
---
 xen/include/asm-x86/alternative.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h
index ba537d6b7e..7c34504f89 100644
--- a/xen/include/asm-x86/alternative.h
+++ b/xen/include/asm-x86/alternative.h
@@ -85,6 +85,11 @@ extern void alternative_instructions(void);
 #define alternative(oldinstr, newinstr, feature)                        \
         asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) : : : "memory")
 
+#define alternative_2(oldinstr, newinstr1, feature1, newinstr2, feature2) \
+	asm volatile (ALTERNATIVE_2(oldinstr, newinstr1, feature1,	\
+				    newinstr2, feature2)		\
+		      : : : "memory")
+
 /*
  * Alternative inline assembly with input.
  *
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 01:23:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 01:23: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 1jtLHj-00022D-M7; Thu, 09 Jul 2020 01:23:35 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtLHi-00021w-Gf
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:23:34 +0000
X-Inumbo-ID: ce354a72-c182-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ce354a72-c182-11ea-b7bb-bc764e2007e4;
 Thu, 09 Jul 2020 01:23:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=t+MDtBewgjli5UcVHIKoaES4ykA7BADLaDHahKnfp3Q=; b=yzQwA8djz1gvUt7OztUPgwT8yY
 VMZKvFKGedZFUKublpR47+0oMfy1xZ0V4Ov6F5U/yUivmETYrudYqZkfTLlS/j1r8UZzeMl7f66W9
 x9eDUy0ra8s9wSdsptski6nzYq446JZuL6olJPCo7S4O8am060HhaBGK2rvtFpoDCjng=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLHh-0000m6-N5
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:23:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLHh-00009W-MF
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:23:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] vtd: optimize CPU cache sync
Message-Id: <E1jtLHh-00009W-MF@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 01:23:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit d9c67d382a60eaad717e06746f5bcce7d16e2e83
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:31:54 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:31:54 2020 +0200

    vtd: optimize CPU cache sync
    
    Some VT-d IOMMUs are non-coherent, which requires a cache write back
    in order for the changes made by the CPU to be visible to the IOMMU.
    This cache write back was unconditionally done using clflush, but there are
    other more efficient instructions to do so, hence implement support
    for them using the alternative framework.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a64ea16522a73a13a0d66cfa4b66a9d3b95dd9d6
    master date: 2020-07-07 14:39:54 +0200
---
 xen/drivers/passthrough/vtd/extern.h  |  1 -
 xen/drivers/passthrough/vtd/iommu.c   | 38 ++++++++++++++++++++++++++++++++++-
 xen/drivers/passthrough/vtd/x86/vtd.c |  5 -----
 3 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 00a73d63ea..065d768b52 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -63,7 +63,6 @@ int __must_check qinval_device_iotlb_sync(struct iommu *iommu,
                                           u16 did, u16 size, u64 addr);
 
 unsigned int get_cache_line_size(void);
-void cacheline_flush(char *);
 void flush_all_cache(void);
 
 u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 5163933e04..166c52862f 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -31,6 +31,7 @@
 #include <xen/pci_regs.h>
 #include <xen/keyhandler.h>
 #include <asm/msi.h>
+#include <asm/nops.h>
 #include <asm/irq.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/p2m.h>
@@ -172,7 +173,42 @@ static void sync_cache(const void *addr, unsigned int size)
 
     addr -= (unsigned long)addr & (clflush_size - 1);
     for ( ; addr < end; addr += clflush_size )
-        cacheline_flush((char *)addr);
+/*
+ * The arguments to a macro must not include preprocessor directives. Doing so
+ * results in undefined behavior, so we have to create some defines here in
+ * order to avoid it.
+ */
+#if defined(HAVE_AS_CLWB)
+# define CLWB_ENCODING "clwb %[p]"
+#elif defined(HAVE_AS_XSAVEOPT)
+# define CLWB_ENCODING "data16 xsaveopt %[p]" /* clwb */
+#else
+# define CLWB_ENCODING ".byte 0x66, 0x0f, 0xae, 0x30" /* clwb (%%rax) */
+#endif
+
+#define BASE_INPUT(addr) [p] "m" (*(const char *)(addr))
+#if defined(HAVE_AS_CLWB) || defined(HAVE_AS_XSAVEOPT)
+# define INPUT BASE_INPUT
+#else
+# define INPUT(addr) "a" (addr), BASE_INPUT(addr)
+#endif
+        /*
+         * Note regarding the use of NOP_DS_PREFIX: it's faster to do a clflush
+         * + prefix than a clflush + nop, and hence the prefix is added instead
+         * of letting the alternative framework fill the gap by appending nops.
+         */
+        alternative_io_2(".byte " __stringify(NOP_DS_PREFIX) "; clflush %[p]",
+                         "data16 clflush %[p]", /* clflushopt */
+                         X86_FEATURE_CLFLUSHOPT,
+                         CLWB_ENCODING,
+                         X86_FEATURE_CLWB, /* no outputs */,
+                         INPUT(addr));
+#undef INPUT
+#undef BASE_INPUT
+#undef CLWB_ENCODING
+
+    alternative_2(ASM_NOP3, "sfence", X86_FEATURE_CLFLUSHOPT,
+                            "sfence", X86_FEATURE_CLWB);
 }
 
 /* Allocate page table, return its machine address */
diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c
index 88a60b3307..7f96b91dd4 100644
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -53,11 +53,6 @@ unsigned int get_cache_line_size(void)
     return ((cpuid_ebx(1) >> 8) & 0xff) * 8;
 }
 
-void cacheline_flush(char * addr)
-{
-    clflush(addr);
-}
-
 void flush_all_cache()
 {
     wbinvd();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 01:23:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 01:23: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 1jtLHu-000243-PF; Thu, 09 Jul 2020 01:23:46 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtLHt-00023p-Iw
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:23:45 +0000
X-Inumbo-ID: d43d4fdc-c182-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d43d4fdc-c182-11ea-bb8b-bc764e2007e4;
 Thu, 09 Jul 2020 01:23:44 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Ge2VjQZcVEnaSHdAViIVj9UXWjNtWLc88zuW+1yWDdM=; b=d4fwG3vDOKff5zb6PNQa9mCqQS
 U2a9HCAl4vlPSCOI2v4CVhBIswIdf8uUUTMQ74lbe239ZqZAaVXbF752HxhB9p03UBgIqvnNE2waX
 //ZVGyDpE89GBS/ZX9xR+vKNTwBiJo3nDBXBR4nyp4wb0PHqi9JQekLpWfXnNU/j9cFg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLHr-0000mE-R2
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:23:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLHr-0000AB-PK
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:23:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] x86/ept: flush cache when modifying PTEs and
 sharing page tables
Message-Id: <E1jtLHr-0000AB-PK@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 01:23:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 4418841aa620071a86a70f1ad5ad6e1f8c3c2636
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:32:21 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:32:21 2020 +0200

    x86/ept: flush cache when modifying PTEs and sharing page tables
    
    Modifications made to the page tables by EPT code need to be written
    to memory when the page tables are shared with the IOMMU, as Intel
    IOMMUs can be non-coherent and thus require changes to be written to
    memory in order to be visible to the IOMMU.
    
    In order to achieve this make sure data is written back to memory
    after writing an EPT entry when the recalc bit is not set in
    atomic_write_ept_entry. If such bit is set, the entry will be
    adjusted and atomic_write_ept_entry will be called a second time
    without the recalc bit set. Note that when splitting a super page the
    new tables resulting of the split should also be written back.
    
    Failure to do so can allow devices behind the IOMMU access to the
    stale super page, or cause coherency issues as changes made by the
    processor to the page tables are not visible to the IOMMU.
    
    This allows to remove the VT-d specific iommu_pte_flush helper, since
    the cache write back is now performed by atomic_write_ept_entry, and
    hence iommu_iotlb_flush can be used to flush the IOMMU TLB. The newly
    used method (iommu_iotlb_flush) can result in less flushes, since it
    might sometimes be called rightly with 0 flags, in which case it
    becomes a no-op.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c23274fd0412381bd75068ebc9f8f8c90a4be748
    master date: 2020-07-07 14:40:11 +0200
---
 xen/arch/x86/mm/p2m-ept.c           | 21 ++++++++++++++-
 xen/drivers/passthrough/vtd/iommu.c | 53 ++-----------------------------------
 xen/include/asm-x86/iommu.h         |  5 ++--
 3 files changed, 25 insertions(+), 54 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 514f022549..cfbf7174fd 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -90,6 +90,19 @@ static int atomic_write_ept_entry(ept_entry_t *entryptr, ept_entry_t new,
 
     write_atomic(&entryptr->epte, new.epte);
 
+    /*
+     * The recalc field on the EPT is used to signal either that a
+     * recalculation of the EMT field is required (which doesn't effect the
+     * IOMMU), or a type change. Type changes can only be between ram_rw,
+     * logdirty and ioreq_server: changes to/from logdirty won't work well with
+     * an IOMMU anyway, as IOMMU #PFs are not synchronous and will lead to
+     * aborts, and changes to/from ioreq_server are already fully flushed
+     * before returning to guest context (see
+     * XEN_DMOP_map_mem_type_to_ioreq_server).
+     */
+    if ( !new.recalc && iommu_hap_pt_share )
+        iommu_sync_cache(entryptr, sizeof(*entryptr));
+
     if ( unlikely(oldmfn != mfn_x(INVALID_MFN)) )
         put_page(mfn_to_page(oldmfn));
 
@@ -319,6 +332,9 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
             break;
     }
 
+    if ( iommu_hap_pt_share )
+        iommu_sync_cache(table, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
     unmap_domain_page(table);
 
     /* Even failed we should install the newly allocated ept page. */
@@ -378,6 +394,9 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
 
+        if ( iommu_hap_pt_share )
+            iommu_sync_cache(next, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
         rc = atomic_write_ept_entry(ept_entry, e, next_level);
         ASSERT(rc == 0);
     }
@@ -874,7 +893,7 @@ out:
          need_modify_vtd_table )
     {
         if ( iommu_hap_pt_share )
-            rc = iommu_pte_flush(d, gfn, &ept_entry->epte, order, vtd_pte_present);
+            rc = iommu_flush_iotlb(d, gfn, vtd_pte_present, 1u << order);
         else
         {
             if ( iommu_flags )
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 166c52862f..2df927fe0f 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -612,10 +612,8 @@ static int __must_check iommu_flush_all(void)
     return rc;
 }
 
-static int __must_check iommu_flush_iotlb(struct domain *d,
-                                          unsigned long gfn,
-                                          bool_t dma_old_pte_present,
-                                          unsigned int page_count)
+int iommu_flush_iotlb(struct domain *d, unsigned long gfn,
+                      bool dma_old_pte_present, unsigned int page_count)
 {
     struct domain_iommu *hd = dom_iommu(d);
     struct acpi_drhd_unit *drhd;
@@ -1876,53 +1874,6 @@ static int __must_check intel_iommu_unmap_page(struct domain *d,
     return dma_pte_clear_one(d, (paddr_t)gfn << PAGE_SHIFT_4K);
 }
 
-int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
-                    int order, int present)
-{
-    struct acpi_drhd_unit *drhd;
-    struct iommu *iommu = NULL;
-    struct domain_iommu *hd = dom_iommu(d);
-    bool_t flush_dev_iotlb;
-    int iommu_domid;
-    int rc = 0;
-
-    iommu_sync_cache(pte, sizeof(struct dma_pte));
-
-    for_each_drhd_unit ( drhd )
-    {
-        iommu = drhd->iommu;
-        if ( !test_bit(iommu->index, &hd->arch.iommu_bitmap) )
-            continue;
-
-        flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
-        iommu_domid= domain_iommu_domid(d, iommu);
-        if ( iommu_domid == -1 )
-            continue;
-
-        rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
-                                   (paddr_t)gfn << PAGE_SHIFT_4K,
-                                   order, !present, flush_dev_iotlb);
-        if ( rc > 0 )
-        {
-            iommu_flush_write_buffer(iommu);
-            rc = 0;
-        }
-    }
-
-    if ( unlikely(rc) )
-    {
-        if ( !d->is_shutting_down && printk_ratelimit() )
-            printk(XENLOG_ERR VTDPREFIX
-                   " d%d: IOMMU pages flush failed: %d\n",
-                   d->domain_id, rc);
-
-        if ( !is_hardware_domain(d) )
-            domain_crash(d);
-    }
-
-    return rc;
-}
-
 static int __init vtd_ept_page_compatible(struct iommu *iommu)
 {
     u64 ept_cap, vtd_cap = iommu->cap;
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 16ff2e94c2..dfc9b77594 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -87,8 +87,9 @@ int iommu_setup_hpet_msi(struct msi_desc *);
 
 /* While VT-d specific, this must get declared in a generic header. */
 int adjust_vtd_irq_affinities(void);
-int __must_check iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
-                                 int order, int present);
+int __must_check iommu_flush_iotlb(struct domain *d, unsigned long gfn,
+                                   bool dma_old_pte_present,
+                                   unsigned int page_count);
 bool_t iommu_supports_eim(void);
 int iommu_enable_x2apic_IR(void);
 void iommu_disable_x2apic_IR(void);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 01:23:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 01:23: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 1jtLI3-00025E-Qs; Thu, 09 Jul 2020 01:23:55 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtLI2-000254-K9
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:23:54 +0000
X-Inumbo-ID: da448206-c182-11ea-8e92-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id da448206-c182-11ea-8e92-12813bfff9fa;
 Thu, 09 Jul 2020 01:23:54 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=SJA/1WkxxCMUsG/iq5LYPr6xpl2Yinso/+eJENaB6Ag=; b=RmoWEou/rDirC2VDuuqVpdc/65
 z/bXL6rl5mgpuxBhbZHXHQ62m4C8yn+MUuhwCTym87Ysg8KYnt4xtAdTlYEaCGwF5W4JgGxkslkUD
 //tm8ybkYLWVE2urbYMgezvQdHI1MUFALPCRr9hEBKpZJuxliCpfHvtGOAUWI6aZurNk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLI1-0000mN-Ui
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:23:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtLI1-0000Aj-TC
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 01:23:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.10] xen: Check the alignment of the offset pased via
 VCPUOP_register_vcpu_info
Message-Id: <E1jtLI1-0000Aj-TC@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 01:23:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 93be943e7d759015bd5db41a48f6dce58e580d5a
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jul 7 15:32:54 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:32:54 2020 +0200

    xen: Check the alignment of the offset pased via VCPUOP_register_vcpu_info
    
    Currently a guest is able to register any guest physical address to use
    for the vcpu_info structure as long as the structure can fits in the
    rest of the frame.
    
    This means a guest can provide an address that is not aligned to the
    natural alignment of the structure.
    
    On Arm 32-bit, unaligned access are completely forbidden by the
    hypervisor. This will result to a data abort which is fatal.
    
    On Arm 64-bit, unaligned access are only forbidden when used for atomic
    access. As the structure contains fields (such as evtchn_pending_self)
    that are updated using atomic operations, any unaligned access will be
    fatal as well.
    
    While the misalignment is only fatal on Arm, a generic check is added
    as an x86 guest shouldn't sensibly pass an unaligned address (this
    would result to a split lock).
    
    This is XSA-327.
    
    Reported-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    master commit: 3fdc211b01b29f252166937238efe02d15cb5780
    master date: 2020-07-07 14:41:00 +0200
---
 xen/common/domain.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 4efe4bf46a..15529d768b 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1167,10 +1167,20 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
     void *mapping;
     vcpu_info_t *new_info;
     struct page_info *page;
+    unsigned int align;
 
     if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
         return -EINVAL;
 
+#ifdef CONFIG_COMPAT
+    if ( has_32bit_shinfo(d) )
+        align = alignof(new_info->compat);
+    else
+#endif
+        align = alignof(*new_info);
+    if ( offset & (align - 1) )
+        return -EINVAL;
+
     if ( !mfn_eq(v->vcpu_info_mfn, INVALID_MFN) )
         return -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 05:00:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 05:00:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jtOfF-0003fb-0j; Thu, 09 Jul 2020 05:00:05 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtOfD-0003RR-C4
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:00:03 +0000
X-Inumbo-ID: 0c11af3e-c1a1-11ea-8ea0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 0c11af3e-c1a1-11ea-8ea0-12813bfff9fa;
 Thu, 09 Jul 2020 05:00:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=oRrLCPq58pYh+32kOvX0jM0AW7EnOSnGsgcPvnzt1EE=; b=oiHDX8T68wu9ddSnfXGSL2Lv8+
 mD7mlVmfUYQlGzhgQxefJsM+EwWAIc5TwsEwvAe3eV56+wlwPs0MNFLfhxfvsxf1ZDeQL5Kr/MN4c
 IHrbvQ2kfXDbASCi6jZFTQIQPUdDjKHzp1QoCz3BxxX/boC8D8SL8fpoaHMMV+/m0w58=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOfC-0005Za-Bc
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOfC-0001nO-8w
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:00:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] x86/shadow: correct an inverted conditional in dirty
 VRAM tracking
Message-Id: <E1jtOfC-0001nO-8w@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 05:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 715453066082072b38eaa754840c558e7a9edf88
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:39:47 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:39:47 2020 +0200

    x86/shadow: correct an inverted conditional in dirty VRAM tracking
    
    This originally was "mfn_x(mfn) == INVALID_MFN". Make it like this
    again, taking the opportunity to also drop the unnecessary nearby
    braces.
    
    This is XSA-319.
    
    Fixes: 246a5a3377c2 ("xen: Use a typesafe to define INVALID_MFN")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 23a216f99d40fbfbc2318ade89d8213eea6ba1f8
    master date: 2020-07-07 14:36:24 +0200
---
 xen/arch/x86/mm/shadow/common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index abaa97e8b0..be4f2ee01f 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3758,10 +3758,8 @@ int shadow_track_dirty_vram(struct domain *d,
             int dirty = 0;
             paddr_t sl1ma = dirty_vram->sl1ma[i];
 
-            if ( !mfn_eq(mfn, INVALID_MFN) )
-            {
+            if ( mfn_eq(mfn, INVALID_MFN) )
                 dirty = 1;
-            }
             else
             {
                 page = mfn_to_page(mfn);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 05:00:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 05:00:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jtOfP-0003t7-2S; Thu, 09 Jul 2020 05:00:15 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtOfN-0003sy-Ky
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:00:13 +0000
X-Inumbo-ID: 121621bc-c1a1-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 121621bc-c1a1-11ea-bb8b-bc764e2007e4;
 Thu, 09 Jul 2020 05:00:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=q4boP51z4OPN68wVOaGOOleUbMdRDDkVov00LsXDK8E=; b=GOWO2U1vgv6Z7jbUoCwkXUkqFp
 tWHAFohsAQnD5iKtNz/cwHuGt+cPJhJvRSlNQNOtgD8A2sUemlssm4+l6Q4Q0XSltc1m63MYPHv0R
 8Ne4P58L6471OeAO0dR6U3M/GlTnfsHwy0OB1q5gBkVw8UzyjBygydEwCIf31OPsTin0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOfM-0005cw-FT
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOfM-0001oo-Dr
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:00:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] x86/EPT: ept_set_middle_entry() related adjustments
Message-Id: <E1jtOfM-0001oo-Dr@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 05:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 098d95995564f38f5415dd7b30096785db9e2337
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:40:11 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:40:11 2020 +0200

    x86/EPT: ept_set_middle_entry() related adjustments
    
    ept_split_super_page() wants to further modify the newly allocated
    table, so have ept_set_middle_entry() return the mapped pointer rather
    than tearing it down and then getting re-established right again.
    
    Similarly ept_next_level() wants to hand back a mapped pointer of
    the next level page, so re-use the one established by
    ept_set_middle_entry() in case that path was taken.
    
    Pull the setting of suppress_ve ahead of insertion into the higher level
    table, and don't have ept_split_super_page() set the field a 2nd time.
    
    This is part of XSA-328.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 1104288186ee73a7f9bfa41cbaa5bb7611521028
    master date: 2020-07-07 14:36:52 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 41 ++++++++++++++++++-----------------------
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 46f044b011..1126a58b83 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -228,8 +228,9 @@ static void ept_p2m_type_to_flags(struct p2m_domain *p2m, ept_entry_t *entry,
 #define GUEST_TABLE_SUPER_PAGE  2
 #define GUEST_TABLE_POD_PAGE    3
 
-/* Fill in middle levels of ept table */
-static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
+/* Fill in middle level of ept table; return pointer to mapped new table. */
+static ept_entry_t *ept_set_middle_entry(struct p2m_domain *p2m,
+                                         ept_entry_t *ept_entry)
 {
     struct page_info *pg;
     ept_entry_t *table;
@@ -237,7 +238,12 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     pg = p2m_alloc_ptp(p2m, 0);
     if ( pg == NULL )
-        return 0;
+        return NULL;
+
+    table = __map_domain_page(pg);
+
+    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
+        table[i].suppress_ve = 1;
 
     ept_entry->epte = 0;
     ept_entry->mfn = page_to_mfn(pg);
@@ -249,14 +255,7 @@ static int ept_set_middle_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry)
 
     ept_entry->suppress_ve = 1;
 
-    table = __map_domain_page(pg);
-
-    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
-        table[i].suppress_ve = 1;
-
-    unmap_domain_page(table);
-
-    return 1;
+    return table;
 }
 
 /* free ept sub tree behind an entry */
@@ -294,10 +293,10 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
 
     ASSERT(is_epte_superpage(ept_entry));
 
-    if ( !ept_set_middle_entry(p2m, &new_ept) )
+    table = ept_set_middle_entry(p2m, &new_ept);
+    if ( !table )
         return 0;
 
-    table = map_domain_page(_mfn(new_ept.mfn));
     trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER);
 
     for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
@@ -308,7 +307,6 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
         epte->sp = (level > 1);
         epte->mfn += i * trunk;
         epte->snp = (iommu_enabled && iommu_snoop);
-        epte->suppress_ve = 1;
 
         ept_p2m_type_to_flags(p2m, epte, epte->sa_p2mt, epte->access);
 
@@ -347,8 +345,7 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
                           ept_entry_t **table, unsigned long *gfn_remainder,
                           int next_level)
 {
-    unsigned long mfn;
-    ept_entry_t *ept_entry, e;
+    ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
     shift = next_level * EPT_TABLE_ORDER;
@@ -373,19 +370,17 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        if ( !ept_set_middle_entry(p2m, ept_entry) )
+        next = ept_set_middle_entry(p2m, ept_entry);
+        if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        else
-            e = atomic_read_ept_entry(ept_entry); /* Refresh */
+        /* e is now stale and hence may not be used anymore below. */
     }
-
     /* The only time sp would be set here is if we had hit a superpage */
-    if ( is_epte_superpage(&e) )
+    else if ( is_epte_superpage(&e) )
         return GUEST_TABLE_SUPER_PAGE;
 
-    mfn = e.mfn;
     unmap_domain_page(*table);
-    *table = map_domain_page(_mfn(mfn));
+    *table = next ?: map_domain_page(_mfn(e.mfn));
     *gfn_remainder &= (1UL << shift) - 1;
     return GUEST_TABLE_NORMAL_PAGE;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 05:00:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 05:00:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jtOfY-0003ud-4K; Thu, 09 Jul 2020 05:00:24 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtOfX-0003uT-7m
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:00:23 +0000
X-Inumbo-ID: 181ce1c2-c1a1-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 181ce1c2-c1a1-11ea-b7bb-bc764e2007e4;
 Thu, 09 Jul 2020 05:00:22 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=oT+cP+N8CO/Li9aA6Ye3SeWl3p9No/BYRBJwUAmoF2w=; b=eYPQKygQspWsDmOuKrw9R/yVOe
 2pi7o5xdD2Q0clsoRfWIxJ6Dwd48nMPrVavbUKWKXA09XXnOCLuGSTPR8eeQ4YvC5YYD3Dm5tlkdb
 tW6wn/XP1wo8Pq4A62jv7bZhmNN2xy3J5/1atyGo3o5Zdd/yhFPqSXBFVcR1ZpNV86HY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOfW-0005dC-Iq
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOfW-0001pQ-Hd
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:00:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] x86/ept: atomically modify entries in ept_next_level
Message-Id: <E1jtOfW-0001pQ-Hd@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 05:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 6ee71c98e35054045d47e65cb10587b0f60cae52
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:40:33 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:40:33 2020 +0200

    x86/ept: atomically modify entries in ept_next_level
    
    ept_next_level was passing a live PTE pointer to ept_set_middle_entry,
    which was then modified without taking into account that the PTE could
    be part of a live EPT table. This wasn't a security issue because the
    pages returned by p2m_alloc_ptp are zeroed, so adding such an entry
    before actually initializing it didn't allow a guest to access
    physical memory addresses it wasn't supposed to access.
    
    This is part of XSA-328.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: bc3d9f95d661372b059a5539ae6cb1e79435bb95
    master date: 2020-07-07 14:37:12 +0200
---
 xen/arch/x86/mm/p2m-ept.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 1126a58b83..6bd0cd4ff7 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -348,6 +348,8 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
     ept_entry_t *ept_entry, *next = NULL, e;
     u32 shift, index;
 
+    ASSERT(next_level);
+
     shift = next_level * EPT_TABLE_ORDER;
 
     index = *gfn_remainder >> shift;
@@ -364,16 +366,20 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
 
     if ( !is_epte_present(&e) )
     {
+        int rc;
+
         if ( e.sa_p2mt == p2m_populate_on_demand )
             return GUEST_TABLE_POD_PAGE;
 
         if ( read_only )
             return GUEST_TABLE_MAP_FAILED;
 
-        next = ept_set_middle_entry(p2m, ept_entry);
+        next = ept_set_middle_entry(p2m, &e);
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
-        /* e is now stale and hence may not be used anymore below. */
+
+        rc = atomic_write_ept_entry(ept_entry, e, next_level);
+        ASSERT(rc == 0);
     }
     /* The only time sp would be set here is if we had hit a superpage */
     else if ( is_epte_superpage(&e) )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 05:00:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 05:00: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 1jtOfi-0003w4-7Q; Thu, 09 Jul 2020 05:00:34 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtOfh-0003vv-Ff
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:00:33 +0000
X-Inumbo-ID: 1e1fd7d2-c1a1-11ea-8ea0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 1e1fd7d2-c1a1-11ea-8ea0-12813bfff9fa;
 Thu, 09 Jul 2020 05:00:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=uFMd8syvuQvzPBtt7vxFb7LUbpuPlOpqSkwOdpw11LQ=; b=gEBFozlExhWLCWZ/YnXokYqRYU
 CoOkE/als6Y2xF7JgkTY7/u+iPrs8Z+clmZ+cyw/vs0U4oWZnUw/HlhmntlvaOCXTFA6eZbobSmb5
 iePRDjfssCn4W64+Y8vnY7chzxZ8kgW9SjNyGBiKa2jK6udtQOB1Scshx4KtAJXAO4LI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOfg-0005dJ-Lt
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOfg-0001py-L2
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:00:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] vtd: improve IOMMU TLB flush
Message-Id: <E1jtOfg-0001py-L2@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 05:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 6fe2c30d483c7c02db1d517edd1c708f81e62bd9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 7 15:40:56 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:40:56 2020 +0200

    vtd: improve IOMMU TLB flush
    
    Do not limit PSI flushes to order 0 pages, in order to avoid doing a
    full TLB flush if the passed in page has an order greater than 0 and
    is aligned. Should increase the performance of IOMMU TLB flushes when
    dealing with page orders greater than 0.
    
    This is part of XSA-321.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    master commit: 5fe515a0fede07543f2a3b049167b1fd8b873caf
    master date: 2020-07-07 14:37:46 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 336b778c81..2180f0e899 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -612,13 +612,14 @@ static int __must_check iommu_flush_iotlb(struct domain *d,
         if ( iommu_domid == -1 )
             continue;
 
-        if ( page_count != 1 || gfn == gfn_x(INVALID_GFN) )
+        if ( !page_count || (page_count & (page_count - 1)) ||
+             gfn == gfn_x(INVALID_GFN) || !IS_ALIGNED(gfn, page_count) )
             rc = iommu_flush_iotlb_dsi(iommu, iommu_domid,
                                        0, flush_dev_iotlb);
         else
             rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
                                        (paddr_t)gfn << PAGE_SHIFT_4K,
-                                       PAGE_ORDER_4K,
+                                       get_order_from_pages(page_count),
                                        !dma_old_pte_present,
                                        flush_dev_iotlb);
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 05:00:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 05:00: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 1jtOfs-0003xA-8z; Thu, 09 Jul 2020 05:00:44 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtOfr-0003x2-NU
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:00:43 +0000
X-Inumbo-ID: 2424f112-c1a1-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2424f112-c1a1-11ea-bb8b-bc764e2007e4;
 Thu, 09 Jul 2020 05:00:42 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=+UD4xWFtSris7dyg29mIT2/B1e9O1jMLnmabRXc6k3c=; b=yHBNH9+LLN7y+GMlEgItRFwsAa
 PKhbwxGr3aEHetyTajRvBzQDkltHyu3sW/Ep1i+VNHuzvuJJk4+vBgzKOBikCgTUrm5yb8IuxwN+N
 erN1HosLfOJX1dOMxxUPkKEUl+eRtd36g2Dgg70K5s9j7xnjsT1pVgR51EQFQ+PA5b4I=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOfq-0005ex-Pl
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOfq-0001qY-O8
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:00:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] vtd: prune (and rename) cache flush functions
Message-Id: <E1jtOfq-0001qY-O8@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 05:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 7338b3371c0535944346fb3336a5e28b5c080658
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:41:18 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:41:18 2020 +0200

    vtd: prune (and rename) cache flush functions
    
    Rename __iommu_flush_cache to iommu_sync_cache and remove
    iommu_flush_cache_page. Also remove the iommu_flush_cache_entry
    wrapper and just use iommu_sync_cache instead. Note the _entry suffix
    was meaningless as the wrapper was already taking a size parameter in
    bytes. While there also constify the addr parameter.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 62298825b9a44f45761acbd758138b5ba059ebd1
    master date: 2020-07-07 14:38:13 +0200
---
 xen/drivers/passthrough/vtd/extern.h   |  3 +--
 xen/drivers/passthrough/vtd/intremap.c |  6 +++---
 xen/drivers/passthrough/vtd/iommu.c    | 31 +++++++++++--------------------
 3 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index d698b1d50a..87d5ed78a2 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -37,8 +37,7 @@ void disable_qinval(struct iommu *iommu);
 int enable_intremap(struct iommu *iommu, int eim);
 void disable_intremap(struct iommu *iommu);
 
-void iommu_flush_cache_entry(void *addr, unsigned int size);
-void iommu_flush_cache_page(void *addr, unsigned long npages);
+void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index 1e0317c47a..1b741a2bdb 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -231,7 +231,7 @@ static void free_remap_entry(struct iommu *iommu, int index)
                      iremap_entries, iremap_entry);
 
     update_irte(iommu, iremap_entry, &new_ire, false);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -403,7 +403,7 @@ static int ioapic_rte_to_remap_entry(struct iommu *iommu,
     }
 
     update_irte(iommu, iremap_entry, &new_ire, !init);
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
@@ -694,7 +694,7 @@ static int msi_msg_to_remap_entry(
     update_irte(iommu, iremap_entry, &new_ire, msi_desc->irte_initialized);
     msi_desc->irte_initialized = true;
 
-    iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
+    iommu_sync_cache(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);
 
     unmap_vtd_domain_page(iremap_entries);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 2180f0e899..8ff1a4d8f7 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -158,7 +158,8 @@ static void __init free_intel_iommu(struct intel_iommu *intel)
 }
 
 static int iommus_incoherent;
-static void __iommu_flush_cache(void *addr, unsigned int size)
+
+void iommu_sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -173,16 +174,6 @@ static void __iommu_flush_cache(void *addr, unsigned int size)
         cacheline_flush((char *)addr + i);
 }
 
-void iommu_flush_cache_entry(void *addr, unsigned int size)
-{
-    __iommu_flush_cache(addr, size);
-}
-
-void iommu_flush_cache_page(void *addr, unsigned long npages)
-{
-    __iommu_flush_cache(addr, PAGE_SIZE * npages);
-}
-
 /* Allocate page table, return its machine address */
 u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
 {
@@ -207,7 +198,7 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_flush_cache_page(vaddr, 1);
+        iommu_sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -242,7 +233,7 @@ static u64 bus_to_context_maddr(struct iommu *iommu, u8 bus)
         }
         set_root_value(*root, maddr);
         set_root_present(*root);
-        iommu_flush_cache_entry(root, sizeof(struct root_entry));
+        iommu_sync_cache(root, sizeof(struct root_entry));
     }
     maddr = (u64) get_context_addr(*root);
     unmap_vtd_domain_page(root_entries);
@@ -300,7 +291,7 @@ static u64 addr_to_dma_page_maddr(struct domain *domain, u64 addr, int alloc)
              */
             dma_set_pte_readable(*pte);
             dma_set_pte_writable(*pte);
-            iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+            iommu_sync_cache(pte, sizeof(struct dma_pte));
         }
 
         if ( level == 2 )
@@ -674,7 +665,7 @@ static int __must_check dma_pte_clear_one(struct domain *domain, u64 addr)
 
     dma_clear_pte(*pte);
     spin_unlock(&hd->arch.mapping_lock);
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     if ( !this_cpu(iommu_dont_flush_iotlb) )
         rc = iommu_flush_iotlb_pages(domain, addr >> PAGE_SHIFT_4K, 1);
@@ -716,7 +707,7 @@ static void iommu_free_page_table(struct page_info *pg)
             iommu_free_pagetable(dma_pte_addr(*pte), next_level);
 
         dma_clear_pte(*pte);
-        iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+        iommu_sync_cache(pte, sizeof(struct dma_pte));
     }
 
     unmap_vtd_domain_page(pt_vaddr);
@@ -1447,7 +1438,7 @@ int domain_context_mapping_one(
     context_set_address_width(*context, agaw);
     context_set_fault_enable(*context);
     context_set_present(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
     spin_unlock(&iommu->lock);
 
     /* Context entry was previously non-present (with domid 0). */
@@ -1594,7 +1585,7 @@ int domain_context_unmap_one(
 
     context_clear_present(*context);
     context_clear_entry(*context);
-    iommu_flush_cache_entry(context, sizeof(struct context_entry));
+    iommu_sync_cache(context, sizeof(struct context_entry));
 
     iommu_domid= domain_iommu_domid(domain, iommu);
     if ( iommu_domid == -1 )
@@ -1824,7 +1815,7 @@ static int __must_check intel_iommu_map_page(struct domain *d,
 
     *pte = new;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
     spin_unlock(&hd->arch.mapping_lock);
     unmap_vtd_domain_page(page);
 
@@ -1858,7 +1849,7 @@ int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
     int iommu_domid;
     int rc = 0;
 
-    iommu_flush_cache_entry(pte, sizeof(struct dma_pte));
+    iommu_sync_cache(pte, sizeof(struct dma_pte));
 
     for_each_drhd_unit ( drhd )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 05:00:54 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 05:00: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 1jtOg2-0003yc-Ad; Thu, 09 Jul 2020 05:00:54 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtOg1-0003x2-MH
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:00:53 +0000
X-Inumbo-ID: 2a2db3d2-c1a1-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2a2db3d2-c1a1-11ea-bb8b-bc764e2007e4;
 Thu, 09 Jul 2020 05:00:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=lPZvmQDCsKbJv/Yq7Peiw1Rnxm8/iwNwT2uBofIENSE=; b=SE2yun6QQ4BKZZf4QDGTcX/EQK
 4Cxm8FwJY5NqTZNjdWu/Zt8/rsRf6GMsYMVo68vx8GCmxZX+Vcu8pJY8oSAL9YuMoQguUBIfPPwd3
 SCdge8vaNzujmEQr8kj3Z5nf1qLXk4+IAOncilrjaLYYQWbZP8aymSFp6suex/8KT4pg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOg0-0005fD-Tp
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOg0-0001rF-S8
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:00:52 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] x86/iommu: introduce a cache sync hook
Message-Id: <E1jtOg0-0001rF-S8@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 05:00:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 1c51a292788e3e006dd9b14ec987c5da662d4a50
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:41:49 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:41:49 2020 +0200

    x86/iommu: introduce a cache sync hook
    
    The hook is only implemented for VT-d and it uses the already existing
    iommu_sync_cache function present in VT-d code. The new hook is
    added so that the cache can be flushed by code outside of VT-d when
    using shared page tables.
    
    Note that alloc_pgtable_maddr must use the now locally defined
    sync_cache function, because IOMMU ops are not yet setup the first
    time the function gets called during IOMMU initialization.
    
    No functional change intended.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 91526b460e5009fc56edbd6809e66c327281faba
    master date: 2020-07-07 14:38:34 +0200
---
 xen/drivers/passthrough/vtd/extern.h | 1 -
 xen/drivers/passthrough/vtd/iommu.c  | 5 +++--
 xen/include/asm-x86/iommu.h          | 7 +++++++
 xen/include/xen/iommu.h              | 1 +
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 87d5ed78a2..00a73d63ea 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -37,7 +37,6 @@ void disable_qinval(struct iommu *iommu);
 int enable_intremap(struct iommu *iommu, int eim);
 void disable_intremap(struct iommu *iommu);
 
-void iommu_sync_cache(const void *addr, unsigned int size);
 int iommu_alloc(struct acpi_drhd_unit *drhd);
 void iommu_free(struct acpi_drhd_unit *drhd);
 
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 8ff1a4d8f7..6b9a1b6145 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -159,7 +159,7 @@ static void __init free_intel_iommu(struct intel_iommu *intel)
 
 static int iommus_incoherent;
 
-void iommu_sync_cache(const void *addr, unsigned int size)
+static void sync_cache(const void *addr, unsigned int size)
 {
     int i;
     static unsigned int clflush_size = 0;
@@ -198,7 +198,7 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        iommu_sync_cache(vaddr, PAGE_SIZE);
+        sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -2696,6 +2696,7 @@ const struct iommu_ops intel_iommu_ops = {
     .iotlb_flush_all = iommu_flush_iotlb_all,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_p2m_table = vtd_dump_p2m_table,
+    .sync_cache = sync_cache,
 };
 
 /*
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index dcf2e21402..16ff2e94c2 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -98,6 +98,13 @@ extern bool untrusted_msi;
 int pi_update_irte(const struct pi_desc *pi_desc, const struct pirq *pirq,
                    const uint8_t gvec);
 
+#define iommu_sync_cache(addr, size) ({                 \
+    const struct iommu_ops *ops = iommu_get_ops();      \
+                                                        \
+    if ( ops->sync_cache )                              \
+        ops->sync_cache(addr, size);                    \
+})
+
 #endif /* !__ARCH_X86_IOMMU_H__ */
 /*
  * Local variables:
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 5f9f82ea22..0e3e49e685 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -176,6 +176,7 @@ struct iommu_ops {
     void (*update_ire_from_apic)(unsigned int apic, unsigned int reg, unsigned int value);
     unsigned int (*read_apic_from_ire)(unsigned int apic, unsigned int reg);
     int (*setup_hpet_msi)(struct msi_desc *);
+    void (*sync_cache)(const void *addr, unsigned int size);
 #endif /* CONFIG_X86 */
     int __must_check (*suspend)(void);
     void (*resume)(void);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 05:01:05 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 05:01: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 1jtOgD-00040C-Cj; Thu, 09 Jul 2020 05:01:05 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtOgC-000400-3h
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:01:04 +0000
X-Inumbo-ID: 3035830e-c1a1-11ea-8ea0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3035830e-c1a1-11ea-8ea0-12813bfff9fa;
 Thu, 09 Jul 2020 05:01:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=SOyTdBD2vPGOECt/cNI8EsOc5GwO0y6vQm0so0lsv80=; b=zDkCsaWIuOOAs/DtdLeQfDbPI6
 wOo+nfQqDgyHvsDlFeVcqn7TJq2D/MKOw5pBbMedpaA77JnNUTOYlnnzPYm2Cu5U/UltJd3t7NaHL
 2e7DWXTMvUYKPJ4wnPjmgD0V3azzosEMWfpVbEQVU9iACUqVRnG5SQfbYztBrgGaa+48=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOgB-0005fX-0S
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:01:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOgA-0001s5-Vv
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:01:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] vtd: don't assume addresses are aligned in sync_cache
Message-Id: <E1jtOgA-0001s5-Vv@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 05:01:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 83917016f87ca5feeb32f2fdcae32e560bb8d283
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:42:15 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:42:15 2020 +0200

    vtd: don't assume addresses are aligned in sync_cache
    
    Current code in sync_cache assume that the address passed in is
    aligned to a cache line size. Fix the code to support passing in
    arbitrary addresses not necessarily aligned to a cache line size.
    
    This is part of XSA-321.
    
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: b6d9398144f21718d25daaf8d72669a75592abc5
    master date: 2020-07-07 14:39:05 +0200
---
 xen/drivers/passthrough/vtd/iommu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 6b9a1b6145..2c6a69dfbe 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -161,8 +161,8 @@ static int iommus_incoherent;
 
 static void sync_cache(const void *addr, unsigned int size)
 {
-    int i;
-    static unsigned int clflush_size = 0;
+    static unsigned long clflush_size = 0;
+    const void *end = addr + size;
 
     if ( !iommus_incoherent )
         return;
@@ -170,8 +170,9 @@ static void sync_cache(const void *addr, unsigned int size)
     if ( clflush_size == 0 )
         clflush_size = get_cache_line_size();
 
-    for ( i = 0; i < size; i += clflush_size )
-        cacheline_flush((char *)addr + i);
+    addr -= (unsigned long)addr & (clflush_size - 1);
+    for ( ; addr < end; addr += clflush_size )
+        cacheline_flush((char *)addr);
 }
 
 /* Allocate page table, return its machine address */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 05:01:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 05:01: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 1jtOgM-00041J-EK; Thu, 09 Jul 2020 05:01:14 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtOgL-000418-Kc
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:01:13 +0000
X-Inumbo-ID: 3635889e-c1a1-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 3635889e-c1a1-11ea-b7bb-bc764e2007e4;
 Thu, 09 Jul 2020 05:01:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=6lIbwEIyFSt7N6/JCIRN3j4DRyiCrYrt86y5kZToKJs=; b=ODSdibnKIN3eDtooUynWXBJ9GV
 Gs6XjdzX2i1XJ8bcZSVeLZThLPuFcKIBVTlpvBXKHQA5lvf/GFQ6969gMC3i33jlrR0mHSOkv9nLt
 h+r/SdoQ9gDj6zMy4G7cPoq22u4qp72QDOujXLyNgzUFf4y+jsLM572Y9t43ZU0M1cdw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOgL-0005fl-3W
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:01:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOgL-0001sa-2c
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:01:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] x86/alternative: introduce alternative_2
Message-Id: <E1jtOgL-0001sa-2c@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 05:01:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 46d6a0721405149ace209cdf23fa009fd366dbf2
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:42:34 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:42:34 2020 +0200

    x86/alternative: introduce alternative_2
    
    It's based on alternative_io_2 without inputs or outputs but with an
    added memory clobber.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 23570bce00ee6ba2139ece978ab6f03ff166e21d
    master date: 2020-07-07 14:39:25 +0200
---
 xen/include/asm-x86/alternative.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h
index ba537d6b7e..7c34504f89 100644
--- a/xen/include/asm-x86/alternative.h
+++ b/xen/include/asm-x86/alternative.h
@@ -85,6 +85,11 @@ extern void alternative_instructions(void);
 #define alternative(oldinstr, newinstr, feature)                        \
         asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) : : : "memory")
 
+#define alternative_2(oldinstr, newinstr1, feature1, newinstr2, feature2) \
+	asm volatile (ALTERNATIVE_2(oldinstr, newinstr1, feature1,	\
+				    newinstr2, feature2)		\
+		      : : : "memory")
+
 /*
  * Alternative inline assembly with input.
  *
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 05:01:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 05:01: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 1jtOgW-000439-G4; Thu, 09 Jul 2020 05:01:24 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtOgV-00042z-TB
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:01:23 +0000
X-Inumbo-ID: 3c3aa990-c1a1-11ea-8ea0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3c3aa990-c1a1-11ea-8ea0-12813bfff9fa;
 Thu, 09 Jul 2020 05:01:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=UYokGPv2WCk3m/6oJxcq/M2u1wx6BCHWeNwEPeG0dGg=; b=nMTUMXq+8huoUhRL7037C1Teno
 UesyWkdw+Zum0D/OC4rWIazA7OuET8JNFgyiblU3pUCVAccKVQ7Fa4YAj56va5p/tWS+aAKAK3wSg
 zDmJ1q4/5gNipv/PkocJUYcjnt9kCkwlCH1e4kC7LAF2hSKg2JCj+c2S8MQEfXYDDrBo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOgV-0005fs-6T
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:01:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOgV-0001tJ-5n
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:01:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] vtd: optimize CPU cache sync
Message-Id: <E1jtOgV-0001tJ-5n@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 05:01:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 3c9a98410be01236f1de1ad171885552fae5397a
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:42:59 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:42:59 2020 +0200

    vtd: optimize CPU cache sync
    
    Some VT-d IOMMUs are non-coherent, which requires a cache write back
    in order for the changes made by the CPU to be visible to the IOMMU.
    This cache write back was unconditionally done using clflush, but there are
    other more efficient instructions to do so, hence implement support
    for them using the alternative framework.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: a64ea16522a73a13a0d66cfa4b66a9d3b95dd9d6
    master date: 2020-07-07 14:39:54 +0200
---
 xen/drivers/passthrough/vtd/extern.h  |  1 -
 xen/drivers/passthrough/vtd/iommu.c   | 38 ++++++++++++++++++++++++++++++++++-
 xen/drivers/passthrough/vtd/x86/vtd.c |  5 -----
 3 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 00a73d63ea..065d768b52 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -63,7 +63,6 @@ int __must_check qinval_device_iotlb_sync(struct iommu *iommu,
                                           u16 did, u16 size, u64 addr);
 
 unsigned int get_cache_line_size(void);
-void cacheline_flush(char *);
 void flush_all_cache(void);
 
 u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 2c6a69dfbe..2d80d5836c 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -31,6 +31,7 @@
 #include <xen/pci_regs.h>
 #include <xen/keyhandler.h>
 #include <asm/msi.h>
+#include <asm/nops.h>
 #include <asm/irq.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/p2m.h>
@@ -172,7 +173,42 @@ static void sync_cache(const void *addr, unsigned int size)
 
     addr -= (unsigned long)addr & (clflush_size - 1);
     for ( ; addr < end; addr += clflush_size )
-        cacheline_flush((char *)addr);
+/*
+ * The arguments to a macro must not include preprocessor directives. Doing so
+ * results in undefined behavior, so we have to create some defines here in
+ * order to avoid it.
+ */
+#if defined(HAVE_AS_CLWB)
+# define CLWB_ENCODING "clwb %[p]"
+#elif defined(HAVE_AS_XSAVEOPT)
+# define CLWB_ENCODING "data16 xsaveopt %[p]" /* clwb */
+#else
+# define CLWB_ENCODING ".byte 0x66, 0x0f, 0xae, 0x30" /* clwb (%%rax) */
+#endif
+
+#define BASE_INPUT(addr) [p] "m" (*(const char *)(addr))
+#if defined(HAVE_AS_CLWB) || defined(HAVE_AS_XSAVEOPT)
+# define INPUT BASE_INPUT
+#else
+# define INPUT(addr) "a" (addr), BASE_INPUT(addr)
+#endif
+        /*
+         * Note regarding the use of NOP_DS_PREFIX: it's faster to do a clflush
+         * + prefix than a clflush + nop, and hence the prefix is added instead
+         * of letting the alternative framework fill the gap by appending nops.
+         */
+        alternative_io_2(".byte " __stringify(NOP_DS_PREFIX) "; clflush %[p]",
+                         "data16 clflush %[p]", /* clflushopt */
+                         X86_FEATURE_CLFLUSHOPT,
+                         CLWB_ENCODING,
+                         X86_FEATURE_CLWB, /* no outputs */,
+                         INPUT(addr));
+#undef INPUT
+#undef BASE_INPUT
+#undef CLWB_ENCODING
+
+    alternative_2(ASM_NOP3, "sfence", X86_FEATURE_CLFLUSHOPT,
+                            "sfence", X86_FEATURE_CLWB);
 }
 
 /* Allocate page table, return its machine address */
diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c
index 88a60b3307..7f96b91dd4 100644
--- a/xen/drivers/passthrough/vtd/x86/vtd.c
+++ b/xen/drivers/passthrough/vtd/x86/vtd.c
@@ -53,11 +53,6 @@ unsigned int get_cache_line_size(void)
     return ((cpuid_ebx(1) >> 8) & 0xff) * 8;
 }
 
-void cacheline_flush(char * addr)
-{
-    clflush(addr);
-}
-
 void flush_all_cache()
 {
     wbinvd();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 05:01:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 05:01: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 1jtOgh-00044U-Ja; Thu, 09 Jul 2020 05:01:35 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtOgg-00044L-C0
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:01:34 +0000
X-Inumbo-ID: 4240b1ae-c1a1-11ea-8ea0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 4240b1ae-c1a1-11ea-8ea0-12813bfff9fa;
 Thu, 09 Jul 2020 05:01:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=AsZbB2lrEj3dLhRmVNMy8Ug/gK1OtQoeA1yCKnrJWCE=; b=nkhKSaXxox9S6o5zcIMk1j02Na
 g/VZNjjF4BGBkF37N0UQgMeV1S+eK3WAwZYWKAULhaMnx5ibG85B+OWT7D+O4K9CLITOlhNU8SfoY
 e9UXwKNnhY6939nbJInExZdOkrpKmhwHVeZva2GhkR6VeqTmtIJ+SQcgUM+4Mhg7kVH0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOgf-0005gV-9U
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:01:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOgf-0001tv-8k
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:01:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] x86/ept: flush cache when modifying PTEs and sharing
 page tables
Message-Id: <E1jtOgf-0001tv-8k@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 05:01:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a852040fe3ab6658ab0dd4fa8f86f50db9d08874
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 7 15:43:29 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:43:29 2020 +0200

    x86/ept: flush cache when modifying PTEs and sharing page tables
    
    Modifications made to the page tables by EPT code need to be written
    to memory when the page tables are shared with the IOMMU, as Intel
    IOMMUs can be non-coherent and thus require changes to be written to
    memory in order to be visible to the IOMMU.
    
    In order to achieve this make sure data is written back to memory
    after writing an EPT entry when the recalc bit is not set in
    atomic_write_ept_entry. If such bit is set, the entry will be
    adjusted and atomic_write_ept_entry will be called a second time
    without the recalc bit set. Note that when splitting a super page the
    new tables resulting of the split should also be written back.
    
    Failure to do so can allow devices behind the IOMMU access to the
    stale super page, or cause coherency issues as changes made by the
    processor to the page tables are not visible to the IOMMU.
    
    This allows to remove the VT-d specific iommu_pte_flush helper, since
    the cache write back is now performed by atomic_write_ept_entry, and
    hence iommu_iotlb_flush can be used to flush the IOMMU TLB. The newly
    used method (iommu_iotlb_flush) can result in less flushes, since it
    might sometimes be called rightly with 0 flags, in which case it
    becomes a no-op.
    
    This is part of XSA-321.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c23274fd0412381bd75068ebc9f8f8c90a4be748
    master date: 2020-07-07 14:40:11 +0200
---
 xen/arch/x86/mm/p2m-ept.c           | 21 ++++++++++++++-
 xen/drivers/passthrough/vtd/iommu.c | 53 ++-----------------------------------
 xen/include/asm-x86/iommu.h         |  5 ++--
 3 files changed, 25 insertions(+), 54 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 6bd0cd4ff7..036771f43c 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -90,6 +90,19 @@ static int atomic_write_ept_entry(ept_entry_t *entryptr, ept_entry_t new,
 
     write_atomic(&entryptr->epte, new.epte);
 
+    /*
+     * The recalc field on the EPT is used to signal either that a
+     * recalculation of the EMT field is required (which doesn't effect the
+     * IOMMU), or a type change. Type changes can only be between ram_rw,
+     * logdirty and ioreq_server: changes to/from logdirty won't work well with
+     * an IOMMU anyway, as IOMMU #PFs are not synchronous and will lead to
+     * aborts, and changes to/from ioreq_server are already fully flushed
+     * before returning to guest context (see
+     * XEN_DMOP_map_mem_type_to_ioreq_server).
+     */
+    if ( !new.recalc && iommu_hap_pt_share )
+        iommu_sync_cache(entryptr, sizeof(*entryptr));
+
     if ( unlikely(oldmfn != mfn_x(INVALID_MFN)) )
         put_page(mfn_to_page(oldmfn));
 
@@ -319,6 +332,9 @@ static bool_t ept_split_super_page(struct p2m_domain *p2m,
             break;
     }
 
+    if ( iommu_hap_pt_share )
+        iommu_sync_cache(table, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
     unmap_domain_page(table);
 
     /* Even failed we should install the newly allocated ept page. */
@@ -378,6 +394,9 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
         if ( !next )
             return GUEST_TABLE_MAP_FAILED;
 
+        if ( iommu_hap_pt_share )
+            iommu_sync_cache(next, EPT_PAGETABLE_ENTRIES * sizeof(ept_entry_t));
+
         rc = atomic_write_ept_entry(ept_entry, e, next_level);
         ASSERT(rc == 0);
     }
@@ -873,7 +892,7 @@ out:
          need_modify_vtd_table )
     {
         if ( iommu_hap_pt_share )
-            rc = iommu_pte_flush(d, gfn, &ept_entry->epte, order, vtd_pte_present);
+            rc = iommu_flush_iotlb(d, gfn, vtd_pte_present, 1u << order);
         else
         {
             if ( iommu_flags )
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 2d80d5836c..1cd00dca40 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -612,10 +612,8 @@ static int __must_check iommu_flush_all(void)
     return rc;
 }
 
-static int __must_check iommu_flush_iotlb(struct domain *d,
-                                          unsigned long gfn,
-                                          bool_t dma_old_pte_present,
-                                          unsigned int page_count)
+int iommu_flush_iotlb(struct domain *d, unsigned long gfn,
+                      bool dma_old_pte_present, unsigned int page_count)
 {
     struct domain_iommu *hd = dom_iommu(d);
     struct acpi_drhd_unit *drhd;
@@ -1876,53 +1874,6 @@ static int __must_check intel_iommu_unmap_page(struct domain *d,
     return dma_pte_clear_one(d, (paddr_t)gfn << PAGE_SHIFT_4K);
 }
 
-int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
-                    int order, int present)
-{
-    struct acpi_drhd_unit *drhd;
-    struct iommu *iommu = NULL;
-    struct domain_iommu *hd = dom_iommu(d);
-    bool_t flush_dev_iotlb;
-    int iommu_domid;
-    int rc = 0;
-
-    iommu_sync_cache(pte, sizeof(struct dma_pte));
-
-    for_each_drhd_unit ( drhd )
-    {
-        iommu = drhd->iommu;
-        if ( !test_bit(iommu->index, &hd->arch.iommu_bitmap) )
-            continue;
-
-        flush_dev_iotlb = !!find_ats_dev_drhd(iommu);
-        iommu_domid= domain_iommu_domid(d, iommu);
-        if ( iommu_domid == -1 )
-            continue;
-
-        rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
-                                   (paddr_t)gfn << PAGE_SHIFT_4K,
-                                   order, !present, flush_dev_iotlb);
-        if ( rc > 0 )
-        {
-            iommu_flush_write_buffer(iommu);
-            rc = 0;
-        }
-    }
-
-    if ( unlikely(rc) )
-    {
-        if ( !d->is_shutting_down && printk_ratelimit() )
-            printk(XENLOG_ERR VTDPREFIX
-                   " d%d: IOMMU pages flush failed: %d\n",
-                   d->domain_id, rc);
-
-        if ( !is_hardware_domain(d) )
-            domain_crash(d);
-    }
-
-    return rc;
-}
-
 static int __init vtd_ept_page_compatible(struct iommu *iommu)
 {
     u64 ept_cap, vtd_cap = iommu->cap;
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index 16ff2e94c2..dfc9b77594 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -87,8 +87,9 @@ int iommu_setup_hpet_msi(struct msi_desc *);
 
 /* While VT-d specific, this must get declared in a generic header. */
 int adjust_vtd_irq_affinities(void);
-int __must_check iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
-                                 int order, int present);
+int __must_check iommu_flush_iotlb(struct domain *d, unsigned long gfn,
+                                   bool dma_old_pte_present,
+                                   unsigned int page_count);
 bool_t iommu_supports_eim(void);
 int iommu_enable_x2apic_IR(void);
 void iommu_disable_x2apic_IR(void);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Thu Jul 09 05:01:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Jul 2020 05:01: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 1jtOgq-00045S-L8; Thu, 09 Jul 2020 05:01:44 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=36mn=AU=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtOgq-00045J-0M
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:01:44 +0000
X-Inumbo-ID: 48429630-c1a1-11ea-8ea0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 48429630-c1a1-11ea-8ea0-12813bfff9fa;
 Thu, 09 Jul 2020 05:01:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=SNESOogmiqw+TDhWAcIABwCTXzk6Wby1DHxzFwlY2gM=; b=sBfUSvJuNl0fDw720PyqQqWLyg
 7mPePg1Lq/KOEwdJUOr9QOYdRbBSeStJ/q16ILiKm3x8Rfcn+Zo2khC6JKRVmtUj/1GlBBuDVWHOb
 bdsTSSfb8tcrYzwsQQTJdfo0F6DTlGCy+2/i7jDWVre5rSYhcrHfpWTFP2IWX4tTqEGU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOgp-0005gh-CU
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:01:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtOgp-0001uT-Bh
 for xen-changelog@lists.xenproject.org; Thu, 09 Jul 2020 05:01:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.9] xen: Check the alignment of the offset pased via
 VCPUOP_register_vcpu_info
Message-Id: <E1jtOgp-0001uT-Bh@xenbits.xenproject.org>
Date: Thu, 09 Jul 2020 05:01:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 4597fc97b3b8870c39214e3aa4132ab711a40691
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jul 7 15:43:59 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 7 15:43:59 2020 +0200

    xen: Check the alignment of the offset pased via VCPUOP_register_vcpu_info
    
    Currently a guest is able to register any guest physical address to use
    for the vcpu_info structure as long as the structure can fits in the
    rest of the frame.
    
    This means a guest can provide an address that is not aligned to the
    natural alignment of the structure.
    
    On Arm 32-bit, unaligned access are completely forbidden by the
    hypervisor. This will result to a data abort which is fatal.
    
    On Arm 64-bit, unaligned access are only forbidden when used for atomic
    access. As the structure contains fields (such as evtchn_pending_self)
    that are updated using atomic operations, any unaligned access will be
    fatal as well.
    
    While the misalignment is only fatal on Arm, a generic check is added
    as an x86 guest shouldn't sensibly pass an unaligned address (this
    would result to a split lock).
    
    This is XSA-327.
    
    Reported-by: Julien Grall <jgrall@amazon.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    master commit: 3fdc211b01b29f252166937238efe02d15cb5780
    master date: 2020-07-07 14:41:00 +0200
---
 xen/common/domain.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index a49545121b..3bd4875349 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1150,10 +1150,20 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
     void *mapping;
     vcpu_info_t *new_info;
     struct page_info *page;
+    unsigned int align;
 
     if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
         return -EINVAL;
 
+#ifdef CONFIG_COMPAT
+    if ( has_32bit_shinfo(d) )
+        align = alignof(new_info->compat);
+    else
+#endif
+        align = alignof(*new_info);
+    if ( offset & (align - 1) )
+        return -EINVAL;
+
     if ( !mfn_eq(v->vcpu_info_mfn, INVALID_MFN) )
         return -EINVAL;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9


From xen-changelog-bounces@lists.xenproject.org Fri Jul 10 16:55:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Jul 2020 16:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jtwIl-0001la-JS; Fri, 10 Jul 2020 16:55:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=xWq2=AV=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtwIk-0001lV-GA
 for xen-changelog@lists.xenproject.org; Fri, 10 Jul 2020 16:55:06 +0000
X-Inumbo-ID: 1a610070-c2ce-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 1a610070-c2ce-11ea-bb8b-bc764e2007e4;
 Fri, 10 Jul 2020 16:55:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=vXx9EeXiBpPmHIciAS9S5hEC61nE7kgO7ReOXZf+UX4=; b=B7qE2BWCxD3zqzF5miVDHewp10
 afqWhp1DqVbp6W0S4ajyAncZF7DRb3/buYHMrjxPQxtzZCeZNwdkWgOY3fstj1mk/GogwDFkRYh0G
 IN7PI82iEIMhBU0tUNpkXSmUPMMGwQBC6qFN27MB62v1Aitez7CB39MO4ik1L5+/IUl0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtwIi-00009c-Rn
 for xen-changelog@lists.xenproject.org; Fri, 10 Jul 2020 16:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtwIi-00021k-Pf
 for xen-changelog@lists.xenproject.org; Fri, 10 Jul 2020 16:55:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] pvcalls: Clearly spell out that the header is just a
 reference
Message-Id: <E1jtwIi-00021k-Pf@xenbits.xenproject.org>
Date: Fri, 10 Jul 2020 16:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 8655fb5f468e85536d4647c9fdd5140005d56d83
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sat Jun 27 10:55:32 2020 +0100
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Fri Jul 10 09:49:24 2020 -0700

    pvcalls: Clearly spell out that the header is just a reference
    
    A recent thread on xen-devel [1] pointed out that the header was
    provided as a reference for the specification.
    
    Unfortunately, this was never written down in xen.git so for an external
    user (or a reviewer) it is not clear whether the spec or the header
    should be followed when there is a conflict.
    
    To avoid more confusion, a paragraph is added at the top of the header
    to clearly spell out it is only provided for reference.
    
    [1] https://lore.kernel.org/xen-devel/alpine.DEB.2.21.2006151343430.9074@sstabellini-ThinkPad-T480s/
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
---
 xen/include/public/io/pvcalls.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/include/public/io/pvcalls.h b/xen/include/public/io/pvcalls.h
index cb8171275c..905880735d 100644
--- a/xen/include/public/io/pvcalls.h
+++ b/xen/include/public/io/pvcalls.h
@@ -3,6 +3,9 @@
  *
  * Refer to docs/misc/pvcalls.markdown for the specification
  *
+ * The header is provided as a C reference for the specification. In
+ * case of conflict, the specification is authoritative.
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
  * deal in the Software without restriction, including without limitation the
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jul 10 16:55:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Jul 2020 16: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 1jtwIu-0001lx-L0; Fri, 10 Jul 2020 16:55:16 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=xWq2=AV=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jtwIt-0001ls-P4
 for xen-changelog@lists.xenproject.org; Fri, 10 Jul 2020 16:55:15 +0000
X-Inumbo-ID: 206480b4-c2ce-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 206480b4-c2ce-11ea-8496-bc764e2007e4;
 Fri, 10 Jul 2020 16:55:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=9TYtl37rnbtl7Zu2IRy+o3tSZzRPtL2wh8j7BvV/7fw=; b=dahI3NiYj1HS/tnyvAnfW+5cQc
 DeFKxJ2pv0e/K2MmWJaFhGLrVwe9OlGM7HeyXDX1qBsecw8hQqqdIgkbXPZC+9gRa/xMG4a4rRbWI
 ZaOQGh0KLocpZ0M7yMPPlzhZl/bYfaG/dxM36gt1M7AQuqaWtjkg9m52lWDx48mInOLA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtwIs-00009k-WA
 for xen-changelog@lists.xenproject.org; Fri, 10 Jul 2020 16:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jtwIs-00022S-U1
 for xen-changelog@lists.xenproject.org; Fri, 10 Jul 2020 16:55:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] pvcalls: Document correctly and explicitely the padding
 for all arches
Message-Id: <E1jtwIs-00022S-U1@xenbits.xenproject.org>
Date: Fri, 10 Jul 2020 16:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 02d69864b51a4302a148c28d6d391238a6778b4b
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sat Jun 27 10:55:33 2020 +0100
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Fri Jul 10 09:52:24 2020 -0700

    pvcalls: Document correctly and explicitely the padding for all arches
    
    The specification of pvcalls suggests there is padding for 32-bit x86 at
    the end of most the structure. However, they are not described in in the
    public header.
    
    Because of that all the structures would have a different size between
    32-bit x86 and 64-bit x86.
    
    For all the other architectures supported (Arm and 64-bit x86), the
    structure have the sames sizes because they contain implicit padding
    thanks to the 64-bit alignment of the field uint64_t field.
    
    Given the specification is authoritative, the padding will now be the
    same for all architectures. The potential breakage of compatibility is
    ought to be fine as pvcalls is still a tech preview.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
---
 docs/misc/pvcalls.pandoc        | 8 --------
 xen/include/public/io/pvcalls.h | 4 ++++
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/docs/misc/pvcalls.pandoc b/docs/misc/pvcalls.pandoc
index 665dad556c..971cd8f4b1 100644
--- a/docs/misc/pvcalls.pandoc
+++ b/docs/misc/pvcalls.pandoc
@@ -246,9 +246,7 @@ The format is defined as follows:
     			uint32_t domain;
     			uint32_t type;
     			uint32_t protocol;
-    			#ifdef CONFIG_X86_32
     			uint8_t pad[4];
-    			#endif
     		} socket;
     		struct xen_pvcalls_connect {
     			uint64_t id;
@@ -257,16 +255,12 @@ The format is defined as follows:
     			uint32_t flags;
     			grant_ref_t ref;
     			uint32_t evtchn;
-    			#ifdef CONFIG_X86_32
     			uint8_t pad[4];
-    			#endif
     		} connect;
     		struct xen_pvcalls_release {
     			uint64_t id;
     			uint8_t reuse;
-    			#ifdef CONFIG_X86_32
     			uint8_t pad[7];
-    			#endif
     		} release;
     		struct xen_pvcalls_bind {
     			uint64_t id;
@@ -276,9 +270,7 @@ The format is defined as follows:
     		struct xen_pvcalls_listen {
     			uint64_t id;
     			uint32_t backlog;
-    			#ifdef CONFIG_X86_32
     			uint8_t pad[4];
-    			#endif
     		} listen;
     		struct xen_pvcalls_accept {
     			uint64_t id;
diff --git a/xen/include/public/io/pvcalls.h b/xen/include/public/io/pvcalls.h
index 905880735d..6da6b5533a 100644
--- a/xen/include/public/io/pvcalls.h
+++ b/xen/include/public/io/pvcalls.h
@@ -68,6 +68,7 @@ struct xen_pvcalls_request {
             uint32_t domain;
             uint32_t type;
             uint32_t protocol;
+            uint8_t pad[4];
         } socket;
         struct xen_pvcalls_connect {
             uint64_t id;
@@ -76,10 +77,12 @@ struct xen_pvcalls_request {
             uint32_t flags;
             grant_ref_t ref;
             uint32_t evtchn;
+            uint8_t pad[4];
         } connect;
         struct xen_pvcalls_release {
             uint64_t id;
             uint8_t reuse;
+            uint8_t pad[7];
         } release;
         struct xen_pvcalls_bind {
             uint64_t id;
@@ -89,6 +92,7 @@ struct xen_pvcalls_request {
         struct xen_pvcalls_listen {
             uint64_t id;
             uint32_t backlog;
+            uint8_t pad[4];
         } listen;
         struct xen_pvcalls_accept {
             uint64_t id;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Jul 11 08:55:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Jul 2020 08: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 1juBHn-000165-88; Sat, 11 Jul 2020 08:55:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=rLS3=AW=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1juBHm-000160-4P
 for xen-changelog@lists.xenproject.org; Sat, 11 Jul 2020 08:55:06 +0000
X-Inumbo-ID: 35439106-c354-11ea-9081-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 35439106-c354-11ea-9081-12813bfff9fa;
 Sat, 11 Jul 2020 08:55:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=mwZZyoB556mcoRv1BaEE+rcUQy6ByYMKGwvHLrncYr4=; b=gyz1bQaXsqKmR93W1vMKSElOP6
 FqmmdPqJIEcqoOOV1caRSb1xPdCPV0IGzPCWrUugQITtSVr7/bSZUM2xXTFjlgUOe6wgfxJ94rzuU
 kjVq6T3Nv9YNLG94a2irl82d2kg2jszYb/DcPhsOQT1Q6iLXo1CCe/jU6fMzbVkGb4tQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1juBHi-0004QJ-Hq
 for xen-changelog@lists.xenproject.org; Sat, 11 Jul 2020 08:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1juBHi-0004jg-Fz
 for xen-changelog@lists.xenproject.org; Sat, 11 Jul 2020 08:55:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] pvcalls: Clearly spell out that the header is just a
 reference
Message-Id: <E1juBHi-0004jg-Fz@xenbits.xenproject.org>
Date: Sat, 11 Jul 2020 08:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 8655fb5f468e85536d4647c9fdd5140005d56d83
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sat Jun 27 10:55:32 2020 +0100
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Fri Jul 10 09:49:24 2020 -0700

    pvcalls: Clearly spell out that the header is just a reference
    
    A recent thread on xen-devel [1] pointed out that the header was
    provided as a reference for the specification.
    
    Unfortunately, this was never written down in xen.git so for an external
    user (or a reviewer) it is not clear whether the spec or the header
    should be followed when there is a conflict.
    
    To avoid more confusion, a paragraph is added at the top of the header
    to clearly spell out it is only provided for reference.
    
    [1] https://lore.kernel.org/xen-devel/alpine.DEB.2.21.2006151343430.9074@sstabellini-ThinkPad-T480s/
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
---
 xen/include/public/io/pvcalls.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/include/public/io/pvcalls.h b/xen/include/public/io/pvcalls.h
index cb8171275c..905880735d 100644
--- a/xen/include/public/io/pvcalls.h
+++ b/xen/include/public/io/pvcalls.h
@@ -3,6 +3,9 @@
  *
  * Refer to docs/misc/pvcalls.markdown for the specification
  *
+ * The header is provided as a C reference for the specification. In
+ * case of conflict, the specification is authoritative.
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
  * deal in the Software without restriction, including without limitation the
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jul 11 08:55:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 11 Jul 2020 08:55:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1juBHv-00016m-9p; Sat, 11 Jul 2020 08:55:15 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=rLS3=AW=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1juBHt-00016a-9v
 for xen-changelog@lists.xenproject.org; Sat, 11 Jul 2020 08:55:13 +0000
X-Inumbo-ID: 3b449ac8-c354-11ea-9081-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3b449ac8-c354-11ea-9081-12813bfff9fa;
 Sat, 11 Jul 2020 08:55:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=MASYiSRnYXF8Bbey5lkoLWjCoWTs/l9i85AvdJWYEOk=; b=JQY54lkvg+wvnDhB/3K4Wvb5ge
 eN7cw+7IdVQcT0LGd8NCpiKggzndHQmDo/DR41+TP66X26P4SUxV5uqb0OAwinknsz1n4UdeMW5JE
 BXgIbRKVj0VdkChuRlkKsXs0kdilm+g6gATB2F0Zh86clEnRmThDZM7AKmgjFFCzYgpo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1juBHs-0004QQ-LS
 for xen-changelog@lists.xenproject.org; Sat, 11 Jul 2020 08:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1juBHs-0004kJ-K5
 for xen-changelog@lists.xenproject.org; Sat, 11 Jul 2020 08:55:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] pvcalls: Document correctly and explicitely the padding
 for all arches
Message-Id: <E1juBHs-0004kJ-K5@xenbits.xenproject.org>
Date: Sat, 11 Jul 2020 08:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 02d69864b51a4302a148c28d6d391238a6778b4b
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sat Jun 27 10:55:33 2020 +0100
Commit:     Stefano Stabellini <sstabellini@kernel.org>
CommitDate: Fri Jul 10 09:52:24 2020 -0700

    pvcalls: Document correctly and explicitely the padding for all arches
    
    The specification of pvcalls suggests there is padding for 32-bit x86 at
    the end of most the structure. However, they are not described in in the
    public header.
    
    Because of that all the structures would have a different size between
    32-bit x86 and 64-bit x86.
    
    For all the other architectures supported (Arm and 64-bit x86), the
    structure have the sames sizes because they contain implicit padding
    thanks to the 64-bit alignment of the field uint64_t field.
    
    Given the specification is authoritative, the padding will now be the
    same for all architectures. The potential breakage of compatibility is
    ought to be fine as pvcalls is still a tech preview.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Release-acked-by: Paul Durrant <paul@xen.org>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
---
 docs/misc/pvcalls.pandoc        | 8 --------
 xen/include/public/io/pvcalls.h | 4 ++++
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/docs/misc/pvcalls.pandoc b/docs/misc/pvcalls.pandoc
index 665dad556c..971cd8f4b1 100644
--- a/docs/misc/pvcalls.pandoc
+++ b/docs/misc/pvcalls.pandoc
@@ -246,9 +246,7 @@ The format is defined as follows:
     			uint32_t domain;
     			uint32_t type;
     			uint32_t protocol;
-    			#ifdef CONFIG_X86_32
     			uint8_t pad[4];
-    			#endif
     		} socket;
     		struct xen_pvcalls_connect {
     			uint64_t id;
@@ -257,16 +255,12 @@ The format is defined as follows:
     			uint32_t flags;
     			grant_ref_t ref;
     			uint32_t evtchn;
-    			#ifdef CONFIG_X86_32
     			uint8_t pad[4];
-    			#endif
     		} connect;
     		struct xen_pvcalls_release {
     			uint64_t id;
     			uint8_t reuse;
-    			#ifdef CONFIG_X86_32
     			uint8_t pad[7];
-    			#endif
     		} release;
     		struct xen_pvcalls_bind {
     			uint64_t id;
@@ -276,9 +270,7 @@ The format is defined as follows:
     		struct xen_pvcalls_listen {
     			uint64_t id;
     			uint32_t backlog;
-    			#ifdef CONFIG_X86_32
     			uint8_t pad[4];
-    			#endif
     		} listen;
     		struct xen_pvcalls_accept {
     			uint64_t id;
diff --git a/xen/include/public/io/pvcalls.h b/xen/include/public/io/pvcalls.h
index 905880735d..6da6b5533a 100644
--- a/xen/include/public/io/pvcalls.h
+++ b/xen/include/public/io/pvcalls.h
@@ -68,6 +68,7 @@ struct xen_pvcalls_request {
             uint32_t domain;
             uint32_t type;
             uint32_t protocol;
+            uint8_t pad[4];
         } socket;
         struct xen_pvcalls_connect {
             uint64_t id;
@@ -76,10 +77,12 @@ struct xen_pvcalls_request {
             uint32_t flags;
             grant_ref_t ref;
             uint32_t evtchn;
+            uint8_t pad[4];
         } connect;
         struct xen_pvcalls_release {
             uint64_t id;
             uint8_t reuse;
+            uint8_t pad[7];
         } release;
         struct xen_pvcalls_bind {
             uint64_t id;
@@ -89,6 +92,7 @@ struct xen_pvcalls_request {
         struct xen_pvcalls_listen {
             uint64_t id;
             uint32_t backlog;
+            uint8_t pad[4];
         } listen;
         struct xen_pvcalls_accept {
             uint64_t id;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jul 13 14:00:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 13 Jul 2020 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 1juz05-0002Vv-DN; Mon, 13 Jul 2020 14:00:09 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Vr3V=AY=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1juz03-0002VP-OT
 for xen-changelog@lists.xenproject.org; Mon, 13 Jul 2020 14:00:07 +0000
X-Inumbo-ID: 277b190e-c511-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 277b190e-c511-11ea-bb8b-bc764e2007e4;
 Mon, 13 Jul 2020 14:00:06 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=+zriT5f4lD34ZWlagLsaT/+aqqz24eoN9tctwpMicUU=; b=0w+TAQK6/z6wgTggUge7yta20m
 SWn1Xxzb2maF2scAblHcsHUCPTvDSTY8aMyeVlSJ2bqkB3A34gb9KYdkGyrJ4yd3WdquEglMJeXbc
 HUfmACsNooN+uPsSDqttjsel/kY6rzYnLE+X7q/+CWeB0g2H8Zmy+jDgHX39+iZ7NvuA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1juz01-0006xC-El
 for xen-changelog@lists.xenproject.org; Mon, 13 Jul 2020 14:00:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1juz01-0001R3-Cy
 for xen-changelog@lists.xenproject.org; Mon, 13 Jul 2020 14:00:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] Branch Xen 4.15: Change version numbers
Message-Id: <E1juz01-0001R3-Cy@xenbits.xenproject.org>
Date: Mon, 13 Jul 2020 14:00:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 3df0424e69549ca21613fad3654509c35b2a3e94
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Mon Jul 13 14:50:06 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jul 13 14:50:06 2020 +0100

    Branch Xen 4.15: Change version numbers
    
    And rerun autogen.sh.  No changes other than to versions.
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 README            | 10 +++++-----
 SUPPORT.md        |  2 +-
 configure         | 18 +++++++++---------
 docs/configure    | 18 +++++++++---------
 stubdom/configure | 18 +++++++++---------
 tools/configure   | 18 +++++++++---------
 xen/Makefile      |  4 ++--
 7 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/README b/README
index 46c67d8906..0e4787c1a6 100644
--- a/README
+++ b/README
@@ -1,9 +1,9 @@
 #################################
- _  _    _ _  _
-| || |  / | || |        _ __ ___
-| || |_ | | || |_ _____| '__/ __|
-|__   _|| |__   _|_____| | | (__
-   |_|(_)_|  |_|       |_|  \___|
+ _  _    _ ____                        _        _     _
+| || |  / | ___|       _   _ _ __  ___| |_ __ _| |__ | | ___
+| || |_ | |___ \ _____| | | | '_ \/ __| __/ _` | '_ \| |/ _ \
+|__   _|| |___) |_____| |_| | | | \__ \ || (_| | |_) | |  __/
+   |_|(_)_|____/       \__,_|_| |_|___/\__\__,_|_.__/|_|\___|
 
 #################################
 
diff --git a/SUPPORT.md b/SUPPORT.md
index 643879f0ea..b81d36eea5 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -9,7 +9,7 @@ for the definitions of the support status levels etc.
 
 # Release Support
 
-    Xen-Version: 4.14-rc
+    Xen-Version: 4.15-unstable
     Initial-Release: n/a
     Supported-Until: TBD
     Security-Support-Until: Unreleased - not yet security-supported
diff --git a/configure b/configure
index 9da3970cef..741e54bf2a 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Xen Hypervisor 4.14.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor 4.15.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.14'
-PACKAGE_STRING='Xen Hypervisor 4.14'
+PACKAGE_VERSION='4.15'
+PACKAGE_STRING='Xen Hypervisor 4.15'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1235,7 +1235,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor 4.14 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor 4.15 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1301,7 +1301,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor 4.14:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor 4.15:";;
    esac
   cat <<\_ACEOF
 
@@ -1399,7 +1399,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor configure 4.14
+Xen Hypervisor configure 4.15
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1416,7 +1416,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor $as_me 4.14, which was
+It was created by Xen Hypervisor $as_me 4.15, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2856,7 +2856,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor $as_me 4.14, which was
+This file was extended by Xen Hypervisor $as_me 4.15, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -2910,7 +2910,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor config.status 4.14
+Xen Hypervisor config.status 4.15
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/docs/configure b/docs/configure
index 9e3ed60462..f55268564e 100755
--- a/docs/configure
+++ b/docs/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Xen Hypervisor Documentation 4.14.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor Documentation 4.15.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Documentation'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.14'
-PACKAGE_STRING='Xen Hypervisor Documentation 4.14'
+PACKAGE_VERSION='4.15'
+PACKAGE_STRING='Xen Hypervisor Documentation 4.15'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1223,7 +1223,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor Documentation 4.14 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Documentation 4.15 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1285,7 +1285,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Documentation 4.14:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Documentation 4.15:";;
    esac
   cat <<\_ACEOF
 
@@ -1383,7 +1383,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Documentation configure 4.14
+Xen Hypervisor Documentation configure 4.15
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1400,7 +1400,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor Documentation $as_me 4.14, which was
+It was created by Xen Hypervisor Documentation $as_me 4.15, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2809,7 +2809,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor Documentation $as_me 4.14, which was
+This file was extended by Xen Hypervisor Documentation $as_me 4.15, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -2863,7 +2863,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor Documentation config.status 4.14
+Xen Hypervisor Documentation config.status 4.15
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/stubdom/configure b/stubdom/configure
index da03da535a..3668203db8 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Xen Hypervisor Stub Domains 4.14.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor Stub Domains 4.15.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Stub Domains'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.14'
-PACKAGE_STRING='Xen Hypervisor Stub Domains 4.14'
+PACKAGE_VERSION='4.15'
+PACKAGE_STRING='Xen Hypervisor Stub Domains 4.15'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1263,7 +1263,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor Stub Domains 4.14 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Stub Domains 4.15 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1329,7 +1329,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Stub Domains 4.14:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Stub Domains 4.15:";;
    esac
   cat <<\_ACEOF
 
@@ -1439,7 +1439,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Stub Domains configure 4.14
+Xen Hypervisor Stub Domains configure 4.15
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1494,7 +1494,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor Stub Domains $as_me 4.14, which was
+It was created by Xen Hypervisor Stub Domains $as_me 4.15, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -4248,7 +4248,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor Stub Domains $as_me 4.14, which was
+This file was extended by Xen Hypervisor Stub Domains $as_me 4.15, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -4302,7 +4302,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor Stub Domains config.status 4.14
+Xen Hypervisor Stub Domains config.status 4.15
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/tools/configure b/tools/configure
index f3f19c1a90..dd9fb8fb6a 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Xen Hypervisor Tools 4.14.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor Tools 4.15.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Tools'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.14'
-PACKAGE_STRING='Xen Hypervisor Tools 4.14'
+PACKAGE_VERSION='4.15'
+PACKAGE_STRING='Xen Hypervisor Tools 4.15'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1412,7 +1412,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor Tools 4.14 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Tools 4.15 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1478,7 +1478,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Tools 4.14:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Tools 4.15:";;
    esac
   cat <<\_ACEOF
 
@@ -1682,7 +1682,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Tools configure 4.14
+Xen Hypervisor Tools configure 4.15
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2097,7 +2097,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor Tools $as_me 4.14, which was
+It was created by Xen Hypervisor Tools $as_me 4.15, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -10529,7 +10529,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor Tools $as_me 4.14, which was
+This file was extended by Xen Hypervisor Tools $as_me 4.15, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -10592,7 +10592,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor Tools config.status 4.14
+Xen Hypervisor Tools config.status 4.15
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/xen/Makefile b/xen/Makefile
index 2f3f8b9deb..a87bb225dc 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -1,8 +1,8 @@
 # This is the correct place to edit the build version.
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
-export XEN_SUBVERSION    = 14
-export XEN_EXTRAVERSION ?= .0-rc$(XEN_VENDORVERSION)
+export XEN_SUBVERSION    = 15
+export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jul 13 14:00:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 13 Jul 2020 14:00:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1juz0D-0002WO-F5; Mon, 13 Jul 2020 14:00:17 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Vr3V=AY=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1juz0C-0002W2-5A
 for xen-changelog@lists.xenproject.org; Mon, 13 Jul 2020 14:00:16 +0000
X-Inumbo-ID: 2d7c78ca-c511-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2d7c78ca-c511-11ea-b7bb-bc764e2007e4;
 Mon, 13 Jul 2020 14:00:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=vxd32Rs/s97/9cCEVkEN8E1XLKVjyehJUK0rXlXPGpg=; b=jqkJwDsJU4caKmt1xDZBMpQLKW
 aingdy5meRs0ZkIujwk3Q8Cb+6yMogicxlfzQuB6AF2Ep1R/jyzF+UWaxl3wN+VHX/mS6YbV2qAyR
 2/qDF7O+o9W4hoS7DKkVXZZZrranYQj9g6Q3gf/N1O9PLmXI1CZyqUL6FVLAmtEGmBW0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1juz0B-0006xt-Ia
 for xen-changelog@lists.xenproject.org; Mon, 13 Jul 2020 14:00:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1juz0B-0001T1-HB
 for xen-changelog@lists.xenproject.org; Mon, 13 Jul 2020 14:00:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] Config.mk: Unnail versions (for unstable branch)
Message-Id: <E1juz0B-0001T1-HB@xenbits.xenproject.org>
Date: Mon, 13 Jul 2020 14:00:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 165f3afbfc3db70fcfdccad07085cde0a03c858b
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Mon Jul 13 14:50:33 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jul 13 14:50:33 2020 +0100

    Config.mk: Unnail versions (for unstable branch)
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Config.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Config.mk b/Config.mk
index 478928c178..7d556aed30 100644
--- a/Config.mk
+++ b/Config.mk
@@ -245,8 +245,8 @@ 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 ?= ea6d3cd1ed79d824e605a70c3626bc437c386260
-MINIOS_UPSTREAM_REVISION ?= f57858b7e8ef8dd48394dd08cec2bef3c9fb92f5
+QEMU_UPSTREAM_REVISION ?= master
+MINIOS_UPSTREAM_REVISION ?= master
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.13.0
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jul 13 14:00:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 13 Jul 2020 14:00: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 1juz0O-0002XS-Go; Mon, 13 Jul 2020 14:00:28 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Vr3V=AY=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1juz0M-0002XD-U6
 for xen-changelog@lists.xenproject.org; Mon, 13 Jul 2020 14:00:26 +0000
X-Inumbo-ID: 33ed3370-c511-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 33ed3370-c511-11ea-bb8b-bc764e2007e4;
 Mon, 13 Jul 2020 14:00:26 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=5rWJljr+YCfHvf/0mFEkj5fX7qqvsFX+I89hkFTed0g=; b=BbBanzoITTKPtLNDkkW+sMMhav
 Ju9EIxo4SmdJTk4GbDtOW50LwPtvMQtipg8aXKpOhhFViQArjqmB57LgOpnHvumrSTEAtK35yBhkz
 /SFfvaSLq06/wsD2TvRw/+djAS0k6KtTaB25Ebqz4GU1vh9XNOrWFHFL75HGp7F7BEvc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1juz0M-0006y1-Ce
 for xen-changelog@lists.xenproject.org; Mon, 13 Jul 2020 14:00:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1juz0M-0001UB-Bf
 for xen-changelog@lists.xenproject.org; Mon, 13 Jul 2020 14:00:26 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.14] SUPPORT.md: Set release notes link
Message-Id: <E1juz0M-0001UB-Bf@xenbits.xenproject.org>
Date: Mon, 13 Jul 2020 14:00:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a3d142a40cbc570184a546d30598d3bc0402bfb7
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Mon Jul 13 14:56:48 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jul 13 14:56:48 2020 +0100

    SUPPORT.md: Set release notes link
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 SUPPORT.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 643879f0ea..7fa7e91b26 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -15,7 +15,7 @@ for the definitions of the support status levels etc.
     Security-Support-Until: Unreleased - not yet security-supported
 
 Release Notes
-: <a href="https://wiki.xenproject.org/wiki/Xen_Project_X.YY_Release_Notes">RN</a>
+: <a href="https://wiki.xenproject.org/wiki/Xen_Project_4.14_Release_Notes">RN</a>
 
 # Feature Support
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Mon Jul 13 14:00:38 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 13 Jul 2020 14:00: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 1juz0Y-0002YY-IP; Mon, 13 Jul 2020 14:00:38 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Vr3V=AY=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1juz0X-0002YI-3k
 for xen-changelog@lists.xenproject.org; Mon, 13 Jul 2020 14:00:37 +0000
X-Inumbo-ID: 39f937d2-c511-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 39f937d2-c511-11ea-b7bb-bc764e2007e4;
 Mon, 13 Jul 2020 14:00:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=HTNcpS24rtbR90hGeq9Zjopton/7MnIwweZfIUMFVNs=; b=E7kXl8dzxUAvHUUJ6UMbWQ2tRn
 kixT1h83miZAUJWsBmP0HEMU4nIOLyZWIZVOhPIPmmu6yHfHjc2AYqNfCjtktYhtZqAuycZtp2eAr
 ImtPXKpoFKESMGO8tnrfY1OKbmn8N7vKW8+cH4RpqY77P5VITK6nO3v9g8alj4+NaXQc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1juz0W-0006yD-Gs
 for xen-changelog@lists.xenproject.org; Mon, 13 Jul 2020 14:00:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1juz0W-0001Ul-Eq
 for xen-changelog@lists.xenproject.org; Mon, 13 Jul 2020 14:00:36 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.14] Branch 4.14: Turn off debug on this stable branch
Message-Id: <E1juz0W-0001Ul-Eq@xenbits.xenproject.org>
Date: Mon, 13 Jul 2020 14:00:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ce3c4493e4e6c94495ddd8538e801a35980bff0d
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Mon Jul 13 14:57:37 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jul 13 14:57:37 2020 +0100

    Branch 4.14: Turn off debug on this stable branch
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/Rules.mk    | 2 +-
 xen/Kconfig.debug | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

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


From xen-changelog-bounces@lists.xenproject.org Tue Jul 14 08:11:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Jul 2020 08:11: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 1jvG1r-0004HK-2k; Tue, 14 Jul 2020 08:11:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=K3Tl=AZ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jvG1p-0004HF-Qw
 for xen-changelog@lists.xenproject.org; Tue, 14 Jul 2020 08:11:05 +0000
X-Inumbo-ID: 903c85d4-c5a9-11ea-92f0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 903c85d4-c5a9-11ea-92f0-12813bfff9fa;
 Tue, 14 Jul 2020 08:11:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Gzk7qdb/QD+j+1WYoqpQGN7+dx07GkILVfED8ZRpUAM=; b=fy2md79KM875xD4q3sN8nxtdnM
 8lZdEIMvfiQkxkVYhgrsFAkixMtnZzJk8BS8fYLwmhUZC7M0ROfykbaEnkQz1J7ZNbyCAZBpmNwro
 /YBF2obDfQgbVzWFls0ca5yZGHZKRoONKKLHvDA+WNUy9FDA7XYffKajbpzBzNxyiuLE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jvG1o-0007wp-Ml
 for xen-changelog@lists.xenproject.org; Tue, 14 Jul 2020 08:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jvG1o-0004O3-KF
 for xen-changelog@lists.xenproject.org; Tue, 14 Jul 2020 08:11:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/mwait: remove unneeded local variables
Message-Id: <E1jvG1o-0004O3-KF@xenbits.xenproject.org>
Date: Tue, 14 Jul 2020 08:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit f36f4bf582d353d8424154b14b663b075a0276e3
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 14 09:57:17 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 14 09:57:17 2020 +0200

    x86/mwait: remove unneeded local variables
    
    Remove the eax and cstate local variables, the same can be directly
    fetched from acpi_processor_cx without any transformations.
    
    No functional change.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/mwait-idle.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 52eab81bf8..8add13d698 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -721,7 +721,7 @@ static void mwait_idle(void)
 	unsigned int cpu = smp_processor_id();
 	struct acpi_processor_power *power = processor_powers[cpu];
 	struct acpi_processor_cx *cx = NULL;
-	unsigned int eax, next_state, cstate;
+	unsigned int next_state;
 	u64 before, after;
 	u32 exp = 0, pred = 0, irq_traced[4] = { 0 };
 
@@ -773,9 +773,6 @@ static void mwait_idle(void)
 	if ((cx->type >= 3) && errata_c6_workaround())
 		cx = power->safe_state;
 
-	eax = cx->address;
-	cstate = ((eax >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) + 1;
-
 #if 0 /* XXX Can we/do we need to do something similar on Xen? */
 	/*
 	 * leave_mm() to avoid costly and often unnecessary wakeups
@@ -785,7 +782,7 @@ static void mwait_idle(void)
 		leave_mm(cpu);
 #endif
 
-	if (!(lapic_timer_reliable_states & (1 << cstate)))
+	if (!(lapic_timer_reliable_states & (1 << cx->type)))
 		lapic_timer_off();
 
 	before = alternative_call(cpuidle_get_tick);
@@ -794,7 +791,7 @@ static void mwait_idle(void)
 	update_last_cx_stat(power, cx, before);
 
 	if (cpu_is_haltable(cpu))
-		mwait_idle_with_hints(eax, MWAIT_ECX_INTERRUPT_BREAK);
+		mwait_idle_with_hints(cx->address, MWAIT_ECX_INTERRUPT_BREAK);
 
 	after = alternative_call(cpuidle_get_tick);
 
@@ -807,7 +804,7 @@ static void mwait_idle(void)
 	update_idle_stats(power, cx, before, after);
 	local_irq_enable();
 
-	if (!(lapic_timer_reliable_states & (1 << cstate)))
+	if (!(lapic_timer_reliable_states & (1 << cx->type)))
 		lapic_timer_on();
 
 	rcu_idle_exit(cpu);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 14 08:11:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Jul 2020 08: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 1jvG20-0004I6-5d; Tue, 14 Jul 2020 08:11:16 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=K3Tl=AZ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jvG1z-0004I0-9J
 for xen-changelog@lists.xenproject.org; Tue, 14 Jul 2020 08:11:15 +0000
X-Inumbo-ID: 96439850-c5a9-11ea-92f0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 96439850-c5a9-11ea-92f0-12813bfff9fa;
 Tue, 14 Jul 2020 08:11:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=sNVoM06o1Es6FANxji1sAuAizNpM4AxwvVNNEHZYvKY=; b=iwJNAhHlld+rZqGwQEUsIPvJcl
 hGmJ4OKbd247A2wIeH+btjb+cBuzRSUHYUkgPL0tClLDUYH/Cyi1qKomtKFjnLxaLIfs+LK+QPiYA
 Ua97L/0QMo3jv2QHPKnN4X28Eg+8W9z2EjcfBfbq2+V25OQYejgIVFwlx1T3eTH4f1II=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jvG1y-0007x3-Qz
 for xen-changelog@lists.xenproject.org; Tue, 14 Jul 2020 08:11:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jvG1y-0004Oy-P5
 for xen-changelog@lists.xenproject.org; Tue, 14 Jul 2020 08:11:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] VT-x: simplify/clarify vmx_load_pdptrs()
Message-Id: <E1jvG1y-0004Oy-P5@xenbits.xenproject.org>
Date: Tue, 14 Jul 2020 08:11:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 1969576661f3e34318e9b0a61a1a38f9a5aee16f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 14 10:00:45 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 14 10:00:45 2020 +0200

    VT-x: simplify/clarify vmx_load_pdptrs()
    
    * Guests outside of long mode can't have PCID enabled. Drop the
      respective check to make more obvious that there's no security issue
      (from potentially accessing past the mapped page's boundary).
    
    * Only bits 5...31 of CR3 are relevant in 32-bit PAE mode; all others
      are ignored. The high 32 ones may in particular have remained
      unchanged after leaving long mode.
    
    * Drop the unnecessary and badly typed local variable p.
    
    * Don't open-code hvm_long_mode_active() (and extend this to the related
      nested VT-x code).
    
    * Constify guest_pdptes to clarify that we're only reading from the
      page.
    
    * Drop the "crash" label now that there's only a single path leading
      there.
    
    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/hvm/vmx/vmx.c  | 24 ++++++++----------------
 xen/arch/x86/hvm/vmx/vvmx.c |  4 ++--
 2 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index cc6d4ece22..eb54aadfba 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1312,19 +1312,15 @@ static void vmx_set_interrupt_shadow(struct vcpu *v, unsigned int intr_shadow)
 
 static void vmx_load_pdptrs(struct vcpu *v)
 {
-    unsigned long cr3 = v->arch.hvm.guest_cr[3];
-    uint64_t *guest_pdptes;
+    uint32_t cr3 = v->arch.hvm.guest_cr[3];
+    const uint64_t *guest_pdptes;
     struct page_info *page;
     p2m_type_t p2mt;
-    char *p;
 
     /* EPT needs to load PDPTRS into VMCS for PAE. */
-    if ( !hvm_pae_enabled(v) || (v->arch.hvm.guest_efer & EFER_LMA) )
+    if ( !hvm_pae_enabled(v) || hvm_long_mode_active(v) )
         return;
 
-    if ( (cr3 & 0x1fUL) && !hvm_pcid_enabled(v) )
-        goto crash;
-
     page = get_page_from_gfn(v->domain, cr3 >> PAGE_SHIFT, &p2mt, P2M_ALLOC);
     if ( !page )
     {
@@ -1332,14 +1328,13 @@ static void vmx_load_pdptrs(struct vcpu *v)
          * queue, but this is the wrong place. We're holding at least
          * the paging lock */
         gdprintk(XENLOG_ERR,
-                 "Bad cr3 on load pdptrs gfn %lx type %d\n",
+                 "Bad cr3 on load pdptrs gfn %"PRIx32" type %d\n",
                  cr3 >> PAGE_SHIFT, (int) p2mt);
-        goto crash;
+        domain_crash(v->domain);
+        return;
     }
 
-    p = __map_domain_page(page);
-
-    guest_pdptes = (uint64_t *)(p + (cr3 & ~PAGE_MASK));
+    guest_pdptes = __map_domain_page(page) + (cr3 & ~(PAGE_MASK | 0x1f));
 
     /*
      * We do not check the PDPTRs for validity. The CPU will do this during
@@ -1356,12 +1351,9 @@ static void vmx_load_pdptrs(struct vcpu *v)
 
     vmx_vmcs_exit(v);
 
-    unmap_domain_page(p);
+    unmap_domain_page(guest_pdptes);
     put_page(page);
     return;
-
- crash:
-    domain_crash(v->domain);
 }
 
 static void vmx_update_host_cr3(struct vcpu *v)
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 7dfff6c445..1e51689ef3 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -1234,7 +1234,7 @@ static void virtual_vmentry(struct cpu_user_regs *regs)
         paging_update_paging_modes(v);
 
     if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
-         !(v->arch.hvm.guest_efer & EFER_LMA) )
+         !hvm_long_mode_active(v) )
         vvmcs_to_shadow_bulk(v, ARRAY_SIZE(gpdpte_fields), gpdpte_fields);
 
     regs->rip = get_vvmcs(v, GUEST_RIP);
@@ -1437,7 +1437,7 @@ static void virtual_vmexit(struct cpu_user_regs *regs)
     sync_exception_state(v);
 
     if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
-         !(v->arch.hvm.guest_efer & EFER_LMA) )
+         !hvm_long_mode_active(v) )
         shadow_to_vvmcs_bulk(v, ARRAY_SIZE(gpdpte_fields), gpdpte_fields);
 
     /* This will clear current pCPU bit in p2m->dirty_cpumask */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jul 15 00:55:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Jul 2020 00:55: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 1jvVhQ-0006Ik-HQ; Wed, 15 Jul 2020 00:55:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=UlVl=A2=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jvVhQ-0006Ie-5S
 for xen-changelog@lists.xenproject.org; Wed, 15 Jul 2020 00:55:04 +0000
X-Inumbo-ID: d0ccec92-c635-11ea-b7bb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id d0ccec92-c635-11ea-b7bb-bc764e2007e4;
 Wed, 15 Jul 2020 00:55:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=myncLgAFR6sztHaftzm6j7pNiOYG5se5wEziz+ug1Us=; b=5zybGuzDDwHR8rtMHmQH4/Drdc
 5gtXbhw2LyTOavl3gTY+BKe5AUi3mGmQtgmSl1ZAGuCCpybtami87hV8N35zmnI+6DpPiFDSDwzY1
 X4T4M+DMgoHkdaKwdSfAplxFyeysNqie0mjtdd57jxU2rZI6i+aFghV0ipCxsGKO2d+Y=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jvVhO-0004Ur-Jk
 for xen-changelog@lists.xenproject.org; Wed, 15 Jul 2020 00:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jvVhO-0005cq-I7
 for xen-changelog@lists.xenproject.org; Wed, 15 Jul 2020 00:55:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] Branch Xen 4.15: Change version numbers
Message-Id: <E1jvVhO-0005cq-I7@xenbits.xenproject.org>
Date: Wed, 15 Jul 2020 00:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 3df0424e69549ca21613fad3654509c35b2a3e94
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Mon Jul 13 14:50:06 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jul 13 14:50:06 2020 +0100

    Branch Xen 4.15: Change version numbers
    
    And rerun autogen.sh.  No changes other than to versions.
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 README            | 10 +++++-----
 SUPPORT.md        |  2 +-
 configure         | 18 +++++++++---------
 docs/configure    | 18 +++++++++---------
 stubdom/configure | 18 +++++++++---------
 tools/configure   | 18 +++++++++---------
 xen/Makefile      |  4 ++--
 7 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/README b/README
index 46c67d8906..0e4787c1a6 100644
--- a/README
+++ b/README
@@ -1,9 +1,9 @@
 #################################
- _  _    _ _  _
-| || |  / | || |        _ __ ___
-| || |_ | | || |_ _____| '__/ __|
-|__   _|| |__   _|_____| | | (__
-   |_|(_)_|  |_|       |_|  \___|
+ _  _    _ ____                        _        _     _
+| || |  / | ___|       _   _ _ __  ___| |_ __ _| |__ | | ___
+| || |_ | |___ \ _____| | | | '_ \/ __| __/ _` | '_ \| |/ _ \
+|__   _|| |___) |_____| |_| | | | \__ \ || (_| | |_) | |  __/
+   |_|(_)_|____/       \__,_|_| |_|___/\__\__,_|_.__/|_|\___|
 
 #################################
 
diff --git a/SUPPORT.md b/SUPPORT.md
index 643879f0ea..b81d36eea5 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -9,7 +9,7 @@ for the definitions of the support status levels etc.
 
 # Release Support
 
-    Xen-Version: 4.14-rc
+    Xen-Version: 4.15-unstable
     Initial-Release: n/a
     Supported-Until: TBD
     Security-Support-Until: Unreleased - not yet security-supported
diff --git a/configure b/configure
index 9da3970cef..741e54bf2a 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Xen Hypervisor 4.14.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor 4.15.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.14'
-PACKAGE_STRING='Xen Hypervisor 4.14'
+PACKAGE_VERSION='4.15'
+PACKAGE_STRING='Xen Hypervisor 4.15'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1235,7 +1235,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor 4.14 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor 4.15 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1301,7 +1301,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor 4.14:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor 4.15:";;
    esac
   cat <<\_ACEOF
 
@@ -1399,7 +1399,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor configure 4.14
+Xen Hypervisor configure 4.15
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1416,7 +1416,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor $as_me 4.14, which was
+It was created by Xen Hypervisor $as_me 4.15, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2856,7 +2856,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor $as_me 4.14, which was
+This file was extended by Xen Hypervisor $as_me 4.15, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -2910,7 +2910,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor config.status 4.14
+Xen Hypervisor config.status 4.15
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/docs/configure b/docs/configure
index 9e3ed60462..f55268564e 100755
--- a/docs/configure
+++ b/docs/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Xen Hypervisor Documentation 4.14.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor Documentation 4.15.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Documentation'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.14'
-PACKAGE_STRING='Xen Hypervisor Documentation 4.14'
+PACKAGE_VERSION='4.15'
+PACKAGE_STRING='Xen Hypervisor Documentation 4.15'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1223,7 +1223,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor Documentation 4.14 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Documentation 4.15 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1285,7 +1285,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Documentation 4.14:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Documentation 4.15:";;
    esac
   cat <<\_ACEOF
 
@@ -1383,7 +1383,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Documentation configure 4.14
+Xen Hypervisor Documentation configure 4.15
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1400,7 +1400,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor Documentation $as_me 4.14, which was
+It was created by Xen Hypervisor Documentation $as_me 4.15, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2809,7 +2809,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor Documentation $as_me 4.14, which was
+This file was extended by Xen Hypervisor Documentation $as_me 4.15, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -2863,7 +2863,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor Documentation config.status 4.14
+Xen Hypervisor Documentation config.status 4.15
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/stubdom/configure b/stubdom/configure
index da03da535a..3668203db8 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Xen Hypervisor Stub Domains 4.14.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor Stub Domains 4.15.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -579,8 +579,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Stub Domains'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.14'
-PACKAGE_STRING='Xen Hypervisor Stub Domains 4.14'
+PACKAGE_VERSION='4.15'
+PACKAGE_STRING='Xen Hypervisor Stub Domains 4.15'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1263,7 +1263,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor Stub Domains 4.14 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Stub Domains 4.15 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1329,7 +1329,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Stub Domains 4.14:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Stub Domains 4.15:";;
    esac
   cat <<\_ACEOF
 
@@ -1439,7 +1439,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Stub Domains configure 4.14
+Xen Hypervisor Stub Domains configure 4.15
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1494,7 +1494,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor Stub Domains $as_me 4.14, which was
+It was created by Xen Hypervisor Stub Domains $as_me 4.15, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -4248,7 +4248,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor Stub Domains $as_me 4.14, which was
+This file was extended by Xen Hypervisor Stub Domains $as_me 4.15, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -4302,7 +4302,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor Stub Domains config.status 4.14
+Xen Hypervisor Stub Domains config.status 4.15
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/tools/configure b/tools/configure
index f3f19c1a90..dd9fb8fb6a 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Xen Hypervisor Tools 4.14.
+# Generated by GNU Autoconf 2.69 for Xen Hypervisor Tools 4.15.
 #
 # Report bugs to <xen-devel@lists.xen.org>.
 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='Xen Hypervisor Tools'
 PACKAGE_TARNAME='xen'
-PACKAGE_VERSION='4.14'
-PACKAGE_STRING='Xen Hypervisor Tools 4.14'
+PACKAGE_VERSION='4.15'
+PACKAGE_STRING='Xen Hypervisor Tools 4.15'
 PACKAGE_BUGREPORT='xen-devel@lists.xen.org'
 PACKAGE_URL='https://www.xen.org/'
 
@@ -1412,7 +1412,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Xen Hypervisor Tools 4.14 to adapt to many kinds of systems.
+\`configure' configures Xen Hypervisor Tools 4.15 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1478,7 +1478,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Xen Hypervisor Tools 4.14:";;
+     short | recursive ) echo "Configuration of Xen Hypervisor Tools 4.15:";;
    esac
   cat <<\_ACEOF
 
@@ -1682,7 +1682,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Xen Hypervisor Tools configure 4.14
+Xen Hypervisor Tools configure 4.15
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2097,7 +2097,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by Xen Hypervisor Tools $as_me 4.14, which was
+It was created by Xen Hypervisor Tools $as_me 4.15, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -10529,7 +10529,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Xen Hypervisor Tools $as_me 4.14, which was
+This file was extended by Xen Hypervisor Tools $as_me 4.15, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -10592,7 +10592,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Xen Hypervisor Tools config.status 4.14
+Xen Hypervisor Tools config.status 4.15
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/xen/Makefile b/xen/Makefile
index 2f3f8b9deb..a87bb225dc 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -1,8 +1,8 @@
 # This is the correct place to edit the build version.
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
-export XEN_SUBVERSION    = 14
-export XEN_EXTRAVERSION ?= .0-rc$(XEN_VENDORVERSION)
+export XEN_SUBVERSION    = 15
+export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 15 00:55:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Jul 2020 00:55:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jvVhb-0006Jg-J3; Wed, 15 Jul 2020 00:55:15 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=UlVl=A2=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jvVha-0006JV-Nb
 for xen-changelog@lists.xenproject.org; Wed, 15 Jul 2020 00:55:14 +0000
X-Inumbo-ID: d6d25596-c635-11ea-937f-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id d6d25596-c635-11ea-937f-12813bfff9fa;
 Wed, 15 Jul 2020 00:55:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=I75uq7GDkRCnhBin7A6hjVN/n9m2l1/ReqA7u7fV29U=; b=YaX72B5ssOW+bkFa4T7vr8xcIg
 w9SO8sYfwTEyMBJPssh/G+aLujdn+vAK68oS/F9VZm/Kk4Zb4TtLR65GSQEqRFx57L98X6J/4INN5
 LrnKhY5Z2hSLSPQX8PhEzxExJjy+WEhZJhvRYBo3ReBUlC0EH8sk2ei37sjiBGzn4kps=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jvVhY-0004Vb-NZ
 for xen-changelog@lists.xenproject.org; Wed, 15 Jul 2020 00:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jvVhY-0005dU-Ll
 for xen-changelog@lists.xenproject.org; Wed, 15 Jul 2020 00:55:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] Config.mk: Unnail versions (for unstable branch)
Message-Id: <E1jvVhY-0005dU-Ll@xenbits.xenproject.org>
Date: Wed, 15 Jul 2020 00:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 165f3afbfc3db70fcfdccad07085cde0a03c858b
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Mon Jul 13 14:50:33 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jul 13 14:50:33 2020 +0100

    Config.mk: Unnail versions (for unstable branch)
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Config.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Config.mk b/Config.mk
index 478928c178..7d556aed30 100644
--- a/Config.mk
+++ b/Config.mk
@@ -245,8 +245,8 @@ 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 ?= ea6d3cd1ed79d824e605a70c3626bc437c386260
-MINIOS_UPSTREAM_REVISION ?= f57858b7e8ef8dd48394dd08cec2bef3c9fb92f5
+QEMU_UPSTREAM_REVISION ?= master
+MINIOS_UPSTREAM_REVISION ?= master
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.13.0
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 15 08:55:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Jul 2020 08:55: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 1jvdBx-0007J6-I1; Wed, 15 Jul 2020 08:55:05 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=UlVl=A2=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jvdBv-0007J1-RP
 for xen-changelog@lists.xenproject.org; Wed, 15 Jul 2020 08:55:03 +0000
X-Inumbo-ID: ded07bea-c678-11ea-93a3-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ded07bea-c678-11ea-93a3-12813bfff9fa;
 Wed, 15 Jul 2020 08:55:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=dDe8m5Ru/wNCOslOHJLLdaQaZaJ3vY0GFDatr1xOZXU=; b=4BNxBtvsQ3oujhuZTgkqfHmK08
 X+rCtbGBmgv3h7jv1kB60lFnecvBqzzauFYm+z56kTjy5+C5HhzIlDImeZYFzlJNboGrvIoD+89NU
 Hrlz0ThOgaWAxyDDxnsx6KkknLdCx1kByIurOna3An4AKtDXOucNJUisJf5wXG/CfSHo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jvdBu-0000OF-CJ
 for xen-changelog@lists.xenproject.org; Wed, 15 Jul 2020 08:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jvdBu-00079p-BM
 for xen-changelog@lists.xenproject.org; Wed, 15 Jul 2020 08:55:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.14] SUPPORT.md: Set release notes link
Message-Id: <E1jvdBu-00079p-BM@xenbits.xenproject.org>
Date: Wed, 15 Jul 2020 08:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a3d142a40cbc570184a546d30598d3bc0402bfb7
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Mon Jul 13 14:56:48 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jul 13 14:56:48 2020 +0100

    SUPPORT.md: Set release notes link
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 SUPPORT.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 643879f0ea..7fa7e91b26 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -15,7 +15,7 @@ for the definitions of the support status levels etc.
     Security-Support-Until: Unreleased - not yet security-supported
 
 Release Notes
-: <a href="https://wiki.xenproject.org/wiki/Xen_Project_X.YY_Release_Notes">RN</a>
+: <a href="https://wiki.xenproject.org/wiki/Xen_Project_4.14_Release_Notes">RN</a>
 
 # Feature Support
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Jul 15 08:55:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Jul 2020 08: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 1jvdC6-0007Ju-JV; Wed, 15 Jul 2020 08:55:14 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=UlVl=A2=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jvdC5-0007Ji-3c
 for xen-changelog@lists.xenproject.org; Wed, 15 Jul 2020 08:55:13 +0000
X-Inumbo-ID: e4d78a9c-c678-11ea-93a3-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e4d78a9c-c678-11ea-93a3-12813bfff9fa;
 Wed, 15 Jul 2020 08:55:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=8rvXPojuzOp/SRmHynCTfob+DP9jC6naCZtT9QoJ3sY=; b=NX8rIQxNtTMJvVAeLqhWi3CJ4e
 SYuzfKoA3sU250sU+Lsx4LjiG0w1LI5gREQ+aF/JS9nvXwL8ARNm+JG5S2iQ638Ff7/vtI/ZTRcs3
 k5nhrfm31od8OeFVwzJaJZEoUAbdHpbgA041elnPclzUtIWGM0LxxPHKUHgjBgghciuA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jvdC4-0000ON-FJ
 for xen-changelog@lists.xenproject.org; Wed, 15 Jul 2020 08:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jvdC4-0007AT-ES
 for xen-changelog@lists.xenproject.org; Wed, 15 Jul 2020 08:55:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.14] Branch 4.14: Turn off debug on this stable branch
Message-Id: <E1jvdC4-0007AT-ES@xenbits.xenproject.org>
Date: Wed, 15 Jul 2020 08:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ce3c4493e4e6c94495ddd8538e801a35980bff0d
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Mon Jul 13 14:57:37 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Mon Jul 13 14:57:37 2020 +0100

    Branch 4.14: Turn off debug on this stable branch
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/Rules.mk    | 2 +-
 xen/Kconfig.debug | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

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


From xen-changelog-bounces@lists.xenproject.org Wed Jul 15 13:55:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Jul 2020 13:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jvhsJ-0004cu-5Q; Wed, 15 Jul 2020 13:55:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=UlVl=A2=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jvhsH-0004cp-R4
 for xen-changelog@lists.xenproject.org; Wed, 15 Jul 2020 13:55:05 +0000
X-Inumbo-ID: c93b1874-c6a2-11ea-93e3-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c93b1874-c6a2-11ea-93e3-12813bfff9fa;
 Wed, 15 Jul 2020 13:55:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=CM5215Xjva1z6kiK9ppNHS2pkL/mGuqBbO/db4utdEE=; b=im5qEvr4yaumNRTa2NrrJX1Rma
 4ezABLPxyuA1yKmdTImWN8gIH0MA+ismz3zRVVToY4vnIYKtbmcU8r4SR6ZXTXM+F66Wz0GIUMQIZ
 tyLWJk6Ul8P/YiEeG7K2LyDie5h3NBESHWZGMSrwab4A/QLgEesZbel51y87TWJ5RXTw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jvhsH-0006rO-2L
 for xen-changelog@lists.xenproject.org; Wed, 15 Jul 2020 13:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jvhsH-00015i-1Q
 for xen-changelog@lists.xenproject.org; Wed, 15 Jul 2020 13:55:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86: restore pv_rtc_handler() invocation
Message-Id: <E1jvhsH-00015i-1Q@xenbits.xenproject.org>
Date: Wed, 15 Jul 2020 13:55:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit f8fe3c07363d11fc81d8e7382dbcaa357c861569
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jul 15 15:46:30 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 15 15:46:30 2020 +0200

    x86: restore pv_rtc_handler() invocation
    
    This was lost when making the logic accessible to PVH Dom0.
    
    While doing so make the access to the global function pointer safe
    against races (as noticed by Roger): The only current user wants to be
    invoked just once (but can tolerate to be invoked multiple times),
    zapping the pointer at that point.
    
    Fixes: 835d8d69d96a ("x86/rtc: provide mediated access to RTC for PVH dom0")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hpet.c | 2 +-
 xen/arch/x86/time.c | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index c46e7cf4ee..154c67423b 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -543,7 +543,7 @@ static void handle_rtc_once(uint8_t index, uint8_t value)
     if ( value & (RTC_PIE | RTC_AIE | RTC_UIE ) )
     {
         cpuidle_disable_deep_cstate();
-        pv_rtc_handler = NULL;
+        ACCESS_ONCE(pv_rtc_handler) = NULL;
     }
 }
 
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index cf97dde9d6..505e54ebd7 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1148,6 +1148,8 @@ void rtc_guest_write(unsigned int port, unsigned int data)
 
     switch ( port )
     {
+        typeof(pv_rtc_handler) hook;
+
     case RTC_PORT(0):
         /*
          * All PV domains (and PVH dom0) are allowed to write to the latched
@@ -1160,6 +1162,11 @@ void rtc_guest_write(unsigned int port, unsigned int data)
     case RTC_PORT(1):
         if ( !ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
             break;
+
+        hook = ACCESS_ONCE(pv_rtc_handler);
+        if ( hook )
+            hook(currd->arch.cmos_idx & 0x7f, data);
+
         spin_lock_irqsave(&rtc_lock, flags);
         outb(currd->arch.cmos_idx & 0x7f, RTC_PORT(0));
         outb(data, RTC_PORT(1));
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jul 15 13:55:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Jul 2020 13:55: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 1jvhsU-0004df-78; Wed, 15 Jul 2020 13:55:18 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=UlVl=A2=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jvhsS-0004dW-Gs
 for xen-changelog@lists.xenproject.org; Wed, 15 Jul 2020 13:55:16 +0000
X-Inumbo-ID: cf8250da-c6a2-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id cf8250da-c6a2-11ea-bb8b-bc764e2007e4;
 Wed, 15 Jul 2020 13:55:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=DQ2lujJOb5tT2ulc7vDS6lhsVuant6Ge3E+Uqpg4WRE=; b=XdHQZXVhnK9k4ehQe9mZCyU2QB
 M0rTbr9FYDGL7N7WlJ+UK9vzrt4qalsbNADNG+6oVpduOeAjqfVktu4/UhqUB/cwR9iLB1piJJxNL
 G/0ccwY3VhzNYSYwEWfM7WOjbqD5lvQmNMHUKa/G2iZF2pfszganMLHQg3CbJiM9+FRQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jvhsR-0006rU-Ii
 for xen-changelog@lists.xenproject.org; Wed, 15 Jul 2020 13:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jvhsR-00016a-Hu
 for xen-changelog@lists.xenproject.org; Wed, 15 Jul 2020 13:55:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.14] x86: restore pv_rtc_handler() invocation
Message-Id: <E1jvhsR-00016a-Hu@xenbits.xenproject.org>
Date: Wed, 15 Jul 2020 13:55:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit d820391d2fba67566c52d5e0a047e70483265b6e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jul 15 15:48:43 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 15 15:48:43 2020 +0200

    x86: restore pv_rtc_handler() invocation
    
    This was lost when making the logic accessible to PVH Dom0.
    
    While doing so make the access to the global function pointer safe
    against races (as noticed by Roger): The only current user wants to be
    invoked just once (but can tolerate to be invoked multiple times),
    zapping the pointer at that point.
    
    Fixes: 835d8d69d96a ("x86/rtc: provide mediated access to RTC for PVH dom0")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
    master commit: f8fe3c07363d11fc81d8e7382dbcaa357c861569
    master date: 2020-07-15 15:46:30 +0200
---
 xen/arch/x86/hpet.c | 2 +-
 xen/arch/x86/time.c | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index c46e7cf4ee..154c67423b 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -543,7 +543,7 @@ static void handle_rtc_once(uint8_t index, uint8_t value)
     if ( value & (RTC_PIE | RTC_AIE | RTC_UIE ) )
     {
         cpuidle_disable_deep_cstate();
-        pv_rtc_handler = NULL;
+        ACCESS_ONCE(pv_rtc_handler) = NULL;
     }
 }
 
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index cf97dde9d6..505e54ebd7 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1148,6 +1148,8 @@ void rtc_guest_write(unsigned int port, unsigned int data)
 
     switch ( port )
     {
+        typeof(pv_rtc_handler) hook;
+
     case RTC_PORT(0):
         /*
          * All PV domains (and PVH dom0) are allowed to write to the latched
@@ -1160,6 +1162,11 @@ void rtc_guest_write(unsigned int port, unsigned int data)
     case RTC_PORT(1):
         if ( !ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
             break;
+
+        hook = ACCESS_ONCE(pv_rtc_handler);
+        if ( hook )
+            hook(currd->arch.cmos_idx & 0x7f, data);
+
         spin_lock_irqsave(&rtc_lock, flags);
         outb(currd->arch.cmos_idx & 0x7f, RTC_PORT(0));
         outb(data, RTC_PORT(1));
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Jul 16 04:22:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 16 Jul 2020 04: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 1jvvPI-0007iR-Bf; Thu, 16 Jul 2020 04:22:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=y/Pe=A3=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jvvPH-0007iM-0v
 for xen-changelog@lists.xenproject.org; Thu, 16 Jul 2020 04:22:03 +0000
X-Inumbo-ID: e5b245f8-c71b-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e5b245f8-c71b-11ea-8496-bc764e2007e4;
 Thu, 16 Jul 2020 04:22:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Z/PIVIjAvtPU0HyN2OLXpRmlkTsogLa29y0bvAXvTHY=; b=OFH7PRl43Ukvc5JlH3choPAeub
 vv1gUq7Cgz1l9aL7strY4OkZLkPeoSmTmFdWyq/AGwfxMTJHTvQvNIjFTCVDlkDLyvIj0brbj/7/f
 uHdX97qhVLpoHpJEfwOQn3Y7XOQJNsbvqZPDkla3Dxjiv6W7l7JeyU4l5N7VG5S/raiQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jvvPF-0002lQ-SK
 for xen-changelog@lists.xenproject.org; Thu, 16 Jul 2020 04:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jvvPF-000217-Qm
 for xen-changelog@lists.xenproject.org; Thu, 16 Jul 2020 04:22:01 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.14] x86: restore pv_rtc_handler() invocation
Message-Id: <E1jvvPF-000217-Qm@xenbits.xenproject.org>
Date: Thu, 16 Jul 2020 04:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit d820391d2fba67566c52d5e0a047e70483265b6e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jul 15 15:48:43 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 15 15:48:43 2020 +0200

    x86: restore pv_rtc_handler() invocation
    
    This was lost when making the logic accessible to PVH Dom0.
    
    While doing so make the access to the global function pointer safe
    against races (as noticed by Roger): The only current user wants to be
    invoked just once (but can tolerate to be invoked multiple times),
    zapping the pointer at that point.
    
    Fixes: 835d8d69d96a ("x86/rtc: provide mediated access to RTC for PVH dom0")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
    master commit: f8fe3c07363d11fc81d8e7382dbcaa357c861569
    master date: 2020-07-15 15:46:30 +0200
---
 xen/arch/x86/hpet.c | 2 +-
 xen/arch/x86/time.c | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index c46e7cf4ee..154c67423b 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -543,7 +543,7 @@ static void handle_rtc_once(uint8_t index, uint8_t value)
     if ( value & (RTC_PIE | RTC_AIE | RTC_UIE ) )
     {
         cpuidle_disable_deep_cstate();
-        pv_rtc_handler = NULL;
+        ACCESS_ONCE(pv_rtc_handler) = NULL;
     }
 }
 
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index cf97dde9d6..505e54ebd7 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1148,6 +1148,8 @@ void rtc_guest_write(unsigned int port, unsigned int data)
 
     switch ( port )
     {
+        typeof(pv_rtc_handler) hook;
+
     case RTC_PORT(0):
         /*
          * All PV domains (and PVH dom0) are allowed to write to the latched
@@ -1160,6 +1162,11 @@ void rtc_guest_write(unsigned int port, unsigned int data)
     case RTC_PORT(1):
         if ( !ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
             break;
+
+        hook = ACCESS_ONCE(pv_rtc_handler);
+        if ( hook )
+            hook(currd->arch.cmos_idx & 0x7f, data);
+
         spin_lock_irqsave(&rtc_lock, flags);
         outb(currd->arch.cmos_idx & 0x7f, RTC_PORT(0));
         outb(data, RTC_PORT(1));
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Jul 16 11:33:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 16 Jul 2020 11:33: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 1jw28P-0003xn-H4; Thu, 16 Jul 2020 11:33:05 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=y/Pe=A3=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jw28O-0003xi-BL
 for xen-changelog@lists.xenproject.org; Thu, 16 Jul 2020 11:33:04 +0000
X-Inumbo-ID: 1bc75ae8-c758-11ea-94a4-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 1bc75ae8-c758-11ea-94a4-12813bfff9fa;
 Thu, 16 Jul 2020 11:33:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=oyVWpUCNcON04yy3SuPMS0Yyt1YFP2n66qE+/Cn8AfM=; b=O4vq5X/mRhK8H6jYcMbijbJMu9
 yuCbhgsH87eOfvzq0rz+A3E0hAZgRafhdxh/ftn3q4d0Jn9VzQmHrd1N4QgV5BmyFvvLbn3jipTT0
 h1Apw5WPEuCzFogwTFgYoTFJiVv7wOZCx7owyQONmS/7V+T/L3ciXufoxfUXagHgLC+I=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jw28M-000473-EE
 for xen-changelog@lists.xenproject.org; Thu, 16 Jul 2020 11:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jw28M-00010x-Cq
 for xen-changelog@lists.xenproject.org; Thu, 16 Jul 2020 11:33:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/mwait: remove unneeded local variables
Message-Id: <E1jw28M-00010x-Cq@xenbits.xenproject.org>
Date: Thu, 16 Jul 2020 11:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit f36f4bf582d353d8424154b14b663b075a0276e3
Author:     Roger Pau MonnÃ© <roger.pau@citrix.com>
AuthorDate: Tue Jul 14 09:57:17 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 14 09:57:17 2020 +0200

    x86/mwait: remove unneeded local variables
    
    Remove the eax and cstate local variables, the same can be directly
    fetched from acpi_processor_cx without any transformations.
    
    No functional change.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/mwait-idle.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 52eab81bf8..8add13d698 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -721,7 +721,7 @@ static void mwait_idle(void)
 	unsigned int cpu = smp_processor_id();
 	struct acpi_processor_power *power = processor_powers[cpu];
 	struct acpi_processor_cx *cx = NULL;
-	unsigned int eax, next_state, cstate;
+	unsigned int next_state;
 	u64 before, after;
 	u32 exp = 0, pred = 0, irq_traced[4] = { 0 };
 
@@ -773,9 +773,6 @@ static void mwait_idle(void)
 	if ((cx->type >= 3) && errata_c6_workaround())
 		cx = power->safe_state;
 
-	eax = cx->address;
-	cstate = ((eax >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) + 1;
-
 #if 0 /* XXX Can we/do we need to do something similar on Xen? */
 	/*
 	 * leave_mm() to avoid costly and often unnecessary wakeups
@@ -785,7 +782,7 @@ static void mwait_idle(void)
 		leave_mm(cpu);
 #endif
 
-	if (!(lapic_timer_reliable_states & (1 << cstate)))
+	if (!(lapic_timer_reliable_states & (1 << cx->type)))
 		lapic_timer_off();
 
 	before = alternative_call(cpuidle_get_tick);
@@ -794,7 +791,7 @@ static void mwait_idle(void)
 	update_last_cx_stat(power, cx, before);
 
 	if (cpu_is_haltable(cpu))
-		mwait_idle_with_hints(eax, MWAIT_ECX_INTERRUPT_BREAK);
+		mwait_idle_with_hints(cx->address, MWAIT_ECX_INTERRUPT_BREAK);
 
 	after = alternative_call(cpuidle_get_tick);
 
@@ -807,7 +804,7 @@ static void mwait_idle(void)
 	update_idle_stats(power, cx, before, after);
 	local_irq_enable();
 
-	if (!(lapic_timer_reliable_states & (1 << cstate)))
+	if (!(lapic_timer_reliable_states & (1 << cx->type)))
 		lapic_timer_on();
 
 	rcu_idle_exit(cpu);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jul 16 11:33:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 16 Jul 2020 11: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 1jw28Y-0003yS-Ii; Thu, 16 Jul 2020 11:33:14 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=y/Pe=A3=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jw28X-0003yK-Gm
 for xen-changelog@lists.xenproject.org; Thu, 16 Jul 2020 11:33:13 +0000
X-Inumbo-ID: 21cb2168-c758-11ea-94a4-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 21cb2168-c758-11ea-94a4-12813bfff9fa;
 Thu, 16 Jul 2020 11:33:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=ZpPON2BrG6kbtmIsoogy5qdnVc67upmQv2sE9yuupQw=; b=PUVqjkcwoMrmKb1EzT0fZqOFwI
 KVRi7osyn75o0HoUVdo7y3AR6eXvaGIMVlMMeRkJZhQjsaJzjcLo67YABytO4iRAy+eYqAeuVZuol
 A5/24RieK1X1VueFONVjxRrBx4Hab2bBJ7rWNTmxvoF19aZaimB/Ax5DuAa22ZzPYGa4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jw28W-000479-HR
 for xen-changelog@lists.xenproject.org; Thu, 16 Jul 2020 11:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jw28W-00011X-Gc
 for xen-changelog@lists.xenproject.org; Thu, 16 Jul 2020 11:33:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] VT-x: simplify/clarify vmx_load_pdptrs()
Message-Id: <E1jw28W-00011X-Gc@xenbits.xenproject.org>
Date: Thu, 16 Jul 2020 11:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 1969576661f3e34318e9b0a61a1a38f9a5aee16f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 14 10:00:45 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 14 10:00:45 2020 +0200

    VT-x: simplify/clarify vmx_load_pdptrs()
    
    * Guests outside of long mode can't have PCID enabled. Drop the
      respective check to make more obvious that there's no security issue
      (from potentially accessing past the mapped page's boundary).
    
    * Only bits 5...31 of CR3 are relevant in 32-bit PAE mode; all others
      are ignored. The high 32 ones may in particular have remained
      unchanged after leaving long mode.
    
    * Drop the unnecessary and badly typed local variable p.
    
    * Don't open-code hvm_long_mode_active() (and extend this to the related
      nested VT-x code).
    
    * Constify guest_pdptes to clarify that we're only reading from the
      page.
    
    * Drop the "crash" label now that there's only a single path leading
      there.
    
    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/hvm/vmx/vmx.c  | 24 ++++++++----------------
 xen/arch/x86/hvm/vmx/vvmx.c |  4 ++--
 2 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index cc6d4ece22..eb54aadfba 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1312,19 +1312,15 @@ static void vmx_set_interrupt_shadow(struct vcpu *v, unsigned int intr_shadow)
 
 static void vmx_load_pdptrs(struct vcpu *v)
 {
-    unsigned long cr3 = v->arch.hvm.guest_cr[3];
-    uint64_t *guest_pdptes;
+    uint32_t cr3 = v->arch.hvm.guest_cr[3];
+    const uint64_t *guest_pdptes;
     struct page_info *page;
     p2m_type_t p2mt;
-    char *p;
 
     /* EPT needs to load PDPTRS into VMCS for PAE. */
-    if ( !hvm_pae_enabled(v) || (v->arch.hvm.guest_efer & EFER_LMA) )
+    if ( !hvm_pae_enabled(v) || hvm_long_mode_active(v) )
         return;
 
-    if ( (cr3 & 0x1fUL) && !hvm_pcid_enabled(v) )
-        goto crash;
-
     page = get_page_from_gfn(v->domain, cr3 >> PAGE_SHIFT, &p2mt, P2M_ALLOC);
     if ( !page )
     {
@@ -1332,14 +1328,13 @@ static void vmx_load_pdptrs(struct vcpu *v)
          * queue, but this is the wrong place. We're holding at least
          * the paging lock */
         gdprintk(XENLOG_ERR,
-                 "Bad cr3 on load pdptrs gfn %lx type %d\n",
+                 "Bad cr3 on load pdptrs gfn %"PRIx32" type %d\n",
                  cr3 >> PAGE_SHIFT, (int) p2mt);
-        goto crash;
+        domain_crash(v->domain);
+        return;
     }
 
-    p = __map_domain_page(page);
-
-    guest_pdptes = (uint64_t *)(p + (cr3 & ~PAGE_MASK));
+    guest_pdptes = __map_domain_page(page) + (cr3 & ~(PAGE_MASK | 0x1f));
 
     /*
      * We do not check the PDPTRs for validity. The CPU will do this during
@@ -1356,12 +1351,9 @@ static void vmx_load_pdptrs(struct vcpu *v)
 
     vmx_vmcs_exit(v);
 
-    unmap_domain_page(p);
+    unmap_domain_page(guest_pdptes);
     put_page(page);
     return;
-
- crash:
-    domain_crash(v->domain);
 }
 
 static void vmx_update_host_cr3(struct vcpu *v)
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 7dfff6c445..1e51689ef3 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -1234,7 +1234,7 @@ static void virtual_vmentry(struct cpu_user_regs *regs)
         paging_update_paging_modes(v);
 
     if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
-         !(v->arch.hvm.guest_efer & EFER_LMA) )
+         !hvm_long_mode_active(v) )
         vvmcs_to_shadow_bulk(v, ARRAY_SIZE(gpdpte_fields), gpdpte_fields);
 
     regs->rip = get_vvmcs(v, GUEST_RIP);
@@ -1437,7 +1437,7 @@ static void virtual_vmexit(struct cpu_user_regs *regs)
     sync_exception_state(v);
 
     if ( nvmx_ept_enabled(v) && hvm_pae_enabled(v) &&
-         !(v->arch.hvm.guest_efer & EFER_LMA) )
+         !hvm_long_mode_active(v) )
         shadow_to_vvmcs_bulk(v, ARRAY_SIZE(gpdpte_fields), gpdpte_fields);
 
     /* This will clear current pCPU bit in p2m->dirty_cpumask */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jul 16 11:33:23 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 16 Jul 2020 11: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 1jw28h-0003zg-KE; Thu, 16 Jul 2020 11:33:23 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=y/Pe=A3=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jw28h-0003zZ-BZ
 for xen-changelog@lists.xenproject.org; Thu, 16 Jul 2020 11:33:23 +0000
X-Inumbo-ID: 26d101c1-c758-11ea-94a4-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 26d101c1-c758-11ea-94a4-12813bfff9fa;
 Thu, 16 Jul 2020 11:33:22 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=LMI+fVvn4yWFOpjzmswt7Orh7amHHMXvLRDLSE34vis=; b=Vg44xdQhffpdYlOoULzZ0Yx7el
 RucubjsXx5iX6lPaG1BIYGES2YtTy9p4ByTugPs+4HMoAvANZsiOXckWkq7HZ7TivpPe7q4c4bHu4
 a0/9Sg0g1UMZNAujDZdI7OAqPA76qRxJD8P5eeyTNbVQiiKvJ8zz6fDAsvvLAa7N32EQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jw28g-00047G-Ke
 for xen-changelog@lists.xenproject.org; Thu, 16 Jul 2020 11:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jw28g-00012G-Jc
 for xen-changelog@lists.xenproject.org; Thu, 16 Jul 2020 11:33:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86: restore pv_rtc_handler() invocation
Message-Id: <E1jw28g-00012G-Jc@xenbits.xenproject.org>
Date: Thu, 16 Jul 2020 11:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit f8fe3c07363d11fc81d8e7382dbcaa357c861569
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jul 15 15:46:30 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 15 15:46:30 2020 +0200

    x86: restore pv_rtc_handler() invocation
    
    This was lost when making the logic accessible to PVH Dom0.
    
    While doing so make the access to the global function pointer safe
    against races (as noticed by Roger): The only current user wants to be
    invoked just once (but can tolerate to be invoked multiple times),
    zapping the pointer at that point.
    
    Fixes: 835d8d69d96a ("x86/rtc: provide mediated access to RTC for PVH dom0")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hpet.c | 2 +-
 xen/arch/x86/time.c | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index c46e7cf4ee..154c67423b 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -543,7 +543,7 @@ static void handle_rtc_once(uint8_t index, uint8_t value)
     if ( value & (RTC_PIE | RTC_AIE | RTC_UIE ) )
     {
         cpuidle_disable_deep_cstate();
-        pv_rtc_handler = NULL;
+        ACCESS_ONCE(pv_rtc_handler) = NULL;
     }
 }
 
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index cf97dde9d6..505e54ebd7 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1148,6 +1148,8 @@ void rtc_guest_write(unsigned int port, unsigned int data)
 
     switch ( port )
     {
+        typeof(pv_rtc_handler) hook;
+
     case RTC_PORT(0):
         /*
          * All PV domains (and PVH dom0) are allowed to write to the latched
@@ -1160,6 +1162,11 @@ void rtc_guest_write(unsigned int port, unsigned int data)
     case RTC_PORT(1):
         if ( !ioports_access_permitted(currd, RTC_PORT(0), RTC_PORT(1)) )
             break;
+
+        hook = ACCESS_ONCE(pv_rtc_handler);
+        if ( hook )
+            hook(currd->arch.cmos_idx & 0x7f, data);
+
         spin_lock_irqsave(&rtc_lock, flags);
         outb(currd->arch.cmos_idx & 0x7f, RTC_PORT(0));
         outb(data, RTC_PORT(1));
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jul 17 15:55:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Jul 2020 15: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 1jwShX-0007aj-5V; Fri, 17 Jul 2020 15:55:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=4Yu1=A4=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jwShV-0007ad-QY
 for xen-changelog@lists.xenproject.org; Fri, 17 Jul 2020 15:55:05 +0000
X-Inumbo-ID: e12964be-c845-11ea-9634-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e12964be-c845-11ea-9634-12813bfff9fa;
 Fri, 17 Jul 2020 15:55:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=AQd0Kvj8EL7AHeQHe2iU7fjrkL+Q9zZA8op8P7H8qI0=; b=KBZmJwkiFffJXgTxWMJ3abDxBG
 m+L90z3eqAMDdMBI656kx8y8BZGapjqAAeJXjAe97gIgj763+CVmunFruxHsTi0Ob+ST//Fex+k1I
 hA/eFsj2a17Iy1FseK77QmV81sztD1MKrFGjZq5nZT5a4vxI/TzAjF4qmzKA72SawOpA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwShU-0001HG-Ab
 for xen-changelog@lists.xenproject.org; Fri, 17 Jul 2020 15:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwShU-0006ln-9g
 for xen-changelog@lists.xenproject.org; Fri, 17 Jul 2020 15:55:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] VT-d: install sync_cache hook on demand
Message-Id: <E1jwShU-0006ln-9g@xenbits.xenproject.org>
Date: Fri, 17 Jul 2020 15:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit bf2a0ed11d4cf79e9863576f97a8d306fc3b1d40
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 17 17:48:42 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 17 17:48:42 2020 +0200

    VT-d: install sync_cache hook on demand
    
    Instead of checking inside the hook whether any non-coherent IOMMUs are
    present, simply install the hook only when this is the case.
    
    To prove that there are no other references to the now dynamically
    updated ops structure (and hence that its updating happens early
    enough), make it static and rename it at the same time.
    
    Note that this change implies that sync_cache() shouldn't be called
    directly unless there are unusual circumstances, like is the case in
    alloc_pgtable_maddr(), which gets invoked too early for iommu_ops to
    be set already (and therefore we also need to be careful there to
    avoid accessing vtd_ops later on, as it lives in .init).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/extern.h |  1 -
 xen/drivers/passthrough/vtd/iommu.c  | 16 ++++++----------
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index f776feefe6..ada3c3098c 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -28,7 +28,6 @@
 struct pci_ats_dev;
 extern bool_t rwbf_quirk;
 extern const struct iommu_init_ops intel_iommu_init_ops;
-extern const struct iommu_ops intel_iommu_ops;
 
 void print_iommu_regs(struct acpi_drhd_unit *drhd);
 void print_vtd_entries(struct vtd_iommu *iommu, int bus, int devfn, u64 gmfn);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 2a99cd208f..ef2fea0a0e 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -59,6 +59,7 @@ bool __read_mostly iommu_snoop = true;
 
 int nr_iommus;
 
+static struct iommu_ops vtd_ops;
 static struct tasklet vtd_fault_tasklet;
 
 static int setup_hwdom_device(u8 devfn, struct pci_dev *);
@@ -146,16 +147,11 @@ static int context_get_domain_id(struct context_entry *context,
     return domid;
 }
 
-static int iommus_incoherent;
-
 static void sync_cache(const void *addr, unsigned int size)
 {
     static unsigned long clflush_size = 0;
     const void *end = addr + size;
 
-    if ( !iommus_incoherent )
-        return;
-
     if ( clflush_size == 0 )
         clflush_size = get_cache_line_size();
 
@@ -217,7 +213,8 @@ uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        sync_cache(vaddr, PAGE_SIZE);
+        if ( (iommu_ops.init ? &iommu_ops : &vtd_ops)->sync_cache )
+            sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -1227,7 +1224,7 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
     iommu->nr_pt_levels = agaw_to_level(agaw);
 
     if ( !ecap_coherent(iommu->ecap) )
-        iommus_incoherent = 1;
+        vtd_ops.sync_cache = sync_cache;
 
     /* allocate domain id bitmap */
     nr_dom = cap_ndoms(iommu->cap);
@@ -2737,7 +2734,7 @@ static int __init intel_iommu_quarantine_init(struct domain *d)
     return level ? -ENOMEM : rc;
 }
 
-const struct iommu_ops __initconstrel intel_iommu_ops = {
+static struct iommu_ops __initdata vtd_ops = {
     .init = intel_iommu_domain_init,
     .hwdom_init = intel_iommu_hwdom_init,
     .quarantine_init = intel_iommu_quarantine_init,
@@ -2768,11 +2765,10 @@ const struct iommu_ops __initconstrel intel_iommu_ops = {
     .iotlb_flush_all = iommu_flush_iotlb_all,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_p2m_table = vtd_dump_p2m_table,
-    .sync_cache = sync_cache,
 };
 
 const struct iommu_init_ops __initconstrel intel_iommu_init_ops = {
-    .ops = &intel_iommu_ops,
+    .ops = &vtd_ops,
     .setup = vtd_setup,
     .supports_x2apic = intel_iommu_supports_eim,
 };
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jul 17 15:55:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Jul 2020 15: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 1jwShh-0007bN-7H; Fri, 17 Jul 2020 15:55:17 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=4Yu1=A4=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jwShf-0007bG-MA
 for xen-changelog@lists.xenproject.org; Fri, 17 Jul 2020 15:55:15 +0000
X-Inumbo-ID: e7335f2c-c845-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e7335f2c-c845-11ea-8496-bc764e2007e4;
 Fri, 17 Jul 2020 15:55:14 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=MFOg/FEpUCl2onpsGFD0OuiW2pwBrJbqUq6YgWy0M3o=; b=MnExwB1KLmGw1xzPlD/Wb0XoYd
 3fycXSnJZZ+8uBSRGIwwPgkODhEeDzGnXDw7dTotflr8/73dlZbPc7Cp1Dp7xQgGyuSVsHBxFDp8N
 JhJt+5oM8US/QBFIcLdKOsDMhMiC7lyGhNTGSxb/iEe+mUmyKj8B6t0Gi2/byeINPdMo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwShe-0001HJ-F0
 for xen-changelog@lists.xenproject.org; Fri, 17 Jul 2020 15:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwShe-0006mU-Cn
 for xen-changelog@lists.xenproject.org; Fri, 17 Jul 2020 15:55:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] VT-d: use clear_page() in alloc_pgtable_maddr()
Message-Id: <E1jwShe-0006mU-Cn@xenbits.xenproject.org>
Date: Fri, 17 Jul 2020 15:55:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 859447ab7b281bcdb6011aae990077abb8800ecf
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 17 17:49:29 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 17 17:49:29 2020 +0200

    VT-d: use clear_page() in alloc_pgtable_maddr()
    
    For full pages this is (meant to be) more efficient. Also change the
    type and reduce the scope of the involved local variable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index ef2fea0a0e..01dc444771 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -199,7 +199,6 @@ static void sync_cache(const void *addr, unsigned int size)
 uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
 {
     struct page_info *pg, *cur_pg;
-    u64 *vaddr;
     unsigned int i;
 
     pg = alloc_domheap_pages(NULL, get_order_from_pages(npages),
@@ -210,8 +209,9 @@ uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
     cur_pg = pg;
     for ( i = 0; i < npages; i++ )
     {
-        vaddr = __map_domain_page(cur_pg);
-        memset(vaddr, 0, PAGE_SIZE);
+        void *vaddr = __map_domain_page(cur_pg);
+
+        clear_page(vaddr);
 
         if ( (iommu_ops.init ? &iommu_ops : &vtd_ops)->sync_cache )
             sync_cache(vaddr, PAGE_SIZE);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jul 17 15:55:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Jul 2020 15: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 1jwShq-0007ch-8k; Fri, 17 Jul 2020 15:55:26 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=4Yu1=A4=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jwShp-0007cR-4C
 for xen-changelog@lists.xenproject.org; Fri, 17 Jul 2020 15:55:25 +0000
X-Inumbo-ID: ed352ed2-c845-11ea-9634-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ed352ed2-c845-11ea-9634-12813bfff9fa;
 Fri, 17 Jul 2020 15:55:24 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=i0AlffpDxsAVziWSZiSkEC5A6kyoHO26VueLmxPL2Oc=; b=UNcKZIriKfKgSRxrboLcuWvgSu
 i/i2E9S3llYkiXeIkYAd71Icb80f9KTkEPFih6RFwdsdDBJmHm0MDYzfMUVd38sf9wi7hTW1za/0u
 31HCeH6+fwa4C7PqSr1svZ9kTJmUTYFFKqoLjHifSceakACdXD2XvOd9dV2TTLwXCD/c=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwSho-0001HR-I4
 for xen-changelog@lists.xenproject.org; Fri, 17 Jul 2020 15:55:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwSho-0006n2-H9
 for xen-changelog@lists.xenproject.org; Fri, 17 Jul 2020 15:55:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/HVM: fold hvm_io_assist() into its only caller
Message-Id: <E1jwSho-0006n2-H9@xenbits.xenproject.org>
Date: Fri, 17 Jul 2020 15:55:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 83bb55fa38f7cbd4c8a670c9a01c8c47642d969e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 17 17:50:09 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 17 17:50:09 2020 +0200

    x86/HVM: fold hvm_io_assist() into its only caller
    
    While there are two call sites, the function they're in can be slightly
    re-arranged such that the code sequence can be added at its bottom. Note
    that the function's only caller has already checked sv->pending, and
    that the prior while() loop was just a slightly more fancy if()
    (allowing an early break out of the construct).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/ioreq.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index 724007016d..41cc02f434 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -103,23 +103,12 @@ bool hvm_io_pending(struct vcpu *v)
     return false;
 }
 
-static void hvm_io_assist(struct hvm_ioreq_vcpu *sv, uint64_t data)
-{
-    struct vcpu *v = sv->vcpu;
-    ioreq_t *ioreq = &v->arch.hvm.hvm_io.io_req;
-
-    if ( hvm_ioreq_needs_completion(ioreq) )
-        ioreq->data = data;
-
-    sv->pending = false;
-}
-
 static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
 {
     unsigned int prev_state = STATE_IOREQ_NONE;
+    uint64_t data = ~0;
 
-    while ( sv->pending )
-    {
+    do {
         unsigned int state = p->state;
 
         smp_rmb();
@@ -132,7 +121,6 @@ static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
              * emulator is dying and it races with an I/O being
              * requested.
              */
-            hvm_io_assist(sv, ~0ul);
             break;
         }
 
@@ -149,7 +137,7 @@ static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
         {
         case STATE_IORESP_READY: /* IORESP_READY -> NONE */
             p->state = STATE_IOREQ_NONE;
-            hvm_io_assist(sv, p->data);
+            data = p->data;
             break;
         case STATE_IOREQ_READY:  /* IOREQ_{READY,INPROCESS} -> IORESP_READY */
         case STATE_IOREQ_INPROCESS:
@@ -164,7 +152,13 @@ static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
             domain_crash(sv->vcpu->domain);
             return false; /* bail */
         }
-    }
+    } while ( false );
+
+    p = &sv->vcpu->arch.hvm.hvm_io.io_req;
+    if ( hvm_ioreq_needs_completion(p) )
+        p->data = data;
+
+    sv->pending = false;
 
     return true;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jul 17 15:55:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Jul 2020 15:55:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jwShz-0007e6-Ir; Fri, 17 Jul 2020 15:55:35 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=4Yu1=A4=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jwShz-0007dh-5X
 for xen-changelog@lists.xenproject.org; Fri, 17 Jul 2020 15:55:35 +0000
X-Inumbo-ID: f33d9404-c845-11ea-9634-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id f33d9404-c845-11ea-9634-12813bfff9fa;
 Fri, 17 Jul 2020 15:55:34 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=FAu+HdUmySkybX0N4yMIpujfUUaFaduc912+1F7CdV8=; b=gSXop5P368v4gkbi43mgClYdZE
 Tg8zaIMsAuyRp+HQTaRzl4QS8ET+XBw427zD6SHiSr/ig0NXNwLnSy5XBQQVDpM/2xfOqpImZCyDg
 koAvmo61ygJci+y9re89OMnDUYTGSROczhZTqSmdpsXaHRXAPVyINvclp2nEsBcZDInE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwShy-0001HY-L1
 for xen-changelog@lists.xenproject.org; Fri, 17 Jul 2020 15:55:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwShy-0006nW-K7
 for xen-changelog@lists.xenproject.org; Fri, 17 Jul 2020 15:55:34 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/HVM: re-work hvm_wait_for_io() a little
Message-Id: <E1jwShy-0006nW-K7@xenbits.xenproject.org>
Date: Fri, 17 Jul 2020 15:55:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 32fa4ec97196678ba39e6746a9ba21d3f57ba853
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 17 17:50:40 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 17 17:50:40 2020 +0200

    x86/HVM: re-work hvm_wait_for_io() a little
    
    Convert the function's main loop to a more ordinary one, without goto
    and without initial steps not needing to be inside a loop at all.
    
    Take the opportunity and add blank lines between case blocks.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/ioreq.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index 41cc02f434..9e4c7e9ca4 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -106,24 +106,17 @@ bool hvm_io_pending(struct vcpu *v)
 static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
 {
     unsigned int prev_state = STATE_IOREQ_NONE;
+    unsigned int state = p->state;
     uint64_t data = ~0;
 
-    do {
-        unsigned int state = p->state;
-
-        smp_rmb();
-
-    recheck:
-        if ( unlikely(state == STATE_IOREQ_NONE) )
-        {
-            /*
-             * The only reason we should see this case is when an
-             * emulator is dying and it races with an I/O being
-             * requested.
-             */
-            break;
-        }
+    smp_rmb();
 
+    /*
+     * The only reason we should see this condition be false is when an
+     * emulator dying races with I/O being requested.
+     */
+    while ( likely(state != STATE_IOREQ_NONE) )
+    {
         if ( unlikely(state < prev_state) )
         {
             gdprintk(XENLOG_ERR, "Weird HVM ioreq state transition %u -> %u\n",
@@ -139,20 +132,24 @@ static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
             p->state = STATE_IOREQ_NONE;
             data = p->data;
             break;
+
         case STATE_IOREQ_READY:  /* IOREQ_{READY,INPROCESS} -> IORESP_READY */
         case STATE_IOREQ_INPROCESS:
             wait_on_xen_event_channel(sv->ioreq_evtchn,
                                       ({ state = p->state;
                                          smp_rmb();
                                          state != prev_state; }));
-            goto recheck;
+            continue;
+
         default:
             gdprintk(XENLOG_ERR, "Weird HVM iorequest state %u\n", state);
             sv->pending = false;
             domain_crash(sv->vcpu->domain);
             return false; /* bail */
         }
-    } while ( false );
+
+        break;
+    }
 
     p = &sv->vcpu->arch.hvm.hvm_io.io_req;
     if ( hvm_ioreq_needs_completion(p) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jul 17 15:55:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Jul 2020 15: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 1jwSiA-0007gs-KY; Fri, 17 Jul 2020 15:55:46 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=4Yu1=A4=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jwSi9-0007gc-CI
 for xen-changelog@lists.xenproject.org; Fri, 17 Jul 2020 15:55:45 +0000
X-Inumbo-ID: f93ed3cc-c845-11ea-bb8b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f93ed3cc-c845-11ea-bb8b-bc764e2007e4;
 Fri, 17 Jul 2020 15:55:44 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=u/xVckr53BHDspE21aGP6CkbhImP2wUQD4OGMC/cMZQ=; b=pD+rFgMzF/NoSbHFoKrhuFFken
 o38NTWAW3pURW3tahWbYIMnGUm0xK9PUhUL97r49Jc9hz5QSHOHW6o1mArDZ47zWz7S+S7xNDaiDH
 91lhFOA4YBXIXVEXR5j3r3z1E763/zFXfoboVnScu4+CWIcsxnm9sq25JOaIORyqXoGA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwSi8-0001Hk-Oj
 for xen-changelog@lists.xenproject.org; Fri, 17 Jul 2020 15:55:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwSi8-0006o5-N9
 for xen-changelog@lists.xenproject.org; Fri, 17 Jul 2020 15:55:44 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/HVM: fold both instances of looking up a
 hvm_ioreq_vcpu with a request pending
Message-Id: <E1jwSi8-0006o5-N9@xenbits.xenproject.org>
Date: Fri, 17 Jul 2020 15:55:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 1745806a4153da200e340b319cabf3d4ad9d5575
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 17 17:51:07 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 17 17:51:07 2020 +0200

    x86/HVM: fold both instances of looking up a hvm_ioreq_vcpu with a request pending
    
    It seems pretty likely that the "break" in the loop getting replaced in
    handle_hvm_io_completion() was meant to exit both nested loops at the
    same time. Re-purpose what has been hvm_io_pending() to hand back the
    struct hvm_ioreq_vcpu instance found, and use it to replace the two
    nested loops.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/ioreq.c | 38 +++++++++++++++++---------------------
 1 file changed, 17 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index 9e4c7e9ca4..1cc27df87f 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -81,7 +81,8 @@ static ioreq_t *get_ioreq(struct hvm_ioreq_server *s, struct vcpu *v)
     return &p->vcpu_ioreq[v->vcpu_id];
 }
 
-bool hvm_io_pending(struct vcpu *v)
+static struct hvm_ioreq_vcpu *get_pending_vcpu(const struct vcpu *v,
+                                               struct hvm_ioreq_server **srvp)
 {
     struct domain *d = v->domain;
     struct hvm_ioreq_server *s;
@@ -96,11 +97,20 @@ bool hvm_io_pending(struct vcpu *v)
                               list_entry )
         {
             if ( sv->vcpu == v && sv->pending )
-                return true;
+            {
+                if ( srvp )
+                    *srvp = s;
+                return sv;
+            }
         }
     }
 
-    return false;
+    return NULL;
+}
+
+bool hvm_io_pending(struct vcpu *v)
+{
+    return get_pending_vcpu(v, NULL);
 }
 
 static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
@@ -165,8 +175,8 @@ bool handle_hvm_io_completion(struct vcpu *v)
     struct domain *d = v->domain;
     struct hvm_vcpu_io *vio = &v->arch.hvm.hvm_io;
     struct hvm_ioreq_server *s;
+    struct hvm_ioreq_vcpu *sv;
     enum hvm_io_completion io_completion;
-    unsigned int id;
 
     if ( has_vpci(d) && vpci_process_pending(v) )
     {
@@ -174,23 +184,9 @@ bool handle_hvm_io_completion(struct vcpu *v)
         return false;
     }
 
-    FOR_EACH_IOREQ_SERVER(d, id, s)
-    {
-        struct hvm_ioreq_vcpu *sv;
-
-        list_for_each_entry ( sv,
-                              &s->ioreq_vcpu_list,
-                              list_entry )
-        {
-            if ( sv->vcpu == v && sv->pending )
-            {
-                if ( !hvm_wait_for_io(sv, get_ioreq(s, v)) )
-                    return false;
-
-                break;
-            }
-        }
-    }
+    sv = get_pending_vcpu(v, &s);
+    if ( sv && !hvm_wait_for_io(sv, get_ioreq(s, v)) )
+        return false;
 
     vio->io_req.state = hvm_ioreq_needs_completion(&vio->io_req) ?
         STATE_IORESP_READY : STATE_IOREQ_NONE;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jul 17 15:55:56 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Jul 2020 15: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 1jwSiK-0007iZ-M7; Fri, 17 Jul 2020 15:55:56 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=4Yu1=A4=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jwSiJ-0007iJ-9L
 for xen-changelog@lists.xenproject.org; Fri, 17 Jul 2020 15:55:55 +0000
X-Inumbo-ID: ff467af4-c845-11ea-9634-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ff467af4-c845-11ea-9634-12813bfff9fa;
 Fri, 17 Jul 2020 15:55:55 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=0sPBZf5F3A867BmmUjCB3hp6yg7bTux4YoCR3Ik9dDI=; b=4nT4XCN2L7XjBMxrsPNO3WkNVH
 BlNTbDpTrZjBI0nKV7ibvZzmxduXQUyh6Zi6o725FgbtlQ6U83rTFxEXHfux8iRPmfEB2Ps0f3OFy
 uUzAQnrVMqrtrypBzmROLT+/qHGgD4kNAnftJS5dYADor/7W5UkkfweP9eJbxzyR/k4s=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwSiI-0001IJ-Rp
 for xen-changelog@lists.xenproject.org; Fri, 17 Jul 2020 15:55:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwSiI-0006of-Qs
 for xen-changelog@lists.xenproject.org; Fri, 17 Jul 2020 15:55:54 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] compat: add a little bit of description to xlat.lst
Message-Id: <E1jwSiI-0006of-Qs@xenbits.xenproject.org>
Date: Fri, 17 Jul 2020 15:55:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit fb024b779336a0f73b3aee885b2ce082e812881f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 17 17:52:14 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 17 17:52:14 2020 +0200

    compat: add a little bit of description to xlat.lst
    
    Requested-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
---
 xen/include/xlat.lst | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst
index 0921d4a8d0..20d4dccce6 100644
--- a/xen/include/xlat.lst
+++ b/xen/include/xlat.lst
@@ -1,3 +1,22 @@
+# There are a few fundamentally different strategies for handling compat
+# (sub-)hypercalls:
+#
+# 1) Wrap a translation layer around the native hypercall. Structures involved
+# in this model should use translation (xlat) macros generated by adding
+# !-prefixed lines here.
+#
+# 2) Compile the entire hypercall function a second time, arranging for the
+# compat structures to get used in place of the native ones. There are no xlat
+# macros involved here, all that's needed are correctly translated structures.
+#
+# 3) Adhoc translation, which may or may not involve adding entries here.
+#
+# 4) Any mixture of the above.
+#
+# In all models any structures re-used in their native form should have
+# ?-mark prefixed lines added here, with the resulting checking macros invoked
+# somewhere in the code handling the hypercall or its translation.
+#
 # First column indicator:
 # ! - needs translation
 # ? - needs checking
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Jul 18 11:33:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 18 Jul 2020 11:33: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 1jwl5W-0001in-AR; Sat, 18 Jul 2020 11:33:06 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kgqk=A5=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jwl5V-0001ig-9f
 for xen-changelog@lists.xenproject.org; Sat, 18 Jul 2020 11:33:05 +0000
X-Inumbo-ID: 6f329061-c8ea-11ea-9727-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 6f329061-c8ea-11ea-9727-12813bfff9fa;
 Sat, 18 Jul 2020 11:33:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Gfss+GtG9acXf+t+5Y0eE/5PNeJFWPVr9QXUuOAx0b4=; b=orJMnjUzbKBWO48q7cAAkHPqPn
 IStxR84Csszq3Lh2Q0pUDbo0SgfxA7l2FyrB53T9TQNkhTPVXYcBt8kxXh2YkkUtQOebUrQSNrqud
 fOrowZ6HzDkMJ1fjGvr+Zb0JGBld/Pi4PUDFPA4YZoIuogx28xgV+PBUHhmP2PnrNIMg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwl5R-00044x-RY
 for xen-changelog@lists.xenproject.org; Sat, 18 Jul 2020 11:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwl5R-0006X6-Qg
 for xen-changelog@lists.xenproject.org; Sat, 18 Jul 2020 11:33:01 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] VT-d: install sync_cache hook on demand
Message-Id: <E1jwl5R-0006X6-Qg@xenbits.xenproject.org>
Date: Sat, 18 Jul 2020 11:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit bf2a0ed11d4cf79e9863576f97a8d306fc3b1d40
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 17 17:48:42 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 17 17:48:42 2020 +0200

    VT-d: install sync_cache hook on demand
    
    Instead of checking inside the hook whether any non-coherent IOMMUs are
    present, simply install the hook only when this is the case.
    
    To prove that there are no other references to the now dynamically
    updated ops structure (and hence that its updating happens early
    enough), make it static and rename it at the same time.
    
    Note that this change implies that sync_cache() shouldn't be called
    directly unless there are unusual circumstances, like is the case in
    alloc_pgtable_maddr(), which gets invoked too early for iommu_ops to
    be set already (and therefore we also need to be careful there to
    avoid accessing vtd_ops later on, as it lives in .init).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/extern.h |  1 -
 xen/drivers/passthrough/vtd/iommu.c  | 16 ++++++----------
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index f776feefe6..ada3c3098c 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -28,7 +28,6 @@
 struct pci_ats_dev;
 extern bool_t rwbf_quirk;
 extern const struct iommu_init_ops intel_iommu_init_ops;
-extern const struct iommu_ops intel_iommu_ops;
 
 void print_iommu_regs(struct acpi_drhd_unit *drhd);
 void print_vtd_entries(struct vtd_iommu *iommu, int bus, int devfn, u64 gmfn);
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 2a99cd208f..ef2fea0a0e 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -59,6 +59,7 @@ bool __read_mostly iommu_snoop = true;
 
 int nr_iommus;
 
+static struct iommu_ops vtd_ops;
 static struct tasklet vtd_fault_tasklet;
 
 static int setup_hwdom_device(u8 devfn, struct pci_dev *);
@@ -146,16 +147,11 @@ static int context_get_domain_id(struct context_entry *context,
     return domid;
 }
 
-static int iommus_incoherent;
-
 static void sync_cache(const void *addr, unsigned int size)
 {
     static unsigned long clflush_size = 0;
     const void *end = addr + size;
 
-    if ( !iommus_incoherent )
-        return;
-
     if ( clflush_size == 0 )
         clflush_size = get_cache_line_size();
 
@@ -217,7 +213,8 @@ uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
         vaddr = __map_domain_page(cur_pg);
         memset(vaddr, 0, PAGE_SIZE);
 
-        sync_cache(vaddr, PAGE_SIZE);
+        if ( (iommu_ops.init ? &iommu_ops : &vtd_ops)->sync_cache )
+            sync_cache(vaddr, PAGE_SIZE);
         unmap_domain_page(vaddr);
         cur_pg++;
     }
@@ -1227,7 +1224,7 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd)
     iommu->nr_pt_levels = agaw_to_level(agaw);
 
     if ( !ecap_coherent(iommu->ecap) )
-        iommus_incoherent = 1;
+        vtd_ops.sync_cache = sync_cache;
 
     /* allocate domain id bitmap */
     nr_dom = cap_ndoms(iommu->cap);
@@ -2737,7 +2734,7 @@ static int __init intel_iommu_quarantine_init(struct domain *d)
     return level ? -ENOMEM : rc;
 }
 
-const struct iommu_ops __initconstrel intel_iommu_ops = {
+static struct iommu_ops __initdata vtd_ops = {
     .init = intel_iommu_domain_init,
     .hwdom_init = intel_iommu_hwdom_init,
     .quarantine_init = intel_iommu_quarantine_init,
@@ -2768,11 +2765,10 @@ const struct iommu_ops __initconstrel intel_iommu_ops = {
     .iotlb_flush_all = iommu_flush_iotlb_all,
     .get_reserved_device_memory = intel_iommu_get_reserved_device_memory,
     .dump_p2m_table = vtd_dump_p2m_table,
-    .sync_cache = sync_cache,
 };
 
 const struct iommu_init_ops __initconstrel intel_iommu_init_ops = {
-    .ops = &intel_iommu_ops,
+    .ops = &vtd_ops,
     .setup = vtd_setup,
     .supports_x2apic = intel_iommu_supports_eim,
 };
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jul 18 11:33:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 18 Jul 2020 11: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 1jwl5e-0001k2-Bv; Sat, 18 Jul 2020 11:33:14 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kgqk=A5=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jwl5c-0001jo-NL
 for xen-changelog@lists.xenproject.org; Sat, 18 Jul 2020 11:33:12 +0000
X-Inumbo-ID: 764af3c4-c8ea-11ea-8496-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 764af3c4-c8ea-11ea-8496-bc764e2007e4;
 Sat, 18 Jul 2020 11:33:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=hs1xFmfqC8nPYY6bzWsGhI790AjDp5t6quAsnZB3TqI=; b=wp1FovazpZi1PtlIVsuHpVYbg2
 kzrSt9Rv67orpVYobxhvUSLaFQeKK0wXe8FYKHLG/8cm/VWAC85FHbO3OG2bphrOuV9YYbmc3Fkp4
 2+vPz2JD/40USF5D2S20PWLpDH1zao23Tu+jPsASnC7+Af7fILvJJN5O6gCxEO0xYnIM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwl5b-000451-V6
 for xen-changelog@lists.xenproject.org; Sat, 18 Jul 2020 11:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwl5b-0006Xi-Tn
 for xen-changelog@lists.xenproject.org; Sat, 18 Jul 2020 11:33:11 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] VT-d: use clear_page() in alloc_pgtable_maddr()
Message-Id: <E1jwl5b-0006Xi-Tn@xenbits.xenproject.org>
Date: Sat, 18 Jul 2020 11:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 859447ab7b281bcdb6011aae990077abb8800ecf
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 17 17:49:29 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 17 17:49:29 2020 +0200

    VT-d: use clear_page() in alloc_pgtable_maddr()
    
    For full pages this is (meant to be) more efficient. Also change the
    type and reduce the scope of the involved local variable.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index ef2fea0a0e..01dc444771 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -199,7 +199,6 @@ static void sync_cache(const void *addr, unsigned int size)
 uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
 {
     struct page_info *pg, *cur_pg;
-    u64 *vaddr;
     unsigned int i;
 
     pg = alloc_domheap_pages(NULL, get_order_from_pages(npages),
@@ -210,8 +209,9 @@ uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node)
     cur_pg = pg;
     for ( i = 0; i < npages; i++ )
     {
-        vaddr = __map_domain_page(cur_pg);
-        memset(vaddr, 0, PAGE_SIZE);
+        void *vaddr = __map_domain_page(cur_pg);
+
+        clear_page(vaddr);
 
         if ( (iommu_ops.init ? &iommu_ops : &vtd_ops)->sync_cache )
             sync_cache(vaddr, PAGE_SIZE);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jul 18 11:33:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 18 Jul 2020 11: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 1jwl5o-0001lb-DY; Sat, 18 Jul 2020 11:33:24 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kgqk=A5=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jwl5m-0001lK-Sa
 for xen-changelog@lists.xenproject.org; Sat, 18 Jul 2020 11:33:22 +0000
X-Inumbo-ID: 7c62e992-c8ea-11ea-9727-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7c62e992-c8ea-11ea-9727-12813bfff9fa;
 Sat, 18 Jul 2020 11:33:22 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=4lrtgPab+T+qMdBYDWYRfHCSfl29Xlips3X9ihmnqJs=; b=N5cTMp6S34eQW67ZskjlnsPon1
 2ahQr3aDdj6OAoCOFdWUn4zASPzCJM/60361vUo0oa7R+nSRbT3XBCByUhaBNlSxGVjjVE0qcnkG3
 lBsQaUeE7yYE9LDcpWMRXoW9xqESGKySCn1RmAjhU5vCE2qLZeJCKhpwAz3DW/VMVytw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwl5m-00045o-3K
 for xen-changelog@lists.xenproject.org; Sat, 18 Jul 2020 11:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwl5m-0006YO-0r
 for xen-changelog@lists.xenproject.org; Sat, 18 Jul 2020 11:33:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/HVM: fold hvm_io_assist() into its only caller
Message-Id: <E1jwl5m-0006YO-0r@xenbits.xenproject.org>
Date: Sat, 18 Jul 2020 11:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 83bb55fa38f7cbd4c8a670c9a01c8c47642d969e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 17 17:50:09 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 17 17:50:09 2020 +0200

    x86/HVM: fold hvm_io_assist() into its only caller
    
    While there are two call sites, the function they're in can be slightly
    re-arranged such that the code sequence can be added at its bottom. Note
    that the function's only caller has already checked sv->pending, and
    that the prior while() loop was just a slightly more fancy if()
    (allowing an early break out of the construct).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/ioreq.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index 724007016d..41cc02f434 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -103,23 +103,12 @@ bool hvm_io_pending(struct vcpu *v)
     return false;
 }
 
-static void hvm_io_assist(struct hvm_ioreq_vcpu *sv, uint64_t data)
-{
-    struct vcpu *v = sv->vcpu;
-    ioreq_t *ioreq = &v->arch.hvm.hvm_io.io_req;
-
-    if ( hvm_ioreq_needs_completion(ioreq) )
-        ioreq->data = data;
-
-    sv->pending = false;
-}
-
 static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
 {
     unsigned int prev_state = STATE_IOREQ_NONE;
+    uint64_t data = ~0;
 
-    while ( sv->pending )
-    {
+    do {
         unsigned int state = p->state;
 
         smp_rmb();
@@ -132,7 +121,6 @@ static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
              * emulator is dying and it races with an I/O being
              * requested.
              */
-            hvm_io_assist(sv, ~0ul);
             break;
         }
 
@@ -149,7 +137,7 @@ static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
         {
         case STATE_IORESP_READY: /* IORESP_READY -> NONE */
             p->state = STATE_IOREQ_NONE;
-            hvm_io_assist(sv, p->data);
+            data = p->data;
             break;
         case STATE_IOREQ_READY:  /* IOREQ_{READY,INPROCESS} -> IORESP_READY */
         case STATE_IOREQ_INPROCESS:
@@ -164,7 +152,13 @@ static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
             domain_crash(sv->vcpu->domain);
             return false; /* bail */
         }
-    }
+    } while ( false );
+
+    p = &sv->vcpu->arch.hvm.hvm_io.io_req;
+    if ( hvm_ioreq_needs_completion(p) )
+        p->data = data;
+
+    sv->pending = false;
 
     return true;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jul 18 11:33:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 18 Jul 2020 11: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 1jwl5y-0001n6-F5; Sat, 18 Jul 2020 11:33:34 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kgqk=A5=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jwl5w-0001mq-Tn
 for xen-changelog@lists.xenproject.org; Sat, 18 Jul 2020 11:33:32 +0000
X-Inumbo-ID: 82636218-c8ea-11ea-9727-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 82636218-c8ea-11ea-9727-12813bfff9fa;
 Sat, 18 Jul 2020 11:33:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=L5VlvA1mWcyFEKRYJ56ktRfAlJRRtZfONy+EDZgrB0I=; b=EoRAVlL9W6pMy+ZJ8YFmvdKe+V
 6L6lwTGchn0gA1/WWn3sGujGqcvoMeIQrX3YmozwUICVBuRClmsjsmOn8i+icYVUskpa8iKWWJMx6
 AO2fQ1WXD9IlM/tjv26F1DauU8cz152XMcZbsqSX8JvgquVQgyVlvywcnYBC82lrrutE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwl5w-00045v-9Y
 for xen-changelog@lists.xenproject.org; Sat, 18 Jul 2020 11:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwl5w-0006Yo-5V
 for xen-changelog@lists.xenproject.org; Sat, 18 Jul 2020 11:33:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/HVM: re-work hvm_wait_for_io() a little
Message-Id: <E1jwl5w-0006Yo-5V@xenbits.xenproject.org>
Date: Sat, 18 Jul 2020 11:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 32fa4ec97196678ba39e6746a9ba21d3f57ba853
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 17 17:50:40 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 17 17:50:40 2020 +0200

    x86/HVM: re-work hvm_wait_for_io() a little
    
    Convert the function's main loop to a more ordinary one, without goto
    and without initial steps not needing to be inside a loop at all.
    
    Take the opportunity and add blank lines between case blocks.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/ioreq.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index 41cc02f434..9e4c7e9ca4 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -106,24 +106,17 @@ bool hvm_io_pending(struct vcpu *v)
 static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
 {
     unsigned int prev_state = STATE_IOREQ_NONE;
+    unsigned int state = p->state;
     uint64_t data = ~0;
 
-    do {
-        unsigned int state = p->state;
-
-        smp_rmb();
-
-    recheck:
-        if ( unlikely(state == STATE_IOREQ_NONE) )
-        {
-            /*
-             * The only reason we should see this case is when an
-             * emulator is dying and it races with an I/O being
-             * requested.
-             */
-            break;
-        }
+    smp_rmb();
 
+    /*
+     * The only reason we should see this condition be false is when an
+     * emulator dying races with I/O being requested.
+     */
+    while ( likely(state != STATE_IOREQ_NONE) )
+    {
         if ( unlikely(state < prev_state) )
         {
             gdprintk(XENLOG_ERR, "Weird HVM ioreq state transition %u -> %u\n",
@@ -139,20 +132,24 @@ static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
             p->state = STATE_IOREQ_NONE;
             data = p->data;
             break;
+
         case STATE_IOREQ_READY:  /* IOREQ_{READY,INPROCESS} -> IORESP_READY */
         case STATE_IOREQ_INPROCESS:
             wait_on_xen_event_channel(sv->ioreq_evtchn,
                                       ({ state = p->state;
                                          smp_rmb();
                                          state != prev_state; }));
-            goto recheck;
+            continue;
+
         default:
             gdprintk(XENLOG_ERR, "Weird HVM iorequest state %u\n", state);
             sv->pending = false;
             domain_crash(sv->vcpu->domain);
             return false; /* bail */
         }
-    } while ( false );
+
+        break;
+    }
 
     p = &sv->vcpu->arch.hvm.hvm_io.io_req;
     if ( hvm_ioreq_needs_completion(p) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jul 18 11:33:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 18 Jul 2020 11:33:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jwl6B-0001oj-Gy; Sat, 18 Jul 2020 11:33:47 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kgqk=A5=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jwl69-0001oZ-W4
 for xen-changelog@lists.xenproject.org; Sat, 18 Jul 2020 11:33:46 +0000
X-Inumbo-ID: 8869bc7a-c8ea-11ea-9727-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8869bc7a-c8ea-11ea-9727-12813bfff9fa;
 Sat, 18 Jul 2020 11:33:42 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=aZpvrzNxREvsselUXxTPL2gBY54rLMrO3mU16eL3L40=; b=tmR9QGQW6EpX1l1KhM+U/5sV6b
 2iIQBIXFgICm2xtVtDyD9Qi8KsWyEZ/FpYI2yTYdGmEzlmXkSKGgen4DvC/Uqx5KMrjfKFqsRv4PS
 kBhlDYXxWfnlMbPWau4j1FUIdOqwLl1WqSGd1i9SPaI2xPstALEjMwUCzymZzXV0cigE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwl66-000462-CV
 for xen-changelog@lists.xenproject.org; Sat, 18 Jul 2020 11:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwl66-0006ZZ-Bd
 for xen-changelog@lists.xenproject.org; Sat, 18 Jul 2020 11:33:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/HVM: fold both instances of looking up a
 hvm_ioreq_vcpu with a request pending
Message-Id: <E1jwl66-0006ZZ-Bd@xenbits.xenproject.org>
Date: Sat, 18 Jul 2020 11:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 1745806a4153da200e340b319cabf3d4ad9d5575
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 17 17:51:07 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 17 17:51:07 2020 +0200

    x86/HVM: fold both instances of looking up a hvm_ioreq_vcpu with a request pending
    
    It seems pretty likely that the "break" in the loop getting replaced in
    handle_hvm_io_completion() was meant to exit both nested loops at the
    same time. Re-purpose what has been hvm_io_pending() to hand back the
    struct hvm_ioreq_vcpu instance found, and use it to replace the two
    nested loops.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
---
 xen/arch/x86/hvm/ioreq.c | 38 +++++++++++++++++---------------------
 1 file changed, 17 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index 9e4c7e9ca4..1cc27df87f 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -81,7 +81,8 @@ static ioreq_t *get_ioreq(struct hvm_ioreq_server *s, struct vcpu *v)
     return &p->vcpu_ioreq[v->vcpu_id];
 }
 
-bool hvm_io_pending(struct vcpu *v)
+static struct hvm_ioreq_vcpu *get_pending_vcpu(const struct vcpu *v,
+                                               struct hvm_ioreq_server **srvp)
 {
     struct domain *d = v->domain;
     struct hvm_ioreq_server *s;
@@ -96,11 +97,20 @@ bool hvm_io_pending(struct vcpu *v)
                               list_entry )
         {
             if ( sv->vcpu == v && sv->pending )
-                return true;
+            {
+                if ( srvp )
+                    *srvp = s;
+                return sv;
+            }
         }
     }
 
-    return false;
+    return NULL;
+}
+
+bool hvm_io_pending(struct vcpu *v)
+{
+    return get_pending_vcpu(v, NULL);
 }
 
 static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
@@ -165,8 +175,8 @@ bool handle_hvm_io_completion(struct vcpu *v)
     struct domain *d = v->domain;
     struct hvm_vcpu_io *vio = &v->arch.hvm.hvm_io;
     struct hvm_ioreq_server *s;
+    struct hvm_ioreq_vcpu *sv;
     enum hvm_io_completion io_completion;
-    unsigned int id;
 
     if ( has_vpci(d) && vpci_process_pending(v) )
     {
@@ -174,23 +184,9 @@ bool handle_hvm_io_completion(struct vcpu *v)
         return false;
     }
 
-    FOR_EACH_IOREQ_SERVER(d, id, s)
-    {
-        struct hvm_ioreq_vcpu *sv;
-
-        list_for_each_entry ( sv,
-                              &s->ioreq_vcpu_list,
-                              list_entry )
-        {
-            if ( sv->vcpu == v && sv->pending )
-            {
-                if ( !hvm_wait_for_io(sv, get_ioreq(s, v)) )
-                    return false;
-
-                break;
-            }
-        }
-    }
+    sv = get_pending_vcpu(v, &s);
+    if ( sv && !hvm_wait_for_io(sv, get_ioreq(s, v)) )
+        return false;
 
     vio->io_req.state = hvm_ioreq_needs_completion(&vio->io_req) ?
         STATE_IORESP_READY : STATE_IOREQ_NONE;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Jul 18 11:33:54 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 18 Jul 2020 11: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 1jwl6I-0001pg-IT; Sat, 18 Jul 2020 11:33:54 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=kgqk=A5=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jwl6H-0001pU-1I
 for xen-changelog@lists.xenproject.org; Sat, 18 Jul 2020 11:33:53 +0000
X-Inumbo-ID: 8e682d0a-c8ea-11ea-9727-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 8e682d0a-c8ea-11ea-9727-12813bfff9fa;
 Sat, 18 Jul 2020 11:33:52 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=kLqXqTyKyLh14YSpqKdYMiiYQDdgYei6ZlAxBc63Cts=; b=O9f92DidEGvnTQDbEva8F56gRp
 Adg27h1Uehmm0TNiKskyG5GizzSC+QTb38BEJmrjgBV/yk74O1hZJqIOtt+fOtySPSnMcZqgD8Ugm
 X8SYV7k8Kj7sMzz3XtevN0i+PF4rm2PjlpF1wc1iYercjMRwrVLE5ckw9hAaYstbmKC4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwl6G-00046C-FP
 for xen-changelog@lists.xenproject.org; Sat, 18 Jul 2020 11:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jwl6G-0006a9-EZ
 for xen-changelog@lists.xenproject.org; Sat, 18 Jul 2020 11:33:52 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] compat: add a little bit of description to xlat.lst
Message-Id: <E1jwl6G-0006a9-EZ@xenbits.xenproject.org>
Date: Sat, 18 Jul 2020 11:33:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit fb024b779336a0f73b3aee885b2ce082e812881f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 17 17:52:14 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 17 17:52:14 2020 +0200

    compat: add a little bit of description to xlat.lst
    
    Requested-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
---
 xen/include/xlat.lst | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst
index 0921d4a8d0..20d4dccce6 100644
--- a/xen/include/xlat.lst
+++ b/xen/include/xlat.lst
@@ -1,3 +1,22 @@
+# There are a few fundamentally different strategies for handling compat
+# (sub-)hypercalls:
+#
+# 1) Wrap a translation layer around the native hypercall. Structures involved
+# in this model should use translation (xlat) macros generated by adding
+# !-prefixed lines here.
+#
+# 2) Compile the entire hypercall function a second time, arranging for the
+# compat structures to get used in place of the native ones. There are no xlat
+# macros involved here, all that's needed are correctly translated structures.
+#
+# 3) Adhoc translation, which may or may not involve adding entries here.
+#
+# 4) Any mixture of the above.
+#
+# In all models any structures re-used in their native form should have
+# ?-mark prefixed lines added here, with the resulting checking macros invoked
+# somewhere in the code handling the hypercall or its translation.
+#
 # First column indicator:
 # ! - needs translation
 # ? - needs checking
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Jul 20 10:55:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Jul 2020 10:55: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 1jxTRr-00045p-7p; Mon, 20 Jul 2020 10:55:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=zyF8=A7=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxTRq-00045h-LH
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 10:55:06 +0000
X-Inumbo-ID: 7803b050-ca77-11ea-9f82-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7803b050-ca77-11ea-9f82-12813bfff9fa;
 Mon, 20 Jul 2020 10:55:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=SzdxPBYEp90WK+wdKTilWrGsN3l1riQ6W6ZQ53IEv8g=; b=X0Ak6So8DqiRLh2vKB79qoPMAN
 E2k7nZRKtO3zM0NaUHb04TVm0Yyp9phZsQ01god36NpCwbCTngUeqMRPWWss76DkI/WsyVPRG2I67
 xaVcjBFbrPeKECgb5iVsUHMDoGdxuaszBUh9/Flxda7B/JAkCL+5J9F3wUSA4vIZ1ii4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxTRp-0003Ql-2M
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 10:55:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxTRp-0003bL-0V
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 10:55:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/vmx: add Intel PT MSR definitions
Message-Id: <E1jxTRp-0003bL-0V@xenbits.xenproject.org>
Date: Mon, 20 Jul 2020 10:55:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 6b6f064cf4b9f8d29746e79408eedc4c1fd93419
Author:     Michal Leszczynski <michal.leszczynski@cert.pl>
AuthorDate: Tue Jun 30 14:33:44 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jul 20 11:48:04 2020 +0100

    x86/vmx: add Intel PT MSR definitions
    
    Define constants related to Intel Processor Trace features.
    
    Signed-off-by: Michal Leszczynski <michal.leszczynski@cert.pl>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/asm-x86/msr-index.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 0fe98af923..4fd54fb5c9 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -72,7 +72,31 @@
 #define MSR_RTIT_OUTPUT_BASE                0x00000560
 #define MSR_RTIT_OUTPUT_MASK                0x00000561
 #define MSR_RTIT_CTL                        0x00000570
+#define  RTIT_CTL_TRACE_EN                  (_AC(1, ULL) <<  0)
+#define  RTIT_CTL_CYC_EN                    (_AC(1, ULL) <<  1)
+#define  RTIT_CTL_OS                        (_AC(1, ULL) <<  2)
+#define  RTIT_CTL_USR                       (_AC(1, ULL) <<  3)
+#define  RTIT_CTL_PWR_EVT_EN                (_AC(1, ULL) <<  4)
+#define  RTIT_CTL_FUP_ON_PTW                (_AC(1, ULL) <<  5)
+#define  RTIT_CTL_FABRIC_EN                 (_AC(1, ULL) <<  6)
+#define  RTIT_CTL_CR3_FILTER                (_AC(1, ULL) <<  7)
+#define  RTIT_CTL_TOPA                      (_AC(1, ULL) <<  8)
+#define  RTIT_CTL_MTC_EN                    (_AC(1, ULL) <<  9)
+#define  RTIT_CTL_TSC_EN                    (_AC(1, ULL) << 10)
+#define  RTIT_CTL_DIS_RETC                  (_AC(1, ULL) << 11)
+#define  RTIT_CTL_PTW_EN                    (_AC(1, ULL) << 12)
+#define  RTIT_CTL_BRANCH_EN                 (_AC(1, ULL) << 13)
+#define  RTIT_CTL_MTC_FREQ                  (_AC(0xf, ULL) << 14)
+#define  RTIT_CTL_CYC_THRESH                (_AC(0xf, ULL) << 19)
+#define  RTIT_CTL_PSB_FREQ                  (_AC(0xf, ULL) << 24)
+#define  RTIT_CTL_ADDR(n)                   (_AC(0xf, ULL) << (32 + 4 * (n)))
 #define MSR_RTIT_STATUS                     0x00000571
+#define  RTIT_STATUS_FILTER_EN              (_AC(1, ULL) <<  0)
+#define  RTIT_STATUS_CONTEXT_EN             (_AC(1, ULL) <<  1)
+#define  RTIT_STATUS_TRIGGER_EN             (_AC(1, ULL) <<  2)
+#define  RTIT_STATUS_ERROR                  (_AC(1, ULL) <<  4)
+#define  RTIT_STATUS_STOPPED                (_AC(1, ULL) <<  5)
+#define  RTIT_STATUS_BYTECNT                (_AC(0x1ffff, ULL) << 32)
 #define MSR_RTIT_CR3_MATCH                  0x00000572
 #define MSR_RTIT_ADDR_A(n)                 (0x00000580 + (n) * 2)
 #define MSR_RTIT_ADDR_B(n)                 (0x00000581 + (n) * 2)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jul 20 10:55:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Jul 2020 10:55:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jxTS0-00046i-9O; Mon, 20 Jul 2020 10:55:16 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=zyF8=A7=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxTS0-00046a-1u
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 10:55:16 +0000
X-Inumbo-ID: 7e037738-ca77-11ea-9f82-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7e037738-ca77-11ea-9f82-12813bfff9fa;
 Mon, 20 Jul 2020 10:55:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=2HMUC9qIFABtzCYSKXJK+sj//uGOTSNUWqcvHffN4tY=; b=txWZBNROv5RATZrt6EdPIpeRoP
 sTsJ1FMx0ygaiS3nnJnMONvyftMDY44n0lHiw1iVcAyYmV4mkLwk77Vla5KMsQFwLwvNqTIfizChH
 5hBwMgNOmefpN4AAj95Hze154MUk8t1ckIiv36BMPLX7lw+IasOPZhatNk41hhSkCtKE=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxTRz-0003Qu-5S
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 10:55:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxTRz-0003bx-4S
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 10:55:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/mtrr: Drop workaround for old 32bit CPUs
Message-Id: <E1jxTRz-0003bx-4S@xenbits.xenproject.org>
Date: Mon, 20 Jul 2020 10:55:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 8c4532f19d6925538fb0c938f7de9a97da8c5c3b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jul 8 11:12:51 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jul 20 11:48:04 2020 +0100

    x86/mtrr: Drop workaround for old 32bit CPUs
    
    This logic is dead as Xen is 64bit-only these days.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/mtrr/generic.c | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch/x86/cpu/mtrr/generic.c
index 89634f918f..06fa0c0420 100644
--- a/xen/arch/x86/cpu/mtrr/generic.c
+++ b/xen/arch/x86/cpu/mtrr/generic.c
@@ -570,23 +570,6 @@ int generic_validate_add_page(unsigned long base, unsigned long size, unsigned i
 {
 	unsigned long lbase, last;
 
-	/*  For Intel PPro stepping <= 7, must be 4 MiB aligned 
-	    and not touch 0x70000000->0x7003FFFF */
-	if (is_cpu(INTEL) && boot_cpu_data.x86 == 6 &&
-	    boot_cpu_data.x86_model == 1 &&
-	    boot_cpu_data.x86_mask <= 7) {
-		if (base & ((1 << (22 - PAGE_SHIFT)) - 1)) {
-			printk(KERN_WARNING "mtrr: base(%#lx000) is not 4 MiB aligned\n", base);
-			return -EINVAL;
-		}
-		if (!(base + size < 0x70000 || base > 0x7003F) &&
-		    (type == MTRR_TYPE_WRCOMB
-		     || type == MTRR_TYPE_WRBACK)) {
-			printk(KERN_WARNING "mtrr: writable mtrr between 0x70000000 and 0x7003FFFF may hang the CPU.\n");
-			return -EINVAL;
-		}
-	}
-
 	/*  Check upper bits of base and last are equal and lower bits are 0
 	    for base and 1 for last  */
 	last = base + size - 1;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jul 20 11:44:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Jul 2020 11:44: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 1jxUDG-0000yx-ID; Mon, 20 Jul 2020 11:44:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=zyF8=A7=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxUDG-0000ys-5v
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 11:44:06 +0000
X-Inumbo-ID: 50008a37-ca7e-11ea-848b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 50008a37-ca7e-11ea-848b-bc764e2007e4;
 Mon, 20 Jul 2020 11:44:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=SQMBDXauox/3PtzISoCY8i4eZ95VKbewlRu9BDDLDmk=; b=HW8oNwPI5ZjPkzmRp4sqx+6wz3
 r/4Z0qZZpW1M54S2xhbZN854YJ2LfhaY+EtrWJGwscBTSBnLODP6APPo7JHgV0zOTZBYciFMJ0cuF
 w4VNxp2bSmjlpPxBPe3/8rtuecBs0wALpUnf1SvMedtsQB6+7v7cmjH9QrzHtjiGxjck=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxUDE-0004Vp-S8
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 11:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxUDE-000764-R6
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 11:44:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] docs: specify stability of hypfs path documentation
Message-Id: <E1jxUDE-000764-R6@xenbits.xenproject.org>
Date: Mon, 20 Jul 2020 11:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 5a4a411bde4f73ff8ce43d6e52b77302973e8f68
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Jul 20 13:38:00 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jul 20 13:38:00 2020 +0200

    docs: specify stability of hypfs path documentation
    
    In docs/misc/hypfs-paths.pandoc the supported paths in the hypervisor
    file system are specified. Make it more clear that path availability
    might change, e.g. due to scope widening or narrowing (e.g. being
    limited to a specific architecture).
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 docs/misc/hypfs-paths.pandoc | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc
index a111c6f25c..81d70bb80c 100644
--- a/docs/misc/hypfs-paths.pandoc
+++ b/docs/misc/hypfs-paths.pandoc
@@ -5,6 +5,9 @@ in the Xen hypervisor file system (hypfs).
 
 The hypervisor file system can be accessed via the xenhypfs tool.
 
+The availability of the hypervisor file system depends on the hypervisor
+config option CONFIG_HYPFS, which is on per default.
+
 ## Notation
 
 The hypervisor file system is similar to the Linux kernel's sysfs.
@@ -64,6 +67,23 @@ the list elements separated by spaces, e.g. "dom0 PCID-on".
 The entry would be writable and it would exist on X86 only and only if the
 hypervisor is configured to support PV guests.
 
+# Stability
+
+Path *presence* is not stable, but path *meaning* is always stable: if a tool
+you write finds a path present, it can rely on behavior in future versions of
+the hypervisors, and in different configurations.  Specifically:
+
+1. Conditions under which paths are used may be extended, restricted, or
+   removed.  For example, a path that’s always available only on ARM systems
+   may become available on x86; or a path available on both systems may be
+   restricted to only appearing on ARM systems.  Paths may also disappear
+   entirely.
+2. However, the meaning of a path will never change.  If a path is present,
+   it will always have exactly the meaning that it always had.  In order to
+   maintain this, removed paths should be retained with the tag [REMOVED].
+   The path may be restored *only* if the restored version of the path is
+   compatible with the previous functionality.
+
 ## Example
 
 A populated Xen hypervisor file system might look like the following example:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jul 20 11:44:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Jul 2020 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 1jxUDR-0000zr-Jl; Mon, 20 Jul 2020 11:44:17 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=zyF8=A7=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxUDQ-0000zk-8j
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 11:44:16 +0000
X-Inumbo-ID: 5689ba62-ca7e-11ea-848b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5689ba62-ca7e-11ea-848b-bc764e2007e4;
 Mon, 20 Jul 2020 11:44:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=RiYXdgNLl0rwf5fW27o7YR2htxgPCGn5IlXho0CjbjQ=; b=qOGtRt/BXORgVEijz4PTbNySF4
 3CpU6rc525+vBMnLe6bbEBm3sHLy9ASJkV51PjBlm8T+Ubgi/jgTtzSXMUJvZwzWcbOcSus7CKbDm
 8DC3kuCFpY+A6eNBX7bcIPdmNNC2UxrcIlZ3yTFX5ViHRirRTapO+TuHhR/b/wY4CHrQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxUDP-0004Vv-D6
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 11:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxUDP-00077I-Bb
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 11:44:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.14] docs: specify stability of hypfs path documentation
Message-Id: <E1jxUDP-00077I-Bb@xenbits.xenproject.org>
Date: Mon, 20 Jul 2020 11:44:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 23fe1b8d5170dfd5039c39181e82bfd5e20f3c18
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Jul 20 13:39:32 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jul 20 13:39:32 2020 +0200

    docs: specify stability of hypfs path documentation
    
    In docs/misc/hypfs-paths.pandoc the supported paths in the hypervisor
    file system are specified. Make it more clear that path availability
    might change, e.g. due to scope widening or narrowing (e.g. being
    limited to a specific architecture).
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
    master commit: 5a4a411bde4f73ff8ce43d6e52b77302973e8f68
    master date: 2020-07-20 13:38:00 +0200
---
 docs/misc/hypfs-paths.pandoc | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc
index a111c6f25c..81d70bb80c 100644
--- a/docs/misc/hypfs-paths.pandoc
+++ b/docs/misc/hypfs-paths.pandoc
@@ -5,6 +5,9 @@ in the Xen hypervisor file system (hypfs).
 
 The hypervisor file system can be accessed via the xenhypfs tool.
 
+The availability of the hypervisor file system depends on the hypervisor
+config option CONFIG_HYPFS, which is on per default.
+
 ## Notation
 
 The hypervisor file system is similar to the Linux kernel's sysfs.
@@ -64,6 +67,23 @@ the list elements separated by spaces, e.g. "dom0 PCID-on".
 The entry would be writable and it would exist on X86 only and only if the
 hypervisor is configured to support PV guests.
 
+# Stability
+
+Path *presence* is not stable, but path *meaning* is always stable: if a tool
+you write finds a path present, it can rely on behavior in future versions of
+the hypervisors, and in different configurations.  Specifically:
+
+1. Conditions under which paths are used may be extended, restricted, or
+   removed.  For example, a path that’s always available only on ARM systems
+   may become available on x86; or a path available on both systems may be
+   restricted to only appearing on ARM systems.  Paths may also disappear
+   entirely.
+2. However, the meaning of a path will never change.  If a path is present,
+   it will always have exactly the meaning that it always had.  In order to
+   maintain this, removed paths should be retained with the tag [REMOVED].
+   The path may be restored *only* if the restored version of the path is
+   compatible with the previous functionality.
+
 ## Example
 
 A populated Xen hypervisor file system might look like the following example:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Mon Jul 20 16:22:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Jul 2020 16:22: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 1jxYYJ-0000gT-BH; Mon, 20 Jul 2020 16:22:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=zyF8=A7=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxYYI-0000gL-1Q
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 16:22:06 +0000
X-Inumbo-ID: 25fc75ac-caa5-11ea-9fd0-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 25fc75ac-caa5-11ea-9fd0-12813bfff9fa;
 Mon, 20 Jul 2020 16:22:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Sk5LdeKL92R3Psu/Ff686ek3i+rdF7xB/2JS7KSCvpY=; b=Yi0OFv33IkumisJL1DARqMW7qH
 l5DPVYe28/lm+3KiyUUXN5GRd4rghUpb4f89fnfZyMifCkN4ZGCm0X6FUUZjKQEu0QKjfgkTj1IRl
 TC8Vr2RZtAUAdaGwYGavzBagsXECfWlB2ikKxAzcb3eTqhKfNj9aWWaoD2PM34hBOWhg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxYYG-0002QS-9Z
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 16:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxYYG-0005x5-8j
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 16:22:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] Arm: prune #include-s needed by domain.h
Message-Id: <E1jxYYG-0005x5-8j@xenbits.xenproject.org>
Date: Mon, 20 Jul 2020 16:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 6720345aaf82fc76dca084f3f7a577062f5ff0f3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jul 15 12:39:06 2020 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon Jul 20 17:16:27 2020 +0100

    Arm: prune #include-s needed by domain.h
    
    asm/domain.h is a dependency of xen/sched.h, and hence should not itself
    include xen/sched.h. Nor should any of the other #include-s used by it.
    While at it, also drop two other #include-s that aren't needed by this
    particular header.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/include/asm-arm/domain.h | 4 +---
 xen/include/asm-arm/vfp.h    | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index 4e2f582006..6819a3bf38 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -2,7 +2,7 @@
 #define __ASM_DOMAIN_H__
 
 #include <xen/cache.h>
-#include <xen/sched.h>
+#include <xen/timer.h>
 #include <asm/page.h>
 #include <asm/p2m.h>
 #include <asm/vfp.h>
@@ -11,8 +11,6 @@
 #include <asm/vgic.h>
 #include <asm/vpl011.h>
 #include <public/hvm/params.h>
-#include <xen/serial.h>
-#include <xen/rbtree.h>
 
 struct hvm_domain
 {
diff --git a/xen/include/asm-arm/vfp.h b/xen/include/asm-arm/vfp.h
index 5f10fe5962..142a91ef8b 100644
--- a/xen/include/asm-arm/vfp.h
+++ b/xen/include/asm-arm/vfp.h
@@ -1,7 +1,7 @@
 #ifndef _ASM_VFP_H
 #define _ASM_VFP_H
 
-#include <xen/sched.h>
+struct vcpu;
 
 #if defined(CONFIG_ARM_32)
 # include <asm/arm32/vfp.h>
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jul 20 17:11:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Jul 2020 17:11: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 1jxZJj-0005XC-7U; Mon, 20 Jul 2020 17:11:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=zyF8=A7=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxZJh-0005X7-Uy
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 17:11:05 +0000
X-Inumbo-ID: feacbd7a-caab-11ea-84ac-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id feacbd7a-caab-11ea-84ac-bc764e2007e4;
 Mon, 20 Jul 2020 17:11:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=qUOak73KB2SmLr5xS4UFilg7cy3W39oGTh9o8kE0Xh8=; b=0wv6eDzG6Pfg/9Si+1lFEV1Ntm
 tT0jqciS4aNBua4OgjCOLmsZOQvnvEDGUd8RWundi4j6d9vM9Kle26CNBe3LQz9OsnAxCxAC0RV0/
 kOaBrT57Dpw63w/a/ZH2TgiulUG3j91rC3UjvAAZVQ3HWyn/yCwKPgNMqcVlPc9U5QhQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxZJg-0003SI-Q9
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 17:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxZJg-0003c9-NT
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 17:11:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] docs: Replace non-UTF-8 character in hypfs-paths.pandoc
Message-Id: <E1jxZJg-0003c9-NT@xenbits.xenproject.org>
Date: Mon, 20 Jul 2020 17:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 9ffdda96d9e7c3d9c7a5bbe2df6ab30f63927542
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jul 20 17:54:52 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jul 20 18:08:00 2020 +0100

    docs: Replace non-UTF-8 character in hypfs-paths.pandoc
    
    From the docs cronjob on xenbits:
    
      /usr/bin/pandoc --number-sections --toc --standalone misc/hypfs-paths.pandoc --output html/misc/hypfs-paths.html
      pandoc: Cannot decode byte '\x92': Data.Text.Internal.Encoding.decodeUtf8: Invalid UTF-8 stream
      make: *** [Makefile:236: html/misc/hypfs-paths.html] Error 1
    
    Fixes: 5a4a411bde4 ("docs: specify stability of hypfs path documentation")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 docs/misc/hypfs-paths.pandoc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc
index 81d70bb80c..dddb592bc5 100644
--- a/docs/misc/hypfs-paths.pandoc
+++ b/docs/misc/hypfs-paths.pandoc
@@ -74,7 +74,7 @@ you write finds a path present, it can rely on behavior in future versions of
 the hypervisors, and in different configurations.  Specifically:
 
 1. Conditions under which paths are used may be extended, restricted, or
-   removed.  For example, a path that’s always available only on ARM systems
+   removed.  For example, a path that's always available only on ARM systems
    may become available on x86; or a path available on both systems may be
    restricted to only appearing on ARM systems.  Paths may also disappear
    entirely.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Jul 20 17:11:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Jul 2020 17:11:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jxZJt-0005Xv-92; Mon, 20 Jul 2020 17:11:17 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=zyF8=A7=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxZJs-0005Xm-Cw
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 17:11:16 +0000
X-Inumbo-ID: 04f7a24e-caac-11ea-84ac-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 04f7a24e-caac-11ea-84ac-bc764e2007e4;
 Mon, 20 Jul 2020 17:11:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=9BMxDjyfjGnDDt5QMxms+fjcOJ+3Dl48C8uS1wEWVqQ=; b=LByCd5s8KeYT4wiTrWgCPt5u51
 NkU9Y79rv5Fr8lWkq4OuKw4cPXTN+6EJdSVnfnxdA7Ohw6dMGWkll39rBjGZK4ViWgM2LltdrBihl
 V49oNifn6bh+JQhG3hafmPqxHkoXiiUins0ZPzMWLAfXe5Y4u70q4Kaapw2L0BdUkFkA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxZJr-0003Sa-CI
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 17:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxZJr-0003dR-Ag
 for xen-changelog@lists.xenproject.org; Mon, 20 Jul 2020 17:11:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.14] docs: Replace non-UTF-8 character in
 hypfs-paths.pandoc
Message-Id: <E1jxZJr-0003dR-Ag@xenbits.xenproject.org>
Date: Mon, 20 Jul 2020 17:11:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 312e5be7ce751c35b79dff3aca4fb660610913e9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jul 20 17:54:52 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jul 20 18:08:21 2020 +0100

    docs: Replace non-UTF-8 character in hypfs-paths.pandoc
    
    From the docs cronjob on xenbits:
    
      /usr/bin/pandoc --number-sections --toc --standalone misc/hypfs-paths.pandoc --output html/misc/hypfs-paths.html
      pandoc: Cannot decode byte '\x92': Data.Text.Internal.Encoding.decodeUtf8: Invalid UTF-8 stream
      make: *** [Makefile:236: html/misc/hypfs-paths.html] Error 1
    
    Fixes: 5a4a411bde4 ("docs: specify stability of hypfs path documentation")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
    (cherry picked from commit 9ffdda96d9e7c3d9c7a5bbe2df6ab30f63927542)
---
 docs/misc/hypfs-paths.pandoc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc
index 81d70bb80c..dddb592bc5 100644
--- a/docs/misc/hypfs-paths.pandoc
+++ b/docs/misc/hypfs-paths.pandoc
@@ -74,7 +74,7 @@ you write finds a path present, it can rely on behavior in future versions of
 the hypervisors, and in different configurations.  Specifically:
 
 1. Conditions under which paths are used may be extended, restricted, or
-   removed.  For example, a path that’s always available only on ARM systems
+   removed.  For example, a path that's always available only on ARM systems
    may become available on x86; or a path available on both systems may be
    restricted to only appearing on ARM systems.  Paths may also disappear
    entirely.
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Jul 21 01:11:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Jul 2020 01:11: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 1jxgoD-0006Mm-Pg; Tue, 21 Jul 2020 01:11:05 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5KM5=BA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxgoB-0006Mh-TG
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 01:11:03 +0000
X-Inumbo-ID: 0ae9a54c-caef-11ea-a044-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 0ae9a54c-caef-11ea-a044-12813bfff9fa;
 Tue, 21 Jul 2020 01:11:01 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=98mti4c/qb31xuLE2AsGjfJUoFpGNeWZMTEQOUfnrUg=; b=BnnwlzJffCGp1cUC+NAsxX9ab1
 EILLpJfbGs5XHVc3FEA9q17oBo9F91HWXuOFUE3tPKGU86xIxJ0eC0dWQXeVg1l8R/JNPmvfJiisd
 QOONKbXQxGz24dqh6KSkXHo9a1++SvCID4izPHUKrUCkPkdxWz5/AppK9Qo4FQqp/Rno=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxgo9-000706-Jd
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 01:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxgo9-0006Vu-HM
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 01:11:01 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.14] docs: specify stability of hypfs path documentation
Message-Id: <E1jxgo9-0006Vu-HM@xenbits.xenproject.org>
Date: Tue, 21 Jul 2020 01:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 23fe1b8d5170dfd5039c39181e82bfd5e20f3c18
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Jul 20 13:39:32 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jul 20 13:39:32 2020 +0200

    docs: specify stability of hypfs path documentation
    
    In docs/misc/hypfs-paths.pandoc the supported paths in the hypervisor
    file system are specified. Make it more clear that path availability
    might change, e.g. due to scope widening or narrowing (e.g. being
    limited to a specific architecture).
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
    master commit: 5a4a411bde4f73ff8ce43d6e52b77302973e8f68
    master date: 2020-07-20 13:38:00 +0200
---
 docs/misc/hypfs-paths.pandoc | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc
index a111c6f25c..81d70bb80c 100644
--- a/docs/misc/hypfs-paths.pandoc
+++ b/docs/misc/hypfs-paths.pandoc
@@ -5,6 +5,9 @@ in the Xen hypervisor file system (hypfs).
 
 The hypervisor file system can be accessed via the xenhypfs tool.
 
+The availability of the hypervisor file system depends on the hypervisor
+config option CONFIG_HYPFS, which is on per default.
+
 ## Notation
 
 The hypervisor file system is similar to the Linux kernel's sysfs.
@@ -64,6 +67,23 @@ the list elements separated by spaces, e.g. "dom0 PCID-on".
 The entry would be writable and it would exist on X86 only and only if the
 hypervisor is configured to support PV guests.
 
+# Stability
+
+Path *presence* is not stable, but path *meaning* is always stable: if a tool
+you write finds a path present, it can rely on behavior in future versions of
+the hypervisors, and in different configurations.  Specifically:
+
+1. Conditions under which paths are used may be extended, restricted, or
+   removed.  For example, a path that’s always available only on ARM systems
+   may become available on x86; or a path available on both systems may be
+   restricted to only appearing on ARM systems.  Paths may also disappear
+   entirely.
+2. However, the meaning of a path will never change.  If a path is present,
+   it will always have exactly the meaning that it always had.  In order to
+   maintain this, removed paths should be retained with the tag [REMOVED].
+   The path may be restored *only* if the restored version of the path is
+   compatible with the previous functionality.
+
 ## Example
 
 A populated Xen hypervisor file system might look like the following example:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Jul 21 06:55:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Jul 2020 06:55: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 1jxmB6-0001p2-U5; Tue, 21 Jul 2020 06:55:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5KM5=BA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxmB5-0001ox-Dk
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 06:55:03 +0000
X-Inumbo-ID: 198398bc-cb1f-11ea-a088-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 198398bc-cb1f-11ea-a088-12813bfff9fa;
 Tue, 21 Jul 2020 06:55:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=odM5YBaIOcnIldGFTweOjDgQ8lSc2F1L3UwJqy4TRgs=; b=lJL8iey5kJum0nEKp4K26VCQeG
 H+rirK2bCOW5pu/TtTTISnSVtO/G0j8vX4FtiQEr6/mbGkxYareRLm2IOh5SJNkfjSG3xuv6uAY6k
 iMJ0c2vgEAniHe0bTXkUR3AWXYB218iFXR5nR6DD7Z1CqPPXEQ3JyTiZWQjaiwj+n9rw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxmB3-0006Yq-Uv
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 06:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxmB3-0000X1-Tu
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 06:55:01 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/vmx: add Intel PT MSR definitions
Message-Id: <E1jxmB3-0000X1-Tu@xenbits.xenproject.org>
Date: Tue, 21 Jul 2020 06:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 6b6f064cf4b9f8d29746e79408eedc4c1fd93419
Author:     Michal Leszczynski <michal.leszczynski@cert.pl>
AuthorDate: Tue Jun 30 14:33:44 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jul 20 11:48:04 2020 +0100

    x86/vmx: add Intel PT MSR definitions
    
    Define constants related to Intel Processor Trace features.
    
    Signed-off-by: Michal Leszczynski <michal.leszczynski@cert.pl>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/asm-x86/msr-index.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
index 0fe98af923..4fd54fb5c9 100644
--- a/xen/include/asm-x86/msr-index.h
+++ b/xen/include/asm-x86/msr-index.h
@@ -72,7 +72,31 @@
 #define MSR_RTIT_OUTPUT_BASE                0x00000560
 #define MSR_RTIT_OUTPUT_MASK                0x00000561
 #define MSR_RTIT_CTL                        0x00000570
+#define  RTIT_CTL_TRACE_EN                  (_AC(1, ULL) <<  0)
+#define  RTIT_CTL_CYC_EN                    (_AC(1, ULL) <<  1)
+#define  RTIT_CTL_OS                        (_AC(1, ULL) <<  2)
+#define  RTIT_CTL_USR                       (_AC(1, ULL) <<  3)
+#define  RTIT_CTL_PWR_EVT_EN                (_AC(1, ULL) <<  4)
+#define  RTIT_CTL_FUP_ON_PTW                (_AC(1, ULL) <<  5)
+#define  RTIT_CTL_FABRIC_EN                 (_AC(1, ULL) <<  6)
+#define  RTIT_CTL_CR3_FILTER                (_AC(1, ULL) <<  7)
+#define  RTIT_CTL_TOPA                      (_AC(1, ULL) <<  8)
+#define  RTIT_CTL_MTC_EN                    (_AC(1, ULL) <<  9)
+#define  RTIT_CTL_TSC_EN                    (_AC(1, ULL) << 10)
+#define  RTIT_CTL_DIS_RETC                  (_AC(1, ULL) << 11)
+#define  RTIT_CTL_PTW_EN                    (_AC(1, ULL) << 12)
+#define  RTIT_CTL_BRANCH_EN                 (_AC(1, ULL) << 13)
+#define  RTIT_CTL_MTC_FREQ                  (_AC(0xf, ULL) << 14)
+#define  RTIT_CTL_CYC_THRESH                (_AC(0xf, ULL) << 19)
+#define  RTIT_CTL_PSB_FREQ                  (_AC(0xf, ULL) << 24)
+#define  RTIT_CTL_ADDR(n)                   (_AC(0xf, ULL) << (32 + 4 * (n)))
 #define MSR_RTIT_STATUS                     0x00000571
+#define  RTIT_STATUS_FILTER_EN              (_AC(1, ULL) <<  0)
+#define  RTIT_STATUS_CONTEXT_EN             (_AC(1, ULL) <<  1)
+#define  RTIT_STATUS_TRIGGER_EN             (_AC(1, ULL) <<  2)
+#define  RTIT_STATUS_ERROR                  (_AC(1, ULL) <<  4)
+#define  RTIT_STATUS_STOPPED                (_AC(1, ULL) <<  5)
+#define  RTIT_STATUS_BYTECNT                (_AC(0x1ffff, ULL) << 32)
 #define MSR_RTIT_CR3_MATCH                  0x00000572
 #define MSR_RTIT_ADDR_A(n)                 (0x00000580 + (n) * 2)
 #define MSR_RTIT_ADDR_B(n)                 (0x00000581 + (n) * 2)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 21 06:55:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Jul 2020 06: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 1jxmBF-0001pW-Vw; Tue, 21 Jul 2020 06:55:13 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5KM5=BA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxmBE-0001pP-T5
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 06:55:12 +0000
X-Inumbo-ID: 1f8bfa4c-cb1f-11ea-a088-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 1f8bfa4c-cb1f-11ea-a088-12813bfff9fa;
 Tue, 21 Jul 2020 06:55:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=WIX3FbyAqZMxu7gkY0YnLTI6tAWOU2dAon7rgRxQ250=; b=kmO2Z2QK/illKZ3smTHIYw2y+0
 Iyd5OhAUvvNpU10oqYWgKQGyvFwfg3rEzQNpg9rlWvItcI37z91GQuYPh6zj6XjUnUkP+rIZIfmN1
 +M/NBu4SRO6A1/cFNNWFQNKU6v59SXXEivtuZBV6sGTMIAq494jGN5+PKFOzsaEkwOIY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxmBE-0006ZX-2W
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 06:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxmBE-0000Y0-0j
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 06:55:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/mtrr: Drop workaround for old 32bit CPUs
Message-Id: <E1jxmBE-0000Y0-0j@xenbits.xenproject.org>
Date: Tue, 21 Jul 2020 06:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 8c4532f19d6925538fb0c938f7de9a97da8c5c3b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jul 8 11:12:51 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jul 20 11:48:04 2020 +0100

    x86/mtrr: Drop workaround for old 32bit CPUs
    
    This logic is dead as Xen is 64bit-only these days.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/mtrr/generic.c | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch/x86/cpu/mtrr/generic.c
index 89634f918f..06fa0c0420 100644
--- a/xen/arch/x86/cpu/mtrr/generic.c
+++ b/xen/arch/x86/cpu/mtrr/generic.c
@@ -570,23 +570,6 @@ int generic_validate_add_page(unsigned long base, unsigned long size, unsigned i
 {
 	unsigned long lbase, last;
 
-	/*  For Intel PPro stepping <= 7, must be 4 MiB aligned 
-	    and not touch 0x70000000->0x7003FFFF */
-	if (is_cpu(INTEL) && boot_cpu_data.x86 == 6 &&
-	    boot_cpu_data.x86_model == 1 &&
-	    boot_cpu_data.x86_mask <= 7) {
-		if (base & ((1 << (22 - PAGE_SHIFT)) - 1)) {
-			printk(KERN_WARNING "mtrr: base(%#lx000) is not 4 MiB aligned\n", base);
-			return -EINVAL;
-		}
-		if (!(base + size < 0x70000 || base > 0x7003F) &&
-		    (type == MTRR_TYPE_WRCOMB
-		     || type == MTRR_TYPE_WRBACK)) {
-			printk(KERN_WARNING "mtrr: writable mtrr between 0x70000000 and 0x7003FFFF may hang the CPU.\n");
-			return -EINVAL;
-		}
-	}
-
 	/*  Check upper bits of base and last are equal and lower bits are 0
 	    for base and 1 for last  */
 	last = base + size - 1;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 21 12:11:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Jul 2020 12:11: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 1jxr6x-00079D-Ai; Tue, 21 Jul 2020 12:11:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5KM5=BA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxr6w-00078b-2L
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:11:06 +0000
X-Inumbo-ID: 3fd05e5d-cb4b-11ea-a0ab-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3fd05e5d-cb4b-11ea-a0ab-12813bfff9fa;
 Tue, 21 Jul 2020 12:11:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=uV5hENEsJ2UVnQbs7sm5TB2RKl7Qp8wknO/Kgbjy2O0=; b=F6V7pKi7iE69J3cSlLrjp5xj7i
 0ouUvDagxfPxrEpbtX5y14xxq+h0Nd1GiJV3bsBQ6257umrk0wXAe/gaKs4ZoOx48u+/TW02xoOFd
 ZpS8qq42pSFNA8VwuJk3ArgyGxCoaV8UmwD/eaaNEWd3FLlMh8xIgGMD9WddjKtiiI60=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxr6v-0005MN-0i
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxr6u-0004Kl-Tr
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:11:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/shadow: dirty VRAM tracking is needed for HVM only
Message-Id: <E1jxr6u-0004Kl-Tr@xenbits.xenproject.org>
Date: Tue, 21 Jul 2020 12:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ded576ce07e9328f66842bef67d8cfc14c3088b7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 21 13:57:06 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 21 13:57:06 2020 +0200

    x86/shadow: dirty VRAM tracking is needed for HVM only
    
    Move shadow_track_dirty_vram() into hvm.c (requiring two static
    functions to become non-static). More importantly though make sure we
    don't de-reference d->arch.hvm.dirty_vram for a non-HVM guest. This was
    a latent issue only just because the field lives far enough into struct
    hvm_domain to be outside the part overlapping with struct pv_domain.
    
    While moving shadow_track_dirty_vram() some purely typographic
    adjustments are being made, like inserting missing blanks or putting
    breaces on their own lines.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c  | 201 +------------------------------------
 xen/arch/x86/mm/shadow/hvm.c     | 212 +++++++++++++++++++++++++++++++++++++++
 xen/arch/x86/mm/shadow/multi.c   |  25 +++--
 xen/arch/x86/mm/shadow/private.h |   8 ++
 4 files changed, 236 insertions(+), 210 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 773777321f..05a155d1bc 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -999,7 +999,7 @@ void shadow_prealloc(struct domain *d, u32 type, unsigned int count)
 
 /* Deliberately free all the memory we can: this will tear down all of
  * this domain's shadows */
-static void shadow_blow_tables(struct domain *d)
+void shadow_blow_tables(struct domain *d)
 {
     struct page_info *sp, *t;
     struct vcpu *v;
@@ -2029,7 +2029,7 @@ int sh_remove_write_access(struct domain *d, mfn_t gmfn,
 /* Remove all mappings of a guest frame from the shadow tables.
  * Returns non-zero if we need to flush TLBs. */
 
-static int sh_remove_all_mappings(struct domain *d, mfn_t gmfn, gfn_t gfn)
+int sh_remove_all_mappings(struct domain *d, mfn_t gmfn, gfn_t gfn)
 {
     struct page_info *page = mfn_to_page(gmfn);
 
@@ -3162,203 +3162,6 @@ static void sh_clean_dirty_bitmap(struct domain *d)
 }
 
 
-/**************************************************************************/
-/* VRAM dirty tracking support */
-int shadow_track_dirty_vram(struct domain *d,
-                            unsigned long begin_pfn,
-                            unsigned long nr,
-                            XEN_GUEST_HANDLE(void) guest_dirty_bitmap)
-{
-    int rc = 0;
-    unsigned long end_pfn = begin_pfn + nr;
-    unsigned long dirty_size = (nr + 7) / 8;
-    int flush_tlb = 0;
-    unsigned long i;
-    p2m_type_t t;
-    struct sh_dirty_vram *dirty_vram;
-    struct p2m_domain *p2m = p2m_get_hostp2m(d);
-    uint8_t *dirty_bitmap = NULL;
-
-    if ( end_pfn < begin_pfn || end_pfn > p2m->max_mapped_pfn + 1 )
-        return -EINVAL;
-
-    /* We perform p2m lookups, so lock the p2m upfront to avoid deadlock */
-    p2m_lock(p2m_get_hostp2m(d));
-    paging_lock(d);
-
-    dirty_vram = d->arch.hvm.dirty_vram;
-
-    if ( dirty_vram && (!nr ||
-             ( begin_pfn != dirty_vram->begin_pfn
-            || end_pfn   != dirty_vram->end_pfn )) )
-    {
-        /* Different tracking, tear the previous down. */
-        gdprintk(XENLOG_INFO, "stopping tracking VRAM %lx - %lx\n", dirty_vram->begin_pfn, dirty_vram->end_pfn);
-        xfree(dirty_vram->sl1ma);
-        xfree(dirty_vram->dirty_bitmap);
-        xfree(dirty_vram);
-        dirty_vram = d->arch.hvm.dirty_vram = NULL;
-    }
-
-    if ( !nr )
-        goto out;
-
-    dirty_bitmap = vzalloc(dirty_size);
-    if ( dirty_bitmap == NULL )
-    {
-        rc = -ENOMEM;
-        goto out;
-    }
-    /* This should happen seldomly (Video mode change),
-     * no need to be careful. */
-    if ( !dirty_vram )
-    {
-        /* Throw away all the shadows rather than walking through them
-         * up to nr times getting rid of mappings of each pfn */
-        shadow_blow_tables(d);
-
-        gdprintk(XENLOG_INFO, "tracking VRAM %lx - %lx\n", begin_pfn, end_pfn);
-
-        rc = -ENOMEM;
-        if ( (dirty_vram = xmalloc(struct sh_dirty_vram)) == NULL )
-            goto out;
-        dirty_vram->begin_pfn = begin_pfn;
-        dirty_vram->end_pfn = end_pfn;
-        d->arch.hvm.dirty_vram = dirty_vram;
-
-        if ( (dirty_vram->sl1ma = xmalloc_array(paddr_t, nr)) == NULL )
-            goto out_dirty_vram;
-        memset(dirty_vram->sl1ma, ~0, sizeof(paddr_t) * nr);
-
-        if ( (dirty_vram->dirty_bitmap = xzalloc_array(uint8_t, dirty_size)) == NULL )
-            goto out_sl1ma;
-
-        dirty_vram->last_dirty = NOW();
-
-        /* Tell the caller that this time we could not track dirty bits. */
-        rc = -ENODATA;
-    }
-    else if (dirty_vram->last_dirty == -1)
-        /* still completely clean, just copy our empty bitmap */
-        memcpy(dirty_bitmap, dirty_vram->dirty_bitmap, dirty_size);
-    else
-    {
-        mfn_t map_mfn = INVALID_MFN;
-        void *map_sl1p = NULL;
-
-        /* Iterate over VRAM to track dirty bits. */
-        for ( i = 0; i < nr; i++ ) {
-            mfn_t mfn = get_gfn_query_unlocked(d, begin_pfn + i, &t);
-            struct page_info *page;
-            int dirty = 0;
-            paddr_t sl1ma = dirty_vram->sl1ma[i];
-
-            if ( mfn_eq(mfn, INVALID_MFN) )
-                dirty = 1;
-            else
-            {
-                page = mfn_to_page(mfn);
-                switch (page->u.inuse.type_info & PGT_count_mask)
-                {
-                case 0:
-                    /* No guest reference, nothing to track. */
-                    break;
-                case 1:
-                    /* One guest reference. */
-                    if ( sl1ma == INVALID_PADDR )
-                    {
-                        /* We don't know which sl1e points to this, too bad. */
-                        dirty = 1;
-                        /* TODO: Heuristics for finding the single mapping of
-                         * this gmfn */
-                        flush_tlb |= sh_remove_all_mappings(d, mfn,
-                                                            _gfn(begin_pfn + i));
-                    }
-                    else
-                    {
-                        /* Hopefully the most common case: only one mapping,
-                         * whose dirty bit we can use. */
-                        l1_pgentry_t *sl1e;
-                        mfn_t sl1mfn = maddr_to_mfn(sl1ma);
-
-                        if ( !mfn_eq(sl1mfn, map_mfn) )
-                        {
-                            if ( map_sl1p )
-                                unmap_domain_page(map_sl1p);
-                            map_sl1p = map_domain_page(sl1mfn);
-                            map_mfn = sl1mfn;
-                        }
-                        sl1e = map_sl1p + (sl1ma & ~PAGE_MASK);
-
-                        if ( l1e_get_flags(*sl1e) & _PAGE_DIRTY )
-                        {
-                            dirty = 1;
-                            /* Note: this is atomic, so we may clear a
-                             * _PAGE_ACCESSED set by another processor. */
-                            l1e_remove_flags(*sl1e, _PAGE_DIRTY);
-                            flush_tlb = 1;
-                        }
-                    }
-                    break;
-                default:
-                    /* More than one guest reference,
-                     * we don't afford tracking that. */
-                    dirty = 1;
-                    break;
-                }
-            }
-
-            if ( dirty )
-            {
-                dirty_vram->dirty_bitmap[i / 8] |= 1 << (i % 8);
-                dirty_vram->last_dirty = NOW();
-            }
-        }
-
-        if ( map_sl1p )
-            unmap_domain_page(map_sl1p);
-
-        memcpy(dirty_bitmap, dirty_vram->dirty_bitmap, dirty_size);
-        memset(dirty_vram->dirty_bitmap, 0, dirty_size);
-        if ( dirty_vram->last_dirty + SECONDS(2) < NOW() )
-        {
-            /* was clean for more than two seconds, try to disable guest
-             * write access */
-            for ( i = begin_pfn; i < end_pfn; i++ )
-            {
-                mfn_t mfn = get_gfn_query_unlocked(d, i, &t);
-                if ( !mfn_eq(mfn, INVALID_MFN) )
-                    flush_tlb |= sh_remove_write_access(d, mfn, 1, 0);
-            }
-            dirty_vram->last_dirty = -1;
-        }
-    }
-    if ( flush_tlb )
-        guest_flush_tlb_mask(d, d->dirty_cpumask);
-    goto out;
-
-out_sl1ma:
-    xfree(dirty_vram->sl1ma);
-out_dirty_vram:
-    xfree(dirty_vram);
-    dirty_vram = d->arch.hvm.dirty_vram = NULL;
-
-out:
-    paging_unlock(d);
-    if ( rc == 0 && dirty_bitmap != NULL &&
-         copy_to_guest(guest_dirty_bitmap, dirty_bitmap, dirty_size) )
-    {
-        paging_lock(d);
-        for ( i = 0; i < dirty_size; i++ )
-            dirty_vram->dirty_bitmap[i] |= dirty_bitmap[i];
-        paging_unlock(d);
-        rc = -EFAULT;
-    }
-    vfree(dirty_bitmap);
-    p2m_unlock(p2m_get_hostp2m(d));
-    return rc;
-}
-
 /* Fluhs TLB of selected vCPUs. */
 bool shadow_flush_tlb(bool (*flush_vcpu)(void *ctxt, struct vcpu *v),
                       void *ctxt)
diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index 608360daec..c5da7a071c 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -691,6 +691,218 @@ static void sh_emulate_unmap_dest(struct vcpu *v, void *addr,
     atomic_inc(&v->domain->arch.paging.shadow.gtable_dirty_version);
 }
 
+/**************************************************************************/
+/* VRAM dirty tracking support */
+int shadow_track_dirty_vram(struct domain *d,
+                            unsigned long begin_pfn,
+                            unsigned long nr,
+                            XEN_GUEST_HANDLE(void) guest_dirty_bitmap)
+{
+    int rc = 0;
+    unsigned long end_pfn = begin_pfn + nr;
+    unsigned long dirty_size = (nr + 7) / 8;
+    int flush_tlb = 0;
+    unsigned long i;
+    p2m_type_t t;
+    struct sh_dirty_vram *dirty_vram;
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
+    uint8_t *dirty_bitmap = NULL;
+
+    if ( end_pfn < begin_pfn || end_pfn > p2m->max_mapped_pfn + 1 )
+        return -EINVAL;
+
+    /* We perform p2m lookups, so lock the p2m upfront to avoid deadlock */
+    p2m_lock(p2m_get_hostp2m(d));
+    paging_lock(d);
+
+    dirty_vram = d->arch.hvm.dirty_vram;
+
+    if ( dirty_vram && (!nr ||
+             ( begin_pfn != dirty_vram->begin_pfn
+            || end_pfn   != dirty_vram->end_pfn )) )
+    {
+        /* Different tracking, tear the previous down. */
+        gdprintk(XENLOG_INFO, "stopping tracking VRAM %lx - %lx\n", dirty_vram->begin_pfn, dirty_vram->end_pfn);
+        xfree(dirty_vram->sl1ma);
+        xfree(dirty_vram->dirty_bitmap);
+        xfree(dirty_vram);
+        dirty_vram = d->arch.hvm.dirty_vram = NULL;
+    }
+
+    if ( !nr )
+        goto out;
+
+    dirty_bitmap = vzalloc(dirty_size);
+    if ( dirty_bitmap == NULL )
+    {
+        rc = -ENOMEM;
+        goto out;
+    }
+    /*
+     * This should happen seldomly (Video mode change),
+     * no need to be careful.
+     */
+    if ( !dirty_vram )
+    {
+        /*
+         * Throw away all the shadows rather than walking through them
+         * up to nr times getting rid of mappings of each pfn.
+         */
+        shadow_blow_tables(d);
+
+        gdprintk(XENLOG_INFO, "tracking VRAM %lx - %lx\n", begin_pfn, end_pfn);
+
+        rc = -ENOMEM;
+        if ( (dirty_vram = xmalloc(struct sh_dirty_vram)) == NULL )
+            goto out;
+        dirty_vram->begin_pfn = begin_pfn;
+        dirty_vram->end_pfn = end_pfn;
+        d->arch.hvm.dirty_vram = dirty_vram;
+
+        if ( (dirty_vram->sl1ma = xmalloc_array(paddr_t, nr)) == NULL )
+            goto out_dirty_vram;
+        memset(dirty_vram->sl1ma, ~0, sizeof(paddr_t) * nr);
+
+        if ( (dirty_vram->dirty_bitmap = xzalloc_array(uint8_t, dirty_size)) == NULL )
+            goto out_sl1ma;
+
+        dirty_vram->last_dirty = NOW();
+
+        /* Tell the caller that this time we could not track dirty bits. */
+        rc = -ENODATA;
+    }
+    else if ( dirty_vram->last_dirty == -1 )
+        /* still completely clean, just copy our empty bitmap */
+        memcpy(dirty_bitmap, dirty_vram->dirty_bitmap, dirty_size);
+    else
+    {
+        mfn_t map_mfn = INVALID_MFN;
+        void *map_sl1p = NULL;
+
+        /* Iterate over VRAM to track dirty bits. */
+        for ( i = 0; i < nr; i++ )
+        {
+            mfn_t mfn = get_gfn_query_unlocked(d, begin_pfn + i, &t);
+            struct page_info *page;
+            int dirty = 0;
+            paddr_t sl1ma = dirty_vram->sl1ma[i];
+
+            if ( mfn_eq(mfn, INVALID_MFN) )
+                dirty = 1;
+            else
+            {
+                page = mfn_to_page(mfn);
+                switch ( page->u.inuse.type_info & PGT_count_mask )
+                {
+                case 0:
+                    /* No guest reference, nothing to track. */
+                    break;
+
+                case 1:
+                    /* One guest reference. */
+                    if ( sl1ma == INVALID_PADDR )
+                    {
+                        /* We don't know which sl1e points to this, too bad. */
+                        dirty = 1;
+                        /*
+                         * TODO: Heuristics for finding the single mapping of
+                         * this gmfn
+                         */
+                        flush_tlb |= sh_remove_all_mappings(d, mfn,
+                                                            _gfn(begin_pfn + i));
+                    }
+                    else
+                    {
+                        /*
+                         * Hopefully the most common case: only one mapping,
+                         * whose dirty bit we can use.
+                         */
+                        l1_pgentry_t *sl1e;
+                        mfn_t sl1mfn = maddr_to_mfn(sl1ma);
+
+                        if ( !mfn_eq(sl1mfn, map_mfn) )
+                        {
+                            if ( map_sl1p )
+                                unmap_domain_page(map_sl1p);
+                            map_sl1p = map_domain_page(sl1mfn);
+                            map_mfn = sl1mfn;
+                        }
+                        sl1e = map_sl1p + (sl1ma & ~PAGE_MASK);
+
+                        if ( l1e_get_flags(*sl1e) & _PAGE_DIRTY )
+                        {
+                            dirty = 1;
+                            /*
+                             * Note: this is atomic, so we may clear a
+                             * _PAGE_ACCESSED set by another processor.
+                             */
+                            l1e_remove_flags(*sl1e, _PAGE_DIRTY);
+                            flush_tlb = 1;
+                        }
+                    }
+                    break;
+
+                default:
+                    /* More than one guest reference,
+                     * we don't afford tracking that. */
+                    dirty = 1;
+                    break;
+                }
+            }
+
+            if ( dirty )
+            {
+                dirty_vram->dirty_bitmap[i / 8] |= 1 << (i % 8);
+                dirty_vram->last_dirty = NOW();
+            }
+        }
+
+        if ( map_sl1p )
+            unmap_domain_page(map_sl1p);
+
+        memcpy(dirty_bitmap, dirty_vram->dirty_bitmap, dirty_size);
+        memset(dirty_vram->dirty_bitmap, 0, dirty_size);
+        if ( dirty_vram->last_dirty + SECONDS(2) < NOW() )
+        {
+            /*
+             * Was clean for more than two seconds, try to disable guest
+             * write access.
+             */
+            for ( i = begin_pfn; i < end_pfn; i++ )
+            {
+                mfn_t mfn = get_gfn_query_unlocked(d, i, &t);
+                if ( !mfn_eq(mfn, INVALID_MFN) )
+                    flush_tlb |= sh_remove_write_access(d, mfn, 1, 0);
+            }
+            dirty_vram->last_dirty = -1;
+        }
+    }
+    if ( flush_tlb )
+        guest_flush_tlb_mask(d, d->dirty_cpumask);
+    goto out;
+
+ out_sl1ma:
+    xfree(dirty_vram->sl1ma);
+ out_dirty_vram:
+    xfree(dirty_vram);
+    dirty_vram = d->arch.hvm.dirty_vram = NULL;
+
+ out:
+    paging_unlock(d);
+    if ( rc == 0 && dirty_bitmap != NULL &&
+         copy_to_guest(guest_dirty_bitmap, dirty_bitmap, dirty_size) )
+    {
+        paging_lock(d);
+        for ( i = 0; i < dirty_size; i++ )
+            dirty_vram->dirty_bitmap[i] |= dirty_bitmap[i];
+        paging_unlock(d);
+        rc = -EFAULT;
+    }
+    vfree(dirty_bitmap);
+    p2m_unlock(p2m_get_hostp2m(d));
+    return rc;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 7d16d1c1a9..e34937f43b 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -494,7 +494,6 @@ _sh_propagate(struct vcpu *v,
     guest_l1e_t guest_entry = { guest_intpte };
     shadow_l1e_t *sp = shadow_entry_ptr;
     struct domain *d = v->domain;
-    struct sh_dirty_vram *dirty_vram = d->arch.hvm.dirty_vram;
     gfn_t target_gfn = guest_l1e_get_gfn(guest_entry);
     u32 pass_thru_flags;
     u32 gflags, sflags;
@@ -649,15 +648,19 @@ _sh_propagate(struct vcpu *v,
         }
     }
 
-    if ( unlikely((level == 1) && dirty_vram
-            && dirty_vram->last_dirty == -1
-            && gfn_x(target_gfn) >= dirty_vram->begin_pfn
-            && gfn_x(target_gfn) < dirty_vram->end_pfn) )
+    if ( unlikely(level == 1) && is_hvm_domain(d) )
     {
-        if ( ft & FETCH_TYPE_WRITE )
-            dirty_vram->last_dirty = NOW();
-        else
-            sflags &= ~_PAGE_RW;
+        struct sh_dirty_vram *dirty_vram = d->arch.hvm.dirty_vram;
+
+        if ( dirty_vram && dirty_vram->last_dirty == -1 &&
+             gfn_x(target_gfn) >= dirty_vram->begin_pfn &&
+             gfn_x(target_gfn) < dirty_vram->end_pfn )
+        {
+            if ( ft & FETCH_TYPE_WRITE )
+                dirty_vram->last_dirty = NOW();
+            else
+                sflags &= ~_PAGE_RW;
+        }
     }
 
     /* Read-only memory */
@@ -1082,7 +1085,7 @@ static inline void shadow_vram_get_l1e(shadow_l1e_t new_sl1e,
     unsigned long gfn;
     struct sh_dirty_vram *dirty_vram = d->arch.hvm.dirty_vram;
 
-    if ( !dirty_vram         /* tracking disabled? */
+    if ( !is_hvm_domain(d) || !dirty_vram /* tracking disabled? */
          || !(flags & _PAGE_RW) /* read-only mapping? */
          || !mfn_valid(mfn) )   /* mfn can be invalid in mmio_direct */
         return;
@@ -1113,7 +1116,7 @@ static inline void shadow_vram_put_l1e(shadow_l1e_t old_sl1e,
     unsigned long gfn;
     struct sh_dirty_vram *dirty_vram = d->arch.hvm.dirty_vram;
 
-    if ( !dirty_vram         /* tracking disabled? */
+    if ( !is_hvm_domain(d) || !dirty_vram /* tracking disabled? */
          || !(flags & _PAGE_RW) /* read-only mapping? */
          || !mfn_valid(mfn) )   /* mfn can be invalid in mmio_direct */
         return;
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 3fd3f0617a..eb5d1e3fab 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -438,6 +438,14 @@ mfn_t oos_snapshot_lookup(struct domain *d, mfn_t gmfn);
 
 #endif /* (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) */
 
+/* Deliberately free all the memory we can: tear down all of d's shadows. */
+void shadow_blow_tables(struct domain *d);
+
+/*
+ * Remove all mappings of a guest frame from the shadow tables.
+ * Returns non-zero if we need to flush TLBs.
+ */
+int sh_remove_all_mappings(struct domain *d, mfn_t gmfn, gfn_t gfn);
 
 /* Reset the up-pointers of every L3 shadow to 0.
  * This is called when l3 shadows stop being pinnable, to clear out all
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 21 12:11:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Jul 2020 12:11: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 1jxr78-00079s-Cv; Tue, 21 Jul 2020 12:11:18 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5KM5=BA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxr76-00079k-PN
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:11:16 +0000
X-Inumbo-ID: 466bab04-cb4b-11ea-8509-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 466bab04-cb4b-11ea-8509-bc764e2007e4;
 Tue, 21 Jul 2020 12:11:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Qz660wI6CeqyGK7yZU1kUg3Qp31aaP3nOq4o5SeLGNw=; b=fwbkbns/JhfW6HP2Yw694P0NVd
 LVD4xOYbprnqY0ND6sbKCozqW3y58wmnFdz2mWCvpeF6y90CKWmAeqvtMQwfgm+FGy5v1YkMDEYjj
 XqNV8GuHbzz7DTx2YVXCG8FMzh6xBgYsypMvNVBp5dHuOGX41w8PK7AxXcn/rYv85HvU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxr75-0005Mb-6B
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxr75-0004Lv-3K
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:11:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/shadow: shadow_table[] needs only one entry for
 PV-only configs
Message-Id: <E1jxr75-0004Lv-3K@xenbits.xenproject.org>
Date: Tue, 21 Jul 2020 12:11:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ef3b0d8d2c3975c5cdd6a521896d85e97b74e924
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 21 13:58:15 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 21 13:58:15 2020 +0200

    x86/shadow: shadow_table[] needs only one entry for PV-only configs
    
    Furthermore the field isn't needed at all with shadow support disabled -
    move it into struct shadow_vcpu.
    
    Introduce for_each_shadow_table(), shortening loops for the 4-level case
    at the same time.
    
    Adjust loop variables and a function parameter to be "unsigned int"
    where applicable at the same time. Also move a comment that ended up
    misplaced due to incremental additions.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c | 20 +++++----
 xen/arch/x86/mm/shadow/multi.c  | 97 ++++++++++++++++++++++-------------------
 xen/include/asm-x86/domain.h    | 16 +++++--
 3 files changed, 78 insertions(+), 55 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 05a155d1bc..a2554d9351 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -959,13 +959,15 @@ static void _shadow_prealloc(struct domain *d, unsigned int pages)
     perfc_incr(shadow_prealloc_2);
 
     for_each_vcpu(d, v)
-        for ( i = 0 ; i < 4 ; i++ )
+        for ( i = 0; i < ARRAY_SIZE(v->arch.paging.shadow.shadow_table); i++ )
         {
-            if ( !pagetable_is_null(v->arch.shadow_table[i]) )
+            if ( !pagetable_is_null(v->arch.paging.shadow.shadow_table[i]) )
             {
                 TRACE_SHADOW_PATH_FLAG(TRCE_SFLAG_PREALLOC_UNHOOK);
-                shadow_unhook_mappings(d,
-                               pagetable_get_mfn(v->arch.shadow_table[i]), 0);
+                shadow_unhook_mappings(
+                    d,
+                    pagetable_get_mfn(v->arch.paging.shadow.shadow_table[i]),
+                    0);
 
                 /* See if that freed up enough space */
                 if ( d->arch.paging.shadow.free_pages >= pages )
@@ -1018,10 +1020,12 @@ void shadow_blow_tables(struct domain *d)
 
     /* Second pass: unhook entries of in-use shadows */
     for_each_vcpu(d, v)
-        for ( i = 0 ; i < 4 ; i++ )
-            if ( !pagetable_is_null(v->arch.shadow_table[i]) )
-                shadow_unhook_mappings(d,
-                               pagetable_get_mfn(v->arch.shadow_table[i]), 0);
+        for ( i = 0; i < ARRAY_SIZE(v->arch.paging.shadow.shadow_table); i++ )
+            if ( !pagetable_is_null(v->arch.paging.shadow.shadow_table[i]) )
+                shadow_unhook_mappings(
+                    d,
+                    pagetable_get_mfn(v->arch.paging.shadow.shadow_table[i]),
+                    0);
 
     /* Make sure everyone sees the unshadowings */
     guest_flush_tlb_mask(d, d->dirty_cpumask);
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index e34937f43b..9c8cb21349 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -85,6 +85,15 @@ const char *const fetch_type_names[] = {
 };
 #endif
 
+#if SHADOW_PAGING_LEVELS == 3
+# define for_each_shadow_table(v, i) \
+    for ( (i) = 0; \
+          (i) < ARRAY_SIZE((v)->arch.paging.shadow.shadow_table); \
+          ++(i) )
+#else
+# define for_each_shadow_table(v, i) for ( (i) = 0; (i) < 1; ++(i) )
+#endif
+
 /* Helper to perform a local TLB flush. */
 static void sh_flush_local(const struct domain *d)
 {
@@ -1624,7 +1633,7 @@ static shadow_l4e_t * shadow_get_and_create_l4e(struct vcpu *v,
                                                 mfn_t *sl4mfn)
 {
     /* There is always a shadow of the top level table.  Get it. */
-    *sl4mfn = pagetable_get_mfn(v->arch.shadow_table[0]);
+    *sl4mfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[0]);
     /* Reading the top level table is always valid. */
     return sh_linear_l4_table(v) + shadow_l4_linear_offset(gw->va);
 }
@@ -1740,7 +1749,7 @@ static shadow_l2e_t * shadow_get_and_create_l2e(struct vcpu *v,
     return sh_linear_l2_table(v) + shadow_l2_linear_offset(gw->va);
 #else /* 32bit... */
     /* There is always a shadow of the top level table.  Get it. */
-    *sl2mfn = pagetable_get_mfn(v->arch.shadow_table[0]);
+    *sl2mfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[0]);
     /* This next line is important: the guest l2 has a 16k
      * shadow, we need to return the right mfn of the four. This
      * call will set it for us as a side-effect. */
@@ -2333,6 +2342,7 @@ int sh_safe_not_to_sync(struct vcpu *v, mfn_t gl1mfn)
     struct domain *d = v->domain;
     struct page_info *sp;
     mfn_t smfn;
+    unsigned int i;
 
     if ( !sh_type_has_up_pointer(d, SH_type_l1_shadow) )
         return 0;
@@ -2365,14 +2375,10 @@ int sh_safe_not_to_sync(struct vcpu *v, mfn_t gl1mfn)
     ASSERT(mfn_valid(smfn));
 #endif
 
-    if ( pagetable_get_pfn(v->arch.shadow_table[0]) == mfn_x(smfn)
-#if (SHADOW_PAGING_LEVELS == 3)
-         || pagetable_get_pfn(v->arch.shadow_table[1]) == mfn_x(smfn)
-         || pagetable_get_pfn(v->arch.shadow_table[2]) == mfn_x(smfn)
-         || pagetable_get_pfn(v->arch.shadow_table[3]) == mfn_x(smfn)
-#endif
-        )
-        return 0;
+    for_each_shadow_table(v, i)
+        if ( pagetable_get_pfn(v->arch.paging.shadow.shadow_table[i]) ==
+             mfn_x(smfn) )
+            return 0;
 
     /* Only in use in one toplevel shadow, and it's not the one we're
      * running on */
@@ -3287,10 +3293,12 @@ static int sh_page_fault(struct vcpu *v,
         for_each_vcpu(d, tmp)
         {
 #if GUEST_PAGING_LEVELS == 3
-            int i;
-            for ( i = 0; i < 4; i++ )
+            unsigned int i;
+
+            for_each_shadow_table(v, i)
             {
-                mfn_t smfn = pagetable_get_mfn(v->arch.shadow_table[i]);
+                mfn_t smfn = pagetable_get_mfn(
+                                 v->arch.paging.shadow.shadow_table[i]);
 
                 if ( mfn_valid(smfn) && (mfn_x(smfn) != 0) )
                 {
@@ -3707,7 +3715,7 @@ sh_update_linear_entries(struct vcpu *v)
      *
      * Because HVM guests run on the same monitor tables regardless of the
      * shadow tables in use, the linear mapping of the shadow tables has to
-     * be updated every time v->arch.shadow_table changes.
+     * be updated every time v->arch.paging.shadow.shadow_table changes.
      */
 
     /* Don't try to update the monitor table if it doesn't exist */
@@ -3723,8 +3731,9 @@ sh_update_linear_entries(struct vcpu *v)
     if ( v == current )
     {
         __linear_l4_table[l4_linear_offset(SH_LINEAR_PT_VIRT_START)] =
-            l4e_from_pfn(pagetable_get_pfn(v->arch.shadow_table[0]),
-                         __PAGE_HYPERVISOR_RW);
+            l4e_from_pfn(
+                pagetable_get_pfn(v->arch.paging.shadow.shadow_table[0]),
+                __PAGE_HYPERVISOR_RW);
     }
     else
     {
@@ -3732,8 +3741,9 @@ sh_update_linear_entries(struct vcpu *v)
 
         ml4e = map_domain_page(pagetable_get_mfn(v->arch.hvm.monitor_table));
         ml4e[l4_table_offset(SH_LINEAR_PT_VIRT_START)] =
-            l4e_from_pfn(pagetable_get_pfn(v->arch.shadow_table[0]),
-                         __PAGE_HYPERVISOR_RW);
+            l4e_from_pfn(
+                pagetable_get_pfn(v->arch.paging.shadow.shadow_table[0]),
+                __PAGE_HYPERVISOR_RW);
         unmap_domain_page(ml4e);
     }
 
@@ -3812,7 +3822,7 @@ sh_update_linear_entries(struct vcpu *v)
 
 
 /*
- * Removes vcpu->arch.shadow_table[].
+ * Removes v->arch.paging.shadow.shadow_table[].
  * Does all appropriate management/bookkeeping/refcounting/etc...
  */
 static void
@@ -3820,38 +3830,34 @@ sh_detach_old_tables(struct vcpu *v)
 {
     struct domain *d = v->domain;
     mfn_t smfn;
-    int i = 0;
+    unsigned int i;
 
     ////
-    //// vcpu->arch.shadow_table[]
+    //// vcpu->arch.paging.shadow.shadow_table[]
     ////
 
-#if GUEST_PAGING_LEVELS == 3
-    /* PAE guests have four shadow_table entries */
-    for ( i = 0 ; i < 4 ; i++ )
-#endif
+    for_each_shadow_table(v, i)
     {
-        smfn = pagetable_get_mfn(v->arch.shadow_table[i]);
+        smfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[i]);
         if ( mfn_x(smfn) )
             sh_put_ref(d, smfn, 0);
-        v->arch.shadow_table[i] = pagetable_null();
+        v->arch.paging.shadow.shadow_table[i] = pagetable_null();
     }
 }
 
 /* Set up the top-level shadow and install it in slot 'slot' of shadow_table */
 static void
 sh_set_toplevel_shadow(struct vcpu *v,
-                       int slot,
+                       unsigned int slot,
                        mfn_t gmfn,
                        unsigned int root_type)
 {
     mfn_t smfn;
     pagetable_t old_entry, new_entry;
-
     struct domain *d = v->domain;
 
     /* Remember the old contents of this slot */
-    old_entry = v->arch.shadow_table[slot];
+    old_entry = v->arch.paging.shadow.shadow_table[slot];
 
     /* Now figure out the new contents: is this a valid guest MFN? */
     if ( !mfn_valid(gmfn) )
@@ -3893,7 +3899,7 @@ sh_set_toplevel_shadow(struct vcpu *v,
     SHADOW_PRINTK("%u/%u [%u] gmfn %#"PRI_mfn" smfn %#"PRI_mfn"\n",
                   GUEST_PAGING_LEVELS, SHADOW_PAGING_LEVELS, slot,
                   mfn_x(gmfn), mfn_x(pagetable_get_mfn(new_entry)));
-    v->arch.shadow_table[slot] = new_entry;
+    v->arch.paging.shadow.shadow_table[slot] = new_entry;
 
     /* Decrement the refcount of the old contents of this slot */
     if ( !pagetable_is_null(old_entry) ) {
@@ -3999,7 +4005,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 
 
     ////
-    //// vcpu->arch.shadow_table[]
+    //// vcpu->arch.paging.shadow.shadow_table[]
     ////
 
     /* We revoke write access to the new guest toplevel page(s) before we
@@ -4056,7 +4062,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
     sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l4_shadow);
     if ( !shadow_mode_external(d) && !is_pv_32bit_domain(d) )
     {
-        mfn_t smfn = pagetable_get_mfn(v->arch.shadow_table[0]);
+        mfn_t smfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[0]);
 
         if ( !(v->arch.flags & TF_kernel_mode) && VM_ASSIST(d, m2p_strict) )
             zap_ro_mpt(smfn);
@@ -4074,9 +4080,10 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
     ///
 #if SHADOW_PAGING_LEVELS == 3
         {
-            mfn_t smfn = pagetable_get_mfn(v->arch.shadow_table[0]);
-            int i;
-            for ( i = 0; i < 4; i++ )
+            mfn_t smfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[0]);
+            unsigned int i;
+
+            for_each_shadow_table(v, i)
             {
 #if GUEST_PAGING_LEVELS == 2
                 /* 2-on-3: make a PAE l3 that points at the four-page l2 */
@@ -4084,7 +4091,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
                     smfn = sh_next_page(smfn);
 #else
                 /* 3-on-3: make a PAE l3 that points at the four l2 pages */
-                smfn = pagetable_get_mfn(v->arch.shadow_table[i]);
+                smfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[i]);
 #endif
                 v->arch.paging.shadow.l3table[i] =
                     (mfn_x(smfn) == 0)
@@ -4108,7 +4115,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
         /* We don't support PV except guest == shadow == config levels */
         BUILD_BUG_ON(GUEST_PAGING_LEVELS != SHADOW_PAGING_LEVELS);
         /* Just use the shadow top-level directly */
-        make_cr3(v, pagetable_get_mfn(v->arch.shadow_table[0]));
+        make_cr3(v, pagetable_get_mfn(v->arch.paging.shadow.shadow_table[0]));
     }
 #endif
 
@@ -4124,7 +4131,8 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
         v->arch.hvm.hw_cr[3] = virt_to_maddr(&v->arch.paging.shadow.l3table);
 #else
         /* 4-on-4: Just use the shadow top-level directly */
-        v->arch.hvm.hw_cr[3] = pagetable_get_paddr(v->arch.shadow_table[0]);
+        v->arch.hvm.hw_cr[3] =
+            pagetable_get_paddr(v->arch.paging.shadow.shadow_table[0]);
 #endif
         hvm_update_guest_cr3(v, noflush);
     }
@@ -4443,7 +4451,7 @@ static void sh_pagetable_dying(paddr_t gpa)
 {
     struct vcpu *v = current;
     struct domain *d = v->domain;
-    int i = 0;
+    unsigned int i;
     int flush = 0;
     int fast_path = 0;
     paddr_t gcr3 = 0;
@@ -4474,15 +4482,16 @@ static void sh_pagetable_dying(paddr_t gpa)
         gl3pa = map_domain_page(l3mfn);
         gl3e = (guest_l3e_t *)(gl3pa + ((unsigned long)gpa & ~PAGE_MASK));
     }
-    for ( i = 0; i < 4; i++ )
+    for_each_shadow_table(v, i)
     {
         mfn_t smfn, gmfn;
 
-        if ( fast_path ) {
-            if ( pagetable_is_null(v->arch.shadow_table[i]) )
+        if ( fast_path )
+        {
+            if ( pagetable_is_null(v->arch.paging.shadow.shadow_table[i]) )
                 smfn = INVALID_MFN;
             else
-                smfn = pagetable_get_mfn(v->arch.shadow_table[i]);
+                smfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[i]);
         }
         else
         {
diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h
index 6fd94c2e14..3f5412d5ab 100644
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
@@ -135,6 +135,14 @@ struct shadow_vcpu {
     l3_pgentry_t l3table[4] __attribute__((__aligned__(32)));
     /* PAE guests: per-vcpu cache of the top-level *guest* entries */
     l3_pgentry_t gl3e[4] __attribute__((__aligned__(32)));
+
+    /* shadow(s) of guest (MFN) */
+#ifdef CONFIG_HVM
+    pagetable_t shadow_table[4];
+#else
+    pagetable_t shadow_table[1];
+#endif
+
     /* Last MFN that we emulated a write to as unshadow heuristics. */
     unsigned long last_emulated_mfn_for_unshadow;
     /* MFN of the last shadow that we shot a writeable mapping in */
@@ -576,6 +584,10 @@ struct arch_vcpu
         struct hvm_vcpu hvm;
     };
 
+    /*
+     * guest_table{,_user} hold a ref to the page, and also a type-count
+     * unless shadow refcounts are in use
+     */
     pagetable_t guest_table_user;       /* (MFN) x86/64 user-space pagetable */
     pagetable_t guest_table;            /* (MFN) guest notion of cr3 */
     struct page_info *old_guest_table;  /* partially destructed pagetable */
@@ -583,9 +595,7 @@ struct arch_vcpu
                                         /* former, if any */
     bool old_guest_table_partial;       /* Are we dropping a type ref, or just
                                          * finishing up a partial de-validation? */
-    /* guest_table holds a ref to the page, and also a type-count unless
-     * shadow refcounts are in use */
-    pagetable_t shadow_table[4];        /* (MFN) shadow(s) of guest */
+
     unsigned long cr3;                  /* (MA) value to install in HW CR3 */
 
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 21 12:11:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Jul 2020 12:11:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jxr7H-0007BG-HB; Tue, 21 Jul 2020 12:11:27 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5KM5=BA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxr7F-0007B3-Vt
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:11:26 +0000
X-Inumbo-ID: 4c6e04e8-cb4b-11ea-a0ab-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 4c6e04e8-cb4b-11ea-a0ab-12813bfff9fa;
 Tue, 21 Jul 2020 12:11:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Wps7Y9lvl+B+6JUQyQESaeMccxK6YVzTQeDWUAXsvmU=; b=AkNXb8XnhL6UHFNeS5DbE1Rhx/
 dkecDkV+pBi1EbmF1GbETRuiOQy1ekrCm6L79wktxR5IvpdU7pA6HFeB2ND80TZZXwgjpqjzMuUF+
 aUvOW7aronCOiqR5RnHyyN8bEoAmoTvXW1AbmJ8VB9KI0071WO29LwGvEWCnXWoGGG58=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxr7F-0005Ov-9c
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxr7F-0004N2-8g
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:11:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/shadow: have just a single instance of
 sh_set_toplevel_shadow()
Message-Id: <E1jxr7F-0004N2-8g@xenbits.xenproject.org>
Date: Tue, 21 Jul 2020 12:11:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 5fd152ea7dfbd7e83c4f398bc8d7273466b88cbb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 21 13:58:56 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 21 13:58:56 2020 +0200

    x86/shadow: have just a single instance of sh_set_toplevel_shadow()
    
    The only guest/shadow level dependent piece here is the call to
    sh_make_shadow(). Make a pointer to the respective function an
    argument of sh_set_toplevel_shadow(), allowing it to be moved to
    common.c.
    
    This implies making get_shadow_status() available to common.c; its set
    and delete counterparts are moved along with it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c  |  74 ++++++++++++++++++++++
 xen/arch/x86/mm/shadow/multi.c   | 130 +++------------------------------------
 xen/arch/x86/mm/shadow/private.h |  61 ++++++++++++++++++
 3 files changed, 143 insertions(+), 122 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index a2554d9351..7c7204fd34 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -2560,6 +2560,80 @@ void shadow_update_paging_modes(struct vcpu *v)
     paging_unlock(v->domain);
 }
 
+/* Set up the top-level shadow and install it in slot 'slot' of shadow_table */
+void sh_set_toplevel_shadow(struct vcpu *v,
+                            unsigned int slot,
+                            mfn_t gmfn,
+                            unsigned int root_type,
+                            mfn_t (*make_shadow)(struct vcpu *v,
+                                                 mfn_t gmfn,
+                                                 uint32_t shadow_type))
+{
+    mfn_t smfn;
+    pagetable_t old_entry, new_entry;
+    struct domain *d = v->domain;
+
+    /* Remember the old contents of this slot */
+    old_entry = v->arch.paging.shadow.shadow_table[slot];
+
+    /* Now figure out the new contents: is this a valid guest MFN? */
+    if ( !mfn_valid(gmfn) )
+    {
+        new_entry = pagetable_null();
+        goto install_new_entry;
+    }
+
+    /* Guest mfn is valid: shadow it and install the shadow */
+    smfn = get_shadow_status(d, gmfn, root_type);
+    if ( !mfn_valid(smfn) )
+    {
+        /* Make sure there's enough free shadow memory. */
+        shadow_prealloc(d, root_type, 1);
+        /* Shadow the page. */
+        smfn = make_shadow(v, gmfn, root_type);
+    }
+    ASSERT(mfn_valid(smfn));
+
+    /* Take a ref to this page: it will be released in sh_detach_old_tables()
+     * or the next call to set_toplevel_shadow() */
+    if ( sh_get_ref(d, smfn, 0) )
+    {
+        /* Pin the shadow and put it (back) on the list of pinned shadows */
+        sh_pin(d, smfn);
+
+        new_entry = pagetable_from_mfn(smfn);
+    }
+    else
+    {
+        printk(XENLOG_G_ERR "can't install %"PRI_mfn" as toplevel shadow\n",
+               mfn_x(smfn));
+        domain_crash(d);
+        new_entry = pagetable_null();
+    }
+
+ install_new_entry:
+    /* Done.  Install it */
+    SHADOW_PRINTK("%u [%u] gmfn %#"PRI_mfn" smfn %#"PRI_mfn"\n",
+                  v->arch.paging.mode->shadow.shadow_levels, slot,
+                  mfn_x(gmfn), mfn_x(pagetable_get_mfn(new_entry)));
+    v->arch.paging.shadow.shadow_table[slot] = new_entry;
+
+    /* Decrement the refcount of the old contents of this slot */
+    if ( !pagetable_is_null(old_entry) )
+    {
+        mfn_t old_smfn = pagetable_get_mfn(old_entry);
+        /* Need to repin the old toplevel shadow if it's been unpinned
+         * by shadow_prealloc(): in PV mode we're still running on this
+         * shadow and it's not safe to free it yet. */
+        if ( !mfn_to_page(old_smfn)->u.sh.pinned && !sh_pin(d, old_smfn) )
+        {
+            printk(XENLOG_G_ERR "can't re-pin %"PRI_mfn"\n", mfn_x(old_smfn));
+            domain_crash(d);
+        }
+        sh_put_ref(d, old_smfn, 0);
+    }
+}
+
 /**************************************************************************/
 /* Turning on and off shadow features */
 
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 9c8cb21349..088d27362d 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -103,7 +103,7 @@ static void sh_flush_local(const struct domain *d)
 /**************************************************************************/
 /* Hash table mapping from guest pagetables to shadows
  *
- * Normal case: maps the mfn of a guest page to the mfn of its shadow page.
+ * normal case: see private.h.
  * FL1's:       maps the *gfn* of the start of a superpage to the mfn of a
  *              shadow L1 which maps its "splinters".
  */
@@ -117,16 +117,6 @@ get_fl1_shadow_status(struct domain *d, gfn_t gfn)
     return smfn;
 }
 
-static inline mfn_t
-get_shadow_status(struct domain *d, mfn_t gmfn, u32 shadow_type)
-/* Look for shadows in the hash table */
-{
-    mfn_t smfn = shadow_hash_lookup(d, mfn_x(gmfn), shadow_type);
-    ASSERT(!mfn_valid(smfn) || mfn_to_page(smfn)->u.sh.head);
-    perfc_incr(shadow_get_shadow_status);
-    return smfn;
-}
-
 static inline void
 set_fl1_shadow_status(struct domain *d, gfn_t gfn, mfn_t smfn)
 /* Put an FL1 shadow into the hash table */
@@ -138,27 +128,6 @@ set_fl1_shadow_status(struct domain *d, gfn_t gfn, mfn_t smfn)
     shadow_hash_insert(d, gfn_x(gfn), SH_type_fl1_shadow, smfn);
 }
 
-static inline void
-set_shadow_status(struct domain *d, mfn_t gmfn, u32 shadow_type, mfn_t smfn)
-/* Put a shadow into the hash table */
-{
-    int res;
-
-    SHADOW_PRINTK("d%d gmfn=%lx, type=%08x, smfn=%lx\n",
-                  d->domain_id, mfn_x(gmfn), shadow_type, mfn_x(smfn));
-
-    ASSERT(mfn_to_page(smfn)->u.sh.head);
-
-    /* 32-bit PV guests don't own their l4 pages so can't get_page them */
-    if ( !is_pv_32bit_domain(d) || shadow_type != SH_type_l4_64_shadow )
-    {
-        res = get_page(mfn_to_page(gmfn), d);
-        ASSERT(res == 1);
-    }
-
-    shadow_hash_insert(d, mfn_x(gmfn), shadow_type, smfn);
-}
-
 static inline void
 delete_fl1_shadow_status(struct domain *d, gfn_t gfn, mfn_t smfn)
 /* Remove a shadow from the hash table */
@@ -169,19 +138,6 @@ delete_fl1_shadow_status(struct domain *d, gfn_t gfn, mfn_t smfn)
     shadow_hash_delete(d, gfn_x(gfn), SH_type_fl1_shadow, smfn);
 }
 
-static inline void
-delete_shadow_status(struct domain *d, mfn_t gmfn, u32 shadow_type, mfn_t smfn)
-/* Remove a shadow from the hash table */
-{
-    SHADOW_PRINTK("d%d gmfn=%"PRI_mfn", type=%08x, smfn=%"PRI_mfn"\n",
-                  d->domain_id, mfn_x(gmfn), shadow_type, mfn_x(smfn));
-    ASSERT(mfn_to_page(smfn)->u.sh.head);
-    shadow_hash_delete(d, mfn_x(gmfn), shadow_type, smfn);
-    /* 32-bit PV guests don't own their l4 pages; see set_shadow_status */
-    if ( !is_pv_32bit_domain(d) || shadow_type != SH_type_l4_64_shadow )
-        put_page(mfn_to_page(gmfn));
-}
-
 
 /**************************************************************************/
 /* Functions for walking the guest page tables */
@@ -3845,78 +3801,6 @@ sh_detach_old_tables(struct vcpu *v)
     }
 }
 
-/* Set up the top-level shadow and install it in slot 'slot' of shadow_table */
-static void
-sh_set_toplevel_shadow(struct vcpu *v,
-                       unsigned int slot,
-                       mfn_t gmfn,
-                       unsigned int root_type)
-{
-    mfn_t smfn;
-    pagetable_t old_entry, new_entry;
-    struct domain *d = v->domain;
-
-    /* Remember the old contents of this slot */
-    old_entry = v->arch.paging.shadow.shadow_table[slot];
-
-    /* Now figure out the new contents: is this a valid guest MFN? */
-    if ( !mfn_valid(gmfn) )
-    {
-        new_entry = pagetable_null();
-        goto install_new_entry;
-    }
-
-    /* Guest mfn is valid: shadow it and install the shadow */
-    smfn = get_shadow_status(d, gmfn, root_type);
-    if ( !mfn_valid(smfn) )
-    {
-        /* Make sure there's enough free shadow memory. */
-        shadow_prealloc(d, root_type, 1);
-        /* Shadow the page. */
-        smfn = sh_make_shadow(v, gmfn, root_type);
-    }
-    ASSERT(mfn_valid(smfn));
-
-    /* Take a ref to this page: it will be released in sh_detach_old_tables()
-     * or the next call to set_toplevel_shadow() */
-    if ( sh_get_ref(d, smfn, 0) )
-    {
-        /* Pin the shadow and put it (back) on the list of pinned shadows */
-        sh_pin(d, smfn);
-
-        new_entry = pagetable_from_mfn(smfn);
-    }
-    else
-    {
-        printk(XENLOG_G_ERR "can't install %"PRI_mfn" as toplevel shadow\n",
-               mfn_x(smfn));
-        domain_crash(d);
-        new_entry = pagetable_null();
-    }
-
- install_new_entry:
-    /* Done.  Install it */
-    SHADOW_PRINTK("%u/%u [%u] gmfn %#"PRI_mfn" smfn %#"PRI_mfn"\n",
-                  GUEST_PAGING_LEVELS, SHADOW_PAGING_LEVELS, slot,
-                  mfn_x(gmfn), mfn_x(pagetable_get_mfn(new_entry)));
-    v->arch.paging.shadow.shadow_table[slot] = new_entry;
-
-    /* Decrement the refcount of the old contents of this slot */
-    if ( !pagetable_is_null(old_entry) ) {
-        mfn_t old_smfn = pagetable_get_mfn(old_entry);
-        /* Need to repin the old toplevel shadow if it's been unpinned
-         * by shadow_prealloc(): in PV mode we're still running on this
-         * shadow and it's not safe to free it yet. */
-        if ( !mfn_to_page(old_smfn)->u.sh.pinned && !sh_pin(d, old_smfn) )
-        {
-            printk(XENLOG_G_ERR "can't re-pin %"PRI_mfn"\n", mfn_x(old_smfn));
-            domain_crash(d);
-        }
-        sh_put_ref(d, old_smfn, 0);
-    }
-}
-
-
 static void
 sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 /* Updates vcpu->arch.cr3 after the guest has changed CR3.
@@ -4014,7 +3898,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 #if GUEST_PAGING_LEVELS == 2
     if ( sh_remove_write_access(d, gmfn, 2, 0) != 0 )
         guest_flush_tlb_mask(d, d->dirty_cpumask);
-    sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l2_shadow);
+    sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l2_shadow, sh_make_shadow);
 #elif GUEST_PAGING_LEVELS == 3
     /* PAE guests have four shadow_table entries, based on the
      * current values of the guest's four l3es. */
@@ -4048,18 +3932,20 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
                 if ( p2m_is_ram(p2mt) )
                     sh_set_toplevel_shadow(v, i, gl2mfn, (i == 3)
                                            ? SH_type_l2h_shadow
-                                           : SH_type_l2_shadow);
+                                           : SH_type_l2_shadow,
+                                           sh_make_shadow);
                 else
-                    sh_set_toplevel_shadow(v, i, INVALID_MFN, 0);
+                    sh_set_toplevel_shadow(v, i, INVALID_MFN, 0,
+                                           sh_make_shadow);
             }
             else
-                sh_set_toplevel_shadow(v, i, INVALID_MFN, 0);
+                sh_set_toplevel_shadow(v, i, INVALID_MFN, 0, sh_make_shadow);
         }
     }
 #elif GUEST_PAGING_LEVELS == 4
     if ( sh_remove_write_access(d, gmfn, 4, 0) != 0 )
         guest_flush_tlb_mask(d, d->dirty_cpumask);
-    sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l4_shadow);
+    sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l4_shadow, sh_make_shadow);
     if ( !shadow_mode_external(d) && !is_pv_32bit_domain(d) )
     {
         mfn_t smfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[0]);
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index eb5d1e3fab..0a8927f49e 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -357,6 +357,15 @@ mfn_t shadow_alloc(struct domain *d,
                     unsigned long backpointer);
 void  shadow_free(struct domain *d, mfn_t smfn);
 
+/* Set up the top-level shadow and install it in slot 'slot' of shadow_table */
+void sh_set_toplevel_shadow(struct vcpu *v,
+                            unsigned int slot,
+                            mfn_t gmfn,
+                            unsigned int root_type,
+                            mfn_t (*make_shadow)(struct vcpu *v,
+                                                 mfn_t gmfn,
+                                                 uint32_t shadow_type));
+
 /* Install the xen mappings in various flavours of shadow */
 void sh_install_xen_entries_in_l4(struct domain *, mfn_t gl4mfn, mfn_t sl4mfn);
 
@@ -701,6 +710,58 @@ static inline void sh_unpin(struct domain *d, mfn_t smfn)
 }
 
 
+/**************************************************************************/
+/* Hash table mapping from guest pagetables to shadows
+ *
+ * Normal case: maps the mfn of a guest page to the mfn of its shadow page.
+ * FL1's:       see multi.c.
+ */
+
+static inline mfn_t
+get_shadow_status(struct domain *d, mfn_t gmfn, u32 shadow_type)
+/* Look for shadows in the hash table */
+{
+    mfn_t smfn = shadow_hash_lookup(d, mfn_x(gmfn), shadow_type);
+    ASSERT(!mfn_valid(smfn) || mfn_to_page(smfn)->u.sh.head);
+    perfc_incr(shadow_get_shadow_status);
+    return smfn;
+}
+
+static inline void
+set_shadow_status(struct domain *d, mfn_t gmfn, u32 shadow_type, mfn_t smfn)
+/* Put a shadow into the hash table */
+{
+    int res;
+
+    SHADOW_PRINTK("d%d gmfn=%lx, type=%08x, smfn=%lx\n",
+                  d->domain_id, mfn_x(gmfn), shadow_type, mfn_x(smfn));
+
+    ASSERT(mfn_to_page(smfn)->u.sh.head);
+
+    /* 32-bit PV guests don't own their l4 pages so can't get_page them */
+    if ( !is_pv_32bit_domain(d) || shadow_type != SH_type_l4_64_shadow )
+    {
+        res = get_page(mfn_to_page(gmfn), d);
+        ASSERT(res == 1);
+    }
+
+    shadow_hash_insert(d, mfn_x(gmfn), shadow_type, smfn);
+}
+
+static inline void
+delete_shadow_status(struct domain *d, mfn_t gmfn, u32 shadow_type, mfn_t smfn)
+/* Remove a shadow from the hash table */
+{
+    SHADOW_PRINTK("d%d gmfn=%"PRI_mfn", type=%08x, smfn=%"PRI_mfn"\n",
+                  d->domain_id, mfn_x(gmfn), shadow_type, mfn_x(smfn));
+    ASSERT(mfn_to_page(smfn)->u.sh.head);
+    shadow_hash_delete(d, mfn_x(gmfn), shadow_type, smfn);
+    /* 32-bit PV guests don't own their l4 pages; see set_shadow_status */
+    if ( !is_pv_32bit_domain(d) || shadow_type != SH_type_l4_64_shadow )
+        put_page(mfn_to_page(gmfn));
+}
+
+
 /**************************************************************************/
 /* PTE-write emulation. */
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 21 12:11:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Jul 2020 12:11:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jxr7R-0007Cp-L3; Tue, 21 Jul 2020 12:11:37 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5KM5=BA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxr7Q-0007B3-0F
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:11:36 +0000
X-Inumbo-ID: 5275329e-cb4b-11ea-a0ab-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5275329e-cb4b-11ea-a0ab-12813bfff9fa;
 Tue, 21 Jul 2020 12:11:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=06pnpkG0vBVR0UGYzXuwqYJ++BbCOekzgz2QhiAkKt4=; b=DzbTYnm4QhXdNVVixMUNtxZGlb
 8qoa9vPPLLVQu5JSeMVBzuJLlTMDVLjFgIQH5SWkWLJFIomSVEdsotW1lTwOqThSGl0gByuq2hTVk
 zw/IjQ2iVvR32apjwe2Ac5vhEuoqnk5WEBvX1O8eS7f25aZzLsm+5O6/HYmD78dpISao=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxr7P-0005P7-Co
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:11:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxr7P-0004OF-Bt
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:11:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/shadow: l3table[] and gl3e[] are HVM only
Message-Id: <E1jxr7P-0004OF-Bt@xenbits.xenproject.org>
Date: Tue, 21 Jul 2020 12:11:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit f6b78aefea557e5fd58d1c1e1e314c25c0bacaef
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 21 13:59:28 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 21 13:59:28 2020 +0200

    x86/shadow: l3table[] and gl3e[] are HVM only
    
    ... by the very fact that they're 3-level specific, while PV always gets
    run in 4-level mode. This requires adding some seemingly redundant
    #ifdef-s - some of them will be possible to drop again once 2- and
    3-level guest code doesn't get built anymore in !HVM configs, but I'm
    afraid there's still quite a bit of disentangling work to be done to
    make this possible.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/multi.c | 69 ++++++++++++++++++++++++++----------------
 xen/include/asm-x86/domain.h   |  3 +-
 2 files changed, 45 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 088d27362d..b205be6cdc 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -150,10 +150,7 @@ sh_walk_guest_tables(struct vcpu *v, unsigned long va, walk_t *gw,
                           ? cr3_pa(v->arch.hvm.guest_cr[3]) >> PAGE_SHIFT
                           : pagetable_get_pfn(v->arch.guest_table));
 
-#if GUEST_PAGING_LEVELS == 3 /* PAE */
-    return guest_walk_tables(v, p2m_get_hostp2m(v->domain), va, gw, pfec,
-                             root_gfn, INVALID_MFN, v->arch.paging.shadow.gl3e);
-#else /* 32 or 64 */
+#if GUEST_PAGING_LEVELS != 3 /* 32 or 64 */
     const struct domain *d = v->domain;
     mfn_t root_mfn = (v->arch.flags & TF_kernel_mode
                       ? pagetable_get_mfn(v->arch.guest_table)
@@ -165,6 +162,14 @@ sh_walk_guest_tables(struct vcpu *v, unsigned long va, walk_t *gw,
     unmap_domain_page(root_map);
 
     return ok;
+#elif !defined(CONFIG_HVM)
+    ASSERT_UNREACHABLE();
+    (void)root_gfn;
+    memset(gw, 0, sizeof(*gw));
+    return false;
+#else /* PAE */
+    return guest_walk_tables(v, p2m_get_hostp2m(v->domain), va, gw, pfec,
+                             root_gfn, INVALID_MFN, v->arch.paging.shadow.gl3e);
 #endif
 }
 
@@ -211,7 +216,7 @@ shadow_check_gwalk(struct vcpu *v, unsigned long va, walk_t *gw, int version)
     l3p = map_domain_page(gw->l3mfn);
     mismatch |= (gw->l3e.l3 != l3p[guest_l3_table_offset(va)].l3);
     unmap_domain_page(l3p);
-#else
+#elif defined(CONFIG_HVM)
     mismatch |= (gw->l3e.l3 !=
                  v->arch.paging.shadow.gl3e[guest_l3_table_offset(va)].l3);
 #endif
@@ -1693,6 +1698,8 @@ static shadow_l2e_t * shadow_get_and_create_l2e(struct vcpu *v,
     }
     /* Now follow it down a level.  Guaranteed to succeed. */
     return sh_linear_l2_table(v) + shadow_l2_linear_offset(gw->va);
+#elif !defined(CONFIG_HVM)
+    return NULL;
 #elif GUEST_PAGING_LEVELS == 3 /* PAE... */
     /* We never demand-shadow PAE l3es: they are only created in
      * sh_update_cr3().  Check if the relevant sl3e is present. */
@@ -3526,6 +3533,8 @@ static bool sh_invlpg(struct vcpu *v, unsigned long linear)
         if ( !(shadow_l3e_get_flags(sl3e) & _PAGE_PRESENT) )
             return false;
     }
+#elif !defined(CONFIG_HVM)
+    return false;
 #else /* SHADOW_PAGING_LEVELS == 3 */
     if ( !(l3e_get_flags(v->arch.paging.shadow.l3table[shadow_l3_linear_offset(linear)])
            & _PAGE_PRESENT) )
@@ -3679,7 +3688,9 @@ sh_update_linear_entries(struct vcpu *v)
          pagetable_get_pfn(v->arch.hvm.monitor_table) == 0 )
         return;
 
-#if SHADOW_PAGING_LEVELS == 4
+#if !defined(CONFIG_HVM)
+    return;
+#elif SHADOW_PAGING_LEVELS == 4
 
     /* For HVM, just need to update the l4e that points to the shadow l4. */
 
@@ -3816,7 +3827,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 {
     struct domain *d = v->domain;
     mfn_t gmfn;
-#if GUEST_PAGING_LEVELS == 3
+#if GUEST_PAGING_LEVELS == 3 && defined(CONFIG_HVM)
     const guest_l3e_t *gl3e;
     unsigned int i, guest_idx;
 #endif
@@ -3867,7 +3878,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 #endif
         gmfn = pagetable_get_mfn(v->arch.guest_table);
 
-#if GUEST_PAGING_LEVELS == 3
+#if GUEST_PAGING_LEVELS == 3 && defined(CONFIG_HVM)
     /*
      * On PAE guests we don't use a mapping of the guest's own top-level
      * table.  We cache the current state of that table and shadow that,
@@ -3895,10 +3906,22 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
     /* We revoke write access to the new guest toplevel page(s) before we
      * replace the old shadow pagetable(s), so that we can safely use the
      * (old) shadow linear maps in the writeable mapping heuristics. */
-#if GUEST_PAGING_LEVELS == 2
-    if ( sh_remove_write_access(d, gmfn, 2, 0) != 0 )
+#if GUEST_PAGING_LEVELS == 4
+    if ( sh_remove_write_access(d, gmfn, 4, 0) != 0 )
         guest_flush_tlb_mask(d, d->dirty_cpumask);
-    sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l2_shadow, sh_make_shadow);
+    sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l4_shadow, sh_make_shadow);
+    if ( !shadow_mode_external(d) && !is_pv_32bit_domain(d) )
+    {
+        mfn_t smfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[0]);
+
+        if ( !(v->arch.flags & TF_kernel_mode) && VM_ASSIST(d, m2p_strict) )
+            zap_ro_mpt(smfn);
+        else if ( (v->arch.flags & TF_kernel_mode) &&
+                  !VM_ASSIST(d, m2p_strict) )
+            fill_ro_mpt(smfn);
+    }
+#elif !defined(CONFIG_HVM)
+    ASSERT_UNREACHABLE();
 #elif GUEST_PAGING_LEVELS == 3
     /* PAE guests have four shadow_table entries, based on the
      * current values of the guest's four l3es. */
@@ -3907,7 +3930,8 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
         gfn_t gl2gfn;
         mfn_t gl2mfn;
         p2m_type_t p2mt;
-        const guest_l3e_t *gl3e = v->arch.paging.shadow.gl3e;
+
+        gl3e = v->arch.paging.shadow.gl3e;
 
         /* First, make all four entries read-only. */
         for ( i = 0; i < 4; i++ )
@@ -3942,25 +3966,16 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
                 sh_set_toplevel_shadow(v, i, INVALID_MFN, 0, sh_make_shadow);
         }
     }
-#elif GUEST_PAGING_LEVELS == 4
-    if ( sh_remove_write_access(d, gmfn, 4, 0) != 0 )
+#elif GUEST_PAGING_LEVELS == 2
+    if ( sh_remove_write_access(d, gmfn, 2, 0) != 0 )
         guest_flush_tlb_mask(d, d->dirty_cpumask);
-    sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l4_shadow, sh_make_shadow);
-    if ( !shadow_mode_external(d) && !is_pv_32bit_domain(d) )
-    {
-        mfn_t smfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[0]);
-
-        if ( !(v->arch.flags & TF_kernel_mode) && VM_ASSIST(d, m2p_strict) )
-            zap_ro_mpt(smfn);
-        else if ( (v->arch.flags & TF_kernel_mode) &&
-                  !VM_ASSIST(d, m2p_strict) )
-            fill_ro_mpt(smfn);
-    }
+    sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l2_shadow, sh_make_shadow);
 #else
 #error This should never happen
 #endif
 
 
+#ifdef CONFIG_HVM
     ///
     /// v->arch.paging.shadow.l3table
     ///
@@ -3986,7 +4001,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
             }
         }
 #endif /* SHADOW_PAGING_LEVELS == 3 */
-
+#endif /* CONFIG_HVM */
 
     ///
     /// v->arch.cr3
@@ -4006,6 +4021,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 #endif
 
 
+#ifdef CONFIG_HVM
     ///
     /// v->arch.hvm.hw_cr[3]
     ///
@@ -4022,6 +4038,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 #endif
         hvm_update_guest_cr3(v, noflush);
     }
+#endif /* CONFIG_HVM */
 
     /* Fix up the linear pagetable mappings */
     sh_update_linear_entries(v);
diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h
index 3f5412d5ab..635335634d 100644
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
@@ -131,15 +131,16 @@ struct shadow_domain {
 
 struct shadow_vcpu {
 #ifdef CONFIG_SHADOW_PAGING
+#ifdef CONFIG_HVM
     /* PAE guests: per-vcpu shadow top-level table */
     l3_pgentry_t l3table[4] __attribute__((__aligned__(32)));
     /* PAE guests: per-vcpu cache of the top-level *guest* entries */
     l3_pgentry_t gl3e[4] __attribute__((__aligned__(32)));
 
     /* shadow(s) of guest (MFN) */
-#ifdef CONFIG_HVM
     pagetable_t shadow_table[4];
 #else
+    /* shadow of guest (MFN) */
     pagetable_t shadow_table[1];
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 21 12:11:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Jul 2020 12:11:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jxr7b-0007Dz-N6; Tue, 21 Jul 2020 12:11:47 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5KM5=BA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxr7a-0007Do-JR
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:11:46 +0000
X-Inumbo-ID: 587a555c-cb4b-11ea-8509-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 587a555c-cb4b-11ea-8509-bc764e2007e4;
 Tue, 21 Jul 2020 12:11:45 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=WtrYbl9JlsFNX+VjU1axTPEoTBikk+LumbEtrYG9nvc=; b=ZDJAesTFJcBQuXHc3qzVt0xTQs
 uogGToWrTjs4diDFQ/W9TwXx7T8POV+HeTl1LVJRd6zYHDZmI+txd6gNdGHagBVA4NqerkLRdaR/z
 CeHUlFTtItKcjFb/TKgATcO5aJ3D1uUzaLJzDgL8iAdHwuKeg+Nyq57dadiwX0nocnfw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxr7Z-0005PK-GR
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:11:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxr7Z-0004Ox-Fi
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:11:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86emul: support AVX512_VP2INTERSECT insns
Message-Id: <E1jxr7Z-0004Ox-Fi@xenbits.xenproject.org>
Date: Tue, 21 Jul 2020 12:11:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit fc7f700cf1845d80dee1f4075044a54645aec04e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 21 14:00:25 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 21 14:00:25 2020 +0200

    x86emul: support AVX512_VP2INTERSECT insns
    
    The standard memory access pattern once again should allow us to go
    without a test harness addition beyond the EVEX Disp8-scaling one.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libxl/libxl_cpuid.c                   | 1 +
 tools/misc/xen-cpuid.c                      | 2 +-
 tools/tests/x86_emulator/evex-disp8.c       | 5 +++++
 tools/tests/x86_emulator/x86-emulate.h      | 1 +
 xen/arch/x86/x86_emulate/x86_emulate.c      | 8 ++++++++
 xen/include/asm-x86/cpufeature.h            | 1 +
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 xen/tools/gen-cpuid.py                      | 2 +-
 8 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index db2f12d115..8b570b7e27 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -214,6 +214,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},
+        {"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},
         {"serialize",    0x00000007,  0, CPUID_REG_EDX, 14,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 8d8f3532a2..f4bf88e2fa 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -160,7 +160,7 @@ static const char *const str_7d0[32] =
     [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
     [ 4] = "fsrm",
 
-    /*  8 */                [ 9] = "srbds-ctrl",
+    [ 8] = "avx512-vp2intersect", [ 9] = "srbds-ctrl",
     [10] = "md-clear",
     /* 12 */                [13] = "tsx-force-abort",
     [14] = "serialize",
diff --git a/tools/tests/x86_emulator/evex-disp8.c b/tools/tests/x86_emulator/evex-disp8.c
index b892ed90da..60c569d5e5 100644
--- a/tools/tests/x86_emulator/evex-disp8.c
+++ b/tools/tests/x86_emulator/evex-disp8.c
@@ -593,6 +593,10 @@ static const struct test avx512_vnni_all[] = {
     INSN(pdpwssds, 66, 0f38, 53, vl, d, vl),
 };
 
+static const struct test avx512_vp2intersect_all[] = {
+    INSN(p2intersect, f2, 0f38, 68, vl, dq, vl)
+};
+
 static const struct test avx512_vpopcntdq_all[] = {
     INSN(popcnt, 66, 0f38, 55, vl, dq, vl)
 };
@@ -996,6 +1000,7 @@ void evex_disp8_test(void *instr, struct x86_emulate_ctxt *ctxt,
     RUN(avx512_vbmi, all);
     RUN(avx512_vbmi2, all);
     RUN(avx512_vnni, all);
+    RUN(avx512_vp2intersect, all);
     RUN(avx512_vpopcntdq, all);
 
     if ( cpu_has_avx512f )
diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h
index 6ea6cbc658..fc52edf8ce 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -168,6 +168,7 @@ static inline bool xcr0_mask(uint64_t mask)
 #define cpu_has_movdir64b  cp.feat.movdir64b
 #define cpu_has_avx512_4vnniw (cp.feat.avx512_4vnniw && xcr0_mask(0xe6))
 #define cpu_has_avx512_4fmaps (cp.feat.avx512_4fmaps && xcr0_mask(0xe6))
+#define cpu_has_avx512_vp2intersect (cp.feat.avx512_vp2intersect && xcr0_mask(0xe6))
 #define cpu_has_serialize  cp.feat.serialize
 #define cpu_has_avx512_bf16 (cp.feat.avx512_bf16 && xcr0_mask(0xe6))
 
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 84bb8e0c9b..44474a268b 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -488,6 +488,7 @@ static const struct ext0f38_table {
     [0x62] = { .simd_size = simd_packed_int, .two_op = 1, .d8s = d8s_bw },
     [0x63] = { .simd_size = simd_packed_int, .to_mem = 1, .two_op = 1, .d8s = d8s_bw },
     [0x64 ... 0x66] = { .simd_size = simd_packed_int, .d8s = d8s_vl },
+    [0x68] = { .simd_size = simd_packed_int, .d8s = d8s_vl },
     [0x70 ... 0x73] = { .simd_size = simd_packed_int, .d8s = d8s_vl },
     [0x75 ... 0x76] = { .simd_size = simd_packed_int, .d8s = d8s_vl },
     [0x77] = { .simd_size = simd_packed_fp, .d8s = d8s_vl },
@@ -2005,6 +2006,7 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_enqcmd()      (ctxt->cpuid->feat.enqcmd)
 #define vcpu_has_avx512_4vnniw() (ctxt->cpuid->feat.avx512_4vnniw)
 #define vcpu_has_avx512_4fmaps() (ctxt->cpuid->feat.avx512_4fmaps)
+#define vcpu_has_avx512_vp2intersect() (ctxt->cpuid->feat.avx512_vp2intersect)
 #define vcpu_has_serialize()   (ctxt->cpuid->feat.serialize)
 #define vcpu_has_avx512_bf16() (ctxt->cpuid->feat.avx512_bf16)
 
@@ -9545,6 +9547,12 @@ x86_emulate(
         }
         goto simd_zmm;
 
+    case X86EMUL_OPC_EVEX_F2(0x0f38, 0x68): /* vp2intersect{d,q} [xyz]mm/mem,[xyz]mm,k+1 */
+        host_and_vcpu_must_have(avx512_vp2intersect);
+        generate_exception_if(evex.opmsk || !evex.r || !evex.R, EXC_UD);
+        op_bytes = 16 << evex.lr;
+        goto avx512f_no_sae;
+
     case X86EMUL_OPC_EVEX_66(0x0f38, 0x70): /* vpshldvw [xyz]mm/mem,[xyz]mm,[xyz]mm{k} */
     case X86EMUL_OPC_EVEX_66(0x0f38, 0x72): /* vpshrdvw [xyz]mm/mem,[xyz]mm,[xyz]mm{k} */
         generate_exception_if(!evex.w, EXC_UD);
diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h
index f790d5c1f8..4de992781e 100644
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -128,6 +128,7 @@
 /* CPUID level 0x00000007:0.edx */
 #define cpu_has_avx512_4vnniw   boot_cpu_has(X86_FEATURE_AVX512_4VNNIW)
 #define cpu_has_avx512_4fmaps   boot_cpu_has(X86_FEATURE_AVX512_4FMAPS)
+#define cpu_has_avx512_vp2intersect boot_cpu_has(X86_FEATURE_AVX512_VP2INTERSECT)
 #define cpu_has_tsx_force_abort boot_cpu_has(X86_FEATURE_TSX_FORCE_ABORT)
 #define cpu_has_serialize       boot_cpu_has(X86_FEATURE_SERIALIZE)
 
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index fe7492a225..ce3deaa5c7 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -259,6 +259,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(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 */
 XEN_CPUFEATURE(TSX_FORCE_ABORT, 9*32+13) /* MSR_TSX_FORCE_ABORT.RTM_ABORT */
diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index ffd9529fdf..143ee7cae1 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -260,7 +260,7 @@ def crunch_numbers(state):
         # AVX512 features are built on top of AVX512F
         AVX512F: [AVX512DQ, AVX512_IFMA, AVX512PF, AVX512ER, AVX512CD,
                   AVX512BW, AVX512VL, AVX512_4VNNIW, AVX512_4FMAPS,
-                  AVX512_VNNI, AVX512_VPOPCNTDQ],
+                  AVX512_VNNI, AVX512_VPOPCNTDQ, AVX512_VP2INTERSECT],
 
         # AVX512 extensions acting on vectors of bytes/words are made
         # dependents of AVX512BW (as to requiring wider than 16-bit mask
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 21 12:22:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Jul 2020 12: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 1jxrHa-0008C2-2Y; Tue, 21 Jul 2020 12:22:06 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5KM5=BA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxrHZ-0008Bw-ID
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:22:05 +0000
X-Inumbo-ID: c8f8e087-cb4c-11ea-a0ac-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c8f8e087-cb4c-11ea-a0ac-12813bfff9fa;
 Tue, 21 Jul 2020 12:22:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=t4xQbexuFq74NDpWoRuTHurUdXnCweKl2jYbZGEhw6Q=; b=me9DUMyXOZINnS68LVGmRVlIMg
 nX1zik/ZYPbEX6B9DvHLvJB2W2Dwq7xgXPpabgQL9kokWZoEWMzsPqhY/EsXtBPWXXFIROUNrBwNN
 eONUuC1VQoILWj+Odt5cwm8Bil8a2oH1y8/ldhdUEMF/vwhngcFqg+VQlaiflteeRKmQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxrHY-0005cG-GL
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxrHY-000546-FU
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:22:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] SUPPORT.md: Spell Experimental correctly
Message-Id: <E1jxrHY-000546-FU@xenbits.xenproject.org>
Date: Tue, 21 Jul 2020 12:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 139ce42388c3fe7096a09b3d397250fe14906809
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Jul 20 18:35:55 2020 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Jul 21 13:19:27 2020 +0100

    SUPPORT.md: Spell Experimental correctly
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 SUPPORT.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index b81d36eea5..1479055c45 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -249,13 +249,13 @@ to boot with memory < maxmem.
 
 Allow sharing of identical pages between guests
 
-    Status, x86 HVM: Expermental
+    Status, x86 HVM: Experimental
 
 ### Memory Paging
 
 Allow pages belonging to guests to be paged to disk
 
-    Status, x86 HVM: Experimenal
+    Status, x86 HVM: Experimental
 
 ### Alternative p2m
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 21 12:22:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Jul 2020 12: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 1jxrHl-0008E8-4K; Tue, 21 Jul 2020 12:22:17 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5KM5=BA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxrHj-0008Dx-UL
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:22:15 +0000
X-Inumbo-ID: cfb12f32-cb4c-11ea-8509-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id cfb12f32-cb4c-11ea-8509-bc764e2007e4;
 Tue, 21 Jul 2020 12:22:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=kuQvTpbzbQ6Thiw6BAzmh1H4Kqx1672tplicOIrgwIg=; b=yhsrfhKrDLnfdwdckPQqzocrtq
 JiQ4SmdPMP4L99pKTvzgJkTsx1S6aXTID1CZz9uWFCwBUDbMgvUDdbT6Yr91IYSefl8se3W2q/VBR
 zogUVUJFroNEXVCtD6mUTctCIq7e47RLcH1uD9tpJ8KaRkcxMepax0MKeEYCo8oVubeo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxrHj-0005cQ-0i
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:22:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxrHi-000551-WB
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:22:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.14] SUPPORT.md: Spell Experimental correctly
Message-Id: <E1jxrHi-000551-WB@xenbits.xenproject.org>
Date: Tue, 21 Jul 2020 12:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 827031adfeb3c2656baa2156d3e7caaea8aec739
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Jul 20 18:35:55 2020 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Jul 21 13:21:24 2020 +0100

    SUPPORT.md: Spell Experimental correctly
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
    (cherry picked from commit 139ce42388c3fe7096a09b3d397250fe14906809)
---
 SUPPORT.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 7fa7e91b26..efbcb26ddf 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -249,13 +249,13 @@ to boot with memory < maxmem.
 
 Allow sharing of identical pages between guests
 
-    Status, x86 HVM: Expermental
+    Status, x86 HVM: Experimental
 
 ### Memory Paging
 
 Allow pages belonging to guests to be paged to disk
 
-    Status, x86 HVM: Experimenal
+    Status, x86 HVM: Experimental
 
 ### Alternative p2m
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Tue Jul 21 12:33:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Jul 2020 12: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 1jxrSE-0001Dn-QO; Tue, 21 Jul 2020 12:33:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5KM5=BA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxrSD-0001Dh-CL
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:33:05 +0000
X-Inumbo-ID: 52d46a40-cb4e-11ea-850b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 52d46a40-cb4e-11ea-850b-bc764e2007e4;
 Tue, 21 Jul 2020 12:33:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=UkGWYHkpV4ehqs9ggyfLMAVaEMBoObfuYoe6BSoKQCw=; b=WlyzMKj9IAZQfiDwLe/TEJHGLR
 YWCQ7MwQOj9dCF5iySHHffZ/LLHCREeh8mLEp/0qIWYz0CMkXMZPBn82EQTXzcCKGCPUW09YjURhQ
 oD9E8QGlsiv35jrIlHuJN7VKd6VHWQ2agDUnbJHO00ynyQVAgwHE34Rqo5ZN7urFkUAA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxrSC-0005rK-F3
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxrSC-0005uV-ED
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:33:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] MAINTAINERS: add myself as a golang bindings maintainer
Message-Id: <E1jxrSC-0005uV-ED@xenbits.xenproject.org>
Date: Tue, 21 Jul 2020 12:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit af0584931c1b902577317dacff976bc4b4f3923d
Author:     Nick Rosbrook <rosbrookn@gmail.com>
AuthorDate: Thu Jul 16 12:00:26 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jul 21 12:31:45 2020 +0000

    MAINTAINERS: add myself as a golang bindings maintainer
    
    Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index e374816755..33fe51324e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -298,6 +298,7 @@ F:	tools/debugger/gdbsx/
 
 GOLANG BINDINGS
 M:	George Dunlap <george.dunlap@citrix.com>
+M:     Nick Rosbrook <rosbrookn@ainfosec.com>
 S:	Maintained
 F:	tools/golang
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 21 12:33:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Jul 2020 12: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 1jxrSQ-0001FM-Ry; Tue, 21 Jul 2020 12:33:18 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5KM5=BA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxrSO-0001F6-WA
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:33:17 +0000
X-Inumbo-ID: 58d52a24-cb4e-11ea-a0ad-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 58d52a24-cb4e-11ea-a0ad-12813bfff9fa;
 Tue, 21 Jul 2020 12:33:14 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Q9KYehHvN0xuLpSyxzmMJLAKS5bxeSk/WZqHvQZun+s=; b=NHhnLShUglrD7ngHf2NzYveA+S
 UjG5BltuKWilOeNX26ZUuBT0ACHCmgWghbr3+wM1ueb1+LRmKFLv1KXblfEHoNMqvdbJD3cxr7BCd
 i7emslFeub0T9+t02+Tuk4Y0GpHoTLoj3aF+f1/1x1Pge4Abc0FyKqRvdvbQi6H6fPTA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxrSM-0005rQ-Hp
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:33:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxrSM-0005vb-H2
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:33:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] golang/xenlight: fix code generation for python 2.6
Message-Id: <E1jxrSM-0005vb-H2@xenbits.xenproject.org>
Date: Tue, 21 Jul 2020 12:33:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 6d49fbdeab3e687a6818f809ca3d98ac7ced2c8d
Author:     Nick Rosbrook <rosbrookn@gmail.com>
AuthorDate: Mon Jul 20 19:54:40 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jul 21 12:31:45 2020 +0000

    golang/xenlight: fix code generation for python 2.6
    
    Before python 2.7, str.format() calls required that the format fields
    were explicitly enumerated, e.g.:
    
      '{0} {1}'.format(foo, bar)
    
      vs.
    
      '{} {}'.format(foo, bar)
    
    Currently, gengotypes.py uses the latter pattern everywhere, which means
    the Go bindings do not build on python 2.6. Use the 2.6 syntax for
    format() in order to support python 2.6 for now.
    
    Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/golang/xenlight/gengotypes.py | 204 ++++++++++++++++++------------------
 1 file changed, 102 insertions(+), 102 deletions(-)

diff --git a/tools/golang/xenlight/gengotypes.py b/tools/golang/xenlight/gengotypes.py
index 557fecd07b..ebec938224 100644
--- a/tools/golang/xenlight/gengotypes.py
+++ b/tools/golang/xenlight/gengotypes.py
@@ -3,7 +3,7 @@
 import os
 import sys
 
-sys.path.append('{}/tools/libxl'.format(os.environ['XEN_ROOT']))
+sys.path.append('{0}/tools/libxl'.format(os.environ['XEN_ROOT']))
 import idl
 
 # Go versions of some builtin types.
@@ -73,14 +73,14 @@ def xenlight_golang_define_enum(ty = None):
 
     if ty.typename is not None:
         typename = xenlight_golang_fmt_name(ty.typename)
-        s += 'type {} int\n'.format(typename)
+        s += 'type {0} int\n'.format(typename)
 
     # Start const block
     s += 'const(\n'
 
     for v in ty.values:
         name = xenlight_golang_fmt_name(v.name)
-        s += '{} {} = {}\n'.format(name, typename, v.value)
+        s += '{0} {1} = {2}\n'.format(name, typename, v.value)
 
     # End const block
     s += ')\n'
@@ -99,9 +99,9 @@ def xenlight_golang_define_struct(ty = None, typename = None, nested = False):
 
     # Begin struct definition
     if nested:
-        s += '{} struct {{\n'.format(name)
+        s += '{0} struct {{\n'.format(name)
     else:
-        s += 'type {} struct {{\n'.format(name)
+        s += 'type {0} struct {{\n'.format(name)
 
     # Write struct fields
     for f in ty.fields:
@@ -111,13 +111,13 @@ def xenlight_golang_define_struct(ty = None, typename = None, nested = False):
                 typename = xenlight_golang_fmt_name(typename)
                 name     = xenlight_golang_fmt_name(f.name)
 
-                s += '{} []{}\n'.format(name, typename)
+                s += '{0} []{1}\n'.format(name, typename)
             else:
                 typename = f.type.typename
                 typename = xenlight_golang_fmt_name(typename)
                 name     = xenlight_golang_fmt_name(f.name)
 
-                s += '{} {}\n'.format(name, typename)
+                s += '{0} {1}\n'.format(name, typename)
 
         elif isinstance(f.type, idl.Struct):
             r = xenlight_golang_define_struct(f.type, typename=f.name, nested=True)
@@ -132,7 +132,7 @@ def xenlight_golang_define_struct(ty = None, typename = None, nested = False):
             extras.extend(r[1])
 
         else:
-            raise Exception('type {} not supported'.format(f.type))
+            raise Exception('type {0} not supported'.format(f.type))
 
     # End struct definition
     s += '}\n'
@@ -151,11 +151,11 @@ def xenlight_golang_define_union(ty = None, struct_name = '', union_name = ''):
     s = ''
     extras = []
 
-    interface_name = '{}_{}_union'.format(struct_name, ty.keyvar.name)
+    interface_name = '{0}_{1}_union'.format(struct_name, ty.keyvar.name)
     interface_name = xenlight_golang_fmt_name(interface_name, exported=False)
 
-    s += 'type {} interface {{\n'.format(interface_name)
-    s += 'is{}()\n'.format(interface_name)
+    s += 'type {0} interface {{\n'.format(interface_name)
+    s += 'is{0}()\n'.format(interface_name)
     s += '}\n'
 
     extras.append(s)
@@ -165,7 +165,7 @@ def xenlight_golang_define_union(ty = None, struct_name = '', union_name = ''):
             continue
 
         # Define struct
-        name = '{}_{}_union_{}'.format(struct_name, ty.keyvar.name, f.name)
+        name = '{0}_{1}_union_{2}'.format(struct_name, ty.keyvar.name, f.name)
         r = xenlight_golang_define_struct(f.type, typename=name)
         extras.append(r[0])
         extras.extend(r[1])
@@ -173,21 +173,21 @@ def xenlight_golang_define_union(ty = None, struct_name = '', union_name = ''):
         # This typeof trick ensures that the fields used in the cgo struct
         # used for marshaling are the same as the fields of the union in the
         # actual C type, and avoids re-defining all of those fields.
-        s = 'typedef typeof(((struct {} *)NULL)->{}.{}){};'
+        s = 'typedef typeof(((struct {0} *)NULL)->{1}.{2}){3};'
         s = s.format(struct_name, union_name, f.name, name)
         cgo_helpers_preamble.append(s)
 
         # Define function to implement 'union' interface
         name = xenlight_golang_fmt_name(name)
-        s = 'func (x {}) is{}(){{}}\n'.format(name, interface_name)
+        s = 'func (x {0}) is{1}(){{}}\n'.format(name, interface_name)
         extras.append(s)
 
     fname = xenlight_golang_fmt_name(ty.keyvar.name)
     ftype = xenlight_golang_fmt_name(ty.keyvar.type.typename)
-    s = '{} {}\n'.format(fname, ftype)
+    s = '{0} {1}\n'.format(fname, ftype)
 
-    fname = xenlight_golang_fmt_name('{}_union'.format(ty.keyvar.name))
-    s += '{} {}\n'.format(fname, interface_name)
+    fname = xenlight_golang_fmt_name('{0}_union'.format(ty.keyvar.name))
+    s += '{0} {1}\n'.format(fname, interface_name)
 
     return (s,extras)
 
@@ -243,7 +243,7 @@ def xenlight_golang_define_from_C(ty = None):
     Define the fromC marshaling function for the type
     represented by ty.
     """
-    func = 'func (x *{}) fromC(xc *C.{}) error {{\n {}\n return nil}}\n'
+    func = 'func (x *{0}) fromC(xc *C.{1}) error {{\n {2}\n return nil}}\n'
 
     goname = xenlight_golang_fmt_name(ty.typename)
     cname  = ty.typename
@@ -271,7 +271,7 @@ def xenlight_golang_define_from_C(ty = None):
             extras.extend(r[1])
 
         else:
-            raise Exception('type {} not supported'.format(f.type))
+            raise Exception('type {0} not supported'.format(f.type))
 
     return (func.format(goname, cname, body), extras)
 
@@ -300,8 +300,8 @@ def xenlight_golang_convert_from_C(ty = None, outer_name = None, cvarname = None
 
     # If outer_name is set, treat this as nested.
     if outer_name is not None:
-        goname = '{}.{}'.format(xenlight_golang_fmt_name(outer_name), goname)
-        cname  = '{}.{}'.format(outer_name, cname)
+        goname = '{0}.{1}'.format(xenlight_golang_fmt_name(outer_name), goname)
+        cname  = '{0}.{1}'.format(outer_name, cname)
 
     # Types that satisfy this condition can be easily casted or
     # converted to a Go builtin type.
@@ -312,15 +312,15 @@ def xenlight_golang_convert_from_C(ty = None, outer_name = None, cvarname = None
     if not is_castable:
         # If the type is not castable, we need to call its fromC
         # function.
-        s += 'if err := x.{}.fromC(&{}.{});'.format(goname,cvarname,cname)
-        s += 'err != nil {{\nreturn fmt.Errorf("converting field {}: %v", err)\n}}\n'.format(goname)
+        s += 'if err := x.{0}.fromC(&{1}.{2});'.format(goname,cvarname,cname)
+        s += 'err != nil {{\nreturn fmt.Errorf("converting field {0}: %v", err)\n}}\n'.format(goname)
 
     elif gotypename == 'string':
         # Use the cgo helper for converting C strings.
-        s += 'x.{} = C.GoString({}.{})\n'.format(goname,cvarname,cname)
+        s += 'x.{0} = C.GoString({1}.{2})\n'.format(goname,cvarname,cname)
 
     else:
-        s += 'x.{} = {}({}.{})\n'.format(goname,gotypename,cvarname,cname)
+        s += 'x.{0} = {1}({2}.{3})\n'.format(goname,gotypename,cvarname,cname)
 
     return s
 
@@ -331,9 +331,9 @@ def xenlight_golang_union_from_C(ty = None, union_name = '', struct_name = ''):
     gokeyname = xenlight_golang_fmt_name(keyname)
     keytype   = ty.keyvar.type.typename
     gokeytype = xenlight_golang_fmt_name(keytype)
-    field_name = xenlight_golang_fmt_name('{}_union'.format(keyname))
+    field_name = xenlight_golang_fmt_name('{0}_union'.format(keyname))
 
-    interface_name = '{}_{}_union'.format(struct_name, keyname)
+    interface_name = '{0}_{1}_union'.format(struct_name, keyname)
     interface_name = xenlight_golang_fmt_name(interface_name, exported=False)
 
     cgo_keyname = keyname
@@ -343,7 +343,7 @@ def xenlight_golang_union_from_C(ty = None, union_name = '', struct_name = ''):
     cases = {}
 
     for f in ty.fields:
-        val = '{}_{}'.format(keytype, f.name)
+        val = '{0}_{1}'.format(keytype, f.name)
         val = xenlight_golang_fmt_name(val)
 
         # Add to list of cases to make for the switch
@@ -354,17 +354,17 @@ def xenlight_golang_union_from_C(ty = None, union_name = '', struct_name = ''):
             continue
 
         # Define fromC func for 'union' struct.
-        typename   = '{}_{}_union_{}'.format(struct_name,keyname,f.name)
+        typename   = '{0}_{1}_union_{2}'.format(struct_name,keyname,f.name)
         gotypename = xenlight_golang_fmt_name(typename)
 
         # Define the function here. The cases for keyed unions are a little
         # different.
-        s = 'func (x *{}) fromC(xc *C.{}) error {{\n'.format(gotypename,struct_name)
-        s += 'if {}(xc.{}) != {} {{\n'.format(gokeytype,cgo_keyname,val)
-        err_string = '"expected union key {}"'.format(val)
-        s += 'return errors.New({})\n'.format(err_string)
+        s = 'func (x *{0}) fromC(xc *C.{1}) error {{\n'.format(gotypename,struct_name)
+        s += 'if {0}(xc.{1}) != {2} {{\n'.format(gokeytype,cgo_keyname,val)
+        err_string = '"expected union key {0}"'.format(val)
+        s += 'return errors.New({0})\n'.format(err_string)
         s += '}\n\n'
-        s += 'tmp := (*C.{})(unsafe.Pointer(&xc.{}[0]))\n'.format(typename,union_name)
+        s += 'tmp := (*C.{0})(unsafe.Pointer(&xc.{1}[0]))\n'.format(typename,union_name)
 
         for nf in f.type.fields:
             s += xenlight_golang_convert_from_C(nf,cvarname='tmp')
@@ -374,35 +374,35 @@ def xenlight_golang_union_from_C(ty = None, union_name = '', struct_name = ''):
 
         extras.append(s)
 
-    s = 'x.{} = {}(xc.{})\n'.format(gokeyname,gokeytype,cgo_keyname)
-    s += 'switch x.{}{{\n'.format(gokeyname)
+    s = 'x.{0} = {1}(xc.{2})\n'.format(gokeyname,gokeytype,cgo_keyname)
+    s += 'switch x.{0}{{\n'.format(gokeyname)
 
     # Create switch statement to determine which 'union element'
     # to populate in the Go struct.
     for case_name, case_tuple in sorted(cases.items()):
         (case_val, case_type) = case_tuple
 
-        s += 'case {}:\n'.format(case_val)
+        s += 'case {0}:\n'.format(case_val)
 
         if case_type is None:
-            s += "x.{} = nil\n".format(field_name)
+            s += "x.{0} = nil\n".format(field_name)
             continue
 
-        gotype = '{}_{}_union_{}'.format(struct_name,keyname,case_name)
+        gotype = '{0}_{1}_union_{2}'.format(struct_name,keyname,case_name)
         gotype = xenlight_golang_fmt_name(gotype)
-        goname = '{}_{}'.format(keyname,case_name)
+        goname = '{0}_{1}'.format(keyname,case_name)
         goname = xenlight_golang_fmt_name(goname,exported=False)
 
-        s += 'var {} {}\n'.format(goname, gotype)
-        s += 'if err := {}.fromC(xc);'.format(goname)
-        s += 'err != nil {{\n return fmt.Errorf("converting field {}: %v", err)\n}}\n'.format(goname)
+        s += 'var {0} {1}\n'.format(goname, gotype)
+        s += 'if err := {0}.fromC(xc);'.format(goname)
+        s += 'err != nil {{\n return fmt.Errorf("converting field {0}: %v", err)\n}}\n'.format(goname)
 
-        s += 'x.{} = {}\n'.format(field_name, goname)
+        s += 'x.{0} = {1}\n'.format(field_name, goname)
 
     # End switch statement
     s += 'default:\n'
-    err_string = '"invalid union key \'%v\'", x.{}'.format(gokeyname)
-    s += 'return fmt.Errorf({})'.format(err_string)
+    err_string = '"invalid union key \'%v\'", x.{0}'.format(gokeyname)
+    s += 'return fmt.Errorf({0})'.format(err_string)
     s += '}\n'
 
     return (s,extras)
@@ -420,22 +420,22 @@ def xenlight_golang_array_from_C(ty = None):
     goname     = xenlight_golang_fmt_name(ty.name)
     ctypename  = ty.type.elem_type.typename
     cname      = ty.name
-    cslice     = 'c{}'.format(goname)
+    cslice     = 'c{0}'.format(goname)
     clenvar    = ty.type.lenvar.name
 
-    s += 'x.{} = nil\n'.format(goname)
-    s += 'if n := int(xc.{}); n > 0 {{\n'.format(clenvar)
-    s += '{} := '.format(cslice)
-    s +='(*[1<<28]C.{})(unsafe.Pointer(xc.{}))[:n:n]\n'.format(ctypename, cname)
-    s += 'x.{} = make([]{}, n)\n'.format(goname, gotypename)
-    s += 'for i, v := range {} {{\n'.format(cslice)
+    s += 'x.{0} = nil\n'.format(goname)
+    s += 'if n := int(xc.{0}); n > 0 {{\n'.format(clenvar)
+    s += '{0} := '.format(cslice)
+    s +='(*[1<<28]C.{0})(unsafe.Pointer(xc.{1}))[:n:n]\n'.format(ctypename, cname)
+    s += 'x.{0} = make([]{1}, n)\n'.format(goname, gotypename)
+    s += 'for i, v := range {0} {{\n'.format(cslice)
 
     is_enum = isinstance(ty.type.elem_type,idl.Enumeration)
     if gotypename in go_builtin_types or is_enum:
-        s += 'x.{}[i] = {}(v)\n'.format(goname, gotypename)
+        s += 'x.{0}[i] = {1}(v)\n'.format(goname, gotypename)
     else:
-        s += 'if err := x.{}[i].fromC(&v); err != nil {{\n'.format(goname)
-        s += 'return fmt.Errorf("converting field {}: %v", err) }}\n'.format(goname)
+        s += 'if err := x.{0}[i].fromC(&v); err != nil {{\n'.format(goname)
+        s += 'return fmt.Errorf("converting field {0}: %v", err) }}\n'.format(goname)
 
     s += '}\n}\n'
 
@@ -446,11 +446,11 @@ def xenlight_golang_define_to_C(ty = None, typename = None, nested = False):
     Define the toC marshaling function for the type
     represented by ty.
     """
-    func = 'func (x *{}) toC(xc *C.{}) (err error){{{}\n return nil\n }}\n'
+    func = 'func (x *{0}) toC(xc *C.{1}) (err error){{{2}\n return nil\n }}\n'
     body = ''
 
     if ty.dispose_fn is not None:
-        body += 'defer func(){{\nif err != nil{{\nC.{}(xc)}}\n}}()\n\n'.format(ty.dispose_fn)
+        body += 'defer func(){{\nif err != nil{{\nC.{0}(xc)}}\n}}()\n\n'.format(ty.dispose_fn)
 
     goname = xenlight_golang_fmt_name(ty.typename)
     cname  = ty.typename
@@ -471,7 +471,7 @@ def xenlight_golang_define_to_C(ty = None, typename = None, nested = False):
             body += xenlight_golang_union_to_C(f.type, f.name, ty.typename)
 
         else:
-            raise Exception('type {} not supported'.format(f.type))
+            raise Exception('type {0} not supported'.format(f.type))
 
     return func.format(goname, cname, body)
 
@@ -506,26 +506,26 @@ def xenlight_golang_convert_to_C(ty = None, outer_name = None,
 
     # If outer_name is set, treat this as nested.
     if outer_name is not None:
-        goname = '{}.{}'.format(xenlight_golang_fmt_name(outer_name), goname)
-        cname  = '{}.{}'.format(outer_name, cname)
+        goname = '{0}.{1}'.format(xenlight_golang_fmt_name(outer_name), goname)
+        cname  = '{0}.{1}'.format(outer_name, cname)
 
     is_castable = (ty.type.json_parse_type == 'JSON_INTEGER' or
                    isinstance(ty.type, idl.Enumeration) or
                    gotypename in go_builtin_types)
 
     if not is_castable:
-        s += 'if err := {}.{}.toC(&{}.{}); err != nil {{\n'.format(govarname,goname,
+        s += 'if err := {0}.{1}.toC(&{2}.{3}); err != nil {{\n'.format(govarname,goname,
                                                                    cvarname,cname)
-        s += 'return fmt.Errorf("converting field {}: %v", err)\n}}\n'.format(goname)
+        s += 'return fmt.Errorf("converting field {0}: %v", err)\n}}\n'.format(goname)
 
     elif gotypename == 'string':
         # Use the cgo helper for converting C strings.
-        s += 'if {}.{} != "" {{\n'.format(govarname,goname)
-        s += '{}.{} = C.CString({}.{})}}\n'.format(cvarname,cname,
+        s += 'if {0}.{1} != "" {{\n'.format(govarname,goname)
+        s += '{0}.{1} = C.CString({2}.{3})}}\n'.format(cvarname,cname,
                                                    govarname,goname)
 
     else:
-        s += '{}.{} = C.{}({}.{})\n'.format(cvarname,cname,ctypename,
+        s += '{0}.{1} = C.{2}({3}.{4})\n'.format(cvarname,cname,ctypename,
                                             govarname,goname)
 
     return s
@@ -537,7 +537,7 @@ def xenlight_golang_union_to_C(ty = None, union_name = '',
     keytype   = ty.keyvar.type.typename
     gokeytype = xenlight_golang_fmt_name(keytype)
 
-    interface_name = '{}_{}_union'.format(struct_name, keyname)
+    interface_name = '{0}_{1}_union'.format(struct_name, keyname)
     interface_name = xenlight_golang_fmt_name(interface_name, exported=False)
 
     cgo_keyname = keyname
@@ -545,44 +545,44 @@ def xenlight_golang_union_to_C(ty = None, union_name = '',
         cgo_keyname = '_' + cgo_keyname
 
 
-    s = 'xc.{} = C.{}(x.{})\n'.format(cgo_keyname,keytype,gokeyname)
-    s += 'switch x.{}{{\n'.format(gokeyname)
+    s = 'xc.{0} = C.{1}(x.{2})\n'.format(cgo_keyname,keytype,gokeyname)
+    s += 'switch x.{0}{{\n'.format(gokeyname)
 
     # Create switch statement to determine how to populate the C union.
     for f in ty.fields:
-        key_val = '{}_{}'.format(keytype, f.name)
+        key_val = '{0}_{1}'.format(keytype, f.name)
         key_val = xenlight_golang_fmt_name(key_val)
 
-        s += 'case {}:\n'.format(key_val)
+        s += 'case {0}:\n'.format(key_val)
 
         if f.type is None:
             s += "break\n"
             continue
 
-        cgotype = '{}_{}_union_{}'.format(struct_name,keyname,f.name)
+        cgotype = '{0}_{1}_union_{2}'.format(struct_name,keyname,f.name)
         gotype  = xenlight_golang_fmt_name(cgotype)
 
-        field_name = xenlight_golang_fmt_name('{}_union'.format(keyname))
-        s += 'tmp, ok := x.{}.({})\n'.format(field_name,gotype)
+        field_name = xenlight_golang_fmt_name('{0}_union'.format(keyname))
+        s += 'tmp, ok := x.{0}.({1})\n'.format(field_name,gotype)
         s += 'if !ok {\n'
-        s += 'return errors.New("wrong type for union key {}")\n'.format(keyname)
+        s += 'return errors.New("wrong type for union key {0}")\n'.format(keyname)
         s += '}\n'
 
-        s += 'var {} C.{}\n'.format(f.name,cgotype)
+        s += 'var {0} C.{1}\n'.format(f.name,cgotype)
         for uf in f.type.fields:
             s += xenlight_golang_convert_to_C(uf,cvarname=f.name,
                                               govarname='tmp')
 
         # The union is still represented as Go []byte.
-        s += '{}Bytes := C.GoBytes(unsafe.Pointer(&{}),C.sizeof_{})\n'.format(f.name,
+        s += '{0}Bytes := C.GoBytes(unsafe.Pointer(&{1}),C.sizeof_{2})\n'.format(f.name,
                                                                               f.name,
                                                                               cgotype)
-        s += 'copy(xc.{}[:],{}Bytes)\n'.format(union_name,f.name)
+        s += 'copy(xc.{0}[:],{1}Bytes)\n'.format(union_name,f.name)
 
     # End switch statement
     s += 'default:\n'
-    err_string = '"invalid union key \'%v\'", x.{}'.format(gokeyname)
-    s += 'return fmt.Errorf({})'.format(err_string)
+    err_string = '"invalid union key \'%v\'", x.{0}'.format(gokeyname)
+    s += 'return fmt.Errorf({0})'.format(err_string)
     s += '}\n'
 
     return s
@@ -599,29 +599,29 @@ def xenlight_golang_array_to_C(ty = None):
 
     is_enum = isinstance(ty.type.elem_type,idl.Enumeration)
     if gotypename in go_builtin_types or is_enum:
-        s += 'if {} := len(x.{}); {} > 0 {{\n'.format(golenvar,goname,golenvar)
-        s += 'xc.{} = (*C.{})(C.malloc(C.size_t({}*{})))\n'.format(cname,ctypename,
+        s += 'if {0} := len(x.{1}); {2} > 0 {{\n'.format(golenvar,goname,golenvar)
+        s += 'xc.{0} = (*C.{1})(C.malloc(C.size_t({2}*{3})))\n'.format(cname,ctypename,
                                                                    golenvar,golenvar)
-        s += 'xc.{} = C.int({})\n'.format(clenvar,golenvar)
-        s += 'c{} := (*[1<<28]C.{})(unsafe.Pointer(xc.{}))[:{}:{}]\n'.format(goname,
+        s += 'xc.{0} = C.int({1})\n'.format(clenvar,golenvar)
+        s += 'c{0} := (*[1<<28]C.{1})(unsafe.Pointer(xc.{2}))[:{3}:{4}]\n'.format(goname,
                                                                       ctypename,cname,
                                                                       golenvar,golenvar)
-        s += 'for i,v := range x.{} {{\n'.format(goname)
-        s += 'c{}[i] = C.{}(v)\n'.format(goname,ctypename)
+        s += 'for i,v := range x.{0} {{\n'.format(goname)
+        s += 'c{0}[i] = C.{1}(v)\n'.format(goname,ctypename)
         s += '}\n}\n'
 
         return s
 
-    s += 'if {} := len(x.{}); {} > 0 {{\n'.format(golenvar,goname,golenvar)
-    s += 'xc.{} = (*C.{})(C.malloc(C.ulong({})*C.sizeof_{}))\n'.format(cname,ctypename,
+    s += 'if {0} := len(x.{1}); {2} > 0 {{\n'.format(golenvar,goname,golenvar)
+    s += 'xc.{0} = (*C.{1})(C.malloc(C.ulong({2})*C.sizeof_{3}))\n'.format(cname,ctypename,
                                                                    golenvar,ctypename)
-    s += 'xc.{} = C.int({})\n'.format(clenvar,golenvar)
-    s += 'c{} := (*[1<<28]C.{})(unsafe.Pointer(xc.{}))[:{}:{}]\n'.format(goname,
+    s += 'xc.{0} = C.int({1})\n'.format(clenvar,golenvar)
+    s += 'c{0} := (*[1<<28]C.{1})(unsafe.Pointer(xc.{2}))[:{3}:{4}]\n'.format(goname,
                                                                          ctypename,cname,
                                                                          golenvar,golenvar)
-    s += 'for i,v := range x.{} {{\n'.format(goname)
-    s += 'if err := v.toC(&c{}[i]); err != nil {{\n'.format(goname)
-    s += 'return fmt.Errorf("converting field {}: %v", err)\n'.format(goname)
+    s += 'for i,v := range x.{0} {{\n'.format(goname)
+    s += 'if err := v.toC(&c{0}[i]); err != nil {{\n'.format(goname)
+    s += 'return fmt.Errorf("converting field {0}: %v", err)\n'.format(goname)
     s += '}\n}\n}\n'
 
     return s
@@ -633,7 +633,7 @@ def xenlight_golang_define_constructor(ty = None):
     gotypename = xenlight_golang_fmt_name(ctypename)
 
     # Since this func is exported, add a comment as per Go conventions.
-    s += '// New{} returns an instance of {}'.format(gotypename,gotypename)
+    s += '// New{0} returns an instance of {1}'.format(gotypename,gotypename)
     s += ' initialized with defaults.\n'
 
     # If a struct has a keyed union, an extra argument is
@@ -643,7 +643,7 @@ def xenlight_golang_define_constructor(ty = None):
     init_fns = []
 
     # Add call to parent init_fn first.
-    init_fns.append('C.{}(&xc)'.format(ty.init_fn))
+    init_fns.append('C.{0}(&xc)'.format(ty.init_fn))
 
     for f in ty.fields:
         if not isinstance(f.type, idl.KeyedUnion):
@@ -658,24 +658,24 @@ def xenlight_golang_define_constructor(ty = None):
         # Serveral keyed unions use 'type' as the key variable name. In
         # that case, prepend the first letter of the Go type name.
         if param_goname == 'type':
-            param_goname = '{}type'.format(param_gotype.lower()[0])
+            param_goname = '{0}type'.format(param_gotype.lower()[0])
 
         # Add call to keyed union's init_fn.
-        init_fns.append('C.{}_{}(&xc, C.{}({}))'.format(ty.init_fn,
+        init_fns.append('C.{0}_{1}(&xc, C.{2}({3}))'.format(ty.init_fn,
                                                         param.name,
                                                         param_ctype,
                                                         param_goname))
 
         # Add to params list.
-        params.append('{} {}'.format(param_goname, param_gotype))
+        params.append('{0} {1}'.format(param_goname, param_gotype))
 
     # Define function
-    s += 'func New{}({}) (*{}, error) {{\n'.format(gotypename,
+    s += 'func New{0}({1}) (*{2}, error) {{\n'.format(gotypename,
                                                    ','.join(params),
                                                    gotypename)
 
     # Declare variables.
-    s += 'var (\nx {}\nxc C.{})\n\n'.format(gotypename, ctypename)
+    s += 'var (\nx {0}\nxc C.{1})\n\n'.format(gotypename, ctypename)
 
     # Write init_fn calls.
     s += '\n'.join(init_fns)
@@ -684,7 +684,7 @@ def xenlight_golang_define_constructor(ty = None):
     # Make sure dispose_fn get's called when constructor
     # returns.
     if ty.dispose_fn is not None:
-        s += 'defer C.{}(&xc)\n'.format(ty.dispose_fn)
+        s += 'defer C.{0}(&xc)\n'.format(ty.dispose_fn)
 
     s += '\n'
 
@@ -727,7 +727,7 @@ if __name__ == '__main__':
     header_comment="""// DO NOT EDIT.
 //
 // This file is generated by:
-// {}
+// {0}
 //
 
 """.format(' '.join(sys.argv))
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 21 12:33:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Jul 2020 12:33:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jxrSY-0001Ge-V0; Tue, 21 Jul 2020 12:33:26 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5KM5=BA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxrSX-0001GU-Fp
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:33:25 +0000
X-Inumbo-ID: 5edb831e-cb4e-11ea-850b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5edb831e-cb4e-11ea-850b-bc764e2007e4;
 Tue, 21 Jul 2020 12:33:24 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=fc3SKJS3p1ANLvGHejQtAS5bNmsND+knc9QSAPJjF90=; b=atbWsgTA4nTPsDpuyOy657Yx99
 JhewKYl7VxvbKfJLbpVV8q7XyZZdgC9cYKeN5kR5At32gdVjgI/mnxoUxXIDGwLM9RhoQmzxGHihK
 YBi1BvXxP3BP/eyinVwu977sWboWpyWQRoEBDxuJW5m5ZrylipOljfviPpu9qnpMp/ys=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxrSW-0005sE-Li
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:33:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxrSW-0005wC-Jy
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:33:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] oxenstored: fix ABI breakage introduced in Xen 4.9.0
Message-Id: <E1jxrSW-0005wC-Jy@xenbits.xenproject.org>
Date: Tue, 21 Jul 2020 12:33:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a6ed77f1e0334c26e6e216aea45f8674d9284856
Author:     Edwin TÃ¶rÃ¶k <edvin.torok@citrix.com>
AuthorDate: Wed Jul 15 16:10:56 2020 +0100
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jul 21 12:31:45 2020 +0000

    oxenstored: fix ABI breakage introduced in Xen 4.9.0
    
    dbc84d2983969bb47d294131ed9e6bbbdc2aec49 (Xen >= 4.9.0) deleted XS_RESTRICT
    from oxenstored, which caused all the following opcodes to be shifted by 1:
    reset_watches became off-by-one compared to the C version of xenstored.
    
    Looking at the C code the opcode for reset watches needs:
    XS_RESET_WATCHES = XS_SET_TARGET + 2
    
    So add the placeholder `Invalid` in the OCaml<->C mapping list.
    (Note that the code here doesn't simply convert the OCaml constructor to
     an integer, so we don't need to introduce a dummy constructor).
    
    Igor says that with a suitably patched xenopsd to enable watch reset,
    we now see `reset watches` during kdump of a guest in xenstored-access.log.
    
    Signed-off-by: Edwin TÃ¶rÃ¶k <edvin.torok@citrix.com>
    Tested-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/xb/op.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xb/op.ml b/tools/ocaml/libs/xb/op.ml
index d4f1f08185..9bcab0f38c 100644
--- a/tools/ocaml/libs/xb/op.ml
+++ b/tools/ocaml/libs/xb/op.ml
@@ -28,7 +28,7 @@ let operation_c_mapping =
            Transaction_end; Introduce; Release;
            Getdomainpath; Write; Mkdir; Rm;
            Setperms; Watchevent; Error; Isintroduced;
-           Resume; Set_target; Reset_watches |]
+           Resume; Set_target; Invalid; Reset_watches |]
 let size = Array.length operation_c_mapping
 
 let array_search el a =
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 21 12:44:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Jul 2020 12:44:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jxrcq-0002Kj-P9; Tue, 21 Jul 2020 12:44:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5KM5=BA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxrcp-0002KZ-7h
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:44:03 +0000
X-Inumbo-ID: dac15639-cb4f-11ea-850b-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id dac15639-cb4f-11ea-850b-bc764e2007e4;
 Tue, 21 Jul 2020 12:44:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=clsg78/N0h8x7aYdQH10m+CR9FwZcjGJu9k4EVAjidI=; b=nBvqPo5Kw9SZJ07p9pnET7NFS5
 QFhzZ0H7GilbV+WOZaAs42pIkJ4U1rgFJLPVnDHX7XaauwDrGqvEhbKfs2PqO1BX/xuPcFhyCkogK
 2UrB7t/AKUJ229OcOWroGBMNvEJKpzBkQzcGAoODq1qAqv/y1yG9I+/VHlzxVQWBVWrc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxrco-00065i-8V
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxrco-0006nl-5Z
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:44:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [mini-os master] mini-os: don't hard-wire xen internal paths
Message-Id: <E1jxrco-0006nl-5Z@xenbits.xenproject.org>
Date: Tue, 21 Jul 2020 12:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit d8a7bd2430a590a958f3c17fc1b2f7f563a04db2
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Jul 13 10:42:30 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jul 21 12:41:15 2020 +0000

    mini-os: don't hard-wire xen internal paths
    
    Mini-OS shouldn't use Xen internal paths for building. Import the
    needed paths from Xen and fall back to the current values only if
    the import was not possible.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 Config.mk | 15 ++++++++++++++-
 Makefile  | 35 ++++++++++++++++++-----------------
 2 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/Config.mk b/Config.mk
index f6a2afa..cb823c2 100644
--- a/Config.mk
+++ b/Config.mk
@@ -33,6 +33,19 @@ endif
 #
 ifneq ($(XEN_ROOT),)
 MINIOS_ROOT=$(XEN_ROOT)/extras/mini-os
+
+-include $(XEN_ROOT)/stubdom/mini-os.mk
+
+XENSTORE_CPPFLAGS ?= -isystem $(XEN_ROOT)/tools/xenstore/include
+TOOLCORE_PATH ?= $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toolcore
+TOOLLOG_PATH ?= $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog
+EVTCHN_PATH ?= $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/evtchn
+GNTTAB_PATH ?= $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/gnttab
+CALL_PATH ?= $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/call
+FOREIGNMEMORY_PATH ?= $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/foreignmemory
+DEVICEMODEL_PATH ?= $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/devicemodel
+CTRL_PATH ?= $(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH)
+GUEST_PATH ?= $(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH)
 else
 MINIOS_ROOT=$(TOPLEVEL_DIR)
 endif
@@ -93,7 +106,7 @@ DEF_CPPFLAGS += -D__MINIOS__
 ifeq ($(libc),y)
 DEF_CPPFLAGS += -DHAVE_LIBC
 DEF_CPPFLAGS += -isystem $(MINIOS_ROOT)/include/posix
-DEF_CPPFLAGS += -isystem $(XEN_ROOT)/tools/xenstore/include
+DEF_CPPFLAGS += $(XENSTORE_CPPFLAGS)
 endif
 
 ifneq ($(LWIPDIR),)
diff --git a/Makefile b/Makefile
index be640cd..4b76b55 100644
--- a/Makefile
+++ b/Makefile
@@ -125,23 +125,24 @@ OBJS := $(filter-out $(OBJ_DIR)/lwip%.o $(LWO), $(OBJS))
 
 ifeq ($(libc),y)
 ifeq ($(CONFIG_XC),y)
-APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toolcore -whole-archive -lxentoolcore -no-whole-archive
-LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toolcore/libxentoolcore.a
-APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog -whole-archive -lxentoollog -no-whole-archive
-LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/toollog/libxentoollog.a
-APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/evtchn -whole-archive -lxenevtchn -no-whole-archive
-LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/evtchn/libxenevtchn.a
-APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/gnttab -whole-archive -lxengnttab -no-whole-archive
-LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/gnttab/libxengnttab.a
-APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/call -whole-archive -lxencall -no-whole-archive
-LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/call/libxencall.a
-APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/foreignmemory -whole-archive -lxenforeignmemory -no-whole-archive
-LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/foreignmemory/libxenforeignmemory.a
-APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/devicemodel -whole-archive -lxendevicemodel -no-whole-archive
-LIBS += $(XEN_ROOT)/stubdom/libs-$(MINIOS_TARGET_ARCH)/devicemodel/libxendevicemodel.a
-APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH) -whole-archive -lxenguest -lxenctrl -no-whole-archive
-LIBS += $(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH)/libxenctrl.a
-LIBS += $(XEN_ROOT)/stubdom/libxc-$(MINIOS_TARGET_ARCH)/libxenguest.a
+APP_LDLIBS += -L$(TOOLCORE_PATH) -whole-archive -lxentoolcore -no-whole-archive
+LIBS += $(TOOLCORE_PATH)/libxentoolcore.a
+APP_LDLIBS += -L$(TOOLLOG_PATH) -whole-archive -lxentoollog -no-whole-archive
+LIBS += $(TOOLLOG_PATH)/libxentoollog.a
+APP_LDLIBS += -L$(EVTCHN_PATH) -whole-archive -lxenevtchn -no-whole-archive
+LIBS += $(EVTCHN_PATH)/libxenevtchn.a
+APP_LDLIBS += -L$(GNTTAB_PATH) -whole-archive -lxengnttab -no-whole-archive
+LIBS += $(GNTTAB_PATH)/libxengnttab.a
+APP_LDLIBS += -L$(CALL_PATH) -whole-archive -lxencall -no-whole-archive
+LIBS += $(CALL_PATH)/libxencall.a
+APP_LDLIBS += -L$(FOREIGNMEMORY_PATH) -whole-archive -lxenforeignmemory -no-whole-archive
+LIBS += $(FOREIGNMEMORY_PATH)/libxenforeignmemory.a
+APP_LDLIBS += -L$(DEVICEMODEL_PATH) -whole-archive -lxendevicemodel -no-whole-archive
+LIBS += $(DEVICEMODEL_PATH)/libxendevicemodel.a
+APP_LDLIBS += -L$(GUEST_PATH) -whole-archive -lxenguest -no-whole-archive
+LIBS += $(GUEST_PATH)/libxenguest.a
+APP_LDLIBS += -L$(CTRL_PATH) -whole-archive -lxenctrl -no-whole-archive
+LIBS += $(CTRL_PATH)/libxenctrl.a
 endif
 APP_LDLIBS += -lpci
 APP_LDLIBS += -lz
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 21 12:44:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Jul 2020 12:44:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jxrd3-0002NK-Qy; Tue, 21 Jul 2020 12:44:17 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5KM5=BA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxrd2-0002N1-MU
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:44:16 +0000
X-Inumbo-ID: e1dca739-cb4f-11ea-a0ae-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id e1dca739-cb4f-11ea-a0ae-12813bfff9fa;
 Tue, 21 Jul 2020 12:44:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=qbnOqFVac7H2m16YPmUZFdmaQLVTlzZQtkpqLRiwxSY=; b=Ne1l5RC+WxKOV3DM5MmZXLaFge
 5p2+OBYuHf5bQxbh6myk7qKTBohUtotuW18r9QUaYKcqbSZtOVCAmzZ2zeb79/14DXQNI1/HlG9Wv
 VVONicJI3PEap65r1aUfr+xl1rFucgRbW+ocXk0FcqOV/8XRcPStPDOtx8fRJ3YH4Qr4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxrd0-00065s-Rb
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxrd0-0006r5-Qj
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 12:44:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools/xen-cpuid: use dashes consistently in feature
 names
Message-Id: <E1jxrd0-0006r5-Qj@xenbits.xenproject.org>
Date: Tue, 21 Jul 2020 12:44:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 057cfa258ca554013178c5aaf6f80db47fb184fc
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 21 14:04:59 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jul 21 12:38:26 2020 +0000

    tools/xen-cpuid: use dashes consistently in feature names
    
    We've grown to a mix of dashes and underscores - switch to consistent
    naming in the hope that future additions will play by this.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/misc/xen-cpuid.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index f4bf88e2fa..ac3548dcfe 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -75,7 +75,7 @@ static const char *const str_e1d[32] =
 
 static const char *const str_e1c[32] =
 {
-    [ 0] = "lahf_lm",    [ 1] = "cmp",
+    [ 0] = "lahf-lm",    [ 1] = "cmp",
     [ 2] = "svm",        [ 3] = "extapic",
     [ 4] = "cr8d",       [ 5] = "lzcnt",
     [ 6] = "sse4a",      [ 7] = "msse",
@@ -86,10 +86,10 @@ static const char *const str_e1c[32] =
     [16] = "fma4",       [17] = "tce",
     /* [18] */           [19] = "nodeid",
     /* [20] */           [21] = "tbm",
-    [22] = "topoext",    [23] = "perfctr_core",
-    [24] = "perfctr_nb", /* [25] */
+    [22] = "topoext",    [23] = "perfctr-core",
+    [24] = "perfctr-nb", /* [25] */
     [26] = "dbx",        [27] = "perftsc",
-    [28] = "pcx_l2i",    [29] = "monitorx",
+    [28] = "pcx-l2i",    [29] = "monitorx",
 };
 
 static const char *const str_7b0[32] =
@@ -97,7 +97,7 @@ static const char *const str_7b0[32] =
     [ 0] = "fsgsbase", [ 1] = "tsc-adj",
     [ 2] = "sgx",      [ 3] = "bmi1",
     [ 4] = "hle",      [ 5] = "avx2",
-    [ 6] = "fdp_exn",  [ 7] = "smep",
+    [ 6] = "fdp-exn",  [ 7] = "smep",
     [ 8] = "bmi2",     [ 9] = "erms",
     [10] = "invpcid",  [11] = "rtm",
     [12] = "pqm",      [13] = "depfpp",
@@ -120,21 +120,21 @@ static const char *const str_Da1[32] =
 
 static const char *const str_7c0[32] =
 {
-    [ 0] = "prefetchwt1",      [ 1] = "avx512_vbmi",
+    [ 0] = "prefetchwt1",      [ 1] = "avx512-vbmi",
     [ 2] = "umip",             [ 3] = "pku",
     [ 4] = "ospke",            [ 5] = "waitpkg",
-    [ 6] = "avx512_vbmi2",     [ 7] = "cet-ss",
+    [ 6] = "avx512-vbmi2",     [ 7] = "cet-ss",
     [ 8] = "gfni",             [ 9] = "vaes",
-    [10] = "vpclmulqdq",       [11] = "avx512_vnni",
-    [12] = "avx512_bitalg",
-    [14] = "avx512_vpopcntdq",
+    [10] = "vpclmulqdq",       [11] = "avx512-vnni",
+    [12] = "avx512-bitalg",
+    [14] = "avx512-vpopcntdq",
     [16] = "tsxldtrk",
 
     [22] = "rdpid",
     /* 24 */                   [25] = "cldemote",
     /* 26 */                   [27] = "movdiri",
     [28] = "movdir64b",
-    [30] = "sgx_lc",
+    [30] = "sgx-lc",
 };
 
 static const char *const str_e7d[32] =
@@ -157,7 +157,7 @@ static const char *const str_e8b[32] =
 
 static const char *const str_7d0[32] =
 {
-    [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
+    [ 2] = "avx512-4vnniw", [ 3] = "avx512-4fmaps",
     [ 4] = "fsrm",
 
     [ 8] = "avx512-vp2intersect", [ 9] = "srbds-ctrl",
@@ -169,13 +169,13 @@ static const char *const str_7d0[32] =
     [20] = "cet-ibt",
 
     [26] = "ibrsb",         [27] = "stibp",
-    [28] = "l1d_flush",     [29] = "arch_caps",
-    [30] = "core_caps",     [31] = "ssbd",
+    [28] = "l1d-flush",     [29] = "arch-caps",
+    [30] = "core-caps",     [31] = "ssbd",
 };
 
 static const char *const str_7a1[32] =
 {
-    /* 4 */                 [ 5] = "avx512_bf16",
+    /* 4 */                 [ 5] = "avx512-bf16",
 };
 
 static const struct {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 21 15:00:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Jul 2020 15:00: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 1jxtkX-00078x-Dc; Tue, 21 Jul 2020 15:00:09 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5KM5=BA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxtkW-00078n-81
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 15:00:08 +0000
X-Inumbo-ID: dc02864e-cb62-11ea-a0e6-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id dc02864e-cb62-11ea-a0e6-12813bfff9fa;
 Tue, 21 Jul 2020 15:00:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=fm9GIKngEfuhmSVq85GlYHN4YhrHAwo9vvbSmffat/Y=; b=3LFQgMAZhmYoYh0+OeM7TH024R
 uzFyleZz7p12p6bvUFkJh/rPsW5VKzpMRCbaQDw3kCGse+gy/6Omh5ipMi8JPrpuHmKm6IU6NKaVD
 Roct95KNT0TnWAq+bqn16pYErItdSIj0MksG8eYWxe+NyTOA7B4phRYII81ERbS01SX4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxtkS-0000ZQ-IC
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 15:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxtkS-0007ZR-Fu
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 15:00:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools: Partially revert "Cross-compilation fixes."
Message-Id: <E1jxtkS-0007ZR-Fu@xenbits.xenproject.org>
Date: Tue, 21 Jul 2020 15:00:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 69953e2856382274749b617125cc98ce38198463
Author:     Elliott Mitchell <ehem+xen@m5p.com>
AuthorDate: Fri Jul 17 20:31:21 2020 -0700
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jul 21 14:48:49 2020 +0000

    tools: Partially revert "Cross-compilation fixes."
    
    This partially reverts commit 16504669c5cbb8b195d20412aadc838da5c428f7.
    
    Doesn't look like much of 16504669c5cbb8b195d20412aadc838da5c428f7
    actually remains due to passage of time.
    
    Of the 3, both Python and pygrub appear to mostly be building just fine
    cross-compiling.  The OCAML portion is being troublesome, this is going
    to cause bug reports elsewhere soon.  The OCAML portion though can
    already be disabled by setting OCAML_TOOLS=n and shouldn't have this
    extra form of disabling.
    
    Signed-off-by: Elliott Mitchell <ehem+xen@m5p.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/Makefile | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index c10946e3b1..198b239edc 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -39,12 +39,9 @@ SUBDIRS-$(CONFIG_X86) += debugger/gdbsx
 SUBDIRS-$(CONFIG_X86) += debugger/kdd
 SUBDIRS-$(CONFIG_TESTS) += tests
 
-# These don't cross-compile
-ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
 SUBDIRS-y += python
 SUBDIRS-y += pygrub
 SUBDIRS-$(OCAML_TOOLS) += ocaml
-endif
 
 ifeq ($(CONFIG_RUMP),y)
 SUBDIRS-y := libs libxc xenstore
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 21 15:00:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 21 Jul 2020 15:00:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jxtkf-0007Ax-Nt; Tue, 21 Jul 2020 15:00:17 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=5KM5=BA=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jxtkd-0007Aa-NW
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 15:00:15 +0000
X-Inumbo-ID: e209d5c4-cb62-11ea-854f-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e209d5c4-cb62-11ea-854f-bc764e2007e4;
 Tue, 21 Jul 2020 15:00:14 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=I28T34uenqe442QlWo1iaF07BEk+OjGLbEFpgpims64=; b=puug/v9QGicUVcStat6iGHfG+g
 PsFvekqtSrICNzTwwEJI3ywiM6Ey8z7UkKk8grosAjN3MPp9rrK63DOseMBsCwtXYArFAi+VaUDR9
 91hDhoHilw+ug+gLlumgc26d3ifJn3L1vbHTkzP3bBANZgfvR6r8foQudvfcsMAt5iSo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxtkc-0000ZZ-Lf
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 15:00:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jxtkc-0007aU-KH
 for xen-changelog@lists.xenproject.org; Tue, 21 Jul 2020 15:00:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools/ocaml: Default to useful build output
Message-Id: <E1jxtkc-0007aU-KH@xenbits.xenproject.org>
Date: Tue, 21 Jul 2020 15:00:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit f3885e8c3ceaef101e466466e879e97103ecce18
Author:     Elliott Mitchell <ehem+xen@m5p.com>
AuthorDate: Fri Jul 17 20:32:42 2020 -0700
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jul 21 14:49:36 2020 +0000

    tools/ocaml: Default to useful build output
    
    While hiding details of build output looks pretty to some, defaulting to
    doing so deviates from the rest of Xen.  Switch the OCAML tools to match
    everything else.
    
    Signed-off-by: Elliott Mitchell <ehem+xen@m5p.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/Makefile.rules | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index a893c42b43..abfbc64ce0 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -1,17 +1,20 @@
 ifdef V
-  ifeq ("$(origin V)", "command line")
-    BUILD_VERBOSE = $(V)
-  endif
+	ifeq ("$(origin V)", "command line")
+		BUILD_VERBOSE = $(V)
+	endif
+else
+	V := 1
+	BUILD_VERBOSE := 1
 endif
 ifndef BUILD_VERBOSE
-  BUILD_VERBOSE = 0
+	BUILD_VERBOSE := 0
 endif
 ifeq ($(BUILD_VERBOSE),1)
-  E = @true
-  Q =
+	E := @true
+	Q :=
 else
-  E = @echo
-  Q = @
+	E := @echo
+	Q := @
 endif
 
 .NOTPARALLEL:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jul 22 11:55:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Jul 2020 11:55: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 1jyDKy-000350-RG; Wed, 22 Jul 2020 11:55:04 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QpMd=BB=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jyDKx-00034l-1E
 for xen-changelog@lists.xenproject.org; Wed, 22 Jul 2020 11:55:03 +0000
X-Inumbo-ID: 2cc0fbce-cc12-11ea-a197-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 2cc0fbce-cc12-11ea-a197-12813bfff9fa;
 Wed, 22 Jul 2020 11:55:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Xp2iYlf+LfX/5Zl0sGc37+zxtpyXE5R2HnHY2qjUUoY=; b=VuEjHoX2D576p4PwCDHYbwGdgo
 yx5nBw6qAjP4TDLz9gB7BV8PYmR0GaW9CvetCYk72VnxlRI+dhSTQnAERnqNq2q3FdkLqZSD13p05
 IqxI6hQ2MEC1onc+rXYAWtJ9ag43qoeQlhHtK7g4M7hYRo4mOMucoM4lxKlneRLVUpRI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyDKv-0005Tq-UE
 for xen-changelog@lists.xenproject.org; Wed, 22 Jul 2020 11:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyDKv-0002Qf-SX
 for xen-changelog@lists.xenproject.org; Wed, 22 Jul 2020 11:55:01 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.14] docs: Replace non-UTF-8 character in
 hypfs-paths.pandoc
Message-Id: <E1jyDKv-0002Qf-SX@xenbits.xenproject.org>
Date: Wed, 22 Jul 2020 11:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 312e5be7ce751c35b79dff3aca4fb660610913e9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jul 20 17:54:52 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jul 20 18:08:21 2020 +0100

    docs: Replace non-UTF-8 character in hypfs-paths.pandoc
    
    From the docs cronjob on xenbits:
    
      /usr/bin/pandoc --number-sections --toc --standalone misc/hypfs-paths.pandoc --output html/misc/hypfs-paths.html
      pandoc: Cannot decode byte '\x92': Data.Text.Internal.Encoding.decodeUtf8: Invalid UTF-8 stream
      make: *** [Makefile:236: html/misc/hypfs-paths.html] Error 1
    
    Fixes: 5a4a411bde4 ("docs: specify stability of hypfs path documentation")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
    (cherry picked from commit 9ffdda96d9e7c3d9c7a5bbe2df6ab30f63927542)
---
 docs/misc/hypfs-paths.pandoc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc
index 81d70bb80c..dddb592bc5 100644
--- a/docs/misc/hypfs-paths.pandoc
+++ b/docs/misc/hypfs-paths.pandoc
@@ -74,7 +74,7 @@ you write finds a path present, it can rely on behavior in future versions of
 the hypervisors, and in different configurations.  Specifically:
 
 1. Conditions under which paths are used may be extended, restricted, or
-   removed.  For example, a path that’s always available only on ARM systems
+   removed.  For example, a path that's always available only on ARM systems
    may become available on x86; or a path available on both systems may be
    restricted to only appearing on ARM systems.  Paths may also disappear
    entirely.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Jul 22 11:55:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Jul 2020 11: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 1jyDL7-00036M-UA; Wed, 22 Jul 2020 11:55:13 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QpMd=BB=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jyDL6-00036A-O6
 for xen-changelog@lists.xenproject.org; Wed, 22 Jul 2020 11:55:12 +0000
X-Inumbo-ID: 32c416b4-cc12-11ea-a197-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 32c416b4-cc12-11ea-a197-12813bfff9fa;
 Wed, 22 Jul 2020 11:55:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=rXISN47kVz4tz+H4L3FLOugYIb2fQbClnZIcCbBvWK4=; b=MukXM0rOkY4WGc+QpWXHcKhGnb
 y+1QpIGRsonWFh30AzZ58XZoiWq2PABG/1BfLMEmMsTj7ARFoQfkQiMPn2NlmYChD+DqPVe3cMzGB
 BLwUZsJsFcdA1rFfKUd1wx7caUmWUMd7TaU1CyFJASGdqiJKqufFwyxvTjB+7RwIjlNA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyDL6-0005Tw-1w
 for xen-changelog@lists.xenproject.org; Wed, 22 Jul 2020 11:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyDL6-0002RK-06
 for xen-changelog@lists.xenproject.org; Wed, 22 Jul 2020 11:55:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.14] SUPPORT.md: Spell Experimental correctly
Message-Id: <E1jyDL6-0002RK-06@xenbits.xenproject.org>
Date: Wed, 22 Jul 2020 11:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 827031adfeb3c2656baa2156d3e7caaea8aec739
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Jul 20 18:35:55 2020 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Jul 21 13:21:24 2020 +0100

    SUPPORT.md: Spell Experimental correctly
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
    (cherry picked from commit 139ce42388c3fe7096a09b3d397250fe14906809)
---
 SUPPORT.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 7fa7e91b26..efbcb26ddf 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -249,13 +249,13 @@ to boot with memory < maxmem.
 
 Allow sharing of identical pages between guests
 
-    Status, x86 HVM: Expermental
+    Status, x86 HVM: Experimental
 
 ### Memory Paging
 
 Allow pages belonging to guests to be paged to disk
 
-    Status, x86 HVM: Experimenal
+    Status, x86 HVM: Experimental
 
 ### Alternative p2m
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Jul 22 14:22:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Jul 2020 14:22:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jyFdH-0007tu-WB; Wed, 22 Jul 2020 14:22:07 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QpMd=BB=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jyFdG-0007tp-J3
 for xen-changelog@lists.xenproject.org; Wed, 22 Jul 2020 14:22:06 +0000
X-Inumbo-ID: b70ed352-cc26-11ea-8664-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b70ed352-cc26-11ea-8664-bc764e2007e4;
 Wed, 22 Jul 2020 14:22:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=duM9oFM05HyIytFVWUTQLC9pReKnW1JW3WWRA5t1gpQ=; b=n3Nob6Xi3aB9rAmofk4Lf4YKx8
 zVy/DrxVSyV0QEhFfJlxNqkWRGKreubJDj9FIeBR3m9gjgEda/d2U+XFPJT69FaYxADkO2A4vSTeB
 Fdd12V3rSsYfMibz/+oiCWEV1+FLfJl/QkCw3k/JC2jto8WU2JxeO416wOepOCubUTbM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyFdE-0000F0-P7
 for xen-changelog@lists.xenproject.org; Wed, 22 Jul 2020 14:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyFdE-0003KL-O8
 for xen-changelog@lists.xenproject.org; Wed, 22 Jul 2020 14:22:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/svm: Fold nsvm_{wr, rd}msr() into svm_msr_{read,
 write}_intercept()
Message-Id: <E1jyFdE-0003KL-O8@xenbits.xenproject.org>
Date: Wed, 22 Jul 2020 14:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 26707b747feb5d707f659989c0f8f2e847e8020a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 10 11:58:03 2018 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jul 22 15:10:57 2020 +0100

    x86/svm: Fold nsvm_{wr,rd}msr() into svm_msr_{read,write}_intercept()
    
    ... to simplify the default cases.
    
    There are multiple errors with the handling of these three MSRs, but they are
    deliberately not addressed at this point.
    
    This removes the dance converting -1/0/1 into X86EMUL_*, allowing for the
    removal of the 'ret' variable.
    
    While cleaning this up, drop the gdprintk()'s for #GP conditions, and the
    'result' variable from svm_msr_write_intercept() as it is never modified.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/svm/nestedsvm.c        | 77 ---------------------------------
 xen/arch/x86/hvm/svm/svm.c              | 46 +++++++++++++-------
 xen/include/asm-x86/hvm/svm/nestedsvm.h |  4 --
 3 files changed, 31 insertions(+), 96 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index 11dc9c089c..a193d9de45 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -47,22 +47,6 @@ nestedsvm_vcpu_stgi(struct vcpu *v)
     local_event_delivery_enable(); /* unmask events for PV drivers */
 }
 
-static int
-nestedsvm_vmcb_isvalid(struct vcpu *v, uint64_t vmcxaddr)
-{
-    /* Address must be 4k aligned */
-    if ( (vmcxaddr & ~PAGE_MASK) != 0 )
-        return 0;
-
-    /* Maximum valid physical address.
-     * See AMD BKDG for HSAVE_PA MSR.
-     */
-    if ( vmcxaddr > 0xfd00000000ULL )
-        return 0;
-
-    return 1;
-}
-
 int nestedsvm_vmcb_map(struct vcpu *v, uint64_t vmcbaddr)
 {
     struct nestedvcpu *nv = &vcpu_nestedhvm(v);
@@ -1263,67 +1247,6 @@ enum hvm_intblk nsvm_intr_blocked(struct vcpu *v)
     return hvm_intblk_none;
 }
 
-/* MSR handling */
-int nsvm_rdmsr(struct vcpu *v, unsigned int msr, uint64_t *msr_content)
-{
-    struct nestedsvm *svm = &vcpu_nestedsvm(v);
-    int ret = 1;
-
-    *msr_content = 0;
-
-    switch (msr) {
-    case MSR_K8_VM_CR:
-        break;
-    case MSR_K8_VM_HSAVE_PA:
-        *msr_content = svm->ns_msr_hsavepa;
-        break;
-    case MSR_AMD64_TSC_RATIO:
-        *msr_content = svm->ns_tscratio;
-        break;
-    default:
-        ret = 0;
-        break;
-    }
-
-    return ret;
-}
-
-int nsvm_wrmsr(struct vcpu *v, unsigned int msr, uint64_t msr_content)
-{
-    int ret = 1;
-    struct nestedsvm *svm = &vcpu_nestedsvm(v);
-
-    switch (msr) {
-    case MSR_K8_VM_CR:
-        /* ignore write. handle all bits as read-only. */
-        break;
-    case MSR_K8_VM_HSAVE_PA:
-        if (!nestedsvm_vmcb_isvalid(v, msr_content)) {
-            gdprintk(XENLOG_ERR,
-                "MSR_K8_VM_HSAVE_PA value invalid %#"PRIx64"\n", msr_content);
-            ret = -1; /* inject #GP */
-            break;
-        }
-        svm->ns_msr_hsavepa = msr_content;
-        break;
-    case MSR_AMD64_TSC_RATIO:
-        if ((msr_content & ~TSC_RATIO_RSVD_BITS) != msr_content) {
-            gdprintk(XENLOG_ERR,
-                "reserved bits set in MSR_AMD64_TSC_RATIO %#"PRIx64"\n",
-                msr_content);
-            ret = -1; /* inject #GP */
-            break;
-        }
-        svm->ns_tscratio = msr_content;
-        break;
-    default:
-        ret = 0;
-        break;
-    }
-
-    return ret;
-}
-
 /* VMEXIT emulation */
 void
 nestedsvm_vmexit_defer(struct vcpu *v,
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 4eb41792e2..bbe73744b8 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1788,10 +1788,10 @@ static void svm_dr_access(struct vcpu *v, struct cpu_user_regs *regs)
 
 static int svm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
 {
-    int ret;
     struct vcpu *v = current;
     const struct domain *d = v->domain;
     struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
+    const struct nestedsvm *nsvm = &vcpu_nestedsvm(v);
 
     switch ( msr )
     {
@@ -1914,6 +1914,18 @@ static int svm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
             goto gpf;
         break;
 
+    case MSR_K8_VM_CR:
+        *msr_content = 0;
+        break;
+
+    case MSR_K8_VM_HSAVE_PA:
+        *msr_content = nsvm->ns_msr_hsavepa;
+        break;
+
+    case MSR_AMD64_TSC_RATIO:
+        *msr_content = nsvm->ns_tscratio;
+        break;
+
     case MSR_AMD_OSVW_ID_LENGTH:
     case MSR_AMD_OSVW_STATUS:
         if ( !d->arch.cpuid->extd.osvw )
@@ -1922,12 +1934,6 @@ static int svm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
         break;
 
     default:
-        ret = nsvm_rdmsr(v, msr, msr_content);
-        if ( ret < 0 )
-            goto gpf;
-        else if ( ret )
-            break;
-
         if ( rdmsr_safe(msr, *msr_content) == 0 )
             break;
 
@@ -1956,10 +1962,10 @@ static int svm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
 
 static int svm_msr_write_intercept(unsigned int msr, uint64_t msr_content)
 {
-    int ret, result = X86EMUL_OKAY;
     struct vcpu *v = current;
     struct domain *d = v->domain;
     struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
+    struct nestedsvm *nsvm = &vcpu_nestedsvm(v);
 
     switch ( msr )
     {
@@ -2085,6 +2091,22 @@ static int svm_msr_write_intercept(unsigned int msr, uint64_t msr_content)
             goto gpf;
         break;
 
+    case MSR_K8_VM_CR:
+        /* ignore write. handle all bits as read-only. */
+        break;
+
+    case MSR_K8_VM_HSAVE_PA:
+        if ( (msr_content & ~PAGE_MASK) || msr_content > 0xfd00000000ULL )
+            goto gpf;
+        nsvm->ns_msr_hsavepa = msr_content;
+        break;
+
+    case MSR_AMD64_TSC_RATIO:
+        if ( msr_content & TSC_RATIO_RSVD_BITS )
+            goto gpf;
+        nsvm->ns_tscratio = msr_content;
+        break;
+
     case MSR_IA32_MCx_MISC(4): /* Threshold register */
     case MSR_F10_MC4_MISC1 ... MSR_F10_MC4_MISC3:
         /*
@@ -2102,12 +2124,6 @@ static int svm_msr_write_intercept(unsigned int msr, uint64_t msr_content)
         break;
 
     default:
-        ret = nsvm_wrmsr(v, msr, msr_content);
-        if ( ret < 0 )
-            goto gpf;
-        else if ( ret )
-            break;
-
         /* Match up with the RDMSR side; ultimately this should go away. */
         if ( rdmsr_safe(msr, msr_content) == 0 )
             break;
@@ -2115,7 +2131,7 @@ static int svm_msr_write_intercept(unsigned int msr, uint64_t msr_content)
         goto gpf;
     }
 
-    return result;
+    return X86EMUL_OKAY;
 
  gpf:
     return X86EMUL_EXCEPTION;
diff --git a/xen/include/asm-x86/hvm/svm/nestedsvm.h b/xen/include/asm-x86/hvm/svm/nestedsvm.h
index 31fb4bfeb4..0873698457 100644
--- a/xen/include/asm-x86/hvm/svm/nestedsvm.h
+++ b/xen/include/asm-x86/hvm/svm/nestedsvm.h
@@ -118,10 +118,6 @@ bool_t nsvm_vmcb_guest_intercepts_event(
 bool_t nsvm_vmcb_hap_enabled(struct vcpu *v);
 enum hvm_intblk nsvm_intr_blocked(struct vcpu *v);
 
-/* MSRs */
-int nsvm_rdmsr(struct vcpu *v, unsigned int msr, uint64_t *msr_content);
-int nsvm_wrmsr(struct vcpu *v, unsigned int msr, uint64_t msr_content);
-
 /* Interrupts, vGIF */
 void svm_vmexit_do_clgi(struct cpu_user_regs *regs, struct vcpu *v);
 void svm_vmexit_do_stgi(struct cpu_user_regs *regs, struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jul 22 17:11:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Jul 2020 17: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 1jyIGp-00073O-TF; Wed, 22 Jul 2020 17:11:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QpMd=BB=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jyIGo-00073J-Bh
 for xen-changelog@lists.xenproject.org; Wed, 22 Jul 2020 17:11:06 +0000
X-Inumbo-ID: 5329d41c-cc3e-11ea-a1e6-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5329d41c-cc3e-11ea-a1e6-12813bfff9fa;
 Wed, 22 Jul 2020 17:11:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=/DHKYz1dNGmbM9P9FdyviJWaZGG5B+8NOHsM1/m01oE=; b=pKHiEn3OUdyXipXL4u88HVj3Yh
 qrkiFDJ1hj8lUzDTsbGLMx6bjHhdJh4Esczu2tVsWBVaeTjoIvwb+XsT3FTZ3gzEPBJ2sQIMw5n2b
 qIYrKJrFw9TiNC6mv46nhludSYPyX53e8aBJ9U970ezWcCVmOy2KMfEZL3uL//mpOafQ=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyIGm-0004F0-82
 for xen-changelog@lists.xenproject.org; Wed, 22 Jul 2020 17:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyIGm-0001zp-4u
 for xen-changelog@lists.xenproject.org; Wed, 22 Jul 2020 17:11:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.14] SUPPORT.md: Set version and release/support dates
Message-Id: <E1jyIGm-0001zp-4u@xenbits.xenproject.org>
Date: Wed, 22 Jul 2020 17:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit e4670f8b045b11a524171b119d9d4a20bf643367
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Wed Jul 22 17:55:44 2020 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Jul 22 18:00:23 2020 +0100

    SUPPORT.md: Set version and release/support dates
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 SUPPORT.md | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index efbcb26ddf..88a182ac31 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -9,10 +9,10 @@ for the definitions of the support status levels etc.
 
 # Release Support
 
-    Xen-Version: 4.14-rc
-    Initial-Release: n/a
-    Supported-Until: TBD
-    Security-Support-Until: Unreleased - not yet security-supported
+    Xen-Version: 4.14
+    Initial-Release: 2020-07-24
+    Supported-Until: 2022-01-24
+    Security-Support-Until: 2023-07-24
 
 Release Notes
 : <a href="https://wiki.xenproject.org/wiki/Xen_Project_4.14_Release_Notes">RN</a>
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Wed Jul 22 17:55:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Jul 2020 17:55: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 1jyIxO-0002JE-QC; Wed, 22 Jul 2020 17:55:06 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=QpMd=BB=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jyIxN-0002J9-O2
 for xen-changelog@lists.xenproject.org; Wed, 22 Jul 2020 17:55:05 +0000
X-Inumbo-ID: 78e94cae-cc44-11ea-a1ec-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 78e94cae-cc44-11ea-a1ec-12813bfff9fa;
 Wed, 22 Jul 2020 17:55:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=x6eAossqIWFsBACV/rV/9SBibxikmC0ESvL/mms8lXA=; b=FU0Sss/tepn/PngsGcbhH1fPb8
 opj/biGsH9N86RsuZIb5JlT16Fa/xI/Uiyxdavm5Yjlg1W0HAW8CHWGmHl5QwefYMuejS29u3N7Lw
 QttA5Qav4Y12gMdu6MSnCXH7AdJCFxohuVL4r60rCw0hebluGRPY3CC/wHWMA/4HOnXM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyIxM-00057j-IJ
 for xen-changelog@lists.xenproject.org; Wed, 22 Jul 2020 17:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyIxM-0004hm-Go
 for xen-changelog@lists.xenproject.org; Wed, 22 Jul 2020 17:55:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.14] Revert "SUPPORT.md: Set version and
 release/support dates"
Message-Id: <E1jyIxM-0004hm-Go@xenbits.xenproject.org>
Date: Wed, 22 Jul 2020 17:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 26984f2f432bb880f2bb4954e1248c9c2d1bbd54
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed Jul 22 18:47:10 2020 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Jul 22 18:47:10 2020 +0100

    Revert "SUPPORT.md: Set version and release/support dates"
    
    This reverts commit e4670f8b045b11a524171b119d9d4a20bf643367.
---
 SUPPORT.md | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 88a182ac31..efbcb26ddf 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -9,10 +9,10 @@ for the definitions of the support status levels etc.
 
 # Release Support
 
-    Xen-Version: 4.14
-    Initial-Release: 2020-07-24
-    Supported-Until: 2022-01-24
-    Security-Support-Until: 2023-07-24
+    Xen-Version: 4.14-rc
+    Initial-Release: n/a
+    Supported-Until: TBD
+    Security-Support-Until: Unreleased - not yet security-supported
 
 Release Notes
 : <a href="https://wiki.xenproject.org/wiki/Xen_Project_4.14_Release_Notes">RN</a>
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Jul 23 09:55:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Jul 2020 09:55:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jyXwU-000457-WE; Thu, 23 Jul 2020 09:55:11 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=tohF=BC=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jyXwT-000452-FI
 for xen-changelog@lists.xenproject.org; Thu, 23 Jul 2020 09:55:09 +0000
X-Inumbo-ID: 964e1fb4-ccca-11ea-86eb-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 964e1fb4-ccca-11ea-86eb-bc764e2007e4;
 Thu, 23 Jul 2020 09:55:06 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=8jfEnTcQp+dg+bQrCWId3nVow38abPLbYbhM3EMW2z0=; b=ISWOdLOFFKoNj5YRmMCq5Y74AG
 uSFYs4NCfoJxgUQV6L8Cho8ZI3+kSnAl4lKAgCvKBySi6SfzsXWvoqsXDt03SKto6Pt+a9gYHIbt9
 UVyd9cJKEYjta4ip2vVqpn2KbHnGrpix5p/l98YUVDm1D7RZBSsMAfP63+YBlKDK/6pM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyXwQ-0003l1-EK
 for xen-changelog@lists.xenproject.org; Thu, 23 Jul 2020 09:55:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyXwQ-0001zQ-CW
 for xen-changelog@lists.xenproject.org; Thu, 23 Jul 2020 09:55:06 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/svm: Misc coding style corrections
Message-Id: <E1jyXwQ-0001zQ-CW@xenbits.xenproject.org>
Date: Thu, 23 Jul 2020 09:55:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ffe4f0fe17b5288e0c19955cd1ba589e6db1b0fe
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 7 15:35:54 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jul 23 10:43:57 2020 +0100

    x86/svm: Misc coding style corrections
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/svm/intr.c      |  19 ++-
 xen/arch/x86/hvm/svm/nestedsvm.c | 291 +++++++++++++++++++++++----------------
 xen/arch/x86/hvm/svm/svm.c       |  76 +++++-----
 3 files changed, 225 insertions(+), 161 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/intr.c b/xen/arch/x86/hvm/svm/intr.c
index 38011bd4e2..7f815d2307 100644
--- a/xen/arch/x86/hvm/svm/intr.c
+++ b/xen/arch/x86/hvm/svm/intr.c
@@ -1,6 +1,6 @@
 /*
  * intr.c: Interrupt handling for SVM.
- * Copyright (c) 2005, AMD Inc. 
+ * Copyright (c) 2005, AMD Inc.
  * Copyright (c) 2004, Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -83,9 +83,12 @@ static void svm_enable_intr_window(struct vcpu *v, struct hvm_intack intack)
 
     ASSERT(intack.source != hvm_intsrc_none);
 
-    if ( nestedhvm_enabled(v->domain) ) {
+    if ( nestedhvm_enabled(v->domain) )
+    {
         struct nestedvcpu *nv = &vcpu_nestedhvm(v);
-        if ( nv->nv_vmentry_pending ) {
+
+        if ( nv->nv_vmentry_pending )
+        {
             struct vmcb_struct *gvmcb = nv->nv_vvmcx;
 
             /* check if l1 guest injects interrupt into l2 guest via vintr.
@@ -131,7 +134,7 @@ static void svm_enable_intr_window(struct vcpu *v, struct hvm_intack intack)
         vmcb, general1_intercepts | GENERAL1_INTERCEPT_VINTR);
 }
 
-void svm_intr_assist(void) 
+void svm_intr_assist(void)
 {
     struct vcpu *v = current;
     struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
@@ -151,7 +154,8 @@ void svm_intr_assist(void)
             return;
 
         intblk = hvm_interrupt_blocked(v, intack);
-        if ( intblk == hvm_intblk_svm_gif ) {
+        if ( intblk == hvm_intblk_svm_gif )
+        {
             ASSERT(nestedhvm_enabled(v->domain));
             return;
         }
@@ -167,10 +171,11 @@ void svm_intr_assist(void)
              * the l1 guest occurred.
              */
             rc = nestedsvm_vcpu_interrupt(v, intack);
-            switch (rc) {
+            switch ( rc )
+            {
             case NSVM_INTR_NOTINTERCEPTED:
                 /* Inject interrupt into 2nd level guest directly. */
-                break;	
+                break;
             case NSVM_INTR_NOTHANDLED:
             case NSVM_INTR_FORCEVMEXIT:
                 return;
diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index a193d9de45..fcfccf75df 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -30,7 +30,7 @@
 
 #define NSVM_ERROR_VVMCB        1
 #define NSVM_ERROR_VMENTRY      2
- 
+
 static void
 nestedsvm_vcpu_clgi(struct vcpu *v)
 {
@@ -51,7 +51,8 @@ int nestedsvm_vmcb_map(struct vcpu *v, uint64_t vmcbaddr)
 {
     struct nestedvcpu *nv = &vcpu_nestedhvm(v);
 
-    if (nv->nv_vvmcx != NULL && nv->nv_vvmcxaddr != vmcbaddr) {
+    if ( nv->nv_vvmcx != NULL && nv->nv_vvmcxaddr != vmcbaddr )
+    {
         ASSERT(vvmcx_valid(v));
         hvm_unmap_guest_frame(nv->nv_vvmcx, 1);
         nv->nv_vvmcx = NULL;
@@ -87,24 +88,24 @@ int nsvm_vcpu_initialise(struct vcpu *v)
 
     msrpm = alloc_xenheap_pages(get_order_from_bytes(MSRPM_SIZE), 0);
     svm->ns_cached_msrpm = msrpm;
-    if (msrpm == NULL)
+    if ( msrpm == NULL )
         goto err;
     memset(msrpm, 0x0, MSRPM_SIZE);
 
     msrpm = alloc_xenheap_pages(get_order_from_bytes(MSRPM_SIZE), 0);
     svm->ns_merged_msrpm = msrpm;
-    if (msrpm == NULL)
+    if ( msrpm == NULL )
         goto err;
     memset(msrpm, 0x0, MSRPM_SIZE);
 
     nv->nv_n2vmcx = alloc_vmcb();
-    if (nv->nv_n2vmcx == NULL)
+    if ( nv->nv_n2vmcx == NULL )
         goto err;
     nv->nv_n2vmcx_pa = virt_to_maddr(nv->nv_n2vmcx);
 
     return 0;
 
-err:
+ err:
     nsvm_vcpu_destroy(v);
     return -ENOMEM;
 }
@@ -120,28 +121,33 @@ void nsvm_vcpu_destroy(struct vcpu *v)
      * in order to avoid double free of l2 vmcb and the possible memory leak
      * of l1 vmcb page.
      */
-    if (nv->nv_n1vmcx)
+    if ( nv->nv_n1vmcx )
         v->arch.hvm.svm.vmcb = nv->nv_n1vmcx;
 
-    if (svm->ns_cached_msrpm) {
+    if ( svm->ns_cached_msrpm )
+    {
         free_xenheap_pages(svm->ns_cached_msrpm,
                            get_order_from_bytes(MSRPM_SIZE));
         svm->ns_cached_msrpm = NULL;
     }
-    if (svm->ns_merged_msrpm) {
+
+    if ( svm->ns_merged_msrpm )
+    {
         free_xenheap_pages(svm->ns_merged_msrpm,
                            get_order_from_bytes(MSRPM_SIZE));
         svm->ns_merged_msrpm = NULL;
     }
+
     hvm_unmap_guest_frame(nv->nv_vvmcx, 1);
     nv->nv_vvmcx = NULL;
-    if (nv->nv_n2vmcx) {
+    if ( nv->nv_n2vmcx )
+    {
         free_vmcb(nv->nv_n2vmcx);
         nv->nv_n2vmcx = NULL;
         nv->nv_n2vmcx_pa = INVALID_PADDR;
     }
-    if (svm->ns_iomap)
-        svm->ns_iomap = NULL;
+
+    svm->ns_iomap = NULL;
 }
 
 int nsvm_vcpu_reset(struct vcpu *v)
@@ -168,8 +174,7 @@ int nsvm_vcpu_reset(struct vcpu *v)
     svm->ns_vmexit.exitinfo1 = 0;
     svm->ns_vmexit.exitinfo2 = 0;
 
-    if (svm->ns_iomap)
-        svm->ns_iomap = NULL;
+    svm->ns_iomap = NULL;
 
     nestedsvm_vcpu_stgi(v);
     return 0;
@@ -182,15 +187,21 @@ static uint64_t nestedsvm_fpu_vmentry(uint64_t n1cr0,
     uint64_t vcr0;
 
     vcr0 = vvmcb->_cr0;
-    if ( !(n1cr0 & X86_CR0_TS) && (n1vmcb->_cr0 & X86_CR0_TS) ) {
-        /* svm_fpu_leave() run while l1 guest was running.
+    if ( !(n1cr0 & X86_CR0_TS) && (n1vmcb->_cr0 & X86_CR0_TS) )
+    {
+        /*
+         * svm_fpu_leave() run while l1 guest was running.
          * Sync FPU state with l2 guest.
          */
         vcr0 |= X86_CR0_TS;
         n2vmcb->_exception_intercepts |= (1U << TRAP_no_device);
-    } else if ( !(vcr0 & X86_CR0_TS) && (n2vmcb->_cr0 & X86_CR0_TS) ) {
-        /* svm_fpu_enter() run while l1 guest was running.
-         * Sync FPU state with l2 guest. */
+    }
+    else if ( !(vcr0 & X86_CR0_TS) && (n2vmcb->_cr0 & X86_CR0_TS) )
+    {
+        /*
+         * svm_fpu_enter() run while l1 guest was running.
+         * Sync FPU state with l2 guest.
+         */
         vcr0 &= ~X86_CR0_TS;
         n2vmcb->_exception_intercepts &= ~(1U << TRAP_no_device);
     }
@@ -201,14 +212,21 @@ static uint64_t nestedsvm_fpu_vmentry(uint64_t n1cr0,
 static void nestedsvm_fpu_vmexit(struct vmcb_struct *n1vmcb,
     struct vmcb_struct *n2vmcb, uint64_t n1cr0, uint64_t guest_cr0)
 {
-    if ( !(guest_cr0 & X86_CR0_TS) && (n2vmcb->_cr0 & X86_CR0_TS) ) {
-        /* svm_fpu_leave() run while l2 guest was running.
-         * Sync FPU state with l1 guest. */
+    if ( !(guest_cr0 & X86_CR0_TS) && (n2vmcb->_cr0 & X86_CR0_TS) )
+    {
+        /*
+         * svm_fpu_leave() run while l2 guest was running.
+         * Sync FPU state with l1 guest.
+         */
         n1vmcb->_cr0 |= X86_CR0_TS;
         n1vmcb->_exception_intercepts |= (1U << TRAP_no_device);
-    } else if ( !(n1cr0 & X86_CR0_TS) && (n1vmcb->_cr0 & X86_CR0_TS) ) {
-        /* svm_fpu_enter() run while l2 guest was running.
-         * Sync FPU state with l1 guest. */
+    }
+    else if ( !(n1cr0 & X86_CR0_TS) && (n1vmcb->_cr0 & X86_CR0_TS) )
+    {
+        /*
+         * svm_fpu_enter() run while l2 guest was running.
+         * Sync FPU state with l1 guest.
+         */
         n1vmcb->_cr0 &= ~X86_CR0_TS;
         n1vmcb->_exception_intercepts &= ~(1U << TRAP_no_device);
     }
@@ -225,16 +243,17 @@ static int nsvm_vcpu_hostsave(struct vcpu *v, unsigned int inst_len)
 
     n1vmcb->rip += inst_len;
 
-    /* Save shadowed values. This ensures that the l1 guest
-     * cannot override them to break out. */
+    /*
+     * Save shadowed values. This ensures that the l1 guest
+     * cannot override them to break out.
+     */
     n1vmcb->_efer = v->arch.hvm.guest_efer;
     n1vmcb->_cr0 = v->arch.hvm.guest_cr[0];
     n1vmcb->_cr2 = v->arch.hvm.guest_cr[2];
     n1vmcb->_cr4 = v->arch.hvm.guest_cr[4];
 
     /* Remember the host interrupt flag */
-    svm->ns_hostflags.fields.rflagsif =
-        (n1vmcb->rflags & X86_EFLAGS_IF) ? 1 : 0;
+    svm->ns_hostflags.fields.rflagsif = !!(n1vmcb->rflags & X86_EFLAGS_IF);
 
     return 0;
 }
@@ -251,7 +270,8 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
     ASSERT(n1vmcb != NULL);
     ASSERT(n2vmcb != NULL);
 
-    /* nsvm_vmcb_prepare4vmexit() already saved register values
+    /*
+     * nsvm_vmcb_prepare4vmexit() already saved register values
      * handled by VMSAVE/VMLOAD into n1vmcb directly.
      */
 
@@ -264,7 +284,7 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
     rc = hvm_set_efer(n1vmcb->_efer);
     if ( rc == X86EMUL_EXCEPTION )
         hvm_inject_hw_exception(TRAP_gp_fault, 0);
-    if (rc != X86EMUL_OKAY)
+    if ( rc != X86EMUL_OKAY )
         gdprintk(XENLOG_ERR, "hvm_set_efer failed, rc: %u\n", rc);
 
     /* CR4 */
@@ -272,7 +292,7 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
     rc = hvm_set_cr4(n1vmcb->_cr4, true);
     if ( rc == X86EMUL_EXCEPTION )
         hvm_inject_hw_exception(TRAP_gp_fault, 0);
-    if (rc != X86EMUL_OKAY)
+    if ( rc != X86EMUL_OKAY )
         gdprintk(XENLOG_ERR, "hvm_set_cr4 failed, rc: %u\n", rc);
 
     /* CR0 */
@@ -283,7 +303,7 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
     rc = hvm_set_cr0(n1vmcb->_cr0 | X86_CR0_PE, true);
     if ( rc == X86EMUL_EXCEPTION )
         hvm_inject_hw_exception(TRAP_gp_fault, 0);
-    if (rc != X86EMUL_OKAY)
+    if ( rc != X86EMUL_OKAY )
         gdprintk(XENLOG_ERR, "hvm_set_cr0 failed, rc: %u\n", rc);
     svm->ns_cr0 = v->arch.hvm.guest_cr[0];
 
@@ -293,17 +313,22 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
 
     /* CR3 */
     /* Nested paging mode */
-    if (nestedhvm_paging_mode_hap(v)) {
+    if ( nestedhvm_paging_mode_hap(v) )
+    {
         /* host nested paging + guest nested paging. */
         /* hvm_set_cr3() below sets v->arch.hvm.guest_cr[3] for us. */
-    } else if (paging_mode_hap(v->domain)) {
+    }
+    else if ( paging_mode_hap(v->domain) )
+    {
         /* host nested paging + guest shadow paging. */
         /* hvm_set_cr3() below sets v->arch.hvm.guest_cr[3] for us. */
-    } else {
+    }
+    else
+    {
         /* host shadow paging + guest shadow paging. */
 
         /* Reset MMU context  -- XXX (hostrestore) not yet working*/
-        if (!pagetable_is_null(v->arch.guest_table))
+        if ( !pagetable_is_null(v->arch.guest_table) )
             put_page(pagetable_get_page(v->arch.guest_table));
         v->arch.guest_table = pagetable_null();
         /* hvm_set_cr3() below sets v->arch.hvm.guest_cr[3] for us. */
@@ -311,7 +336,7 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
     rc = hvm_set_cr3(n1vmcb->_cr3, false, true);
     if ( rc == X86EMUL_EXCEPTION )
         hvm_inject_hw_exception(TRAP_gp_fault, 0);
-    if (rc != X86EMUL_OKAY)
+    if ( rc != X86EMUL_OKAY )
         gdprintk(XENLOG_ERR, "hvm_set_cr3 failed, rc: %u\n", rc);
 
     regs->rax = n1vmcb->rax;
@@ -321,7 +346,8 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
     n1vmcb->_dr7 = 0; /* disable all breakpoints */
     n1vmcb->_cpl = 0;
 
-    /* Clear exitintinfo to prevent a fault loop of re-injecting
+    /*
+     * Clear exitintinfo to prevent a fault loop of re-injecting
      * exceptions forever.
      */
     n1vmcb->exit_int_info.raw = 0;
@@ -375,13 +401,11 @@ static int nsvm_vmrun_permissionmap(struct vcpu *v, bool_t viopm)
     nv->nv_ioportED = ioport_ed;
 
     /* v->arch.hvm.svm.msrpm has type unsigned long, thus BYTES_PER_LONG. */
-    for (i = 0; i < MSRPM_SIZE / BYTES_PER_LONG; i++)
+    for ( i = 0; i < MSRPM_SIZE / BYTES_PER_LONG; i++ )
         svm->ns_merged_msrpm[i] = arch_svm->msrpm[i] | ns_msrpm_ptr[i];
 
-    host_vmcb->_iopm_base_pa =
-        (uint64_t)virt_to_maddr(svm->ns_iomap);
-    host_vmcb->_msrpm_base_pa =
-        (uint64_t)virt_to_maddr(svm->ns_merged_msrpm);
+    host_vmcb->_iopm_base_pa  = virt_to_maddr(svm->ns_iomap);
+    host_vmcb->_msrpm_base_pa = virt_to_maddr(svm->ns_merged_msrpm);
 
     return 0;
 }
@@ -438,7 +462,7 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
      * below. Those cleanbits would be tracked in an integer field
      * in struct nestedsvm.
      * But this effort is not worth doing because:
-     * - Only the intercepts bit of the n1vmcb can effectively be used here 
+     * - Only the intercepts bit of the n1vmcb can effectively be used here
      * - The CPU runs more instructions for the tracking than can be
      *   safed here.
      * The overhead comes from (ordered from highest to lowest):
@@ -462,7 +486,7 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
         n1vmcb->_general2_intercepts | ns_vmcb->_general2_intercepts;
 
     /* Nested Pause Filter */
-    if (ns_vmcb->_general1_intercepts & GENERAL1_INTERCEPT_PAUSE)
+    if ( ns_vmcb->_general1_intercepts & GENERAL1_INTERCEPT_PAUSE )
         n2vmcb->_pause_filter_count =
             min(n1vmcb->_pause_filter_count, ns_vmcb->_pause_filter_count);
     else
@@ -473,7 +497,7 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
 
     /* Nested IO permission bitmaps */
     rc = nsvm_vmrun_permissionmap(v, clean.iopm);
-    if (rc)
+    if ( rc )
         return rc;
 
     /* ASID - Emulation handled in hvm_asid_handle_vmenter() */
@@ -534,7 +558,7 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
     rc = hvm_set_efer(ns_vmcb->_efer);
     if ( rc == X86EMUL_EXCEPTION )
         hvm_inject_hw_exception(TRAP_gp_fault, 0);
-    if (rc != X86EMUL_OKAY)
+    if ( rc != X86EMUL_OKAY )
         gdprintk(XENLOG_ERR, "hvm_set_efer failed, rc: %u\n", rc);
 
     /* CR4 */
@@ -542,7 +566,7 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
     rc = hvm_set_cr4(ns_vmcb->_cr4, true);
     if ( rc == X86EMUL_EXCEPTION )
         hvm_inject_hw_exception(TRAP_gp_fault, 0);
-    if (rc != X86EMUL_OKAY)
+    if ( rc != X86EMUL_OKAY )
         gdprintk(XENLOG_ERR, "hvm_set_cr4 failed, rc: %u\n", rc);
 
     /* CR0 */
@@ -552,7 +576,7 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
     rc = hvm_set_cr0(cr0, true);
     if ( rc == X86EMUL_EXCEPTION )
         hvm_inject_hw_exception(TRAP_gp_fault, 0);
-    if (rc != X86EMUL_OKAY)
+    if ( rc != X86EMUL_OKAY )
         gdprintk(XENLOG_ERR, "hvm_set_cr0 failed, rc: %u\n", rc);
 
     /* CR2 */
@@ -560,7 +584,8 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
     hvm_update_guest_cr(v, 2);
 
     /* Nested paging mode */
-    if (nestedhvm_paging_mode_hap(v)) {
+    if ( nestedhvm_paging_mode_hap(v) )
+    {
         /* host nested paging + guest nested paging. */
         n2vmcb->_np_enable = 1;
 
@@ -570,9 +595,11 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
         rc = hvm_set_cr3(ns_vmcb->_cr3, false, true);
         if ( rc == X86EMUL_EXCEPTION )
             hvm_inject_hw_exception(TRAP_gp_fault, 0);
-        if (rc != X86EMUL_OKAY)
+        if ( rc != X86EMUL_OKAY )
             gdprintk(XENLOG_ERR, "hvm_set_cr3 failed, rc: %u\n", rc);
-    } else if (paging_mode_hap(v->domain)) {
+    }
+    else if ( paging_mode_hap(v->domain) )
+    {
         /* host nested paging + guest shadow paging. */
         n2vmcb->_np_enable = 1;
         /* Keep h_cr3 as it is. */
@@ -584,9 +611,11 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
         rc = hvm_set_cr3(ns_vmcb->_cr3, false, true);
         if ( rc == X86EMUL_EXCEPTION )
             hvm_inject_hw_exception(TRAP_gp_fault, 0);
-        if (rc != X86EMUL_OKAY)
+        if ( rc != X86EMUL_OKAY )
             gdprintk(XENLOG_ERR, "hvm_set_cr3 failed, rc: %u\n", rc);
-    } else {
+    }
+    else
+    {
         /* host shadow paging + guest shadow paging. */
         n2vmcb->_np_enable = 0;
         n2vmcb->_h_cr3 = 0x0;
@@ -640,13 +669,15 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
     n2vmcb->cleanbits.raw = 0;
 
     rc = svm_vmcb_isvalid(__func__, ns_vmcb, v, true);
-    if (rc) {
+    if ( rc )
+    {
         gdprintk(XENLOG_ERR, "virtual vmcb invalid\n");
         return NSVM_ERROR_VVMCB;
     }
 
     rc = svm_vmcb_isvalid(__func__, n2vmcb, v, true);
-    if (rc) {
+    if ( rc )
+    {
         gdprintk(XENLOG_ERR, "n2vmcb invalid\n");
         return NSVM_ERROR_VMENTRY;
     }
@@ -691,15 +722,15 @@ nsvm_vcpu_vmentry(struct vcpu *v, struct cpu_user_regs *regs,
     }
 
     /* nested paging for the guest */
-    svm->ns_hap_enabled = (ns_vmcb->_np_enable) ? 1 : 0;
+    svm->ns_hap_enabled = !!ns_vmcb->_np_enable;
 
     /* Remember the V_INTR_MASK in hostflags */
-    svm->ns_hostflags.fields.vintrmask =
-        (ns_vmcb->_vintr.fields.intr_masking) ? 1 : 0;
+    svm->ns_hostflags.fields.vintrmask = !!ns_vmcb->_vintr.fields.intr_masking;
 
     /* Save l1 guest state (= host state) */
     ret = nsvm_vcpu_hostsave(v, inst_len);
-    if (ret) {
+    if ( ret )
+    {
         gdprintk(XENLOG_ERR, "hostsave failed, ret = %i\n", ret);
         return ret;
     }
@@ -709,7 +740,8 @@ nsvm_vcpu_vmentry(struct vcpu *v, struct cpu_user_regs *regs,
     v->arch.hvm.svm.vmcb_pa = nv->nv_n2vmcx_pa;
 
     ret = nsvm_vmcb_prepare4vmrun(v, regs);
-    if (ret) {
+    if ( ret )
+    {
         gdprintk(XENLOG_ERR, "prepare4vmrun failed, ret = %i\n", ret);
         return ret;
     }
@@ -744,7 +776,8 @@ nsvm_vcpu_vmrun(struct vcpu *v, struct cpu_user_regs *regs)
      * and l1 guest keeps alive. */
     nestedhvm_vcpu_enter_guestmode(v);
 
-    switch (ret) {
+    switch ( ret )
+    {
     case 0:
         break;
     case NSVM_ERROR_VVMCB:
@@ -762,7 +795,7 @@ nsvm_vcpu_vmrun(struct vcpu *v, struct cpu_user_regs *regs)
     }
 
     /* If l1 guest uses shadow paging, update the paging mode. */
-    if (!nestedhvm_paging_mode_hap(v))
+    if ( !nestedhvm_paging_mode_hap(v) )
         paging_update_paging_modes(v);
 
     nv->nv_vmswitch_in_progress = 0;
@@ -785,9 +818,10 @@ nsvm_vcpu_vmexit_inject(struct vcpu *v, struct cpu_user_regs *regs,
 
     ns_vmcb = nv->nv_vvmcx;
 
-    if (nv->nv_vmexit_pending) {
-
-        switch (exitcode) {
+    if ( nv->nv_vmexit_pending )
+    {
+        switch ( exitcode )
+        {
         case VMEXIT_INTR:
             if ( unlikely(ns_vmcb->event_inj.v) && nv->nv_vmentry_pending &&
                  hvm_event_needs_reinjection(ns_vmcb->event_inj.type,
@@ -845,20 +879,20 @@ nsvm_vmcb_guest_intercepts_msr(unsigned long *msr_bitmap,
 
     msr_bit = svm_msrbit(msr_bitmap, msr);
 
-    if (msr_bit == NULL)
+    if ( msr_bit == NULL )
         /* MSR not in the permission map: Let the guest handle it. */
         return NESTEDHVM_VMEXIT_INJECT;
 
     msr &= 0x1fff;
 
-    if (write)
+    if ( write )
         /* write access */
         enabled = test_bit(msr * 2 + 1, msr_bit);
     else
         /* read access */
         enabled = test_bit(msr * 2, msr_bit);
 
-    if (!enabled)
+    if ( !enabled )
         return NESTEDHVM_VMEXIT_HOST;
 
     return NESTEDHVM_VMEXIT_INJECT;
@@ -921,41 +955,42 @@ nsvm_vmcb_guest_intercepts_exitcode(struct vcpu *v,
     struct vmcb_struct *ns_vmcb = nv->nv_vvmcx;
     enum nestedhvm_vmexits vmexits;
 
-    switch (exitcode) {
+    switch ( exitcode )
+    {
     case VMEXIT_CR0_READ ... VMEXIT_CR15_READ:
     case VMEXIT_CR0_WRITE ... VMEXIT_CR15_WRITE:
         exit_bits = 1ULL << (exitcode - VMEXIT_CR0_READ);
-        if (svm->ns_cr_intercepts & exit_bits)
+        if ( svm->ns_cr_intercepts & exit_bits )
             break;
         return 0;
 
     case VMEXIT_DR0_READ ... VMEXIT_DR7_READ:
     case VMEXIT_DR0_WRITE ... VMEXIT_DR7_WRITE:
         exit_bits = 1ULL << (exitcode - VMEXIT_DR0_READ);
-        if (svm->ns_dr_intercepts & exit_bits)
+        if ( svm->ns_dr_intercepts & exit_bits )
             break;
         return 0;
 
     case VMEXIT_EXCEPTION_DE ... VMEXIT_EXCEPTION_XF:
         exit_bits = 1ULL << (exitcode - VMEXIT_EXCEPTION_DE);
-        if (svm->ns_exception_intercepts & exit_bits)
+        if ( svm->ns_exception_intercepts & exit_bits )
             break;
         return 0;
 
     case VMEXIT_INTR ... VMEXIT_SHUTDOWN:
         exit_bits = 1ULL << (exitcode - VMEXIT_INTR);
-        if (svm->ns_general1_intercepts & exit_bits)
+        if ( svm->ns_general1_intercepts & exit_bits )
             break;
         return 0;
 
     case VMEXIT_VMRUN ... VMEXIT_XSETBV:
         exit_bits = 1ULL << (exitcode - VMEXIT_VMRUN);
-        if (svm->ns_general2_intercepts & exit_bits)
+        if ( svm->ns_general2_intercepts & exit_bits )
             break;
         return 0;
 
     case VMEXIT_NPF:
-        if (nestedhvm_paging_mode_hap(v))
+        if ( nestedhvm_paging_mode_hap(v) )
             break;
         return 0;
     case VMEXIT_INVALID:
@@ -969,7 +1004,8 @@ nsvm_vmcb_guest_intercepts_exitcode(struct vcpu *v,
     }
 
     /* Special cases: Do more detailed checks */
-    switch (exitcode) {
+    switch ( exitcode )
+    {
     case VMEXIT_MSR:
         ASSERT(regs != NULL);
         if ( !nestedsvm_vmcb_map(v, nv->nv_vvmcxaddr) )
@@ -977,7 +1013,7 @@ nsvm_vmcb_guest_intercepts_exitcode(struct vcpu *v,
         ns_vmcb = nv->nv_vvmcx;
         vmexits = nsvm_vmcb_guest_intercepts_msr(svm->ns_cached_msrpm,
             regs->ecx, ns_vmcb->exitinfo1 != 0);
-        if (vmexits == NESTEDHVM_VMEXIT_HOST)
+        if ( vmexits == NESTEDHVM_VMEXIT_HOST )
             return 0;
         break;
     case VMEXIT_IOIO:
@@ -986,7 +1022,7 @@ nsvm_vmcb_guest_intercepts_exitcode(struct vcpu *v,
         ns_vmcb = nv->nv_vvmcx;
         vmexits = nsvm_vmcb_guest_intercepts_ioio(ns_vmcb->_iopm_base_pa,
             ns_vmcb->exitinfo1);
-        if (vmexits == NESTEDHVM_VMEXIT_HOST)
+        if ( vmexits == NESTEDHVM_VMEXIT_HOST )
             return 0;
         break;
     }
@@ -1027,7 +1063,7 @@ nsvm_vmcb_prepare4vmexit(struct vcpu *v, struct cpu_user_regs *regs)
      */
 
     /* TSC offset */
-    /* Keep it. It's maintainted by the l1 guest. */ 
+    /* Keep it. It's maintainted by the l1 guest. */
 
     /* ASID */
     /* ns_vmcb->_guest_asid = n2vmcb->_guest_asid; */
@@ -1037,7 +1073,7 @@ nsvm_vmcb_prepare4vmexit(struct vcpu *v, struct cpu_user_regs *regs)
 
     /* Virtual Interrupts */
     ns_vmcb->_vintr = n2vmcb->_vintr;
-    if (!(svm->ns_hostflags.fields.vintrmask))
+    if ( !svm->ns_hostflags.fields.vintrmask )
         ns_vmcb->_vintr.fields.intr_masking = 0;
 
     /* Interrupt state */
@@ -1065,14 +1101,17 @@ nsvm_vmcb_prepare4vmexit(struct vcpu *v, struct cpu_user_regs *regs)
     ns_vmcb->event_inj.raw = 0;
 
     /* Nested paging mode */
-    if (nestedhvm_paging_mode_hap(v)) {
+    if ( nestedhvm_paging_mode_hap(v) )
+    {
         /* host nested paging + guest nested paging. */
         ns_vmcb->_np_enable = n2vmcb->_np_enable;
         ns_vmcb->_cr3 = n2vmcb->_cr3;
         /* The vmcb->h_cr3 is the shadowed h_cr3. The original
          * unshadowed guest h_cr3 is kept in ns_vmcb->h_cr3,
          * hence we keep the ns_vmcb->h_cr3 value. */
-    } else if (paging_mode_hap(v->domain)) {
+    }
+    else if ( paging_mode_hap(v->domain) )
+    {
         /* host nested paging + guest shadow paging. */
         ns_vmcb->_np_enable = 0;
         /* Throw h_cr3 away. Guest is not allowed to set it or
@@ -1081,7 +1120,9 @@ nsvm_vmcb_prepare4vmexit(struct vcpu *v, struct cpu_user_regs *regs)
         /* Stop intercepting #PF (already done above
          * by restoring cached intercepts). */
         ns_vmcb->_cr3 = n2vmcb->_cr3;
-    } else {
+    }
+    else
+    {
         /* host shadow paging + guest shadow paging. */
         ns_vmcb->_np_enable = 0;
         ns_vmcb->_h_cr3 = 0x0;
@@ -1211,12 +1252,13 @@ enum hvm_intblk nsvm_intr_blocked(struct vcpu *v)
     if ( !nestedsvm_gif_isset(v) )
         return hvm_intblk_svm_gif;
 
-    if ( nestedhvm_vcpu_in_guestmode(v) ) {
+    if ( nestedhvm_vcpu_in_guestmode(v) )
+    {
         struct vmcb_struct *n2vmcb = nv->nv_n2vmcx;
 
-        if ( svm->ns_hostflags.fields.vintrmask )
-            if ( !svm->ns_hostflags.fields.rflagsif )
-                return hvm_intblk_rflags_ie;
+        if ( svm->ns_hostflags.fields.vintrmask &&
+             !svm->ns_hostflags.fields.rflagsif )
+            return hvm_intblk_rflags_ie;
 
         /* when l1 guest passes its devices through to the l2 guest
          * and l2 guest does an MMIO access then we may want to
@@ -1237,12 +1279,11 @@ enum hvm_intblk nsvm_intr_blocked(struct vcpu *v)
         }
     }
 
-    if ( nv->nv_vmexit_pending ) {
+    if ( nv->nv_vmexit_pending )
         /* hvm_inject_hw_exception() must have run before.
          * exceptions have higher priority than interrupts.
          */
         return hvm_intblk_rflags_ie;
-    }
 
     return hvm_intblk_none;
 }
@@ -1275,9 +1316,10 @@ nestedsvm_check_intercepts(struct vcpu *v, struct cpu_user_regs *regs,
     ASSERT(vcpu_nestedhvm(v).nv_vmexit_pending == 0);
     is_intercepted = nsvm_vmcb_guest_intercepts_exitcode(v, regs, exitcode);
 
-    switch (exitcode) {
+    switch ( exitcode )
+    {
     case VMEXIT_INVALID:
-        if (is_intercepted)
+        if ( is_intercepted )
             return NESTEDHVM_VMEXIT_INJECT;
         return NESTEDHVM_VMEXIT_HOST;
 
@@ -1291,14 +1333,16 @@ nestedsvm_check_intercepts(struct vcpu *v, struct cpu_user_regs *regs,
         return NESTEDHVM_VMEXIT_HOST;
 
     case VMEXIT_NPF:
-        if (nestedhvm_paging_mode_hap(v)) {
-            if (!is_intercepted)
+        if ( nestedhvm_paging_mode_hap(v) )
+        {
+            if ( !is_intercepted )
                 return NESTEDHVM_VMEXIT_FATALERROR;
             /* host nested paging + guest nested paging */
             return NESTEDHVM_VMEXIT_HOST;
         }
-        if (paging_mode_hap(v->domain)) {
-            if (is_intercepted)
+        if ( paging_mode_hap(v->domain) )
+        {
+            if ( is_intercepted )
                 return NESTEDHVM_VMEXIT_FATALERROR;
             /* host nested paging + guest shadow paging */
             return NESTEDHVM_VMEXIT_HOST;
@@ -1306,20 +1350,21 @@ nestedsvm_check_intercepts(struct vcpu *v, struct cpu_user_regs *regs,
         /* host shadow paging + guest shadow paging */
         /* Can this happen? */
         BUG();
-        return NESTEDHVM_VMEXIT_FATALERROR;
+
     case VMEXIT_EXCEPTION_PF:
-        if (nestedhvm_paging_mode_hap(v)) {
+        if ( nestedhvm_paging_mode_hap(v) )
+        {
             /* host nested paging + guest nested paging */
-            if (!is_intercepted)
+            if ( !is_intercepted )
                 /* l1 guest intercepts #PF unnecessarily */
                 return NESTEDHVM_VMEXIT_HOST;
             /* l2 guest intercepts #PF unnecessarily */
             return NESTEDHVM_VMEXIT_INJECT;
         }
-        if (!paging_mode_hap(v->domain)) {
+        if ( !paging_mode_hap(v->domain) )
             /* host shadow paging + guest shadow paging */
             return NESTEDHVM_VMEXIT_HOST;
-        }
+
         /* host nested paging + guest shadow paging */
         return NESTEDHVM_VMEXIT_INJECT;
     case VMEXIT_VMMCALL:
@@ -1331,7 +1376,7 @@ nestedsvm_check_intercepts(struct vcpu *v, struct cpu_user_regs *regs,
         break;
     }
 
-    if (is_intercepted)
+    if ( is_intercepted )
         return NESTEDHVM_VMEXIT_INJECT;
     return NESTEDHVM_VMEXIT_HOST;
 }
@@ -1346,11 +1391,11 @@ nestedsvm_vmexit_n2n1(struct vcpu *v, struct cpu_user_regs *regs)
     ASSERT(nestedhvm_vcpu_in_guestmode(v));
 
     rc = nsvm_vmcb_prepare4vmexit(v, regs);
-    if (rc)
+    if ( rc )
         ret = NESTEDHVM_VMEXIT_ERROR;
 
     rc = nsvm_vcpu_hostrestore(v, regs);
-    if (rc)
+    if ( rc )
         ret = NESTEDHVM_VMEXIT_FATALERROR;
 
     nestedhvm_vcpu_exit_guestmode(v);
@@ -1374,17 +1419,19 @@ nestedsvm_vcpu_vmexit(struct vcpu *v, struct cpu_user_regs *regs,
     /* On special intercepts the host has to handle
      * the vcpu is still in guest mode here.
      */
-    if (nestedhvm_vcpu_in_guestmode(v)) {
+    if ( nestedhvm_vcpu_in_guestmode(v) )
+    {
         enum nestedhvm_vmexits ret;
 
         ret = nestedsvm_vmexit_n2n1(v, regs);
-        switch (ret) {
+        switch ( ret )
+        {
         case NESTEDHVM_VMEXIT_FATALERROR:
             gdprintk(XENLOG_ERR, "VMEXIT: fatal error\n");
             return ret;
         case NESTEDHVM_VMEXIT_HOST:
             BUG();
-            return ret;
+
         case NESTEDHVM_VMEXIT_ERROR:
             exitcode = VMEXIT_INVALID;
             break;
@@ -1404,12 +1451,12 @@ nestedsvm_vcpu_vmexit(struct vcpu *v, struct cpu_user_regs *regs,
     rc = nsvm_vcpu_vmexit_inject(v, regs, exitcode);
 
     /* If l1 guest uses shadow paging, update the paging mode. */
-    if (!nestedhvm_paging_mode_hap(v))
+    if ( !nestedhvm_paging_mode_hap(v) )
         paging_update_paging_modes(v);
 
     nv->nv_vmswitch_in_progress = 0;
 
-    if (rc)
+    if ( rc )
         return NESTEDHVM_VMEXIT_FATALERROR;
 
     return NESTEDHVM_VMEXIT_DONE;
@@ -1422,7 +1469,7 @@ void nsvm_vcpu_switch(struct cpu_user_regs *regs)
     struct nestedvcpu *nv;
     struct nestedsvm *svm;
 
-    if (!nestedhvm_enabled(v->domain))
+    if ( !nestedhvm_enabled(v->domain) )
         return;
 
     nv = &vcpu_nestedhvm(v);
@@ -1433,32 +1480,34 @@ void nsvm_vcpu_switch(struct cpu_user_regs *regs)
     ASSERT(nv->nv_n1vmcx_pa != INVALID_PADDR);
     ASSERT(nv->nv_n2vmcx_pa != INVALID_PADDR);
 
-    if (nv->nv_vmexit_pending) {
- vmexit:
+    if ( nv->nv_vmexit_pending )
+    {
+    vmexit:
         nestedsvm_vcpu_vmexit(v, regs, svm->ns_vmexit.exitcode);
         nv->nv_vmexit_pending = 0;
         nv->nv_vmentry_pending = 0;
         return;
     }
-    if (nv->nv_vmentry_pending) {
+
+    if ( nv->nv_vmentry_pending )
+    {
         int ret;
         ASSERT(!nv->nv_vmexit_pending);
         ret = nsvm_vcpu_vmrun(v, regs);
-        if (ret)
+        if ( ret )
             goto vmexit;
 
         ASSERT(nestedhvm_vcpu_in_guestmode(v));
         nv->nv_vmentry_pending = 0;
     }
 
-    if (nestedhvm_vcpu_in_guestmode(v)
-       && nestedhvm_paging_mode_hap(v))
+    if ( nestedhvm_vcpu_in_guestmode(v) && nestedhvm_paging_mode_hap(v) )
     {
         /* In case left the l2 guest due to a physical interrupt (e.g. IPI)
          * that is not for the l1 guest then we continue running the l2 guest
          * but check if the nestedp2m is still valid.
          */
-        if (nv->nv_p2m == NULL)
+        if ( nv->nv_p2m == NULL )
             nestedsvm_vmcb_set_nestedp2m(v, nv->nv_vvmcx, nv->nv_n2vmcx);
     }
 }
@@ -1477,7 +1526,8 @@ nestedsvm_vcpu_interrupt(struct vcpu *v, const struct hvm_intack intack)
     if ( intr != hvm_intblk_none )
         return NSVM_INTR_MASKED;
 
-    switch (intack.source) {
+    switch ( intack.source )
+    {
     case hvm_intsrc_pic:
     case hvm_intsrc_lapic:
     case hvm_intsrc_vector:
@@ -1500,7 +1550,8 @@ nestedsvm_vcpu_interrupt(struct vcpu *v, const struct hvm_intack intack)
 
     ret = nsvm_vmcb_guest_intercepts_exitcode(v,
                                      guest_cpu_user_regs(), exitcode);
-    if (ret) {
+    if ( ret )
+    {
         nestedsvm_vmexit_defer(v, exitcode, intack.source, exitinfo2);
         return NSVM_INTR_FORCEVMEXIT;
     }
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index bbe73744b8..ca3bbfcbb3 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -326,7 +326,7 @@ static int svm_vmcb_restore(struct vcpu *v, struct hvm_hw_cpu *c)
     vmcb->sysenter_cs = v->arch.hvm.svm.guest_sysenter_cs = c->sysenter_cs;
     vmcb->sysenter_esp = v->arch.hvm.svm.guest_sysenter_esp = c->sysenter_esp;
     vmcb->sysenter_eip = v->arch.hvm.svm.guest_sysenter_eip = c->sysenter_eip;
-    
+
     if ( paging_mode_hap(v->domain) )
     {
         vmcb_set_np_enable(vmcb, 1);
@@ -386,7 +386,8 @@ static void svm_save_vmcb_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt)
 static int svm_load_vmcb_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt)
 {
     svm_load_cpu_state(v, ctxt);
-    if (svm_vmcb_restore(v, ctxt)) {
+    if ( svm_vmcb_restore(v, ctxt) )
+    {
         gdprintk(XENLOG_ERR, "svm_vmcb restore failed!\n");
         domain_crash(v->domain);
         return -EINVAL;
@@ -413,9 +414,9 @@ static void svm_fpu_leave(struct vcpu *v)
     ASSERT(read_cr0() & X86_CR0_TS);
 
     /*
-     * If the guest does not have TS enabled then we must cause and handle an 
-     * exception on first use of the FPU. If the guest *does* have TS enabled 
-     * then this is not necessary: no FPU activity can occur until the guest 
+     * If the guest does not have TS enabled then we must cause and handle an
+     * exception on first use of the FPU. If the guest *does* have TS enabled
+     * then this is not necessary: no FPU activity can occur until the guest
      * clears CR0.TS, and we will initialise the FPU when that happens.
      */
     if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_TS) )
@@ -475,7 +476,8 @@ void svm_update_guest_cr(struct vcpu *v, unsigned int cr, unsigned int flags)
 
     switch ( cr )
     {
-    case 0: {
+    case 0:
+    {
         unsigned long hw_cr0_mask = 0;
 
         if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_TS) )
@@ -821,7 +823,8 @@ static void svm_set_tsc_offset(struct vcpu *v, u64 offset, u64 at_tsc)
     uint64_t n2_tsc_offset = 0;
     struct domain *d = v->domain;
 
-    if ( !nestedhvm_enabled(d) ) {
+    if ( !nestedhvm_enabled(d) )
+    {
         vmcb_set_tsc_offset(vmcb, offset);
         return;
     }
@@ -829,12 +832,14 @@ static void svm_set_tsc_offset(struct vcpu *v, u64 offset, u64 at_tsc)
     n1vmcb = vcpu_nestedhvm(v).nv_n1vmcx;
     n2vmcb = vcpu_nestedhvm(v).nv_n2vmcx;
 
-    if ( nestedhvm_vcpu_in_guestmode(v) ) {
+    if ( nestedhvm_vcpu_in_guestmode(v) )
+    {
         struct nestedsvm *svm = &vcpu_nestedsvm(v);
 
         n2_tsc_offset = vmcb_get_tsc_offset(n2vmcb) -
                         vmcb_get_tsc_offset(n1vmcb);
-        if ( svm->ns_tscratio != DEFAULT_TSC_RATIO ) {
+        if ( svm->ns_tscratio != DEFAULT_TSC_RATIO )
+        {
             uint64_t guest_tsc = hvm_get_guest_tsc_fixed(v, at_tsc);
 
             n2_tsc_offset = svm_get_tsc_offset(guest_tsc,
@@ -930,7 +935,7 @@ static inline void svm_tsc_ratio_save(struct vcpu *v)
 
 static inline void svm_tsc_ratio_load(struct vcpu *v)
 {
-    if ( cpu_has_tsc_ratio && !v->domain->arch.vtsc ) 
+    if ( cpu_has_tsc_ratio && !v->domain->arch.vtsc )
         wrmsrl(MSR_AMD64_TSC_RATIO, hvm_tsc_scaling_ratio(v->domain));
 }
 
@@ -1111,7 +1116,7 @@ static void svm_host_osvw_init(void)
              rdmsr_safe(MSR_AMD_OSVW_STATUS, status) )
             len = status = 0;
 
-        if (len < osvw_length)
+        if ( len < osvw_length )
             osvw_length = len;
 
         osvw_status |= status;
@@ -1507,13 +1512,11 @@ static void svm_init_erratum_383(const struct cpuinfo_x86 *c)
         return;
 
     /* use safe methods to be compatible with nested virtualization */
-    if (rdmsr_safe(MSR_AMD64_DC_CFG, msr_content) == 0 &&
-        wrmsr_safe(MSR_AMD64_DC_CFG, msr_content | (1ULL << 47)) == 0)
-    {
+    if ( rdmsr_safe(MSR_AMD64_DC_CFG, msr_content) == 0 &&
+         wrmsr_safe(MSR_AMD64_DC_CFG, msr_content | (1ULL << 47)) == 0 )
         amd_erratum383_found = 1;
-    } else {
+    else
         printk("Failed to enable erratum 383\n");
-    }
 }
 
 #ifdef CONFIG_PV
@@ -1582,7 +1585,7 @@ static int _svm_cpu_up(bool bsp)
     int rc;
     unsigned int cpu = smp_processor_id();
     const struct cpuinfo_x86 *c = &cpu_data[cpu];
- 
+
     /* Check whether SVM feature is disabled in BIOS */
     rdmsrl(MSR_K8_VM_CR, msr_content);
     if ( msr_content & K8_VMCR_SVME_DISABLE )
@@ -1713,7 +1716,7 @@ static void svm_do_nested_pgfault(struct vcpu *v,
         _d.qualification = 0;
         _d.mfn = mfn_x(mfn);
         _d.p2mt = p2mt;
-        
+
         __trace_var(TRC_HVM_NPF, 0, sizeof(_d), &_d);
     }
 
@@ -2248,16 +2251,15 @@ nsvm_get_nvmcb_page(struct vcpu *v, uint64_t vmcbaddr)
         return NULL;
 
     /* Need to translate L1-GPA to MPA */
-    page = get_page_from_gfn(v->domain, 
-                            nv->nv_vvmcxaddr >> PAGE_SHIFT, 
-                            &p2mt, P2M_ALLOC | P2M_UNSHARE);
+    page = get_page_from_gfn(v->domain, nv->nv_vvmcxaddr >> PAGE_SHIFT,
+                             &p2mt, P2M_ALLOC | P2M_UNSHARE);
     if ( !page )
         return NULL;
 
     if ( !p2m_is_ram(p2mt) || p2m_is_readonly(p2mt) )
     {
         put_page(page);
-        return NULL; 
+        return NULL;
     }
 
     return  page;
@@ -2274,7 +2276,7 @@ svm_vmexit_do_vmload(struct vmcb_struct *vmcb,
     if ( (inst_len = svm_get_insn_len(v, INSTR_VMLOAD)) == 0 )
         return;
 
-    if ( !nsvm_efer_svm_enabled(v) ) 
+    if ( !nsvm_efer_svm_enabled(v) )
     {
         hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC);
         return;
@@ -2309,7 +2311,7 @@ svm_vmexit_do_vmsave(struct vmcb_struct *vmcb,
     if ( (inst_len = svm_get_insn_len(v, INSTR_VMSAVE)) == 0 )
         return;
 
-    if ( !nsvm_efer_svm_enabled(v) ) 
+    if ( !nsvm_efer_svm_enabled(v) )
     {
         hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC);
         return;
@@ -2344,11 +2346,11 @@ static int svm_is_erratum_383(struct cpu_user_regs *regs)
 
     if ( msr_content != 0xb600000000010015ULL )
         return 0;
-    
+
     /* Clear MCi_STATUS registers */
-    for (i = 0; i < this_cpu(nr_mce_banks); i++)
+    for ( i = 0; i < this_cpu(nr_mce_banks); i++ )
         wrmsrl(MSR_IA32_MCx_STATUS(i), 0ULL);
-    
+
     rdmsrl(MSR_IA32_MCG_STATUS, msr_content);
     wrmsrl(MSR_IA32_MCG_STATUS, msr_content & ~(1ULL << 2));
 
@@ -2535,7 +2537,8 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
                     1/*cycles*/, 2, exit_reason,
                     regs->eip, 0, 0, 0, 0);
 
-    if ( vcpu_guestmode ) {
+    if ( vcpu_guestmode )
+    {
         enum nestedhvm_vmexits nsret;
         struct nestedvcpu *nv = &vcpu_nestedhvm(v);
         struct vmcb_struct *ns_vmcb = nv->nv_vvmcx;
@@ -2550,7 +2553,8 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
         exitinfo1 = ns_vmcb->exitinfo1;
         ns_vmcb->exitinfo1 = vmcb->exitinfo1;
         nsret = nestedsvm_check_intercepts(v, regs, exit_reason);
-        switch (nsret) {
+        switch ( nsret )
+        {
         case NESTEDHVM_VMEXIT_CONTINUE:
             BUG();
             break;
@@ -2566,7 +2570,8 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
             nv->nv_vmswitch_in_progress = 1;
             nsret = nestedsvm_vmexit_n2n1(v, regs);
             nv->nv_vmswitch_in_progress = 0;
-            switch (nsret) {
+            switch ( nsret )
+            {
             case NESTEDHVM_VMEXIT_DONE:
                 /* defer VMEXIT injection */
                 nestedsvm_vmexit_defer(v, exit_reason, exitinfo1, exitinfo2);
@@ -2698,9 +2703,10 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
 
     case VMEXIT_EXCEPTION_NM:
         svm_fpu_dirty_intercept();
-        break;  
+        break;
 
-    case VMEXIT_EXCEPTION_PF: {
+    case VMEXIT_EXCEPTION_PF:
+    {
         unsigned long va;
         va = vmcb->exitinfo2;
         regs->error_code = vmcb->exitinfo1;
@@ -2744,7 +2750,8 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
         svm_vmexit_mce_intercept(v, regs);
         break;
 
-    case VMEXIT_VINTR: {
+    case VMEXIT_VINTR:
+    {
         u32 general1_intercepts = vmcb_get_general1_intercepts(vmcb);
         intr = vmcb_get_vintr(vmcb);
 
@@ -2952,7 +2959,8 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
         v->arch.hvm.svm.cached_insn_len = 0;
         break;
 
-    case VMEXIT_IRET: {
+    case VMEXIT_IRET:
+    {
         u32 general1_intercepts = vmcb_get_general1_intercepts(vmcb);
 
         /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jul 23 14:55:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Jul 2020 14: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 1jycck-0000Rn-Cw; Thu, 23 Jul 2020 14:55:06 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=tohF=BC=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jyccj-0000Ri-V7
 for xen-changelog@lists.xenproject.org; Thu, 23 Jul 2020 14:55:06 +0000
X-Inumbo-ID: 7dcca1e8-ccf4-11ea-a2ba-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7dcca1e8-ccf4-11ea-a2ba-12813bfff9fa;
 Thu, 23 Jul 2020 14:55:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=tqfJ3+KaGXhra62uEm7VKJtsG6ETrXUxSN8PACjVW5g=; b=PuLMz5iD/9XuyrTEpjVn/yAbFR
 jyt27dMgcHjP6mlxRqcvVGCi0qQF+zfCujTnA90OmkI+VVlVHgO36zaJsnNCOs2hXxKqvmDJ532Cp
 /oiHVIIIUQKaYIcGsX9tAGNDc7EU6xfSyOxhNHEOSUKwz4JN04oVvp7TCQnMybqVmjlU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jycci-0001lb-59
 for xen-changelog@lists.xenproject.org; Thu, 23 Jul 2020 14:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jycci-0004jV-3C
 for xen-changelog@lists.xenproject.org; Thu, 23 Jul 2020 14:55:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/vmce: Dispatch vmce_{rd, wr}msr() from guest_{rd,
 wr}msr()
Message-Id: <E1jycci-0004jV-3C@xenbits.xenproject.org>
Date: Thu, 23 Jul 2020 14:55:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 8a7bf75eb5bba4046c1aa278330a371545a6ecbd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jul 21 18:25:15 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jul 23 15:42:48 2020 +0100

    x86/vmce: Dispatch vmce_{rd,wr}msr() from guest_{rd,wr}msr()
    
    ... rather than from the default clauses of the PV and HVM MSR handlers.
    
    This means that we no longer take the vmce lock for any unknown MSR, and
    accesses to architectural MCE banks outside of the subset implemented for the
    guest no longer fall further through the unknown MSR path.
    
    The bank limit of 32 isn't stated anywhere I can locate, but is a consequence
    of the MSR layout described in SDM Volume 4.
    
    With the vmce calls removed, the hvm alternative_call()'s expression can be
    simplified substantially.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/hvm.c         | 16 ++--------------
 xen/arch/x86/msr.c             | 16 ++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c | 15 ---------------
 3 files changed, 18 insertions(+), 29 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 5bb47583b3..a9d1685549 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3560,13 +3560,7 @@ int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
          break;
 
     default:
-        if ( (ret = vmce_rdmsr(msr, msr_content)) < 0 )
-            goto gp_fault;
-        /* If ret == 0 then this is not an MCE MSR, see other MSRs. */
-        ret = ((ret == 0)
-               ? alternative_call(hvm_funcs.msr_read_intercept,
-                                  msr, msr_content)
-               : X86EMUL_OKAY);
+        ret = alternative_call(hvm_funcs.msr_read_intercept, msr, msr_content);
         break;
     }
 
@@ -3696,13 +3690,7 @@ int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content,
         break;
 
     default:
-        if ( (ret = vmce_wrmsr(msr, msr_content)) < 0 )
-            goto gp_fault;
-        /* If ret == 0 then this is not an MCE MSR, see other MSRs. */
-        ret = ((ret == 0)
-               ? alternative_call(hvm_funcs.msr_write_intercept,
-                                  msr, msr_content)
-               : X86EMUL_OKAY);
+        ret = alternative_call(hvm_funcs.msr_write_intercept, msr, msr_content);
         break;
     }
 
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 22f921cc71..ca4307e19f 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -227,6 +227,14 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         *val = msrs->misc_features_enables.raw;
         break;
 
+    case MSR_IA32_MCG_CAP     ... MSR_IA32_MCG_CTL:      /* 0x179 -> 0x17b */
+    case MSR_IA32_MCx_CTL2(0) ... MSR_IA32_MCx_CTL2(31): /* 0x280 -> 0x29f */
+    case MSR_IA32_MCx_CTL(0)  ... MSR_IA32_MCx_MISC(31): /* 0x400 -> 0x47f */
+    case MSR_IA32_MCG_EXT_CTL:                           /* 0x4d0 */
+        if ( vmce_rdmsr(msr, val) < 0 )
+            goto gp_fault;
+        break;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
@@ -436,6 +444,14 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         break;
     }
 
+    case MSR_IA32_MCG_CAP     ... MSR_IA32_MCG_CTL:      /* 0x179 -> 0x17b */
+    case MSR_IA32_MCx_CTL2(0) ... MSR_IA32_MCx_CTL2(31): /* 0x280 -> 0x29f */
+    case MSR_IA32_MCx_CTL(0)  ... MSR_IA32_MCx_MISC(31): /* 0x400 -> 0x47f */
+    case MSR_IA32_MCG_EXT_CTL:                           /* 0x4d0 */
+        if ( vmce_wrmsr(msr, val) < 0 )
+            goto gp_fault;
+        break;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 254da2b849..f14552cb4b 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -855,8 +855,6 @@ static int read_msr(unsigned int reg, uint64_t *val,
 
     switch ( reg )
     {
-        int rc;
-
     case MSR_FS_BASE:
         if ( is_pv_32bit_domain(currd) )
             break;
@@ -955,12 +953,6 @@ static int read_msr(unsigned int reg, uint64_t *val,
         }
         /* fall through */
     default:
-        rc = vmce_rdmsr(reg, val);
-        if ( rc < 0 )
-            break;
-        if ( rc )
-            return X86EMUL_OKAY;
-        /* fall through */
     normal:
         /* Everyone can read the MSR space. */
         /* gdprintk(XENLOG_WARNING, "Domain attempted RDMSR %08x\n", reg); */
@@ -991,7 +983,6 @@ static int write_msr(unsigned int reg, uint64_t val,
     switch ( reg )
     {
         uint64_t temp;
-        int rc;
 
     case MSR_FS_BASE:
         if ( is_pv_32bit_domain(currd) || !is_canonical_address(val) )
@@ -1122,12 +1113,6 @@ static int write_msr(unsigned int reg, uint64_t val,
         }
         /* fall through */
     default:
-        rc = vmce_wrmsr(reg, val);
-        if ( rc < 0 )
-            break;
-        if ( rc )
-            return X86EMUL_OKAY;
-
         if ( (rdmsr_safe(reg, temp) != 0) || (val != temp) )
     invalid:
             gdprintk(XENLOG_WARNING,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Jul 23 15:11:08 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Jul 2020 15:11: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 1jycsF-0002FF-0L; Thu, 23 Jul 2020 15:11:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=tohF=BC=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jycsE-0002F7-8j
 for xen-changelog@lists.xenproject.org; Thu, 23 Jul 2020 15:11:06 +0000
X-Inumbo-ID: b980f1c5-ccf6-11ea-a2bc-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b980f1c5-ccf6-11ea-a2bc-12813bfff9fa;
 Thu, 23 Jul 2020 15:11:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=JFBxp8fz+HYBpm8OxeONjZzvJlLx3HxgZhOt9WFeBwQ=; b=jrwOuCl6xle8VjBFZO0bNGwFsz
 L24OagvD/GYgQs9VVgvQEmKBeBPPMLjpwu2RrrntQxujz22bL5Q/85O/TVIBESLh1AAb6vzTOyo7F
 cv8dFkvOOGViEhpR7oPMZ6inGrjGdIGh+tMthLBPcvvBNS9e6Vbd70fctTrbC6dIRvss=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jycsC-000276-JF
 for xen-changelog@lists.xenproject.org; Thu, 23 Jul 2020 15:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jycsC-0005vG-He
 for xen-changelog@lists.xenproject.org; Thu, 23 Jul 2020 15:11:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.14] SUPPORT.md: Set version and release/support dates
Message-Id: <E1jycsC-0005vG-He@xenbits.xenproject.org>
Date: Thu, 23 Jul 2020 15:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 2f0ed84a820e6760e825aace23c622d326a20f2e
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Wed Jul 22 17:55:44 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Thu Jul 23 15:15:56 2020 +0100

    SUPPORT.md: Set version and release/support dates
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index efbcb26ddf..88a182ac31 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -9,10 +9,10 @@ for the definitions of the support status levels etc.
 
 # Release Support
 
-    Xen-Version: 4.14-rc
-    Initial-Release: n/a
-    Supported-Until: TBD
-    Security-Support-Until: Unreleased - not yet security-supported
+    Xen-Version: 4.14
+    Initial-Release: 2020-07-24
+    Supported-Until: 2022-01-24
+    Security-Support-Until: 2023-07-24
 
 Release Notes
 : <a href="https://wiki.xenproject.org/wiki/Xen_Project_4.14_Release_Notes">RN</a>
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Jul 23 15:11:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Jul 2020 15:11: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 1jycsQ-0002GB-23; Thu, 23 Jul 2020 15:11:18 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=tohF=BC=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jycsO-0002G6-N0
 for xen-changelog@lists.xenproject.org; Thu, 23 Jul 2020 15:11:16 +0000
X-Inumbo-ID: c041e356-ccf6-11ea-a2bc-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c041e356-ccf6-11ea-a2bc-12813bfff9fa;
 Thu, 23 Jul 2020 15:11:14 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=myMfGjSuV1ELvQoeuivf47D5EhzMYaDmXb9MjBTDDZQ=; b=qOCN7wptQUUiLHI15vwqP/iqpX
 aQceQ7Wm8oz94mbVKvo47chK66WnAQSjbUVY+dYKSZojyxdzV+DDMlg/msfGJ/CoXK9cx9Kyef2iO
 vcPcc1ELlRvnG2xkIJ5LBjsgJD5EHNNFO9lsR3MUgQ24DcVKIZdKBZmsEiychm/fxjVs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jycsM-00027K-Ml
 for xen-changelog@lists.xenproject.org; Thu, 23 Jul 2020 15:11:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jycsM-0005wV-LK
 for xen-changelog@lists.xenproject.org; Thu, 23 Jul 2020 15:11:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.14] Config.mk: Nail subtrees to the Xen 4.14.0 release
 tags
Message-Id: <E1jycsM-0005wV-LK@xenbits.xenproject.org>
Date: Thu, 23 Jul 2020 15:11:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 51d3a84728aa82ed7ed7bbd651c0413961a70e5f
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Thu Jul 23 15:23:30 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Thu Jul 23 15:23:30 2020 +0100

    Config.mk: Nail subtrees to the Xen 4.14.0 release tags
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Config.mk | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/Config.mk b/Config.mk
index 478928c178..264dc0d27d 100644
--- a/Config.mk
+++ b/Config.mk
@@ -245,17 +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 ?= ea6d3cd1ed79d824e605a70c3626bc437c386260
-MINIOS_UPSTREAM_REVISION ?= f57858b7e8ef8dd48394dd08cec2bef3c9fb92f5
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.14.0
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.14.0
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.13.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= 3c659044118e34603161457db9934a34f816d78b
-# Fri Mar 13 12:35:26 2020 +0000
-# xen: cleanup IOREQ server on exit
+QEMU_TRADITIONAL_REVISION ?= xen-4.14.0
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.14


From xen-changelog-bounces@lists.xenproject.org Thu Jul 23 15:11:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Jul 2020 15:11:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jycsZ-0002Hb-3e; Thu, 23 Jul 2020 15:11:27 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=tohF=BC=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jycsX-0002HO-UK
 for xen-changelog@lists.xenproject.org; Thu, 23 Jul 2020 15:11:25 +0000
X-Inumbo-ID: c64864f0-ccf6-11ea-a2bc-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c64864f0-ccf6-11ea-a2bc-12813bfff9fa;
 Thu, 23 Jul 2020 15:11:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=oJErWJ4h2xFDjmrYDUstJJfuJgOpuWxLU5hm+qQ9cdI=; b=kiFLhJKOyNfPa+jm3KQCcflT44
 BzK46HtmzjJmKs/rYXaRVXA9t/FVH6oYvmPXADLemejxWNmbuxx1LXuKmV30+87i3MTnFMEl84iae
 oY3ctts5VPMzDb6o+ixtmhsGOXlyWwrbHhIIyeLwVdB8vlR3TwzFIBtyp05Yz+2Ob0+g=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jycsW-000293-Qh
 for xen-changelog@lists.xenproject.org; Thu, 23 Jul 2020 15:11:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jycsW-0005xi-Ox
 for xen-changelog@lists.xenproject.org; Thu, 23 Jul 2020 15:11:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging-4.14] README, Makefile: Xen 4.14.0 release
Message-Id: <E1jycsW-0005xi-Ox@xenbits.xenproject.org>
Date: Thu, 23 Jul 2020 15:11:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 456957aaa1391e0dfa969e2dd97b87c51a79444e
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Thu Jul 23 16:07:51 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Thu Jul 23 16:07:51 2020 +0100

    README, Makefile: Xen 4.14.0 release
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 README       | 16 ++++++++--------
 xen/Makefile |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/README b/README
index 46c67d8906..c7da4b06e2 100644
--- a/README
+++ b/README
@@ -1,11 +1,11 @@
-#################################
- _  _    _ _  _
-| || |  / | || |        _ __ ___
-| || |_ | | || |_ _____| '__/ __|
-|__   _|| |__   _|_____| | | (__
-   |_|(_)_|  |_|       |_|  \___|
-
-#################################
+###################################
+__  __            _  _    _ _  _
+\ \/ /___ _ __   | || |  / | || |
+ \  // _ \ '_ \  | || |_ | | || |_
+ /  \  __/ | | | |__   _|| |__   _|
+/_/\_\___|_| |_|    |_|(_)_|  |_|
+
+###################################
 
 https://www.xen.org/
 
diff --git a/xen/Makefile b/xen/Makefile
index 2f3f8b9deb..4a45e716a8 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 ?= .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.14


From xen-changelog-bounces@lists.xenproject.org Fri Jul 24 08:22:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Jul 2020 08:22: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 1jysxy-0001KC-P2; Fri, 24 Jul 2020 08:22:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Cf1I=BD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jysxx-0001K7-P3
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 08:22:05 +0000
X-Inumbo-ID: c1a908b0-cd86-11ea-87e3-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c1a908b0-cd86-11ea-87e3-bc764e2007e4;
 Fri, 24 Jul 2020 08:22:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=WPsHhGXGycLCdKuBEpqC17ytvz4rPl468QAGstdOt4Y=; b=1pArsjTF9kbieIoruBZgsQMkyA
 XeA2B35pxTOvovQnnCQFWoU/OY2EbT0qyyT2XuxK/1PAOFhkTQC6lLk+BR657Lp8DULGHWpkuqnnM
 Sflhj8DFs6Zgk+WmUeQQ8pYn5fAFOgBZhip2ZERIKIAXJP/IQKDuhX4MCyVMBtszfdRk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jysxw-0002FH-IR
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 08:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jysxw-0005Cz-HL
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 08:22:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/S3: put data segment registers into known state
 upon resume
Message-Id: <E1jysxw-0005Cz-HL@xenbits.xenproject.org>
Date: Fri, 24 Jul 2020 08:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 55f8c389d4348cc517946fdcb10794112458e81e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 24 10:17:26 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 24 10:17:26 2020 +0200

    x86/S3: put data segment registers into known state upon resume
    
    wakeup_32 sets %ds and %es to BOOT_DS, while leaving %fs at what
    wakeup_start did set it to, and %gs at whatever BIOS did load into it.
    All of this may end up confusing the first load_segments() to run on
    the BSP after resume, in particular allowing a non-nul selector value
    to be left in %fs.
    
    Alongside %ss, also put all other data segment registers into the same
    state that the boot and CPU bringup paths put them in.
    
    Reported-by: M. Vefa Bicakci <m.v.b@runbox.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/acpi/wakeup_prot.S | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/acpi/wakeup_prot.S b/xen/arch/x86/acpi/wakeup_prot.S
index dcc7e2327d..a2c41c4f3f 100644
--- a/xen/arch/x86/acpi/wakeup_prot.S
+++ b/xen/arch/x86/acpi/wakeup_prot.S
@@ -49,6 +49,10 @@ ENTRY(s3_resume)
         mov     %rax, %cr0
 
         mov     $__HYPERVISOR_DS64, %eax
+        mov     %eax, %ds
+        mov     %eax, %es
+        mov     %eax, %fs
+        mov     %eax, %gs
         mov     %eax, %ss
         mov     saved_rsp(%rip), %rsp
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jul 24 08:22:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Jul 2020 08: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 1jysy8-0001Kv-Qe; Fri, 24 Jul 2020 08:22:16 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Cf1I=BD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jysy7-0001Ko-Og
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 08:22:15 +0000
X-Inumbo-ID: c7b57202-cd86-11ea-87e3-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c7b57202-cd86-11ea-87e3-bc764e2007e4;
 Fri, 24 Jul 2020 08:22:14 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=wcR5d48tJIT/81wFxjYRkIsFcn/l9brPKsL6U47sW9A=; b=bsOxhVyZjU6SvnYJjTKRURbhgZ
 CyHmW5MrXmYi7VhD2ERA/0TRqePt1qSAOu0BiEPaYniSZH0e+xwzM5gyGmHOoG0HZWywqzCA8gUb0
 mzhUYsCQeFDCtRIO02CduONUsdaeL/uZ0nCj8EyuwDCZBQUUBQUjWx99Qs9kWahqyGMY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jysy6-0002Fq-Mh
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 08:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jysy6-0005Da-Kb
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 08:22:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] lockprof: don't leave locks uninitialized upon
 allocation failure
Message-Id: <E1jysy6-0005Da-Kb@xenbits.xenproject.org>
Date: Fri, 24 Jul 2020 08:22:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 82cba984b2e37496360ef2bf22e529a53c084631
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 24 10:18:30 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 24 10:18:30 2020 +0200

    lockprof: don't leave locks uninitialized upon allocation failure
    
    Even if a specific struct lock_profile instance can't be allocated, the
    lock itself should still be functional. As this isn't a production use
    feature, also log a message in the event that the profiling struct can't
    be allocated.
    
    Fixes: d98feda5c756 ("Make lock profiling usable again")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/xen/spinlock.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h
index 468b9ac9ef..c0e7690a6c 100644
--- a/xen/include/xen/spinlock.h
+++ b/xen/include/xen/spinlock.h
@@ -103,10 +103,16 @@ struct lock_profile_qhead {
     do {                                                                      \
         struct lock_profile *prof;                                            \
         prof = xzalloc(struct lock_profile);                                  \
-        if (!prof) break;                                                     \
+        (s)->l = (spinlock_t)_SPIN_LOCK_UNLOCKED(prof);                       \
+        if ( !prof )                                                          \
+        {                                                                     \
+            printk(XENLOG_WARNING                                             \
+                   "lock profiling unavailable for %p(%d)'s %s\n",            \
+                   s, (s)->profile_head.idx, #l);                             \
+            break;                                                            \
+        }                                                                     \
         prof->name = #l;                                                      \
         prof->lock = &(s)->l;                                                 \
-        (s)->l = (spinlock_t)_SPIN_LOCK_UNLOCKED(prof);                       \
         prof->next = (s)->profile_head.elem_q;                                \
         (s)->profile_head.elem_q = prof;                                      \
     } while(0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jul 24 08:22:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Jul 2020 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 1jysyI-0001MF-SK; Fri, 24 Jul 2020 08:22:26 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Cf1I=BD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jysyH-0001M2-OE
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 08:22:25 +0000
X-Inumbo-ID: cdb7380c-cd86-11ea-a385-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id cdb7380c-cd86-11ea-a385-12813bfff9fa;
 Fri, 24 Jul 2020 08:22:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=+NTt8YHCaDocFGEqPObDefHx17d7kTQlUfWCSDfvMfQ=; b=lrg1GR4DJv/JyrJXK0C5SnLDBv
 3iQA+mT7M33AfuxVsT4vjupkMTM7E39omt22f1x2NWTvullY5LasC19CxSD0YTbdXBS9LHJhsSRvT
 zSUzo1K54a2wFesBgyKEV8oWB/Ok8uZ13aHIBg1pGlp2mBBP9AYnbh+kiB1PVFtjE2Wk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jysyG-0002Fx-QB
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 08:22:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jysyG-0005Ff-Ot
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 08:22:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] lockprof: don't pass name into registration function
Message-Id: <E1jysyG-0005Ff-Ot@xenbits.xenproject.org>
Date: Fri, 24 Jul 2020 08:22:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit b2a64292b0bfa317886b3432d1a5b2a4193a48d6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 24 10:19:25 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 24 10:19:25 2020 +0200

    lockprof: don't pass name into registration function
    
    The type uniquely identifies the associated name, hence the name fields
    can be statically initialized.
    
    Also constify not just the involved struct field, but also struct
    lock_profile's. Rather than specifying lock_profile_ancs[]' dimension at
    definition time, add a suitable build time check, such that at least
    missing tail additions to the initializer can be spotted easily.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/domain.c        |  2 +-
 xen/common/spinlock.c      | 17 ++++++++++-------
 xen/include/xen/spinlock.h | 10 +++++-----
 3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index e9be05f1d0..f0f9c62feb 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -392,7 +392,7 @@ struct domain *domain_create(domid_t domid,
         d->max_vcpus = config->max_vcpus;
     }
 
-    lock_profile_register_struct(LOCKPROF_TYPE_PERDOM, d, domid, "Domain");
+    lock_profile_register_struct(LOCKPROF_TYPE_PERDOM, d, domid);
 
     if ( (err = xsm_alloc_security_domain(d)) != 0 )
         goto fail;
diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index 6c8b62beb0..17f4519fc7 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -338,7 +338,7 @@ void _spin_unlock_recursive(spinlock_t *lock)
 
 struct lock_profile_anc {
     struct lock_profile_qhead *head_q;   /* first head of this type */
-    char                      *name;     /* descriptive string for print */
+    const char                *name;     /* descriptive string for print */
 };
 
 typedef void lock_profile_subfunc(
@@ -348,7 +348,10 @@ extern struct lock_profile *__lock_profile_start;
 extern struct lock_profile *__lock_profile_end;
 
 static s_time_t lock_profile_start;
-static struct lock_profile_anc lock_profile_ancs[LOCKPROF_TYPE_N];
+static struct lock_profile_anc lock_profile_ancs[] = {
+    [LOCKPROF_TYPE_GLOBAL] = { .name = "Global" },
+    [LOCKPROF_TYPE_PERDOM] = { .name = "Domain" },
+};
 static struct lock_profile_qhead lock_profile_glb_q;
 static spinlock_t lock_profile_lock = SPIN_LOCK_UNLOCKED;
 
@@ -473,13 +476,12 @@ int spinlock_profile_control(struct xen_sysctl_lockprof_op *pc)
 }
 
 void _lock_profile_register_struct(
-    int32_t type, struct lock_profile_qhead *qhead, int32_t idx, char *name)
+    int32_t type, struct lock_profile_qhead *qhead, int32_t idx)
 {
     qhead->idx = idx;
     spin_lock(&lock_profile_lock);
     qhead->head_q = lock_profile_ancs[type].head_q;
     lock_profile_ancs[type].head_q = qhead;
-    lock_profile_ancs[type].name = name;
     spin_unlock(&lock_profile_lock);
 }
 
@@ -504,6 +506,8 @@ static int __init lock_prof_init(void)
 {
     struct lock_profile **q;
 
+    BUILD_BUG_ON(ARRAY_SIZE(lock_profile_ancs) != LOCKPROF_TYPE_N);
+
     for ( q = &__lock_profile_start; q < &__lock_profile_end; q++ )
     {
         (*q)->next = lock_profile_glb_q.elem_q;
@@ -511,9 +515,8 @@ static int __init lock_prof_init(void)
         (*q)->lock->profile = *q;
     }
 
-    _lock_profile_register_struct(
-        LOCKPROF_TYPE_GLOBAL, &lock_profile_glb_q,
-        0, "Global lock");
+    _lock_profile_register_struct(LOCKPROF_TYPE_GLOBAL,
+                                  &lock_profile_glb_q, 0);
 
     return 0;
 }
diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h
index c0e7690a6c..ca13b600a0 100644
--- a/xen/include/xen/spinlock.h
+++ b/xen/include/xen/spinlock.h
@@ -72,7 +72,7 @@ struct spinlock;
 
 struct lock_profile {
     struct lock_profile *next;       /* forward link */
-    char                *name;       /* lock name */
+    const char          *name;       /* lock name */
     struct spinlock     *lock;       /* the lock itself */
     u64                 lock_cnt;    /* # of complete locking ops */
     u64                 block_cnt;   /* # of complete wait for lock */
@@ -118,11 +118,11 @@ struct lock_profile_qhead {
     } while(0)
 
 void _lock_profile_register_struct(
-    int32_t, struct lock_profile_qhead *, int32_t, char *);
+    int32_t, struct lock_profile_qhead *, int32_t);
 void _lock_profile_deregister_struct(int32_t, struct lock_profile_qhead *);
 
-#define lock_profile_register_struct(type, ptr, idx, print)                   \
-    _lock_profile_register_struct(type, &((ptr)->profile_head), idx, print)
+#define lock_profile_register_struct(type, ptr, idx)                          \
+    _lock_profile_register_struct(type, &((ptr)->profile_head), idx)
 #define lock_profile_deregister_struct(type, ptr)                             \
     _lock_profile_deregister_struct(type, &((ptr)->profile_head))
 
@@ -138,7 +138,7 @@ struct lock_profile_qhead { };
 #define DEFINE_SPINLOCK(l) spinlock_t l = SPIN_LOCK_UNLOCKED
 
 #define spin_lock_init_prof(s, l) spin_lock_init(&((s)->l))
-#define lock_profile_register_struct(type, ptr, idx, print)
+#define lock_profile_register_struct(type, ptr, idx)
 #define lock_profile_deregister_struct(type, ptr)
 #define spinlock_profile_printall(key)
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jul 24 09:22:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Jul 2020 09:22: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 1jytu2-0007DZ-Bg; Fri, 24 Jul 2020 09:22:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Cf1I=BD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jytu1-0007DU-Lj
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 09:22:05 +0000
X-Inumbo-ID: 23396b30-cd8f-11ea-87e7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 23396b30-cd8f-11ea-87e7-bc764e2007e4;
 Fri, 24 Jul 2020 09:22:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=B6xAaWslofTKXI/4YeOaTpHFbNEbksfmgxQZwy8k2F4=; b=lW1/pX4UafAlflIQlx9RqT3FTE
 19p73QHcL/l2TxSmlDVF4Lav/L0M7wOqIKYD8S0LLwMh8cfdOt0aThG8EbOPdqEh00ZTDNdXxyez+
 BXNFMNiy2kbp80qJJFVH2TuQhPl0/IHsYns8HMEXg69d661kRZApfZ0B0oFob2NJ5wiY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jytu0-0003Ur-75
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 09:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jytu0-0000fM-4y
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 09:22:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/pv: Make the PV default WRMSR path match the HVM
 default
Message-Id: <E1jytu0-0000fM-4y@xenbits.xenproject.org>
Date: Fri, 24 Jul 2020 09:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 0562cbc14cf02b8188b9f1f37f39a4886776ce7c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jul 23 18:33:51 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jul 24 10:15:19 2020 +0100

    x86/pv: Make the PV default WRMSR path match the HVM default
    
    The current HVM default for writes to unknown MSRs is to inject #GP if the MSR
    is unreadable, and discard writes otherwise. While this behaviour isn't great,
    the PV default is even worse, because it swallows writes even to non-readable
    MSRs.  i.e. A PV guest doesn't even get a #GP fault for a write to a totally
    bogus index.
    
    Update PV to make it consistent with HVM, which will simplify the task of
    making other improvements to the default MSR behaviour.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/emul-priv-op.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index f14552cb4b..efeb2a727e 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -1113,7 +1113,10 @@ static int write_msr(unsigned int reg, uint64_t val,
         }
         /* fall through */
     default:
-        if ( (rdmsr_safe(reg, temp) != 0) || (val != temp) )
+        if ( rdmsr_safe(reg, temp) )
+            break;
+
+        if ( val != temp )
     invalid:
             gdprintk(XENLOG_WARNING,
                      "Domain attempted WRMSR %08x from 0x%016"PRIx64" to 0x%016"PRIx64"\n",
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jul 24 09:33:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Jul 2020 09: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 1jyu4e-0008H1-J5; Fri, 24 Jul 2020 09:33:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Cf1I=BD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jyu4d-0008Gt-Cw
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 09:33:03 +0000
X-Inumbo-ID: ab98092c-cd90-11ea-87e7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ab98092c-cd90-11ea-87e7-bc764e2007e4;
 Fri, 24 Jul 2020 09:33:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=J1TJxC18rDB76VR/gGw5gT5OF80egXtx6C0n6uHIJiE=; b=s9Qg9wFTBtShVX+XaE6FAHnjoU
 qBQDyB7Ow8pU5BXgxPN7YsN1ErW5pBeeYNH8u4mKWkNNfESR3XHrjKwRU97WamqHGqIBBkWd3okXb
 dqc9fZn4AsW+BVNij0RM5v1qcVMLGlYBQyQW4hsluF7cNuGW4paUMdHYf2FbrBfBG7ns=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyu4c-0003iH-Ht
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 09:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyu4c-0001Fy-H4
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 09:33:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.14] SUPPORT.md: Set version and release/support dates
Message-Id: <E1jyu4c-0001Fy-H4@xenbits.xenproject.org>
Date: Fri, 24 Jul 2020 09:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit e4670f8b045b11a524171b119d9d4a20bf643367
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Wed Jul 22 17:55:44 2020 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Jul 22 18:00:23 2020 +0100

    SUPPORT.md: Set version and release/support dates
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 SUPPORT.md | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index efbcb26ddf..88a182ac31 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -9,10 +9,10 @@ for the definitions of the support status levels etc.
 
 # Release Support
 
-    Xen-Version: 4.14-rc
-    Initial-Release: n/a
-    Supported-Until: TBD
-    Security-Support-Until: Unreleased - not yet security-supported
+    Xen-Version: 4.14
+    Initial-Release: 2020-07-24
+    Supported-Until: 2022-01-24
+    Security-Support-Until: 2023-07-24
 
 Release Notes
 : <a href="https://wiki.xenproject.org/wiki/Xen_Project_4.14_Release_Notes">RN</a>
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jul 24 09:33:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Jul 2020 09:33:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1jyu4p-0008Hs-Kp; Fri, 24 Jul 2020 09:33:15 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Cf1I=BD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jyu4n-0008Hj-Up
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 09:33:13 +0000
X-Inumbo-ID: b1a61dd6-cd90-11ea-a390-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id b1a61dd6-cd90-11ea-a390-12813bfff9fa;
 Fri, 24 Jul 2020 09:33:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Kmld+lVvLk6+FIieuuyxbendOYxVgCXIYlZ9VMpagzU=; b=pVA1E3GCKfmelgdS60hLilNznf
 ahMrV6c7ehvbnYMTTsmubtE+xUofDqBMx4tYyJVI4RoR9+3Twiu2esWIrLvmR+ti0s31mGQXzzLNI
 hMr/Bd5iOwjfdRc3s2LFsarIC/8lEtE8N44wInqxCxuONBsGJQJA6w5ni3l12BKSeijw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyu4m-0003iP-La
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 09:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyu4m-0001Gq-K1
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 09:33:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.14] Revert "SUPPORT.md: Set version and release/support
 dates"
Message-Id: <E1jyu4m-0001Gq-K1@xenbits.xenproject.org>
Date: Fri, 24 Jul 2020 09:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 26984f2f432bb880f2bb4954e1248c9c2d1bbd54
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed Jul 22 18:47:10 2020 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Jul 22 18:47:10 2020 +0100

    Revert "SUPPORT.md: Set version and release/support dates"
    
    This reverts commit e4670f8b045b11a524171b119d9d4a20bf643367.
---
 SUPPORT.md | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 88a182ac31..efbcb26ddf 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -9,10 +9,10 @@ for the definitions of the support status levels etc.
 
 # Release Support
 
-    Xen-Version: 4.14
-    Initial-Release: 2020-07-24
-    Supported-Until: 2022-01-24
-    Security-Support-Until: 2023-07-24
+    Xen-Version: 4.14-rc
+    Initial-Release: n/a
+    Supported-Until: TBD
+    Security-Support-Until: Unreleased - not yet security-supported
 
 Release Notes
 : <a href="https://wiki.xenproject.org/wiki/Xen_Project_4.14_Release_Notes">RN</a>
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jul 24 09:33:24 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Jul 2020 09: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 1jyu4y-0008Iy-MY; Fri, 24 Jul 2020 09:33:24 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Cf1I=BD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jyu4x-0008Ip-Il
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 09:33:23 +0000
X-Inumbo-ID: b7a92336-cd90-11ea-87e7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b7a92336-cd90-11ea-87e7-bc764e2007e4;
 Fri, 24 Jul 2020 09:33:22 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=4PdLocS/Xxi7IG9wqZq0RusYSqSKPMk04Vc0sV7BeLo=; b=miZckHUVwYmeeHx5cqsYcquIzp
 ujosDEAURUAH/6EFxZPkOwcMLp7m1E1r/ey1dwusfcWC+glTsyl4uHsKFRI24PK9mU+YeOWCBRQ87
 S657KRRLsEsXx7atW9T9uUe3gYmVBpqop677uNHCJvXVRS7dA4LRdja6xgkhhgFN7+Vo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyu4w-0003jD-PR
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 09:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyu4w-0001HZ-NZ
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 09:33:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.14] SUPPORT.md: Set version and release/support dates
Message-Id: <E1jyu4w-0001HZ-NZ@xenbits.xenproject.org>
Date: Fri, 24 Jul 2020 09:33:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 2f0ed84a820e6760e825aace23c622d326a20f2e
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Wed Jul 22 17:55:44 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Thu Jul 23 15:15:56 2020 +0100

    SUPPORT.md: Set version and release/support dates
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 SUPPORT.md | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index efbcb26ddf..88a182ac31 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -9,10 +9,10 @@ for the definitions of the support status levels etc.
 
 # Release Support
 
-    Xen-Version: 4.14-rc
-    Initial-Release: n/a
-    Supported-Until: TBD
-    Security-Support-Until: Unreleased - not yet security-supported
+    Xen-Version: 4.14
+    Initial-Release: 2020-07-24
+    Supported-Until: 2022-01-24
+    Security-Support-Until: 2023-07-24
 
 Release Notes
 : <a href="https://wiki.xenproject.org/wiki/Xen_Project_4.14_Release_Notes">RN</a>
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jul 24 09:33:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Jul 2020 09: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 1jyu58-0008KI-O2; Fri, 24 Jul 2020 09:33:34 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Cf1I=BD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jyu57-0008Ip-K6
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 09:33:33 +0000
X-Inumbo-ID: bdb17260-cd90-11ea-87e7-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id bdb17260-cd90-11ea-87e7-bc764e2007e4;
 Fri, 24 Jul 2020 09:33:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=598fyNvg1REDz1PNlRwB+hB70yvRKqENOGGddmTfmug=; b=zD8mDQzIo37NPdV8z7fPj919nV
 awexi4rzmFgoWbABlKcvMFV2X62fqAtVHMngZ1edLumK87kUK1/oCscVpx1ueMpfD+rDskoa26vPx
 Mc5nBe337XqLvMNApcWL6awNLceysEeHUMlb7bVYUwP16qWwND/SccaJC+izl/uP4a+c=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyu56-0003jO-SH
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 09:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyu56-0001IG-RO
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 09:33:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.14] Config.mk: Nail subtrees to the Xen 4.14.0 release
 tags
Message-Id: <E1jyu56-0001IG-RO@xenbits.xenproject.org>
Date: Fri, 24 Jul 2020 09:33:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 51d3a84728aa82ed7ed7bbd651c0413961a70e5f
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Thu Jul 23 15:23:30 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Thu Jul 23 15:23:30 2020 +0100

    Config.mk: Nail subtrees to the Xen 4.14.0 release tags
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Config.mk | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/Config.mk b/Config.mk
index 478928c178..264dc0d27d 100644
--- a/Config.mk
+++ b/Config.mk
@@ -245,17 +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 ?= ea6d3cd1ed79d824e605a70c3626bc437c386260
-MINIOS_UPSTREAM_REVISION ?= f57858b7e8ef8dd48394dd08cec2bef3c9fb92f5
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.14.0
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.14.0
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.13.0
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
-QEMU_TRADITIONAL_REVISION ?= 3c659044118e34603161457db9934a34f816d78b
-# Fri Mar 13 12:35:26 2020 +0000
-# xen: cleanup IOREQ server on exit
+QEMU_TRADITIONAL_REVISION ?= xen-4.14.0
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Fri Jul 24 09:33:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Jul 2020 09: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 1jyu5L-0008LX-Pg; Fri, 24 Jul 2020 09:33:47 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Cf1I=BD=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1jyu5K-0008LN-AI
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 09:33:46 +0000
X-Inumbo-ID: c3b2a8fa-cd90-11ea-a390-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id c3b2a8fa-cd90-11ea-a390-12813bfff9fa;
 Fri, 24 Jul 2020 09:33:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=D7cfkAJr9h4gcNolV9AF7gkjLtRhEfUrrylf8kNyw8w=; b=z+ZR9K2D/xJmWj906cObHiV66y
 twqPcZlIaONnNMUHTKQt0rfvcVprxku+SJ86+8DDLvRbb0irzI5RIDELg3pWsVyxsJKWhuNDpqzWb
 +NGaMK78nWOqbt+/bg+NhEoN3mFKBjz67B8qK0bPAakDed0V9jXetmYrLCZU8m2wspRY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyu5G-0003jb-Vu
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 09:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1jyu5G-0001Ix-UG
 for xen-changelog@lists.xenproject.org; Fri, 24 Jul 2020 09:33:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen stable-4.14] README, Makefile: Xen 4.14.0 release
Message-Id: <E1jyu5G-0001Ix-UG@xenbits.xenproject.org>
Date: Fri, 24 Jul 2020 09:33:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 456957aaa1391e0dfa969e2dd97b87c51a79444e
Author:     Ian Jackson <ian.jackson@eu.citrix.com>
AuthorDate: Thu Jul 23 16:07:51 2020 +0100
Commit:     Ian Jackson <ian.jackson@eu.citrix.com>
CommitDate: Thu Jul 23 16:07:51 2020 +0100

    README, Makefile: Xen 4.14.0 release
    
    Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 README       | 16 ++++++++--------
 xen/Makefile |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/README b/README
index 46c67d8906..c7da4b06e2 100644
--- a/README
+++ b/README
@@ -1,11 +1,11 @@
-#################################
- _  _    _ _  _
-| || |  / | || |        _ __ ___
-| || |_ | | || |_ _____| '__/ __|
-|__   _|| |__   _|_____| | | (__
-   |_|(_)_|  |_|       |_|  \___|
-
-#################################
+###################################
+__  __            _  _    _ _  _
+\ \/ /___ _ __   | || |  / | || |
+ \  // _ \ '_ \  | || |_ | | || |_
+ /  \  __/ | | | |__   _|| |__   _|
+/_/\_\___|_| |_|    |_|(_)_|  |_|
+
+###################################
 
 https://www.xen.org/
 
diff --git a/xen/Makefile b/xen/Makefile
index 2f3f8b9deb..4a45e716a8 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 ?= .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.14


From xen-changelog-bounces@lists.xenproject.org Mon Jul 27 14:00:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 27 Jul 2020 14:00:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1k03fj-0005Km-Vh; Mon, 27 Jul 2020 14:00:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=qTb/=BG=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k03fi-0005HC-NL
 for xen-changelog@lists.xenproject.org; Mon, 27 Jul 2020 14:00:06 +0000
X-Inumbo-ID: 78e7806a-d011-11ea-a7d2-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 78e7806a-d011-11ea-a7d2-12813bfff9fa;
 Mon, 27 Jul 2020 14:00:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=dRIR7M+twq1s/TfXSxgmriEdOjoiujdKaEulJj71E/U=; b=jZpwme8fJToFoQKINH3v6hQfLv
 bMIvwpZMnO6mv/dU7CJt3QoanbmMfQnCtOdQfiP5/NAIspGXaW1wXk9f85bXAUvT1dQeLz5psthzU
 yrIWXqAAyLDdZPwFeTMB3oqkN85il2CZjtxQvHSPMMSGw6s/d3jQjD4A/fTn92ErzNIo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k03fg-0000to-T7
 for xen-changelog@lists.xenproject.org; Mon, 27 Jul 2020 14:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k03fg-0001bJ-Rk
 for xen-changelog@lists.xenproject.org; Mon, 27 Jul 2020 14:00:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] xen/displif: Protocol version 2
Message-Id: <E1k03fg-0001bJ-Rk@xenbits.xenproject.org>
Date: Mon, 27 Jul 2020 14:00:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit c27a184225eab54d20435c8cab5ad0ef384dc2c0
Author:     Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
AuthorDate: Wed Jul 1 10:19:23 2020 +0300
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Mon Jul 27 14:58:55 2020 +0100

    xen/displif: Protocol version 2
    
    1. Add protocol version as an integer
    
    Version string, which is in fact an integer, is hard to handle in the
    code that supports different protocol versions. To simplify that
    also add the version as an integer.
    
    2. Pass buffer offset with XENDISPL_OP_DBUF_CREATE
    
    There are cases when display data buffer is created with non-zero
    offset to the data start. Handle such cases and provide that offset
    while creating a display buffer.
    
    3. Add XENDISPL_OP_GET_EDID command
    
    Add an optional request for reading Extended Display Identification
    Data (EDID) structure which allows better configuration of the
    display connectors over the configuration set in XenStore.
    With this change connectors may have multiple resolutions defined
    with respect to detailed timing definitions and additional properties
    normally provided by displays.
    
    If this request is not supported by the backend then visible area
    is defined by the relevant XenStore's "resolution" property.
    
    If backend provides extended display identification data (EDID) with
    XENDISPL_OP_GET_EDID request then EDID values must take precedence
    over the resolutions defined in XenStore.
    
    4. Bump protocol version to 2.
    
    Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/include/public/io/displif.h | 91 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 88 insertions(+), 3 deletions(-)

diff --git a/xen/include/public/io/displif.h b/xen/include/public/io/displif.h
index cc5de9cb1f..0055895510 100644
--- a/xen/include/public/io/displif.h
+++ b/xen/include/public/io/displif.h
@@ -38,7 +38,8 @@
  *                           Protocol version
  ******************************************************************************
  */
-#define XENDISPL_PROTOCOL_VERSION     "1"
+#define XENDISPL_PROTOCOL_VERSION     "2"
+#define XENDISPL_PROTOCOL_VERSION_INT  2
 
 /*
  ******************************************************************************
@@ -202,6 +203,9 @@
  *      Width and height of the connector in pixels separated by
  *      XENDISPL_RESOLUTION_SEPARATOR. This defines visible area of the
  *      display.
+ *      If backend provides extended display identification data (EDID) with
+ *      XENDISPL_OP_GET_EDID request then EDID values must take precedence
+ *      over the resolutions defined here.
  *
  *------------------ Connector Request Transport Parameters -------------------
  *
@@ -349,6 +353,8 @@
 #define XENDISPL_OP_FB_DETACH         0x13
 #define XENDISPL_OP_SET_CONFIG        0x14
 #define XENDISPL_OP_PG_FLIP           0x15
+/* The below command is available in protocol version 2 and above. */
+#define XENDISPL_OP_GET_EDID          0x16
 
 /*
  ******************************************************************************
@@ -377,6 +383,10 @@
 #define XENDISPL_FIELD_BE_ALLOC       "be-alloc"
 #define XENDISPL_FIELD_UNIQUE_ID      "unique-id"
 
+#define XENDISPL_EDID_BLOCK_SIZE      128
+#define XENDISPL_EDID_BLOCK_COUNT     256
+#define XENDISPL_EDID_MAX_SIZE        (XENDISPL_EDID_BLOCK_SIZE * XENDISPL_EDID_BLOCK_COUNT)
+
 /*
  ******************************************************************************
  *                          STATUS RETURN CODES
@@ -451,7 +461,9 @@
  * +----------------+----------------+----------------+----------------+
  * |                           gref_directory                          | 40
  * +----------------+----------------+----------------+----------------+
- * |                             reserved                              | 44
+ * |                             data_ofs                              | 44
+ * +----------------+----------------+----------------+----------------+
+ * |                             reserved                              | 48
  * +----------------+----------------+----------------+----------------+
  * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
  * +----------------+----------------+----------------+----------------+
@@ -494,6 +506,7 @@
  *   buffer size (buffer_sz) exceeds what can be addressed by this single page,
  *   then reference to the next page must be supplied (see gref_dir_next_page
  *   below)
+ * data_ofs - uint32_t, offset of the data in the buffer, octets
  */
 
 #define XENDISPL_DBUF_FLG_REQ_ALLOC       (1 << 0)
@@ -506,6 +519,7 @@ struct xendispl_dbuf_create_req {
     uint32_t buffer_sz;
     uint32_t flags;
     grant_ref_t gref_directory;
+    uint32_t data_ofs;
 };
 
 /*
@@ -731,6 +745,44 @@ struct xendispl_page_flip_req {
     uint64_t fb_cookie;
 };
 
+/*
+ * Request EDID - request EDID describing current connector:
+ *         0                1                 2               3        octet
+ * +----------------+----------------+----------------+----------------+
+ * |               id                | _OP_GET_EDID   |   reserved     | 4
+ * +----------------+----------------+----------------+----------------+
+ * |                             buffer_sz                             | 8
+ * +----------------+----------------+----------------+----------------+
+ * |                          gref_directory                           | 12
+ * +----------------+----------------+----------------+----------------+
+ * |                             reserved                              | 16
+ * +----------------+----------------+----------------+----------------+
+ * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
+ * +----------------+----------------+----------------+----------------+
+ * |                             reserved                              | 64
+ * +----------------+----------------+----------------+----------------+
+ *
+ * Notes:
+ *   - This command is not available in protocol version 1 and should be
+ *     ignored.
+ *   - This request is optional and if not supported then visible area
+ *     is defined by the relevant XenStore's "resolution" property.
+ *   - Shared buffer, allocated for EDID storage, must not be less then
+ *     XENDISPL_EDID_MAX_SIZE octets.
+ *
+ * buffer_sz - uint32_t, buffer size to be allocated, octets
+ * gref_directory - grant_ref_t, a reference to the first shared page
+ *   describing EDID buffer references. See XENDISPL_OP_DBUF_CREATE for
+ *   grant page directory structure (struct xendispl_page_directory).
+ *
+ * See response format for this request.
+ */
+
+struct xendispl_get_edid_req {
+    uint32_t buffer_sz;
+    grant_ref_t gref_directory;
+};
+
 /*
  *---------------------------------- Responses --------------------------------
  *
@@ -753,6 +805,35 @@ struct xendispl_page_flip_req {
  * id - uint16_t, private guest value, echoed from request
  * status - int32_t, response status, zero on success and -XEN_EXX on failure
  *
+ *
+ * Get EDID response - response for XENDISPL_OP_GET_EDID:
+ *         0                1                 2               3        octet
+ * +----------------+----------------+----------------+----------------+
+ * |               id                |    operation   |    reserved    | 4
+ * +----------------+----------------+----------------+----------------+
+ * |                              status                               | 8
+ * +----------------+----------------+----------------+----------------+
+ * |                             edid_sz                               | 12
+ * +----------------+----------------+----------------+----------------+
+ * |                             reserved                              | 16
+ * +----------------+----------------+----------------+----------------+
+ * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
+ * +----------------+----------------+----------------+----------------+
+ * |                             reserved                              | 64
+ * +----------------+----------------+----------------+----------------+
+ *
+ * Notes:
+ *   - This response is not available in protocol version 1 and should be
+ *     ignored.
+ *
+ * edid_sz - uint32_t, size of the EDID, octets
+ */
+
+struct xendispl_get_edid_resp {
+    uint32_t edid_sz;
+};
+
+/*
  *----------------------------------- Events ----------------------------------
  *
  * Events are sent via a shared page allocated by the front and propagated by
@@ -804,6 +885,7 @@ struct xendispl_req {
         struct xendispl_fb_detach_req fb_detach;
         struct xendispl_set_config_req set_config;
         struct xendispl_page_flip_req pg_flip;
+        struct xendispl_get_edid_req get_edid;
         uint8_t reserved[56];
     } op;
 };
@@ -813,7 +895,10 @@ struct xendispl_resp {
     uint8_t operation;
     uint8_t reserved;
     int32_t status;
-    uint8_t reserved1[56];
+    union {
+        struct xendispl_get_edid_resp get_edid;
+        uint8_t reserved1[56];
+    } op;
 };
 
 struct xendispl_evt {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:11:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:11: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 1k0KhV-000418-Av; Tue, 28 Jul 2020 08:11:05 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0KhU-00040x-5i
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:11:04 +0000
X-Inumbo-ID: e0f00c34-d0a9-11ea-8b19-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e0f00c34-d0a9-11ea-8b19-bc764e2007e4;
 Tue, 28 Jul 2020 08:11:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=yUp8uxb7dOIafvSDkOmS/ew7BiWIZP90avBSHB+nhME=; b=bgEmJV+r7fp95VU2/1vZNIxLYo
 0B3hkBKL+Sg3QJNkSG9z/Lc7M4IB46Hmz8cUD0WEBbbwtICnG8RNsM6WMegN4KqwoizKUDs9guyU9
 SyxjWiXop1gx6Or3PQejPu3tXoPacOkTftFrwaH5bHZSq0UAd5jCUMLotdAhttD3PuSc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0KhS-0002Fj-UM
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0KhS-0002iO-TJ
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:11:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] docs: specify stability of hypfs path documentation
Message-Id: <E1k0KhS-0002iO-TJ@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 5a4a411bde4f73ff8ce43d6e52b77302973e8f68
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Jul 20 13:38:00 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jul 20 13:38:00 2020 +0200

    docs: specify stability of hypfs path documentation
    
    In docs/misc/hypfs-paths.pandoc the supported paths in the hypervisor
    file system are specified. Make it more clear that path availability
    might change, e.g. due to scope widening or narrowing (e.g. being
    limited to a specific architecture).
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 docs/misc/hypfs-paths.pandoc | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc
index a111c6f25c..81d70bb80c 100644
--- a/docs/misc/hypfs-paths.pandoc
+++ b/docs/misc/hypfs-paths.pandoc
@@ -5,6 +5,9 @@ in the Xen hypervisor file system (hypfs).
 
 The hypervisor file system can be accessed via the xenhypfs tool.
 
+The availability of the hypervisor file system depends on the hypervisor
+config option CONFIG_HYPFS, which is on per default.
+
 ## Notation
 
 The hypervisor file system is similar to the Linux kernel's sysfs.
@@ -64,6 +67,23 @@ the list elements separated by spaces, e.g. "dom0 PCID-on".
 The entry would be writable and it would exist on X86 only and only if the
 hypervisor is configured to support PV guests.
 
+# Stability
+
+Path *presence* is not stable, but path *meaning* is always stable: if a tool
+you write finds a path present, it can rely on behavior in future versions of
+the hypervisors, and in different configurations.  Specifically:
+
+1. Conditions under which paths are used may be extended, restricted, or
+   removed.  For example, a path that’s always available only on ARM systems
+   may become available on x86; or a path available on both systems may be
+   restricted to only appearing on ARM systems.  Paths may also disappear
+   entirely.
+2. However, the meaning of a path will never change.  If a path is present,
+   it will always have exactly the meaning that it always had.  In order to
+   maintain this, removed paths should be retained with the tag [REMOVED].
+   The path may be restored *only* if the restored version of the path is
+   compatible with the previous functionality.
+
 ## Example
 
 A populated Xen hypervisor file system might look like the following example:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:11:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:11:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1k0Khf-00042F-CW; Tue, 28 Jul 2020 08:11:15 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0Khe-000424-2y
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:11:14 +0000
X-Inumbo-ID: e6f436e6-d0a9-11ea-8b19-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e6f436e6-d0a9-11ea-8b19-bc764e2007e4;
 Tue, 28 Jul 2020 08:11:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=fFSOPeVwXdPDJuyLEtmnvmE6Y9xVLZ/TGGkNdc35NPA=; b=icYw608attfGvH1gvEycpREMW1
 gBw92XxzbX+L+7tzewmfEM+1DuYxJwUBATI0WSicMbb9r8r8nJrbL3S+dJ9HStASdvTkyGrMpS8FG
 7YAY5qgKQAWm99XQCaLZgH5BpSmkTMusP08e6VJ8I8QUyE6UOJnJksRPQlcuIcZH9tKw=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Khd-0002G1-12
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:11:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Khd-0002jc-0I
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:11:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] Arm: prune #include-s needed by domain.h
Message-Id: <E1k0Khd-0002jc-0I@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:11:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 6720345aaf82fc76dca084f3f7a577062f5ff0f3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jul 15 12:39:06 2020 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon Jul 20 17:16:27 2020 +0100

    Arm: prune #include-s needed by domain.h
    
    asm/domain.h is a dependency of xen/sched.h, and hence should not itself
    include xen/sched.h. Nor should any of the other #include-s used by it.
    While at it, also drop two other #include-s that aren't needed by this
    particular header.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/include/asm-arm/domain.h | 4 +---
 xen/include/asm-arm/vfp.h    | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index 4e2f582006..6819a3bf38 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -2,7 +2,7 @@
 #define __ASM_DOMAIN_H__
 
 #include <xen/cache.h>
-#include <xen/sched.h>
+#include <xen/timer.h>
 #include <asm/page.h>
 #include <asm/p2m.h>
 #include <asm/vfp.h>
@@ -11,8 +11,6 @@
 #include <asm/vgic.h>
 #include <asm/vpl011.h>
 #include <public/hvm/params.h>
-#include <xen/serial.h>
-#include <xen/rbtree.h>
 
 struct hvm_domain
 {
diff --git a/xen/include/asm-arm/vfp.h b/xen/include/asm-arm/vfp.h
index 5f10fe5962..142a91ef8b 100644
--- a/xen/include/asm-arm/vfp.h
+++ b/xen/include/asm-arm/vfp.h
@@ -1,7 +1,7 @@
 #ifndef _ASM_VFP_H
 #define _ASM_VFP_H
 
-#include <xen/sched.h>
+struct vcpu;
 
 #if defined(CONFIG_ARM_32)
 # include <asm/arm32/vfp.h>
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:11:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:11:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1k0Khp-00043k-E6; Tue, 28 Jul 2020 08:11:25 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0Khn-00043S-Vu
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:11:24 +0000
X-Inumbo-ID: ecfc7d32-d0a9-11ea-8b19-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ecfc7d32-d0a9-11ea-8b19-bc764e2007e4;
 Tue, 28 Jul 2020 08:11:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=NdeIdiC1RrcJxqaplgq6VIcuztYOjtO4QCdcXb2KwXQ=; b=Vx26k89MCQZyDDjvO1DFCLGXDr
 Xs/tOZsRsyryIb+1hNPo7vv8AbonVEEOwPzzP20f27wj8Bt51BP/Vue/QEiv1uhkFViWlRVQ8xtr8
 nx99TvUQOY51G4rzs0x8DkMhISCDbGTMHiuJPuaspBl2ncYG7XawtWIMmX0CTyAnxUkI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Khn-0002Gv-43
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:11:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Khn-0002lK-38
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:11:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] docs: Replace non-UTF-8 character in hypfs-paths.pandoc
Message-Id: <E1k0Khn-0002lK-38@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:11:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 9ffdda96d9e7c3d9c7a5bbe2df6ab30f63927542
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jul 20 17:54:52 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Jul 20 18:08:00 2020 +0100

    docs: Replace non-UTF-8 character in hypfs-paths.pandoc
    
    From the docs cronjob on xenbits:
    
      /usr/bin/pandoc --number-sections --toc --standalone misc/hypfs-paths.pandoc --output html/misc/hypfs-paths.html
      pandoc: Cannot decode byte '\x92': Data.Text.Internal.Encoding.decodeUtf8: Invalid UTF-8 stream
      make: *** [Makefile:236: html/misc/hypfs-paths.html] Error 1
    
    Fixes: 5a4a411bde4 ("docs: specify stability of hypfs path documentation")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Release-acked-by: Paul Durrant <paul@xen.org>
---
 docs/misc/hypfs-paths.pandoc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc
index 81d70bb80c..dddb592bc5 100644
--- a/docs/misc/hypfs-paths.pandoc
+++ b/docs/misc/hypfs-paths.pandoc
@@ -74,7 +74,7 @@ you write finds a path present, it can rely on behavior in future versions of
 the hypervisors, and in different configurations.  Specifically:
 
 1. Conditions under which paths are used may be extended, restricted, or
-   removed.  For example, a path that’s always available only on ARM systems
+   removed.  For example, a path that's always available only on ARM systems
    may become available on x86; or a path available on both systems may be
    restricted to only appearing on ARM systems.  Paths may also disappear
    entirely.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:11:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:11:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1k0Ki0-00045m-Ft; Tue, 28 Jul 2020 08:11:36 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0Khz-00045S-1S
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:11:35 +0000
X-Inumbo-ID: f302f1fc-d0a9-11ea-8b19-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f302f1fc-d0a9-11ea-8b19-bc764e2007e4;
 Tue, 28 Jul 2020 08:11:33 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=KPwdumWxicJ0U5Grh9qfcxSumJ2Y9WfzEApiq+0VRms=; b=PR56+F8PClZnCc+yOGJPLBQRpQ
 unx0AbCBuIsOiKuOX5zL1DzOk9RTUMngi/f2p/LpI8Er5wUdeuRqoDziVfiAFjRj6MU3GdpJ1oKId
 y2v8l1gdaoOVhu6IIaU+ivyrKrTPH1/mLA4d6FvBYLS0rOmumh5PjAzxfdS9UsMTw+8Q=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Khx-0002Hq-8y
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:11:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Khx-0002ml-6d
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:11:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/shadow: dirty VRAM tracking is needed for HVM only
Message-Id: <E1k0Khx-0002ml-6d@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:11:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ded576ce07e9328f66842bef67d8cfc14c3088b7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 21 13:57:06 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 21 13:57:06 2020 +0200

    x86/shadow: dirty VRAM tracking is needed for HVM only
    
    Move shadow_track_dirty_vram() into hvm.c (requiring two static
    functions to become non-static). More importantly though make sure we
    don't de-reference d->arch.hvm.dirty_vram for a non-HVM guest. This was
    a latent issue only just because the field lives far enough into struct
    hvm_domain to be outside the part overlapping with struct pv_domain.
    
    While moving shadow_track_dirty_vram() some purely typographic
    adjustments are being made, like inserting missing blanks or putting
    breaces on their own lines.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c  | 201 +------------------------------------
 xen/arch/x86/mm/shadow/hvm.c     | 212 +++++++++++++++++++++++++++++++++++++++
 xen/arch/x86/mm/shadow/multi.c   |  25 +++--
 xen/arch/x86/mm/shadow/private.h |   8 ++
 4 files changed, 236 insertions(+), 210 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 773777321f..05a155d1bc 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -999,7 +999,7 @@ void shadow_prealloc(struct domain *d, u32 type, unsigned int count)
 
 /* Deliberately free all the memory we can: this will tear down all of
  * this domain's shadows */
-static void shadow_blow_tables(struct domain *d)
+void shadow_blow_tables(struct domain *d)
 {
     struct page_info *sp, *t;
     struct vcpu *v;
@@ -2029,7 +2029,7 @@ int sh_remove_write_access(struct domain *d, mfn_t gmfn,
 /* Remove all mappings of a guest frame from the shadow tables.
  * Returns non-zero if we need to flush TLBs. */
 
-static int sh_remove_all_mappings(struct domain *d, mfn_t gmfn, gfn_t gfn)
+int sh_remove_all_mappings(struct domain *d, mfn_t gmfn, gfn_t gfn)
 {
     struct page_info *page = mfn_to_page(gmfn);
 
@@ -3162,203 +3162,6 @@ static void sh_clean_dirty_bitmap(struct domain *d)
 }
 
 
-/**************************************************************************/
-/* VRAM dirty tracking support */
-int shadow_track_dirty_vram(struct domain *d,
-                            unsigned long begin_pfn,
-                            unsigned long nr,
-                            XEN_GUEST_HANDLE(void) guest_dirty_bitmap)
-{
-    int rc = 0;
-    unsigned long end_pfn = begin_pfn + nr;
-    unsigned long dirty_size = (nr + 7) / 8;
-    int flush_tlb = 0;
-    unsigned long i;
-    p2m_type_t t;
-    struct sh_dirty_vram *dirty_vram;
-    struct p2m_domain *p2m = p2m_get_hostp2m(d);
-    uint8_t *dirty_bitmap = NULL;
-
-    if ( end_pfn < begin_pfn || end_pfn > p2m->max_mapped_pfn + 1 )
-        return -EINVAL;
-
-    /* We perform p2m lookups, so lock the p2m upfront to avoid deadlock */
-    p2m_lock(p2m_get_hostp2m(d));
-    paging_lock(d);
-
-    dirty_vram = d->arch.hvm.dirty_vram;
-
-    if ( dirty_vram && (!nr ||
-             ( begin_pfn != dirty_vram->begin_pfn
-            || end_pfn   != dirty_vram->end_pfn )) )
-    {
-        /* Different tracking, tear the previous down. */
-        gdprintk(XENLOG_INFO, "stopping tracking VRAM %lx - %lx\n", dirty_vram->begin_pfn, dirty_vram->end_pfn);
-        xfree(dirty_vram->sl1ma);
-        xfree(dirty_vram->dirty_bitmap);
-        xfree(dirty_vram);
-        dirty_vram = d->arch.hvm.dirty_vram = NULL;
-    }
-
-    if ( !nr )
-        goto out;
-
-    dirty_bitmap = vzalloc(dirty_size);
-    if ( dirty_bitmap == NULL )
-    {
-        rc = -ENOMEM;
-        goto out;
-    }
-    /* This should happen seldomly (Video mode change),
-     * no need to be careful. */
-    if ( !dirty_vram )
-    {
-        /* Throw away all the shadows rather than walking through them
-         * up to nr times getting rid of mappings of each pfn */
-        shadow_blow_tables(d);
-
-        gdprintk(XENLOG_INFO, "tracking VRAM %lx - %lx\n", begin_pfn, end_pfn);
-
-        rc = -ENOMEM;
-        if ( (dirty_vram = xmalloc(struct sh_dirty_vram)) == NULL )
-            goto out;
-        dirty_vram->begin_pfn = begin_pfn;
-        dirty_vram->end_pfn = end_pfn;
-        d->arch.hvm.dirty_vram = dirty_vram;
-
-        if ( (dirty_vram->sl1ma = xmalloc_array(paddr_t, nr)) == NULL )
-            goto out_dirty_vram;
-        memset(dirty_vram->sl1ma, ~0, sizeof(paddr_t) * nr);
-
-        if ( (dirty_vram->dirty_bitmap = xzalloc_array(uint8_t, dirty_size)) == NULL )
-            goto out_sl1ma;
-
-        dirty_vram->last_dirty = NOW();
-
-        /* Tell the caller that this time we could not track dirty bits. */
-        rc = -ENODATA;
-    }
-    else if (dirty_vram->last_dirty == -1)
-        /* still completely clean, just copy our empty bitmap */
-        memcpy(dirty_bitmap, dirty_vram->dirty_bitmap, dirty_size);
-    else
-    {
-        mfn_t map_mfn = INVALID_MFN;
-        void *map_sl1p = NULL;
-
-        /* Iterate over VRAM to track dirty bits. */
-        for ( i = 0; i < nr; i++ ) {
-            mfn_t mfn = get_gfn_query_unlocked(d, begin_pfn + i, &t);
-            struct page_info *page;
-            int dirty = 0;
-            paddr_t sl1ma = dirty_vram->sl1ma[i];
-
-            if ( mfn_eq(mfn, INVALID_MFN) )
-                dirty = 1;
-            else
-            {
-                page = mfn_to_page(mfn);
-                switch (page->u.inuse.type_info & PGT_count_mask)
-                {
-                case 0:
-                    /* No guest reference, nothing to track. */
-                    break;
-                case 1:
-                    /* One guest reference. */
-                    if ( sl1ma == INVALID_PADDR )
-                    {
-                        /* We don't know which sl1e points to this, too bad. */
-                        dirty = 1;
-                        /* TODO: Heuristics for finding the single mapping of
-                         * this gmfn */
-                        flush_tlb |= sh_remove_all_mappings(d, mfn,
-                                                            _gfn(begin_pfn + i));
-                    }
-                    else
-                    {
-                        /* Hopefully the most common case: only one mapping,
-                         * whose dirty bit we can use. */
-                        l1_pgentry_t *sl1e;
-                        mfn_t sl1mfn = maddr_to_mfn(sl1ma);
-
-                        if ( !mfn_eq(sl1mfn, map_mfn) )
-                        {
-                            if ( map_sl1p )
-                                unmap_domain_page(map_sl1p);
-                            map_sl1p = map_domain_page(sl1mfn);
-                            map_mfn = sl1mfn;
-                        }
-                        sl1e = map_sl1p + (sl1ma & ~PAGE_MASK);
-
-                        if ( l1e_get_flags(*sl1e) & _PAGE_DIRTY )
-                        {
-                            dirty = 1;
-                            /* Note: this is atomic, so we may clear a
-                             * _PAGE_ACCESSED set by another processor. */
-                            l1e_remove_flags(*sl1e, _PAGE_DIRTY);
-                            flush_tlb = 1;
-                        }
-                    }
-                    break;
-                default:
-                    /* More than one guest reference,
-                     * we don't afford tracking that. */
-                    dirty = 1;
-                    break;
-                }
-            }
-
-            if ( dirty )
-            {
-                dirty_vram->dirty_bitmap[i / 8] |= 1 << (i % 8);
-                dirty_vram->last_dirty = NOW();
-            }
-        }
-
-        if ( map_sl1p )
-            unmap_domain_page(map_sl1p);
-
-        memcpy(dirty_bitmap, dirty_vram->dirty_bitmap, dirty_size);
-        memset(dirty_vram->dirty_bitmap, 0, dirty_size);
-        if ( dirty_vram->last_dirty + SECONDS(2) < NOW() )
-        {
-            /* was clean for more than two seconds, try to disable guest
-             * write access */
-            for ( i = begin_pfn; i < end_pfn; i++ )
-            {
-                mfn_t mfn = get_gfn_query_unlocked(d, i, &t);
-                if ( !mfn_eq(mfn, INVALID_MFN) )
-                    flush_tlb |= sh_remove_write_access(d, mfn, 1, 0);
-            }
-            dirty_vram->last_dirty = -1;
-        }
-    }
-    if ( flush_tlb )
-        guest_flush_tlb_mask(d, d->dirty_cpumask);
-    goto out;
-
-out_sl1ma:
-    xfree(dirty_vram->sl1ma);
-out_dirty_vram:
-    xfree(dirty_vram);
-    dirty_vram = d->arch.hvm.dirty_vram = NULL;
-
-out:
-    paging_unlock(d);
-    if ( rc == 0 && dirty_bitmap != NULL &&
-         copy_to_guest(guest_dirty_bitmap, dirty_bitmap, dirty_size) )
-    {
-        paging_lock(d);
-        for ( i = 0; i < dirty_size; i++ )
-            dirty_vram->dirty_bitmap[i] |= dirty_bitmap[i];
-        paging_unlock(d);
-        rc = -EFAULT;
-    }
-    vfree(dirty_bitmap);
-    p2m_unlock(p2m_get_hostp2m(d));
-    return rc;
-}
-
 /* Fluhs TLB of selected vCPUs. */
 bool shadow_flush_tlb(bool (*flush_vcpu)(void *ctxt, struct vcpu *v),
                       void *ctxt)
diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index 608360daec..c5da7a071c 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -691,6 +691,218 @@ static void sh_emulate_unmap_dest(struct vcpu *v, void *addr,
     atomic_inc(&v->domain->arch.paging.shadow.gtable_dirty_version);
 }
 
+/**************************************************************************/
+/* VRAM dirty tracking support */
+int shadow_track_dirty_vram(struct domain *d,
+                            unsigned long begin_pfn,
+                            unsigned long nr,
+                            XEN_GUEST_HANDLE(void) guest_dirty_bitmap)
+{
+    int rc = 0;
+    unsigned long end_pfn = begin_pfn + nr;
+    unsigned long dirty_size = (nr + 7) / 8;
+    int flush_tlb = 0;
+    unsigned long i;
+    p2m_type_t t;
+    struct sh_dirty_vram *dirty_vram;
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
+    uint8_t *dirty_bitmap = NULL;
+
+    if ( end_pfn < begin_pfn || end_pfn > p2m->max_mapped_pfn + 1 )
+        return -EINVAL;
+
+    /* We perform p2m lookups, so lock the p2m upfront to avoid deadlock */
+    p2m_lock(p2m_get_hostp2m(d));
+    paging_lock(d);
+
+    dirty_vram = d->arch.hvm.dirty_vram;
+
+    if ( dirty_vram && (!nr ||
+             ( begin_pfn != dirty_vram->begin_pfn
+            || end_pfn   != dirty_vram->end_pfn )) )
+    {
+        /* Different tracking, tear the previous down. */
+        gdprintk(XENLOG_INFO, "stopping tracking VRAM %lx - %lx\n", dirty_vram->begin_pfn, dirty_vram->end_pfn);
+        xfree(dirty_vram->sl1ma);
+        xfree(dirty_vram->dirty_bitmap);
+        xfree(dirty_vram);
+        dirty_vram = d->arch.hvm.dirty_vram = NULL;
+    }
+
+    if ( !nr )
+        goto out;
+
+    dirty_bitmap = vzalloc(dirty_size);
+    if ( dirty_bitmap == NULL )
+    {
+        rc = -ENOMEM;
+        goto out;
+    }
+    /*
+     * This should happen seldomly (Video mode change),
+     * no need to be careful.
+     */
+    if ( !dirty_vram )
+    {
+        /*
+         * Throw away all the shadows rather than walking through them
+         * up to nr times getting rid of mappings of each pfn.
+         */
+        shadow_blow_tables(d);
+
+        gdprintk(XENLOG_INFO, "tracking VRAM %lx - %lx\n", begin_pfn, end_pfn);
+
+        rc = -ENOMEM;
+        if ( (dirty_vram = xmalloc(struct sh_dirty_vram)) == NULL )
+            goto out;
+        dirty_vram->begin_pfn = begin_pfn;
+        dirty_vram->end_pfn = end_pfn;
+        d->arch.hvm.dirty_vram = dirty_vram;
+
+        if ( (dirty_vram->sl1ma = xmalloc_array(paddr_t, nr)) == NULL )
+            goto out_dirty_vram;
+        memset(dirty_vram->sl1ma, ~0, sizeof(paddr_t) * nr);
+
+        if ( (dirty_vram->dirty_bitmap = xzalloc_array(uint8_t, dirty_size)) == NULL )
+            goto out_sl1ma;
+
+        dirty_vram->last_dirty = NOW();
+
+        /* Tell the caller that this time we could not track dirty bits. */
+        rc = -ENODATA;
+    }
+    else if ( dirty_vram->last_dirty == -1 )
+        /* still completely clean, just copy our empty bitmap */
+        memcpy(dirty_bitmap, dirty_vram->dirty_bitmap, dirty_size);
+    else
+    {
+        mfn_t map_mfn = INVALID_MFN;
+        void *map_sl1p = NULL;
+
+        /* Iterate over VRAM to track dirty bits. */
+        for ( i = 0; i < nr; i++ )
+        {
+            mfn_t mfn = get_gfn_query_unlocked(d, begin_pfn + i, &t);
+            struct page_info *page;
+            int dirty = 0;
+            paddr_t sl1ma = dirty_vram->sl1ma[i];
+
+            if ( mfn_eq(mfn, INVALID_MFN) )
+                dirty = 1;
+            else
+            {
+                page = mfn_to_page(mfn);
+                switch ( page->u.inuse.type_info & PGT_count_mask )
+                {
+                case 0:
+                    /* No guest reference, nothing to track. */
+                    break;
+
+                case 1:
+                    /* One guest reference. */
+                    if ( sl1ma == INVALID_PADDR )
+                    {
+                        /* We don't know which sl1e points to this, too bad. */
+                        dirty = 1;
+                        /*
+                         * TODO: Heuristics for finding the single mapping of
+                         * this gmfn
+                         */
+                        flush_tlb |= sh_remove_all_mappings(d, mfn,
+                                                            _gfn(begin_pfn + i));
+                    }
+                    else
+                    {
+                        /*
+                         * Hopefully the most common case: only one mapping,
+                         * whose dirty bit we can use.
+                         */
+                        l1_pgentry_t *sl1e;
+                        mfn_t sl1mfn = maddr_to_mfn(sl1ma);
+
+                        if ( !mfn_eq(sl1mfn, map_mfn) )
+                        {
+                            if ( map_sl1p )
+                                unmap_domain_page(map_sl1p);
+                            map_sl1p = map_domain_page(sl1mfn);
+                            map_mfn = sl1mfn;
+                        }
+                        sl1e = map_sl1p + (sl1ma & ~PAGE_MASK);
+
+                        if ( l1e_get_flags(*sl1e) & _PAGE_DIRTY )
+                        {
+                            dirty = 1;
+                            /*
+                             * Note: this is atomic, so we may clear a
+                             * _PAGE_ACCESSED set by another processor.
+                             */
+                            l1e_remove_flags(*sl1e, _PAGE_DIRTY);
+                            flush_tlb = 1;
+                        }
+                    }
+                    break;
+
+                default:
+                    /* More than one guest reference,
+                     * we don't afford tracking that. */
+                    dirty = 1;
+                    break;
+                }
+            }
+
+            if ( dirty )
+            {
+                dirty_vram->dirty_bitmap[i / 8] |= 1 << (i % 8);
+                dirty_vram->last_dirty = NOW();
+            }
+        }
+
+        if ( map_sl1p )
+            unmap_domain_page(map_sl1p);
+
+        memcpy(dirty_bitmap, dirty_vram->dirty_bitmap, dirty_size);
+        memset(dirty_vram->dirty_bitmap, 0, dirty_size);
+        if ( dirty_vram->last_dirty + SECONDS(2) < NOW() )
+        {
+            /*
+             * Was clean for more than two seconds, try to disable guest
+             * write access.
+             */
+            for ( i = begin_pfn; i < end_pfn; i++ )
+            {
+                mfn_t mfn = get_gfn_query_unlocked(d, i, &t);
+                if ( !mfn_eq(mfn, INVALID_MFN) )
+                    flush_tlb |= sh_remove_write_access(d, mfn, 1, 0);
+            }
+            dirty_vram->last_dirty = -1;
+        }
+    }
+    if ( flush_tlb )
+        guest_flush_tlb_mask(d, d->dirty_cpumask);
+    goto out;
+
+ out_sl1ma:
+    xfree(dirty_vram->sl1ma);
+ out_dirty_vram:
+    xfree(dirty_vram);
+    dirty_vram = d->arch.hvm.dirty_vram = NULL;
+
+ out:
+    paging_unlock(d);
+    if ( rc == 0 && dirty_bitmap != NULL &&
+         copy_to_guest(guest_dirty_bitmap, dirty_bitmap, dirty_size) )
+    {
+        paging_lock(d);
+        for ( i = 0; i < dirty_size; i++ )
+            dirty_vram->dirty_bitmap[i] |= dirty_bitmap[i];
+        paging_unlock(d);
+        rc = -EFAULT;
+    }
+    vfree(dirty_bitmap);
+    p2m_unlock(p2m_get_hostp2m(d));
+    return rc;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 7d16d1c1a9..e34937f43b 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -494,7 +494,6 @@ _sh_propagate(struct vcpu *v,
     guest_l1e_t guest_entry = { guest_intpte };
     shadow_l1e_t *sp = shadow_entry_ptr;
     struct domain *d = v->domain;
-    struct sh_dirty_vram *dirty_vram = d->arch.hvm.dirty_vram;
     gfn_t target_gfn = guest_l1e_get_gfn(guest_entry);
     u32 pass_thru_flags;
     u32 gflags, sflags;
@@ -649,15 +648,19 @@ _sh_propagate(struct vcpu *v,
         }
     }
 
-    if ( unlikely((level == 1) && dirty_vram
-            && dirty_vram->last_dirty == -1
-            && gfn_x(target_gfn) >= dirty_vram->begin_pfn
-            && gfn_x(target_gfn) < dirty_vram->end_pfn) )
+    if ( unlikely(level == 1) && is_hvm_domain(d) )
     {
-        if ( ft & FETCH_TYPE_WRITE )
-            dirty_vram->last_dirty = NOW();
-        else
-            sflags &= ~_PAGE_RW;
+        struct sh_dirty_vram *dirty_vram = d->arch.hvm.dirty_vram;
+
+        if ( dirty_vram && dirty_vram->last_dirty == -1 &&
+             gfn_x(target_gfn) >= dirty_vram->begin_pfn &&
+             gfn_x(target_gfn) < dirty_vram->end_pfn )
+        {
+            if ( ft & FETCH_TYPE_WRITE )
+                dirty_vram->last_dirty = NOW();
+            else
+                sflags &= ~_PAGE_RW;
+        }
     }
 
     /* Read-only memory */
@@ -1082,7 +1085,7 @@ static inline void shadow_vram_get_l1e(shadow_l1e_t new_sl1e,
     unsigned long gfn;
     struct sh_dirty_vram *dirty_vram = d->arch.hvm.dirty_vram;
 
-    if ( !dirty_vram         /* tracking disabled? */
+    if ( !is_hvm_domain(d) || !dirty_vram /* tracking disabled? */
          || !(flags & _PAGE_RW) /* read-only mapping? */
          || !mfn_valid(mfn) )   /* mfn can be invalid in mmio_direct */
         return;
@@ -1113,7 +1116,7 @@ static inline void shadow_vram_put_l1e(shadow_l1e_t old_sl1e,
     unsigned long gfn;
     struct sh_dirty_vram *dirty_vram = d->arch.hvm.dirty_vram;
 
-    if ( !dirty_vram         /* tracking disabled? */
+    if ( !is_hvm_domain(d) || !dirty_vram /* tracking disabled? */
          || !(flags & _PAGE_RW) /* read-only mapping? */
          || !mfn_valid(mfn) )   /* mfn can be invalid in mmio_direct */
         return;
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 3fd3f0617a..eb5d1e3fab 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -438,6 +438,14 @@ mfn_t oos_snapshot_lookup(struct domain *d, mfn_t gmfn);
 
 #endif /* (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) */
 
+/* Deliberately free all the memory we can: tear down all of d's shadows. */
+void shadow_blow_tables(struct domain *d);
+
+/*
+ * Remove all mappings of a guest frame from the shadow tables.
+ * Returns non-zero if we need to flush TLBs.
+ */
+int sh_remove_all_mappings(struct domain *d, mfn_t gmfn, gfn_t gfn);
 
 /* Reset the up-pointers of every L3 shadow to 0.
  * This is called when l3 shadows stop being pinnable, to clear out all
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:11:45 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:11: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 1k0Ki9-00047O-Iy; Tue, 28 Jul 2020 08:11:45 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0Ki8-00047H-UA
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:11:44 +0000
X-Inumbo-ID: f8593a1d-d0a9-11ea-8b19-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id f8593a1d-d0a9-11ea-8b19-bc764e2007e4;
 Tue, 28 Jul 2020 08:11:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=6H2jeC8UPI583WDhp3v1MyRepjAsds02J0x3vE4gnf0=; b=Uz4yz2u9YwQmoeWNVYCknn/xjP
 WIMke6rlHP+xCXpSqkZQDciuxIpF66a/8R8eCPOjJ9xskoNMx3KwBkI+d1XSmwC3NM3QFHyLSARJo
 /MqHVTnFJvl5Hz0G5u3zUpXzc7WNKGnLaQf8kgqDF+d0zraVOl1zXpcnyvh5VsldlKns=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Ki7-0002I6-CY
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:11:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Ki7-0002nj-Bd
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:11:43 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/shadow: shadow_table[] needs only one entry for
 PV-only configs
Message-Id: <E1k0Ki7-0002nj-Bd@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:11:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ef3b0d8d2c3975c5cdd6a521896d85e97b74e924
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 21 13:58:15 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 21 13:58:15 2020 +0200

    x86/shadow: shadow_table[] needs only one entry for PV-only configs
    
    Furthermore the field isn't needed at all with shadow support disabled -
    move it into struct shadow_vcpu.
    
    Introduce for_each_shadow_table(), shortening loops for the 4-level case
    at the same time.
    
    Adjust loop variables and a function parameter to be "unsigned int"
    where applicable at the same time. Also move a comment that ended up
    misplaced due to incremental additions.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c | 20 +++++----
 xen/arch/x86/mm/shadow/multi.c  | 97 ++++++++++++++++++++++-------------------
 xen/include/asm-x86/domain.h    | 16 +++++--
 3 files changed, 78 insertions(+), 55 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 05a155d1bc..a2554d9351 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -959,13 +959,15 @@ static void _shadow_prealloc(struct domain *d, unsigned int pages)
     perfc_incr(shadow_prealloc_2);
 
     for_each_vcpu(d, v)
-        for ( i = 0 ; i < 4 ; i++ )
+        for ( i = 0; i < ARRAY_SIZE(v->arch.paging.shadow.shadow_table); i++ )
         {
-            if ( !pagetable_is_null(v->arch.shadow_table[i]) )
+            if ( !pagetable_is_null(v->arch.paging.shadow.shadow_table[i]) )
             {
                 TRACE_SHADOW_PATH_FLAG(TRCE_SFLAG_PREALLOC_UNHOOK);
-                shadow_unhook_mappings(d,
-                               pagetable_get_mfn(v->arch.shadow_table[i]), 0);
+                shadow_unhook_mappings(
+                    d,
+                    pagetable_get_mfn(v->arch.paging.shadow.shadow_table[i]),
+                    0);
 
                 /* See if that freed up enough space */
                 if ( d->arch.paging.shadow.free_pages >= pages )
@@ -1018,10 +1020,12 @@ void shadow_blow_tables(struct domain *d)
 
     /* Second pass: unhook entries of in-use shadows */
     for_each_vcpu(d, v)
-        for ( i = 0 ; i < 4 ; i++ )
-            if ( !pagetable_is_null(v->arch.shadow_table[i]) )
-                shadow_unhook_mappings(d,
-                               pagetable_get_mfn(v->arch.shadow_table[i]), 0);
+        for ( i = 0; i < ARRAY_SIZE(v->arch.paging.shadow.shadow_table); i++ )
+            if ( !pagetable_is_null(v->arch.paging.shadow.shadow_table[i]) )
+                shadow_unhook_mappings(
+                    d,
+                    pagetable_get_mfn(v->arch.paging.shadow.shadow_table[i]),
+                    0);
 
     /* Make sure everyone sees the unshadowings */
     guest_flush_tlb_mask(d, d->dirty_cpumask);
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index e34937f43b..9c8cb21349 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -85,6 +85,15 @@ const char *const fetch_type_names[] = {
 };
 #endif
 
+#if SHADOW_PAGING_LEVELS == 3
+# define for_each_shadow_table(v, i) \
+    for ( (i) = 0; \
+          (i) < ARRAY_SIZE((v)->arch.paging.shadow.shadow_table); \
+          ++(i) )
+#else
+# define for_each_shadow_table(v, i) for ( (i) = 0; (i) < 1; ++(i) )
+#endif
+
 /* Helper to perform a local TLB flush. */
 static void sh_flush_local(const struct domain *d)
 {
@@ -1624,7 +1633,7 @@ static shadow_l4e_t * shadow_get_and_create_l4e(struct vcpu *v,
                                                 mfn_t *sl4mfn)
 {
     /* There is always a shadow of the top level table.  Get it. */
-    *sl4mfn = pagetable_get_mfn(v->arch.shadow_table[0]);
+    *sl4mfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[0]);
     /* Reading the top level table is always valid. */
     return sh_linear_l4_table(v) + shadow_l4_linear_offset(gw->va);
 }
@@ -1740,7 +1749,7 @@ static shadow_l2e_t * shadow_get_and_create_l2e(struct vcpu *v,
     return sh_linear_l2_table(v) + shadow_l2_linear_offset(gw->va);
 #else /* 32bit... */
     /* There is always a shadow of the top level table.  Get it. */
-    *sl2mfn = pagetable_get_mfn(v->arch.shadow_table[0]);
+    *sl2mfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[0]);
     /* This next line is important: the guest l2 has a 16k
      * shadow, we need to return the right mfn of the four. This
      * call will set it for us as a side-effect. */
@@ -2333,6 +2342,7 @@ int sh_safe_not_to_sync(struct vcpu *v, mfn_t gl1mfn)
     struct domain *d = v->domain;
     struct page_info *sp;
     mfn_t smfn;
+    unsigned int i;
 
     if ( !sh_type_has_up_pointer(d, SH_type_l1_shadow) )
         return 0;
@@ -2365,14 +2375,10 @@ int sh_safe_not_to_sync(struct vcpu *v, mfn_t gl1mfn)
     ASSERT(mfn_valid(smfn));
 #endif
 
-    if ( pagetable_get_pfn(v->arch.shadow_table[0]) == mfn_x(smfn)
-#if (SHADOW_PAGING_LEVELS == 3)
-         || pagetable_get_pfn(v->arch.shadow_table[1]) == mfn_x(smfn)
-         || pagetable_get_pfn(v->arch.shadow_table[2]) == mfn_x(smfn)
-         || pagetable_get_pfn(v->arch.shadow_table[3]) == mfn_x(smfn)
-#endif
-        )
-        return 0;
+    for_each_shadow_table(v, i)
+        if ( pagetable_get_pfn(v->arch.paging.shadow.shadow_table[i]) ==
+             mfn_x(smfn) )
+            return 0;
 
     /* Only in use in one toplevel shadow, and it's not the one we're
      * running on */
@@ -3287,10 +3293,12 @@ static int sh_page_fault(struct vcpu *v,
         for_each_vcpu(d, tmp)
         {
 #if GUEST_PAGING_LEVELS == 3
-            int i;
-            for ( i = 0; i < 4; i++ )
+            unsigned int i;
+
+            for_each_shadow_table(v, i)
             {
-                mfn_t smfn = pagetable_get_mfn(v->arch.shadow_table[i]);
+                mfn_t smfn = pagetable_get_mfn(
+                                 v->arch.paging.shadow.shadow_table[i]);
 
                 if ( mfn_valid(smfn) && (mfn_x(smfn) != 0) )
                 {
@@ -3707,7 +3715,7 @@ sh_update_linear_entries(struct vcpu *v)
      *
      * Because HVM guests run on the same monitor tables regardless of the
      * shadow tables in use, the linear mapping of the shadow tables has to
-     * be updated every time v->arch.shadow_table changes.
+     * be updated every time v->arch.paging.shadow.shadow_table changes.
      */
 
     /* Don't try to update the monitor table if it doesn't exist */
@@ -3723,8 +3731,9 @@ sh_update_linear_entries(struct vcpu *v)
     if ( v == current )
     {
         __linear_l4_table[l4_linear_offset(SH_LINEAR_PT_VIRT_START)] =
-            l4e_from_pfn(pagetable_get_pfn(v->arch.shadow_table[0]),
-                         __PAGE_HYPERVISOR_RW);
+            l4e_from_pfn(
+                pagetable_get_pfn(v->arch.paging.shadow.shadow_table[0]),
+                __PAGE_HYPERVISOR_RW);
     }
     else
     {
@@ -3732,8 +3741,9 @@ sh_update_linear_entries(struct vcpu *v)
 
         ml4e = map_domain_page(pagetable_get_mfn(v->arch.hvm.monitor_table));
         ml4e[l4_table_offset(SH_LINEAR_PT_VIRT_START)] =
-            l4e_from_pfn(pagetable_get_pfn(v->arch.shadow_table[0]),
-                         __PAGE_HYPERVISOR_RW);
+            l4e_from_pfn(
+                pagetable_get_pfn(v->arch.paging.shadow.shadow_table[0]),
+                __PAGE_HYPERVISOR_RW);
         unmap_domain_page(ml4e);
     }
 
@@ -3812,7 +3822,7 @@ sh_update_linear_entries(struct vcpu *v)
 
 
 /*
- * Removes vcpu->arch.shadow_table[].
+ * Removes v->arch.paging.shadow.shadow_table[].
  * Does all appropriate management/bookkeeping/refcounting/etc...
  */
 static void
@@ -3820,38 +3830,34 @@ sh_detach_old_tables(struct vcpu *v)
 {
     struct domain *d = v->domain;
     mfn_t smfn;
-    int i = 0;
+    unsigned int i;
 
     ////
-    //// vcpu->arch.shadow_table[]
+    //// vcpu->arch.paging.shadow.shadow_table[]
     ////
 
-#if GUEST_PAGING_LEVELS == 3
-    /* PAE guests have four shadow_table entries */
-    for ( i = 0 ; i < 4 ; i++ )
-#endif
+    for_each_shadow_table(v, i)
     {
-        smfn = pagetable_get_mfn(v->arch.shadow_table[i]);
+        smfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[i]);
         if ( mfn_x(smfn) )
             sh_put_ref(d, smfn, 0);
-        v->arch.shadow_table[i] = pagetable_null();
+        v->arch.paging.shadow.shadow_table[i] = pagetable_null();
     }
 }
 
 /* Set up the top-level shadow and install it in slot 'slot' of shadow_table */
 static void
 sh_set_toplevel_shadow(struct vcpu *v,
-                       int slot,
+                       unsigned int slot,
                        mfn_t gmfn,
                        unsigned int root_type)
 {
     mfn_t smfn;
     pagetable_t old_entry, new_entry;
-
     struct domain *d = v->domain;
 
     /* Remember the old contents of this slot */
-    old_entry = v->arch.shadow_table[slot];
+    old_entry = v->arch.paging.shadow.shadow_table[slot];
 
     /* Now figure out the new contents: is this a valid guest MFN? */
     if ( !mfn_valid(gmfn) )
@@ -3893,7 +3899,7 @@ sh_set_toplevel_shadow(struct vcpu *v,
     SHADOW_PRINTK("%u/%u [%u] gmfn %#"PRI_mfn" smfn %#"PRI_mfn"\n",
                   GUEST_PAGING_LEVELS, SHADOW_PAGING_LEVELS, slot,
                   mfn_x(gmfn), mfn_x(pagetable_get_mfn(new_entry)));
-    v->arch.shadow_table[slot] = new_entry;
+    v->arch.paging.shadow.shadow_table[slot] = new_entry;
 
     /* Decrement the refcount of the old contents of this slot */
     if ( !pagetable_is_null(old_entry) ) {
@@ -3999,7 +4005,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 
 
     ////
-    //// vcpu->arch.shadow_table[]
+    //// vcpu->arch.paging.shadow.shadow_table[]
     ////
 
     /* We revoke write access to the new guest toplevel page(s) before we
@@ -4056,7 +4062,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
     sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l4_shadow);
     if ( !shadow_mode_external(d) && !is_pv_32bit_domain(d) )
     {
-        mfn_t smfn = pagetable_get_mfn(v->arch.shadow_table[0]);
+        mfn_t smfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[0]);
 
         if ( !(v->arch.flags & TF_kernel_mode) && VM_ASSIST(d, m2p_strict) )
             zap_ro_mpt(smfn);
@@ -4074,9 +4080,10 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
     ///
 #if SHADOW_PAGING_LEVELS == 3
         {
-            mfn_t smfn = pagetable_get_mfn(v->arch.shadow_table[0]);
-            int i;
-            for ( i = 0; i < 4; i++ )
+            mfn_t smfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[0]);
+            unsigned int i;
+
+            for_each_shadow_table(v, i)
             {
 #if GUEST_PAGING_LEVELS == 2
                 /* 2-on-3: make a PAE l3 that points at the four-page l2 */
@@ -4084,7 +4091,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
                     smfn = sh_next_page(smfn);
 #else
                 /* 3-on-3: make a PAE l3 that points at the four l2 pages */
-                smfn = pagetable_get_mfn(v->arch.shadow_table[i]);
+                smfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[i]);
 #endif
                 v->arch.paging.shadow.l3table[i] =
                     (mfn_x(smfn) == 0)
@@ -4108,7 +4115,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
         /* We don't support PV except guest == shadow == config levels */
         BUILD_BUG_ON(GUEST_PAGING_LEVELS != SHADOW_PAGING_LEVELS);
         /* Just use the shadow top-level directly */
-        make_cr3(v, pagetable_get_mfn(v->arch.shadow_table[0]));
+        make_cr3(v, pagetable_get_mfn(v->arch.paging.shadow.shadow_table[0]));
     }
 #endif
 
@@ -4124,7 +4131,8 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
         v->arch.hvm.hw_cr[3] = virt_to_maddr(&v->arch.paging.shadow.l3table);
 #else
         /* 4-on-4: Just use the shadow top-level directly */
-        v->arch.hvm.hw_cr[3] = pagetable_get_paddr(v->arch.shadow_table[0]);
+        v->arch.hvm.hw_cr[3] =
+            pagetable_get_paddr(v->arch.paging.shadow.shadow_table[0]);
 #endif
         hvm_update_guest_cr3(v, noflush);
     }
@@ -4443,7 +4451,7 @@ static void sh_pagetable_dying(paddr_t gpa)
 {
     struct vcpu *v = current;
     struct domain *d = v->domain;
-    int i = 0;
+    unsigned int i;
     int flush = 0;
     int fast_path = 0;
     paddr_t gcr3 = 0;
@@ -4474,15 +4482,16 @@ static void sh_pagetable_dying(paddr_t gpa)
         gl3pa = map_domain_page(l3mfn);
         gl3e = (guest_l3e_t *)(gl3pa + ((unsigned long)gpa & ~PAGE_MASK));
     }
-    for ( i = 0; i < 4; i++ )
+    for_each_shadow_table(v, i)
     {
         mfn_t smfn, gmfn;
 
-        if ( fast_path ) {
-            if ( pagetable_is_null(v->arch.shadow_table[i]) )
+        if ( fast_path )
+        {
+            if ( pagetable_is_null(v->arch.paging.shadow.shadow_table[i]) )
                 smfn = INVALID_MFN;
             else
-                smfn = pagetable_get_mfn(v->arch.shadow_table[i]);
+                smfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[i]);
         }
         else
         {
diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h
index 6fd94c2e14..3f5412d5ab 100644
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
@@ -135,6 +135,14 @@ struct shadow_vcpu {
     l3_pgentry_t l3table[4] __attribute__((__aligned__(32)));
     /* PAE guests: per-vcpu cache of the top-level *guest* entries */
     l3_pgentry_t gl3e[4] __attribute__((__aligned__(32)));
+
+    /* shadow(s) of guest (MFN) */
+#ifdef CONFIG_HVM
+    pagetable_t shadow_table[4];
+#else
+    pagetable_t shadow_table[1];
+#endif
+
     /* Last MFN that we emulated a write to as unshadow heuristics. */
     unsigned long last_emulated_mfn_for_unshadow;
     /* MFN of the last shadow that we shot a writeable mapping in */
@@ -576,6 +584,10 @@ struct arch_vcpu
         struct hvm_vcpu hvm;
     };
 
+    /*
+     * guest_table{,_user} hold a ref to the page, and also a type-count
+     * unless shadow refcounts are in use
+     */
     pagetable_t guest_table_user;       /* (MFN) x86/64 user-space pagetable */
     pagetable_t guest_table;            /* (MFN) guest notion of cr3 */
     struct page_info *old_guest_table;  /* partially destructed pagetable */
@@ -583,9 +595,7 @@ struct arch_vcpu
                                         /* former, if any */
     bool old_guest_table_partial;       /* Are we dropping a type ref, or just
                                          * finishing up a partial de-validation? */
-    /* guest_table holds a ref to the page, and also a type-count unless
-     * shadow refcounts are in use */
-    pagetable_t shadow_table[4];        /* (MFN) shadow(s) of guest */
+
     unsigned long cr3;                  /* (MA) value to install in HW CR3 */
 
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:11:56 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08: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 1k0KiK-00049E-Ks; Tue, 28 Jul 2020 08:11:56 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0KiJ-00048z-1r
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:11:55 +0000
X-Inumbo-ID: ff1a9332-d0a9-11ea-8b19-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ff1a9332-d0a9-11ea-8b19-bc764e2007e4;
 Tue, 28 Jul 2020 08:11:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=PQFNanFowBnItEKJJFYDHzdU5LrzvQkJm3xdZi0qEK8=; b=IwJ/N1YzDCgdHpKSSQkECMxaSM
 6i28vDvMEAzuttCY/c0rGH/LlgEUH3tl3CNYVB76Ij7BpAfl7RYGD/TImgmbvwfEg6e+gRUasNRyn
 Rs92FvsePv1k4cMB5DlJypkNXvamuwdMCSnpUftZL/IPw9Lu0mGN8Aj7AvXh5HdIwvx4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0KiH-0002Ir-Ht
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:11:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0KiH-0002ow-FE
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:11:53 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/shadow: have just a single instance of
 sh_set_toplevel_shadow()
Message-Id: <E1k0KiH-0002ow-FE@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:11:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 5fd152ea7dfbd7e83c4f398bc8d7273466b88cbb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 21 13:58:56 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 21 13:58:56 2020 +0200

    x86/shadow: have just a single instance of sh_set_toplevel_shadow()
    
    The only guest/shadow level dependent piece here is the call to
    sh_make_shadow(). Make a pointer to the respective function an
    argument of sh_set_toplevel_shadow(), allowing it to be moved to
    common.c.
    
    This implies making get_shadow_status() available to common.c; its set
    and delete counterparts are moved along with it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c  |  74 ++++++++++++++++++++++
 xen/arch/x86/mm/shadow/multi.c   | 130 +++------------------------------------
 xen/arch/x86/mm/shadow/private.h |  61 ++++++++++++++++++
 3 files changed, 143 insertions(+), 122 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index a2554d9351..7c7204fd34 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -2560,6 +2560,80 @@ void shadow_update_paging_modes(struct vcpu *v)
     paging_unlock(v->domain);
 }
 
+/* Set up the top-level shadow and install it in slot 'slot' of shadow_table */
+void sh_set_toplevel_shadow(struct vcpu *v,
+                            unsigned int slot,
+                            mfn_t gmfn,
+                            unsigned int root_type,
+                            mfn_t (*make_shadow)(struct vcpu *v,
+                                                 mfn_t gmfn,
+                                                 uint32_t shadow_type))
+{
+    mfn_t smfn;
+    pagetable_t old_entry, new_entry;
+    struct domain *d = v->domain;
+
+    /* Remember the old contents of this slot */
+    old_entry = v->arch.paging.shadow.shadow_table[slot];
+
+    /* Now figure out the new contents: is this a valid guest MFN? */
+    if ( !mfn_valid(gmfn) )
+    {
+        new_entry = pagetable_null();
+        goto install_new_entry;
+    }
+
+    /* Guest mfn is valid: shadow it and install the shadow */
+    smfn = get_shadow_status(d, gmfn, root_type);
+    if ( !mfn_valid(smfn) )
+    {
+        /* Make sure there's enough free shadow memory. */
+        shadow_prealloc(d, root_type, 1);
+        /* Shadow the page. */
+        smfn = make_shadow(v, gmfn, root_type);
+    }
+    ASSERT(mfn_valid(smfn));
+
+    /* Take a ref to this page: it will be released in sh_detach_old_tables()
+     * or the next call to set_toplevel_shadow() */
+    if ( sh_get_ref(d, smfn, 0) )
+    {
+        /* Pin the shadow and put it (back) on the list of pinned shadows */
+        sh_pin(d, smfn);
+
+        new_entry = pagetable_from_mfn(smfn);
+    }
+    else
+    {
+        printk(XENLOG_G_ERR "can't install %"PRI_mfn" as toplevel shadow\n",
+               mfn_x(smfn));
+        domain_crash(d);
+        new_entry = pagetable_null();
+    }
+
+ install_new_entry:
+    /* Done.  Install it */
+    SHADOW_PRINTK("%u [%u] gmfn %#"PRI_mfn" smfn %#"PRI_mfn"\n",
+                  v->arch.paging.mode->shadow.shadow_levels, slot,
+                  mfn_x(gmfn), mfn_x(pagetable_get_mfn(new_entry)));
+    v->arch.paging.shadow.shadow_table[slot] = new_entry;
+
+    /* Decrement the refcount of the old contents of this slot */
+    if ( !pagetable_is_null(old_entry) )
+    {
+        mfn_t old_smfn = pagetable_get_mfn(old_entry);
+        /* Need to repin the old toplevel shadow if it's been unpinned
+         * by shadow_prealloc(): in PV mode we're still running on this
+         * shadow and it's not safe to free it yet. */
+        if ( !mfn_to_page(old_smfn)->u.sh.pinned && !sh_pin(d, old_smfn) )
+        {
+            printk(XENLOG_G_ERR "can't re-pin %"PRI_mfn"\n", mfn_x(old_smfn));
+            domain_crash(d);
+        }
+        sh_put_ref(d, old_smfn, 0);
+    }
+}
+
 /**************************************************************************/
 /* Turning on and off shadow features */
 
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 9c8cb21349..088d27362d 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -103,7 +103,7 @@ static void sh_flush_local(const struct domain *d)
 /**************************************************************************/
 /* Hash table mapping from guest pagetables to shadows
  *
- * Normal case: maps the mfn of a guest page to the mfn of its shadow page.
+ * normal case: see private.h.
  * FL1's:       maps the *gfn* of the start of a superpage to the mfn of a
  *              shadow L1 which maps its "splinters".
  */
@@ -117,16 +117,6 @@ get_fl1_shadow_status(struct domain *d, gfn_t gfn)
     return smfn;
 }
 
-static inline mfn_t
-get_shadow_status(struct domain *d, mfn_t gmfn, u32 shadow_type)
-/* Look for shadows in the hash table */
-{
-    mfn_t smfn = shadow_hash_lookup(d, mfn_x(gmfn), shadow_type);
-    ASSERT(!mfn_valid(smfn) || mfn_to_page(smfn)->u.sh.head);
-    perfc_incr(shadow_get_shadow_status);
-    return smfn;
-}
-
 static inline void
 set_fl1_shadow_status(struct domain *d, gfn_t gfn, mfn_t smfn)
 /* Put an FL1 shadow into the hash table */
@@ -138,27 +128,6 @@ set_fl1_shadow_status(struct domain *d, gfn_t gfn, mfn_t smfn)
     shadow_hash_insert(d, gfn_x(gfn), SH_type_fl1_shadow, smfn);
 }
 
-static inline void
-set_shadow_status(struct domain *d, mfn_t gmfn, u32 shadow_type, mfn_t smfn)
-/* Put a shadow into the hash table */
-{
-    int res;
-
-    SHADOW_PRINTK("d%d gmfn=%lx, type=%08x, smfn=%lx\n",
-                  d->domain_id, mfn_x(gmfn), shadow_type, mfn_x(smfn));
-
-    ASSERT(mfn_to_page(smfn)->u.sh.head);
-
-    /* 32-bit PV guests don't own their l4 pages so can't get_page them */
-    if ( !is_pv_32bit_domain(d) || shadow_type != SH_type_l4_64_shadow )
-    {
-        res = get_page(mfn_to_page(gmfn), d);
-        ASSERT(res == 1);
-    }
-
-    shadow_hash_insert(d, mfn_x(gmfn), shadow_type, smfn);
-}
-
 static inline void
 delete_fl1_shadow_status(struct domain *d, gfn_t gfn, mfn_t smfn)
 /* Remove a shadow from the hash table */
@@ -169,19 +138,6 @@ delete_fl1_shadow_status(struct domain *d, gfn_t gfn, mfn_t smfn)
     shadow_hash_delete(d, gfn_x(gfn), SH_type_fl1_shadow, smfn);
 }
 
-static inline void
-delete_shadow_status(struct domain *d, mfn_t gmfn, u32 shadow_type, mfn_t smfn)
-/* Remove a shadow from the hash table */
-{
-    SHADOW_PRINTK("d%d gmfn=%"PRI_mfn", type=%08x, smfn=%"PRI_mfn"\n",
-                  d->domain_id, mfn_x(gmfn), shadow_type, mfn_x(smfn));
-    ASSERT(mfn_to_page(smfn)->u.sh.head);
-    shadow_hash_delete(d, mfn_x(gmfn), shadow_type, smfn);
-    /* 32-bit PV guests don't own their l4 pages; see set_shadow_status */
-    if ( !is_pv_32bit_domain(d) || shadow_type != SH_type_l4_64_shadow )
-        put_page(mfn_to_page(gmfn));
-}
-
 
 /**************************************************************************/
 /* Functions for walking the guest page tables */
@@ -3845,78 +3801,6 @@ sh_detach_old_tables(struct vcpu *v)
     }
 }
 
-/* Set up the top-level shadow and install it in slot 'slot' of shadow_table */
-static void
-sh_set_toplevel_shadow(struct vcpu *v,
-                       unsigned int slot,
-                       mfn_t gmfn,
-                       unsigned int root_type)
-{
-    mfn_t smfn;
-    pagetable_t old_entry, new_entry;
-    struct domain *d = v->domain;
-
-    /* Remember the old contents of this slot */
-    old_entry = v->arch.paging.shadow.shadow_table[slot];
-
-    /* Now figure out the new contents: is this a valid guest MFN? */
-    if ( !mfn_valid(gmfn) )
-    {
-        new_entry = pagetable_null();
-        goto install_new_entry;
-    }
-
-    /* Guest mfn is valid: shadow it and install the shadow */
-    smfn = get_shadow_status(d, gmfn, root_type);
-    if ( !mfn_valid(smfn) )
-    {
-        /* Make sure there's enough free shadow memory. */
-        shadow_prealloc(d, root_type, 1);
-        /* Shadow the page. */
-        smfn = sh_make_shadow(v, gmfn, root_type);
-    }
-    ASSERT(mfn_valid(smfn));
-
-    /* Take a ref to this page: it will be released in sh_detach_old_tables()
-     * or the next call to set_toplevel_shadow() */
-    if ( sh_get_ref(d, smfn, 0) )
-    {
-        /* Pin the shadow and put it (back) on the list of pinned shadows */
-        sh_pin(d, smfn);
-
-        new_entry = pagetable_from_mfn(smfn);
-    }
-    else
-    {
-        printk(XENLOG_G_ERR "can't install %"PRI_mfn" as toplevel shadow\n",
-               mfn_x(smfn));
-        domain_crash(d);
-        new_entry = pagetable_null();
-    }
-
- install_new_entry:
-    /* Done.  Install it */
-    SHADOW_PRINTK("%u/%u [%u] gmfn %#"PRI_mfn" smfn %#"PRI_mfn"\n",
-                  GUEST_PAGING_LEVELS, SHADOW_PAGING_LEVELS, slot,
-                  mfn_x(gmfn), mfn_x(pagetable_get_mfn(new_entry)));
-    v->arch.paging.shadow.shadow_table[slot] = new_entry;
-
-    /* Decrement the refcount of the old contents of this slot */
-    if ( !pagetable_is_null(old_entry) ) {
-        mfn_t old_smfn = pagetable_get_mfn(old_entry);
-        /* Need to repin the old toplevel shadow if it's been unpinned
-         * by shadow_prealloc(): in PV mode we're still running on this
-         * shadow and it's not safe to free it yet. */
-        if ( !mfn_to_page(old_smfn)->u.sh.pinned && !sh_pin(d, old_smfn) )
-        {
-            printk(XENLOG_G_ERR "can't re-pin %"PRI_mfn"\n", mfn_x(old_smfn));
-            domain_crash(d);
-        }
-        sh_put_ref(d, old_smfn, 0);
-    }
-}
-
-
 static void
 sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 /* Updates vcpu->arch.cr3 after the guest has changed CR3.
@@ -4014,7 +3898,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 #if GUEST_PAGING_LEVELS == 2
     if ( sh_remove_write_access(d, gmfn, 2, 0) != 0 )
         guest_flush_tlb_mask(d, d->dirty_cpumask);
-    sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l2_shadow);
+    sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l2_shadow, sh_make_shadow);
 #elif GUEST_PAGING_LEVELS == 3
     /* PAE guests have four shadow_table entries, based on the
      * current values of the guest's four l3es. */
@@ -4048,18 +3932,20 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
                 if ( p2m_is_ram(p2mt) )
                     sh_set_toplevel_shadow(v, i, gl2mfn, (i == 3)
                                            ? SH_type_l2h_shadow
-                                           : SH_type_l2_shadow);
+                                           : SH_type_l2_shadow,
+                                           sh_make_shadow);
                 else
-                    sh_set_toplevel_shadow(v, i, INVALID_MFN, 0);
+                    sh_set_toplevel_shadow(v, i, INVALID_MFN, 0,
+                                           sh_make_shadow);
             }
             else
-                sh_set_toplevel_shadow(v, i, INVALID_MFN, 0);
+                sh_set_toplevel_shadow(v, i, INVALID_MFN, 0, sh_make_shadow);
         }
     }
 #elif GUEST_PAGING_LEVELS == 4
     if ( sh_remove_write_access(d, gmfn, 4, 0) != 0 )
         guest_flush_tlb_mask(d, d->dirty_cpumask);
-    sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l4_shadow);
+    sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l4_shadow, sh_make_shadow);
     if ( !shadow_mode_external(d) && !is_pv_32bit_domain(d) )
     {
         mfn_t smfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[0]);
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index eb5d1e3fab..0a8927f49e 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -357,6 +357,15 @@ mfn_t shadow_alloc(struct domain *d,
                     unsigned long backpointer);
 void  shadow_free(struct domain *d, mfn_t smfn);
 
+/* Set up the top-level shadow and install it in slot 'slot' of shadow_table */
+void sh_set_toplevel_shadow(struct vcpu *v,
+                            unsigned int slot,
+                            mfn_t gmfn,
+                            unsigned int root_type,
+                            mfn_t (*make_shadow)(struct vcpu *v,
+                                                 mfn_t gmfn,
+                                                 uint32_t shadow_type));
+
 /* Install the xen mappings in various flavours of shadow */
 void sh_install_xen_entries_in_l4(struct domain *, mfn_t gl4mfn, mfn_t sl4mfn);
 
@@ -701,6 +710,58 @@ static inline void sh_unpin(struct domain *d, mfn_t smfn)
 }
 
 
+/**************************************************************************/
+/* Hash table mapping from guest pagetables to shadows
+ *
+ * Normal case: maps the mfn of a guest page to the mfn of its shadow page.
+ * FL1's:       see multi.c.
+ */
+
+static inline mfn_t
+get_shadow_status(struct domain *d, mfn_t gmfn, u32 shadow_type)
+/* Look for shadows in the hash table */
+{
+    mfn_t smfn = shadow_hash_lookup(d, mfn_x(gmfn), shadow_type);
+    ASSERT(!mfn_valid(smfn) || mfn_to_page(smfn)->u.sh.head);
+    perfc_incr(shadow_get_shadow_status);
+    return smfn;
+}
+
+static inline void
+set_shadow_status(struct domain *d, mfn_t gmfn, u32 shadow_type, mfn_t smfn)
+/* Put a shadow into the hash table */
+{
+    int res;
+
+    SHADOW_PRINTK("d%d gmfn=%lx, type=%08x, smfn=%lx\n",
+                  d->domain_id, mfn_x(gmfn), shadow_type, mfn_x(smfn));
+
+    ASSERT(mfn_to_page(smfn)->u.sh.head);
+
+    /* 32-bit PV guests don't own their l4 pages so can't get_page them */
+    if ( !is_pv_32bit_domain(d) || shadow_type != SH_type_l4_64_shadow )
+    {
+        res = get_page(mfn_to_page(gmfn), d);
+        ASSERT(res == 1);
+    }
+
+    shadow_hash_insert(d, mfn_x(gmfn), shadow_type, smfn);
+}
+
+static inline void
+delete_shadow_status(struct domain *d, mfn_t gmfn, u32 shadow_type, mfn_t smfn)
+/* Remove a shadow from the hash table */
+{
+    SHADOW_PRINTK("d%d gmfn=%"PRI_mfn", type=%08x, smfn=%"PRI_mfn"\n",
+                  d->domain_id, mfn_x(gmfn), shadow_type, mfn_x(smfn));
+    ASSERT(mfn_to_page(smfn)->u.sh.head);
+    shadow_hash_delete(d, mfn_x(gmfn), shadow_type, smfn);
+    /* 32-bit PV guests don't own their l4 pages; see set_shadow_status */
+    if ( !is_pv_32bit_domain(d) || shadow_type != SH_type_l4_64_shadow )
+        put_page(mfn_to_page(gmfn));
+}
+
+
 /**************************************************************************/
 /* PTE-write emulation. */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:12:05 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:12: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 1k0KiT-0004AW-O0; Tue, 28 Jul 2020 08:12:05 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0KiS-0004AN-Pz
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:12:04 +0000
X-Inumbo-ID: 047ddef7-d0aa-11ea-8b19-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 047ddef7-d0aa-11ea-8b19-bc764e2007e4;
 Tue, 28 Jul 2020 08:12:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=9QvPBhuDAan7R+LZnu/YBgpOViy091YhTrxTuAHxDms=; b=Uf5aygPYu2EL4rZWS1Z2KtdMzg
 BAyrX45d/Qk+0TfncVqr73Gn/FJYwDCaUPkm3Sp8hRqXtXZcSPhk3AAt48xjQnIG7Odojqd/ZZQ1j
 8RnidtSVpHOz1QNclsal0AdKxVtoTgSsQisGXF2BIF/R8MAE7xyEeLx0b1Ueqc2+F/jY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0KiR-0002JE-LY
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:12:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0KiR-0002qE-KS
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:12:03 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/shadow: l3table[] and gl3e[] are HVM only
Message-Id: <E1k0KiR-0002qE-KS@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:12:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit f6b78aefea557e5fd58d1c1e1e314c25c0bacaef
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 21 13:59:28 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 21 13:59:28 2020 +0200

    x86/shadow: l3table[] and gl3e[] are HVM only
    
    ... by the very fact that they're 3-level specific, while PV always gets
    run in 4-level mode. This requires adding some seemingly redundant
    #ifdef-s - some of them will be possible to drop again once 2- and
    3-level guest code doesn't get built anymore in !HVM configs, but I'm
    afraid there's still quite a bit of disentangling work to be done to
    make this possible.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/multi.c | 69 ++++++++++++++++++++++++++----------------
 xen/include/asm-x86/domain.h   |  3 +-
 2 files changed, 45 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 088d27362d..b205be6cdc 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -150,10 +150,7 @@ sh_walk_guest_tables(struct vcpu *v, unsigned long va, walk_t *gw,
                           ? cr3_pa(v->arch.hvm.guest_cr[3]) >> PAGE_SHIFT
                           : pagetable_get_pfn(v->arch.guest_table));
 
-#if GUEST_PAGING_LEVELS == 3 /* PAE */
-    return guest_walk_tables(v, p2m_get_hostp2m(v->domain), va, gw, pfec,
-                             root_gfn, INVALID_MFN, v->arch.paging.shadow.gl3e);
-#else /* 32 or 64 */
+#if GUEST_PAGING_LEVELS != 3 /* 32 or 64 */
     const struct domain *d = v->domain;
     mfn_t root_mfn = (v->arch.flags & TF_kernel_mode
                       ? pagetable_get_mfn(v->arch.guest_table)
@@ -165,6 +162,14 @@ sh_walk_guest_tables(struct vcpu *v, unsigned long va, walk_t *gw,
     unmap_domain_page(root_map);
 
     return ok;
+#elif !defined(CONFIG_HVM)
+    ASSERT_UNREACHABLE();
+    (void)root_gfn;
+    memset(gw, 0, sizeof(*gw));
+    return false;
+#else /* PAE */
+    return guest_walk_tables(v, p2m_get_hostp2m(v->domain), va, gw, pfec,
+                             root_gfn, INVALID_MFN, v->arch.paging.shadow.gl3e);
 #endif
 }
 
@@ -211,7 +216,7 @@ shadow_check_gwalk(struct vcpu *v, unsigned long va, walk_t *gw, int version)
     l3p = map_domain_page(gw->l3mfn);
     mismatch |= (gw->l3e.l3 != l3p[guest_l3_table_offset(va)].l3);
     unmap_domain_page(l3p);
-#else
+#elif defined(CONFIG_HVM)
     mismatch |= (gw->l3e.l3 !=
                  v->arch.paging.shadow.gl3e[guest_l3_table_offset(va)].l3);
 #endif
@@ -1693,6 +1698,8 @@ static shadow_l2e_t * shadow_get_and_create_l2e(struct vcpu *v,
     }
     /* Now follow it down a level.  Guaranteed to succeed. */
     return sh_linear_l2_table(v) + shadow_l2_linear_offset(gw->va);
+#elif !defined(CONFIG_HVM)
+    return NULL;
 #elif GUEST_PAGING_LEVELS == 3 /* PAE... */
     /* We never demand-shadow PAE l3es: they are only created in
      * sh_update_cr3().  Check if the relevant sl3e is present. */
@@ -3526,6 +3533,8 @@ static bool sh_invlpg(struct vcpu *v, unsigned long linear)
         if ( !(shadow_l3e_get_flags(sl3e) & _PAGE_PRESENT) )
             return false;
     }
+#elif !defined(CONFIG_HVM)
+    return false;
 #else /* SHADOW_PAGING_LEVELS == 3 */
     if ( !(l3e_get_flags(v->arch.paging.shadow.l3table[shadow_l3_linear_offset(linear)])
            & _PAGE_PRESENT) )
@@ -3679,7 +3688,9 @@ sh_update_linear_entries(struct vcpu *v)
          pagetable_get_pfn(v->arch.hvm.monitor_table) == 0 )
         return;
 
-#if SHADOW_PAGING_LEVELS == 4
+#if !defined(CONFIG_HVM)
+    return;
+#elif SHADOW_PAGING_LEVELS == 4
 
     /* For HVM, just need to update the l4e that points to the shadow l4. */
 
@@ -3816,7 +3827,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 {
     struct domain *d = v->domain;
     mfn_t gmfn;
-#if GUEST_PAGING_LEVELS == 3
+#if GUEST_PAGING_LEVELS == 3 && defined(CONFIG_HVM)
     const guest_l3e_t *gl3e;
     unsigned int i, guest_idx;
 #endif
@@ -3867,7 +3878,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 #endif
         gmfn = pagetable_get_mfn(v->arch.guest_table);
 
-#if GUEST_PAGING_LEVELS == 3
+#if GUEST_PAGING_LEVELS == 3 && defined(CONFIG_HVM)
     /*
      * On PAE guests we don't use a mapping of the guest's own top-level
      * table.  We cache the current state of that table and shadow that,
@@ -3895,10 +3906,22 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
     /* We revoke write access to the new guest toplevel page(s) before we
      * replace the old shadow pagetable(s), so that we can safely use the
      * (old) shadow linear maps in the writeable mapping heuristics. */
-#if GUEST_PAGING_LEVELS == 2
-    if ( sh_remove_write_access(d, gmfn, 2, 0) != 0 )
+#if GUEST_PAGING_LEVELS == 4
+    if ( sh_remove_write_access(d, gmfn, 4, 0) != 0 )
         guest_flush_tlb_mask(d, d->dirty_cpumask);
-    sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l2_shadow, sh_make_shadow);
+    sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l4_shadow, sh_make_shadow);
+    if ( !shadow_mode_external(d) && !is_pv_32bit_domain(d) )
+    {
+        mfn_t smfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[0]);
+
+        if ( !(v->arch.flags & TF_kernel_mode) && VM_ASSIST(d, m2p_strict) )
+            zap_ro_mpt(smfn);
+        else if ( (v->arch.flags & TF_kernel_mode) &&
+                  !VM_ASSIST(d, m2p_strict) )
+            fill_ro_mpt(smfn);
+    }
+#elif !defined(CONFIG_HVM)
+    ASSERT_UNREACHABLE();
 #elif GUEST_PAGING_LEVELS == 3
     /* PAE guests have four shadow_table entries, based on the
      * current values of the guest's four l3es. */
@@ -3907,7 +3930,8 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
         gfn_t gl2gfn;
         mfn_t gl2mfn;
         p2m_type_t p2mt;
-        const guest_l3e_t *gl3e = v->arch.paging.shadow.gl3e;
+
+        gl3e = v->arch.paging.shadow.gl3e;
 
         /* First, make all four entries read-only. */
         for ( i = 0; i < 4; i++ )
@@ -3942,25 +3966,16 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
                 sh_set_toplevel_shadow(v, i, INVALID_MFN, 0, sh_make_shadow);
         }
     }
-#elif GUEST_PAGING_LEVELS == 4
-    if ( sh_remove_write_access(d, gmfn, 4, 0) != 0 )
+#elif GUEST_PAGING_LEVELS == 2
+    if ( sh_remove_write_access(d, gmfn, 2, 0) != 0 )
         guest_flush_tlb_mask(d, d->dirty_cpumask);
-    sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l4_shadow, sh_make_shadow);
-    if ( !shadow_mode_external(d) && !is_pv_32bit_domain(d) )
-    {
-        mfn_t smfn = pagetable_get_mfn(v->arch.paging.shadow.shadow_table[0]);
-
-        if ( !(v->arch.flags & TF_kernel_mode) && VM_ASSIST(d, m2p_strict) )
-            zap_ro_mpt(smfn);
-        else if ( (v->arch.flags & TF_kernel_mode) &&
-                  !VM_ASSIST(d, m2p_strict) )
-            fill_ro_mpt(smfn);
-    }
+    sh_set_toplevel_shadow(v, 0, gmfn, SH_type_l2_shadow, sh_make_shadow);
 #else
 #error This should never happen
 #endif
 
 
+#ifdef CONFIG_HVM
     ///
     /// v->arch.paging.shadow.l3table
     ///
@@ -3986,7 +4001,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
             }
         }
 #endif /* SHADOW_PAGING_LEVELS == 3 */
-
+#endif /* CONFIG_HVM */
 
     ///
     /// v->arch.cr3
@@ -4006,6 +4021,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 #endif
 
 
+#ifdef CONFIG_HVM
     ///
     /// v->arch.hvm.hw_cr[3]
     ///
@@ -4022,6 +4038,7 @@ sh_update_cr3(struct vcpu *v, int do_locking, bool noflush)
 #endif
         hvm_update_guest_cr3(v, noflush);
     }
+#endif /* CONFIG_HVM */
 
     /* Fix up the linear pagetable mappings */
     sh_update_linear_entries(v);
diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h
index 3f5412d5ab..635335634d 100644
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
@@ -131,15 +131,16 @@ struct shadow_domain {
 
 struct shadow_vcpu {
 #ifdef CONFIG_SHADOW_PAGING
+#ifdef CONFIG_HVM
     /* PAE guests: per-vcpu shadow top-level table */
     l3_pgentry_t l3table[4] __attribute__((__aligned__(32)));
     /* PAE guests: per-vcpu cache of the top-level *guest* entries */
     l3_pgentry_t gl3e[4] __attribute__((__aligned__(32)));
 
     /* shadow(s) of guest (MFN) */
-#ifdef CONFIG_HVM
     pagetable_t shadow_table[4];
 #else
+    /* shadow of guest (MFN) */
     pagetable_t shadow_table[1];
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:12:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:12: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 1k0Kie-0004C5-Pt; Tue, 28 Jul 2020 08:12:16 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0Kid-0004Bp-3r
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:12:15 +0000
X-Inumbo-ID: 0b28af88-d0aa-11ea-a878-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 0b28af88-d0aa-11ea-a878-12813bfff9fa;
 Tue, 28 Jul 2020 08:12:14 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=hYe6h1mENrVjIBamDM/NPqYVwWteT6fgNbyvSvcEK0E=; b=H17plnF/UiaEkAirvhNJ2Ilv81
 N7I/uw5ckWkyls0YkcadY9kmlQ+2mmCExBrRbbgyBm4fefk4bedi48b6CKZeTCI/d0rW0K+i7Eazm
 qKdRgaCjfFCEBInjQR7wAbAy1hZhIQr3as4guxg1Lsa8ulyeTSc3oAAfYJZgEtWM5eFU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kib-0002JS-PV
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kib-00030S-Og
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:12:13 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86emul: support AVX512_VP2INTERSECT insns
Message-Id: <E1k0Kib-00030S-Og@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:12:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit fc7f700cf1845d80dee1f4075044a54645aec04e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 21 14:00:25 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jul 21 14:00:25 2020 +0200

    x86emul: support AVX512_VP2INTERSECT insns
    
    The standard memory access pattern once again should allow us to go
    without a test harness addition beyond the EVEX Disp8-scaling one.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libxl/libxl_cpuid.c                   | 1 +
 tools/misc/xen-cpuid.c                      | 2 +-
 tools/tests/x86_emulator/evex-disp8.c       | 5 +++++
 tools/tests/x86_emulator/x86-emulate.h      | 1 +
 xen/arch/x86/x86_emulate/x86_emulate.c      | 8 ++++++++
 xen/include/asm-x86/cpufeature.h            | 1 +
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 xen/tools/gen-cpuid.py                      | 2 +-
 8 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index db2f12d115..8b570b7e27 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -214,6 +214,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},
+        {"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},
         {"serialize",    0x00000007,  0, CPUID_REG_EDX, 14,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 8d8f3532a2..f4bf88e2fa 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -160,7 +160,7 @@ static const char *const str_7d0[32] =
     [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
     [ 4] = "fsrm",
 
-    /*  8 */                [ 9] = "srbds-ctrl",
+    [ 8] = "avx512-vp2intersect", [ 9] = "srbds-ctrl",
     [10] = "md-clear",
     /* 12 */                [13] = "tsx-force-abort",
     [14] = "serialize",
diff --git a/tools/tests/x86_emulator/evex-disp8.c b/tools/tests/x86_emulator/evex-disp8.c
index b892ed90da..60c569d5e5 100644
--- a/tools/tests/x86_emulator/evex-disp8.c
+++ b/tools/tests/x86_emulator/evex-disp8.c
@@ -593,6 +593,10 @@ static const struct test avx512_vnni_all[] = {
     INSN(pdpwssds, 66, 0f38, 53, vl, d, vl),
 };
 
+static const struct test avx512_vp2intersect_all[] = {
+    INSN(p2intersect, f2, 0f38, 68, vl, dq, vl)
+};
+
 static const struct test avx512_vpopcntdq_all[] = {
     INSN(popcnt, 66, 0f38, 55, vl, dq, vl)
 };
@@ -996,6 +1000,7 @@ void evex_disp8_test(void *instr, struct x86_emulate_ctxt *ctxt,
     RUN(avx512_vbmi, all);
     RUN(avx512_vbmi2, all);
     RUN(avx512_vnni, all);
+    RUN(avx512_vp2intersect, all);
     RUN(avx512_vpopcntdq, all);
 
     if ( cpu_has_avx512f )
diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h
index 6ea6cbc658..fc52edf8ce 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -168,6 +168,7 @@ static inline bool xcr0_mask(uint64_t mask)
 #define cpu_has_movdir64b  cp.feat.movdir64b
 #define cpu_has_avx512_4vnniw (cp.feat.avx512_4vnniw && xcr0_mask(0xe6))
 #define cpu_has_avx512_4fmaps (cp.feat.avx512_4fmaps && xcr0_mask(0xe6))
+#define cpu_has_avx512_vp2intersect (cp.feat.avx512_vp2intersect && xcr0_mask(0xe6))
 #define cpu_has_serialize  cp.feat.serialize
 #define cpu_has_avx512_bf16 (cp.feat.avx512_bf16 && xcr0_mask(0xe6))
 
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 84bb8e0c9b..44474a268b 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -488,6 +488,7 @@ static const struct ext0f38_table {
     [0x62] = { .simd_size = simd_packed_int, .two_op = 1, .d8s = d8s_bw },
     [0x63] = { .simd_size = simd_packed_int, .to_mem = 1, .two_op = 1, .d8s = d8s_bw },
     [0x64 ... 0x66] = { .simd_size = simd_packed_int, .d8s = d8s_vl },
+    [0x68] = { .simd_size = simd_packed_int, .d8s = d8s_vl },
     [0x70 ... 0x73] = { .simd_size = simd_packed_int, .d8s = d8s_vl },
     [0x75 ... 0x76] = { .simd_size = simd_packed_int, .d8s = d8s_vl },
     [0x77] = { .simd_size = simd_packed_fp, .d8s = d8s_vl },
@@ -2005,6 +2006,7 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_enqcmd()      (ctxt->cpuid->feat.enqcmd)
 #define vcpu_has_avx512_4vnniw() (ctxt->cpuid->feat.avx512_4vnniw)
 #define vcpu_has_avx512_4fmaps() (ctxt->cpuid->feat.avx512_4fmaps)
+#define vcpu_has_avx512_vp2intersect() (ctxt->cpuid->feat.avx512_vp2intersect)
 #define vcpu_has_serialize()   (ctxt->cpuid->feat.serialize)
 #define vcpu_has_avx512_bf16() (ctxt->cpuid->feat.avx512_bf16)
 
@@ -9545,6 +9547,12 @@ x86_emulate(
         }
         goto simd_zmm;
 
+    case X86EMUL_OPC_EVEX_F2(0x0f38, 0x68): /* vp2intersect{d,q} [xyz]mm/mem,[xyz]mm,k+1 */
+        host_and_vcpu_must_have(avx512_vp2intersect);
+        generate_exception_if(evex.opmsk || !evex.r || !evex.R, EXC_UD);
+        op_bytes = 16 << evex.lr;
+        goto avx512f_no_sae;
+
     case X86EMUL_OPC_EVEX_66(0x0f38, 0x70): /* vpshldvw [xyz]mm/mem,[xyz]mm,[xyz]mm{k} */
     case X86EMUL_OPC_EVEX_66(0x0f38, 0x72): /* vpshrdvw [xyz]mm/mem,[xyz]mm,[xyz]mm{k} */
         generate_exception_if(!evex.w, EXC_UD);
diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h
index f790d5c1f8..4de992781e 100644
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -128,6 +128,7 @@
 /* CPUID level 0x00000007:0.edx */
 #define cpu_has_avx512_4vnniw   boot_cpu_has(X86_FEATURE_AVX512_4VNNIW)
 #define cpu_has_avx512_4fmaps   boot_cpu_has(X86_FEATURE_AVX512_4FMAPS)
+#define cpu_has_avx512_vp2intersect boot_cpu_has(X86_FEATURE_AVX512_VP2INTERSECT)
 #define cpu_has_tsx_force_abort boot_cpu_has(X86_FEATURE_TSX_FORCE_ABORT)
 #define cpu_has_serialize       boot_cpu_has(X86_FEATURE_SERIALIZE)
 
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index fe7492a225..ce3deaa5c7 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -259,6 +259,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(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 */
 XEN_CPUFEATURE(TSX_FORCE_ABORT, 9*32+13) /* MSR_TSX_FORCE_ABORT.RTM_ABORT */
diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index ffd9529fdf..143ee7cae1 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -260,7 +260,7 @@ def crunch_numbers(state):
         # AVX512 features are built on top of AVX512F
         AVX512F: [AVX512DQ, AVX512_IFMA, AVX512PF, AVX512ER, AVX512CD,
                   AVX512BW, AVX512VL, AVX512_4VNNIW, AVX512_4FMAPS,
-                  AVX512_VNNI, AVX512_VPOPCNTDQ],
+                  AVX512_VNNI, AVX512_VPOPCNTDQ, AVX512_VP2INTERSECT],
 
         # AVX512 extensions acting on vectors of bytes/words are made
         # dependents of AVX512BW (as to requiring wider than 16-bit mask
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:12:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:12: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 1k0Kin-0004Dx-RZ; Tue, 28 Jul 2020 08:12:25 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0Kim-0004D9-Iv
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:12:24 +0000
X-Inumbo-ID: 112c4fe8-d0aa-11ea-8b19-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 112c4fe8-d0aa-11ea-8b19-bc764e2007e4;
 Tue, 28 Jul 2020 08:12:24 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=8bY59EEOC1VS3oAWuyzfgrfvZwQre2I8NisYiO2xRdE=; b=bIeZggLil1lFRZzdofG13SMeyS
 tzBOVOMnz8pBkqPwNHwx+drrUOBeSNLbem0VnDCJaYkd5SsGCNpA1ipoE6nKPe89nJo2a/MqRxv23
 d/PMgi9is6TzJk2kiMA4nBI8lXO4nKKUWhiC8lR6eHgutMxTedSgw2+KKoCHN3yM10bI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kil-0002JZ-SP
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kil-00032w-Ri
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:12:23 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] SUPPORT.md: Spell Experimental correctly
Message-Id: <E1k0Kil-00032w-Ri@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:12:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 139ce42388c3fe7096a09b3d397250fe14906809
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Jul 20 18:35:55 2020 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Jul 21 13:19:27 2020 +0100

    SUPPORT.md: Spell Experimental correctly
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 SUPPORT.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index b81d36eea5..1479055c45 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -249,13 +249,13 @@ to boot with memory < maxmem.
 
 Allow sharing of identical pages between guests
 
-    Status, x86 HVM: Expermental
+    Status, x86 HVM: Experimental
 
 ### Memory Paging
 
 Allow pages belonging to guests to be paged to disk
 
-    Status, x86 HVM: Experimenal
+    Status, x86 HVM: Experimental
 
 ### Alternative p2m
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:12:35 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:12: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 1k0Kix-0004FG-T8; Tue, 28 Jul 2020 08:12:35 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0Kiw-0004F3-NT
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:12:34 +0000
X-Inumbo-ID: 1731db06-d0aa-11ea-a878-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 1731db06-d0aa-11ea-a878-12813bfff9fa;
 Tue, 28 Jul 2020 08:12:34 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=cPz12K+JezvYiUo/NoDgaKbI5qChMoMgj7K3Uv5B6yg=; b=X2GHYF5vwMrisV0EYVUk19eArB
 ZvR8jwaOYMndH47mQkDx0RHJYoClYCGSJoTqKzHZgSH/pVQssM7LoT6eXJkoWyImH7YQZid7vw33j
 syrVy8B6ERqpKKhoyylMyTT6QjtyXLL8vnNxDydV2erd/UQPEZtfydOzjGVjlJ3z6Rtk=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kiv-0002Jo-VQ
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kiv-00033n-Ug
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:12:33 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] MAINTAINERS: add myself as a golang bindings maintainer
Message-Id: <E1k0Kiv-00033n-Ug@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:12:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit af0584931c1b902577317dacff976bc4b4f3923d
Author:     Nick Rosbrook <rosbrookn@gmail.com>
AuthorDate: Thu Jul 16 12:00:26 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jul 21 12:31:45 2020 +0000

    MAINTAINERS: add myself as a golang bindings maintainer
    
    Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index e374816755..33fe51324e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -298,6 +298,7 @@ F:	tools/debugger/gdbsx/
 
 GOLANG BINDINGS
 M:	George Dunlap <george.dunlap@citrix.com>
+M:     Nick Rosbrook <rosbrookn@ainfosec.com>
 S:	Maintained
 F:	tools/golang
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:12:46 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:12: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 1k0Kj8-0004GS-Ud; Tue, 28 Jul 2020 08:12:46 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0Kj8-0004GJ-2F
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:12:46 +0000
X-Inumbo-ID: 1d34444e-d0aa-11ea-8b19-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 1d34444e-d0aa-11ea-8b19-bc764e2007e4;
 Tue, 28 Jul 2020 08:12:44 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=gmXN7KW9v5i4LdscEfzDOu6p5jaRwGc3IMJ1ZaiQP9Q=; b=7Ea7wIKrNrICM80ca+fzY57AzQ
 dVzFnAWLhHnI4NVOlQCMNTDNlTsJvrRLJ4BuUUQWo6TreK1g/Pm5c7xS/DLtXnC+7O/OJD+rYkoZX
 p/Jy4DzwJmn4V0rVjN+z2asspyiEMKsSmQZE2JfNY2t4Lz+rDHSqyDW7NFjcz9eZpqx0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kj6-0002Jz-20
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:12:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kj6-00034X-1G
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:12:44 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] golang/xenlight: fix code generation for python 2.6
Message-Id: <E1k0Kj6-00034X-1G@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:12:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 6d49fbdeab3e687a6818f809ca3d98ac7ced2c8d
Author:     Nick Rosbrook <rosbrookn@gmail.com>
AuthorDate: Mon Jul 20 19:54:40 2020 -0400
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jul 21 12:31:45 2020 +0000

    golang/xenlight: fix code generation for python 2.6
    
    Before python 2.7, str.format() calls required that the format fields
    were explicitly enumerated, e.g.:
    
      '{0} {1}'.format(foo, bar)
    
      vs.
    
      '{} {}'.format(foo, bar)
    
    Currently, gengotypes.py uses the latter pattern everywhere, which means
    the Go bindings do not build on python 2.6. Use the 2.6 syntax for
    format() in order to support python 2.6 for now.
    
    Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/golang/xenlight/gengotypes.py | 204 ++++++++++++++++++------------------
 1 file changed, 102 insertions(+), 102 deletions(-)

diff --git a/tools/golang/xenlight/gengotypes.py b/tools/golang/xenlight/gengotypes.py
index 557fecd07b..ebec938224 100644
--- a/tools/golang/xenlight/gengotypes.py
+++ b/tools/golang/xenlight/gengotypes.py
@@ -3,7 +3,7 @@
 import os
 import sys
 
-sys.path.append('{}/tools/libxl'.format(os.environ['XEN_ROOT']))
+sys.path.append('{0}/tools/libxl'.format(os.environ['XEN_ROOT']))
 import idl
 
 # Go versions of some builtin types.
@@ -73,14 +73,14 @@ def xenlight_golang_define_enum(ty = None):
 
     if ty.typename is not None:
         typename = xenlight_golang_fmt_name(ty.typename)
-        s += 'type {} int\n'.format(typename)
+        s += 'type {0} int\n'.format(typename)
 
     # Start const block
     s += 'const(\n'
 
     for v in ty.values:
         name = xenlight_golang_fmt_name(v.name)
-        s += '{} {} = {}\n'.format(name, typename, v.value)
+        s += '{0} {1} = {2}\n'.format(name, typename, v.value)
 
     # End const block
     s += ')\n'
@@ -99,9 +99,9 @@ def xenlight_golang_define_struct(ty = None, typename = None, nested = False):
 
     # Begin struct definition
     if nested:
-        s += '{} struct {{\n'.format(name)
+        s += '{0} struct {{\n'.format(name)
     else:
-        s += 'type {} struct {{\n'.format(name)
+        s += 'type {0} struct {{\n'.format(name)
 
     # Write struct fields
     for f in ty.fields:
@@ -111,13 +111,13 @@ def xenlight_golang_define_struct(ty = None, typename = None, nested = False):
                 typename = xenlight_golang_fmt_name(typename)
                 name     = xenlight_golang_fmt_name(f.name)
 
-                s += '{} []{}\n'.format(name, typename)
+                s += '{0} []{1}\n'.format(name, typename)
             else:
                 typename = f.type.typename
                 typename = xenlight_golang_fmt_name(typename)
                 name     = xenlight_golang_fmt_name(f.name)
 
-                s += '{} {}\n'.format(name, typename)
+                s += '{0} {1}\n'.format(name, typename)
 
         elif isinstance(f.type, idl.Struct):
             r = xenlight_golang_define_struct(f.type, typename=f.name, nested=True)
@@ -132,7 +132,7 @@ def xenlight_golang_define_struct(ty = None, typename = None, nested = False):
             extras.extend(r[1])
 
         else:
-            raise Exception('type {} not supported'.format(f.type))
+            raise Exception('type {0} not supported'.format(f.type))
 
     # End struct definition
     s += '}\n'
@@ -151,11 +151,11 @@ def xenlight_golang_define_union(ty = None, struct_name = '', union_name = ''):
     s = ''
     extras = []
 
-    interface_name = '{}_{}_union'.format(struct_name, ty.keyvar.name)
+    interface_name = '{0}_{1}_union'.format(struct_name, ty.keyvar.name)
     interface_name = xenlight_golang_fmt_name(interface_name, exported=False)
 
-    s += 'type {} interface {{\n'.format(interface_name)
-    s += 'is{}()\n'.format(interface_name)
+    s += 'type {0} interface {{\n'.format(interface_name)
+    s += 'is{0}()\n'.format(interface_name)
     s += '}\n'
 
     extras.append(s)
@@ -165,7 +165,7 @@ def xenlight_golang_define_union(ty = None, struct_name = '', union_name = ''):
             continue
 
         # Define struct
-        name = '{}_{}_union_{}'.format(struct_name, ty.keyvar.name, f.name)
+        name = '{0}_{1}_union_{2}'.format(struct_name, ty.keyvar.name, f.name)
         r = xenlight_golang_define_struct(f.type, typename=name)
         extras.append(r[0])
         extras.extend(r[1])
@@ -173,21 +173,21 @@ def xenlight_golang_define_union(ty = None, struct_name = '', union_name = ''):
         # This typeof trick ensures that the fields used in the cgo struct
         # used for marshaling are the same as the fields of the union in the
         # actual C type, and avoids re-defining all of those fields.
-        s = 'typedef typeof(((struct {} *)NULL)->{}.{}){};'
+        s = 'typedef typeof(((struct {0} *)NULL)->{1}.{2}){3};'
         s = s.format(struct_name, union_name, f.name, name)
         cgo_helpers_preamble.append(s)
 
         # Define function to implement 'union' interface
         name = xenlight_golang_fmt_name(name)
-        s = 'func (x {}) is{}(){{}}\n'.format(name, interface_name)
+        s = 'func (x {0}) is{1}(){{}}\n'.format(name, interface_name)
         extras.append(s)
 
     fname = xenlight_golang_fmt_name(ty.keyvar.name)
     ftype = xenlight_golang_fmt_name(ty.keyvar.type.typename)
-    s = '{} {}\n'.format(fname, ftype)
+    s = '{0} {1}\n'.format(fname, ftype)
 
-    fname = xenlight_golang_fmt_name('{}_union'.format(ty.keyvar.name))
-    s += '{} {}\n'.format(fname, interface_name)
+    fname = xenlight_golang_fmt_name('{0}_union'.format(ty.keyvar.name))
+    s += '{0} {1}\n'.format(fname, interface_name)
 
     return (s,extras)
 
@@ -243,7 +243,7 @@ def xenlight_golang_define_from_C(ty = None):
     Define the fromC marshaling function for the type
     represented by ty.
     """
-    func = 'func (x *{}) fromC(xc *C.{}) error {{\n {}\n return nil}}\n'
+    func = 'func (x *{0}) fromC(xc *C.{1}) error {{\n {2}\n return nil}}\n'
 
     goname = xenlight_golang_fmt_name(ty.typename)
     cname  = ty.typename
@@ -271,7 +271,7 @@ def xenlight_golang_define_from_C(ty = None):
             extras.extend(r[1])
 
         else:
-            raise Exception('type {} not supported'.format(f.type))
+            raise Exception('type {0} not supported'.format(f.type))
 
     return (func.format(goname, cname, body), extras)
 
@@ -300,8 +300,8 @@ def xenlight_golang_convert_from_C(ty = None, outer_name = None, cvarname = None
 
     # If outer_name is set, treat this as nested.
     if outer_name is not None:
-        goname = '{}.{}'.format(xenlight_golang_fmt_name(outer_name), goname)
-        cname  = '{}.{}'.format(outer_name, cname)
+        goname = '{0}.{1}'.format(xenlight_golang_fmt_name(outer_name), goname)
+        cname  = '{0}.{1}'.format(outer_name, cname)
 
     # Types that satisfy this condition can be easily casted or
     # converted to a Go builtin type.
@@ -312,15 +312,15 @@ def xenlight_golang_convert_from_C(ty = None, outer_name = None, cvarname = None
     if not is_castable:
         # If the type is not castable, we need to call its fromC
         # function.
-        s += 'if err := x.{}.fromC(&{}.{});'.format(goname,cvarname,cname)
-        s += 'err != nil {{\nreturn fmt.Errorf("converting field {}: %v", err)\n}}\n'.format(goname)
+        s += 'if err := x.{0}.fromC(&{1}.{2});'.format(goname,cvarname,cname)
+        s += 'err != nil {{\nreturn fmt.Errorf("converting field {0}: %v", err)\n}}\n'.format(goname)
 
     elif gotypename == 'string':
         # Use the cgo helper for converting C strings.
-        s += 'x.{} = C.GoString({}.{})\n'.format(goname,cvarname,cname)
+        s += 'x.{0} = C.GoString({1}.{2})\n'.format(goname,cvarname,cname)
 
     else:
-        s += 'x.{} = {}({}.{})\n'.format(goname,gotypename,cvarname,cname)
+        s += 'x.{0} = {1}({2}.{3})\n'.format(goname,gotypename,cvarname,cname)
 
     return s
 
@@ -331,9 +331,9 @@ def xenlight_golang_union_from_C(ty = None, union_name = '', struct_name = ''):
     gokeyname = xenlight_golang_fmt_name(keyname)
     keytype   = ty.keyvar.type.typename
     gokeytype = xenlight_golang_fmt_name(keytype)
-    field_name = xenlight_golang_fmt_name('{}_union'.format(keyname))
+    field_name = xenlight_golang_fmt_name('{0}_union'.format(keyname))
 
-    interface_name = '{}_{}_union'.format(struct_name, keyname)
+    interface_name = '{0}_{1}_union'.format(struct_name, keyname)
     interface_name = xenlight_golang_fmt_name(interface_name, exported=False)
 
     cgo_keyname = keyname
@@ -343,7 +343,7 @@ def xenlight_golang_union_from_C(ty = None, union_name = '', struct_name = ''):
     cases = {}
 
     for f in ty.fields:
-        val = '{}_{}'.format(keytype, f.name)
+        val = '{0}_{1}'.format(keytype, f.name)
         val = xenlight_golang_fmt_name(val)
 
         # Add to list of cases to make for the switch
@@ -354,17 +354,17 @@ def xenlight_golang_union_from_C(ty = None, union_name = '', struct_name = ''):
             continue
 
         # Define fromC func for 'union' struct.
-        typename   = '{}_{}_union_{}'.format(struct_name,keyname,f.name)
+        typename   = '{0}_{1}_union_{2}'.format(struct_name,keyname,f.name)
         gotypename = xenlight_golang_fmt_name(typename)
 
         # Define the function here. The cases for keyed unions are a little
         # different.
-        s = 'func (x *{}) fromC(xc *C.{}) error {{\n'.format(gotypename,struct_name)
-        s += 'if {}(xc.{}) != {} {{\n'.format(gokeytype,cgo_keyname,val)
-        err_string = '"expected union key {}"'.format(val)
-        s += 'return errors.New({})\n'.format(err_string)
+        s = 'func (x *{0}) fromC(xc *C.{1}) error {{\n'.format(gotypename,struct_name)
+        s += 'if {0}(xc.{1}) != {2} {{\n'.format(gokeytype,cgo_keyname,val)
+        err_string = '"expected union key {0}"'.format(val)
+        s += 'return errors.New({0})\n'.format(err_string)
         s += '}\n\n'
-        s += 'tmp := (*C.{})(unsafe.Pointer(&xc.{}[0]))\n'.format(typename,union_name)
+        s += 'tmp := (*C.{0})(unsafe.Pointer(&xc.{1}[0]))\n'.format(typename,union_name)
 
         for nf in f.type.fields:
             s += xenlight_golang_convert_from_C(nf,cvarname='tmp')
@@ -374,35 +374,35 @@ def xenlight_golang_union_from_C(ty = None, union_name = '', struct_name = ''):
 
         extras.append(s)
 
-    s = 'x.{} = {}(xc.{})\n'.format(gokeyname,gokeytype,cgo_keyname)
-    s += 'switch x.{}{{\n'.format(gokeyname)
+    s = 'x.{0} = {1}(xc.{2})\n'.format(gokeyname,gokeytype,cgo_keyname)
+    s += 'switch x.{0}{{\n'.format(gokeyname)
 
     # Create switch statement to determine which 'union element'
     # to populate in the Go struct.
     for case_name, case_tuple in sorted(cases.items()):
         (case_val, case_type) = case_tuple
 
-        s += 'case {}:\n'.format(case_val)
+        s += 'case {0}:\n'.format(case_val)
 
         if case_type is None:
-            s += "x.{} = nil\n".format(field_name)
+            s += "x.{0} = nil\n".format(field_name)
             continue
 
-        gotype = '{}_{}_union_{}'.format(struct_name,keyname,case_name)
+        gotype = '{0}_{1}_union_{2}'.format(struct_name,keyname,case_name)
         gotype = xenlight_golang_fmt_name(gotype)
-        goname = '{}_{}'.format(keyname,case_name)
+        goname = '{0}_{1}'.format(keyname,case_name)
         goname = xenlight_golang_fmt_name(goname,exported=False)
 
-        s += 'var {} {}\n'.format(goname, gotype)
-        s += 'if err := {}.fromC(xc);'.format(goname)
-        s += 'err != nil {{\n return fmt.Errorf("converting field {}: %v", err)\n}}\n'.format(goname)
+        s += 'var {0} {1}\n'.format(goname, gotype)
+        s += 'if err := {0}.fromC(xc);'.format(goname)
+        s += 'err != nil {{\n return fmt.Errorf("converting field {0}: %v", err)\n}}\n'.format(goname)
 
-        s += 'x.{} = {}\n'.format(field_name, goname)
+        s += 'x.{0} = {1}\n'.format(field_name, goname)
 
     # End switch statement
     s += 'default:\n'
-    err_string = '"invalid union key \'%v\'", x.{}'.format(gokeyname)
-    s += 'return fmt.Errorf({})'.format(err_string)
+    err_string = '"invalid union key \'%v\'", x.{0}'.format(gokeyname)
+    s += 'return fmt.Errorf({0})'.format(err_string)
     s += '}\n'
 
     return (s,extras)
@@ -420,22 +420,22 @@ def xenlight_golang_array_from_C(ty = None):
     goname     = xenlight_golang_fmt_name(ty.name)
     ctypename  = ty.type.elem_type.typename
     cname      = ty.name
-    cslice     = 'c{}'.format(goname)
+    cslice     = 'c{0}'.format(goname)
     clenvar    = ty.type.lenvar.name
 
-    s += 'x.{} = nil\n'.format(goname)
-    s += 'if n := int(xc.{}); n > 0 {{\n'.format(clenvar)
-    s += '{} := '.format(cslice)
-    s +='(*[1<<28]C.{})(unsafe.Pointer(xc.{}))[:n:n]\n'.format(ctypename, cname)
-    s += 'x.{} = make([]{}, n)\n'.format(goname, gotypename)
-    s += 'for i, v := range {} {{\n'.format(cslice)
+    s += 'x.{0} = nil\n'.format(goname)
+    s += 'if n := int(xc.{0}); n > 0 {{\n'.format(clenvar)
+    s += '{0} := '.format(cslice)
+    s +='(*[1<<28]C.{0})(unsafe.Pointer(xc.{1}))[:n:n]\n'.format(ctypename, cname)
+    s += 'x.{0} = make([]{1}, n)\n'.format(goname, gotypename)
+    s += 'for i, v := range {0} {{\n'.format(cslice)
 
     is_enum = isinstance(ty.type.elem_type,idl.Enumeration)
     if gotypename in go_builtin_types or is_enum:
-        s += 'x.{}[i] = {}(v)\n'.format(goname, gotypename)
+        s += 'x.{0}[i] = {1}(v)\n'.format(goname, gotypename)
     else:
-        s += 'if err := x.{}[i].fromC(&v); err != nil {{\n'.format(goname)
-        s += 'return fmt.Errorf("converting field {}: %v", err) }}\n'.format(goname)
+        s += 'if err := x.{0}[i].fromC(&v); err != nil {{\n'.format(goname)
+        s += 'return fmt.Errorf("converting field {0}: %v", err) }}\n'.format(goname)
 
     s += '}\n}\n'
 
@@ -446,11 +446,11 @@ def xenlight_golang_define_to_C(ty = None, typename = None, nested = False):
     Define the toC marshaling function for the type
     represented by ty.
     """
-    func = 'func (x *{}) toC(xc *C.{}) (err error){{{}\n return nil\n }}\n'
+    func = 'func (x *{0}) toC(xc *C.{1}) (err error){{{2}\n return nil\n }}\n'
     body = ''
 
     if ty.dispose_fn is not None:
-        body += 'defer func(){{\nif err != nil{{\nC.{}(xc)}}\n}}()\n\n'.format(ty.dispose_fn)
+        body += 'defer func(){{\nif err != nil{{\nC.{0}(xc)}}\n}}()\n\n'.format(ty.dispose_fn)
 
     goname = xenlight_golang_fmt_name(ty.typename)
     cname  = ty.typename
@@ -471,7 +471,7 @@ def xenlight_golang_define_to_C(ty = None, typename = None, nested = False):
             body += xenlight_golang_union_to_C(f.type, f.name, ty.typename)
 
         else:
-            raise Exception('type {} not supported'.format(f.type))
+            raise Exception('type {0} not supported'.format(f.type))
 
     return func.format(goname, cname, body)
 
@@ -506,26 +506,26 @@ def xenlight_golang_convert_to_C(ty = None, outer_name = None,
 
     # If outer_name is set, treat this as nested.
     if outer_name is not None:
-        goname = '{}.{}'.format(xenlight_golang_fmt_name(outer_name), goname)
-        cname  = '{}.{}'.format(outer_name, cname)
+        goname = '{0}.{1}'.format(xenlight_golang_fmt_name(outer_name), goname)
+        cname  = '{0}.{1}'.format(outer_name, cname)
 
     is_castable = (ty.type.json_parse_type == 'JSON_INTEGER' or
                    isinstance(ty.type, idl.Enumeration) or
                    gotypename in go_builtin_types)
 
     if not is_castable:
-        s += 'if err := {}.{}.toC(&{}.{}); err != nil {{\n'.format(govarname,goname,
+        s += 'if err := {0}.{1}.toC(&{2}.{3}); err != nil {{\n'.format(govarname,goname,
                                                                    cvarname,cname)
-        s += 'return fmt.Errorf("converting field {}: %v", err)\n}}\n'.format(goname)
+        s += 'return fmt.Errorf("converting field {0}: %v", err)\n}}\n'.format(goname)
 
     elif gotypename == 'string':
         # Use the cgo helper for converting C strings.
-        s += 'if {}.{} != "" {{\n'.format(govarname,goname)
-        s += '{}.{} = C.CString({}.{})}}\n'.format(cvarname,cname,
+        s += 'if {0}.{1} != "" {{\n'.format(govarname,goname)
+        s += '{0}.{1} = C.CString({2}.{3})}}\n'.format(cvarname,cname,
                                                    govarname,goname)
 
     else:
-        s += '{}.{} = C.{}({}.{})\n'.format(cvarname,cname,ctypename,
+        s += '{0}.{1} = C.{2}({3}.{4})\n'.format(cvarname,cname,ctypename,
                                             govarname,goname)
 
     return s
@@ -537,7 +537,7 @@ def xenlight_golang_union_to_C(ty = None, union_name = '',
     keytype   = ty.keyvar.type.typename
     gokeytype = xenlight_golang_fmt_name(keytype)
 
-    interface_name = '{}_{}_union'.format(struct_name, keyname)
+    interface_name = '{0}_{1}_union'.format(struct_name, keyname)
     interface_name = xenlight_golang_fmt_name(interface_name, exported=False)
 
     cgo_keyname = keyname
@@ -545,44 +545,44 @@ def xenlight_golang_union_to_C(ty = None, union_name = '',
         cgo_keyname = '_' + cgo_keyname
 
 
-    s = 'xc.{} = C.{}(x.{})\n'.format(cgo_keyname,keytype,gokeyname)
-    s += 'switch x.{}{{\n'.format(gokeyname)
+    s = 'xc.{0} = C.{1}(x.{2})\n'.format(cgo_keyname,keytype,gokeyname)
+    s += 'switch x.{0}{{\n'.format(gokeyname)
 
     # Create switch statement to determine how to populate the C union.
     for f in ty.fields:
-        key_val = '{}_{}'.format(keytype, f.name)
+        key_val = '{0}_{1}'.format(keytype, f.name)
         key_val = xenlight_golang_fmt_name(key_val)
 
-        s += 'case {}:\n'.format(key_val)
+        s += 'case {0}:\n'.format(key_val)
 
         if f.type is None:
             s += "break\n"
             continue
 
-        cgotype = '{}_{}_union_{}'.format(struct_name,keyname,f.name)
+        cgotype = '{0}_{1}_union_{2}'.format(struct_name,keyname,f.name)
         gotype  = xenlight_golang_fmt_name(cgotype)
 
-        field_name = xenlight_golang_fmt_name('{}_union'.format(keyname))
-        s += 'tmp, ok := x.{}.({})\n'.format(field_name,gotype)
+        field_name = xenlight_golang_fmt_name('{0}_union'.format(keyname))
+        s += 'tmp, ok := x.{0}.({1})\n'.format(field_name,gotype)
         s += 'if !ok {\n'
-        s += 'return errors.New("wrong type for union key {}")\n'.format(keyname)
+        s += 'return errors.New("wrong type for union key {0}")\n'.format(keyname)
         s += '}\n'
 
-        s += 'var {} C.{}\n'.format(f.name,cgotype)
+        s += 'var {0} C.{1}\n'.format(f.name,cgotype)
         for uf in f.type.fields:
             s += xenlight_golang_convert_to_C(uf,cvarname=f.name,
                                               govarname='tmp')
 
         # The union is still represented as Go []byte.
-        s += '{}Bytes := C.GoBytes(unsafe.Pointer(&{}),C.sizeof_{})\n'.format(f.name,
+        s += '{0}Bytes := C.GoBytes(unsafe.Pointer(&{1}),C.sizeof_{2})\n'.format(f.name,
                                                                               f.name,
                                                                               cgotype)
-        s += 'copy(xc.{}[:],{}Bytes)\n'.format(union_name,f.name)
+        s += 'copy(xc.{0}[:],{1}Bytes)\n'.format(union_name,f.name)
 
     # End switch statement
     s += 'default:\n'
-    err_string = '"invalid union key \'%v\'", x.{}'.format(gokeyname)
-    s += 'return fmt.Errorf({})'.format(err_string)
+    err_string = '"invalid union key \'%v\'", x.{0}'.format(gokeyname)
+    s += 'return fmt.Errorf({0})'.format(err_string)
     s += '}\n'
 
     return s
@@ -599,29 +599,29 @@ def xenlight_golang_array_to_C(ty = None):
 
     is_enum = isinstance(ty.type.elem_type,idl.Enumeration)
     if gotypename in go_builtin_types or is_enum:
-        s += 'if {} := len(x.{}); {} > 0 {{\n'.format(golenvar,goname,golenvar)
-        s += 'xc.{} = (*C.{})(C.malloc(C.size_t({}*{})))\n'.format(cname,ctypename,
+        s += 'if {0} := len(x.{1}); {2} > 0 {{\n'.format(golenvar,goname,golenvar)
+        s += 'xc.{0} = (*C.{1})(C.malloc(C.size_t({2}*{3})))\n'.format(cname,ctypename,
                                                                    golenvar,golenvar)
-        s += 'xc.{} = C.int({})\n'.format(clenvar,golenvar)
-        s += 'c{} := (*[1<<28]C.{})(unsafe.Pointer(xc.{}))[:{}:{}]\n'.format(goname,
+        s += 'xc.{0} = C.int({1})\n'.format(clenvar,golenvar)
+        s += 'c{0} := (*[1<<28]C.{1})(unsafe.Pointer(xc.{2}))[:{3}:{4}]\n'.format(goname,
                                                                       ctypename,cname,
                                                                       golenvar,golenvar)
-        s += 'for i,v := range x.{} {{\n'.format(goname)
-        s += 'c{}[i] = C.{}(v)\n'.format(goname,ctypename)
+        s += 'for i,v := range x.{0} {{\n'.format(goname)
+        s += 'c{0}[i] = C.{1}(v)\n'.format(goname,ctypename)
         s += '}\n}\n'
 
         return s
 
-    s += 'if {} := len(x.{}); {} > 0 {{\n'.format(golenvar,goname,golenvar)
-    s += 'xc.{} = (*C.{})(C.malloc(C.ulong({})*C.sizeof_{}))\n'.format(cname,ctypename,
+    s += 'if {0} := len(x.{1}); {2} > 0 {{\n'.format(golenvar,goname,golenvar)
+    s += 'xc.{0} = (*C.{1})(C.malloc(C.ulong({2})*C.sizeof_{3}))\n'.format(cname,ctypename,
                                                                    golenvar,ctypename)
-    s += 'xc.{} = C.int({})\n'.format(clenvar,golenvar)
-    s += 'c{} := (*[1<<28]C.{})(unsafe.Pointer(xc.{}))[:{}:{}]\n'.format(goname,
+    s += 'xc.{0} = C.int({1})\n'.format(clenvar,golenvar)
+    s += 'c{0} := (*[1<<28]C.{1})(unsafe.Pointer(xc.{2}))[:{3}:{4}]\n'.format(goname,
                                                                          ctypename,cname,
                                                                          golenvar,golenvar)
-    s += 'for i,v := range x.{} {{\n'.format(goname)
-    s += 'if err := v.toC(&c{}[i]); err != nil {{\n'.format(goname)
-    s += 'return fmt.Errorf("converting field {}: %v", err)\n'.format(goname)
+    s += 'for i,v := range x.{0} {{\n'.format(goname)
+    s += 'if err := v.toC(&c{0}[i]); err != nil {{\n'.format(goname)
+    s += 'return fmt.Errorf("converting field {0}: %v", err)\n'.format(goname)
     s += '}\n}\n}\n'
 
     return s
@@ -633,7 +633,7 @@ def xenlight_golang_define_constructor(ty = None):
     gotypename = xenlight_golang_fmt_name(ctypename)
 
     # Since this func is exported, add a comment as per Go conventions.
-    s += '// New{} returns an instance of {}'.format(gotypename,gotypename)
+    s += '// New{0} returns an instance of {1}'.format(gotypename,gotypename)
     s += ' initialized with defaults.\n'
 
     # If a struct has a keyed union, an extra argument is
@@ -643,7 +643,7 @@ def xenlight_golang_define_constructor(ty = None):
     init_fns = []
 
     # Add call to parent init_fn first.
-    init_fns.append('C.{}(&xc)'.format(ty.init_fn))
+    init_fns.append('C.{0}(&xc)'.format(ty.init_fn))
 
     for f in ty.fields:
         if not isinstance(f.type, idl.KeyedUnion):
@@ -658,24 +658,24 @@ def xenlight_golang_define_constructor(ty = None):
         # Serveral keyed unions use 'type' as the key variable name. In
         # that case, prepend the first letter of the Go type name.
         if param_goname == 'type':
-            param_goname = '{}type'.format(param_gotype.lower()[0])
+            param_goname = '{0}type'.format(param_gotype.lower()[0])
 
         # Add call to keyed union's init_fn.
-        init_fns.append('C.{}_{}(&xc, C.{}({}))'.format(ty.init_fn,
+        init_fns.append('C.{0}_{1}(&xc, C.{2}({3}))'.format(ty.init_fn,
                                                         param.name,
                                                         param_ctype,
                                                         param_goname))
 
         # Add to params list.
-        params.append('{} {}'.format(param_goname, param_gotype))
+        params.append('{0} {1}'.format(param_goname, param_gotype))
 
     # Define function
-    s += 'func New{}({}) (*{}, error) {{\n'.format(gotypename,
+    s += 'func New{0}({1}) (*{2}, error) {{\n'.format(gotypename,
                                                    ','.join(params),
                                                    gotypename)
 
     # Declare variables.
-    s += 'var (\nx {}\nxc C.{})\n\n'.format(gotypename, ctypename)
+    s += 'var (\nx {0}\nxc C.{1})\n\n'.format(gotypename, ctypename)
 
     # Write init_fn calls.
     s += '\n'.join(init_fns)
@@ -684,7 +684,7 @@ def xenlight_golang_define_constructor(ty = None):
     # Make sure dispose_fn get's called when constructor
     # returns.
     if ty.dispose_fn is not None:
-        s += 'defer C.{}(&xc)\n'.format(ty.dispose_fn)
+        s += 'defer C.{0}(&xc)\n'.format(ty.dispose_fn)
 
     s += '\n'
 
@@ -727,7 +727,7 @@ if __name__ == '__main__':
     header_comment="""// DO NOT EDIT.
 //
 // This file is generated by:
-// {}
+// {0}
 //
 
 """.format(' '.join(sys.argv))
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:12:57 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:12: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 1k0KjJ-0004Hh-1j; Tue, 28 Jul 2020 08:12:57 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0KjH-0004HY-NN
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:12:55 +0000
X-Inumbo-ID: 23378e96-d0aa-11ea-a878-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 23378e96-d0aa-11ea-a878-12813bfff9fa;
 Tue, 28 Jul 2020 08:12:54 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=q3q8Ibpo8yR6kvx+JjuRNVHaC3CP+L9k4O0BDTaxrNQ=; b=Z0+ZmzHc6fbK74T2rTbmUEOFJK
 U9KuvUuYJkVxN4RvpbDscOgGHkAbZBJ0Nx+Sv+U88U03QXGX0YsIki9ljntz4VQ7o1Z4+jF+tiHZJ
 KImcbiFaDew4EtrqD9QNJ00PLW5jZeDMsdWSH9lyxieG/EP2sbqT0ZWLe3Co27JNKssM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0KjG-0002Kf-4r
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:12:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0KjG-00035l-46
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:12:54 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] oxenstored: fix ABI breakage introduced in Xen 4.9.0
Message-Id: <E1k0KjG-00035l-46@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:12:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a6ed77f1e0334c26e6e216aea45f8674d9284856
Author:     Edwin TÃ¶rÃ¶k <edvin.torok@citrix.com>
AuthorDate: Wed Jul 15 16:10:56 2020 +0100
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jul 21 12:31:45 2020 +0000

    oxenstored: fix ABI breakage introduced in Xen 4.9.0
    
    dbc84d2983969bb47d294131ed9e6bbbdc2aec49 (Xen >= 4.9.0) deleted XS_RESTRICT
    from oxenstored, which caused all the following opcodes to be shifted by 1:
    reset_watches became off-by-one compared to the C version of xenstored.
    
    Looking at the C code the opcode for reset watches needs:
    XS_RESET_WATCHES = XS_SET_TARGET + 2
    
    So add the placeholder `Invalid` in the OCaml<->C mapping list.
    (Note that the code here doesn't simply convert the OCaml constructor to
     an integer, so we don't need to introduce a dummy constructor).
    
    Igor says that with a suitably patched xenopsd to enable watch reset,
    we now see `reset watches` during kdump of a guest in xenstored-access.log.
    
    Signed-off-by: Edwin TÃ¶rÃ¶k <edvin.torok@citrix.com>
    Tested-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/xb/op.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xb/op.ml b/tools/ocaml/libs/xb/op.ml
index d4f1f08185..9bcab0f38c 100644
--- a/tools/ocaml/libs/xb/op.ml
+++ b/tools/ocaml/libs/xb/op.ml
@@ -28,7 +28,7 @@ let operation_c_mapping =
            Transaction_end; Introduce; Release;
            Getdomainpath; Write; Mkdir; Rm;
            Setperms; Watchevent; Error; Isintroduced;
-           Resume; Set_target; Reset_watches |]
+           Resume; Set_target; Invalid; Reset_watches |]
 let size = Array.length operation_c_mapping
 
 let array_search el a =
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:13:06 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:13: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 1k0KjS-0004KG-3P; Tue, 28 Jul 2020 08:13:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0KjR-0004K8-3L
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:13:05 +0000
X-Inumbo-ID: 28ccca75-d0aa-11ea-8b19-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 28ccca75-d0aa-11ea-8b19-bc764e2007e4;
 Tue, 28 Jul 2020 08:13:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=+soCwEvy7qQLUD1VN15RTFpDg0B2cwQ1pZmzzeN18Zo=; b=VmEJNqZrtAhm1eO3gkTMpeJcoO
 CODrbQEcWQeBOayd54zogjxi2gsQIX387gD7WWcCx1aORiFm0z0KUelEqQkll+r5wxhQ2jo5gUgVW
 d47PIh4XxTfm31nSUeE0kcKnS4AIxAp9eVEqx7O9lVcG7XWAGZWQwyb8xnKMnNk3Tt68=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0KjQ-0002L0-7X
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:13:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0KjQ-00036u-6z
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:13:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools/xen-cpuid: use dashes consistently in feature names
Message-Id: <E1k0KjQ-00036u-6z@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:13:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 057cfa258ca554013178c5aaf6f80db47fb184fc
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Jul 21 14:04:59 2020 +0200
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jul 21 12:38:26 2020 +0000

    tools/xen-cpuid: use dashes consistently in feature names
    
    We've grown to a mix of dashes and underscores - switch to consistent
    naming in the hope that future additions will play by this.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Wei Liu <wl@xen.org>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/misc/xen-cpuid.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index f4bf88e2fa..ac3548dcfe 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -75,7 +75,7 @@ static const char *const str_e1d[32] =
 
 static const char *const str_e1c[32] =
 {
-    [ 0] = "lahf_lm",    [ 1] = "cmp",
+    [ 0] = "lahf-lm",    [ 1] = "cmp",
     [ 2] = "svm",        [ 3] = "extapic",
     [ 4] = "cr8d",       [ 5] = "lzcnt",
     [ 6] = "sse4a",      [ 7] = "msse",
@@ -86,10 +86,10 @@ static const char *const str_e1c[32] =
     [16] = "fma4",       [17] = "tce",
     /* [18] */           [19] = "nodeid",
     /* [20] */           [21] = "tbm",
-    [22] = "topoext",    [23] = "perfctr_core",
-    [24] = "perfctr_nb", /* [25] */
+    [22] = "topoext",    [23] = "perfctr-core",
+    [24] = "perfctr-nb", /* [25] */
     [26] = "dbx",        [27] = "perftsc",
-    [28] = "pcx_l2i",    [29] = "monitorx",
+    [28] = "pcx-l2i",    [29] = "monitorx",
 };
 
 static const char *const str_7b0[32] =
@@ -97,7 +97,7 @@ static const char *const str_7b0[32] =
     [ 0] = "fsgsbase", [ 1] = "tsc-adj",
     [ 2] = "sgx",      [ 3] = "bmi1",
     [ 4] = "hle",      [ 5] = "avx2",
-    [ 6] = "fdp_exn",  [ 7] = "smep",
+    [ 6] = "fdp-exn",  [ 7] = "smep",
     [ 8] = "bmi2",     [ 9] = "erms",
     [10] = "invpcid",  [11] = "rtm",
     [12] = "pqm",      [13] = "depfpp",
@@ -120,21 +120,21 @@ static const char *const str_Da1[32] =
 
 static const char *const str_7c0[32] =
 {
-    [ 0] = "prefetchwt1",      [ 1] = "avx512_vbmi",
+    [ 0] = "prefetchwt1",      [ 1] = "avx512-vbmi",
     [ 2] = "umip",             [ 3] = "pku",
     [ 4] = "ospke",            [ 5] = "waitpkg",
-    [ 6] = "avx512_vbmi2",     [ 7] = "cet-ss",
+    [ 6] = "avx512-vbmi2",     [ 7] = "cet-ss",
     [ 8] = "gfni",             [ 9] = "vaes",
-    [10] = "vpclmulqdq",       [11] = "avx512_vnni",
-    [12] = "avx512_bitalg",
-    [14] = "avx512_vpopcntdq",
+    [10] = "vpclmulqdq",       [11] = "avx512-vnni",
+    [12] = "avx512-bitalg",
+    [14] = "avx512-vpopcntdq",
     [16] = "tsxldtrk",
 
     [22] = "rdpid",
     /* 24 */                   [25] = "cldemote",
     /* 26 */                   [27] = "movdiri",
     [28] = "movdir64b",
-    [30] = "sgx_lc",
+    [30] = "sgx-lc",
 };
 
 static const char *const str_e7d[32] =
@@ -157,7 +157,7 @@ static const char *const str_e8b[32] =
 
 static const char *const str_7d0[32] =
 {
-    [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
+    [ 2] = "avx512-4vnniw", [ 3] = "avx512-4fmaps",
     [ 4] = "fsrm",
 
     [ 8] = "avx512-vp2intersect", [ 9] = "srbds-ctrl",
@@ -169,13 +169,13 @@ static const char *const str_7d0[32] =
     [20] = "cet-ibt",
 
     [26] = "ibrsb",         [27] = "stibp",
-    [28] = "l1d_flush",     [29] = "arch_caps",
-    [30] = "core_caps",     [31] = "ssbd",
+    [28] = "l1d-flush",     [29] = "arch-caps",
+    [30] = "core-caps",     [31] = "ssbd",
 };
 
 static const char *const str_7a1[32] =
 {
-    /* 4 */                 [ 5] = "avx512_bf16",
+    /* 4 */                 [ 5] = "avx512-bf16",
 };
 
 static const struct {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:13:17 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:13: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 1k0Kjd-0004LS-5B; Tue, 28 Jul 2020 08:13:17 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0Kjb-0004LH-7Q
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:13:15 +0000
X-Inumbo-ID: 2f3cdb56-d0aa-11ea-a878-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 2f3cdb56-d0aa-11ea-a878-12813bfff9fa;
 Tue, 28 Jul 2020 08:13:14 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=0YjnodA2ORZHUaltQR2/NpNTJYfKeM0pBub5obbeeNc=; b=nQyyi1WHuaFhQOkCjJJqG3+4eJ
 vtFM7EE21YbKAsnYIw/LMv7IJi5dy6HCVh2mUP7U/rsun+M0/QPv9feByzmOQeEDYWgjIW9UCTX3k
 ntzGIujjHykJOW7SrlzH1vEZ/B6gdhJYwklIuJ5k3KXSZD4p1BE6h3UBOzAPS1krJg4s=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kja-0002L8-AM
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:13:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kja-000385-9e
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:13:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools: Partially revert "Cross-compilation fixes."
Message-Id: <E1k0Kja-000385-9e@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:13:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 69953e2856382274749b617125cc98ce38198463
Author:     Elliott Mitchell <ehem+xen@m5p.com>
AuthorDate: Fri Jul 17 20:31:21 2020 -0700
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jul 21 14:48:49 2020 +0000

    tools: Partially revert "Cross-compilation fixes."
    
    This partially reverts commit 16504669c5cbb8b195d20412aadc838da5c428f7.
    
    Doesn't look like much of 16504669c5cbb8b195d20412aadc838da5c428f7
    actually remains due to passage of time.
    
    Of the 3, both Python and pygrub appear to mostly be building just fine
    cross-compiling.  The OCAML portion is being troublesome, this is going
    to cause bug reports elsewhere soon.  The OCAML portion though can
    already be disabled by setting OCAML_TOOLS=n and shouldn't have this
    extra form of disabling.
    
    Signed-off-by: Elliott Mitchell <ehem+xen@m5p.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    Acked-by: Wei Liu <wl@xen.org>
---
 tools/Makefile | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index c10946e3b1..198b239edc 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -39,12 +39,9 @@ SUBDIRS-$(CONFIG_X86) += debugger/gdbsx
 SUBDIRS-$(CONFIG_X86) += debugger/kdd
 SUBDIRS-$(CONFIG_TESTS) += tests
 
-# These don't cross-compile
-ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
 SUBDIRS-y += python
 SUBDIRS-y += pygrub
 SUBDIRS-$(OCAML_TOOLS) += ocaml
-endif
 
 ifeq ($(CONFIG_RUMP),y)
 SUBDIRS-y := libs libxc xenstore
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:13:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:13: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 1k0Kjm-0004Mn-6i; Tue, 28 Jul 2020 08:13:26 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0Kjl-0004MB-73
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:13:25 +0000
X-Inumbo-ID: 3540df20-d0aa-11ea-a878-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3540df20-d0aa-11ea-a878-12813bfff9fa;
 Tue, 28 Jul 2020 08:13:24 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=tY9zwbc7NQdatH/no90dyDAdmXMbubotrjAAJu2Yhtw=; b=fpWT/scGA7Rguc8bS13WSdOWqP
 nf0ekYjS0fot5aWig5Q7oZ9MqJBB2Ls8aechNfVrHPNJEClIpco/Aq8OI+dRpTZe0xGbDVFQAb0i4
 oPqYzEy9MfEjLsff0AF4Wt6pQkhUy5Af4Em4OEgxZIGTo0DMtijyLxSZElE1wOogC6N8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kjk-0002LJ-DI
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:13:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kjk-00038l-CT
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:13:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] tools/ocaml: Default to useful build output
Message-Id: <E1k0Kjk-00038l-CT@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:13:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit f3885e8c3ceaef101e466466e879e97103ecce18
Author:     Elliott Mitchell <ehem+xen@m5p.com>
AuthorDate: Fri Jul 17 20:32:42 2020 -0700
Commit:     Wei Liu <wl@xen.org>
CommitDate: Tue Jul 21 14:49:36 2020 +0000

    tools/ocaml: Default to useful build output
    
    While hiding details of build output looks pretty to some, defaulting to
    doing so deviates from the rest of Xen.  Switch the OCAML tools to match
    everything else.
    
    Signed-off-by: Elliott Mitchell <ehem+xen@m5p.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/Makefile.rules | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index a893c42b43..abfbc64ce0 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -1,17 +1,20 @@
 ifdef V
-  ifeq ("$(origin V)", "command line")
-    BUILD_VERBOSE = $(V)
-  endif
+	ifeq ("$(origin V)", "command line")
+		BUILD_VERBOSE = $(V)
+	endif
+else
+	V := 1
+	BUILD_VERBOSE := 1
 endif
 ifndef BUILD_VERBOSE
-  BUILD_VERBOSE = 0
+	BUILD_VERBOSE := 0
 endif
 ifeq ($(BUILD_VERBOSE),1)
-  E = @true
-  Q =
+	E := @true
+	Q :=
 else
-  E = @echo
-  Q = @
+	E := @echo
+	Q := @
 endif
 
 .NOTPARALLEL:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:13:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:13: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 1k0Kjx-0004O3-8V; Tue, 28 Jul 2020 08:13:37 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0Kjv-0004Ns-O9
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:13:35 +0000
X-Inumbo-ID: 3b450d38-d0aa-11ea-a878-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3b450d38-d0aa-11ea-a878-12813bfff9fa;
 Tue, 28 Jul 2020 08:13:34 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=uYL0Rum8BzMYfmWcFhhHRUI78nrNl6cUi/cIjtlcOsQ=; b=fhc0Wi0A0vN4PISfGf8Brp+d+e
 xUcuba/Em9nE5i7OKbmu+V27gLiThC3X5k0BTAchCDZo7s7R4OvLMZ2ypjYBlR9Ofn7b/25VlMZnS
 z1iaXbDX57c7A0XUEnqn61lbPCkW9bXXPvzYY5SSt+nLMfuFHqsHbR8+0zSG2cJMyvPo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kju-0002LQ-GK
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:13:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kju-00039M-Fb
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:13:34 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/svm: Fold nsvm_{wr, rd}msr() into svm_msr_{read,
 write}_intercept()
Message-Id: <E1k0Kju-00039M-Fb@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:13:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 26707b747feb5d707f659989c0f8f2e847e8020a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 10 11:58:03 2018 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jul 22 15:10:57 2020 +0100

    x86/svm: Fold nsvm_{wr,rd}msr() into svm_msr_{read,write}_intercept()
    
    ... to simplify the default cases.
    
    There are multiple errors with the handling of these three MSRs, but they are
    deliberately not addressed at this point.
    
    This removes the dance converting -1/0/1 into X86EMUL_*, allowing for the
    removal of the 'ret' variable.
    
    While cleaning this up, drop the gdprintk()'s for #GP conditions, and the
    'result' variable from svm_msr_write_intercept() as it is never modified.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/svm/nestedsvm.c        | 77 ---------------------------------
 xen/arch/x86/hvm/svm/svm.c              | 46 +++++++++++++-------
 xen/include/asm-x86/hvm/svm/nestedsvm.h |  4 --
 3 files changed, 31 insertions(+), 96 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index 11dc9c089c..a193d9de45 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -47,22 +47,6 @@ nestedsvm_vcpu_stgi(struct vcpu *v)
     local_event_delivery_enable(); /* unmask events for PV drivers */
 }
 
-static int
-nestedsvm_vmcb_isvalid(struct vcpu *v, uint64_t vmcxaddr)
-{
-    /* Address must be 4k aligned */
-    if ( (vmcxaddr & ~PAGE_MASK) != 0 )
-        return 0;
-
-    /* Maximum valid physical address.
-     * See AMD BKDG for HSAVE_PA MSR.
-     */
-    if ( vmcxaddr > 0xfd00000000ULL )
-        return 0;
-
-    return 1;
-}
-
 int nestedsvm_vmcb_map(struct vcpu *v, uint64_t vmcbaddr)
 {
     struct nestedvcpu *nv = &vcpu_nestedhvm(v);
@@ -1263,67 +1247,6 @@ enum hvm_intblk nsvm_intr_blocked(struct vcpu *v)
     return hvm_intblk_none;
 }
 
-/* MSR handling */
-int nsvm_rdmsr(struct vcpu *v, unsigned int msr, uint64_t *msr_content)
-{
-    struct nestedsvm *svm = &vcpu_nestedsvm(v);
-    int ret = 1;
-
-    *msr_content = 0;
-
-    switch (msr) {
-    case MSR_K8_VM_CR:
-        break;
-    case MSR_K8_VM_HSAVE_PA:
-        *msr_content = svm->ns_msr_hsavepa;
-        break;
-    case MSR_AMD64_TSC_RATIO:
-        *msr_content = svm->ns_tscratio;
-        break;
-    default:
-        ret = 0;
-        break;
-    }
-
-    return ret;
-}
-
-int nsvm_wrmsr(struct vcpu *v, unsigned int msr, uint64_t msr_content)
-{
-    int ret = 1;
-    struct nestedsvm *svm = &vcpu_nestedsvm(v);
-
-    switch (msr) {
-    case MSR_K8_VM_CR:
-        /* ignore write. handle all bits as read-only. */
-        break;
-    case MSR_K8_VM_HSAVE_PA:
-        if (!nestedsvm_vmcb_isvalid(v, msr_content)) {
-            gdprintk(XENLOG_ERR,
-                "MSR_K8_VM_HSAVE_PA value invalid %#"PRIx64"\n", msr_content);
-            ret = -1; /* inject #GP */
-            break;
-        }
-        svm->ns_msr_hsavepa = msr_content;
-        break;
-    case MSR_AMD64_TSC_RATIO:
-        if ((msr_content & ~TSC_RATIO_RSVD_BITS) != msr_content) {
-            gdprintk(XENLOG_ERR,
-                "reserved bits set in MSR_AMD64_TSC_RATIO %#"PRIx64"\n",
-                msr_content);
-            ret = -1; /* inject #GP */
-            break;
-        }
-        svm->ns_tscratio = msr_content;
-        break;
-    default:
-        ret = 0;
-        break;
-    }
-
-    return ret;
-}
-
 /* VMEXIT emulation */
 void
 nestedsvm_vmexit_defer(struct vcpu *v,
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 4eb41792e2..bbe73744b8 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1788,10 +1788,10 @@ static void svm_dr_access(struct vcpu *v, struct cpu_user_regs *regs)
 
 static int svm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
 {
-    int ret;
     struct vcpu *v = current;
     const struct domain *d = v->domain;
     struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
+    const struct nestedsvm *nsvm = &vcpu_nestedsvm(v);
 
     switch ( msr )
     {
@@ -1914,6 +1914,18 @@ static int svm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
             goto gpf;
         break;
 
+    case MSR_K8_VM_CR:
+        *msr_content = 0;
+        break;
+
+    case MSR_K8_VM_HSAVE_PA:
+        *msr_content = nsvm->ns_msr_hsavepa;
+        break;
+
+    case MSR_AMD64_TSC_RATIO:
+        *msr_content = nsvm->ns_tscratio;
+        break;
+
     case MSR_AMD_OSVW_ID_LENGTH:
     case MSR_AMD_OSVW_STATUS:
         if ( !d->arch.cpuid->extd.osvw )
@@ -1922,12 +1934,6 @@ static int svm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
         break;
 
     default:
-        ret = nsvm_rdmsr(v, msr, msr_content);
-        if ( ret < 0 )
-            goto gpf;
-        else if ( ret )
-            break;
-
         if ( rdmsr_safe(msr, *msr_content) == 0 )
             break;
 
@@ -1956,10 +1962,10 @@ static int svm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
 
 static int svm_msr_write_intercept(unsigned int msr, uint64_t msr_content)
 {
-    int ret, result = X86EMUL_OKAY;
     struct vcpu *v = current;
     struct domain *d = v->domain;
     struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
+    struct nestedsvm *nsvm = &vcpu_nestedsvm(v);
 
     switch ( msr )
     {
@@ -2085,6 +2091,22 @@ static int svm_msr_write_intercept(unsigned int msr, uint64_t msr_content)
             goto gpf;
         break;
 
+    case MSR_K8_VM_CR:
+        /* ignore write. handle all bits as read-only. */
+        break;
+
+    case MSR_K8_VM_HSAVE_PA:
+        if ( (msr_content & ~PAGE_MASK) || msr_content > 0xfd00000000ULL )
+            goto gpf;
+        nsvm->ns_msr_hsavepa = msr_content;
+        break;
+
+    case MSR_AMD64_TSC_RATIO:
+        if ( msr_content & TSC_RATIO_RSVD_BITS )
+            goto gpf;
+        nsvm->ns_tscratio = msr_content;
+        break;
+
     case MSR_IA32_MCx_MISC(4): /* Threshold register */
     case MSR_F10_MC4_MISC1 ... MSR_F10_MC4_MISC3:
         /*
@@ -2102,12 +2124,6 @@ static int svm_msr_write_intercept(unsigned int msr, uint64_t msr_content)
         break;
 
     default:
-        ret = nsvm_wrmsr(v, msr, msr_content);
-        if ( ret < 0 )
-            goto gpf;
-        else if ( ret )
-            break;
-
         /* Match up with the RDMSR side; ultimately this should go away. */
         if ( rdmsr_safe(msr, msr_content) == 0 )
             break;
@@ -2115,7 +2131,7 @@ static int svm_msr_write_intercept(unsigned int msr, uint64_t msr_content)
         goto gpf;
     }
 
-    return result;
+    return X86EMUL_OKAY;
 
  gpf:
     return X86EMUL_EXCEPTION;
diff --git a/xen/include/asm-x86/hvm/svm/nestedsvm.h b/xen/include/asm-x86/hvm/svm/nestedsvm.h
index 31fb4bfeb4..0873698457 100644
--- a/xen/include/asm-x86/hvm/svm/nestedsvm.h
+++ b/xen/include/asm-x86/hvm/svm/nestedsvm.h
@@ -118,10 +118,6 @@ bool_t nsvm_vmcb_guest_intercepts_event(
 bool_t nsvm_vmcb_hap_enabled(struct vcpu *v);
 enum hvm_intblk nsvm_intr_blocked(struct vcpu *v);
 
-/* MSRs */
-int nsvm_rdmsr(struct vcpu *v, unsigned int msr, uint64_t *msr_content);
-int nsvm_wrmsr(struct vcpu *v, unsigned int msr, uint64_t msr_content);
-
 /* Interrupts, vGIF */
 void svm_vmexit_do_clgi(struct cpu_user_regs *regs, struct vcpu *v);
 void svm_vmexit_do_stgi(struct cpu_user_regs *regs, struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:13:49 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:13: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 1k0Kk9-0004PB-AE; Tue, 28 Jul 2020 08:13:49 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0Kk7-0004Oy-9P
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:13:47 +0000
X-Inumbo-ID: 4148b8ce-d0aa-11ea-8b19-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4148b8ce-d0aa-11ea-8b19-bc764e2007e4;
 Tue, 28 Jul 2020 08:13:44 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=5LVhKSKI5C9gve1clUTa1TCxP5tr16VMuS1Orl8UMdA=; b=yhv48k2j0m5DsUsNpqVQZ2XVzo
 99s0Of/DK4jiDCjfJO7RocdskHCw6J3f32A+pcQCpP9Cd1M7+/zEM8xsQW05cERoly+spbFtfWi1i
 HWGDt1BANYNbmlaMtAmBctGylSPrf6hhh3i0PbcWi8yEXnlAcpABTqh9nWtI8GXy/0jI=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kk4-0002LY-JS
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:13:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kk4-00039w-Il
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:13:44 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/svm: Misc coding style corrections
Message-Id: <E1k0Kk4-00039w-Il@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:13:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ffe4f0fe17b5288e0c19955cd1ba589e6db1b0fe
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 7 15:35:54 2020 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jul 23 10:43:57 2020 +0100

    x86/svm: Misc coding style corrections
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/svm/intr.c      |  19 ++-
 xen/arch/x86/hvm/svm/nestedsvm.c | 291 +++++++++++++++++++++++----------------
 xen/arch/x86/hvm/svm/svm.c       |  76 +++++-----
 3 files changed, 225 insertions(+), 161 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/intr.c b/xen/arch/x86/hvm/svm/intr.c
index 38011bd4e2..7f815d2307 100644
--- a/xen/arch/x86/hvm/svm/intr.c
+++ b/xen/arch/x86/hvm/svm/intr.c
@@ -1,6 +1,6 @@
 /*
  * intr.c: Interrupt handling for SVM.
- * Copyright (c) 2005, AMD Inc. 
+ * Copyright (c) 2005, AMD Inc.
  * Copyright (c) 2004, Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -83,9 +83,12 @@ static void svm_enable_intr_window(struct vcpu *v, struct hvm_intack intack)
 
     ASSERT(intack.source != hvm_intsrc_none);
 
-    if ( nestedhvm_enabled(v->domain) ) {
+    if ( nestedhvm_enabled(v->domain) )
+    {
         struct nestedvcpu *nv = &vcpu_nestedhvm(v);
-        if ( nv->nv_vmentry_pending ) {
+
+        if ( nv->nv_vmentry_pending )
+        {
             struct vmcb_struct *gvmcb = nv->nv_vvmcx;
 
             /* check if l1 guest injects interrupt into l2 guest via vintr.
@@ -131,7 +134,7 @@ static void svm_enable_intr_window(struct vcpu *v, struct hvm_intack intack)
         vmcb, general1_intercepts | GENERAL1_INTERCEPT_VINTR);
 }
 
-void svm_intr_assist(void) 
+void svm_intr_assist(void)
 {
     struct vcpu *v = current;
     struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
@@ -151,7 +154,8 @@ void svm_intr_assist(void)
             return;
 
         intblk = hvm_interrupt_blocked(v, intack);
-        if ( intblk == hvm_intblk_svm_gif ) {
+        if ( intblk == hvm_intblk_svm_gif )
+        {
             ASSERT(nestedhvm_enabled(v->domain));
             return;
         }
@@ -167,10 +171,11 @@ void svm_intr_assist(void)
              * the l1 guest occurred.
              */
             rc = nestedsvm_vcpu_interrupt(v, intack);
-            switch (rc) {
+            switch ( rc )
+            {
             case NSVM_INTR_NOTINTERCEPTED:
                 /* Inject interrupt into 2nd level guest directly. */
-                break;	
+                break;
             case NSVM_INTR_NOTHANDLED:
             case NSVM_INTR_FORCEVMEXIT:
                 return;
diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index a193d9de45..fcfccf75df 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -30,7 +30,7 @@
 
 #define NSVM_ERROR_VVMCB        1
 #define NSVM_ERROR_VMENTRY      2
- 
+
 static void
 nestedsvm_vcpu_clgi(struct vcpu *v)
 {
@@ -51,7 +51,8 @@ int nestedsvm_vmcb_map(struct vcpu *v, uint64_t vmcbaddr)
 {
     struct nestedvcpu *nv = &vcpu_nestedhvm(v);
 
-    if (nv->nv_vvmcx != NULL && nv->nv_vvmcxaddr != vmcbaddr) {
+    if ( nv->nv_vvmcx != NULL && nv->nv_vvmcxaddr != vmcbaddr )
+    {
         ASSERT(vvmcx_valid(v));
         hvm_unmap_guest_frame(nv->nv_vvmcx, 1);
         nv->nv_vvmcx = NULL;
@@ -87,24 +88,24 @@ int nsvm_vcpu_initialise(struct vcpu *v)
 
     msrpm = alloc_xenheap_pages(get_order_from_bytes(MSRPM_SIZE), 0);
     svm->ns_cached_msrpm = msrpm;
-    if (msrpm == NULL)
+    if ( msrpm == NULL )
         goto err;
     memset(msrpm, 0x0, MSRPM_SIZE);
 
     msrpm = alloc_xenheap_pages(get_order_from_bytes(MSRPM_SIZE), 0);
     svm->ns_merged_msrpm = msrpm;
-    if (msrpm == NULL)
+    if ( msrpm == NULL )
         goto err;
     memset(msrpm, 0x0, MSRPM_SIZE);
 
     nv->nv_n2vmcx = alloc_vmcb();
-    if (nv->nv_n2vmcx == NULL)
+    if ( nv->nv_n2vmcx == NULL )
         goto err;
     nv->nv_n2vmcx_pa = virt_to_maddr(nv->nv_n2vmcx);
 
     return 0;
 
-err:
+ err:
     nsvm_vcpu_destroy(v);
     return -ENOMEM;
 }
@@ -120,28 +121,33 @@ void nsvm_vcpu_destroy(struct vcpu *v)
      * in order to avoid double free of l2 vmcb and the possible memory leak
      * of l1 vmcb page.
      */
-    if (nv->nv_n1vmcx)
+    if ( nv->nv_n1vmcx )
         v->arch.hvm.svm.vmcb = nv->nv_n1vmcx;
 
-    if (svm->ns_cached_msrpm) {
+    if ( svm->ns_cached_msrpm )
+    {
         free_xenheap_pages(svm->ns_cached_msrpm,
                            get_order_from_bytes(MSRPM_SIZE));
         svm->ns_cached_msrpm = NULL;
     }
-    if (svm->ns_merged_msrpm) {
+
+    if ( svm->ns_merged_msrpm )
+    {
         free_xenheap_pages(svm->ns_merged_msrpm,
                            get_order_from_bytes(MSRPM_SIZE));
         svm->ns_merged_msrpm = NULL;
     }
+
     hvm_unmap_guest_frame(nv->nv_vvmcx, 1);
     nv->nv_vvmcx = NULL;
-    if (nv->nv_n2vmcx) {
+    if ( nv->nv_n2vmcx )
+    {
         free_vmcb(nv->nv_n2vmcx);
         nv->nv_n2vmcx = NULL;
         nv->nv_n2vmcx_pa = INVALID_PADDR;
     }
-    if (svm->ns_iomap)
-        svm->ns_iomap = NULL;
+
+    svm->ns_iomap = NULL;
 }
 
 int nsvm_vcpu_reset(struct vcpu *v)
@@ -168,8 +174,7 @@ int nsvm_vcpu_reset(struct vcpu *v)
     svm->ns_vmexit.exitinfo1 = 0;
     svm->ns_vmexit.exitinfo2 = 0;
 
-    if (svm->ns_iomap)
-        svm->ns_iomap = NULL;
+    svm->ns_iomap = NULL;
 
     nestedsvm_vcpu_stgi(v);
     return 0;
@@ -182,15 +187,21 @@ static uint64_t nestedsvm_fpu_vmentry(uint64_t n1cr0,
     uint64_t vcr0;
 
     vcr0 = vvmcb->_cr0;
-    if ( !(n1cr0 & X86_CR0_TS) && (n1vmcb->_cr0 & X86_CR0_TS) ) {
-        /* svm_fpu_leave() run while l1 guest was running.
+    if ( !(n1cr0 & X86_CR0_TS) && (n1vmcb->_cr0 & X86_CR0_TS) )
+    {
+        /*
+         * svm_fpu_leave() run while l1 guest was running.
          * Sync FPU state with l2 guest.
          */
         vcr0 |= X86_CR0_TS;
         n2vmcb->_exception_intercepts |= (1U << TRAP_no_device);
-    } else if ( !(vcr0 & X86_CR0_TS) && (n2vmcb->_cr0 & X86_CR0_TS) ) {
-        /* svm_fpu_enter() run while l1 guest was running.
-         * Sync FPU state with l2 guest. */
+    }
+    else if ( !(vcr0 & X86_CR0_TS) && (n2vmcb->_cr0 & X86_CR0_TS) )
+    {
+        /*
+         * svm_fpu_enter() run while l1 guest was running.
+         * Sync FPU state with l2 guest.
+         */
         vcr0 &= ~X86_CR0_TS;
         n2vmcb->_exception_intercepts &= ~(1U << TRAP_no_device);
     }
@@ -201,14 +212,21 @@ static uint64_t nestedsvm_fpu_vmentry(uint64_t n1cr0,
 static void nestedsvm_fpu_vmexit(struct vmcb_struct *n1vmcb,
     struct vmcb_struct *n2vmcb, uint64_t n1cr0, uint64_t guest_cr0)
 {
-    if ( !(guest_cr0 & X86_CR0_TS) && (n2vmcb->_cr0 & X86_CR0_TS) ) {
-        /* svm_fpu_leave() run while l2 guest was running.
-         * Sync FPU state with l1 guest. */
+    if ( !(guest_cr0 & X86_CR0_TS) && (n2vmcb->_cr0 & X86_CR0_TS) )
+    {
+        /*
+         * svm_fpu_leave() run while l2 guest was running.
+         * Sync FPU state with l1 guest.
+         */
         n1vmcb->_cr0 |= X86_CR0_TS;
         n1vmcb->_exception_intercepts |= (1U << TRAP_no_device);
-    } else if ( !(n1cr0 & X86_CR0_TS) && (n1vmcb->_cr0 & X86_CR0_TS) ) {
-        /* svm_fpu_enter() run while l2 guest was running.
-         * Sync FPU state with l1 guest. */
+    }
+    else if ( !(n1cr0 & X86_CR0_TS) && (n1vmcb->_cr0 & X86_CR0_TS) )
+    {
+        /*
+         * svm_fpu_enter() run while l2 guest was running.
+         * Sync FPU state with l1 guest.
+         */
         n1vmcb->_cr0 &= ~X86_CR0_TS;
         n1vmcb->_exception_intercepts &= ~(1U << TRAP_no_device);
     }
@@ -225,16 +243,17 @@ static int nsvm_vcpu_hostsave(struct vcpu *v, unsigned int inst_len)
 
     n1vmcb->rip += inst_len;
 
-    /* Save shadowed values. This ensures that the l1 guest
-     * cannot override them to break out. */
+    /*
+     * Save shadowed values. This ensures that the l1 guest
+     * cannot override them to break out.
+     */
     n1vmcb->_efer = v->arch.hvm.guest_efer;
     n1vmcb->_cr0 = v->arch.hvm.guest_cr[0];
     n1vmcb->_cr2 = v->arch.hvm.guest_cr[2];
     n1vmcb->_cr4 = v->arch.hvm.guest_cr[4];
 
     /* Remember the host interrupt flag */
-    svm->ns_hostflags.fields.rflagsif =
-        (n1vmcb->rflags & X86_EFLAGS_IF) ? 1 : 0;
+    svm->ns_hostflags.fields.rflagsif = !!(n1vmcb->rflags & X86_EFLAGS_IF);
 
     return 0;
 }
@@ -251,7 +270,8 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
     ASSERT(n1vmcb != NULL);
     ASSERT(n2vmcb != NULL);
 
-    /* nsvm_vmcb_prepare4vmexit() already saved register values
+    /*
+     * nsvm_vmcb_prepare4vmexit() already saved register values
      * handled by VMSAVE/VMLOAD into n1vmcb directly.
      */
 
@@ -264,7 +284,7 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
     rc = hvm_set_efer(n1vmcb->_efer);
     if ( rc == X86EMUL_EXCEPTION )
         hvm_inject_hw_exception(TRAP_gp_fault, 0);
-    if (rc != X86EMUL_OKAY)
+    if ( rc != X86EMUL_OKAY )
         gdprintk(XENLOG_ERR, "hvm_set_efer failed, rc: %u\n", rc);
 
     /* CR4 */
@@ -272,7 +292,7 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
     rc = hvm_set_cr4(n1vmcb->_cr4, true);
     if ( rc == X86EMUL_EXCEPTION )
         hvm_inject_hw_exception(TRAP_gp_fault, 0);
-    if (rc != X86EMUL_OKAY)
+    if ( rc != X86EMUL_OKAY )
         gdprintk(XENLOG_ERR, "hvm_set_cr4 failed, rc: %u\n", rc);
 
     /* CR0 */
@@ -283,7 +303,7 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
     rc = hvm_set_cr0(n1vmcb->_cr0 | X86_CR0_PE, true);
     if ( rc == X86EMUL_EXCEPTION )
         hvm_inject_hw_exception(TRAP_gp_fault, 0);
-    if (rc != X86EMUL_OKAY)
+    if ( rc != X86EMUL_OKAY )
         gdprintk(XENLOG_ERR, "hvm_set_cr0 failed, rc: %u\n", rc);
     svm->ns_cr0 = v->arch.hvm.guest_cr[0];
 
@@ -293,17 +313,22 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
 
     /* CR3 */
     /* Nested paging mode */
-    if (nestedhvm_paging_mode_hap(v)) {
+    if ( nestedhvm_paging_mode_hap(v) )
+    {
         /* host nested paging + guest nested paging. */
         /* hvm_set_cr3() below sets v->arch.hvm.guest_cr[3] for us. */
-    } else if (paging_mode_hap(v->domain)) {
+    }
+    else if ( paging_mode_hap(v->domain) )
+    {
         /* host nested paging + guest shadow paging. */
         /* hvm_set_cr3() below sets v->arch.hvm.guest_cr[3] for us. */
-    } else {
+    }
+    else
+    {
         /* host shadow paging + guest shadow paging. */
 
         /* Reset MMU context  -- XXX (hostrestore) not yet working*/
-        if (!pagetable_is_null(v->arch.guest_table))
+        if ( !pagetable_is_null(v->arch.guest_table) )
             put_page(pagetable_get_page(v->arch.guest_table));
         v->arch.guest_table = pagetable_null();
         /* hvm_set_cr3() below sets v->arch.hvm.guest_cr[3] for us. */
@@ -311,7 +336,7 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
     rc = hvm_set_cr3(n1vmcb->_cr3, false, true);
     if ( rc == X86EMUL_EXCEPTION )
         hvm_inject_hw_exception(TRAP_gp_fault, 0);
-    if (rc != X86EMUL_OKAY)
+    if ( rc != X86EMUL_OKAY )
         gdprintk(XENLOG_ERR, "hvm_set_cr3 failed, rc: %u\n", rc);
 
     regs->rax = n1vmcb->rax;
@@ -321,7 +346,8 @@ static int nsvm_vcpu_hostrestore(struct vcpu *v, struct cpu_user_regs *regs)
     n1vmcb->_dr7 = 0; /* disable all breakpoints */
     n1vmcb->_cpl = 0;
 
-    /* Clear exitintinfo to prevent a fault loop of re-injecting
+    /*
+     * Clear exitintinfo to prevent a fault loop of re-injecting
      * exceptions forever.
      */
     n1vmcb->exit_int_info.raw = 0;
@@ -375,13 +401,11 @@ static int nsvm_vmrun_permissionmap(struct vcpu *v, bool_t viopm)
     nv->nv_ioportED = ioport_ed;
 
     /* v->arch.hvm.svm.msrpm has type unsigned long, thus BYTES_PER_LONG. */
-    for (i = 0; i < MSRPM_SIZE / BYTES_PER_LONG; i++)
+    for ( i = 0; i < MSRPM_SIZE / BYTES_PER_LONG; i++ )
         svm->ns_merged_msrpm[i] = arch_svm->msrpm[i] | ns_msrpm_ptr[i];
 
-    host_vmcb->_iopm_base_pa =
-        (uint64_t)virt_to_maddr(svm->ns_iomap);
-    host_vmcb->_msrpm_base_pa =
-        (uint64_t)virt_to_maddr(svm->ns_merged_msrpm);
+    host_vmcb->_iopm_base_pa  = virt_to_maddr(svm->ns_iomap);
+    host_vmcb->_msrpm_base_pa = virt_to_maddr(svm->ns_merged_msrpm);
 
     return 0;
 }
@@ -438,7 +462,7 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
      * below. Those cleanbits would be tracked in an integer field
      * in struct nestedsvm.
      * But this effort is not worth doing because:
-     * - Only the intercepts bit of the n1vmcb can effectively be used here 
+     * - Only the intercepts bit of the n1vmcb can effectively be used here
      * - The CPU runs more instructions for the tracking than can be
      *   safed here.
      * The overhead comes from (ordered from highest to lowest):
@@ -462,7 +486,7 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
         n1vmcb->_general2_intercepts | ns_vmcb->_general2_intercepts;
 
     /* Nested Pause Filter */
-    if (ns_vmcb->_general1_intercepts & GENERAL1_INTERCEPT_PAUSE)
+    if ( ns_vmcb->_general1_intercepts & GENERAL1_INTERCEPT_PAUSE )
         n2vmcb->_pause_filter_count =
             min(n1vmcb->_pause_filter_count, ns_vmcb->_pause_filter_count);
     else
@@ -473,7 +497,7 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
 
     /* Nested IO permission bitmaps */
     rc = nsvm_vmrun_permissionmap(v, clean.iopm);
-    if (rc)
+    if ( rc )
         return rc;
 
     /* ASID - Emulation handled in hvm_asid_handle_vmenter() */
@@ -534,7 +558,7 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
     rc = hvm_set_efer(ns_vmcb->_efer);
     if ( rc == X86EMUL_EXCEPTION )
         hvm_inject_hw_exception(TRAP_gp_fault, 0);
-    if (rc != X86EMUL_OKAY)
+    if ( rc != X86EMUL_OKAY )
         gdprintk(XENLOG_ERR, "hvm_set_efer failed, rc: %u\n", rc);
 
     /* CR4 */
@@ -542,7 +566,7 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
     rc = hvm_set_cr4(ns_vmcb->_cr4, true);
     if ( rc == X86EMUL_EXCEPTION )
         hvm_inject_hw_exception(TRAP_gp_fault, 0);
-    if (rc != X86EMUL_OKAY)
+    if ( rc != X86EMUL_OKAY )
         gdprintk(XENLOG_ERR, "hvm_set_cr4 failed, rc: %u\n", rc);
 
     /* CR0 */
@@ -552,7 +576,7 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
     rc = hvm_set_cr0(cr0, true);
     if ( rc == X86EMUL_EXCEPTION )
         hvm_inject_hw_exception(TRAP_gp_fault, 0);
-    if (rc != X86EMUL_OKAY)
+    if ( rc != X86EMUL_OKAY )
         gdprintk(XENLOG_ERR, "hvm_set_cr0 failed, rc: %u\n", rc);
 
     /* CR2 */
@@ -560,7 +584,8 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
     hvm_update_guest_cr(v, 2);
 
     /* Nested paging mode */
-    if (nestedhvm_paging_mode_hap(v)) {
+    if ( nestedhvm_paging_mode_hap(v) )
+    {
         /* host nested paging + guest nested paging. */
         n2vmcb->_np_enable = 1;
 
@@ -570,9 +595,11 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
         rc = hvm_set_cr3(ns_vmcb->_cr3, false, true);
         if ( rc == X86EMUL_EXCEPTION )
             hvm_inject_hw_exception(TRAP_gp_fault, 0);
-        if (rc != X86EMUL_OKAY)
+        if ( rc != X86EMUL_OKAY )
             gdprintk(XENLOG_ERR, "hvm_set_cr3 failed, rc: %u\n", rc);
-    } else if (paging_mode_hap(v->domain)) {
+    }
+    else if ( paging_mode_hap(v->domain) )
+    {
         /* host nested paging + guest shadow paging. */
         n2vmcb->_np_enable = 1;
         /* Keep h_cr3 as it is. */
@@ -584,9 +611,11 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
         rc = hvm_set_cr3(ns_vmcb->_cr3, false, true);
         if ( rc == X86EMUL_EXCEPTION )
             hvm_inject_hw_exception(TRAP_gp_fault, 0);
-        if (rc != X86EMUL_OKAY)
+        if ( rc != X86EMUL_OKAY )
             gdprintk(XENLOG_ERR, "hvm_set_cr3 failed, rc: %u\n", rc);
-    } else {
+    }
+    else
+    {
         /* host shadow paging + guest shadow paging. */
         n2vmcb->_np_enable = 0;
         n2vmcb->_h_cr3 = 0x0;
@@ -640,13 +669,15 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
     n2vmcb->cleanbits.raw = 0;
 
     rc = svm_vmcb_isvalid(__func__, ns_vmcb, v, true);
-    if (rc) {
+    if ( rc )
+    {
         gdprintk(XENLOG_ERR, "virtual vmcb invalid\n");
         return NSVM_ERROR_VVMCB;
     }
 
     rc = svm_vmcb_isvalid(__func__, n2vmcb, v, true);
-    if (rc) {
+    if ( rc )
+    {
         gdprintk(XENLOG_ERR, "n2vmcb invalid\n");
         return NSVM_ERROR_VMENTRY;
     }
@@ -691,15 +722,15 @@ nsvm_vcpu_vmentry(struct vcpu *v, struct cpu_user_regs *regs,
     }
 
     /* nested paging for the guest */
-    svm->ns_hap_enabled = (ns_vmcb->_np_enable) ? 1 : 0;
+    svm->ns_hap_enabled = !!ns_vmcb->_np_enable;
 
     /* Remember the V_INTR_MASK in hostflags */
-    svm->ns_hostflags.fields.vintrmask =
-        (ns_vmcb->_vintr.fields.intr_masking) ? 1 : 0;
+    svm->ns_hostflags.fields.vintrmask = !!ns_vmcb->_vintr.fields.intr_masking;
 
     /* Save l1 guest state (= host state) */
     ret = nsvm_vcpu_hostsave(v, inst_len);
-    if (ret) {
+    if ( ret )
+    {
         gdprintk(XENLOG_ERR, "hostsave failed, ret = %i\n", ret);
         return ret;
     }
@@ -709,7 +740,8 @@ nsvm_vcpu_vmentry(struct vcpu *v, struct cpu_user_regs *regs,
     v->arch.hvm.svm.vmcb_pa = nv->nv_n2vmcx_pa;
 
     ret = nsvm_vmcb_prepare4vmrun(v, regs);
-    if (ret) {
+    if ( ret )
+    {
         gdprintk(XENLOG_ERR, "prepare4vmrun failed, ret = %i\n", ret);
         return ret;
     }
@@ -744,7 +776,8 @@ nsvm_vcpu_vmrun(struct vcpu *v, struct cpu_user_regs *regs)
      * and l1 guest keeps alive. */
     nestedhvm_vcpu_enter_guestmode(v);
 
-    switch (ret) {
+    switch ( ret )
+    {
     case 0:
         break;
     case NSVM_ERROR_VVMCB:
@@ -762,7 +795,7 @@ nsvm_vcpu_vmrun(struct vcpu *v, struct cpu_user_regs *regs)
     }
 
     /* If l1 guest uses shadow paging, update the paging mode. */
-    if (!nestedhvm_paging_mode_hap(v))
+    if ( !nestedhvm_paging_mode_hap(v) )
         paging_update_paging_modes(v);
 
     nv->nv_vmswitch_in_progress = 0;
@@ -785,9 +818,10 @@ nsvm_vcpu_vmexit_inject(struct vcpu *v, struct cpu_user_regs *regs,
 
     ns_vmcb = nv->nv_vvmcx;
 
-    if (nv->nv_vmexit_pending) {
-
-        switch (exitcode) {
+    if ( nv->nv_vmexit_pending )
+    {
+        switch ( exitcode )
+        {
         case VMEXIT_INTR:
             if ( unlikely(ns_vmcb->event_inj.v) && nv->nv_vmentry_pending &&
                  hvm_event_needs_reinjection(ns_vmcb->event_inj.type,
@@ -845,20 +879,20 @@ nsvm_vmcb_guest_intercepts_msr(unsigned long *msr_bitmap,
 
     msr_bit = svm_msrbit(msr_bitmap, msr);
 
-    if (msr_bit == NULL)
+    if ( msr_bit == NULL )
         /* MSR not in the permission map: Let the guest handle it. */
         return NESTEDHVM_VMEXIT_INJECT;
 
     msr &= 0x1fff;
 
-    if (write)
+    if ( write )
         /* write access */
         enabled = test_bit(msr * 2 + 1, msr_bit);
     else
         /* read access */
         enabled = test_bit(msr * 2, msr_bit);
 
-    if (!enabled)
+    if ( !enabled )
         return NESTEDHVM_VMEXIT_HOST;
 
     return NESTEDHVM_VMEXIT_INJECT;
@@ -921,41 +955,42 @@ nsvm_vmcb_guest_intercepts_exitcode(struct vcpu *v,
     struct vmcb_struct *ns_vmcb = nv->nv_vvmcx;
     enum nestedhvm_vmexits vmexits;
 
-    switch (exitcode) {
+    switch ( exitcode )
+    {
     case VMEXIT_CR0_READ ... VMEXIT_CR15_READ:
     case VMEXIT_CR0_WRITE ... VMEXIT_CR15_WRITE:
         exit_bits = 1ULL << (exitcode - VMEXIT_CR0_READ);
-        if (svm->ns_cr_intercepts & exit_bits)
+        if ( svm->ns_cr_intercepts & exit_bits )
             break;
         return 0;
 
     case VMEXIT_DR0_READ ... VMEXIT_DR7_READ:
     case VMEXIT_DR0_WRITE ... VMEXIT_DR7_WRITE:
         exit_bits = 1ULL << (exitcode - VMEXIT_DR0_READ);
-        if (svm->ns_dr_intercepts & exit_bits)
+        if ( svm->ns_dr_intercepts & exit_bits )
             break;
         return 0;
 
     case VMEXIT_EXCEPTION_DE ... VMEXIT_EXCEPTION_XF:
         exit_bits = 1ULL << (exitcode - VMEXIT_EXCEPTION_DE);
-        if (svm->ns_exception_intercepts & exit_bits)
+        if ( svm->ns_exception_intercepts & exit_bits )
             break;
         return 0;
 
     case VMEXIT_INTR ... VMEXIT_SHUTDOWN:
         exit_bits = 1ULL << (exitcode - VMEXIT_INTR);
-        if (svm->ns_general1_intercepts & exit_bits)
+        if ( svm->ns_general1_intercepts & exit_bits )
             break;
         return 0;
 
     case VMEXIT_VMRUN ... VMEXIT_XSETBV:
         exit_bits = 1ULL << (exitcode - VMEXIT_VMRUN);
-        if (svm->ns_general2_intercepts & exit_bits)
+        if ( svm->ns_general2_intercepts & exit_bits )
             break;
         return 0;
 
     case VMEXIT_NPF:
-        if (nestedhvm_paging_mode_hap(v))
+        if ( nestedhvm_paging_mode_hap(v) )
             break;
         return 0;
     case VMEXIT_INVALID:
@@ -969,7 +1004,8 @@ nsvm_vmcb_guest_intercepts_exitcode(struct vcpu *v,
     }
 
     /* Special cases: Do more detailed checks */
-    switch (exitcode) {
+    switch ( exitcode )
+    {
     case VMEXIT_MSR:
         ASSERT(regs != NULL);
         if ( !nestedsvm_vmcb_map(v, nv->nv_vvmcxaddr) )
@@ -977,7 +1013,7 @@ nsvm_vmcb_guest_intercepts_exitcode(struct vcpu *v,
         ns_vmcb = nv->nv_vvmcx;
         vmexits = nsvm_vmcb_guest_intercepts_msr(svm->ns_cached_msrpm,
             regs->ecx, ns_vmcb->exitinfo1 != 0);
-        if (vmexits == NESTEDHVM_VMEXIT_HOST)
+        if ( vmexits == NESTEDHVM_VMEXIT_HOST )
             return 0;
         break;
     case VMEXIT_IOIO:
@@ -986,7 +1022,7 @@ nsvm_vmcb_guest_intercepts_exitcode(struct vcpu *v,
         ns_vmcb = nv->nv_vvmcx;
         vmexits = nsvm_vmcb_guest_intercepts_ioio(ns_vmcb->_iopm_base_pa,
             ns_vmcb->exitinfo1);
-        if (vmexits == NESTEDHVM_VMEXIT_HOST)
+        if ( vmexits == NESTEDHVM_VMEXIT_HOST )
             return 0;
         break;
     }
@@ -1027,7 +1063,7 @@ nsvm_vmcb_prepare4vmexit(struct vcpu *v, struct cpu_user_regs *regs)
      */
 
     /* TSC offset */
-    /* Keep it. It's maintainted by the l1 guest. */ 
+    /* Keep it. It's maintainted by the l1 guest. */
 
     /* ASID */
     /* ns_vmcb->_guest_asid = n2vmcb->_guest_asid; */
@@ -1037,7 +1073,7 @@ nsvm_vmcb_prepare4vmexit(struct vcpu *v, struct cpu_user_regs *regs)
 
     /* Virtual Interrupts */
     ns_vmcb->_vintr = n2vmcb->_vintr;
-    if (!(svm->ns_hostflags.fields.vintrmask))
+    if ( !svm->ns_hostflags.fields.vintrmask )
         ns_vmcb->_vintr.fields.intr_masking = 0;
 
     /* Interrupt state */
@@ -1065,14 +1101,17 @@ nsvm_vmcb_prepare4vmexit(struct vcpu *v, struct cpu_user_regs *regs)
     ns_vmcb->event_inj.raw = 0;
 
     /* Nested paging mode */
-    if (nestedhvm_paging_mode_hap(v)) {
+    if ( nestedhvm_paging_mode_hap(v) )
+    {
         /* host nested paging + guest nested paging. */
         ns_vmcb->_np_enable = n2vmcb->_np_enable;
         ns_vmcb->_cr3 = n2vmcb->_cr3;
         /* The vmcb->h_cr3 is the shadowed h_cr3. The original
          * unshadowed guest h_cr3 is kept in ns_vmcb->h_cr3,
          * hence we keep the ns_vmcb->h_cr3 value. */
-    } else if (paging_mode_hap(v->domain)) {
+    }
+    else if ( paging_mode_hap(v->domain) )
+    {
         /* host nested paging + guest shadow paging. */
         ns_vmcb->_np_enable = 0;
         /* Throw h_cr3 away. Guest is not allowed to set it or
@@ -1081,7 +1120,9 @@ nsvm_vmcb_prepare4vmexit(struct vcpu *v, struct cpu_user_regs *regs)
         /* Stop intercepting #PF (already done above
          * by restoring cached intercepts). */
         ns_vmcb->_cr3 = n2vmcb->_cr3;
-    } else {
+    }
+    else
+    {
         /* host shadow paging + guest shadow paging. */
         ns_vmcb->_np_enable = 0;
         ns_vmcb->_h_cr3 = 0x0;
@@ -1211,12 +1252,13 @@ enum hvm_intblk nsvm_intr_blocked(struct vcpu *v)
     if ( !nestedsvm_gif_isset(v) )
         return hvm_intblk_svm_gif;
 
-    if ( nestedhvm_vcpu_in_guestmode(v) ) {
+    if ( nestedhvm_vcpu_in_guestmode(v) )
+    {
         struct vmcb_struct *n2vmcb = nv->nv_n2vmcx;
 
-        if ( svm->ns_hostflags.fields.vintrmask )
-            if ( !svm->ns_hostflags.fields.rflagsif )
-                return hvm_intblk_rflags_ie;
+        if ( svm->ns_hostflags.fields.vintrmask &&
+             !svm->ns_hostflags.fields.rflagsif )
+            return hvm_intblk_rflags_ie;
 
         /* when l1 guest passes its devices through to the l2 guest
          * and l2 guest does an MMIO access then we may want to
@@ -1237,12 +1279,11 @@ enum hvm_intblk nsvm_intr_blocked(struct vcpu *v)
         }
     }
 
-    if ( nv->nv_vmexit_pending ) {
+    if ( nv->nv_vmexit_pending )
         /* hvm_inject_hw_exception() must have run before.
          * exceptions have higher priority than interrupts.
          */
         return hvm_intblk_rflags_ie;
-    }
 
     return hvm_intblk_none;
 }
@@ -1275,9 +1316,10 @@ nestedsvm_check_intercepts(struct vcpu *v, struct cpu_user_regs *regs,
     ASSERT(vcpu_nestedhvm(v).nv_vmexit_pending == 0);
     is_intercepted = nsvm_vmcb_guest_intercepts_exitcode(v, regs, exitcode);
 
-    switch (exitcode) {
+    switch ( exitcode )
+    {
     case VMEXIT_INVALID:
-        if (is_intercepted)
+        if ( is_intercepted )
             return NESTEDHVM_VMEXIT_INJECT;
         return NESTEDHVM_VMEXIT_HOST;
 
@@ -1291,14 +1333,16 @@ nestedsvm_check_intercepts(struct vcpu *v, struct cpu_user_regs *regs,
         return NESTEDHVM_VMEXIT_HOST;
 
     case VMEXIT_NPF:
-        if (nestedhvm_paging_mode_hap(v)) {
-            if (!is_intercepted)
+        if ( nestedhvm_paging_mode_hap(v) )
+        {
+            if ( !is_intercepted )
                 return NESTEDHVM_VMEXIT_FATALERROR;
             /* host nested paging + guest nested paging */
             return NESTEDHVM_VMEXIT_HOST;
         }
-        if (paging_mode_hap(v->domain)) {
-            if (is_intercepted)
+        if ( paging_mode_hap(v->domain) )
+        {
+            if ( is_intercepted )
                 return NESTEDHVM_VMEXIT_FATALERROR;
             /* host nested paging + guest shadow paging */
             return NESTEDHVM_VMEXIT_HOST;
@@ -1306,20 +1350,21 @@ nestedsvm_check_intercepts(struct vcpu *v, struct cpu_user_regs *regs,
         /* host shadow paging + guest shadow paging */
         /* Can this happen? */
         BUG();
-        return NESTEDHVM_VMEXIT_FATALERROR;
+
     case VMEXIT_EXCEPTION_PF:
-        if (nestedhvm_paging_mode_hap(v)) {
+        if ( nestedhvm_paging_mode_hap(v) )
+        {
             /* host nested paging + guest nested paging */
-            if (!is_intercepted)
+            if ( !is_intercepted )
                 /* l1 guest intercepts #PF unnecessarily */
                 return NESTEDHVM_VMEXIT_HOST;
             /* l2 guest intercepts #PF unnecessarily */
             return NESTEDHVM_VMEXIT_INJECT;
         }
-        if (!paging_mode_hap(v->domain)) {
+        if ( !paging_mode_hap(v->domain) )
             /* host shadow paging + guest shadow paging */
             return NESTEDHVM_VMEXIT_HOST;
-        }
+
         /* host nested paging + guest shadow paging */
         return NESTEDHVM_VMEXIT_INJECT;
     case VMEXIT_VMMCALL:
@@ -1331,7 +1376,7 @@ nestedsvm_check_intercepts(struct vcpu *v, struct cpu_user_regs *regs,
         break;
     }
 
-    if (is_intercepted)
+    if ( is_intercepted )
         return NESTEDHVM_VMEXIT_INJECT;
     return NESTEDHVM_VMEXIT_HOST;
 }
@@ -1346,11 +1391,11 @@ nestedsvm_vmexit_n2n1(struct vcpu *v, struct cpu_user_regs *regs)
     ASSERT(nestedhvm_vcpu_in_guestmode(v));
 
     rc = nsvm_vmcb_prepare4vmexit(v, regs);
-    if (rc)
+    if ( rc )
         ret = NESTEDHVM_VMEXIT_ERROR;
 
     rc = nsvm_vcpu_hostrestore(v, regs);
-    if (rc)
+    if ( rc )
         ret = NESTEDHVM_VMEXIT_FATALERROR;
 
     nestedhvm_vcpu_exit_guestmode(v);
@@ -1374,17 +1419,19 @@ nestedsvm_vcpu_vmexit(struct vcpu *v, struct cpu_user_regs *regs,
     /* On special intercepts the host has to handle
      * the vcpu is still in guest mode here.
      */
-    if (nestedhvm_vcpu_in_guestmode(v)) {
+    if ( nestedhvm_vcpu_in_guestmode(v) )
+    {
         enum nestedhvm_vmexits ret;
 
         ret = nestedsvm_vmexit_n2n1(v, regs);
-        switch (ret) {
+        switch ( ret )
+        {
         case NESTEDHVM_VMEXIT_FATALERROR:
             gdprintk(XENLOG_ERR, "VMEXIT: fatal error\n");
             return ret;
         case NESTEDHVM_VMEXIT_HOST:
             BUG();
-            return ret;
+
         case NESTEDHVM_VMEXIT_ERROR:
             exitcode = VMEXIT_INVALID;
             break;
@@ -1404,12 +1451,12 @@ nestedsvm_vcpu_vmexit(struct vcpu *v, struct cpu_user_regs *regs,
     rc = nsvm_vcpu_vmexit_inject(v, regs, exitcode);
 
     /* If l1 guest uses shadow paging, update the paging mode. */
-    if (!nestedhvm_paging_mode_hap(v))
+    if ( !nestedhvm_paging_mode_hap(v) )
         paging_update_paging_modes(v);
 
     nv->nv_vmswitch_in_progress = 0;
 
-    if (rc)
+    if ( rc )
         return NESTEDHVM_VMEXIT_FATALERROR;
 
     return NESTEDHVM_VMEXIT_DONE;
@@ -1422,7 +1469,7 @@ void nsvm_vcpu_switch(struct cpu_user_regs *regs)
     struct nestedvcpu *nv;
     struct nestedsvm *svm;
 
-    if (!nestedhvm_enabled(v->domain))
+    if ( !nestedhvm_enabled(v->domain) )
         return;
 
     nv = &vcpu_nestedhvm(v);
@@ -1433,32 +1480,34 @@ void nsvm_vcpu_switch(struct cpu_user_regs *regs)
     ASSERT(nv->nv_n1vmcx_pa != INVALID_PADDR);
     ASSERT(nv->nv_n2vmcx_pa != INVALID_PADDR);
 
-    if (nv->nv_vmexit_pending) {
- vmexit:
+    if ( nv->nv_vmexit_pending )
+    {
+    vmexit:
         nestedsvm_vcpu_vmexit(v, regs, svm->ns_vmexit.exitcode);
         nv->nv_vmexit_pending = 0;
         nv->nv_vmentry_pending = 0;
         return;
     }
-    if (nv->nv_vmentry_pending) {
+
+    if ( nv->nv_vmentry_pending )
+    {
         int ret;
         ASSERT(!nv->nv_vmexit_pending);
         ret = nsvm_vcpu_vmrun(v, regs);
-        if (ret)
+        if ( ret )
             goto vmexit;
 
         ASSERT(nestedhvm_vcpu_in_guestmode(v));
         nv->nv_vmentry_pending = 0;
     }
 
-    if (nestedhvm_vcpu_in_guestmode(v)
-       && nestedhvm_paging_mode_hap(v))
+    if ( nestedhvm_vcpu_in_guestmode(v) && nestedhvm_paging_mode_hap(v) )
     {
         /* In case left the l2 guest due to a physical interrupt (e.g. IPI)
          * that is not for the l1 guest then we continue running the l2 guest
          * but check if the nestedp2m is still valid.
          */
-        if (nv->nv_p2m == NULL)
+        if ( nv->nv_p2m == NULL )
             nestedsvm_vmcb_set_nestedp2m(v, nv->nv_vvmcx, nv->nv_n2vmcx);
     }
 }
@@ -1477,7 +1526,8 @@ nestedsvm_vcpu_interrupt(struct vcpu *v, const struct hvm_intack intack)
     if ( intr != hvm_intblk_none )
         return NSVM_INTR_MASKED;
 
-    switch (intack.source) {
+    switch ( intack.source )
+    {
     case hvm_intsrc_pic:
     case hvm_intsrc_lapic:
     case hvm_intsrc_vector:
@@ -1500,7 +1550,8 @@ nestedsvm_vcpu_interrupt(struct vcpu *v, const struct hvm_intack intack)
 
     ret = nsvm_vmcb_guest_intercepts_exitcode(v,
                                      guest_cpu_user_regs(), exitcode);
-    if (ret) {
+    if ( ret )
+    {
         nestedsvm_vmexit_defer(v, exitcode, intack.source, exitinfo2);
         return NSVM_INTR_FORCEVMEXIT;
     }
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index bbe73744b8..ca3bbfcbb3 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -326,7 +326,7 @@ static int svm_vmcb_restore(struct vcpu *v, struct hvm_hw_cpu *c)
     vmcb->sysenter_cs = v->arch.hvm.svm.guest_sysenter_cs = c->sysenter_cs;
     vmcb->sysenter_esp = v->arch.hvm.svm.guest_sysenter_esp = c->sysenter_esp;
     vmcb->sysenter_eip = v->arch.hvm.svm.guest_sysenter_eip = c->sysenter_eip;
-    
+
     if ( paging_mode_hap(v->domain) )
     {
         vmcb_set_np_enable(vmcb, 1);
@@ -386,7 +386,8 @@ static void svm_save_vmcb_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt)
 static int svm_load_vmcb_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt)
 {
     svm_load_cpu_state(v, ctxt);
-    if (svm_vmcb_restore(v, ctxt)) {
+    if ( svm_vmcb_restore(v, ctxt) )
+    {
         gdprintk(XENLOG_ERR, "svm_vmcb restore failed!\n");
         domain_crash(v->domain);
         return -EINVAL;
@@ -413,9 +414,9 @@ static void svm_fpu_leave(struct vcpu *v)
     ASSERT(read_cr0() & X86_CR0_TS);
 
     /*
-     * If the guest does not have TS enabled then we must cause and handle an 
-     * exception on first use of the FPU. If the guest *does* have TS enabled 
-     * then this is not necessary: no FPU activity can occur until the guest 
+     * If the guest does not have TS enabled then we must cause and handle an
+     * exception on first use of the FPU. If the guest *does* have TS enabled
+     * then this is not necessary: no FPU activity can occur until the guest
      * clears CR0.TS, and we will initialise the FPU when that happens.
      */
     if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_TS) )
@@ -475,7 +476,8 @@ void svm_update_guest_cr(struct vcpu *v, unsigned int cr, unsigned int flags)
 
     switch ( cr )
     {
-    case 0: {
+    case 0:
+    {
         unsigned long hw_cr0_mask = 0;
 
         if ( !(v->arch.hvm.guest_cr[0] & X86_CR0_TS) )
@@ -821,7 +823,8 @@ static void svm_set_tsc_offset(struct vcpu *v, u64 offset, u64 at_tsc)
     uint64_t n2_tsc_offset = 0;
     struct domain *d = v->domain;
 
-    if ( !nestedhvm_enabled(d) ) {
+    if ( !nestedhvm_enabled(d) )
+    {
         vmcb_set_tsc_offset(vmcb, offset);
         return;
     }
@@ -829,12 +832,14 @@ static void svm_set_tsc_offset(struct vcpu *v, u64 offset, u64 at_tsc)
     n1vmcb = vcpu_nestedhvm(v).nv_n1vmcx;
     n2vmcb = vcpu_nestedhvm(v).nv_n2vmcx;
 
-    if ( nestedhvm_vcpu_in_guestmode(v) ) {
+    if ( nestedhvm_vcpu_in_guestmode(v) )
+    {
         struct nestedsvm *svm = &vcpu_nestedsvm(v);
 
         n2_tsc_offset = vmcb_get_tsc_offset(n2vmcb) -
                         vmcb_get_tsc_offset(n1vmcb);
-        if ( svm->ns_tscratio != DEFAULT_TSC_RATIO ) {
+        if ( svm->ns_tscratio != DEFAULT_TSC_RATIO )
+        {
             uint64_t guest_tsc = hvm_get_guest_tsc_fixed(v, at_tsc);
 
             n2_tsc_offset = svm_get_tsc_offset(guest_tsc,
@@ -930,7 +935,7 @@ static inline void svm_tsc_ratio_save(struct vcpu *v)
 
 static inline void svm_tsc_ratio_load(struct vcpu *v)
 {
-    if ( cpu_has_tsc_ratio && !v->domain->arch.vtsc ) 
+    if ( cpu_has_tsc_ratio && !v->domain->arch.vtsc )
         wrmsrl(MSR_AMD64_TSC_RATIO, hvm_tsc_scaling_ratio(v->domain));
 }
 
@@ -1111,7 +1116,7 @@ static void svm_host_osvw_init(void)
              rdmsr_safe(MSR_AMD_OSVW_STATUS, status) )
             len = status = 0;
 
-        if (len < osvw_length)
+        if ( len < osvw_length )
             osvw_length = len;
 
         osvw_status |= status;
@@ -1507,13 +1512,11 @@ static void svm_init_erratum_383(const struct cpuinfo_x86 *c)
         return;
 
     /* use safe methods to be compatible with nested virtualization */
-    if (rdmsr_safe(MSR_AMD64_DC_CFG, msr_content) == 0 &&
-        wrmsr_safe(MSR_AMD64_DC_CFG, msr_content | (1ULL << 47)) == 0)
-    {
+    if ( rdmsr_safe(MSR_AMD64_DC_CFG, msr_content) == 0 &&
+         wrmsr_safe(MSR_AMD64_DC_CFG, msr_content | (1ULL << 47)) == 0 )
         amd_erratum383_found = 1;
-    } else {
+    else
         printk("Failed to enable erratum 383\n");
-    }
 }
 
 #ifdef CONFIG_PV
@@ -1582,7 +1585,7 @@ static int _svm_cpu_up(bool bsp)
     int rc;
     unsigned int cpu = smp_processor_id();
     const struct cpuinfo_x86 *c = &cpu_data[cpu];
- 
+
     /* Check whether SVM feature is disabled in BIOS */
     rdmsrl(MSR_K8_VM_CR, msr_content);
     if ( msr_content & K8_VMCR_SVME_DISABLE )
@@ -1713,7 +1716,7 @@ static void svm_do_nested_pgfault(struct vcpu *v,
         _d.qualification = 0;
         _d.mfn = mfn_x(mfn);
         _d.p2mt = p2mt;
-        
+
         __trace_var(TRC_HVM_NPF, 0, sizeof(_d), &_d);
     }
 
@@ -2248,16 +2251,15 @@ nsvm_get_nvmcb_page(struct vcpu *v, uint64_t vmcbaddr)
         return NULL;
 
     /* Need to translate L1-GPA to MPA */
-    page = get_page_from_gfn(v->domain, 
-                            nv->nv_vvmcxaddr >> PAGE_SHIFT, 
-                            &p2mt, P2M_ALLOC | P2M_UNSHARE);
+    page = get_page_from_gfn(v->domain, nv->nv_vvmcxaddr >> PAGE_SHIFT,
+                             &p2mt, P2M_ALLOC | P2M_UNSHARE);
     if ( !page )
         return NULL;
 
     if ( !p2m_is_ram(p2mt) || p2m_is_readonly(p2mt) )
     {
         put_page(page);
-        return NULL; 
+        return NULL;
     }
 
     return  page;
@@ -2274,7 +2276,7 @@ svm_vmexit_do_vmload(struct vmcb_struct *vmcb,
     if ( (inst_len = svm_get_insn_len(v, INSTR_VMLOAD)) == 0 )
         return;
 
-    if ( !nsvm_efer_svm_enabled(v) ) 
+    if ( !nsvm_efer_svm_enabled(v) )
     {
         hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC);
         return;
@@ -2309,7 +2311,7 @@ svm_vmexit_do_vmsave(struct vmcb_struct *vmcb,
     if ( (inst_len = svm_get_insn_len(v, INSTR_VMSAVE)) == 0 )
         return;
 
-    if ( !nsvm_efer_svm_enabled(v) ) 
+    if ( !nsvm_efer_svm_enabled(v) )
     {
         hvm_inject_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC);
         return;
@@ -2344,11 +2346,11 @@ static int svm_is_erratum_383(struct cpu_user_regs *regs)
 
     if ( msr_content != 0xb600000000010015ULL )
         return 0;
-    
+
     /* Clear MCi_STATUS registers */
-    for (i = 0; i < this_cpu(nr_mce_banks); i++)
+    for ( i = 0; i < this_cpu(nr_mce_banks); i++ )
         wrmsrl(MSR_IA32_MCx_STATUS(i), 0ULL);
-    
+
     rdmsrl(MSR_IA32_MCG_STATUS, msr_content);
     wrmsrl(MSR_IA32_MCG_STATUS, msr_content & ~(1ULL << 2));
 
@@ -2535,7 +2537,8 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
                     1/*cycles*/, 2, exit_reason,
                     regs->eip, 0, 0, 0, 0);
 
-    if ( vcpu_guestmode ) {
+    if ( vcpu_guestmode )
+    {
         enum nestedhvm_vmexits nsret;
         struct nestedvcpu *nv = &vcpu_nestedhvm(v);
         struct vmcb_struct *ns_vmcb = nv->nv_vvmcx;
@@ -2550,7 +2553,8 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
         exitinfo1 = ns_vmcb->exitinfo1;
         ns_vmcb->exitinfo1 = vmcb->exitinfo1;
         nsret = nestedsvm_check_intercepts(v, regs, exit_reason);
-        switch (nsret) {
+        switch ( nsret )
+        {
         case NESTEDHVM_VMEXIT_CONTINUE:
             BUG();
             break;
@@ -2566,7 +2570,8 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
             nv->nv_vmswitch_in_progress = 1;
             nsret = nestedsvm_vmexit_n2n1(v, regs);
             nv->nv_vmswitch_in_progress = 0;
-            switch (nsret) {
+            switch ( nsret )
+            {
             case NESTEDHVM_VMEXIT_DONE:
                 /* defer VMEXIT injection */
                 nestedsvm_vmexit_defer(v, exit_reason, exitinfo1, exitinfo2);
@@ -2698,9 +2703,10 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
 
     case VMEXIT_EXCEPTION_NM:
         svm_fpu_dirty_intercept();
-        break;  
+        break;
 
-    case VMEXIT_EXCEPTION_PF: {
+    case VMEXIT_EXCEPTION_PF:
+    {
         unsigned long va;
         va = vmcb->exitinfo2;
         regs->error_code = vmcb->exitinfo1;
@@ -2744,7 +2750,8 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
         svm_vmexit_mce_intercept(v, regs);
         break;
 
-    case VMEXIT_VINTR: {
+    case VMEXIT_VINTR:
+    {
         u32 general1_intercepts = vmcb_get_general1_intercepts(vmcb);
         intr = vmcb_get_vintr(vmcb);
 
@@ -2952,7 +2959,8 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
         v->arch.hvm.svm.cached_insn_len = 0;
         break;
 
-    case VMEXIT_IRET: {
+    case VMEXIT_IRET:
+    {
         u32 general1_intercepts = vmcb_get_general1_intercepts(vmcb);
 
         /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:13:57 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:13: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 1k0KkH-0004QE-Dw; Tue, 28 Jul 2020 08:13:57 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0KkF-0004Q3-Me
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:13:55 +0000
X-Inumbo-ID: 4750d094-d0aa-11ea-8b19-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4750d094-d0aa-11ea-8b19-bc764e2007e4;
 Tue, 28 Jul 2020 08:13:54 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=NHYvmoctJT1C48w+itguhKI9q4B8M9nN0A9PPutSGaM=; b=7L9DE1+z/1jJibOfD5/IjT0ZGz
 0U3fHxUKowBIExb6eqOvj4DWlXbnyhzpqQb3HJanTFLEUoTOrhK3kQtQQXMq2XLBPUw2/AQWnnXJs
 b+HVFgkYxblsGwQn/QXXwNBHq7N2aykUu9G2zWJFrHcwKW6CQ9UF1JdJfPjIjvFKVJP4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0KkE-0002MK-N4
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:13:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0KkE-0003AW-Lw
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:13:54 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/vmce: Dispatch vmce_{rd, wr}msr() from guest_{rd,
 wr}msr()
Message-Id: <E1k0KkE-0003AW-Lw@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:13:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 8a7bf75eb5bba4046c1aa278330a371545a6ecbd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jul 21 18:25:15 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jul 23 15:42:48 2020 +0100

    x86/vmce: Dispatch vmce_{rd,wr}msr() from guest_{rd,wr}msr()
    
    ... rather than from the default clauses of the PV and HVM MSR handlers.
    
    This means that we no longer take the vmce lock for any unknown MSR, and
    accesses to architectural MCE banks outside of the subset implemented for the
    guest no longer fall further through the unknown MSR path.
    
    The bank limit of 32 isn't stated anywhere I can locate, but is a consequence
    of the MSR layout described in SDM Volume 4.
    
    With the vmce calls removed, the hvm alternative_call()'s expression can be
    simplified substantially.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/hvm.c         | 16 ++--------------
 xen/arch/x86/msr.c             | 16 ++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c | 15 ---------------
 3 files changed, 18 insertions(+), 29 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 5bb47583b3..a9d1685549 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3560,13 +3560,7 @@ int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
          break;
 
     default:
-        if ( (ret = vmce_rdmsr(msr, msr_content)) < 0 )
-            goto gp_fault;
-        /* If ret == 0 then this is not an MCE MSR, see other MSRs. */
-        ret = ((ret == 0)
-               ? alternative_call(hvm_funcs.msr_read_intercept,
-                                  msr, msr_content)
-               : X86EMUL_OKAY);
+        ret = alternative_call(hvm_funcs.msr_read_intercept, msr, msr_content);
         break;
     }
 
@@ -3696,13 +3690,7 @@ int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content,
         break;
 
     default:
-        if ( (ret = vmce_wrmsr(msr, msr_content)) < 0 )
-            goto gp_fault;
-        /* If ret == 0 then this is not an MCE MSR, see other MSRs. */
-        ret = ((ret == 0)
-               ? alternative_call(hvm_funcs.msr_write_intercept,
-                                  msr, msr_content)
-               : X86EMUL_OKAY);
+        ret = alternative_call(hvm_funcs.msr_write_intercept, msr, msr_content);
         break;
     }
 
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 22f921cc71..ca4307e19f 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -227,6 +227,14 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         *val = msrs->misc_features_enables.raw;
         break;
 
+    case MSR_IA32_MCG_CAP     ... MSR_IA32_MCG_CTL:      /* 0x179 -> 0x17b */
+    case MSR_IA32_MCx_CTL2(0) ... MSR_IA32_MCx_CTL2(31): /* 0x280 -> 0x29f */
+    case MSR_IA32_MCx_CTL(0)  ... MSR_IA32_MCx_MISC(31): /* 0x400 -> 0x47f */
+    case MSR_IA32_MCG_EXT_CTL:                           /* 0x4d0 */
+        if ( vmce_rdmsr(msr, val) < 0 )
+            goto gp_fault;
+        break;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
@@ -436,6 +444,14 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         break;
     }
 
+    case MSR_IA32_MCG_CAP     ... MSR_IA32_MCG_CTL:      /* 0x179 -> 0x17b */
+    case MSR_IA32_MCx_CTL2(0) ... MSR_IA32_MCx_CTL2(31): /* 0x280 -> 0x29f */
+    case MSR_IA32_MCx_CTL(0)  ... MSR_IA32_MCx_MISC(31): /* 0x400 -> 0x47f */
+    case MSR_IA32_MCG_EXT_CTL:                           /* 0x4d0 */
+        if ( vmce_wrmsr(msr, val) < 0 )
+            goto gp_fault;
+        break;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 254da2b849..f14552cb4b 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -855,8 +855,6 @@ static int read_msr(unsigned int reg, uint64_t *val,
 
     switch ( reg )
     {
-        int rc;
-
     case MSR_FS_BASE:
         if ( is_pv_32bit_domain(currd) )
             break;
@@ -955,12 +953,6 @@ static int read_msr(unsigned int reg, uint64_t *val,
         }
         /* fall through */
     default:
-        rc = vmce_rdmsr(reg, val);
-        if ( rc < 0 )
-            break;
-        if ( rc )
-            return X86EMUL_OKAY;
-        /* fall through */
     normal:
         /* Everyone can read the MSR space. */
         /* gdprintk(XENLOG_WARNING, "Domain attempted RDMSR %08x\n", reg); */
@@ -991,7 +983,6 @@ static int write_msr(unsigned int reg, uint64_t val,
     switch ( reg )
     {
         uint64_t temp;
-        int rc;
 
     case MSR_FS_BASE:
         if ( is_pv_32bit_domain(currd) || !is_canonical_address(val) )
@@ -1122,12 +1113,6 @@ static int write_msr(unsigned int reg, uint64_t val,
         }
         /* fall through */
     default:
-        rc = vmce_wrmsr(reg, val);
-        if ( rc < 0 )
-            break;
-        if ( rc )
-            return X86EMUL_OKAY;
-
         if ( (rdmsr_safe(reg, temp) != 0) || (val != temp) )
     invalid:
             gdprintk(XENLOG_WARNING,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:14:06 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:14: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 1k0KkQ-0004RH-Fc; Tue, 28 Jul 2020 08:14:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0KkP-0004R9-H8
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:14:05 +0000
X-Inumbo-ID: 4cf4895b-d0aa-11ea-8b19-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4cf4895b-d0aa-11ea-8b19-bc764e2007e4;
 Tue, 28 Jul 2020 08:14:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=VDJS+UiJDkD5RYTvzu7BrwCyWY2SZl6U7WsHtKXuBRA=; b=UEtIRWvYa8uQ2PXKhQPF+ADd4R
 tuvN1O+TuLIUp7W6SQQk/7DwMWJLob+QLEruxMUCqyNmfkqLl4/Hkg9y35L8etiXYYdzs4Qz/Zx4i
 HIuL/cfUfjpnD3lSU09CJh/zyErA+K0OOBsSNZkTk+0AlJ/60PKIWxrAihOX6QQ+8QUc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0KkO-0002Mg-Px
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:14:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0KkO-0003BH-PC
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:14:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/S3: put data segment registers into known state upon
 resume
Message-Id: <E1k0KkO-0003BH-PC@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:14:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 55f8c389d4348cc517946fdcb10794112458e81e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 24 10:17:26 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 24 10:17:26 2020 +0200

    x86/S3: put data segment registers into known state upon resume
    
    wakeup_32 sets %ds and %es to BOOT_DS, while leaving %fs at what
    wakeup_start did set it to, and %gs at whatever BIOS did load into it.
    All of this may end up confusing the first load_segments() to run on
    the BSP after resume, in particular allowing a non-nul selector value
    to be left in %fs.
    
    Alongside %ss, also put all other data segment registers into the same
    state that the boot and CPU bringup paths put them in.
    
    Reported-by: M. Vefa Bicakci <m.v.b@runbox.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/acpi/wakeup_prot.S | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/acpi/wakeup_prot.S b/xen/arch/x86/acpi/wakeup_prot.S
index dcc7e2327d..a2c41c4f3f 100644
--- a/xen/arch/x86/acpi/wakeup_prot.S
+++ b/xen/arch/x86/acpi/wakeup_prot.S
@@ -49,6 +49,10 @@ ENTRY(s3_resume)
         mov     %rax, %cr0
 
         mov     $__HYPERVISOR_DS64, %eax
+        mov     %eax, %ds
+        mov     %eax, %es
+        mov     %eax, %fs
+        mov     %eax, %gs
         mov     %eax, %ss
         mov     saved_rsp(%rip), %rsp
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:14:16 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:14: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 1k0Kka-0004SQ-HN; Tue, 28 Jul 2020 08:14:16 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0KkZ-0004SF-Md
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:14:15 +0000
X-Inumbo-ID: 535648a6-d0aa-11ea-a878-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 535648a6-d0aa-11ea-a878-12813bfff9fa;
 Tue, 28 Jul 2020 08:14:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=N+AgHmgJJ5vDSjcCFngUScLsrAsC3HKI9HrlH0XZ230=; b=jQbM8t730lbBp/VRatNUrZOXBV
 Mdu1TIoeJR6QAmAOGYBYNaYEQbYh6bdgw4Wq2UiVT1pkTnsz3tXl/kcW0aL7JvxAnihirtzPdUKa3
 yAy6AOInnSc0hecMCJRFyZDIaYIga6rXhVWG2OZOYcOhx9E4sWzsMslHK4EgqgpNh1Ag=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0KkY-0002Mo-Sd
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:14:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0KkY-0003C2-S1
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:14:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] lockprof: don't leave locks uninitialized upon
 allocation failure
Message-Id: <E1k0KkY-0003C2-S1@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:14:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 82cba984b2e37496360ef2bf22e529a53c084631
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 24 10:18:30 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 24 10:18:30 2020 +0200

    lockprof: don't leave locks uninitialized upon allocation failure
    
    Even if a specific struct lock_profile instance can't be allocated, the
    lock itself should still be functional. As this isn't a production use
    feature, also log a message in the event that the profiling struct can't
    be allocated.
    
    Fixes: d98feda5c756 ("Make lock profiling usable again")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/xen/spinlock.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h
index 468b9ac9ef..c0e7690a6c 100644
--- a/xen/include/xen/spinlock.h
+++ b/xen/include/xen/spinlock.h
@@ -103,10 +103,16 @@ struct lock_profile_qhead {
     do {                                                                      \
         struct lock_profile *prof;                                            \
         prof = xzalloc(struct lock_profile);                                  \
-        if (!prof) break;                                                     \
+        (s)->l = (spinlock_t)_SPIN_LOCK_UNLOCKED(prof);                       \
+        if ( !prof )                                                          \
+        {                                                                     \
+            printk(XENLOG_WARNING                                             \
+                   "lock profiling unavailable for %p(%d)'s %s\n",            \
+                   s, (s)->profile_head.idx, #l);                             \
+            break;                                                            \
+        }                                                                     \
         prof->name = #l;                                                      \
         prof->lock = &(s)->l;                                                 \
-        (s)->l = (spinlock_t)_SPIN_LOCK_UNLOCKED(prof);                       \
         prof->next = (s)->profile_head.elem_q;                                \
         (s)->profile_head.elem_q = prof;                                      \
     } while(0)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:14:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:14: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 1k0Kkk-0004UJ-J1; Tue, 28 Jul 2020 08:14:26 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0Kkj-0004U6-T0
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:14:25 +0000
X-Inumbo-ID: 595a0fc6-d0aa-11ea-a878-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 595a0fc6-d0aa-11ea-a878-12813bfff9fa;
 Tue, 28 Jul 2020 08:14:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=UOsp67YG4LS/KyVxxXMidTJ/T9BuQvdxhN3VA5o0HNs=; b=JcQg3G7SnEqw42ZHZHc2SJc+Mu
 vxdwXRcxezZwqjJcjA6+X2yct2Xn8EHR8EuVcCLQxbbsJr1lBGn3nkqFrno9qFW9K6wId20+UjteD
 pTLU+LYo4aZOSX/+zIL44bI3jWFbVRPp6kWX8RQGkkYIBNhhoqlR5By1Ak1by3IZkPSY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kki-0002N0-VT
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:14:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kki-0003Ct-Ut
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:14:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] lockprof: don't pass name into registration function
Message-Id: <E1k0Kki-0003Ct-Ut@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:14:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit b2a64292b0bfa317886b3432d1a5b2a4193a48d6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 24 10:19:25 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 24 10:19:25 2020 +0200

    lockprof: don't pass name into registration function
    
    The type uniquely identifies the associated name, hence the name fields
    can be statically initialized.
    
    Also constify not just the involved struct field, but also struct
    lock_profile's. Rather than specifying lock_profile_ancs[]' dimension at
    definition time, add a suitable build time check, such that at least
    missing tail additions to the initializer can be spotted easily.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/domain.c        |  2 +-
 xen/common/spinlock.c      | 17 ++++++++++-------
 xen/include/xen/spinlock.h | 10 +++++-----
 3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index e9be05f1d0..f0f9c62feb 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -392,7 +392,7 @@ struct domain *domain_create(domid_t domid,
         d->max_vcpus = config->max_vcpus;
     }
 
-    lock_profile_register_struct(LOCKPROF_TYPE_PERDOM, d, domid, "Domain");
+    lock_profile_register_struct(LOCKPROF_TYPE_PERDOM, d, domid);
 
     if ( (err = xsm_alloc_security_domain(d)) != 0 )
         goto fail;
diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index 6c8b62beb0..17f4519fc7 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -338,7 +338,7 @@ void _spin_unlock_recursive(spinlock_t *lock)
 
 struct lock_profile_anc {
     struct lock_profile_qhead *head_q;   /* first head of this type */
-    char                      *name;     /* descriptive string for print */
+    const char                *name;     /* descriptive string for print */
 };
 
 typedef void lock_profile_subfunc(
@@ -348,7 +348,10 @@ extern struct lock_profile *__lock_profile_start;
 extern struct lock_profile *__lock_profile_end;
 
 static s_time_t lock_profile_start;
-static struct lock_profile_anc lock_profile_ancs[LOCKPROF_TYPE_N];
+static struct lock_profile_anc lock_profile_ancs[] = {
+    [LOCKPROF_TYPE_GLOBAL] = { .name = "Global" },
+    [LOCKPROF_TYPE_PERDOM] = { .name = "Domain" },
+};
 static struct lock_profile_qhead lock_profile_glb_q;
 static spinlock_t lock_profile_lock = SPIN_LOCK_UNLOCKED;
 
@@ -473,13 +476,12 @@ int spinlock_profile_control(struct xen_sysctl_lockprof_op *pc)
 }
 
 void _lock_profile_register_struct(
-    int32_t type, struct lock_profile_qhead *qhead, int32_t idx, char *name)
+    int32_t type, struct lock_profile_qhead *qhead, int32_t idx)
 {
     qhead->idx = idx;
     spin_lock(&lock_profile_lock);
     qhead->head_q = lock_profile_ancs[type].head_q;
     lock_profile_ancs[type].head_q = qhead;
-    lock_profile_ancs[type].name = name;
     spin_unlock(&lock_profile_lock);
 }
 
@@ -504,6 +506,8 @@ static int __init lock_prof_init(void)
 {
     struct lock_profile **q;
 
+    BUILD_BUG_ON(ARRAY_SIZE(lock_profile_ancs) != LOCKPROF_TYPE_N);
+
     for ( q = &__lock_profile_start; q < &__lock_profile_end; q++ )
     {
         (*q)->next = lock_profile_glb_q.elem_q;
@@ -511,9 +515,8 @@ static int __init lock_prof_init(void)
         (*q)->lock->profile = *q;
     }
 
-    _lock_profile_register_struct(
-        LOCKPROF_TYPE_GLOBAL, &lock_profile_glb_q,
-        0, "Global lock");
+    _lock_profile_register_struct(LOCKPROF_TYPE_GLOBAL,
+                                  &lock_profile_glb_q, 0);
 
     return 0;
 }
diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h
index c0e7690a6c..ca13b600a0 100644
--- a/xen/include/xen/spinlock.h
+++ b/xen/include/xen/spinlock.h
@@ -72,7 +72,7 @@ struct spinlock;
 
 struct lock_profile {
     struct lock_profile *next;       /* forward link */
-    char                *name;       /* lock name */
+    const char          *name;       /* lock name */
     struct spinlock     *lock;       /* the lock itself */
     u64                 lock_cnt;    /* # of complete locking ops */
     u64                 block_cnt;   /* # of complete wait for lock */
@@ -118,11 +118,11 @@ struct lock_profile_qhead {
     } while(0)
 
 void _lock_profile_register_struct(
-    int32_t, struct lock_profile_qhead *, int32_t, char *);
+    int32_t, struct lock_profile_qhead *, int32_t);
 void _lock_profile_deregister_struct(int32_t, struct lock_profile_qhead *);
 
-#define lock_profile_register_struct(type, ptr, idx, print)                   \
-    _lock_profile_register_struct(type, &((ptr)->profile_head), idx, print)
+#define lock_profile_register_struct(type, ptr, idx)                          \
+    _lock_profile_register_struct(type, &((ptr)->profile_head), idx)
 #define lock_profile_deregister_struct(type, ptr)                             \
     _lock_profile_deregister_struct(type, &((ptr)->profile_head))
 
@@ -138,7 +138,7 @@ struct lock_profile_qhead { };
 #define DEFINE_SPINLOCK(l) spinlock_t l = SPIN_LOCK_UNLOCKED
 
 #define spin_lock_init_prof(s, l) spin_lock_init(&((s)->l))
-#define lock_profile_register_struct(type, ptr, idx, print)
+#define lock_profile_register_struct(type, ptr, idx)
 #define lock_profile_deregister_struct(type, ptr)
 #define spinlock_profile_printall(key)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 08:14:36 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 08:14:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1k0Kku-0004VG-Kl; Tue, 28 Jul 2020 08:14:36 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0Kkt-0004V7-TB
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:14:35 +0000
X-Inumbo-ID: 5f5f929c-d0aa-11ea-a878-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 5f5f929c-d0aa-11ea-a878-12813bfff9fa;
 Tue, 28 Jul 2020 08:14:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=lVbQ2X6S3xW4+Df/tHmplAjbz7X1enuQIt9R2A9O8ko=; b=hND2F3EInOYPvmHIhoZSdSIG4n
 BKWY/WADbOPnCWugQ8geicWT0yXeIM3/pz68epLMJ2Ee6LO1vTzXezhmrQs1dOJ11jy+tC+0Ronr5
 ALyp4a4CTPNh+0Om98BBQoBN1mkUYL/A9IDYYKS9kZzSmrzYLIBWYmNlyX30pktjYyu0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kkt-0002N8-1z
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:14:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Kkt-0003Dd-1O
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 08:14:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/pv: Make the PV default WRMSR path match the HVM
 default
Message-Id: <E1k0Kkt-0003Dd-1O@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 08:14:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 0562cbc14cf02b8188b9f1f37f39a4886776ce7c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jul 23 18:33:51 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jul 24 10:15:19 2020 +0100

    x86/pv: Make the PV default WRMSR path match the HVM default
    
    The current HVM default for writes to unknown MSRs is to inject #GP if the MSR
    is unreadable, and discard writes otherwise. While this behaviour isn't great,
    the PV default is even worse, because it swallows writes even to non-readable
    MSRs.  i.e. A PV guest doesn't even get a #GP fault for a write to a totally
    bogus index.
    
    Update PV to make it consistent with HVM, which will simplify the task of
    making other improvements to the default MSR behaviour.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/emul-priv-op.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index f14552cb4b..efeb2a727e 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -1113,7 +1113,10 @@ static int write_msr(unsigned int reg, uint64_t val,
         }
         /* fall through */
     default:
-        if ( (rdmsr_safe(reg, temp) != 0) || (val != temp) )
+        if ( rdmsr_safe(reg, temp) )
+            break;
+
+        if ( val != temp )
     invalid:
             gdprintk(XENLOG_WARNING,
                      "Domain attempted WRMSR %08x from 0x%016"PRIx64" to 0x%016"PRIx64"\n",
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 18:44:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 18:44:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1k0Ua6-0002uE-Tx; Tue, 28 Jul 2020 18:44:06 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0Ua5-0002u8-Ry
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:44:05 +0000
X-Inumbo-ID: 4fcf3064-d102-11ea-8bc3-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 4fcf3064-d102-11ea-8bc3-bc764e2007e4;
 Tue, 28 Jul 2020 18:44:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=nNtA7e6567C+PfsbOZJ43g1royS9IFggJOojYqkVrbI=; b=yizM6X0+GG9sjMGrtGnlDod0+4
 MpRM/wvI+jTqobsyFmrXoHYyRS9U4gFy2w/4+Ifgmd4WNiCmELeWtMMpMJ9bG6rUvX0HhpPJXzFsR
 lWyn/oF98esvTABd1TaPiN3YBB1QrWP6SvES2PwT1nSpntpPEX9VmNhU9ujPerTxZedA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Ua4-0007dZ-K7
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Ua4-0001aK-Ii
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:44:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] public/domctl: Fix the struct xen_domctl ABI in 32bit
 builds
Message-Id: <E1k0Ua4-0001aK-Ii@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 18:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 8899a280a493d6717afc7a709f7d1e842b4eb2d6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jul 27 19:21:09 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jul 28 19:33:28 2020 +0100

    public/domctl: Fix the struct xen_domctl ABI in 32bit builds
    
    The Xen domctl ABI currently relies on the union containing a field with
    alignment of 8.
    
    32bit projects which only copy the used subset of functionality end up with an
    ABI breakage if they don't have at least one uint64_aligned_t field copied.
    
    Insert explicit padding, and some build assertions to ensure it never changes
    moving forwards.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/domctl.c         | 8 ++++++++
 xen/include/public/domctl.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index a69b3b59a8..20ef8399bd 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -959,6 +959,14 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
     return ret;
 }
 
+static void __init __maybe_unused build_assertions(void)
+{
+    struct xen_domctl d;
+
+    BUILD_BUG_ON(sizeof(d) != 16 /* header */ + 128 /* union */);
+    BUILD_BUG_ON(offsetof(typeof(d), u) != 16);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 59bdc28c89..9464a9058a 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -1222,6 +1222,7 @@ struct xen_domctl {
 #define XEN_DOMCTL_gdbsx_domstatus             1003
     uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
     domid_t  domain;
+    uint16_t _pad[3];
     union {
         struct xen_domctl_createdomain      createdomain;
         struct xen_domctl_getdomaininfo     getdomaininfo;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 18:44:19 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 18:44: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 1k0UaI-0002v1-Vh; Tue, 28 Jul 2020 18:44:18 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0UaI-0002uu-7u
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:44:18 +0000
X-Inumbo-ID: 55e21a52-d102-11ea-8bc3-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 55e21a52-d102-11ea-8bc3-bc764e2007e4;
 Tue, 28 Jul 2020 18:44:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=iVu1C02ieYlro7sEt6uUFeoZoVTazhrX1eK1Jjo8nXc=; b=2eCj5TC6jVVREO+3V2Woidc46Q
 RYOAHY373b/ULblrmUdnrp9IDT0lRVRjrC2LcuO5q56/6/0kGTMGK7zSvPrHDDj79eEAlKeIIJbg+
 kJqqpTqZSpUOh3ovtiRgHgFadsx0xTTCRTT/CjC9DR0oNW6ZjTMQsiRqW5vrVZfSMK7Q=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0UaE-0007eJ-Qw
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0UaE-0001bW-Nm
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:44:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] print: introduce a format specifier for pci_sbdf_t
Message-Id: <E1k0UaE-0001bW-Nm@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 18:44:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 1ee1441835f41f0a2303c761657ba69a5a1b4a7f
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Jul 27 12:31:36 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jul 28 19:33:28 2020 +0100

    print: introduce a format specifier for pci_sbdf_t
    
    The new format specifier is '%pp', and prints a pci_sbdf_t using the
    seg:bus:dev.func format. Replace all SBDFs printed using
    '%04x:%02x:%02x.%u' to use the new format specifier.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Acked-by: Julien Grall <julien.grall@arm.com>
    For just the pieces where Jan is the only maintainer:
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/printk-formats.txt                |  5 ++
 xen/arch/x86/hvm/vmsi.c                     | 10 +---
 xen/arch/x86/msi.c                          | 37 +++++-------
 xen/common/vsprintf.c                       | 18 ++++++
 xen/drivers/passthrough/amd/iommu_acpi.c    | 22 ++++---
 xen/drivers/passthrough/amd/iommu_cmd.c     |  5 +-
 xen/drivers/passthrough/amd/iommu_detect.c  |  5 +-
 xen/drivers/passthrough/amd/iommu_init.c    | 18 +++---
 xen/drivers/passthrough/amd/iommu_intr.c    |  9 +--
 xen/drivers/passthrough/amd/pci_amd_iommu.c | 25 +++-----
 xen/drivers/passthrough/pci.c               | 89 ++++++++++++-----------------
 xen/drivers/passthrough/vtd/dmar.c          | 27 +++++----
 xen/drivers/passthrough/vtd/intremap.c      | 11 ++--
 xen/drivers/passthrough/vtd/iommu.c         | 80 +++++++++++---------------
 xen/drivers/passthrough/vtd/quirks.c        | 22 +++----
 xen/drivers/passthrough/vtd/utils.c         |  6 +-
 xen/drivers/passthrough/x86/ats.c           | 13 ++---
 xen/drivers/vpci/header.c                   | 11 ++--
 xen/drivers/vpci/msi.c                      |  6 +-
 xen/drivers/vpci/msix.c                     | 24 +++-----
 20 files changed, 189 insertions(+), 254 deletions(-)

diff --git a/docs/misc/printk-formats.txt b/docs/misc/printk-formats.txt
index 080f498f65..8f666f696a 100644
--- a/docs/misc/printk-formats.txt
+++ b/docs/misc/printk-formats.txt
@@ -48,3 +48,8 @@ Domain and vCPU information:
                The domain part as above, with the vcpu_id printed in decimal.
                  e.g.  d0v1
                        d[IDLE]v0
+
+PCI:
+
+       %pp     PCI device address in S:B:D.F format from a pci_sbdf_t.
+                 e.g.  0004:02:00.0
diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c
index 5d4eddebee..7ca19353ab 100644
--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -697,10 +697,8 @@ static int vpci_msi_update(const struct pci_dev *pdev, uint32_t data,
 
         if ( rc )
         {
-            gdprintk(XENLOG_ERR,
-                     "%04x:%02x:%02x.%u: failed to bind PIRQ %u: %d\n",
-                     pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
-                     PCI_FUNC(pdev->devfn), pirq + i, rc);
+            gdprintk(XENLOG_ERR, "%pp: failed to bind PIRQ %u: %d\n",
+                     &pdev->sbdf, pirq + i, rc);
             while ( bind.machine_irq-- > pirq )
                 pt_irq_destroy_bind(pdev->domain, &bind);
             return rc;
@@ -754,9 +752,7 @@ static int vpci_msi_enable(const struct pci_dev *pdev, uint32_t data,
                                    &msi_info);
     if ( rc )
     {
-        gdprintk(XENLOG_ERR, "%04x:%02x:%02x.%u: failed to map PIRQ: %d\n",
-                 pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
-                 PCI_FUNC(pdev->devfn), rc);
+        gdprintk(XENLOG_ERR, "%pp: failed to map PIRQ: %d\n", &pdev->sbdf, rc);
         return rc;
     }
 
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 161ee60dbe..29e4351a49 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -430,8 +430,8 @@ static bool msi_set_mask_bit(struct irq_desc *desc, bool host, bool guest)
             {
                 pdev->msix->warned = domid;
                 printk(XENLOG_G_WARNING
-                       "cannot mask IRQ %d: masking MSI-X on Dom%d's %04x:%02x:%02x.%u\n",
-                       desc->irq, domid, seg, bus, slot, func);
+                       "cannot mask IRQ %d: masking MSI-X on Dom%d's %pp\n",
+                       desc->irq, domid, &pdev->sbdf);
             }
         }
         pdev->msix->host_maskall = maskall;
@@ -985,11 +985,11 @@ static int msix_capability_init(struct pci_dev *dev,
             struct domain *d = dev->domain ?: currd;
 
             if ( !is_hardware_domain(currd) || d != currd )
-                printk("%s use of MSI-X on %04x:%02x:%02x.%u by Dom%d\n",
+                printk("%s use of MSI-X on %pp by %pd\n",
                        is_hardware_domain(currd)
                        ? XENLOG_WARNING "Potentially insecure"
                        : XENLOG_ERR "Insecure",
-                       seg, bus, slot, func, d->domain_id);
+                       &dev->sbdf, d);
             if ( !is_hardware_domain(d) &&
                  /* Assume a domain without memory has no mappings yet. */
                  (!is_hardware_domain(currd) || domain_tot_pages(d)) )
@@ -1043,18 +1043,15 @@ static int __pci_enable_msi(struct msi_info *msi, struct msi_desc **desc)
     old_desc = find_msi_entry(pdev, msi->irq, PCI_CAP_ID_MSI);
     if ( old_desc )
     {
-        printk(XENLOG_ERR "irq %d already mapped to MSI on %04x:%02x:%02x.%u\n",
-               msi->irq, msi->seg, msi->bus,
-               PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn));
+        printk(XENLOG_ERR "irq %d already mapped to MSI on %pp\n",
+               msi->irq, &pdev->sbdf);
         return -EEXIST;
     }
 
     old_desc = find_msi_entry(pdev, -1, PCI_CAP_ID_MSIX);
     if ( old_desc )
     {
-        printk(XENLOG_WARNING "MSI-X already in use on %04x:%02x:%02x.%u\n",
-               msi->seg, msi->bus,
-               PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn));
+        printk(XENLOG_WARNING "MSI-X already in use on %pp\n", &pdev->sbdf);
         __pci_disable_msix(old_desc);
     }
 
@@ -1091,8 +1088,6 @@ static void __pci_disable_msi(struct msi_desc *entry)
 static int __pci_enable_msix(struct msi_info *msi, struct msi_desc **desc)
 {
     struct pci_dev *pdev;
-    u8 slot = PCI_SLOT(msi->devfn);
-    u8 func = PCI_FUNC(msi->devfn);
     struct msi_desc *old_desc;
 
     ASSERT(pcidevs_locked());
@@ -1106,16 +1101,15 @@ static int __pci_enable_msix(struct msi_info *msi, struct msi_desc **desc)
     old_desc = find_msi_entry(pdev, msi->irq, PCI_CAP_ID_MSIX);
     if ( old_desc )
     {
-        printk(XENLOG_ERR "irq %d already mapped to MSI-X on %04x:%02x:%02x.%u\n",
-               msi->irq, msi->seg, msi->bus, slot, func);
+        printk(XENLOG_ERR "irq %d already mapped to MSI-X on %pp\n",
+               msi->irq, &pdev->sbdf);
         return -EEXIST;
     }
 
     old_desc = find_msi_entry(pdev, -1, PCI_CAP_ID_MSI);
     if ( old_desc )
     {
-        printk(XENLOG_WARNING "MSI already in use on %04x:%02x:%02x.%u\n",
-               msi->seg, msi->bus, slot, func);
+        printk(XENLOG_WARNING "MSI already in use on %pp\n", &pdev->sbdf);
         __pci_disable_msi(old_desc);
     }
 
@@ -1162,9 +1156,8 @@ static void __pci_disable_msix(struct msi_desc *entry)
         writel(1, entry->mask_base + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
     else if ( !(control & PCI_MSIX_FLAGS_MASKALL) )
     {
-        printk(XENLOG_WARNING
-               "cannot disable IRQ %d: masking MSI-X on %04x:%02x:%02x.%u\n",
-               entry->irq, seg, bus, slot, func);
+        printk(XENLOG_WARNING "cannot disable IRQ %d: masking MSI-X on %pp\n",
+               entry->irq, &dev->sbdf);
         maskall = true;
     }
     dev->msix->host_maskall = maskall;
@@ -1340,7 +1333,6 @@ int pci_restore_msi_state(struct pci_dev *pdev)
     struct msi_desc *entry, *tmp;
     struct irq_desc *desc;
     struct msi_msg msg;
-    u8 slot = PCI_SLOT(pdev->devfn), func = PCI_FUNC(pdev->devfn);
     unsigned int type = 0, pos = 0;
     u16 control = 0;
 
@@ -1369,9 +1361,8 @@ int pci_restore_msi_state(struct pci_dev *pdev)
         if (desc->msi_desc != entry)
         {
     bogus:
-            dprintk(XENLOG_ERR,
-                    "Restore MSI for %04x:%02x:%02x:%u entry %u not set?\n",
-                    pdev->seg, pdev->bus, slot, func, i);
+            dprintk(XENLOG_ERR, "Restore MSI for %pp entry %u not set?\n",
+                    &pdev->sbdf, i);
             spin_unlock_irqrestore(&desc->lock, flags);
             if ( type == PCI_CAP_ID_MSIX )
                 pci_conf_write16(pdev->sbdf, msix_control_reg(pos),
diff --git a/xen/common/vsprintf.c b/xen/common/vsprintf.c
index 183d3ed4bb..185a4bd561 100644
--- a/xen/common/vsprintf.c
+++ b/xen/common/vsprintf.c
@@ -394,6 +394,20 @@ static char *print_vcpu(char *str, const char *end, const struct vcpu *v)
     return number(str + 1, end, v->vcpu_id, 10, -1, -1, 0);
 }
 
+static char *print_pci_addr(char *str, const char *end, const pci_sbdf_t *sbdf)
+{
+    str = number(str, end, sbdf->seg, 16, 4, -1, ZEROPAD);
+    if ( str < end )
+        *str = ':';
+    str = number(str + 1, end, sbdf->bus, 16, 2, -1, ZEROPAD);
+    if ( str < end )
+        *str = ':';
+    str = number(str + 1, end, sbdf->dev, 16, 2, -1, ZEROPAD);
+    if ( str < end )
+        *str = '.';
+    return number(str + 1, end, sbdf->fn, 8, -1, -1, 0);
+}
+
 static char *pointer(char *str, const char *end, const char **fmt_ptr,
                      const void *arg, int field_width, int precision,
                      int flags)
@@ -476,6 +490,10 @@ static char *pointer(char *str, const char *end, const char **fmt_ptr,
         }
     }
 
+    case 'p': /* PCI SBDF. */
+        ++*fmt_ptr;
+        return print_pci_addr(str, end, arg);
+
     case 's': /* Symbol name with offset and size (iff offset != 0) */
     case 'S': /* Symbol name unconditionally with offset and size */
     {
diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c b/xen/drivers/passthrough/amd/iommu_acpi.c
index f4abbfd9dc..1f6b004260 100644
--- a/xen/drivers/passthrough/amd/iommu_acpi.c
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c
@@ -92,9 +92,8 @@ static void __init add_ivrs_mapping_entry(
                     iommu, &ivrs_mappings[alias_id].intremap_inuse, 0);
 
             if ( !ivrs_mappings[alias_id].intremap_table )
-                panic("No memory for %04x:%02x:%02x.%u's IRT\n",
-                      iommu->seg, PCI_BUS(alias_id), PCI_SLOT(alias_id),
-                      PCI_FUNC(alias_id));
+                panic("No memory for %pp's IRT\n",
+                      &PCI_SBDF2(iommu->seg, alias_id));
         }
     }
 
@@ -738,9 +737,8 @@ static u16 __init parse_ivhd_device_special(
         return 0;
     }
 
-    AMD_IOMMU_DEBUG("IVHD Special: %04x:%02x:%02x.%u variety %#x handle %#x\n",
-                    seg, PCI_BUS(bdf), PCI_SLOT(bdf), PCI_FUNC(bdf),
-                    special->variety, special->handle);
+    AMD_IOMMU_DEBUG("IVHD Special: %pp variety %#x handle %#x\n",
+                    &PCI_SBDF2(seg, bdf), special->variety, special->handle);
     add_ivrs_mapping_entry(bdf, bdf, special->header.data_setting, true,
                            iommu);
 
@@ -764,9 +762,9 @@ static u16 __init parse_ivhd_device_special(
         if ( idx < nr_ioapic_sbdf )
         {
             AMD_IOMMU_DEBUG("IVHD: Command line override present for IO-APIC %#x"
-                            "(IVRS: %#x devID %04x:%02x:%02x.%u)\n",
-                            ioapic_sbdf[idx].id, special->handle, seg,
-                            PCI_BUS(bdf), PCI_SLOT(bdf), PCI_FUNC(bdf));
+                            "(IVRS: %#x devID %pp)\n",
+                            ioapic_sbdf[idx].id, special->handle,
+                            &PCI_SBDF2(seg, bdf));
             break;
         }
 
@@ -836,9 +834,9 @@ static u16 __init parse_ivhd_device_special(
             break;
         case HPET_CMDL:
             AMD_IOMMU_DEBUG("IVHD: Command line override present for HPET %#x "
-                            "(IVRS: %#x devID %04x:%02x:%02x.%u)\n",
-                            hpet_sbdf.id, special->handle, seg, PCI_BUS(bdf),
-                            PCI_SLOT(bdf), PCI_FUNC(bdf));
+                            "(IVRS: %#x devID %pp)\n",
+                            hpet_sbdf.id, special->handle,
+                            &PCI_SBDF2(seg, bdf));
             break;
         case HPET_NONE:
             /* set device id of hpet */
diff --git a/xen/drivers/passthrough/amd/iommu_cmd.c b/xen/drivers/passthrough/amd/iommu_cmd.c
index 249ed345a0..6c0647c524 100644
--- a/xen/drivers/passthrough/amd/iommu_cmd.c
+++ b/xen/drivers/passthrough/amd/iommu_cmd.c
@@ -289,9 +289,8 @@ void amd_iommu_flush_iotlb(u8 devfn, const struct pci_dev *pdev,
 
     if ( !iommu )
     {
-        AMD_IOMMU_DEBUG("%s: Can't find iommu for %04x:%02x:%02x.%u\n",
-                        __func__, pdev->seg, pdev->bus,
-                        PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
+        AMD_IOMMU_DEBUG("%s: Can't find iommu for %pp\n",
+                        __func__, &pdev->sbdf);
         return;
     }
 
diff --git a/xen/drivers/passthrough/amd/iommu_detect.c b/xen/drivers/passthrough/amd/iommu_detect.c
index 8312bb4b6f..d05bc6a5bb 100644
--- a/xen/drivers/passthrough/amd/iommu_detect.c
+++ b/xen/drivers/passthrough/amd/iommu_detect.c
@@ -182,9 +182,8 @@ int __init amd_iommu_detect_one_acpi(
 
     rt = pci_ro_device(iommu->seg, bus, PCI_DEVFN(dev, func));
     if ( rt )
-        printk(XENLOG_ERR
-               "Could not mark config space of %04x:%02x:%02x.%u read-only (%d)\n",
-               iommu->seg, bus, dev, func, rt);
+        printk(XENLOG_ERR "Could not mark config space of %pp read-only (%d)\n",
+               &PCI_SBDF2(iommu->seg, iommu->bdf), rt);
 
     list_add_tail(&iommu->list, &amd_iommu_head);
     rt = 0;
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 034f3b9c2c..24d1dfec40 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -558,10 +558,10 @@ static void parse_event_log_entry(struct amd_iommu *iommu, u32 entry[])
         unsigned int flags = MASK_EXTR(entry[1], IOMMU_EVENT_FLAGS_MASK);
         uint64_t addr = *(uint64_t *)(entry + 2);
 
-        printk(XENLOG_ERR "AMD-Vi: %s: %04x:%02x:%02x.%u d%d addr %016"PRIx64
+        printk(XENLOG_ERR "AMD-Vi: %s: %pp d%u addr %016"PRIx64
                " flags %#x%s%s%s%s%s%s%s%s%s%s\n",
-               code_str, iommu->seg, PCI_BUS(device_id), PCI_SLOT(device_id),
-               PCI_FUNC(device_id), domain_id, addr, flags,
+               code_str, &PCI_SBDF2(iommu->seg, device_id),
+               domain_id, addr, flags,
                (flags & 0xe00) ? " ??" : "",
                (flags & 0x100) ? " TR" : "",
                (flags & 0x080) ? " RZ" : "",
@@ -753,9 +753,8 @@ static bool_t __init set_iommu_interrupt_handler(struct amd_iommu *iommu)
     pcidevs_unlock();
     if ( !iommu->msi.dev )
     {
-        AMD_IOMMU_DEBUG("IOMMU: no pdev for %04x:%02x:%02x.%u\n",
-                        iommu->seg, PCI_BUS(iommu->bdf),
-                        PCI_SLOT(iommu->bdf), PCI_FUNC(iommu->bdf));
+        AMD_IOMMU_DEBUG("IOMMU: no pdev for %pp\n",
+                        &PCI_SBDF2(iommu->seg, iommu->bdf));
         return 0;
     }
 
@@ -841,9 +840,6 @@ __initcall(iov_adjust_irq_affinities);
 static void amd_iommu_erratum_746_workaround(struct amd_iommu *iommu)
 {
     u32 value;
-    u8 bus = PCI_BUS(iommu->bdf);
-    u8 dev = PCI_SLOT(iommu->bdf);
-    u8 func = PCI_FUNC(iommu->bdf);
 
     if ( (boot_cpu_data.x86 != 0x15) ||
          (boot_cpu_data.x86_model < 0x10) ||
@@ -861,8 +857,8 @@ static void amd_iommu_erratum_746_workaround(struct amd_iommu *iommu)
 
     pci_conf_write32(PCI_SBDF2(iommu->seg, iommu->bdf), 0xf4, value | (1 << 2));
     printk(XENLOG_INFO
-           "AMD-Vi: Applying erratum 746 workaround for IOMMU at %04x:%02x:%02x.%u\n",
-           iommu->seg, bus, dev, func);
+           "AMD-Vi: Applying erratum 746 workaround for IOMMU at %pp\n",
+           &PCI_SBDF2(iommu->seg, iommu->bdf));
 
     /* Clear the enable writing bit */
     pci_conf_write32(PCI_SBDF2(iommu->seg, iommu->bdf), 0xf0, 0x90);
diff --git a/xen/drivers/passthrough/amd/iommu_intr.c b/xen/drivers/passthrough/amd/iommu_intr.c
index cec575071d..0adee53fb8 100644
--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -610,8 +610,7 @@ static struct amd_iommu *_find_iommu_for_device(int seg, int bdf)
     if ( iommu )
         return iommu;
 
-    AMD_IOMMU_DEBUG("No IOMMU for MSI dev = %04x:%02x:%02x.%u\n",
-                    seg, PCI_BUS(bdf), PCI_SLOT(bdf), PCI_FUNC(bdf));
+    AMD_IOMMU_DEBUG("No IOMMU for MSI dev = %pp\n", &PCI_SBDF2(seg, bdf));
     return ERR_PTR(-EINVAL);
 }
 
@@ -863,10 +862,8 @@ static void dump_intremap_table(const struct amd_iommu *iommu,
 
         if ( ivrs_mapping )
         {
-            printk("  %04x:%02x:%02x:%u:\n", iommu->seg,
-                   PCI_BUS(ivrs_mapping->dte_requestor_id),
-                   PCI_SLOT(ivrs_mapping->dte_requestor_id),
-                   PCI_FUNC(ivrs_mapping->dte_requestor_id));
+            printk("  %pp:\n",
+                   &PCI_SBDF2(iommu->seg, ivrs_mapping->dte_requestor_id));
             ivrs_mapping = NULL;
         }
 
diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index 8d6309cc8c..5f5f4a2eac 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -49,9 +49,8 @@ struct amd_iommu *find_iommu_for_device(int seg, int bdf)
                 tmp.dte_requestor_id = bdf;
             ivrs_mappings[bdf] = tmp;
 
-            printk(XENLOG_WARNING "%04x:%02x:%02x.%u not found in ACPI tables;"
-                   " using same IOMMU as function 0\n",
-                   seg, PCI_BUS(bdf), PCI_SLOT(bdf), PCI_FUNC(bdf));
+            printk(XENLOG_WARNING "%pp not found in ACPI tables;"
+                   " using same IOMMU as function 0\n", &PCI_SBDF2(seg, bdf));
 
             /* write iommu field last */
             ivrs_mappings[bdf].iommu = ivrs_mappings[bd0].iommu;
@@ -349,9 +348,8 @@ static int reassign_device(struct domain *source, struct domain *target,
         return rc;
 
     amd_iommu_setup_domain_device(target, iommu, devfn, pdev);
-    AMD_IOMMU_DEBUG("Re-assign %04x:%02x:%02x.%u from dom%d to dom%d\n",
-                    pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                    source->domain_id, target->domain_id);
+    AMD_IOMMU_DEBUG("Re-assign %pp from dom%d to dom%d\n",
+                    &pdev->sbdf, source->domain_id, target->domain_id);
 
     return 0;
 }
@@ -459,15 +457,12 @@ static int amd_iommu_add_device(u8 devfn, struct pci_dev *pdev)
         if ( pdev->type == DEV_TYPE_PCI_HOST_BRIDGE &&
              is_hardware_domain(pdev->domain) )
         {
-            AMD_IOMMU_DEBUG("Skipping host bridge %04x:%02x:%02x.%u\n",
-                            pdev->seg, pdev->bus, PCI_SLOT(devfn),
-                            PCI_FUNC(devfn));
+            AMD_IOMMU_DEBUG("Skipping host bridge %pp\n", &pdev->sbdf);
             return 0;
         }
 
-        AMD_IOMMU_DEBUG("No iommu for %04x:%02x:%02x.%u; cannot be handed to d%d\n",
-                        pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                        pdev->domain->domain_id);
+        AMD_IOMMU_DEBUG("No iommu for %pp; cannot be handed to d%d\n",
+                        &pdev->sbdf, pdev->domain->domain_id);
         return -ENODEV;
     }
 
@@ -522,10 +517,8 @@ static int amd_iommu_remove_device(u8 devfn, struct pci_dev *pdev)
     iommu = find_iommu_for_device(pdev->seg, bdf);
     if ( !iommu )
     {
-        AMD_IOMMU_DEBUG("Fail to find iommu."
-                        " %04x:%02x:%02x.%u cannot be removed from dom%d\n",
-                        pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                        pdev->domain->domain_id);
+        AMD_IOMMU_DEBUG("Fail to find iommu. %pp cannot be removed from %pd\n",
+                        &pdev->sbdf, pdev->domain);
         return -ENODEV;
     }
 
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 5846978890..e54974bcb0 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -239,10 +239,6 @@ static void check_pdev(const struct pci_dev *pdev)
     (PCI_STATUS_PARITY | PCI_STATUS_SIG_TARGET_ABORT | \
      PCI_STATUS_REC_TARGET_ABORT | PCI_STATUS_REC_MASTER_ABORT | \
      PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_DETECTED_PARITY)
-    u16 seg = pdev->seg;
-    u8 bus = pdev->bus;
-    u8 dev = PCI_SLOT(pdev->devfn);
-    u8 func = PCI_FUNC(pdev->devfn);
     u16 val;
 
     if ( command_mask )
@@ -253,8 +249,8 @@ static void check_pdev(const struct pci_dev *pdev)
         val = pci_conf_read16(pdev->sbdf, PCI_STATUS);
         if ( val & PCI_STATUS_CHECK )
         {
-            printk(XENLOG_INFO "%04x:%02x:%02x.%u status %04x -> %04x\n",
-                   seg, bus, dev, func, val, val & ~PCI_STATUS_CHECK);
+            printk(XENLOG_INFO "%pp status %04x -> %04x\n",
+                   &pdev->sbdf, val, val & ~PCI_STATUS_CHECK);
             pci_conf_write16(pdev->sbdf, PCI_STATUS, val & PCI_STATUS_CHECK);
         }
     }
@@ -271,9 +267,8 @@ static void check_pdev(const struct pci_dev *pdev)
         val = pci_conf_read16(pdev->sbdf, PCI_SEC_STATUS);
         if ( val & PCI_STATUS_CHECK )
         {
-            printk(XENLOG_INFO
-                   "%04x:%02x:%02x.%u secondary status %04x -> %04x\n",
-                   seg, bus, dev, func, val, val & ~PCI_STATUS_CHECK);
+            printk(XENLOG_INFO "%pp secondary status %04x -> %04x\n",
+                   &pdev->sbdf, val, val & ~PCI_STATUS_CHECK);
             pci_conf_write16(pdev->sbdf, PCI_SEC_STATUS,
                              val & PCI_STATUS_CHECK);
         }
@@ -427,8 +422,8 @@ static struct pci_dev *alloc_pdev(struct pci_seg *pseg, u8 bus, u8 devfn)
             break;
 
         default:
-            printk(XENLOG_WARNING "%04x:%02x:%02x.%u: unknown type %d\n",
-                   pseg->nr, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pdev->type);
+            printk(XENLOG_WARNING "%pp: unknown type %d\n",
+                   &pdev->sbdf, pdev->type);
             break;
     }
 
@@ -660,9 +655,9 @@ unsigned int pci_size_mem_bar(pci_sbdf_t sbdf, unsigned int pos,
         if ( flags & PCI_BAR_LAST )
         {
             printk(XENLOG_WARNING
-                   "%sdevice %04x:%02x:%02x.%u with 64-bit %sBAR in last slot\n",
-                   (flags & PCI_BAR_VF) ? "SR-IOV " : "", sbdf.seg, sbdf.bus,
-                   sbdf.dev, sbdf.fn, (flags & PCI_BAR_VF) ? "vf " : "");
+                   "%sdevice %pp with 64-bit %sBAR in last slot\n",
+                   (flags & PCI_BAR_VF) ? "SR-IOV " : "", &sbdf,
+                   (flags & PCI_BAR_VF) ? "vf " : "");
             *psize = 0;
             return 1;
         }
@@ -765,9 +760,8 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
                      PCI_BASE_ADDRESS_SPACE_IO )
                 {
                     printk(XENLOG_WARNING
-                           "SR-IOV device %04x:%02x:%02x.%u with vf BAR%u"
-                           " in IO space\n",
-                           seg, bus, slot, func, i);
+                           "SR-IOV device %pp with vf BAR%u in IO space\n",
+                           &pdev->sbdf, i);
                     continue;
                 }
                 ret = pci_size_mem_bar(pdev->sbdf, idx, NULL,
@@ -780,10 +774,8 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
             }
         }
         else
-            printk(XENLOG_WARNING
-                   "SR-IOV device %04x:%02x:%02x.%u has its virtual"
-                   " functions already enabled (%04x)\n",
-                   seg, bus, slot, func, ctrl);
+            printk(XENLOG_WARNING "SR-IOV device %pp has its virtual"
+                   " functions already enabled (%04x)\n", &pdev->sbdf, ctrl);
     }
 
     check_pdev(pdev);
@@ -810,15 +802,14 @@ out:
     pcidevs_unlock();
     if ( !ret )
     {
-        printk(XENLOG_DEBUG "PCI add %s %04x:%02x:%02x.%u\n", pdev_type,
-               seg, bus, slot, func);
+        printk(XENLOG_DEBUG "PCI add %s %pp\n", pdev_type,  &pdev->sbdf);
         while ( pdev->phantom_stride )
         {
             func += pdev->phantom_stride;
             if ( PCI_SLOT(func) )
                 break;
-            printk(XENLOG_DEBUG "PCI phantom %04x:%02x:%02x.%u\n",
-                   seg, bus, slot, func);
+            printk(XENLOG_DEBUG "PCI phantom %pp\n",
+                   &PCI_SBDF(seg, bus, slot, func));
         }
     }
     return ret;
@@ -847,9 +838,8 @@ int pci_remove_device(u16 seg, u8 bus, u8 devfn)
             if ( pdev->domain )
                 list_del(&pdev->domain_list);
             pci_cleanup_msi(pdev);
+            printk(XENLOG_DEBUG "PCI remove device %pp\n", &pdev->sbdf);
             free_pdev(pseg, pdev);
-            printk(XENLOG_DEBUG "PCI remove device %04x:%02x:%02x.%u\n",
-                   seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
             break;
         }
 
@@ -968,8 +958,8 @@ static int deassign_device(struct domain *d, uint16_t seg, uint8_t bus,
 
  out:
     if ( ret )
-        printk(XENLOG_G_ERR "%pd: deassign (%04x:%02x:%02x.%u) failed (%d)\n",
-               d, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), ret);
+        printk(XENLOG_G_ERR "%pd: deassign (%pp) failed (%d)\n",
+               d, &PCI_SBDF3(seg, bus, devfn), ret);
 
     return ret;
 }
@@ -1138,8 +1128,8 @@ static int __init _scan_pci_devices(struct pci_seg *pseg, void *arg)
                 pdev = alloc_pdev(pseg, bus, PCI_DEVFN(dev, func));
                 if ( !pdev )
                 {
-                    printk(XENLOG_WARNING "%04x:%02x:%02x.%u: alloc_pdev failed\n",
-                           pseg->nr, bus, dev, func);
+                    printk(XENLOG_WARNING "%pp: alloc_pdev failed\n",
+                           &PCI_SBDF(pseg->nr, bus, dev, func));
                     return -ENOMEM;
                 }
 
@@ -1180,9 +1170,8 @@ static void __hwdom_init setup_one_hwdom_device(const struct setup_hwdom *ctxt,
         err = ctxt->handler(devfn, pdev);
         if ( err )
         {
-            printk(XENLOG_ERR "setup %04x:%02x:%02x.%u for d%d failed (%d)\n",
-                   pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                   ctxt->d->domain_id, err);
+            printk(XENLOG_ERR "setup %pp for d%d failed (%d)\n",
+                   &pdev->sbdf, ctxt->d->domain_id, err);
             if ( devfn == pdev->devfn )
                 return;
         }
@@ -1223,9 +1212,8 @@ static int __hwdom_init _setup_hwdom_pci_devices(struct pci_seg *pseg, void *arg
                 pdev->domain = dom_xen;
             }
             else if ( pdev->domain != ctxt->d )
-                printk(XENLOG_WARNING "Dom%d owning %04x:%02x:%02x.%u?\n",
-                       pdev->domain->domain_id, pseg->nr, bus,
-                       PCI_SLOT(devfn), PCI_FUNC(devfn));
+                printk(XENLOG_WARNING "Dom%d owning %pp?\n",
+                       pdev->domain->domain_id, &pdev->sbdf);
 
             if ( iommu_verbose )
             {
@@ -1361,9 +1349,8 @@ static int _dump_pci_devices(struct pci_seg *pseg, void *arg)
 
     list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
     {
-        printk("%04x:%02x:%02x.%u - %pd - node %-3d - MSIs < ",
-               pseg->nr, pdev->bus,
-               PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), pdev->domain,
+        printk("%pp - %pd - node %-3d - MSIs < ",
+               &pdev->sbdf, pdev->domain,
                (pdev->node != NUMA_NO_NODE) ? pdev->node : -1);
         list_for_each_entry ( msi, &pdev->msi_list, list )
                printk("%d ", msi->irq);
@@ -1428,8 +1415,8 @@ static int iommu_add_device(struct pci_dev *pdev)
             return 0;
         rc = hd->platform_ops->add_device(devfn, pci_to_dev(pdev));
         if ( rc )
-            printk(XENLOG_WARNING "IOMMU: add %04x:%02x:%02x.%u failed (%d)\n",
-                   pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn), rc);
+            printk(XENLOG_WARNING "IOMMU: add %pp failed (%d)\n",
+                   &pdev->sbdf, rc);
     }
 }
 
@@ -1473,8 +1460,7 @@ static int iommu_remove_device(struct pci_dev *pdev)
         if ( !rc )
             continue;
 
-        printk(XENLOG_ERR "IOMMU: remove %04x:%02x:%02x.%u failed (%d)\n",
-               pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn), rc);
+        printk(XENLOG_ERR "IOMMU: remove %pp failed (%d)\n", &pdev->sbdf, rc);
         return rc;
     }
 
@@ -1550,8 +1536,8 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn, u32 flag)
 
  done:
     if ( rc )
-        printk(XENLOG_G_WARNING "%pd: assign (%04x:%02x:%02x.%u) failed (%d)\n",
-               d, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), rc);
+        printk(XENLOG_G_WARNING "%pd: assign (%pp) failed (%d)\n",
+               d, &PCI_SBDF3(seg, bus, devfn), rc);
     /* The device is assigned to dom_io so mark it as quarantined */
     else if ( d == dom_io )
         pdev->quarantine = true;
@@ -1624,10 +1610,8 @@ void iommu_dev_iotlb_flush_timeout(struct domain *d, struct pci_dev *pdev)
     _pci_hide_device(pdev);
 
     if ( !d->is_shutting_down && printk_ratelimit() )
-        printk(XENLOG_ERR
-               "dom%d: ATS device %04x:%02x:%02x.%u flush failed\n",
-               d->domain_id, pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
-               PCI_FUNC(pdev->devfn));
+        printk(XENLOG_ERR "dom%d: ATS device %pp flush failed\n",
+               d->domain_id, &pdev->sbdf);
     if ( !is_hardware_domain(d) )
         domain_crash(d);
 
@@ -1717,9 +1701,8 @@ int iommu_do_pci_domctl(
         {
             if ( ret )
             {
-                printk(XENLOG_G_INFO
-                       "%04x:%02x:%02x.%u already assigned, or non-existent\n",
-                       seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+                printk(XENLOG_G_INFO "%pp already assigned, or non-existent\n",
+                       &PCI_SBDF3(seg, bus, devfn));
                 ret = -EINVAL;
             }
         }
diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 29cd5c5d70..36d909b06d 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -349,9 +349,8 @@ static int __init acpi_parse_dev_scope(
             sub_bus = pci_conf_read8(PCI_SBDF(seg, bus, path->dev, path->fn),
                                      PCI_SUBORDINATE_BUS);
             if ( iommu_verbose )
-                printk(VTDPREFIX
-                       " bridge: %04x:%02x:%02x.%u start=%x sec=%x sub=%x\n",
-                       seg, bus, path->dev, path->fn,
+                printk(VTDPREFIX " bridge: %pp start=%x sec=%x sub=%x\n",
+                       &PCI_SBDF(seg, bus, path->dev, path->fn),
                        acpi_scope->bus, sec_bus, sub_bus);
 
             dmar_scope_add_buses(scope, sec_bus, sub_bus);
@@ -359,8 +358,8 @@ static int __init acpi_parse_dev_scope(
 
         case ACPI_DMAR_SCOPE_TYPE_HPET:
             if ( iommu_verbose )
-                printk(VTDPREFIX " MSI HPET: %04x:%02x:%02x.%u\n",
-                       seg, bus, path->dev, path->fn);
+                printk(VTDPREFIX " MSI HPET: %pp\n",
+                       &PCI_SBDF(seg, bus, path->dev, path->fn));
 
             if ( drhd )
             {
@@ -381,8 +380,8 @@ static int __init acpi_parse_dev_scope(
 
         case ACPI_DMAR_SCOPE_TYPE_ENDPOINT:
             if ( iommu_verbose )
-                printk(VTDPREFIX " endpoint: %04x:%02x:%02x.%u\n",
-                       seg, bus, path->dev, path->fn);
+                printk(VTDPREFIX " endpoint: %pp\n",
+                       &PCI_SBDF(seg, bus, path->dev, path->fn));
 
             if ( drhd )
             {
@@ -395,8 +394,8 @@ static int __init acpi_parse_dev_scope(
 
         case ACPI_DMAR_SCOPE_TYPE_IOAPIC:
             if ( iommu_verbose )
-                printk(VTDPREFIX " IOAPIC: %04x:%02x:%02x.%u\n",
-                       seg, bus, path->dev, path->fn);
+                printk(VTDPREFIX " IOAPIC: %pp\n",
+                       &PCI_SBDF(seg, bus, path->dev, path->fn));
 
             if ( drhd )
             {
@@ -525,8 +524,8 @@ acpi_parse_one_drhd(struct acpi_dmar_header *header)
 
             if ( !pci_device_detect(drhd->segment, b, d, f) )
                 printk(XENLOG_WARNING VTDPREFIX
-                       " Non-existent device (%04x:%02x:%02x.%u) in this DRHD's scope!\n",
-                       drhd->segment, b, d, f);
+                       " Non-existent device (%pp) in this DRHD's scope!\n",
+                       &PCI_SBDF(drhd->segment, b, d, f));
         }
 
         acpi_register_drhd_unit(dmaru);
@@ -562,9 +561,9 @@ static int register_one_rmrr(struct acpi_rmrr_unit *rmrru)
         if ( pci_device_detect(rmrru->segment, b, d, f) == 0 )
         {
             dprintk(XENLOG_WARNING VTDPREFIX,
-                    " Non-existent device (%04x:%02x:%02x.%u) is reported"
-                    " in RMRR [%"PRIx64",%"PRIx64"]'s scope!\n",
-                    rmrru->segment, b, d, f,
+                    " Non-existent device (%pp) is reported"
+                    " in RMRR [%"PRIx64", %"PRIx64"]'s scope!\n",
+                    &PCI_SBDF(rmrru->segment, b, d, f),
                     rmrru->base_address, rmrru->end_address);
             ignore = true;
         }
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index a2f02c1bea..0d2a9d78de 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -521,16 +521,13 @@ static void set_msi_source_id(struct pci_dev *pdev, struct iremap_entry *ire)
         }
         else
             dprintk(XENLOG_WARNING VTDPREFIX,
-                    "d%d: no upstream bridge for %04x:%02x:%02x.%u\n",
-                    pdev->domain->domain_id,
-                    seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+                    "d%d: no upstream bridge for %pp\n",
+                    pdev->domain->domain_id, &pdev->sbdf);
         break;
 
     default:
-        dprintk(XENLOG_WARNING VTDPREFIX,
-                "d%d: unknown(%u): %04x:%02x:%02x.%u\n",
-                pdev->domain->domain_id, pdev->type,
-                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+        dprintk(XENLOG_WARNING VTDPREFIX, "d%d: unknown(%u): %pp\n",
+                pdev->domain->domain_id, pdev->type, &pdev->sbdf);
         break;
    }
 }
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 01dc444771..deaeab095d 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -870,27 +870,24 @@ static int iommu_page_fault_do_one(struct vtd_iommu *iommu, int type,
     {
     case DMA_REMAP:
         printk(XENLOG_G_WARNING VTDPREFIX
-               "DMAR:[%s] Request device [%04x:%02x:%02x.%u] "
+               "DMAR:[%s] Request device [%pp] "
                "fault addr %"PRIx64"\n",
                (type ? "DMA Read" : "DMA Write"),
-               seg, PCI_BUS(source_id), PCI_SLOT(source_id),
-               PCI_FUNC(source_id), addr);
+               &PCI_SBDF2(seg, source_id), addr);
         kind = "DMAR";
         break;
     case INTR_REMAP:
         printk(XENLOG_G_WARNING VTDPREFIX
-               "INTR-REMAP: Request device [%04x:%02x:%02x.%u] "
+               "INTR-REMAP: Request device [%pp] "
                "fault index %"PRIx64"\n",
-               seg, PCI_BUS(source_id), PCI_SLOT(source_id),
-               PCI_FUNC(source_id), addr >> 48);
+               &PCI_SBDF2(seg, source_id), addr >> 48);
         kind = "INTR-REMAP";
         break;
     default:
         printk(XENLOG_G_WARNING VTDPREFIX
-               "UNKNOWN: Request device [%04x:%02x:%02x.%u] "
+               "UNKNOWN: Request device [%pp] "
                "fault addr %"PRIx64"\n",
-               seg, PCI_BUS(source_id), PCI_SLOT(source_id),
-               PCI_FUNC(source_id), addr);
+               &PCI_SBDF2(seg, source_id), addr);
         kind = "UNKNOWN";
         break;
     }
@@ -1336,9 +1333,8 @@ int domain_context_mapping_one(
         {
             if ( pdev->domain != domain )
             {
-                printk(XENLOG_G_INFO VTDPREFIX
-                       "%pd: %04x:%02x:%02x.%u owned by %pd\n",
-                       domain, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                printk(XENLOG_G_INFO VTDPREFIX "%pd: %pp owned by %pd",
+                       domain, &PCI_SBDF3(seg, bus, devfn),
                        pdev->domain);
                 res = -EINVAL;
             }
@@ -1351,17 +1347,15 @@ int domain_context_mapping_one(
             if ( cdomain < 0 )
             {
                 printk(XENLOG_G_WARNING VTDPREFIX
-                       "%pd: %04x:%02x:%02x.%u mapped, but can't find owner\n",
-                       domain, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+                       "%pd: %pp mapped, but can't find owner\n",
+                       domain, &PCI_SBDF3(seg, bus, devfn));
                 res = -EINVAL;
             }
             else if ( cdomain != domain->domain_id )
             {
                 printk(XENLOG_G_INFO VTDPREFIX
-                       "%pd: %04x:%02x:%02x.%u already mapped to d%d\n",
-                       domain,
-                       seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                       cdomain);
+                       "%pd: %pp already mapped to d%d",
+                       domain, &PCI_SBDF3(seg, bus, devfn), cdomain);
                 res = -EINVAL;
             }
         }
@@ -1487,9 +1481,8 @@ static int domain_context_mapping(struct domain *domain, u8 devfn,
     {
     case DEV_TYPE_PCI_HOST_BRIDGE:
         if ( iommu_debug )
-            printk(VTDPREFIX "d%d:Hostbridge: skip %04x:%02x:%02x.%u map\n",
-                   domain->domain_id, seg, bus,
-                   PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(VTDPREFIX "%pd:Hostbridge: skip %pp map\n",
+                   domain, &PCI_SBDF3(seg, bus, devfn));
         if ( !is_hardware_domain(domain) )
             return -EPERM;
         break;
@@ -1501,9 +1494,8 @@ static int domain_context_mapping(struct domain *domain, u8 devfn,
 
     case DEV_TYPE_PCIe_ENDPOINT:
         if ( iommu_debug )
-            printk(VTDPREFIX "d%d:PCIe: map %04x:%02x:%02x.%u\n",
-                   domain->domain_id, seg, bus,
-                   PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(VTDPREFIX "%pd:PCIe: map %pp\n",
+                   domain, &PCI_SBDF3(seg, bus, devfn));
         ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn,
                                          pdev);
         if ( !ret && devfn == pdev->devfn && ats_device(pdev, drhd) > 0 )
@@ -1513,9 +1505,8 @@ static int domain_context_mapping(struct domain *domain, u8 devfn,
 
     case DEV_TYPE_PCI:
         if ( iommu_debug )
-            printk(VTDPREFIX "d%d:PCI: map %04x:%02x:%02x.%u\n",
-                   domain->domain_id, seg, bus,
-                   PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(VTDPREFIX "%pd:PCI: map %pp\n",
+                   domain, &PCI_SBDF3(seg, bus, devfn));
 
         ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn,
                                          pdev);
@@ -1551,9 +1542,8 @@ static int domain_context_mapping(struct domain *domain, u8 devfn,
         break;
 
     default:
-        dprintk(XENLOG_ERR VTDPREFIX, "d%d:unknown(%u): %04x:%02x:%02x.%u\n",
-                domain->domain_id, pdev->type,
-                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+        dprintk(XENLOG_ERR VTDPREFIX, "%pd:unknown(%u): %pp\n",
+                domain, pdev->type, &PCI_SBDF3(seg, bus, devfn));
         ret = -EINVAL;
         break;
     }
@@ -1648,9 +1638,8 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
     {
     case DEV_TYPE_PCI_HOST_BRIDGE:
         if ( iommu_debug )
-            printk(VTDPREFIX "d%d:Hostbridge: skip %04x:%02x:%02x.%u unmap\n",
-                   domain->domain_id, seg, bus,
-                   PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(VTDPREFIX "%pd:Hostbridge: skip %pp unmap\n",
+                   domain, &PCI_SBDF3(seg, bus, devfn));
         if ( !is_hardware_domain(domain) )
             return -EPERM;
         goto out;
@@ -1662,9 +1651,8 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
 
     case DEV_TYPE_PCIe_ENDPOINT:
         if ( iommu_debug )
-            printk(VTDPREFIX "d%d:PCIe: unmap %04x:%02x:%02x.%u\n",
-                   domain->domain_id, seg, bus,
-                   PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(VTDPREFIX "%pd:PCIe: unmap %pp\n",
+                   domain, &PCI_SBDF3(seg, bus, devfn));
         ret = domain_context_unmap_one(domain, iommu, bus, devfn);
         if ( !ret && devfn == pdev->devfn && ats_device(pdev, drhd) > 0 )
             disable_ats_device(pdev);
@@ -1673,8 +1661,8 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
 
     case DEV_TYPE_PCI:
         if ( iommu_debug )
-            printk(VTDPREFIX "d%d:PCI: unmap %04x:%02x:%02x.%u\n",
-                   domain->domain_id, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(VTDPREFIX "%pd:PCI: unmap %pp\n",
+                   domain, &PCI_SBDF3(seg, bus, devfn));
         ret = domain_context_unmap_one(domain, iommu, bus, devfn);
         if ( ret )
             break;
@@ -1699,9 +1687,8 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
         break;
 
     default:
-        dprintk(XENLOG_ERR VTDPREFIX, "d%d:unknown(%u): %04x:%02x:%02x.%u\n",
-                domain->domain_id, pdev->type,
-                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+        dprintk(XENLOG_ERR VTDPREFIX, "%pd:unknown(%u): %pp\n",
+                domain, pdev->type, &PCI_SBDF3(seg, bus, devfn));
         ret = -EINVAL;
         goto out;
     }
@@ -2459,12 +2446,11 @@ static int intel_iommu_assign_device(
             bool_t relaxed = !!(flag & XEN_DOMCTL_DEV_RDM_RELAXED);
 
             printk(XENLOG_GUEST "%s" VTDPREFIX
-                   " It's %s to assign %04x:%02x:%02x.%u"
-                   " with shared RMRR at %"PRIx64" for Dom%d.\n",
+                   " It's %s to assign %pp"
+                   " with shared RMRR at %"PRIx64" for %pd.\n",
                    relaxed ? XENLOG_WARNING : XENLOG_ERR,
                    relaxed ? "risky" : "disallowed",
-                   seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                   rmrr->base_address, d->domain_id);
+                   &PCI_SBDF3(seg, bus, devfn), rmrr->base_address, d);
             if ( !relaxed )
                 return -EPERM;
         }
@@ -2494,8 +2480,8 @@ static int intel_iommu_assign_device(
                 if ( rc )
                 {
                     printk(XENLOG_ERR VTDPREFIX
-                           " failed to reclaim %04x:%02x:%02x.%u from %pd (%d)\n",
-                           seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), d, rc);
+                           " failed to reclaim %pp from %pd (%d)\n",
+                           &PCI_SBDF3(seg, bus, devfn), d, rc);
                     domain_crash(d);
                 }
                 break;
diff --git a/xen/drivers/passthrough/vtd/quirks.c b/xen/drivers/passthrough/vtd/quirks.c
index 5594270678..a8330f17bc 100644
--- a/xen/drivers/passthrough/vtd/quirks.c
+++ b/xen/drivers/passthrough/vtd/quirks.c
@@ -413,8 +413,6 @@ void pci_vtd_quirk(const struct pci_dev *pdev)
 {
     int seg = pdev->seg;
     int bus = pdev->bus;
-    int dev = PCI_SLOT(pdev->devfn);
-    int func = PCI_FUNC(pdev->devfn);
     int pos;
     bool_t ff;
     u32 val, val2;
@@ -438,8 +436,7 @@ void pci_vtd_quirk(const struct pci_dev *pdev)
     case 0x3c28: /* Sandybridge */
         val = pci_conf_read32(pdev->sbdf, 0x1AC);
         pci_conf_write32(pdev->sbdf, 0x1AC, val | (1 << 31));
-        printk(XENLOG_INFO "Masked VT-d error signaling on %04x:%02x:%02x.%u\n",
-               seg, bus, dev, func);
+        printk(XENLOG_INFO "Masked VT-d error signaling on %pp\n", &pdev->sbdf);
         break;
 
     /* Tylersburg (EP)/Boxboro (MP) chipsets (NHM-EP/EX, WSM-EP/EX) */
@@ -474,8 +471,7 @@ void pci_vtd_quirk(const struct pci_dev *pdev)
             ff = pcie_aer_get_firmware_first(pdev);
         if ( !pos )
         {
-            printk(XENLOG_WARNING "%04x:%02x:%02x.%u without AER capability?\n",
-                   seg, bus, dev, func);
+            printk(XENLOG_WARNING "%pp without AER capability?\n", &pdev->sbdf);
             break;
         }
 
@@ -498,8 +494,7 @@ void pci_vtd_quirk(const struct pci_dev *pdev)
         val = pci_conf_read32(pdev->sbdf, 0x20c);
         pci_conf_write32(pdev->sbdf, 0x20c, val | (1 << 4));
 
-        printk(XENLOG_INFO "%s UR signaling on %04x:%02x:%02x.%u\n",
-               action, seg, bus, dev, func);
+        printk(XENLOG_INFO "%s UR signaling on %pp\n", action, &pdev->sbdf);
         break;
 
     case 0x0040: case 0x0044: case 0x0048: /* Nehalem/Westmere */
@@ -524,16 +519,15 @@ void pci_vtd_quirk(const struct pci_dev *pdev)
             {
                 __set_bit(0x1c8 * 8 + 20, va);
                 iounmap(va);
-                printk(XENLOG_INFO "Masked UR signaling on %04x:%02x:%02x.%u\n",
-                       seg, bus, dev, func);
+                printk(XENLOG_INFO "Masked UR signaling on %pp\n", &pdev->sbdf);
             }
             else
-                printk(XENLOG_ERR "Could not map %"PRIpaddr" for %04x:%02x:%02x.%u\n",
-                       pa, seg, bus, dev, func);
+                printk(XENLOG_ERR "Could not map %"PRIpaddr" for %pp\n",
+                       pa, &pdev->sbdf);
         }
         else
-            printk(XENLOG_WARNING "Bogus DMIBAR %#"PRIx64" on %04x:%02x:%02x.%u\n",
-                   bar, seg, bus, dev, func);
+            printk(XENLOG_WARNING "Bogus DMIBAR %#"PRIx64" on %pp\n",
+                   bar, &pdev->sbdf);
         break;
     }
 }
diff --git a/xen/drivers/passthrough/vtd/utils.c b/xen/drivers/passthrough/vtd/utils.c
index 7552dd8e0c..4febcf506d 100644
--- a/xen/drivers/passthrough/vtd/utils.c
+++ b/xen/drivers/passthrough/vtd/utils.c
@@ -95,9 +95,9 @@ void print_vtd_entries(struct vtd_iommu *iommu, int bus, int devfn, u64 gmfn)
     u64 *l, val;
     u32 l_index, level;
 
-    printk("print_vtd_entries: iommu #%u dev %04x:%02x:%02x.%u gmfn %"PRI_gfn"\n",
-           iommu->index, iommu->drhd->segment, bus,
-           PCI_SLOT(devfn), PCI_FUNC(devfn), gmfn);
+    printk("print_vtd_entries: iommu #%u dev %pp gmfn %"PRI_gfn"\n",
+           iommu->index, &PCI_SBDF3(iommu->drhd->segment, bus, devfn),
+           gmfn);
 
     if ( iommu->root_maddr == 0 )
     {
diff --git a/xen/drivers/passthrough/x86/ats.c b/xen/drivers/passthrough/x86/ats.c
index 8ae0eae4a2..4628ffde45 100644
--- a/xen/drivers/passthrough/x86/ats.c
+++ b/xen/drivers/passthrough/x86/ats.c
@@ -32,8 +32,7 @@ int enable_ats_device(struct pci_dev *pdev, struct list_head *ats_list)
     BUG_ON(!pos);
 
     if ( iommu_verbose )
-        dprintk(XENLOG_INFO, "%04x:%02x:%02x.%u: ATS capability found\n",
-                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+        dprintk(XENLOG_INFO, "%pp: ATS capability found\n", &pdev->sbdf);
 
     value = pci_conf_read16(pdev->sbdf, pos + ATS_REG_CTL);
     if ( value & ATS_ENABLE )
@@ -64,9 +63,8 @@ int enable_ats_device(struct pci_dev *pdev, struct list_head *ats_list)
     }
 
     if ( iommu_verbose )
-        dprintk(XENLOG_INFO, "%04x:%02x:%02x.%u: ATS %s enabled\n",
-                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                pos ? "is" : "was");
+        dprintk(XENLOG_INFO, "%pp: ATS %s enabled\n",
+                &pdev->sbdf, pos ? "is" : "was");
 
     return pos;
 }
@@ -74,8 +72,6 @@ int enable_ats_device(struct pci_dev *pdev, struct list_head *ats_list)
 void disable_ats_device(struct pci_dev *pdev)
 {
     u32 value;
-    u16 seg = pdev->seg;
-    u8 bus = pdev->bus, devfn = pdev->devfn;
 
     BUG_ON(!pdev->ats.cap_pos);
 
@@ -86,6 +82,5 @@ void disable_ats_device(struct pci_dev *pdev)
     list_del(&pdev->ats.list);
 
     if ( iommu_verbose )
-        dprintk(XENLOG_INFO, "%04x:%02x:%02x.%u: ATS is disabled\n",
-                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+        dprintk(XENLOG_INFO, "%pp: ATS is disabled\n", &pdev->sbdf);
 }
diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index 3c794f486d..ba9a036202 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -355,7 +355,6 @@ static void bar_write(const struct pci_dev *pdev, unsigned int reg,
                       uint32_t val, void *data)
 {
     struct vpci_bar *bar = data;
-    uint8_t slot = PCI_SLOT(pdev->devfn), func = PCI_FUNC(pdev->devfn);
     bool hi = false;
 
     if ( bar->type == VPCI_BAR_MEM64_HI )
@@ -372,9 +371,8 @@ static void bar_write(const struct pci_dev *pdev, unsigned int reg,
         /* If the value written is the current one avoid printing a warning. */
         if ( val != (uint32_t)(bar->addr >> (hi ? 32 : 0)) )
             gprintk(XENLOG_WARNING,
-                    "%04x:%02x:%02x.%u: ignored BAR %lu write with memory decoding enabled\n",
-                    pdev->seg, pdev->bus, slot, func,
-                    bar - pdev->vpci->header.bars + hi);
+                    "%pp: ignored BAR %lu write with memory decoding enabled\n",
+                    &pdev->sbdf, bar - pdev->vpci->header.bars + hi);
         return;
     }
 
@@ -402,15 +400,14 @@ static void rom_write(const struct pci_dev *pdev, unsigned int reg,
 {
     struct vpci_header *header = &pdev->vpci->header;
     struct vpci_bar *rom = data;
-    uint8_t slot = PCI_SLOT(pdev->devfn), func = PCI_FUNC(pdev->devfn);
     uint16_t cmd = pci_conf_read16(pdev->sbdf, PCI_COMMAND);
     bool new_enabled = val & PCI_ROM_ADDRESS_ENABLE;
 
     if ( (cmd & PCI_COMMAND_MEMORY) && header->rom_enabled && new_enabled )
     {
         gprintk(XENLOG_WARNING,
-                "%04x:%02x:%02x.%u: ignored ROM BAR write with memory decoding enabled\n",
-                pdev->seg, pdev->bus, slot, func);
+                "%pp: ignored ROM BAR write with memory decoding enabled\n",
+                &pdev->sbdf);
         return;
     }
 
diff --git a/xen/drivers/vpci/msi.c b/xen/drivers/vpci/msi.c
index 75010762ed..65db438d24 100644
--- a/xen/drivers/vpci/msi.c
+++ b/xen/drivers/vpci/msi.c
@@ -289,8 +289,7 @@ void vpci_dump_msi(void)
             msi = pdev->vpci->msi;
             if ( msi && msi->enabled )
             {
-                printk("%04x:%02x:%02x.%u MSI\n", pdev->seg, pdev->bus,
-                       PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
+                printk("%pp MSI\n", &pdev->sbdf);
 
                 printk("  enabled: %d 64-bit: %d",
                        msi->enabled, msi->address64);
@@ -307,8 +306,7 @@ void vpci_dump_msi(void)
             {
                 int rc;
 
-                printk("%04x:%02x:%02x.%u MSI-X\n", pdev->seg, pdev->bus,
-                       PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
+                printk("%pp MSI-X\n", &pdev->sbdf);
 
                 printk("  entries: %u maskall: %d enabled: %d\n",
                        msix->max_entries, msix->masked, msix->enabled);
diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
index 38c1e7e5dd..64dd0a929c 100644
--- a/xen/drivers/vpci/msix.c
+++ b/xen/drivers/vpci/msix.c
@@ -42,15 +42,14 @@ static uint32_t control_read(const struct pci_dev *pdev, unsigned int reg,
 static int update_entry(struct vpci_msix_entry *entry,
                         const struct pci_dev *pdev, unsigned int nr)
 {
-    uint8_t slot = PCI_SLOT(pdev->devfn), func = PCI_FUNC(pdev->devfn);
     int rc = vpci_msix_arch_disable_entry(entry, pdev);
 
     /* Ignore ENOENT, it means the entry wasn't setup. */
     if ( rc && rc != -ENOENT )
     {
         gprintk(XENLOG_WARNING,
-                "%04x:%02x:%02x.%u: unable to disable entry %u for update: %d\n",
-                pdev->seg, pdev->bus, slot, func, nr, rc);
+                "%pp: unable to disable entry %u for update: %d\n",
+                &pdev->sbdf, nr, rc);
         return rc;
     }
 
@@ -59,9 +58,8 @@ static int update_entry(struct vpci_msix_entry *entry,
                                                       VPCI_MSIX_TABLE));
     if ( rc )
     {
-        gprintk(XENLOG_WARNING,
-                "%04x:%02x:%02x.%u: unable to enable entry %u: %d\n",
-                pdev->seg, pdev->bus, slot, func, nr, rc);
+        gprintk(XENLOG_WARNING, "%pp: unable to enable entry %u: %d\n",
+                &pdev->sbdf, nr, rc);
         /* Entry is likely not properly configured. */
         return rc;
     }
@@ -72,7 +70,6 @@ static int update_entry(struct vpci_msix_entry *entry,
 static void control_write(const struct pci_dev *pdev, unsigned int reg,
                           uint32_t val, void *data)
 {
-    uint8_t slot = PCI_SLOT(pdev->devfn), func = PCI_FUNC(pdev->devfn);
     struct vpci_msix *msix = data;
     bool new_masked = val & PCI_MSIX_FLAGS_MASKALL;
     bool new_enabled = val & PCI_MSIX_FLAGS_ENABLE;
@@ -133,9 +130,8 @@ static void control_write(const struct pci_dev *pdev, unsigned int reg,
                 /* Ignore non-present entry. */
                 break;
             default:
-                gprintk(XENLOG_WARNING,
-                        "%04x:%02x:%02x.%u: unable to disable entry %u: %d\n",
-                        pdev->seg, pdev->bus, slot, func, i, rc);
+                gprintk(XENLOG_WARNING, "%pp: unable to disable entry %u: %d\n",
+                        &pdev->sbdf, i, rc);
                 return;
             }
         }
@@ -180,8 +176,7 @@ static bool access_allowed(const struct pci_dev *pdev, unsigned long addr,
         return true;
 
     gprintk(XENLOG_WARNING,
-            "%04x:%02x:%02x.%u: unaligned or invalid size MSI-X table access\n",
-            pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
+            "%pp: unaligned or invalid size MSI-X table access\n", &pdev->sbdf);
 
     return false;
 }
@@ -431,10 +426,9 @@ int vpci_make_msix_hole(const struct pci_dev *pdev)
             default:
                 put_gfn(d, start);
                 gprintk(XENLOG_WARNING,
-                        "%04x:%02x:%02x.%u: existing mapping (mfn: %" PRI_mfn
+                        "%pp: existing mapping (mfn: %" PRI_mfn
                         "type: %d) at %#lx clobbers MSIX MMIO area\n",
-                        pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
-                        PCI_FUNC(pdev->devfn), mfn_x(mfn), t, start);
+                        &pdev->sbdf, mfn_x(mfn), t, start);
                 return -EEXIST;
             }
             put_gfn(d, start);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 18:44:27 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 18:44:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1k0UaR-0002wA-2j; Tue, 28 Jul 2020 18:44:27 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0UaP-0002w2-RT
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:44:25 +0000
X-Inumbo-ID: 5be52994-d102-11ea-8bc3-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 5be52994-d102-11ea-8bc3-bc764e2007e4;
 Tue, 28 Jul 2020 18:44:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=oknjXKv+uY+mdPi477hK4UkDLb/T+pPb2xMpOzHLIWo=; b=HMdDzw2heMeg3qPqMlITnp+AJG
 qH6M4iNlo5+vLETu8sLfKqoOP1BxNU9W8tBWuqxekxUPHJX3ekngvh1/XTBsUeElynYc3OSGNLo9j
 GCtUGCbdIDcrw7Kpl8jg0yTfqRL+8Tydej4hP9a9MLfyhbit1GEXFGeFro+E25DOLvy0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0UaO-0007eS-Uw
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:44:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0UaO-0001cR-T7
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:44:24 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/hvm: fix vIO-APIC build without IRQ0_SPECIAL_ROUTING
Message-Id: <E1k0UaO-0001cR-T7@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 18:44:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 4489ffdec331cdd3a2e025f9def68e07403706d1
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Jul 27 19:05:35 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jul 28 19:33:28 2020 +0100

    x86/hvm: fix vIO-APIC build without IRQ0_SPECIAL_ROUTING
    
    pit_channel0_enabled needs to be guarded with IRQ0_SPECIAL_ROUTING
    since it's only used when the special handling of ISA IRQ 0 is
    enabled. However such helper being a single line it's better to just
    inline it directly in vioapic_deliver where it's used.
    
    No functional change.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/vioapic.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index b87facb0e0..b00037ea87 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -391,11 +391,6 @@ static void ioapic_inj_irq(
     vlapic_set_irq(target, vector, trig_mode);
 }
 
-static inline int pit_channel0_enabled(void)
-{
-    return pt_active(&current->domain->arch.vpit.pt0);
-}
-
 static void vioapic_deliver(struct hvm_vioapic *vioapic, unsigned int pin)
 {
     uint16_t dest = vioapic->redirtbl[pin].fields.dest_id;
@@ -421,7 +416,7 @@ static void vioapic_deliver(struct hvm_vioapic *vioapic, unsigned int pin)
     {
 #ifdef IRQ0_SPECIAL_ROUTING
         /* Force round-robin to pick VCPU 0 */
-        if ( (irq == hvm_isa_irq_to_gsi(0)) && pit_channel0_enabled() )
+        if ( (irq == hvm_isa_irq_to_gsi(0)) && pt_active(&d->arch.vpit.pt0) )
         {
             v = d->vcpu ? d->vcpu[0] : NULL;
             target = v ? vcpu_vlapic(v) : NULL;
@@ -446,7 +441,7 @@ static void vioapic_deliver(struct hvm_vioapic *vioapic, unsigned int pin)
     {
 #ifdef IRQ0_SPECIAL_ROUTING
         /* Do not deliver timer interrupts to VCPU != 0 */
-        if ( (irq == hvm_isa_irq_to_gsi(0)) && pit_channel0_enabled() )
+        if ( (irq == hvm_isa_irq_to_gsi(0)) && pt_active(&d->arch.vpit.pt0) )
         {
             if ( (v = d->vcpu ? d->vcpu[0] : NULL) != NULL )
                 ioapic_inj_irq(vioapic, vcpu_vlapic(v), vector,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 18:44:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 18:44:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1k0Uab-0002xN-4F; Tue, 28 Jul 2020 18:44:37 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0UaZ-0002xC-Tc
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:44:35 +0000
X-Inumbo-ID: 61eebc88-d102-11ea-8bc3-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 61eebc88-d102-11ea-8bc3-bc764e2007e4;
 Tue, 28 Jul 2020 18:44:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=sxJBQGNq1UhXAWXr5Ced7qiCzn6KuAb4bBra5aF0F7o=; b=3TrAumym2xhFniLwuX3w3AmN/N
 hZHsyXDIzOi3d8TlEld84FSyXpMp9kzjQidAsNHBoh/gzsyDcvYPPt0B+rNhu0y/qds3OnlZiXsQm
 5UBF1usnbraMry9wx3Pu+vNVdcMJ9IURJEr7Qzikb9/aO6DOS6q4naeEEVmzD+DIOkJs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0UaZ-0007ef-1g
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0UaZ-0001d6-0m
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:44:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/hvm: don't force vCPU 0 for IRQ 0 when using fixed
 destination mode
Message-Id: <E1k0UaZ-0001d6-0m@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 18:44:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ab5bfc049e8e04bca66d591ab439d2341623f83c
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Jul 27 19:05:36 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jul 28 19:33:28 2020 +0100

    x86/hvm: don't force vCPU 0 for IRQ 0 when using fixed destination mode
    
    When the IO APIC pin mapped to the ISA IRQ 0 has been configured to
    use fixed delivery mode, do not forcefully route interrupts to vCPU 0,
    as the OS might have setup those interrupts to be injected to a
    different vCPU, and injecting to vCPU 0 can cause the OS to miss such
    interrupts or errors to happen due to unexpected vectors being
    injected on vCPU 0.
    
    In order to fix remove such handling altogether for fixed destination
    mode pins and just inject them according to the data setup in the
    IO-APIC entry.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vioapic.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index b00037ea87..123191db75 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -438,26 +438,11 @@ static void vioapic_deliver(struct hvm_vioapic *vioapic, unsigned int pin)
     }
 
     case dest_Fixed:
-    {
-#ifdef IRQ0_SPECIAL_ROUTING
-        /* Do not deliver timer interrupts to VCPU != 0 */
-        if ( (irq == hvm_isa_irq_to_gsi(0)) && pt_active(&d->arch.vpit.pt0) )
-        {
-            if ( (v = d->vcpu ? d->vcpu[0] : NULL) != NULL )
-                ioapic_inj_irq(vioapic, vcpu_vlapic(v), vector,
-                               trig_mode, delivery_mode);
-        }
-        else
-#endif
-        {
-            for_each_vcpu ( d, v )
-                if ( vlapic_match_dest(vcpu_vlapic(v), NULL,
-                                       0, dest, dest_mode) )
-                    ioapic_inj_irq(vioapic, vcpu_vlapic(v), vector,
-                                   trig_mode, delivery_mode);
-        }
+        for_each_vcpu ( d, v )
+            if ( vlapic_match_dest(vcpu_vlapic(v), NULL, 0, dest, dest_mode) )
+                ioapic_inj_irq(vioapic, vcpu_vlapic(v), vector, trig_mode,
+                               delivery_mode);
         break;
-    }
 
     case dest_NMI:
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 18:44:47 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 18:44:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1k0Ual-0002z7-62; Tue, 28 Jul 2020 18:44:47 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0Uaj-0002yv-Vl
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:44:46 +0000
X-Inumbo-ID: 67ef7af0-d102-11ea-8bc3-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 67ef7af0-d102-11ea-8bc3-bc764e2007e4;
 Tue, 28 Jul 2020 18:44:45 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=2/nDGyxWTbi6WatVL7SWwSmTBA2KRSsA+7oNnJrsoik=; b=lyfT2E5iPUH0dwk6HUAIQbjwbc
 PcaJvetVPH4KzSK5hozyi1qhD9+3j0X8/qft6en2zC9xXg9Xbz1zLQrTgEQvAK/E8GqXWUDjiVwps
 FqcbcFv7OojMseuvYHeUG6piX2jwqu1SUtF9+NeEXpraThbozguN0Qr1WivDxuRdxbHA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Uaj-0007en-4c
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:44:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Uaj-0001da-3i
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:44:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/hvm: fix ISA IRQ 0 handling when set as lowest
 priority mode in IO APIC
Message-Id: <E1k0Uaj-0001da-3i@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 18:44:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit dc036ab9d506b997777c7656d9e6e4fa32bc582e
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Jul 27 19:05:37 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jul 28 19:33:28 2020 +0100

    x86/hvm: fix ISA IRQ 0 handling when set as lowest priority mode in IO APIC
    
    Lowest priority destination mode does allow the vIO APIC code to
    select a vCPU to inject the interrupt to, but the selected vCPU must
    be part of the possible destinations configured for such IO APIC pin.
    
    Fix the code in order to only force vCPU 0 if it's part of the
    listed destinations.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/vioapic.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index 123191db75..67d4a6237f 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -415,12 +415,14 @@ static void vioapic_deliver(struct hvm_vioapic *vioapic, unsigned int pin)
     case dest_LowestPrio:
     {
 #ifdef IRQ0_SPECIAL_ROUTING
-        /* Force round-robin to pick VCPU 0 */
-        if ( (irq == hvm_isa_irq_to_gsi(0)) && pt_active(&d->arch.vpit.pt0) )
-        {
-            v = d->vcpu ? d->vcpu[0] : NULL;
-            target = v ? vcpu_vlapic(v) : NULL;
-        }
+        struct vlapic *lapic0 = vcpu_vlapic(d->vcpu[0]);
+
+        /* Force to pick vCPU 0 if part of the destination list */
+        if ( (irq == hvm_isa_irq_to_gsi(0)) && pt_active(&d->arch.vpit.pt0) &&
+             vlapic_match_dest(lapic0, NULL, 0, dest, dest_mode) &&
+             /* Mimic the vlapic_enabled check found in vlapic_lowest_prio. */
+             vlapic_enabled(lapic0) )
+            target = lapic0;
         else
 #endif
             target = vlapic_lowest_prio(d, NULL, 0, dest, dest_mode);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 18:44:57 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 18:44:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1k0Uav-00030A-7o; Tue, 28 Jul 2020 18:44:57 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0Uau-0002zw-1S
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:44:56 +0000
X-Inumbo-ID: 6df84422-d102-11ea-8bc3-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 6df84422-d102-11ea-8bc3-bc764e2007e4;
 Tue, 28 Jul 2020 18:44:55 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=5IHT1A2BGDfc+HRPq3IrLWsFHMVf77HvAbRO0tfhglc=; b=304QrZXuWiP21dCNNbwrSUDflW
 DgAZLQRXFKKTboWKyrd0kKxmE8cqYWPAg2vSzUCxkyXy/rNLNfVX7paiiuawK+TuF8GXAp1TLBQFC
 paBo2q/cP+mh6M8O9uMCcShgxOGlqyd5CyD5ZFSQoKwMlHFTryP+g6e3IO5tEmPeIrS4=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Uat-0007ev-8T
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:44:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Uat-0001e4-6n
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:44:55 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/vpt: only try to resume timers belonging to enabled
 devices
Message-Id: <E1k0Uat-0001e4-6n@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 18:44:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit b9e9ccbb11e4c54b498d3a08e48347c3cad72944
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Jul 27 19:05:38 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jul 28 19:33:28 2020 +0100

    x86/vpt: only try to resume timers belonging to enabled devices
    
    Check whether the emulated device is actually enabled before trying to
    resume the associated timers.
    
    Thankfully all those structures are zeroed at initialization, and
    since the devices are not enabled they are never populated, which
    triggers the pt->vcpu check at the beginning of pt_resume forcing an
    exit from the function.
    
    While there limit the scope of i and make it unsigned.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vpt.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 47f2c2aa64..62c87867c5 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -636,14 +636,19 @@ static void pt_resume(struct periodic_time *pt)
 
 void pt_may_unmask_irq(struct domain *d, struct periodic_time *vlapic_pt)
 {
-    int i;
-
     if ( d )
     {
-        pt_resume(&d->arch.vpit.pt0);
-        pt_resume(&d->arch.hvm.pl_time->vrtc.pt);
-        for ( i = 0; i < HPET_TIMER_NUM; i++ )
-            pt_resume(&d->arch.hvm.pl_time->vhpet.pt[i]);
+        if ( has_vpit(d) )
+            pt_resume(&d->arch.vpit.pt0);
+        if ( has_vrtc(d) )
+            pt_resume(&d->arch.hvm.pl_time->vrtc.pt);
+        if ( has_vhpet(d) )
+        {
+            unsigned int i;
+
+            for ( i = 0; i < HPET_TIMER_NUM; i++ )
+                pt_resume(&d->arch.hvm.pl_time->vhpet.pt[i]);
+        }
     }
 
     if ( vlapic_pt )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 18:45:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 18:45: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 1k0Ub7-00031I-9U; Tue, 28 Jul 2020 18:45:09 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0Ub5-00031A-UN
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:45:07 +0000
X-Inumbo-ID: 7398db95-d102-11ea-a924-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 7398db95-d102-11ea-a924-12813bfff9fa;
 Tue, 28 Jul 2020 18:45:06 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=z8cQzoJOwNMOqeQ2liKaohqli1AEPQUpck1/y+xhCNw=; b=2QBEAEtn/DQFu7aMVkuK/HmL81
 s0/dqwtTflhqLGdMLJdJysLI9i7Z1ljKAmEIdpxNYyg5QpRXH/xoijJtftDLoOY44nltJajxsCPdO
 x6VCSC/SRSH2y4zXTA/kilZON8prgSIXLAF9cotW/HXDO/EIf9oxFlrIXm9/NOvAILg8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Ub3-0007fT-BW
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:45:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0Ub3-0001ej-Af
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:45:05 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/hvm: only translate ISA interrupts to GSIs in
 virtual timers
Message-Id: <E1k0Ub3-0001ej-Af@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 18:45:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit b6641f28c5932793da2877ed8b9dac4aea6305ce
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Jul 27 19:05:39 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jul 28 19:33:28 2020 +0100

    x86/hvm: only translate ISA interrupts to GSIs in virtual timers
    
    Only call hvm_isa_irq_to_gsi for ISA interrupts, interrupts
    originating from an IO APIC pin already use a GSI and don't need to be
    translated.
    
    I haven't observed any issues from this, but I think it's better to
    use it correctly.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vpt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 62c87867c5..c68bbd1558 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -86,13 +86,13 @@ static int pt_irq_vector(struct periodic_time *pt, enum hvm_intsrc src)
         return pt->irq;
 
     isa_irq = pt->irq;
-    gsi = hvm_isa_irq_to_gsi(isa_irq);
 
     if ( src == hvm_intsrc_pic )
         return (v->domain->arch.hvm.vpic[isa_irq >> 3].irq_base
                 + (isa_irq & 7));
 
     ASSERT(src == hvm_intsrc_lapic);
+    gsi = pt->source == PTSRC_isa ? hvm_isa_irq_to_gsi(isa_irq) : pt->irq;
     vector = vioapic_get_vector(v->domain, gsi);
     if ( vector < 0 )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Jul 28 18:45:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 28 Jul 2020 18:45: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 1k0UbG-000328-BB; Tue, 28 Jul 2020 18:45:18 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=k51K=BH=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0UbE-00031x-KE
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:45:16 +0000
X-Inumbo-ID: 79ff0238-d102-11ea-8bc4-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 79ff0238-d102-11ea-8bc4-bc764e2007e4;
 Tue, 28 Jul 2020 18:45:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=owpW2SDQheIqmpbtc5YkWkwEeQb6BIvA91K029abNBU=; b=4Q/FMeIQ5/3v6dzQULLqA/XfaX
 w4l6o2WMEHaQqSMvN28WO9PTpFu4p2rqGrY7XqRTu9UqUFdNqPWvaSYGlpxY8KFMZnRfqErlajQDw
 PKOXHB6QtAY1PosZMFdL+iO+a7zxWR5qkEQiqU4RlAaNgWyoCjXz1ktGI8O7lduQx1AU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0UbD-0007g0-Ed
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:45:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0UbD-0001fK-Dq
 for xen-changelog@lists.xenproject.org; Tue, 28 Jul 2020 18:45:15 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/hvm: Clean up track_dirty_vram() calltree
Message-Id: <E1k0UbD-0001fK-Dq@xenbits.xenproject.org>
Date: Tue, 28 Jul 2020 18:45:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit b071ec25e85c4aacf3da59e5258cda0b1c4df45d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jul 20 17:22:25 2018 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jul 28 19:33:28 2020 +0100

    x86/hvm: Clean up track_dirty_vram() calltree
    
     * Rename nr to nr_frames.  A plain 'nr' is confusing to follow in the the
       lower levels.
     * Use DIV_ROUND_UP() rather than opencoding it in several different ways
     * The hypercall input is capped at uint32_t, so there is no need for
       nr_frames to be unsigned long in the lower levels.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/hvm/dm.c        | 13 +++++++------
 xen/arch/x86/mm/hap/hap.c    | 21 +++++++++++----------
 xen/arch/x86/mm/shadow/hvm.c | 16 ++++++++--------
 xen/include/asm-x86/hap.h    |  2 +-
 xen/include/asm-x86/shadow.h |  2 +-
 5 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
index e3f845165d..9930d68860 100644
--- a/xen/arch/x86/hvm/dm.c
+++ b/xen/arch/x86/hvm/dm.c
@@ -62,9 +62,10 @@ static bool _raw_copy_from_guest_buf_offset(void *dst,
                                     sizeof(dst))
 
 static int track_dirty_vram(struct domain *d, xen_pfn_t first_pfn,
-                            unsigned int nr, const struct xen_dm_op_buf *buf)
+                            unsigned int nr_frames,
+                            const struct xen_dm_op_buf *buf)
 {
-    if ( nr > (GB(1) >> PAGE_SHIFT) )
+    if ( nr_frames > (GB(1) >> PAGE_SHIFT) )
         return -EINVAL;
 
     if ( d->is_dying )
@@ -73,12 +74,12 @@ static int track_dirty_vram(struct domain *d, xen_pfn_t first_pfn,
     if ( !d->max_vcpus || !d->vcpu[0] )
         return -EINVAL;
 
-    if ( ((nr + 7) / 8) > buf->size )
+    if ( DIV_ROUND_UP(nr_frames, BITS_PER_BYTE) > buf->size )
         return -EINVAL;
 
-    return shadow_mode_enabled(d) ?
-        shadow_track_dirty_vram(d, first_pfn, nr, buf->h) :
-        hap_track_dirty_vram(d, first_pfn, nr, buf->h);
+    return shadow_mode_enabled(d)
+        ? shadow_track_dirty_vram(d, first_pfn, nr_frames, buf->h)
+        :    hap_track_dirty_vram(d, first_pfn, nr_frames, buf->h);
 }
 
 static int set_pci_intx_level(struct domain *d, uint16_t domain,
diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index 7f84d0c6ea..4eedd1a995 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -58,16 +58,16 @@
 
 int hap_track_dirty_vram(struct domain *d,
                          unsigned long begin_pfn,
-                         unsigned long nr,
+                         unsigned int nr_frames,
                          XEN_GUEST_HANDLE(void) guest_dirty_bitmap)
 {
     long rc = 0;
     struct sh_dirty_vram *dirty_vram;
     uint8_t *dirty_bitmap = NULL;
 
-    if ( nr )
+    if ( nr_frames )
     {
-        int size = (nr + BITS_PER_BYTE - 1) / BITS_PER_BYTE;
+        unsigned int size = DIV_ROUND_UP(nr_frames, BITS_PER_BYTE);
 
         if ( !paging_mode_log_dirty(d) )
         {
@@ -97,13 +97,13 @@ int hap_track_dirty_vram(struct domain *d,
         }
 
         if ( begin_pfn != dirty_vram->begin_pfn ||
-             begin_pfn + nr != dirty_vram->end_pfn )
+             begin_pfn + nr_frames != dirty_vram->end_pfn )
         {
             unsigned long ostart = dirty_vram->begin_pfn;
             unsigned long oend = dirty_vram->end_pfn;
 
             dirty_vram->begin_pfn = begin_pfn;
-            dirty_vram->end_pfn = begin_pfn + nr;
+            dirty_vram->end_pfn = begin_pfn + nr_frames;
 
             paging_unlock(d);
 
@@ -115,7 +115,7 @@ int hap_track_dirty_vram(struct domain *d,
              * Switch vram to log dirty mode, either by setting l1e entries of
              * P2M table to be read-only, or via hardware-assisted log-dirty.
              */
-            p2m_change_type_range(d, begin_pfn, begin_pfn + nr,
+            p2m_change_type_range(d, begin_pfn, begin_pfn + nr_frames,
                                   p2m_ram_rw, p2m_ram_logdirty);
 
             guest_flush_tlb_mask(d, d->dirty_cpumask);
@@ -132,7 +132,7 @@ int hap_track_dirty_vram(struct domain *d,
             p2m_flush_hardware_cached_dirty(d);
 
             /* get the bitmap */
-            paging_log_dirty_range(d, begin_pfn, nr, dirty_bitmap);
+            paging_log_dirty_range(d, begin_pfn, nr_frames, dirty_bitmap);
 
             domain_unpause(d);
         }
@@ -153,14 +153,15 @@ int hap_track_dirty_vram(struct domain *d,
              * then stop tracking
              */
             begin_pfn = dirty_vram->begin_pfn;
-            nr = dirty_vram->end_pfn - dirty_vram->begin_pfn;
+            nr_frames = dirty_vram->end_pfn - dirty_vram->begin_pfn;
             xfree(dirty_vram);
             d->arch.hvm.dirty_vram = NULL;
         }
 
         paging_unlock(d);
-        if ( nr )
-            p2m_change_type_range(d, begin_pfn, begin_pfn + nr,
+
+        if ( nr_frames )
+            p2m_change_type_range(d, begin_pfn, begin_pfn + nr_frames,
                                   p2m_ram_logdirty, p2m_ram_rw);
     }
 out:
diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index c5da7a071c..b832272c10 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -695,12 +695,12 @@ static void sh_emulate_unmap_dest(struct vcpu *v, void *addr,
 /* VRAM dirty tracking support */
 int shadow_track_dirty_vram(struct domain *d,
                             unsigned long begin_pfn,
-                            unsigned long nr,
+                            unsigned int nr_frames,
                             XEN_GUEST_HANDLE(void) guest_dirty_bitmap)
 {
     int rc = 0;
-    unsigned long end_pfn = begin_pfn + nr;
-    unsigned long dirty_size = (nr + 7) / 8;
+    unsigned long end_pfn = begin_pfn + nr_frames;
+    unsigned int dirty_size = DIV_ROUND_UP(nr_frames, BITS_PER_BYTE);
     int flush_tlb = 0;
     unsigned long i;
     p2m_type_t t;
@@ -717,7 +717,7 @@ int shadow_track_dirty_vram(struct domain *d,
 
     dirty_vram = d->arch.hvm.dirty_vram;
 
-    if ( dirty_vram && (!nr ||
+    if ( dirty_vram && (!nr_frames ||
              ( begin_pfn != dirty_vram->begin_pfn
             || end_pfn   != dirty_vram->end_pfn )) )
     {
@@ -729,7 +729,7 @@ int shadow_track_dirty_vram(struct domain *d,
         dirty_vram = d->arch.hvm.dirty_vram = NULL;
     }
 
-    if ( !nr )
+    if ( !nr_frames )
         goto out;
 
     dirty_bitmap = vzalloc(dirty_size);
@@ -759,9 +759,9 @@ int shadow_track_dirty_vram(struct domain *d,
         dirty_vram->end_pfn = end_pfn;
         d->arch.hvm.dirty_vram = dirty_vram;
 
-        if ( (dirty_vram->sl1ma = xmalloc_array(paddr_t, nr)) == NULL )
+        if ( (dirty_vram->sl1ma = xmalloc_array(paddr_t, nr_frames)) == NULL )
             goto out_dirty_vram;
-        memset(dirty_vram->sl1ma, ~0, sizeof(paddr_t) * nr);
+        memset(dirty_vram->sl1ma, ~0, sizeof(paddr_t) * nr_frames);
 
         if ( (dirty_vram->dirty_bitmap = xzalloc_array(uint8_t, dirty_size)) == NULL )
             goto out_sl1ma;
@@ -780,7 +780,7 @@ int shadow_track_dirty_vram(struct domain *d,
         void *map_sl1p = NULL;
 
         /* Iterate over VRAM to track dirty bits. */
-        for ( i = 0; i < nr; i++ )
+        for ( i = 0; i < nr_frames; i++ )
         {
             mfn_t mfn = get_gfn_query_unlocked(d, begin_pfn + i, &t);
             struct page_info *page;
diff --git a/xen/include/asm-x86/hap.h b/xen/include/asm-x86/hap.h
index faf856913a..d489df3812 100644
--- a/xen/include/asm-x86/hap.h
+++ b/xen/include/asm-x86/hap.h
@@ -40,7 +40,7 @@ void  hap_teardown(struct domain *d, bool *preempted);
 void  hap_vcpu_init(struct vcpu *v);
 int   hap_track_dirty_vram(struct domain *d,
                            unsigned long begin_pfn,
-                           unsigned long nr,
+                           unsigned int nr_frames,
                            XEN_GUEST_HANDLE(void) dirty_bitmap);
 
 extern const struct paging_mode *hap_paging_get_mode(struct vcpu *);
diff --git a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h
index 224d1bc2f9..76e47f257f 100644
--- a/xen/include/asm-x86/shadow.h
+++ b/xen/include/asm-x86/shadow.h
@@ -64,7 +64,7 @@ int shadow_enable(struct domain *d, u32 mode);
 /* Enable VRAM dirty bit tracking. */
 int shadow_track_dirty_vram(struct domain *d,
                             unsigned long first_pfn,
-                            unsigned long nr,
+                            unsigned int nr_frames,
                             XEN_GUEST_HANDLE(void) dirty_bitmap);
 
 /* Handler for shadow control ops: operations from user-space to enable
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jul 29 18:11:12 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 29 Jul 2020 18: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 1k0qXk-00080R-5r; Wed, 29 Jul 2020 18:11:08 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=BDG6=BI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0qXi-00080M-RZ
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 18:11:06 +0000
X-Inumbo-ID: ddf8cb60-d1c6-11ea-8cb5-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id ddf8cb60-d1c6-11ea-8cb5-bc764e2007e4;
 Wed, 29 Jul 2020 18:11:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=bFMptIkGEm625pYbFhXbtXMC4s8Bx2gseINtMQbxwkM=; b=gP5Zhf/ocHkDSUbH3NfPiciDLq
 S5aSkoRTWOf0iej3cyBtQWo69wRUq0WfO9tx433CfDUve2gA0vuuHZUWdtyCmGS1clK8dJQ9vb/B1
 400RN7CsEtTL4dVWuqB8814Sw+vxpS5nTSWU+C1mATJFpVed+Dpc6EtJScjUduQDB7IM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0qXg-0006xh-H0
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 18:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0qXg-00027j-F4
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 18:11:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/cpuid: Fix APIC bit clearing
Message-Id: <E1k0qXg-00027j-F4@xenbits.xenproject.org>
Date: Wed, 29 Jul 2020 18:11:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 64219fa179c3e48adad12bfce3f6b3f1596cccbf
Author:     Fam Zheng <famzheng@amazon.com>
AuthorDate: Wed Jul 29 18:51:45 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jul 29 19:03:41 2020 +0100

    x86/cpuid: Fix APIC bit clearing
    
    The bug is obvious here, other places in this function used
    "cpufeat_mask" correctly.
    
    Fixed: b648feff8ea2 ("xen/x86: Improvements to in-hypervisor cpuid sanity checks")
    Signed-off-by: Fam Zheng <famzheng@amazon.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpuid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 6a4a787b68..63a03ef1e5 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -1057,7 +1057,7 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
         {
             /* Fast-forward MSR_APIC_BASE.EN. */
             if ( vlapic_hw_disabled(vcpu_vlapic(v)) )
-                res->d &= ~cpufeat_bit(X86_FEATURE_APIC);
+                res->d &= ~cpufeat_mask(X86_FEATURE_APIC);
 
             /*
              * PSE36 is not supported in shadow mode.  This bit should be
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Jul 29 20:00:07 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 29 Jul 2020 20: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 1k0sFA-0000HT-Li; Wed, 29 Jul 2020 20:00:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=BDG6=BI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0sF9-0000CL-Cm
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:00:03 +0000
X-Inumbo-ID: 169c18aa-d1d6-11ea-8cd8-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 169c18aa-d1d6-11ea-8cd8-bc764e2007e4;
 Wed, 29 Jul 2020 20:00:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=nwfMDUgUhGr2geA8PTlQoNOLjB55ESvRRx4p5Md2NnQ=; b=Wgss88Fp1y1yEE5EZtqIvp1fm1
 aRmlLRnDBB4yRnASo8yErS9GT33jvcsMu781QIDJXFPtFPAXy4pSf4qzeLBY16LVN7b++NtUfSHim
 ScfoiqhCVj+2xSmSezC2nu9iEMTChLYVxbXXJubQuqr2Ydls+WDr0zm0VSeuqwhVDYWg=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0sF7-0000oW-Vl
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0sF7-0001Kp-UA
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:00:01 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen/displif: Protocol version 2
Message-Id: <E1k0sF7-0001Kp-UA@xenbits.xenproject.org>
Date: Wed, 29 Jul 2020 20:00:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit c27a184225eab54d20435c8cab5ad0ef384dc2c0
Author:     Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
AuthorDate: Wed Jul 1 10:19:23 2020 +0300
Commit:     George Dunlap <george.dunlap@citrix.com>
CommitDate: Mon Jul 27 14:58:55 2020 +0100

    xen/displif: Protocol version 2
    
    1. Add protocol version as an integer
    
    Version string, which is in fact an integer, is hard to handle in the
    code that supports different protocol versions. To simplify that
    also add the version as an integer.
    
    2. Pass buffer offset with XENDISPL_OP_DBUF_CREATE
    
    There are cases when display data buffer is created with non-zero
    offset to the data start. Handle such cases and provide that offset
    while creating a display buffer.
    
    3. Add XENDISPL_OP_GET_EDID command
    
    Add an optional request for reading Extended Display Identification
    Data (EDID) structure which allows better configuration of the
    display connectors over the configuration set in XenStore.
    With this change connectors may have multiple resolutions defined
    with respect to detailed timing definitions and additional properties
    normally provided by displays.
    
    If this request is not supported by the backend then visible area
    is defined by the relevant XenStore's "resolution" property.
    
    If backend provides extended display identification data (EDID) with
    XENDISPL_OP_GET_EDID request then EDID values must take precedence
    over the resolutions defined in XenStore.
    
    4. Bump protocol version to 2.
    
    Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/include/public/io/displif.h | 91 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 88 insertions(+), 3 deletions(-)

diff --git a/xen/include/public/io/displif.h b/xen/include/public/io/displif.h
index cc5de9cb1f..0055895510 100644
--- a/xen/include/public/io/displif.h
+++ b/xen/include/public/io/displif.h
@@ -38,7 +38,8 @@
  *                           Protocol version
  ******************************************************************************
  */
-#define XENDISPL_PROTOCOL_VERSION     "1"
+#define XENDISPL_PROTOCOL_VERSION     "2"
+#define XENDISPL_PROTOCOL_VERSION_INT  2
 
 /*
  ******************************************************************************
@@ -202,6 +203,9 @@
  *      Width and height of the connector in pixels separated by
  *      XENDISPL_RESOLUTION_SEPARATOR. This defines visible area of the
  *      display.
+ *      If backend provides extended display identification data (EDID) with
+ *      XENDISPL_OP_GET_EDID request then EDID values must take precedence
+ *      over the resolutions defined here.
  *
  *------------------ Connector Request Transport Parameters -------------------
  *
@@ -349,6 +353,8 @@
 #define XENDISPL_OP_FB_DETACH         0x13
 #define XENDISPL_OP_SET_CONFIG        0x14
 #define XENDISPL_OP_PG_FLIP           0x15
+/* The below command is available in protocol version 2 and above. */
+#define XENDISPL_OP_GET_EDID          0x16
 
 /*
  ******************************************************************************
@@ -377,6 +383,10 @@
 #define XENDISPL_FIELD_BE_ALLOC       "be-alloc"
 #define XENDISPL_FIELD_UNIQUE_ID      "unique-id"
 
+#define XENDISPL_EDID_BLOCK_SIZE      128
+#define XENDISPL_EDID_BLOCK_COUNT     256
+#define XENDISPL_EDID_MAX_SIZE        (XENDISPL_EDID_BLOCK_SIZE * XENDISPL_EDID_BLOCK_COUNT)
+
 /*
  ******************************************************************************
  *                          STATUS RETURN CODES
@@ -451,7 +461,9 @@
  * +----------------+----------------+----------------+----------------+
  * |                           gref_directory                          | 40
  * +----------------+----------------+----------------+----------------+
- * |                             reserved                              | 44
+ * |                             data_ofs                              | 44
+ * +----------------+----------------+----------------+----------------+
+ * |                             reserved                              | 48
  * +----------------+----------------+----------------+----------------+
  * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
  * +----------------+----------------+----------------+----------------+
@@ -494,6 +506,7 @@
  *   buffer size (buffer_sz) exceeds what can be addressed by this single page,
  *   then reference to the next page must be supplied (see gref_dir_next_page
  *   below)
+ * data_ofs - uint32_t, offset of the data in the buffer, octets
  */
 
 #define XENDISPL_DBUF_FLG_REQ_ALLOC       (1 << 0)
@@ -506,6 +519,7 @@ struct xendispl_dbuf_create_req {
     uint32_t buffer_sz;
     uint32_t flags;
     grant_ref_t gref_directory;
+    uint32_t data_ofs;
 };
 
 /*
@@ -731,6 +745,44 @@ struct xendispl_page_flip_req {
     uint64_t fb_cookie;
 };
 
+/*
+ * Request EDID - request EDID describing current connector:
+ *         0                1                 2               3        octet
+ * +----------------+----------------+----------------+----------------+
+ * |               id                | _OP_GET_EDID   |   reserved     | 4
+ * +----------------+----------------+----------------+----------------+
+ * |                             buffer_sz                             | 8
+ * +----------------+----------------+----------------+----------------+
+ * |                          gref_directory                           | 12
+ * +----------------+----------------+----------------+----------------+
+ * |                             reserved                              | 16
+ * +----------------+----------------+----------------+----------------+
+ * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
+ * +----------------+----------------+----------------+----------------+
+ * |                             reserved                              | 64
+ * +----------------+----------------+----------------+----------------+
+ *
+ * Notes:
+ *   - This command is not available in protocol version 1 and should be
+ *     ignored.
+ *   - This request is optional and if not supported then visible area
+ *     is defined by the relevant XenStore's "resolution" property.
+ *   - Shared buffer, allocated for EDID storage, must not be less then
+ *     XENDISPL_EDID_MAX_SIZE octets.
+ *
+ * buffer_sz - uint32_t, buffer size to be allocated, octets
+ * gref_directory - grant_ref_t, a reference to the first shared page
+ *   describing EDID buffer references. See XENDISPL_OP_DBUF_CREATE for
+ *   grant page directory structure (struct xendispl_page_directory).
+ *
+ * See response format for this request.
+ */
+
+struct xendispl_get_edid_req {
+    uint32_t buffer_sz;
+    grant_ref_t gref_directory;
+};
+
 /*
  *---------------------------------- Responses --------------------------------
  *
@@ -753,6 +805,35 @@ struct xendispl_page_flip_req {
  * id - uint16_t, private guest value, echoed from request
  * status - int32_t, response status, zero on success and -XEN_EXX on failure
  *
+ *
+ * Get EDID response - response for XENDISPL_OP_GET_EDID:
+ *         0                1                 2               3        octet
+ * +----------------+----------------+----------------+----------------+
+ * |               id                |    operation   |    reserved    | 4
+ * +----------------+----------------+----------------+----------------+
+ * |                              status                               | 8
+ * +----------------+----------------+----------------+----------------+
+ * |                             edid_sz                               | 12
+ * +----------------+----------------+----------------+----------------+
+ * |                             reserved                              | 16
+ * +----------------+----------------+----------------+----------------+
+ * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
+ * +----------------+----------------+----------------+----------------+
+ * |                             reserved                              | 64
+ * +----------------+----------------+----------------+----------------+
+ *
+ * Notes:
+ *   - This response is not available in protocol version 1 and should be
+ *     ignored.
+ *
+ * edid_sz - uint32_t, size of the EDID, octets
+ */
+
+struct xendispl_get_edid_resp {
+    uint32_t edid_sz;
+};
+
+/*
  *----------------------------------- Events ----------------------------------
  *
  * Events are sent via a shared page allocated by the front and propagated by
@@ -804,6 +885,7 @@ struct xendispl_req {
         struct xendispl_fb_detach_req fb_detach;
         struct xendispl_set_config_req set_config;
         struct xendispl_page_flip_req pg_flip;
+        struct xendispl_get_edid_req get_edid;
         uint8_t reserved[56];
     } op;
 };
@@ -813,7 +895,10 @@ struct xendispl_resp {
     uint8_t operation;
     uint8_t reserved;
     int32_t status;
-    uint8_t reserved1[56];
+    union {
+        struct xendispl_get_edid_resp get_edid;
+        uint8_t reserved1[56];
+    } op;
 };
 
 struct xendispl_evt {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 29 20:00:13 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 29 Jul 2020 20:00:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1k0sFJ-0000ed-NM; Wed, 29 Jul 2020 20:00:13 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=BDG6=BI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0sFJ-0000eV-09
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:00:13 +0000
X-Inumbo-ID: 1ca7c00a-d1d6-11ea-8cd8-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 1ca7c00a-d1d6-11ea-8cd8-bc764e2007e4;
 Wed, 29 Jul 2020 20:00:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=psJFxupxUK/VfUcFAQQIKmRe382oR1YEe3eRjA1SX48=; b=gbt8wzTYXSm5TUKrY9O6hVgEm6
 3U/jpn2lpr9fidVCIv413mXz/bwoz/C+AokcBJaIMhfpJOZQtDUfVjdvKdq1HIcqOOMGs4X/u67Mt
 uehscCfg2DUmNv9ejjASYMFzZUjOo3WGPh9/5opKME2eMY4kjGWAsTmKTzZJZMOmG9pY=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0sFI-0000oc-4H
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0sFI-0001MZ-1p
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:00:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] public/domctl: Fix the struct xen_domctl ABI in 32bit
 builds
Message-Id: <E1k0sFI-0001MZ-1p@xenbits.xenproject.org>
Date: Wed, 29 Jul 2020 20:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 8899a280a493d6717afc7a709f7d1e842b4eb2d6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jul 27 19:21:09 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jul 28 19:33:28 2020 +0100

    public/domctl: Fix the struct xen_domctl ABI in 32bit builds
    
    The Xen domctl ABI currently relies on the union containing a field with
    alignment of 8.
    
    32bit projects which only copy the used subset of functionality end up with an
    ABI breakage if they don't have at least one uint64_aligned_t field copied.
    
    Insert explicit padding, and some build assertions to ensure it never changes
    moving forwards.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/domctl.c         | 8 ++++++++
 xen/include/public/domctl.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index a69b3b59a8..20ef8399bd 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -959,6 +959,14 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
     return ret;
 }
 
+static void __init __maybe_unused build_assertions(void)
+{
+    struct xen_domctl d;
+
+    BUILD_BUG_ON(sizeof(d) != 16 /* header */ + 128 /* union */);
+    BUILD_BUG_ON(offsetof(typeof(d), u) != 16);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 59bdc28c89..9464a9058a 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -1222,6 +1222,7 @@ struct xen_domctl {
 #define XEN_DOMCTL_gdbsx_domstatus             1003
     uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
     domid_t  domain;
+    uint16_t _pad[3];
     union {
         struct xen_domctl_createdomain      createdomain;
         struct xen_domctl_getdomaininfo     getdomaininfo;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 29 20:00:26 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 29 Jul 2020 20:00: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 1k0sFW-0000gh-PQ; Wed, 29 Jul 2020 20:00:26 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=BDG6=BI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0sFV-0000gX-IB
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:00:25 +0000
X-Inumbo-ID: 22af8a14-d1d6-11ea-aa54-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 22af8a14-d1d6-11ea-aa54-12813bfff9fa;
 Wed, 29 Jul 2020 20:00:22 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=SZpcd9bzIpD/6S4M86byQ+X/5wO4mygxeInmikdBnJ4=; b=TAn8PD7pZuVZUFDKZXTWMRvh0B
 iwBUbSros098vTBPKC4NJOiPf4Glni2OeAI9Ibfdbl/p62FAy2oURrlSKeAWCXRL50MhxHMosLai1
 FnDjqFombIgeBM1ZCyXy+JMy90nqKv+3Y8bDG9ZpjDxJQQAMmc6iIE9Xu1Yv4NT5Ibgc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0sFS-0000oj-8O
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0sFS-0001ND-7N
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:00:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] print: introduce a format specifier for pci_sbdf_t
Message-Id: <E1k0sFS-0001ND-7N@xenbits.xenproject.org>
Date: Wed, 29 Jul 2020 20:00:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 1ee1441835f41f0a2303c761657ba69a5a1b4a7f
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Jul 27 12:31:36 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jul 28 19:33:28 2020 +0100

    print: introduce a format specifier for pci_sbdf_t
    
    The new format specifier is '%pp', and prints a pci_sbdf_t using the
    seg:bus:dev.func format. Replace all SBDFs printed using
    '%04x:%02x:%02x.%u' to use the new format specifier.
    
    No functional change intended.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    Acked-by: Julien Grall <julien.grall@arm.com>
    For just the pieces where Jan is the only maintainer:
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/printk-formats.txt                |  5 ++
 xen/arch/x86/hvm/vmsi.c                     | 10 +---
 xen/arch/x86/msi.c                          | 37 +++++-------
 xen/common/vsprintf.c                       | 18 ++++++
 xen/drivers/passthrough/amd/iommu_acpi.c    | 22 ++++---
 xen/drivers/passthrough/amd/iommu_cmd.c     |  5 +-
 xen/drivers/passthrough/amd/iommu_detect.c  |  5 +-
 xen/drivers/passthrough/amd/iommu_init.c    | 18 +++---
 xen/drivers/passthrough/amd/iommu_intr.c    |  9 +--
 xen/drivers/passthrough/amd/pci_amd_iommu.c | 25 +++-----
 xen/drivers/passthrough/pci.c               | 89 ++++++++++++-----------------
 xen/drivers/passthrough/vtd/dmar.c          | 27 +++++----
 xen/drivers/passthrough/vtd/intremap.c      | 11 ++--
 xen/drivers/passthrough/vtd/iommu.c         | 80 +++++++++++---------------
 xen/drivers/passthrough/vtd/quirks.c        | 22 +++----
 xen/drivers/passthrough/vtd/utils.c         |  6 +-
 xen/drivers/passthrough/x86/ats.c           | 13 ++---
 xen/drivers/vpci/header.c                   | 11 ++--
 xen/drivers/vpci/msi.c                      |  6 +-
 xen/drivers/vpci/msix.c                     | 24 +++-----
 20 files changed, 189 insertions(+), 254 deletions(-)

diff --git a/docs/misc/printk-formats.txt b/docs/misc/printk-formats.txt
index 080f498f65..8f666f696a 100644
--- a/docs/misc/printk-formats.txt
+++ b/docs/misc/printk-formats.txt
@@ -48,3 +48,8 @@ Domain and vCPU information:
                The domain part as above, with the vcpu_id printed in decimal.
                  e.g.  d0v1
                        d[IDLE]v0
+
+PCI:
+
+       %pp     PCI device address in S:B:D.F format from a pci_sbdf_t.
+                 e.g.  0004:02:00.0
diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c
index 5d4eddebee..7ca19353ab 100644
--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -697,10 +697,8 @@ static int vpci_msi_update(const struct pci_dev *pdev, uint32_t data,
 
         if ( rc )
         {
-            gdprintk(XENLOG_ERR,
-                     "%04x:%02x:%02x.%u: failed to bind PIRQ %u: %d\n",
-                     pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
-                     PCI_FUNC(pdev->devfn), pirq + i, rc);
+            gdprintk(XENLOG_ERR, "%pp: failed to bind PIRQ %u: %d\n",
+                     &pdev->sbdf, pirq + i, rc);
             while ( bind.machine_irq-- > pirq )
                 pt_irq_destroy_bind(pdev->domain, &bind);
             return rc;
@@ -754,9 +752,7 @@ static int vpci_msi_enable(const struct pci_dev *pdev, uint32_t data,
                                    &msi_info);
     if ( rc )
     {
-        gdprintk(XENLOG_ERR, "%04x:%02x:%02x.%u: failed to map PIRQ: %d\n",
-                 pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
-                 PCI_FUNC(pdev->devfn), rc);
+        gdprintk(XENLOG_ERR, "%pp: failed to map PIRQ: %d\n", &pdev->sbdf, rc);
         return rc;
     }
 
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 161ee60dbe..29e4351a49 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -430,8 +430,8 @@ static bool msi_set_mask_bit(struct irq_desc *desc, bool host, bool guest)
             {
                 pdev->msix->warned = domid;
                 printk(XENLOG_G_WARNING
-                       "cannot mask IRQ %d: masking MSI-X on Dom%d's %04x:%02x:%02x.%u\n",
-                       desc->irq, domid, seg, bus, slot, func);
+                       "cannot mask IRQ %d: masking MSI-X on Dom%d's %pp\n",
+                       desc->irq, domid, &pdev->sbdf);
             }
         }
         pdev->msix->host_maskall = maskall;
@@ -985,11 +985,11 @@ static int msix_capability_init(struct pci_dev *dev,
             struct domain *d = dev->domain ?: currd;
 
             if ( !is_hardware_domain(currd) || d != currd )
-                printk("%s use of MSI-X on %04x:%02x:%02x.%u by Dom%d\n",
+                printk("%s use of MSI-X on %pp by %pd\n",
                        is_hardware_domain(currd)
                        ? XENLOG_WARNING "Potentially insecure"
                        : XENLOG_ERR "Insecure",
-                       seg, bus, slot, func, d->domain_id);
+                       &dev->sbdf, d);
             if ( !is_hardware_domain(d) &&
                  /* Assume a domain without memory has no mappings yet. */
                  (!is_hardware_domain(currd) || domain_tot_pages(d)) )
@@ -1043,18 +1043,15 @@ static int __pci_enable_msi(struct msi_info *msi, struct msi_desc **desc)
     old_desc = find_msi_entry(pdev, msi->irq, PCI_CAP_ID_MSI);
     if ( old_desc )
     {
-        printk(XENLOG_ERR "irq %d already mapped to MSI on %04x:%02x:%02x.%u\n",
-               msi->irq, msi->seg, msi->bus,
-               PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn));
+        printk(XENLOG_ERR "irq %d already mapped to MSI on %pp\n",
+               msi->irq, &pdev->sbdf);
         return -EEXIST;
     }
 
     old_desc = find_msi_entry(pdev, -1, PCI_CAP_ID_MSIX);
     if ( old_desc )
     {
-        printk(XENLOG_WARNING "MSI-X already in use on %04x:%02x:%02x.%u\n",
-               msi->seg, msi->bus,
-               PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn));
+        printk(XENLOG_WARNING "MSI-X already in use on %pp\n", &pdev->sbdf);
         __pci_disable_msix(old_desc);
     }
 
@@ -1091,8 +1088,6 @@ static void __pci_disable_msi(struct msi_desc *entry)
 static int __pci_enable_msix(struct msi_info *msi, struct msi_desc **desc)
 {
     struct pci_dev *pdev;
-    u8 slot = PCI_SLOT(msi->devfn);
-    u8 func = PCI_FUNC(msi->devfn);
     struct msi_desc *old_desc;
 
     ASSERT(pcidevs_locked());
@@ -1106,16 +1101,15 @@ static int __pci_enable_msix(struct msi_info *msi, struct msi_desc **desc)
     old_desc = find_msi_entry(pdev, msi->irq, PCI_CAP_ID_MSIX);
     if ( old_desc )
     {
-        printk(XENLOG_ERR "irq %d already mapped to MSI-X on %04x:%02x:%02x.%u\n",
-               msi->irq, msi->seg, msi->bus, slot, func);
+        printk(XENLOG_ERR "irq %d already mapped to MSI-X on %pp\n",
+               msi->irq, &pdev->sbdf);
         return -EEXIST;
     }
 
     old_desc = find_msi_entry(pdev, -1, PCI_CAP_ID_MSI);
     if ( old_desc )
     {
-        printk(XENLOG_WARNING "MSI already in use on %04x:%02x:%02x.%u\n",
-               msi->seg, msi->bus, slot, func);
+        printk(XENLOG_WARNING "MSI already in use on %pp\n", &pdev->sbdf);
         __pci_disable_msi(old_desc);
     }
 
@@ -1162,9 +1156,8 @@ static void __pci_disable_msix(struct msi_desc *entry)
         writel(1, entry->mask_base + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
     else if ( !(control & PCI_MSIX_FLAGS_MASKALL) )
     {
-        printk(XENLOG_WARNING
-               "cannot disable IRQ %d: masking MSI-X on %04x:%02x:%02x.%u\n",
-               entry->irq, seg, bus, slot, func);
+        printk(XENLOG_WARNING "cannot disable IRQ %d: masking MSI-X on %pp\n",
+               entry->irq, &dev->sbdf);
         maskall = true;
     }
     dev->msix->host_maskall = maskall;
@@ -1340,7 +1333,6 @@ int pci_restore_msi_state(struct pci_dev *pdev)
     struct msi_desc *entry, *tmp;
     struct irq_desc *desc;
     struct msi_msg msg;
-    u8 slot = PCI_SLOT(pdev->devfn), func = PCI_FUNC(pdev->devfn);
     unsigned int type = 0, pos = 0;
     u16 control = 0;
 
@@ -1369,9 +1361,8 @@ int pci_restore_msi_state(struct pci_dev *pdev)
         if (desc->msi_desc != entry)
         {
     bogus:
-            dprintk(XENLOG_ERR,
-                    "Restore MSI for %04x:%02x:%02x:%u entry %u not set?\n",
-                    pdev->seg, pdev->bus, slot, func, i);
+            dprintk(XENLOG_ERR, "Restore MSI for %pp entry %u not set?\n",
+                    &pdev->sbdf, i);
             spin_unlock_irqrestore(&desc->lock, flags);
             if ( type == PCI_CAP_ID_MSIX )
                 pci_conf_write16(pdev->sbdf, msix_control_reg(pos),
diff --git a/xen/common/vsprintf.c b/xen/common/vsprintf.c
index 183d3ed4bb..185a4bd561 100644
--- a/xen/common/vsprintf.c
+++ b/xen/common/vsprintf.c
@@ -394,6 +394,20 @@ static char *print_vcpu(char *str, const char *end, const struct vcpu *v)
     return number(str + 1, end, v->vcpu_id, 10, -1, -1, 0);
 }
 
+static char *print_pci_addr(char *str, const char *end, const pci_sbdf_t *sbdf)
+{
+    str = number(str, end, sbdf->seg, 16, 4, -1, ZEROPAD);
+    if ( str < end )
+        *str = ':';
+    str = number(str + 1, end, sbdf->bus, 16, 2, -1, ZEROPAD);
+    if ( str < end )
+        *str = ':';
+    str = number(str + 1, end, sbdf->dev, 16, 2, -1, ZEROPAD);
+    if ( str < end )
+        *str = '.';
+    return number(str + 1, end, sbdf->fn, 8, -1, -1, 0);
+}
+
 static char *pointer(char *str, const char *end, const char **fmt_ptr,
                      const void *arg, int field_width, int precision,
                      int flags)
@@ -476,6 +490,10 @@ static char *pointer(char *str, const char *end, const char **fmt_ptr,
         }
     }
 
+    case 'p': /* PCI SBDF. */
+        ++*fmt_ptr;
+        return print_pci_addr(str, end, arg);
+
     case 's': /* Symbol name with offset and size (iff offset != 0) */
     case 'S': /* Symbol name unconditionally with offset and size */
     {
diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c b/xen/drivers/passthrough/amd/iommu_acpi.c
index f4abbfd9dc..1f6b004260 100644
--- a/xen/drivers/passthrough/amd/iommu_acpi.c
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c
@@ -92,9 +92,8 @@ static void __init add_ivrs_mapping_entry(
                     iommu, &ivrs_mappings[alias_id].intremap_inuse, 0);
 
             if ( !ivrs_mappings[alias_id].intremap_table )
-                panic("No memory for %04x:%02x:%02x.%u's IRT\n",
-                      iommu->seg, PCI_BUS(alias_id), PCI_SLOT(alias_id),
-                      PCI_FUNC(alias_id));
+                panic("No memory for %pp's IRT\n",
+                      &PCI_SBDF2(iommu->seg, alias_id));
         }
     }
 
@@ -738,9 +737,8 @@ static u16 __init parse_ivhd_device_special(
         return 0;
     }
 
-    AMD_IOMMU_DEBUG("IVHD Special: %04x:%02x:%02x.%u variety %#x handle %#x\n",
-                    seg, PCI_BUS(bdf), PCI_SLOT(bdf), PCI_FUNC(bdf),
-                    special->variety, special->handle);
+    AMD_IOMMU_DEBUG("IVHD Special: %pp variety %#x handle %#x\n",
+                    &PCI_SBDF2(seg, bdf), special->variety, special->handle);
     add_ivrs_mapping_entry(bdf, bdf, special->header.data_setting, true,
                            iommu);
 
@@ -764,9 +762,9 @@ static u16 __init parse_ivhd_device_special(
         if ( idx < nr_ioapic_sbdf )
         {
             AMD_IOMMU_DEBUG("IVHD: Command line override present for IO-APIC %#x"
-                            "(IVRS: %#x devID %04x:%02x:%02x.%u)\n",
-                            ioapic_sbdf[idx].id, special->handle, seg,
-                            PCI_BUS(bdf), PCI_SLOT(bdf), PCI_FUNC(bdf));
+                            "(IVRS: %#x devID %pp)\n",
+                            ioapic_sbdf[idx].id, special->handle,
+                            &PCI_SBDF2(seg, bdf));
             break;
         }
 
@@ -836,9 +834,9 @@ static u16 __init parse_ivhd_device_special(
             break;
         case HPET_CMDL:
             AMD_IOMMU_DEBUG("IVHD: Command line override present for HPET %#x "
-                            "(IVRS: %#x devID %04x:%02x:%02x.%u)\n",
-                            hpet_sbdf.id, special->handle, seg, PCI_BUS(bdf),
-                            PCI_SLOT(bdf), PCI_FUNC(bdf));
+                            "(IVRS: %#x devID %pp)\n",
+                            hpet_sbdf.id, special->handle,
+                            &PCI_SBDF2(seg, bdf));
             break;
         case HPET_NONE:
             /* set device id of hpet */
diff --git a/xen/drivers/passthrough/amd/iommu_cmd.c b/xen/drivers/passthrough/amd/iommu_cmd.c
index 249ed345a0..6c0647c524 100644
--- a/xen/drivers/passthrough/amd/iommu_cmd.c
+++ b/xen/drivers/passthrough/amd/iommu_cmd.c
@@ -289,9 +289,8 @@ void amd_iommu_flush_iotlb(u8 devfn, const struct pci_dev *pdev,
 
     if ( !iommu )
     {
-        AMD_IOMMU_DEBUG("%s: Can't find iommu for %04x:%02x:%02x.%u\n",
-                        __func__, pdev->seg, pdev->bus,
-                        PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
+        AMD_IOMMU_DEBUG("%s: Can't find iommu for %pp\n",
+                        __func__, &pdev->sbdf);
         return;
     }
 
diff --git a/xen/drivers/passthrough/amd/iommu_detect.c b/xen/drivers/passthrough/amd/iommu_detect.c
index 8312bb4b6f..d05bc6a5bb 100644
--- a/xen/drivers/passthrough/amd/iommu_detect.c
+++ b/xen/drivers/passthrough/amd/iommu_detect.c
@@ -182,9 +182,8 @@ int __init amd_iommu_detect_one_acpi(
 
     rt = pci_ro_device(iommu->seg, bus, PCI_DEVFN(dev, func));
     if ( rt )
-        printk(XENLOG_ERR
-               "Could not mark config space of %04x:%02x:%02x.%u read-only (%d)\n",
-               iommu->seg, bus, dev, func, rt);
+        printk(XENLOG_ERR "Could not mark config space of %pp read-only (%d)\n",
+               &PCI_SBDF2(iommu->seg, iommu->bdf), rt);
 
     list_add_tail(&iommu->list, &amd_iommu_head);
     rt = 0;
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 034f3b9c2c..24d1dfec40 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -558,10 +558,10 @@ static void parse_event_log_entry(struct amd_iommu *iommu, u32 entry[])
         unsigned int flags = MASK_EXTR(entry[1], IOMMU_EVENT_FLAGS_MASK);
         uint64_t addr = *(uint64_t *)(entry + 2);
 
-        printk(XENLOG_ERR "AMD-Vi: %s: %04x:%02x:%02x.%u d%d addr %016"PRIx64
+        printk(XENLOG_ERR "AMD-Vi: %s: %pp d%u addr %016"PRIx64
                " flags %#x%s%s%s%s%s%s%s%s%s%s\n",
-               code_str, iommu->seg, PCI_BUS(device_id), PCI_SLOT(device_id),
-               PCI_FUNC(device_id), domain_id, addr, flags,
+               code_str, &PCI_SBDF2(iommu->seg, device_id),
+               domain_id, addr, flags,
                (flags & 0xe00) ? " ??" : "",
                (flags & 0x100) ? " TR" : "",
                (flags & 0x080) ? " RZ" : "",
@@ -753,9 +753,8 @@ static bool_t __init set_iommu_interrupt_handler(struct amd_iommu *iommu)
     pcidevs_unlock();
     if ( !iommu->msi.dev )
     {
-        AMD_IOMMU_DEBUG("IOMMU: no pdev for %04x:%02x:%02x.%u\n",
-                        iommu->seg, PCI_BUS(iommu->bdf),
-                        PCI_SLOT(iommu->bdf), PCI_FUNC(iommu->bdf));
+        AMD_IOMMU_DEBUG("IOMMU: no pdev for %pp\n",
+                        &PCI_SBDF2(iommu->seg, iommu->bdf));
         return 0;
     }
 
@@ -841,9 +840,6 @@ __initcall(iov_adjust_irq_affinities);
 static void amd_iommu_erratum_746_workaround(struct amd_iommu *iommu)
 {
     u32 value;
-    u8 bus = PCI_BUS(iommu->bdf);
-    u8 dev = PCI_SLOT(iommu->bdf);
-    u8 func = PCI_FUNC(iommu->bdf);
 
     if ( (boot_cpu_data.x86 != 0x15) ||
          (boot_cpu_data.x86_model < 0x10) ||
@@ -861,8 +857,8 @@ static void amd_iommu_erratum_746_workaround(struct amd_iommu *iommu)
 
     pci_conf_write32(PCI_SBDF2(iommu->seg, iommu->bdf), 0xf4, value | (1 << 2));
     printk(XENLOG_INFO
-           "AMD-Vi: Applying erratum 746 workaround for IOMMU at %04x:%02x:%02x.%u\n",
-           iommu->seg, bus, dev, func);
+           "AMD-Vi: Applying erratum 746 workaround for IOMMU at %pp\n",
+           &PCI_SBDF2(iommu->seg, iommu->bdf));
 
     /* Clear the enable writing bit */
     pci_conf_write32(PCI_SBDF2(iommu->seg, iommu->bdf), 0xf0, 0x90);
diff --git a/xen/drivers/passthrough/amd/iommu_intr.c b/xen/drivers/passthrough/amd/iommu_intr.c
index cec575071d..0adee53fb8 100644
--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -610,8 +610,7 @@ static struct amd_iommu *_find_iommu_for_device(int seg, int bdf)
     if ( iommu )
         return iommu;
 
-    AMD_IOMMU_DEBUG("No IOMMU for MSI dev = %04x:%02x:%02x.%u\n",
-                    seg, PCI_BUS(bdf), PCI_SLOT(bdf), PCI_FUNC(bdf));
+    AMD_IOMMU_DEBUG("No IOMMU for MSI dev = %pp\n", &PCI_SBDF2(seg, bdf));
     return ERR_PTR(-EINVAL);
 }
 
@@ -863,10 +862,8 @@ static void dump_intremap_table(const struct amd_iommu *iommu,
 
         if ( ivrs_mapping )
         {
-            printk("  %04x:%02x:%02x:%u:\n", iommu->seg,
-                   PCI_BUS(ivrs_mapping->dte_requestor_id),
-                   PCI_SLOT(ivrs_mapping->dte_requestor_id),
-                   PCI_FUNC(ivrs_mapping->dte_requestor_id));
+            printk("  %pp:\n",
+                   &PCI_SBDF2(iommu->seg, ivrs_mapping->dte_requestor_id));
             ivrs_mapping = NULL;
         }
 
diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index 8d6309cc8c..5f5f4a2eac 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -49,9 +49,8 @@ struct amd_iommu *find_iommu_for_device(int seg, int bdf)
                 tmp.dte_requestor_id = bdf;
             ivrs_mappings[bdf] = tmp;
 
-            printk(XENLOG_WARNING "%04x:%02x:%02x.%u not found in ACPI tables;"
-                   " using same IOMMU as function 0\n",
-                   seg, PCI_BUS(bdf), PCI_SLOT(bdf), PCI_FUNC(bdf));
+            printk(XENLOG_WARNING "%pp not found in ACPI tables;"
+                   " using same IOMMU as function 0\n", &PCI_SBDF2(seg, bdf));
 
             /* write iommu field last */
             ivrs_mappings[bdf].iommu = ivrs_mappings[bd0].iommu;
@@ -349,9 +348,8 @@ static int reassign_device(struct domain *source, struct domain *target,
         return rc;
 
     amd_iommu_setup_domain_device(target, iommu, devfn, pdev);
-    AMD_IOMMU_DEBUG("Re-assign %04x:%02x:%02x.%u from dom%d to dom%d\n",
-                    pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                    source->domain_id, target->domain_id);
+    AMD_IOMMU_DEBUG("Re-assign %pp from dom%d to dom%d\n",
+                    &pdev->sbdf, source->domain_id, target->domain_id);
 
     return 0;
 }
@@ -459,15 +457,12 @@ static int amd_iommu_add_device(u8 devfn, struct pci_dev *pdev)
         if ( pdev->type == DEV_TYPE_PCI_HOST_BRIDGE &&
              is_hardware_domain(pdev->domain) )
         {
-            AMD_IOMMU_DEBUG("Skipping host bridge %04x:%02x:%02x.%u\n",
-                            pdev->seg, pdev->bus, PCI_SLOT(devfn),
-                            PCI_FUNC(devfn));
+            AMD_IOMMU_DEBUG("Skipping host bridge %pp\n", &pdev->sbdf);
             return 0;
         }
 
-        AMD_IOMMU_DEBUG("No iommu for %04x:%02x:%02x.%u; cannot be handed to d%d\n",
-                        pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                        pdev->domain->domain_id);
+        AMD_IOMMU_DEBUG("No iommu for %pp; cannot be handed to d%d\n",
+                        &pdev->sbdf, pdev->domain->domain_id);
         return -ENODEV;
     }
 
@@ -522,10 +517,8 @@ static int amd_iommu_remove_device(u8 devfn, struct pci_dev *pdev)
     iommu = find_iommu_for_device(pdev->seg, bdf);
     if ( !iommu )
     {
-        AMD_IOMMU_DEBUG("Fail to find iommu."
-                        " %04x:%02x:%02x.%u cannot be removed from dom%d\n",
-                        pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                        pdev->domain->domain_id);
+        AMD_IOMMU_DEBUG("Fail to find iommu. %pp cannot be removed from %pd\n",
+                        &pdev->sbdf, pdev->domain);
         return -ENODEV;
     }
 
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 5846978890..e54974bcb0 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -239,10 +239,6 @@ static void check_pdev(const struct pci_dev *pdev)
     (PCI_STATUS_PARITY | PCI_STATUS_SIG_TARGET_ABORT | \
      PCI_STATUS_REC_TARGET_ABORT | PCI_STATUS_REC_MASTER_ABORT | \
      PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_DETECTED_PARITY)
-    u16 seg = pdev->seg;
-    u8 bus = pdev->bus;
-    u8 dev = PCI_SLOT(pdev->devfn);
-    u8 func = PCI_FUNC(pdev->devfn);
     u16 val;
 
     if ( command_mask )
@@ -253,8 +249,8 @@ static void check_pdev(const struct pci_dev *pdev)
         val = pci_conf_read16(pdev->sbdf, PCI_STATUS);
         if ( val & PCI_STATUS_CHECK )
         {
-            printk(XENLOG_INFO "%04x:%02x:%02x.%u status %04x -> %04x\n",
-                   seg, bus, dev, func, val, val & ~PCI_STATUS_CHECK);
+            printk(XENLOG_INFO "%pp status %04x -> %04x\n",
+                   &pdev->sbdf, val, val & ~PCI_STATUS_CHECK);
             pci_conf_write16(pdev->sbdf, PCI_STATUS, val & PCI_STATUS_CHECK);
         }
     }
@@ -271,9 +267,8 @@ static void check_pdev(const struct pci_dev *pdev)
         val = pci_conf_read16(pdev->sbdf, PCI_SEC_STATUS);
         if ( val & PCI_STATUS_CHECK )
         {
-            printk(XENLOG_INFO
-                   "%04x:%02x:%02x.%u secondary status %04x -> %04x\n",
-                   seg, bus, dev, func, val, val & ~PCI_STATUS_CHECK);
+            printk(XENLOG_INFO "%pp secondary status %04x -> %04x\n",
+                   &pdev->sbdf, val, val & ~PCI_STATUS_CHECK);
             pci_conf_write16(pdev->sbdf, PCI_SEC_STATUS,
                              val & PCI_STATUS_CHECK);
         }
@@ -427,8 +422,8 @@ static struct pci_dev *alloc_pdev(struct pci_seg *pseg, u8 bus, u8 devfn)
             break;
 
         default:
-            printk(XENLOG_WARNING "%04x:%02x:%02x.%u: unknown type %d\n",
-                   pseg->nr, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pdev->type);
+            printk(XENLOG_WARNING "%pp: unknown type %d\n",
+                   &pdev->sbdf, pdev->type);
             break;
     }
 
@@ -660,9 +655,9 @@ unsigned int pci_size_mem_bar(pci_sbdf_t sbdf, unsigned int pos,
         if ( flags & PCI_BAR_LAST )
         {
             printk(XENLOG_WARNING
-                   "%sdevice %04x:%02x:%02x.%u with 64-bit %sBAR in last slot\n",
-                   (flags & PCI_BAR_VF) ? "SR-IOV " : "", sbdf.seg, sbdf.bus,
-                   sbdf.dev, sbdf.fn, (flags & PCI_BAR_VF) ? "vf " : "");
+                   "%sdevice %pp with 64-bit %sBAR in last slot\n",
+                   (flags & PCI_BAR_VF) ? "SR-IOV " : "", &sbdf,
+                   (flags & PCI_BAR_VF) ? "vf " : "");
             *psize = 0;
             return 1;
         }
@@ -765,9 +760,8 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
                      PCI_BASE_ADDRESS_SPACE_IO )
                 {
                     printk(XENLOG_WARNING
-                           "SR-IOV device %04x:%02x:%02x.%u with vf BAR%u"
-                           " in IO space\n",
-                           seg, bus, slot, func, i);
+                           "SR-IOV device %pp with vf BAR%u in IO space\n",
+                           &pdev->sbdf, i);
                     continue;
                 }
                 ret = pci_size_mem_bar(pdev->sbdf, idx, NULL,
@@ -780,10 +774,8 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
             }
         }
         else
-            printk(XENLOG_WARNING
-                   "SR-IOV device %04x:%02x:%02x.%u has its virtual"
-                   " functions already enabled (%04x)\n",
-                   seg, bus, slot, func, ctrl);
+            printk(XENLOG_WARNING "SR-IOV device %pp has its virtual"
+                   " functions already enabled (%04x)\n", &pdev->sbdf, ctrl);
     }
 
     check_pdev(pdev);
@@ -810,15 +802,14 @@ out:
     pcidevs_unlock();
     if ( !ret )
     {
-        printk(XENLOG_DEBUG "PCI add %s %04x:%02x:%02x.%u\n", pdev_type,
-               seg, bus, slot, func);
+        printk(XENLOG_DEBUG "PCI add %s %pp\n", pdev_type,  &pdev->sbdf);
         while ( pdev->phantom_stride )
         {
             func += pdev->phantom_stride;
             if ( PCI_SLOT(func) )
                 break;
-            printk(XENLOG_DEBUG "PCI phantom %04x:%02x:%02x.%u\n",
-                   seg, bus, slot, func);
+            printk(XENLOG_DEBUG "PCI phantom %pp\n",
+                   &PCI_SBDF(seg, bus, slot, func));
         }
     }
     return ret;
@@ -847,9 +838,8 @@ int pci_remove_device(u16 seg, u8 bus, u8 devfn)
             if ( pdev->domain )
                 list_del(&pdev->domain_list);
             pci_cleanup_msi(pdev);
+            printk(XENLOG_DEBUG "PCI remove device %pp\n", &pdev->sbdf);
             free_pdev(pseg, pdev);
-            printk(XENLOG_DEBUG "PCI remove device %04x:%02x:%02x.%u\n",
-                   seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
             break;
         }
 
@@ -968,8 +958,8 @@ static int deassign_device(struct domain *d, uint16_t seg, uint8_t bus,
 
  out:
     if ( ret )
-        printk(XENLOG_G_ERR "%pd: deassign (%04x:%02x:%02x.%u) failed (%d)\n",
-               d, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), ret);
+        printk(XENLOG_G_ERR "%pd: deassign (%pp) failed (%d)\n",
+               d, &PCI_SBDF3(seg, bus, devfn), ret);
 
     return ret;
 }
@@ -1138,8 +1128,8 @@ static int __init _scan_pci_devices(struct pci_seg *pseg, void *arg)
                 pdev = alloc_pdev(pseg, bus, PCI_DEVFN(dev, func));
                 if ( !pdev )
                 {
-                    printk(XENLOG_WARNING "%04x:%02x:%02x.%u: alloc_pdev failed\n",
-                           pseg->nr, bus, dev, func);
+                    printk(XENLOG_WARNING "%pp: alloc_pdev failed\n",
+                           &PCI_SBDF(pseg->nr, bus, dev, func));
                     return -ENOMEM;
                 }
 
@@ -1180,9 +1170,8 @@ static void __hwdom_init setup_one_hwdom_device(const struct setup_hwdom *ctxt,
         err = ctxt->handler(devfn, pdev);
         if ( err )
         {
-            printk(XENLOG_ERR "setup %04x:%02x:%02x.%u for d%d failed (%d)\n",
-                   pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                   ctxt->d->domain_id, err);
+            printk(XENLOG_ERR "setup %pp for d%d failed (%d)\n",
+                   &pdev->sbdf, ctxt->d->domain_id, err);
             if ( devfn == pdev->devfn )
                 return;
         }
@@ -1223,9 +1212,8 @@ static int __hwdom_init _setup_hwdom_pci_devices(struct pci_seg *pseg, void *arg
                 pdev->domain = dom_xen;
             }
             else if ( pdev->domain != ctxt->d )
-                printk(XENLOG_WARNING "Dom%d owning %04x:%02x:%02x.%u?\n",
-                       pdev->domain->domain_id, pseg->nr, bus,
-                       PCI_SLOT(devfn), PCI_FUNC(devfn));
+                printk(XENLOG_WARNING "Dom%d owning %pp?\n",
+                       pdev->domain->domain_id, &pdev->sbdf);
 
             if ( iommu_verbose )
             {
@@ -1361,9 +1349,8 @@ static int _dump_pci_devices(struct pci_seg *pseg, void *arg)
 
     list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
     {
-        printk("%04x:%02x:%02x.%u - %pd - node %-3d - MSIs < ",
-               pseg->nr, pdev->bus,
-               PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), pdev->domain,
+        printk("%pp - %pd - node %-3d - MSIs < ",
+               &pdev->sbdf, pdev->domain,
                (pdev->node != NUMA_NO_NODE) ? pdev->node : -1);
         list_for_each_entry ( msi, &pdev->msi_list, list )
                printk("%d ", msi->irq);
@@ -1428,8 +1415,8 @@ static int iommu_add_device(struct pci_dev *pdev)
             return 0;
         rc = hd->platform_ops->add_device(devfn, pci_to_dev(pdev));
         if ( rc )
-            printk(XENLOG_WARNING "IOMMU: add %04x:%02x:%02x.%u failed (%d)\n",
-                   pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn), rc);
+            printk(XENLOG_WARNING "IOMMU: add %pp failed (%d)\n",
+                   &pdev->sbdf, rc);
     }
 }
 
@@ -1473,8 +1460,7 @@ static int iommu_remove_device(struct pci_dev *pdev)
         if ( !rc )
             continue;
 
-        printk(XENLOG_ERR "IOMMU: remove %04x:%02x:%02x.%u failed (%d)\n",
-               pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn), rc);
+        printk(XENLOG_ERR "IOMMU: remove %pp failed (%d)\n", &pdev->sbdf, rc);
         return rc;
     }
 
@@ -1550,8 +1536,8 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn, u32 flag)
 
  done:
     if ( rc )
-        printk(XENLOG_G_WARNING "%pd: assign (%04x:%02x:%02x.%u) failed (%d)\n",
-               d, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), rc);
+        printk(XENLOG_G_WARNING "%pd: assign (%pp) failed (%d)\n",
+               d, &PCI_SBDF3(seg, bus, devfn), rc);
     /* The device is assigned to dom_io so mark it as quarantined */
     else if ( d == dom_io )
         pdev->quarantine = true;
@@ -1624,10 +1610,8 @@ void iommu_dev_iotlb_flush_timeout(struct domain *d, struct pci_dev *pdev)
     _pci_hide_device(pdev);
 
     if ( !d->is_shutting_down && printk_ratelimit() )
-        printk(XENLOG_ERR
-               "dom%d: ATS device %04x:%02x:%02x.%u flush failed\n",
-               d->domain_id, pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
-               PCI_FUNC(pdev->devfn));
+        printk(XENLOG_ERR "dom%d: ATS device %pp flush failed\n",
+               d->domain_id, &pdev->sbdf);
     if ( !is_hardware_domain(d) )
         domain_crash(d);
 
@@ -1717,9 +1701,8 @@ int iommu_do_pci_domctl(
         {
             if ( ret )
             {
-                printk(XENLOG_G_INFO
-                       "%04x:%02x:%02x.%u already assigned, or non-existent\n",
-                       seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+                printk(XENLOG_G_INFO "%pp already assigned, or non-existent\n",
+                       &PCI_SBDF3(seg, bus, devfn));
                 ret = -EINVAL;
             }
         }
diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index 29cd5c5d70..36d909b06d 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -349,9 +349,8 @@ static int __init acpi_parse_dev_scope(
             sub_bus = pci_conf_read8(PCI_SBDF(seg, bus, path->dev, path->fn),
                                      PCI_SUBORDINATE_BUS);
             if ( iommu_verbose )
-                printk(VTDPREFIX
-                       " bridge: %04x:%02x:%02x.%u start=%x sec=%x sub=%x\n",
-                       seg, bus, path->dev, path->fn,
+                printk(VTDPREFIX " bridge: %pp start=%x sec=%x sub=%x\n",
+                       &PCI_SBDF(seg, bus, path->dev, path->fn),
                        acpi_scope->bus, sec_bus, sub_bus);
 
             dmar_scope_add_buses(scope, sec_bus, sub_bus);
@@ -359,8 +358,8 @@ static int __init acpi_parse_dev_scope(
 
         case ACPI_DMAR_SCOPE_TYPE_HPET:
             if ( iommu_verbose )
-                printk(VTDPREFIX " MSI HPET: %04x:%02x:%02x.%u\n",
-                       seg, bus, path->dev, path->fn);
+                printk(VTDPREFIX " MSI HPET: %pp\n",
+                       &PCI_SBDF(seg, bus, path->dev, path->fn));
 
             if ( drhd )
             {
@@ -381,8 +380,8 @@ static int __init acpi_parse_dev_scope(
 
         case ACPI_DMAR_SCOPE_TYPE_ENDPOINT:
             if ( iommu_verbose )
-                printk(VTDPREFIX " endpoint: %04x:%02x:%02x.%u\n",
-                       seg, bus, path->dev, path->fn);
+                printk(VTDPREFIX " endpoint: %pp\n",
+                       &PCI_SBDF(seg, bus, path->dev, path->fn));
 
             if ( drhd )
             {
@@ -395,8 +394,8 @@ static int __init acpi_parse_dev_scope(
 
         case ACPI_DMAR_SCOPE_TYPE_IOAPIC:
             if ( iommu_verbose )
-                printk(VTDPREFIX " IOAPIC: %04x:%02x:%02x.%u\n",
-                       seg, bus, path->dev, path->fn);
+                printk(VTDPREFIX " IOAPIC: %pp\n",
+                       &PCI_SBDF(seg, bus, path->dev, path->fn));
 
             if ( drhd )
             {
@@ -525,8 +524,8 @@ acpi_parse_one_drhd(struct acpi_dmar_header *header)
 
             if ( !pci_device_detect(drhd->segment, b, d, f) )
                 printk(XENLOG_WARNING VTDPREFIX
-                       " Non-existent device (%04x:%02x:%02x.%u) in this DRHD's scope!\n",
-                       drhd->segment, b, d, f);
+                       " Non-existent device (%pp) in this DRHD's scope!\n",
+                       &PCI_SBDF(drhd->segment, b, d, f));
         }
 
         acpi_register_drhd_unit(dmaru);
@@ -562,9 +561,9 @@ static int register_one_rmrr(struct acpi_rmrr_unit *rmrru)
         if ( pci_device_detect(rmrru->segment, b, d, f) == 0 )
         {
             dprintk(XENLOG_WARNING VTDPREFIX,
-                    " Non-existent device (%04x:%02x:%02x.%u) is reported"
-                    " in RMRR [%"PRIx64",%"PRIx64"]'s scope!\n",
-                    rmrru->segment, b, d, f,
+                    " Non-existent device (%pp) is reported"
+                    " in RMRR [%"PRIx64", %"PRIx64"]'s scope!\n",
+                    &PCI_SBDF(rmrru->segment, b, d, f),
                     rmrru->base_address, rmrru->end_address);
             ignore = true;
         }
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index a2f02c1bea..0d2a9d78de 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -521,16 +521,13 @@ static void set_msi_source_id(struct pci_dev *pdev, struct iremap_entry *ire)
         }
         else
             dprintk(XENLOG_WARNING VTDPREFIX,
-                    "d%d: no upstream bridge for %04x:%02x:%02x.%u\n",
-                    pdev->domain->domain_id,
-                    seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+                    "d%d: no upstream bridge for %pp\n",
+                    pdev->domain->domain_id, &pdev->sbdf);
         break;
 
     default:
-        dprintk(XENLOG_WARNING VTDPREFIX,
-                "d%d: unknown(%u): %04x:%02x:%02x.%u\n",
-                pdev->domain->domain_id, pdev->type,
-                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+        dprintk(XENLOG_WARNING VTDPREFIX, "d%d: unknown(%u): %pp\n",
+                pdev->domain->domain_id, pdev->type, &pdev->sbdf);
         break;
    }
 }
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 01dc444771..deaeab095d 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -870,27 +870,24 @@ static int iommu_page_fault_do_one(struct vtd_iommu *iommu, int type,
     {
     case DMA_REMAP:
         printk(XENLOG_G_WARNING VTDPREFIX
-               "DMAR:[%s] Request device [%04x:%02x:%02x.%u] "
+               "DMAR:[%s] Request device [%pp] "
                "fault addr %"PRIx64"\n",
                (type ? "DMA Read" : "DMA Write"),
-               seg, PCI_BUS(source_id), PCI_SLOT(source_id),
-               PCI_FUNC(source_id), addr);
+               &PCI_SBDF2(seg, source_id), addr);
         kind = "DMAR";
         break;
     case INTR_REMAP:
         printk(XENLOG_G_WARNING VTDPREFIX
-               "INTR-REMAP: Request device [%04x:%02x:%02x.%u] "
+               "INTR-REMAP: Request device [%pp] "
                "fault index %"PRIx64"\n",
-               seg, PCI_BUS(source_id), PCI_SLOT(source_id),
-               PCI_FUNC(source_id), addr >> 48);
+               &PCI_SBDF2(seg, source_id), addr >> 48);
         kind = "INTR-REMAP";
         break;
     default:
         printk(XENLOG_G_WARNING VTDPREFIX
-               "UNKNOWN: Request device [%04x:%02x:%02x.%u] "
+               "UNKNOWN: Request device [%pp] "
                "fault addr %"PRIx64"\n",
-               seg, PCI_BUS(source_id), PCI_SLOT(source_id),
-               PCI_FUNC(source_id), addr);
+               &PCI_SBDF2(seg, source_id), addr);
         kind = "UNKNOWN";
         break;
     }
@@ -1336,9 +1333,8 @@ int domain_context_mapping_one(
         {
             if ( pdev->domain != domain )
             {
-                printk(XENLOG_G_INFO VTDPREFIX
-                       "%pd: %04x:%02x:%02x.%u owned by %pd\n",
-                       domain, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                printk(XENLOG_G_INFO VTDPREFIX "%pd: %pp owned by %pd",
+                       domain, &PCI_SBDF3(seg, bus, devfn),
                        pdev->domain);
                 res = -EINVAL;
             }
@@ -1351,17 +1347,15 @@ int domain_context_mapping_one(
             if ( cdomain < 0 )
             {
                 printk(XENLOG_G_WARNING VTDPREFIX
-                       "%pd: %04x:%02x:%02x.%u mapped, but can't find owner\n",
-                       domain, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+                       "%pd: %pp mapped, but can't find owner\n",
+                       domain, &PCI_SBDF3(seg, bus, devfn));
                 res = -EINVAL;
             }
             else if ( cdomain != domain->domain_id )
             {
                 printk(XENLOG_G_INFO VTDPREFIX
-                       "%pd: %04x:%02x:%02x.%u already mapped to d%d\n",
-                       domain,
-                       seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                       cdomain);
+                       "%pd: %pp already mapped to d%d",
+                       domain, &PCI_SBDF3(seg, bus, devfn), cdomain);
                 res = -EINVAL;
             }
         }
@@ -1487,9 +1481,8 @@ static int domain_context_mapping(struct domain *domain, u8 devfn,
     {
     case DEV_TYPE_PCI_HOST_BRIDGE:
         if ( iommu_debug )
-            printk(VTDPREFIX "d%d:Hostbridge: skip %04x:%02x:%02x.%u map\n",
-                   domain->domain_id, seg, bus,
-                   PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(VTDPREFIX "%pd:Hostbridge: skip %pp map\n",
+                   domain, &PCI_SBDF3(seg, bus, devfn));
         if ( !is_hardware_domain(domain) )
             return -EPERM;
         break;
@@ -1501,9 +1494,8 @@ static int domain_context_mapping(struct domain *domain, u8 devfn,
 
     case DEV_TYPE_PCIe_ENDPOINT:
         if ( iommu_debug )
-            printk(VTDPREFIX "d%d:PCIe: map %04x:%02x:%02x.%u\n",
-                   domain->domain_id, seg, bus,
-                   PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(VTDPREFIX "%pd:PCIe: map %pp\n",
+                   domain, &PCI_SBDF3(seg, bus, devfn));
         ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn,
                                          pdev);
         if ( !ret && devfn == pdev->devfn && ats_device(pdev, drhd) > 0 )
@@ -1513,9 +1505,8 @@ static int domain_context_mapping(struct domain *domain, u8 devfn,
 
     case DEV_TYPE_PCI:
         if ( iommu_debug )
-            printk(VTDPREFIX "d%d:PCI: map %04x:%02x:%02x.%u\n",
-                   domain->domain_id, seg, bus,
-                   PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(VTDPREFIX "%pd:PCI: map %pp\n",
+                   domain, &PCI_SBDF3(seg, bus, devfn));
 
         ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn,
                                          pdev);
@@ -1551,9 +1542,8 @@ static int domain_context_mapping(struct domain *domain, u8 devfn,
         break;
 
     default:
-        dprintk(XENLOG_ERR VTDPREFIX, "d%d:unknown(%u): %04x:%02x:%02x.%u\n",
-                domain->domain_id, pdev->type,
-                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+        dprintk(XENLOG_ERR VTDPREFIX, "%pd:unknown(%u): %pp\n",
+                domain, pdev->type, &PCI_SBDF3(seg, bus, devfn));
         ret = -EINVAL;
         break;
     }
@@ -1648,9 +1638,8 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
     {
     case DEV_TYPE_PCI_HOST_BRIDGE:
         if ( iommu_debug )
-            printk(VTDPREFIX "d%d:Hostbridge: skip %04x:%02x:%02x.%u unmap\n",
-                   domain->domain_id, seg, bus,
-                   PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(VTDPREFIX "%pd:Hostbridge: skip %pp unmap\n",
+                   domain, &PCI_SBDF3(seg, bus, devfn));
         if ( !is_hardware_domain(domain) )
             return -EPERM;
         goto out;
@@ -1662,9 +1651,8 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
 
     case DEV_TYPE_PCIe_ENDPOINT:
         if ( iommu_debug )
-            printk(VTDPREFIX "d%d:PCIe: unmap %04x:%02x:%02x.%u\n",
-                   domain->domain_id, seg, bus,
-                   PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(VTDPREFIX "%pd:PCIe: unmap %pp\n",
+                   domain, &PCI_SBDF3(seg, bus, devfn));
         ret = domain_context_unmap_one(domain, iommu, bus, devfn);
         if ( !ret && devfn == pdev->devfn && ats_device(pdev, drhd) > 0 )
             disable_ats_device(pdev);
@@ -1673,8 +1661,8 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
 
     case DEV_TYPE_PCI:
         if ( iommu_debug )
-            printk(VTDPREFIX "d%d:PCI: unmap %04x:%02x:%02x.%u\n",
-                   domain->domain_id, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(VTDPREFIX "%pd:PCI: unmap %pp\n",
+                   domain, &PCI_SBDF3(seg, bus, devfn));
         ret = domain_context_unmap_one(domain, iommu, bus, devfn);
         if ( ret )
             break;
@@ -1699,9 +1687,8 @@ static int domain_context_unmap(struct domain *domain, u8 devfn,
         break;
 
     default:
-        dprintk(XENLOG_ERR VTDPREFIX, "d%d:unknown(%u): %04x:%02x:%02x.%u\n",
-                domain->domain_id, pdev->type,
-                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+        dprintk(XENLOG_ERR VTDPREFIX, "%pd:unknown(%u): %pp\n",
+                domain, pdev->type, &PCI_SBDF3(seg, bus, devfn));
         ret = -EINVAL;
         goto out;
     }
@@ -2459,12 +2446,11 @@ static int intel_iommu_assign_device(
             bool_t relaxed = !!(flag & XEN_DOMCTL_DEV_RDM_RELAXED);
 
             printk(XENLOG_GUEST "%s" VTDPREFIX
-                   " It's %s to assign %04x:%02x:%02x.%u"
-                   " with shared RMRR at %"PRIx64" for Dom%d.\n",
+                   " It's %s to assign %pp"
+                   " with shared RMRR at %"PRIx64" for %pd.\n",
                    relaxed ? XENLOG_WARNING : XENLOG_ERR,
                    relaxed ? "risky" : "disallowed",
-                   seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                   rmrr->base_address, d->domain_id);
+                   &PCI_SBDF3(seg, bus, devfn), rmrr->base_address, d);
             if ( !relaxed )
                 return -EPERM;
         }
@@ -2494,8 +2480,8 @@ static int intel_iommu_assign_device(
                 if ( rc )
                 {
                     printk(XENLOG_ERR VTDPREFIX
-                           " failed to reclaim %04x:%02x:%02x.%u from %pd (%d)\n",
-                           seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), d, rc);
+                           " failed to reclaim %pp from %pd (%d)\n",
+                           &PCI_SBDF3(seg, bus, devfn), d, rc);
                     domain_crash(d);
                 }
                 break;
diff --git a/xen/drivers/passthrough/vtd/quirks.c b/xen/drivers/passthrough/vtd/quirks.c
index 5594270678..a8330f17bc 100644
--- a/xen/drivers/passthrough/vtd/quirks.c
+++ b/xen/drivers/passthrough/vtd/quirks.c
@@ -413,8 +413,6 @@ void pci_vtd_quirk(const struct pci_dev *pdev)
 {
     int seg = pdev->seg;
     int bus = pdev->bus;
-    int dev = PCI_SLOT(pdev->devfn);
-    int func = PCI_FUNC(pdev->devfn);
     int pos;
     bool_t ff;
     u32 val, val2;
@@ -438,8 +436,7 @@ void pci_vtd_quirk(const struct pci_dev *pdev)
     case 0x3c28: /* Sandybridge */
         val = pci_conf_read32(pdev->sbdf, 0x1AC);
         pci_conf_write32(pdev->sbdf, 0x1AC, val | (1 << 31));
-        printk(XENLOG_INFO "Masked VT-d error signaling on %04x:%02x:%02x.%u\n",
-               seg, bus, dev, func);
+        printk(XENLOG_INFO "Masked VT-d error signaling on %pp\n", &pdev->sbdf);
         break;
 
     /* Tylersburg (EP)/Boxboro (MP) chipsets (NHM-EP/EX, WSM-EP/EX) */
@@ -474,8 +471,7 @@ void pci_vtd_quirk(const struct pci_dev *pdev)
             ff = pcie_aer_get_firmware_first(pdev);
         if ( !pos )
         {
-            printk(XENLOG_WARNING "%04x:%02x:%02x.%u without AER capability?\n",
-                   seg, bus, dev, func);
+            printk(XENLOG_WARNING "%pp without AER capability?\n", &pdev->sbdf);
             break;
         }
 
@@ -498,8 +494,7 @@ void pci_vtd_quirk(const struct pci_dev *pdev)
         val = pci_conf_read32(pdev->sbdf, 0x20c);
         pci_conf_write32(pdev->sbdf, 0x20c, val | (1 << 4));
 
-        printk(XENLOG_INFO "%s UR signaling on %04x:%02x:%02x.%u\n",
-               action, seg, bus, dev, func);
+        printk(XENLOG_INFO "%s UR signaling on %pp\n", action, &pdev->sbdf);
         break;
 
     case 0x0040: case 0x0044: case 0x0048: /* Nehalem/Westmere */
@@ -524,16 +519,15 @@ void pci_vtd_quirk(const struct pci_dev *pdev)
             {
                 __set_bit(0x1c8 * 8 + 20, va);
                 iounmap(va);
-                printk(XENLOG_INFO "Masked UR signaling on %04x:%02x:%02x.%u\n",
-                       seg, bus, dev, func);
+                printk(XENLOG_INFO "Masked UR signaling on %pp\n", &pdev->sbdf);
             }
             else
-                printk(XENLOG_ERR "Could not map %"PRIpaddr" for %04x:%02x:%02x.%u\n",
-                       pa, seg, bus, dev, func);
+                printk(XENLOG_ERR "Could not map %"PRIpaddr" for %pp\n",
+                       pa, &pdev->sbdf);
         }
         else
-            printk(XENLOG_WARNING "Bogus DMIBAR %#"PRIx64" on %04x:%02x:%02x.%u\n",
-                   bar, seg, bus, dev, func);
+            printk(XENLOG_WARNING "Bogus DMIBAR %#"PRIx64" on %pp\n",
+                   bar, &pdev->sbdf);
         break;
     }
 }
diff --git a/xen/drivers/passthrough/vtd/utils.c b/xen/drivers/passthrough/vtd/utils.c
index 7552dd8e0c..4febcf506d 100644
--- a/xen/drivers/passthrough/vtd/utils.c
+++ b/xen/drivers/passthrough/vtd/utils.c
@@ -95,9 +95,9 @@ void print_vtd_entries(struct vtd_iommu *iommu, int bus, int devfn, u64 gmfn)
     u64 *l, val;
     u32 l_index, level;
 
-    printk("print_vtd_entries: iommu #%u dev %04x:%02x:%02x.%u gmfn %"PRI_gfn"\n",
-           iommu->index, iommu->drhd->segment, bus,
-           PCI_SLOT(devfn), PCI_FUNC(devfn), gmfn);
+    printk("print_vtd_entries: iommu #%u dev %pp gmfn %"PRI_gfn"\n",
+           iommu->index, &PCI_SBDF3(iommu->drhd->segment, bus, devfn),
+           gmfn);
 
     if ( iommu->root_maddr == 0 )
     {
diff --git a/xen/drivers/passthrough/x86/ats.c b/xen/drivers/passthrough/x86/ats.c
index 8ae0eae4a2..4628ffde45 100644
--- a/xen/drivers/passthrough/x86/ats.c
+++ b/xen/drivers/passthrough/x86/ats.c
@@ -32,8 +32,7 @@ int enable_ats_device(struct pci_dev *pdev, struct list_head *ats_list)
     BUG_ON(!pos);
 
     if ( iommu_verbose )
-        dprintk(XENLOG_INFO, "%04x:%02x:%02x.%u: ATS capability found\n",
-                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+        dprintk(XENLOG_INFO, "%pp: ATS capability found\n", &pdev->sbdf);
 
     value = pci_conf_read16(pdev->sbdf, pos + ATS_REG_CTL);
     if ( value & ATS_ENABLE )
@@ -64,9 +63,8 @@ int enable_ats_device(struct pci_dev *pdev, struct list_head *ats_list)
     }
 
     if ( iommu_verbose )
-        dprintk(XENLOG_INFO, "%04x:%02x:%02x.%u: ATS %s enabled\n",
-                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                pos ? "is" : "was");
+        dprintk(XENLOG_INFO, "%pp: ATS %s enabled\n",
+                &pdev->sbdf, pos ? "is" : "was");
 
     return pos;
 }
@@ -74,8 +72,6 @@ int enable_ats_device(struct pci_dev *pdev, struct list_head *ats_list)
 void disable_ats_device(struct pci_dev *pdev)
 {
     u32 value;
-    u16 seg = pdev->seg;
-    u8 bus = pdev->bus, devfn = pdev->devfn;
 
     BUG_ON(!pdev->ats.cap_pos);
 
@@ -86,6 +82,5 @@ void disable_ats_device(struct pci_dev *pdev)
     list_del(&pdev->ats.list);
 
     if ( iommu_verbose )
-        dprintk(XENLOG_INFO, "%04x:%02x:%02x.%u: ATS is disabled\n",
-                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+        dprintk(XENLOG_INFO, "%pp: ATS is disabled\n", &pdev->sbdf);
 }
diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index 3c794f486d..ba9a036202 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -355,7 +355,6 @@ static void bar_write(const struct pci_dev *pdev, unsigned int reg,
                       uint32_t val, void *data)
 {
     struct vpci_bar *bar = data;
-    uint8_t slot = PCI_SLOT(pdev->devfn), func = PCI_FUNC(pdev->devfn);
     bool hi = false;
 
     if ( bar->type == VPCI_BAR_MEM64_HI )
@@ -372,9 +371,8 @@ static void bar_write(const struct pci_dev *pdev, unsigned int reg,
         /* If the value written is the current one avoid printing a warning. */
         if ( val != (uint32_t)(bar->addr >> (hi ? 32 : 0)) )
             gprintk(XENLOG_WARNING,
-                    "%04x:%02x:%02x.%u: ignored BAR %lu write with memory decoding enabled\n",
-                    pdev->seg, pdev->bus, slot, func,
-                    bar - pdev->vpci->header.bars + hi);
+                    "%pp: ignored BAR %lu write with memory decoding enabled\n",
+                    &pdev->sbdf, bar - pdev->vpci->header.bars + hi);
         return;
     }
 
@@ -402,15 +400,14 @@ static void rom_write(const struct pci_dev *pdev, unsigned int reg,
 {
     struct vpci_header *header = &pdev->vpci->header;
     struct vpci_bar *rom = data;
-    uint8_t slot = PCI_SLOT(pdev->devfn), func = PCI_FUNC(pdev->devfn);
     uint16_t cmd = pci_conf_read16(pdev->sbdf, PCI_COMMAND);
     bool new_enabled = val & PCI_ROM_ADDRESS_ENABLE;
 
     if ( (cmd & PCI_COMMAND_MEMORY) && header->rom_enabled && new_enabled )
     {
         gprintk(XENLOG_WARNING,
-                "%04x:%02x:%02x.%u: ignored ROM BAR write with memory decoding enabled\n",
-                pdev->seg, pdev->bus, slot, func);
+                "%pp: ignored ROM BAR write with memory decoding enabled\n",
+                &pdev->sbdf);
         return;
     }
 
diff --git a/xen/drivers/vpci/msi.c b/xen/drivers/vpci/msi.c
index 75010762ed..65db438d24 100644
--- a/xen/drivers/vpci/msi.c
+++ b/xen/drivers/vpci/msi.c
@@ -289,8 +289,7 @@ void vpci_dump_msi(void)
             msi = pdev->vpci->msi;
             if ( msi && msi->enabled )
             {
-                printk("%04x:%02x:%02x.%u MSI\n", pdev->seg, pdev->bus,
-                       PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
+                printk("%pp MSI\n", &pdev->sbdf);
 
                 printk("  enabled: %d 64-bit: %d",
                        msi->enabled, msi->address64);
@@ -307,8 +306,7 @@ void vpci_dump_msi(void)
             {
                 int rc;
 
-                printk("%04x:%02x:%02x.%u MSI-X\n", pdev->seg, pdev->bus,
-                       PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
+                printk("%pp MSI-X\n", &pdev->sbdf);
 
                 printk("  entries: %u maskall: %d enabled: %d\n",
                        msix->max_entries, msix->masked, msix->enabled);
diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
index 38c1e7e5dd..64dd0a929c 100644
--- a/xen/drivers/vpci/msix.c
+++ b/xen/drivers/vpci/msix.c
@@ -42,15 +42,14 @@ static uint32_t control_read(const struct pci_dev *pdev, unsigned int reg,
 static int update_entry(struct vpci_msix_entry *entry,
                         const struct pci_dev *pdev, unsigned int nr)
 {
-    uint8_t slot = PCI_SLOT(pdev->devfn), func = PCI_FUNC(pdev->devfn);
     int rc = vpci_msix_arch_disable_entry(entry, pdev);
 
     /* Ignore ENOENT, it means the entry wasn't setup. */
     if ( rc && rc != -ENOENT )
     {
         gprintk(XENLOG_WARNING,
-                "%04x:%02x:%02x.%u: unable to disable entry %u for update: %d\n",
-                pdev->seg, pdev->bus, slot, func, nr, rc);
+                "%pp: unable to disable entry %u for update: %d\n",
+                &pdev->sbdf, nr, rc);
         return rc;
     }
 
@@ -59,9 +58,8 @@ static int update_entry(struct vpci_msix_entry *entry,
                                                       VPCI_MSIX_TABLE));
     if ( rc )
     {
-        gprintk(XENLOG_WARNING,
-                "%04x:%02x:%02x.%u: unable to enable entry %u: %d\n",
-                pdev->seg, pdev->bus, slot, func, nr, rc);
+        gprintk(XENLOG_WARNING, "%pp: unable to enable entry %u: %d\n",
+                &pdev->sbdf, nr, rc);
         /* Entry is likely not properly configured. */
         return rc;
     }
@@ -72,7 +70,6 @@ static int update_entry(struct vpci_msix_entry *entry,
 static void control_write(const struct pci_dev *pdev, unsigned int reg,
                           uint32_t val, void *data)
 {
-    uint8_t slot = PCI_SLOT(pdev->devfn), func = PCI_FUNC(pdev->devfn);
     struct vpci_msix *msix = data;
     bool new_masked = val & PCI_MSIX_FLAGS_MASKALL;
     bool new_enabled = val & PCI_MSIX_FLAGS_ENABLE;
@@ -133,9 +130,8 @@ static void control_write(const struct pci_dev *pdev, unsigned int reg,
                 /* Ignore non-present entry. */
                 break;
             default:
-                gprintk(XENLOG_WARNING,
-                        "%04x:%02x:%02x.%u: unable to disable entry %u: %d\n",
-                        pdev->seg, pdev->bus, slot, func, i, rc);
+                gprintk(XENLOG_WARNING, "%pp: unable to disable entry %u: %d\n",
+                        &pdev->sbdf, i, rc);
                 return;
             }
         }
@@ -180,8 +176,7 @@ static bool access_allowed(const struct pci_dev *pdev, unsigned long addr,
         return true;
 
     gprintk(XENLOG_WARNING,
-            "%04x:%02x:%02x.%u: unaligned or invalid size MSI-X table access\n",
-            pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
+            "%pp: unaligned or invalid size MSI-X table access\n", &pdev->sbdf);
 
     return false;
 }
@@ -431,10 +426,9 @@ int vpci_make_msix_hole(const struct pci_dev *pdev)
             default:
                 put_gfn(d, start);
                 gprintk(XENLOG_WARNING,
-                        "%04x:%02x:%02x.%u: existing mapping (mfn: %" PRI_mfn
+                        "%pp: existing mapping (mfn: %" PRI_mfn
                         "type: %d) at %#lx clobbers MSIX MMIO area\n",
-                        pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
-                        PCI_FUNC(pdev->devfn), mfn_x(mfn), t, start);
+                        &pdev->sbdf, mfn_x(mfn), t, start);
                 return -EEXIST;
             }
             put_gfn(d, start);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 29 20:00:34 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 29 Jul 2020 20:00: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 1k0sFe-0000i3-T3; Wed, 29 Jul 2020 20:00:34 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=BDG6=BI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0sFd-0000hr-BO
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:00:33 +0000
X-Inumbo-ID: 28b77b74-d1d6-11ea-8cd8-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 28b77b74-d1d6-11ea-8cd8-bc764e2007e4;
 Wed, 29 Jul 2020 20:00:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=8BBdV9QKXqSAE5b2YOt58SAF4tWhJqtL1Q1NnLelaus=; b=Ge4iD3atr8qHNeZkfU8cMrHUtT
 6rxGlUGC3Tro9jhl3+p6EnJZyk0RpZcseopxZZ2kGMkowJ3G92Jou7pbDPaho7Dy8/+Z90lL+sCwm
 311EETnYoM9a4Bmb7tOSffWjSubt7/mc1SmtSWZTtZngJ3ZpjjrmIMSh6dfKpVxf5WnM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0sFc-0000oo-C7
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0sFc-0001OB-Ae
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:00:32 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/hvm: fix vIO-APIC build without IRQ0_SPECIAL_ROUTING
Message-Id: <E1k0sFc-0001OB-Ae@xenbits.xenproject.org>
Date: Wed, 29 Jul 2020 20:00:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 4489ffdec331cdd3a2e025f9def68e07403706d1
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Jul 27 19:05:35 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jul 28 19:33:28 2020 +0100

    x86/hvm: fix vIO-APIC build without IRQ0_SPECIAL_ROUTING
    
    pit_channel0_enabled needs to be guarded with IRQ0_SPECIAL_ROUTING
    since it's only used when the special handling of ISA IRQ 0 is
    enabled. However such helper being a single line it's better to just
    inline it directly in vioapic_deliver where it's used.
    
    No functional change.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/vioapic.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index b87facb0e0..b00037ea87 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -391,11 +391,6 @@ static void ioapic_inj_irq(
     vlapic_set_irq(target, vector, trig_mode);
 }
 
-static inline int pit_channel0_enabled(void)
-{
-    return pt_active(&current->domain->arch.vpit.pt0);
-}
-
 static void vioapic_deliver(struct hvm_vioapic *vioapic, unsigned int pin)
 {
     uint16_t dest = vioapic->redirtbl[pin].fields.dest_id;
@@ -421,7 +416,7 @@ static void vioapic_deliver(struct hvm_vioapic *vioapic, unsigned int pin)
     {
 #ifdef IRQ0_SPECIAL_ROUTING
         /* Force round-robin to pick VCPU 0 */
-        if ( (irq == hvm_isa_irq_to_gsi(0)) && pit_channel0_enabled() )
+        if ( (irq == hvm_isa_irq_to_gsi(0)) && pt_active(&d->arch.vpit.pt0) )
         {
             v = d->vcpu ? d->vcpu[0] : NULL;
             target = v ? vcpu_vlapic(v) : NULL;
@@ -446,7 +441,7 @@ static void vioapic_deliver(struct hvm_vioapic *vioapic, unsigned int pin)
     {
 #ifdef IRQ0_SPECIAL_ROUTING
         /* Do not deliver timer interrupts to VCPU != 0 */
-        if ( (irq == hvm_isa_irq_to_gsi(0)) && pit_channel0_enabled() )
+        if ( (irq == hvm_isa_irq_to_gsi(0)) && pt_active(&d->arch.vpit.pt0) )
         {
             if ( (v = d->vcpu ? d->vcpu[0] : NULL) != NULL )
                 ioapic_inj_irq(vioapic, vcpu_vlapic(v), vector,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 29 20:00:44 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 29 Jul 2020 20:00: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 1k0sFo-0000jV-Uk; Wed, 29 Jul 2020 20:00:44 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=BDG6=BI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0sFn-0000jF-89
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:00:43 +0000
X-Inumbo-ID: 2eb63fba-d1d6-11ea-8cd8-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 2eb63fba-d1d6-11ea-8cd8-bc764e2007e4;
 Wed, 29 Jul 2020 20:00:42 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=hfxb4dV3aNb13tdca/mVvs6RbdYOdbIeAKeVGGebNhU=; b=XAq8YIs2sOZJ7mlNs+fI+DfKoz
 HF4KRoc+4nOYx1XtvbiValNwQ4VnNYGXSloCVTBd9zHdy85lCQaM4SxoEA3ljSegz7cmGm8Uz+x8Y
 gcBv2gyEyLLaH+dqluJf6Gtrflqb0xLhT6eIabBOa4pQSVRJX5d/upcoklJTIppR0k/k=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0sFm-0000p4-Er
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0sFm-0001Oz-E9
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:00:42 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/hvm: don't force vCPU 0 for IRQ 0 when using fixed
 destination mode
Message-Id: <E1k0sFm-0001Oz-E9@xenbits.xenproject.org>
Date: Wed, 29 Jul 2020 20:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ab5bfc049e8e04bca66d591ab439d2341623f83c
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Jul 27 19:05:36 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jul 28 19:33:28 2020 +0100

    x86/hvm: don't force vCPU 0 for IRQ 0 when using fixed destination mode
    
    When the IO APIC pin mapped to the ISA IRQ 0 has been configured to
    use fixed delivery mode, do not forcefully route interrupts to vCPU 0,
    as the OS might have setup those interrupts to be injected to a
    different vCPU, and injecting to vCPU 0 can cause the OS to miss such
    interrupts or errors to happen due to unexpected vectors being
    injected on vCPU 0.
    
    In order to fix remove such handling altogether for fixed destination
    mode pins and just inject them according to the data setup in the
    IO-APIC entry.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vioapic.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index b00037ea87..123191db75 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -438,26 +438,11 @@ static void vioapic_deliver(struct hvm_vioapic *vioapic, unsigned int pin)
     }
 
     case dest_Fixed:
-    {
-#ifdef IRQ0_SPECIAL_ROUTING
-        /* Do not deliver timer interrupts to VCPU != 0 */
-        if ( (irq == hvm_isa_irq_to_gsi(0)) && pt_active(&d->arch.vpit.pt0) )
-        {
-            if ( (v = d->vcpu ? d->vcpu[0] : NULL) != NULL )
-                ioapic_inj_irq(vioapic, vcpu_vlapic(v), vector,
-                               trig_mode, delivery_mode);
-        }
-        else
-#endif
-        {
-            for_each_vcpu ( d, v )
-                if ( vlapic_match_dest(vcpu_vlapic(v), NULL,
-                                       0, dest, dest_mode) )
-                    ioapic_inj_irq(vioapic, vcpu_vlapic(v), vector,
-                                   trig_mode, delivery_mode);
-        }
+        for_each_vcpu ( d, v )
+            if ( vlapic_match_dest(vcpu_vlapic(v), NULL, 0, dest, dest_mode) )
+                ioapic_inj_irq(vioapic, vcpu_vlapic(v), vector, trig_mode,
+                               delivery_mode);
         break;
-    }
 
     case dest_NMI:
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 29 20:00:55 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 29 Jul 2020 20:00: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 1k0sFz-0000ku-0X; Wed, 29 Jul 2020 20:00:55 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=BDG6=BI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0sFx-0000kk-FY
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:00:53 +0000
X-Inumbo-ID: 34bfdb64-d1d6-11ea-aa54-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 34bfdb64-d1d6-11ea-aa54-12813bfff9fa;
 Wed, 29 Jul 2020 20:00:52 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=d7pClgAuQ/mdoduGz4Yfo0wNyNivywt9Hxkc3sPiFJ8=; b=VgUlW0KgcNq5N6ytYgplfMVjHq
 f2qKlzAgY5qL1/WL5KCei4YKT1pcJk3vGrXims92beOL7wHc6kyu5yZUdZamPjzc9XvaBDVJTjNlF
 BVTgdDrIuwXbRYjt46iOtsbY6k1XewuILrfW/wvN+LWV9dw4ks7V0ep95+QXSqre1PbU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0sFw-0000pp-Iw
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0sFw-0001Pb-Gv
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:00:52 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/hvm: fix ISA IRQ 0 handling when set as lowest
 priority mode in IO APIC
Message-Id: <E1k0sFw-0001Pb-Gv@xenbits.xenproject.org>
Date: Wed, 29 Jul 2020 20:00:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit dc036ab9d506b997777c7656d9e6e4fa32bc582e
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Jul 27 19:05:37 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jul 28 19:33:28 2020 +0100

    x86/hvm: fix ISA IRQ 0 handling when set as lowest priority mode in IO APIC
    
    Lowest priority destination mode does allow the vIO APIC code to
    select a vCPU to inject the interrupt to, but the selected vCPU must
    be part of the possible destinations configured for such IO APIC pin.
    
    Fix the code in order to only force vCPU 0 if it's part of the
    listed destinations.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/vioapic.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index 123191db75..67d4a6237f 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -415,12 +415,14 @@ static void vioapic_deliver(struct hvm_vioapic *vioapic, unsigned int pin)
     case dest_LowestPrio:
     {
 #ifdef IRQ0_SPECIAL_ROUTING
-        /* Force round-robin to pick VCPU 0 */
-        if ( (irq == hvm_isa_irq_to_gsi(0)) && pt_active(&d->arch.vpit.pt0) )
-        {
-            v = d->vcpu ? d->vcpu[0] : NULL;
-            target = v ? vcpu_vlapic(v) : NULL;
-        }
+        struct vlapic *lapic0 = vcpu_vlapic(d->vcpu[0]);
+
+        /* Force to pick vCPU 0 if part of the destination list */
+        if ( (irq == hvm_isa_irq_to_gsi(0)) && pt_active(&d->arch.vpit.pt0) &&
+             vlapic_match_dest(lapic0, NULL, 0, dest, dest_mode) &&
+             /* Mimic the vlapic_enabled check found in vlapic_lowest_prio. */
+             vlapic_enabled(lapic0) )
+            target = lapic0;
         else
 #endif
             target = vlapic_lowest_prio(d, NULL, 0, dest, dest_mode);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 29 20:01:05 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 29 Jul 2020 20:01: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 1k0sG9-0000mi-2F; Wed, 29 Jul 2020 20:01:05 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=BDG6=BI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0sG7-0000m7-RW
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:01:03 +0000
X-Inumbo-ID: 3abb9cf7-d1d6-11ea-aa54-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 3abb9cf7-d1d6-11ea-aa54-12813bfff9fa;
 Wed, 29 Jul 2020 20:01:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=wc3SkAuAZ5lwIf90GW4kr/a0eRVboQjPCxDgkTX/Ejc=; b=wdRjkzMGP9Ie/Bl8jIMWvvvEWo
 r+pH0cvRWwL8dbCJq6uedSQHyTMp8e+T2gPtOvjbXrkcIozkelauLNDAP0Vq19e+9VL6b9A1WSiQz
 zgTcdQfMxFsQ+kVjvmMFLzzVibaal7T6mbDtw7K+leofzwsjrGYcpdAzArWhHwLBkXZ0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0sG6-0000qE-Lq
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:01:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0sG6-0001QU-L1
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:01:02 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/vpt: only try to resume timers belonging to enabled
 devices
Message-Id: <E1k0sG6-0001QU-L1@xenbits.xenproject.org>
Date: Wed, 29 Jul 2020 20:01:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit b9e9ccbb11e4c54b498d3a08e48347c3cad72944
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Jul 27 19:05:38 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jul 28 19:33:28 2020 +0100

    x86/vpt: only try to resume timers belonging to enabled devices
    
    Check whether the emulated device is actually enabled before trying to
    resume the associated timers.
    
    Thankfully all those structures are zeroed at initialization, and
    since the devices are not enabled they are never populated, which
    triggers the pt->vcpu check at the beginning of pt_resume forcing an
    exit from the function.
    
    While there limit the scope of i and make it unsigned.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vpt.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 47f2c2aa64..62c87867c5 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -636,14 +636,19 @@ static void pt_resume(struct periodic_time *pt)
 
 void pt_may_unmask_irq(struct domain *d, struct periodic_time *vlapic_pt)
 {
-    int i;
-
     if ( d )
     {
-        pt_resume(&d->arch.vpit.pt0);
-        pt_resume(&d->arch.hvm.pl_time->vrtc.pt);
-        for ( i = 0; i < HPET_TIMER_NUM; i++ )
-            pt_resume(&d->arch.hvm.pl_time->vhpet.pt[i]);
+        if ( has_vpit(d) )
+            pt_resume(&d->arch.vpit.pt0);
+        if ( has_vrtc(d) )
+            pt_resume(&d->arch.hvm.pl_time->vrtc.pt);
+        if ( has_vhpet(d) )
+        {
+            unsigned int i;
+
+            for ( i = 0; i < HPET_TIMER_NUM; i++ )
+                pt_resume(&d->arch.hvm.pl_time->vhpet.pt[i]);
+        }
     }
 
     if ( vlapic_pt )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 29 20:01:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 29 Jul 2020 20:01: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 1k0sGJ-0000nk-3p; Wed, 29 Jul 2020 20:01:15 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=BDG6=BI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0sGH-0000nW-KA
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:01:13 +0000
X-Inumbo-ID: 40ca2388-d1d6-11ea-8cd8-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 40ca2388-d1d6-11ea-8cd8-bc764e2007e4;
 Wed, 29 Jul 2020 20:01:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=7fcS/mRmR6xlMkdNuXNr/6M+BBRXhaYMfZ7iA2Q/KZA=; b=HCt70TOh7BvvBy1+YxX5p32Ft/
 sR2cbQUUEVrhzxCMveNTHqnCzVDJRUk3ppNWGthQ+eXX7VXsDArUQh3UV7CZ/XmdLE884mdO0jppr
 P+xp/lxZlcKOiCkBLvBp6DCBEuk+Z4sKDfd7N60K5Wwv6kQdKGDTrI8/l2cbc2h7Kna0=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0sGG-0000qX-Oj
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:01:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0sGG-0001RE-Ns
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:01:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/hvm: only translate ISA interrupts to GSIs in
 virtual timers
Message-Id: <E1k0sGG-0001RE-Ns@xenbits.xenproject.org>
Date: Wed, 29 Jul 2020 20:01:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit b6641f28c5932793da2877ed8b9dac4aea6305ce
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Jul 27 19:05:39 2020 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jul 28 19:33:28 2020 +0100

    x86/hvm: only translate ISA interrupts to GSIs in virtual timers
    
    Only call hvm_isa_irq_to_gsi for ISA interrupts, interrupts
    originating from an IO APIC pin already use a GSI and don't need to be
    translated.
    
    I haven't observed any issues from this, but I think it's better to
    use it correctly.
    
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vpt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 62c87867c5..c68bbd1558 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -86,13 +86,13 @@ static int pt_irq_vector(struct periodic_time *pt, enum hvm_intsrc src)
         return pt->irq;
 
     isa_irq = pt->irq;
-    gsi = hvm_isa_irq_to_gsi(isa_irq);
 
     if ( src == hvm_intsrc_pic )
         return (v->domain->arch.hvm.vpic[isa_irq >> 3].irq_base
                 + (isa_irq & 7));
 
     ASSERT(src == hvm_intsrc_lapic);
+    gsi = pt->source == PTSRC_isa ? hvm_isa_irq_to_gsi(isa_irq) : pt->irq;
     vector = vioapic_get_vector(v->domain, gsi);
     if ( vector < 0 )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Jul 29 20:01:25 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 29 Jul 2020 20:01: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 1k0sGT-0000pZ-5Z; Wed, 29 Jul 2020 20:01:25 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=BDG6=BI=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k0sGS-0000pN-1D
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:01:24 +0000
X-Inumbo-ID: 45ae8fb2-d1d6-11ea-8cd8-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 45ae8fb2-d1d6-11ea-8cd8-bc764e2007e4;
 Wed, 29 Jul 2020 20:01:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=9aQE48uA6rMysypbRgs0VNIQELVNbA3kOx6XkdlpfEw=; b=bUb0M9RBgUbB97P0+R5dBg9kGr
 hyroMrI8imMg+mxfPOJUO74gyROAHRBCmvm0WUSPLKrPJUL7jDDzTgT9Bh8SQkkozMh8XWdsEdvQd
 EqcliTFFQzj4hq/bSXft7BcjBf3poKv6mj2SNR9tHhxg1BFliLLoBkDqRgnucu3H9lPo=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0sGQ-0000rR-SS
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:01:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k0sGQ-0001S4-Qv
 for xen-changelog@lists.xenproject.org; Wed, 29 Jul 2020 20:01:22 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/hvm: Clean up track_dirty_vram() calltree
Message-Id: <E1k0sGQ-0001S4-Qv@xenbits.xenproject.org>
Date: Wed, 29 Jul 2020 20:01:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit b071ec25e85c4aacf3da59e5258cda0b1c4df45d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jul 20 17:22:25 2018 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Jul 28 19:33:28 2020 +0100

    x86/hvm: Clean up track_dirty_vram() calltree
    
     * Rename nr to nr_frames.  A plain 'nr' is confusing to follow in the the
       lower levels.
     * Use DIV_ROUND_UP() rather than opencoding it in several different ways
     * The hypercall input is capped at uint32_t, so there is no need for
       nr_frames to be unsigned long in the lower levels.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/hvm/dm.c        | 13 +++++++------
 xen/arch/x86/mm/hap/hap.c    | 21 +++++++++++----------
 xen/arch/x86/mm/shadow/hvm.c | 16 ++++++++--------
 xen/include/asm-x86/hap.h    |  2 +-
 xen/include/asm-x86/shadow.h |  2 +-
 5 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
index e3f845165d..9930d68860 100644
--- a/xen/arch/x86/hvm/dm.c
+++ b/xen/arch/x86/hvm/dm.c
@@ -62,9 +62,10 @@ static bool _raw_copy_from_guest_buf_offset(void *dst,
                                     sizeof(dst))
 
 static int track_dirty_vram(struct domain *d, xen_pfn_t first_pfn,
-                            unsigned int nr, const struct xen_dm_op_buf *buf)
+                            unsigned int nr_frames,
+                            const struct xen_dm_op_buf *buf)
 {
-    if ( nr > (GB(1) >> PAGE_SHIFT) )
+    if ( nr_frames > (GB(1) >> PAGE_SHIFT) )
         return -EINVAL;
 
     if ( d->is_dying )
@@ -73,12 +74,12 @@ static int track_dirty_vram(struct domain *d, xen_pfn_t first_pfn,
     if ( !d->max_vcpus || !d->vcpu[0] )
         return -EINVAL;
 
-    if ( ((nr + 7) / 8) > buf->size )
+    if ( DIV_ROUND_UP(nr_frames, BITS_PER_BYTE) > buf->size )
         return -EINVAL;
 
-    return shadow_mode_enabled(d) ?
-        shadow_track_dirty_vram(d, first_pfn, nr, buf->h) :
-        hap_track_dirty_vram(d, first_pfn, nr, buf->h);
+    return shadow_mode_enabled(d)
+        ? shadow_track_dirty_vram(d, first_pfn, nr_frames, buf->h)
+        :    hap_track_dirty_vram(d, first_pfn, nr_frames, buf->h);
 }
 
 static int set_pci_intx_level(struct domain *d, uint16_t domain,
diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index 7f84d0c6ea..4eedd1a995 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -58,16 +58,16 @@
 
 int hap_track_dirty_vram(struct domain *d,
                          unsigned long begin_pfn,
-                         unsigned long nr,
+                         unsigned int nr_frames,
                          XEN_GUEST_HANDLE(void) guest_dirty_bitmap)
 {
     long rc = 0;
     struct sh_dirty_vram *dirty_vram;
     uint8_t *dirty_bitmap = NULL;
 
-    if ( nr )
+    if ( nr_frames )
     {
-        int size = (nr + BITS_PER_BYTE - 1) / BITS_PER_BYTE;
+        unsigned int size = DIV_ROUND_UP(nr_frames, BITS_PER_BYTE);
 
         if ( !paging_mode_log_dirty(d) )
         {
@@ -97,13 +97,13 @@ int hap_track_dirty_vram(struct domain *d,
         }
 
         if ( begin_pfn != dirty_vram->begin_pfn ||
-             begin_pfn + nr != dirty_vram->end_pfn )
+             begin_pfn + nr_frames != dirty_vram->end_pfn )
         {
             unsigned long ostart = dirty_vram->begin_pfn;
             unsigned long oend = dirty_vram->end_pfn;
 
             dirty_vram->begin_pfn = begin_pfn;
-            dirty_vram->end_pfn = begin_pfn + nr;
+            dirty_vram->end_pfn = begin_pfn + nr_frames;
 
             paging_unlock(d);
 
@@ -115,7 +115,7 @@ int hap_track_dirty_vram(struct domain *d,
              * Switch vram to log dirty mode, either by setting l1e entries of
              * P2M table to be read-only, or via hardware-assisted log-dirty.
              */
-            p2m_change_type_range(d, begin_pfn, begin_pfn + nr,
+            p2m_change_type_range(d, begin_pfn, begin_pfn + nr_frames,
                                   p2m_ram_rw, p2m_ram_logdirty);
 
             guest_flush_tlb_mask(d, d->dirty_cpumask);
@@ -132,7 +132,7 @@ int hap_track_dirty_vram(struct domain *d,
             p2m_flush_hardware_cached_dirty(d);
 
             /* get the bitmap */
-            paging_log_dirty_range(d, begin_pfn, nr, dirty_bitmap);
+            paging_log_dirty_range(d, begin_pfn, nr_frames, dirty_bitmap);
 
             domain_unpause(d);
         }
@@ -153,14 +153,15 @@ int hap_track_dirty_vram(struct domain *d,
              * then stop tracking
              */
             begin_pfn = dirty_vram->begin_pfn;
-            nr = dirty_vram->end_pfn - dirty_vram->begin_pfn;
+            nr_frames = dirty_vram->end_pfn - dirty_vram->begin_pfn;
             xfree(dirty_vram);
             d->arch.hvm.dirty_vram = NULL;
         }
 
         paging_unlock(d);
-        if ( nr )
-            p2m_change_type_range(d, begin_pfn, begin_pfn + nr,
+
+        if ( nr_frames )
+            p2m_change_type_range(d, begin_pfn, begin_pfn + nr_frames,
                                   p2m_ram_logdirty, p2m_ram_rw);
     }
 out:
diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index c5da7a071c..b832272c10 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -695,12 +695,12 @@ static void sh_emulate_unmap_dest(struct vcpu *v, void *addr,
 /* VRAM dirty tracking support */
 int shadow_track_dirty_vram(struct domain *d,
                             unsigned long begin_pfn,
-                            unsigned long nr,
+                            unsigned int nr_frames,
                             XEN_GUEST_HANDLE(void) guest_dirty_bitmap)
 {
     int rc = 0;
-    unsigned long end_pfn = begin_pfn + nr;
-    unsigned long dirty_size = (nr + 7) / 8;
+    unsigned long end_pfn = begin_pfn + nr_frames;
+    unsigned int dirty_size = DIV_ROUND_UP(nr_frames, BITS_PER_BYTE);
     int flush_tlb = 0;
     unsigned long i;
     p2m_type_t t;
@@ -717,7 +717,7 @@ int shadow_track_dirty_vram(struct domain *d,
 
     dirty_vram = d->arch.hvm.dirty_vram;
 
-    if ( dirty_vram && (!nr ||
+    if ( dirty_vram && (!nr_frames ||
              ( begin_pfn != dirty_vram->begin_pfn
             || end_pfn   != dirty_vram->end_pfn )) )
     {
@@ -729,7 +729,7 @@ int shadow_track_dirty_vram(struct domain *d,
         dirty_vram = d->arch.hvm.dirty_vram = NULL;
     }
 
-    if ( !nr )
+    if ( !nr_frames )
         goto out;
 
     dirty_bitmap = vzalloc(dirty_size);
@@ -759,9 +759,9 @@ int shadow_track_dirty_vram(struct domain *d,
         dirty_vram->end_pfn = end_pfn;
         d->arch.hvm.dirty_vram = dirty_vram;
 
-        if ( (dirty_vram->sl1ma = xmalloc_array(paddr_t, nr)) == NULL )
+        if ( (dirty_vram->sl1ma = xmalloc_array(paddr_t, nr_frames)) == NULL )
             goto out_dirty_vram;
-        memset(dirty_vram->sl1ma, ~0, sizeof(paddr_t) * nr);
+        memset(dirty_vram->sl1ma, ~0, sizeof(paddr_t) * nr_frames);
 
         if ( (dirty_vram->dirty_bitmap = xzalloc_array(uint8_t, dirty_size)) == NULL )
             goto out_sl1ma;
@@ -780,7 +780,7 @@ int shadow_track_dirty_vram(struct domain *d,
         void *map_sl1p = NULL;
 
         /* Iterate over VRAM to track dirty bits. */
-        for ( i = 0; i < nr; i++ )
+        for ( i = 0; i < nr_frames; i++ )
         {
             mfn_t mfn = get_gfn_query_unlocked(d, begin_pfn + i, &t);
             struct page_info *page;
diff --git a/xen/include/asm-x86/hap.h b/xen/include/asm-x86/hap.h
index faf856913a..d489df3812 100644
--- a/xen/include/asm-x86/hap.h
+++ b/xen/include/asm-x86/hap.h
@@ -40,7 +40,7 @@ void  hap_teardown(struct domain *d, bool *preempted);
 void  hap_vcpu_init(struct vcpu *v);
 int   hap_track_dirty_vram(struct domain *d,
                            unsigned long begin_pfn,
-                           unsigned long nr,
+                           unsigned int nr_frames,
                            XEN_GUEST_HANDLE(void) dirty_bitmap);
 
 extern const struct paging_mode *hap_paging_get_mode(struct vcpu *);
diff --git a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h
index 224d1bc2f9..76e47f257f 100644
--- a/xen/include/asm-x86/shadow.h
+++ b/xen/include/asm-x86/shadow.h
@@ -64,7 +64,7 @@ int shadow_enable(struct domain *d, u32 mode);
 /* Enable VRAM dirty bit tracking. */
 int shadow_track_dirty_vram(struct domain *d,
                             unsigned long first_pfn,
-                            unsigned long nr,
+                            unsigned int nr_frames,
                             XEN_GUEST_HANDLE(void) dirty_bitmap);
 
 /* Handler for shadow control ops: operations from user-space to enable
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Jul 30 18:33:09 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 30 Jul 2020 18:33: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 1k1DMY-0005T9-QQ; Thu, 30 Jul 2020 18:33:06 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=PPqE=BJ=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k1DMY-0005T4-0h
 for xen-changelog@lists.xenproject.org; Thu, 30 Jul 2020 18:33:06 +0000
X-Inumbo-ID: 1b2b8d98-d293-11ea-ab07-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 1b2b8d98-d293-11ea-ab07-12813bfff9fa;
 Thu, 30 Jul 2020 18:33:04 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=GWCSSX+1/tVnCXvj63PjuFz8KmRAWflDZ7b36eKB7uI=; b=GlgZZT2LdCYh0C08u7v9nKlJkV
 IG1+qwh4QTxLlmMxe35aGqnQSRP5OXi08ooQCV1C/Ghgefzbfk70iCoFji4uJXd0YtdbKlUWQ1kgB
 QtNAfKSuK+kfrNdbswijZmTopR3B5dHg6fyyYX7CU6571+F/ukMouTDj54lbdlcQ5RNc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k1DMW-00089Q-Hd
 for xen-changelog@lists.xenproject.org; Thu, 30 Jul 2020 18:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k1DMW-0007Yq-H1
 for xen-changelog@lists.xenproject.org; Thu, 30 Jul 2020 18:33:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] xen/spinlock: move debug helpers inside the locked
 regions
Message-Id: <E1k1DMW-0007Yq-H1@xenbits.xenproject.org>
Date: Thu, 30 Jul 2020 18:33:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 98bed5de1de3352c63cfe29a00f17e8d9ce72689
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Jul 29 13:13:30 2020 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jul 30 19:27:08 2020 +0100

    xen/spinlock: move debug helpers inside the locked regions
    
    Debug helpers such as lock profiling or the invariant pCPU assertions
    must strictly be performed inside the exclusive locked region, or else
    races might happen.
    
    Note the issue was not strictly introduced by the pointed commit in
    the Fixes tag, since lock stats where already incremented before the
    barrier, but that commit made it more apparent as manipulating the cpu
    field could happen outside of the locked regions and thus trigger the
    BUG_ON on rel_lock(). This is only enabled on debug builds, and thus
    releases are not affected.
    
    Fixes: 80cba391a35 ('spinlocks: in debug builds store cpu holding the lock')
    Reported-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/spinlock.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index 17f4519fc7..ce3106e2d3 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -170,9 +170,9 @@ void inline _spin_lock_cb(spinlock_t *lock, void (*cb)(void *), void *data)
             cb(data);
         arch_lock_relax();
     }
+    arch_lock_acquire_barrier();
     got_lock(&lock->debug);
     LOCK_PROFILE_GOT;
-    arch_lock_acquire_barrier();
 }
 
 void _spin_lock(spinlock_t *lock)
@@ -198,9 +198,9 @@ unsigned long _spin_lock_irqsave(spinlock_t *lock)
 
 void _spin_unlock(spinlock_t *lock)
 {
-    arch_lock_release_barrier();
     LOCK_PROFILE_REL;
     rel_lock(&lock->debug);
+    arch_lock_release_barrier();
     add_sized(&lock->tickets.head, 1);
     arch_lock_signal();
     preempt_enable();
@@ -249,15 +249,15 @@ int _spin_trylock(spinlock_t *lock)
         preempt_enable();
         return 0;
     }
+    /*
+     * cmpxchg() is a full barrier so no need for an
+     * arch_lock_acquire_barrier().
+     */
     got_lock(&lock->debug);
 #ifdef CONFIG_DEBUG_LOCK_PROFILE
     if (lock->profile)
         lock->profile->time_locked = NOW();
 #endif
-    /*
-     * cmpxchg() is a full barrier so no need for an
-     * arch_lock_acquire_barrier().
-     */
     return 1;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jul 31 12:11:10 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 31 Jul 2020 12:11: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 1k1TsO-00042e-R1; Fri, 31 Jul 2020 12:11:04 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=hW1S=BK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k1TsN-00042V-CY
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 12:11:03 +0000
X-Inumbo-ID: e6b6d4f2-d326-11ea-8e2c-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id e6b6d4f2-d326-11ea-8e2c-bc764e2007e4;
 Fri, 31 Jul 2020 12:11:02 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=e5vsVZuZkra8ftVy9lOq8zCvrElbCx5XTACv7L1hM7A=; b=QtT7XYEWRauGvlsjZpEtSfeh2e
 3wU28tLif2Hq2SCHMidVYI4t/PYW5whcdeozwymsuuVr74eK3ety5Hb2wt3ruBnBPsG0OW94xv92+
 wveOpPTqPz03/s38NjRrwWYJAp/JEDTKuGgm1GkSix3XCSORN19pWrhfvS+ILRAdbRs8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k1TsL-0000W1-VL
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 12:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k1TsL-0005Ou-TS
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 12:11:01 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] x86/cpuid: Fix APIC bit clearing
Message-Id: <E1k1TsL-0005Ou-TS@xenbits.xenproject.org>
Date: Fri, 31 Jul 2020 12:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 64219fa179c3e48adad12bfce3f6b3f1596cccbf
Author:     Fam Zheng <famzheng@amazon.com>
AuthorDate: Wed Jul 29 18:51:45 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jul 29 19:03:41 2020 +0100

    x86/cpuid: Fix APIC bit clearing
    
    The bug is obvious here, other places in this function used
    "cpufeat_mask" correctly.
    
    Fixed: b648feff8ea2 ("xen/x86: Improvements to in-hypervisor cpuid sanity checks")
    Signed-off-by: Fam Zheng <famzheng@amazon.com>
    Reviewed-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpuid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 6a4a787b68..63a03ef1e5 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -1057,7 +1057,7 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
         {
             /* Fast-forward MSR_APIC_BASE.EN. */
             if ( vlapic_hw_disabled(vcpu_vlapic(v)) )
-                res->d &= ~cpufeat_bit(X86_FEATURE_APIC);
+                res->d &= ~cpufeat_mask(X86_FEATURE_APIC);
 
             /*
              * PSE36 is not supported in shadow mode.  This bit should be
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jul 31 12:11:14 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 31 Jul 2020 12:11: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 1k1TsY-00043P-Sm; Fri, 31 Jul 2020 12:11:14 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=hW1S=BK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k1TsX-00043E-He
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 12:11:13 +0000
X-Inumbo-ID: ecb0b95e-d326-11ea-aba9-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id ecb0b95e-d326-11ea-aba9-12813bfff9fa;
 Fri, 31 Jul 2020 12:11:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=gJ+LdBxBrhXJpQG6aF4fKJZvZcC/Q718N7dUjFsHocI=; b=ZAMkiHbm6EdpM2uEF5nGSTbkFI
 ogGqf2gg7qisJBO0HvXpA1ud5QbVEr5FyvOB0q/Gp7DwdpMJFbfbKmLsgV5677GDXbntE5EDpK5dH
 Iey5X1juUjp+gdxKMykXtphkw8WSpe6FXq/LiFK6ZurUnqYtdmB3K2nB6VNAuBpzTJIc=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k1TsW-0000WC-2h
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 12:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k1TsW-0005Po-18
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 12:11:12 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen master] xen/spinlock: move debug helpers inside the locked
 regions
Message-Id: <E1k1TsW-0005Po-18@xenbits.xenproject.org>
Date: Fri, 31 Jul 2020 12:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 98bed5de1de3352c63cfe29a00f17e8d9ce72689
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Jul 29 13:13:30 2020 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Jul 30 19:27:08 2020 +0100

    xen/spinlock: move debug helpers inside the locked regions
    
    Debug helpers such as lock profiling or the invariant pCPU assertions
    must strictly be performed inside the exclusive locked region, or else
    races might happen.
    
    Note the issue was not strictly introduced by the pointed commit in
    the Fixes tag, since lock stats where already incremented before the
    barrier, but that commit made it more apparent as manipulating the cpu
    field could happen outside of the locked regions and thus trigger the
    BUG_ON on rel_lock(). This is only enabled on debug builds, and thus
    releases are not affected.
    
    Fixes: 80cba391a35 ('spinlocks: in debug builds store cpu holding the lock')
    Reported-by: Igor Druzhinin <igor.druzhinin@citrix.com>
    Signed-off-by: Roger Pau MonnÃ© <roger.pau@citrix.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/spinlock.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index 17f4519fc7..ce3106e2d3 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -170,9 +170,9 @@ void inline _spin_lock_cb(spinlock_t *lock, void (*cb)(void *), void *data)
             cb(data);
         arch_lock_relax();
     }
+    arch_lock_acquire_barrier();
     got_lock(&lock->debug);
     LOCK_PROFILE_GOT;
-    arch_lock_acquire_barrier();
 }
 
 void _spin_lock(spinlock_t *lock)
@@ -198,9 +198,9 @@ unsigned long _spin_lock_irqsave(spinlock_t *lock)
 
 void _spin_unlock(spinlock_t *lock)
 {
-    arch_lock_release_barrier();
     LOCK_PROFILE_REL;
     rel_lock(&lock->debug);
+    arch_lock_release_barrier();
     add_sized(&lock->tickets.head, 1);
     arch_lock_signal();
     preempt_enable();
@@ -249,15 +249,15 @@ int _spin_trylock(spinlock_t *lock)
         preempt_enable();
         return 0;
     }
+    /*
+     * cmpxchg() is a full barrier so no need for an
+     * arch_lock_acquire_barrier().
+     */
     got_lock(&lock->debug);
 #ifdef CONFIG_DEBUG_LOCK_PROFILE
     if (lock->profile)
         lock->profile->time_locked = NOW();
 #endif
-    /*
-     * cmpxchg() is a full barrier so no need for an
-     * arch_lock_acquire_barrier().
-     */
     return 1;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Jul 31 14:22:15 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 31 Jul 2020 14: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 1k1VvI-0003tn-2l; Fri, 31 Jul 2020 14:22:12 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=hW1S=BK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k1VvG-0003td-Bv
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 14:22:10 +0000
X-Inumbo-ID: 35675696-d339-11ea-abc2-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 35675696-d339-11ea-abc2-12813bfff9fa;
 Fri, 31 Jul 2020 14:22:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=LERipkpFAZMF6uguvGGnXASDFE71Xg2hsfv8iNIjpKk=; b=GCMOfkbhjM7IpykvJQlyqC+cKO
 uSBjM0R/rAT1TDE5wUyDhnZkxFCr8mzCmSc80F1NhuAFTk5B11XUyw/NQtfr1Wf/5ctIJS9V+3QK3
 OGN0hFNIhXjbA4sjw6mKGjRDcfuxtWDMF7YpczO0vqhZ1zfD09vhUD2qHzwgHmxoLPb8=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k1VvA-0003Vv-VT
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 14:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k1VvA-0005gU-TY
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 14:22:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools/configure: drop BASH configure variable
Message-Id: <E1k1VvA-0005gU-TY@xenbits.xenproject.org>
Date: Fri, 31 Jul 2020 14:22:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit a85f67b2658ed8032586b3a3e7cd78814d20aa4b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jun 26 17:46:38 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jul 31 15:18:41 2020 +0100

    tools/configure: drop BASH configure variable
    
    This is a weird variable to have in the first place.  The only user of it is
    XSM's CONFIG_SHELL, which opencodes a fallback to sh.  The scripts are shebang
    sh, which is already necessary to support non-Linux build environments.
    
    Make the mkflask.sh and mkaccess_vector.sh scripts executable, drop the
    CONFIG_SHELL, and drop the $BASH variable to prevent further use.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 config/Tools.mk.in                      | 1 -
 tools/configure                         | 5 +----
 tools/configure.ac                      | 1 -
 xen/xsm/flask/Makefile                  | 8 ++------
 xen/xsm/flask/policy/mkaccess_vector.sh | 0
 xen/xsm/flask/policy/mkflask.sh         | 0
 6 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/config/Tools.mk.in b/config/Tools.mk.in
index 23df47af8d..48bd9ab731 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@
-BASH                := @BASH@
 XGETTTEXT           := @XGETTEXT@
 AS86                := @AS86@
 LD86                := @LD86@
diff --git a/tools/configure b/tools/configure
index dd9fb8fb6a..edcdcf4f73 100755
--- a/tools/configure
+++ b/tools/configure
@@ -662,6 +662,7 @@ GREP
 CPP
 pyconfig
 PYTHONPATH
+BASH
 CHECKPOLICY
 XENSTORED
 GO
@@ -686,7 +687,6 @@ SET_MAKE
 AWK
 IASL
 XGETTEXT
-BASH
 FLEX
 BISON
 PERL
@@ -843,7 +843,6 @@ PYTHON
 PERL
 BISON
 FLEX
-BASH
 XGETTEXT
 AS86
 LD86
@@ -1589,7 +1588,6 @@ Some influential environment variables:
   PERL        Path to Perl parser
   BISON       Path to Bison parser generator
   FLEX        Path to Flex lexical analyser generator
-  BASH        Path to bash shell
   XGETTEXT    Path to xgetttext tool
   AS86        Path to as86 tool
   LD86        Path to ld86 tool
@@ -4718,7 +4716,6 @@ LDFLAGS="$PREPEND_LDFLAGS $LDFLAGS $APPEND_LDFLAGS"
 
 
 
-
 # Checks for programs.
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
diff --git a/tools/configure.ac b/tools/configure.ac
index 9d126b7a14..6614a4f130 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -297,7 +297,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([BASH], [Path to bash shell])
 AC_ARG_VAR([XGETTEXT], [Path to xgetttext tool])
 AC_ARG_VAR([AS86], [Path to as86 tool])
 AC_ARG_VAR([LD86], [Path to ld86 tool])
diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile
index 07f36d075d..50bec20a1e 100644
--- a/xen/xsm/flask/Makefile
+++ b/xen/xsm/flask/Makefile
@@ -8,10 +8,6 @@ CFLAGS-y += -I./include
 
 AWK = awk
 
-CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
-          else if [ -x /bin/bash ]; then echo /bin/bash; \
-          else echo sh; fi ; fi)
-
 FLASK_H_DEPEND = policy/security_classes policy/initial_sids
 AV_H_DEPEND = policy/access_vectors
 
@@ -24,14 +20,14 @@ extra-y += $(ALL_H_FILES)
 
 mkflask := policy/mkflask.sh
 quiet_cmd_mkflask = MKFLASK $@
-cmd_mkflask = $(CONFIG_SHELL) $(mkflask) $(AWK) include $(FLASK_H_DEPEND)
+cmd_mkflask = $(SHELL) $(mkflask) $(AWK) include $(FLASK_H_DEPEND)
 
 $(subst include/,%/,$(FLASK_H_FILES)): $(FLASK_H_DEPEND) $(mkflask) FORCE
 	$(call if_changed,mkflask)
 
 mkaccess := policy/mkaccess_vector.sh
 quiet_cmd_mkaccess = MKACCESS VECTOR $@
-cmd_mkaccess = $(CONFIG_SHELL) $(mkaccess) $(AWK) $(AV_H_DEPEND)
+cmd_mkaccess = $(SHELL) $(mkaccess) $(AWK) $(AV_H_DEPEND)
 
 $(subst include/,%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE
 	$(call if_changed,mkaccess)
diff --git a/xen/xsm/flask/policy/mkaccess_vector.sh b/xen/xsm/flask/policy/mkaccess_vector.sh
old mode 100644
new mode 100755
diff --git a/xen/xsm/flask/policy/mkflask.sh b/xen/xsm/flask/policy/mkflask.sh
old mode 100644
new mode 100755
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jul 31 15:44:11 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 31 Jul 2020 15: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 1k1XCZ-00045T-Ut; Fri, 31 Jul 2020 15:44:07 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=hW1S=BK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k1XCY-00045F-2G
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 15:44:06 +0000
X-Inumbo-ID: a9e438e4-d344-11ea-abdc-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id a9e438e4-d344-11ea-abdc-12813bfff9fa;
 Fri, 31 Jul 2020 15:44:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=gaescUR1DEzKp/T4+pzbxCPYgKT4h935FiLFdm9PosU=; b=Fmx79/GroOzXjRpmd3vwKr23I3
 QRUvZhD46UIe/1dVfIoNhLRMRdM6TjwwPvCzr1lzaUjafOmLRh6I+pZM0Irz/GtooDZGAe4wkEI4R
 gnThb1GJtjMDdJ/QVyBHEwdwCwLpOV/uj0FYcJxj3WkSPkyj2deaZOvjKa+amkEVz8Fs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k1XCW-0005Gx-Rl
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 15:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k1XCW-0003VI-P9
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 15:44:04 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/PV: drop a few misleading paging_mode_refcounts()
 checks
Message-Id: <E1k1XCW-0003VI-P9@xenbits.xenproject.org>
Date: Fri, 31 Jul 2020 15:44:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit cb79dc100fae7295009118ae10efe7822d5be2af
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 31 17:40:13 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 31 17:40:13 2020 +0200

    x86/PV: drop a few misleading paging_mode_refcounts() checks
    
    The filling and cleaning up of v->arch.guest_table in new_guest_cr3()
    was apparently inconsistent so far: There was a type ref acquired
    unconditionally for the new top level page table, but the dropping of
    the old type ref was conditional upon !paging_mode_refcounts(). Mirror
    this also to arch_set_info_guest().
    
    Also move new_guest_cr3()'s #ifdef to around the function - both callers
    now get built only when CONFIG_PV, i.e. no need to retain a stub.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Tim Deegan <tim@xen.org>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/domain.c |  7 ++-----
 xen/arch/x86/mm.c     | 38 ++++++++++++++++----------------------
 2 files changed, 18 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index fee6c3931a..f8084dc9e3 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1122,8 +1122,6 @@ int arch_set_info_guest(
 
     if ( !cr3_page )
         rc = -EINVAL;
-    else if ( paging_mode_refcounts(d) )
-        /* nothing */;
     else if ( cr3_page == v->arch.old_guest_table )
     {
         v->arch.old_guest_table = NULL;
@@ -1144,8 +1142,7 @@ int arch_set_info_guest(
         case -ERESTART:
             break;
         case 0:
-            if ( !compat && !VM_ASSIST(d, m2p_strict) &&
-                 !paging_mode_refcounts(d) )
+            if ( !compat && !VM_ASSIST(d, m2p_strict) )
                 fill_ro_mpt(cr3_mfn);
             break;
         default:
@@ -1166,7 +1163,7 @@ int arch_set_info_guest(
 
             if ( !cr3_page )
                 rc = -EINVAL;
-            else if ( !paging_mode_refcounts(d) )
+            else
             {
                 rc = get_page_type_preemptible(cr3_page, PGT_root_page_table);
                 switch ( rc )
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 82bc676553..638f6bf580 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -3149,9 +3149,9 @@ int vcpu_destroy_pagetables(struct vcpu *v)
     return rc;
 }
 
+#ifdef CONFIG_PV
 int new_guest_cr3(mfn_t mfn)
 {
-#ifdef CONFIG_PV
     struct vcpu *curr = current;
     struct domain *d = curr->domain;
     int rc;
@@ -3220,7 +3220,7 @@ int new_guest_cr3(mfn_t mfn)
 
     pv_destroy_ldt(curr); /* Unconditional TLB flush later. */
 
-    if ( !VM_ASSIST(d, m2p_strict) && !paging_mode_refcounts(d) )
+    if ( !VM_ASSIST(d, m2p_strict) )
         fill_ro_mpt(mfn);
     curr->arch.guest_table = pagetable_from_mfn(mfn);
     update_cr3(curr);
@@ -3231,30 +3231,24 @@ int new_guest_cr3(mfn_t mfn)
     {
         struct page_info *page = mfn_to_page(old_base_mfn);
 
-        if ( paging_mode_refcounts(d) )
-            put_page(page);
-        else
-            switch ( rc = put_page_and_type_preemptible(page) )
-            {
-            case -EINTR:
-            case -ERESTART:
-                curr->arch.old_guest_ptpg = NULL;
-                curr->arch.old_guest_table = page;
-                curr->arch.old_guest_table_partial = (rc == -ERESTART);
-                rc = -ERESTART;
-                break;
-            default:
-                BUG_ON(rc);
-                break;
-            }
+        switch ( rc = put_page_and_type_preemptible(page) )
+        {
+        case -EINTR:
+        case -ERESTART:
+            curr->arch.old_guest_ptpg = NULL;
+            curr->arch.old_guest_table = page;
+            curr->arch.old_guest_table_partial = (rc == -ERESTART);
+            rc = -ERESTART;
+            break;
+        default:
+            BUG_ON(rc);
+            break;
+        }
     }
 
     return rc;
-#else
-    ASSERT_UNREACHABLE();
-    return -EINVAL;
-#endif
 }
+#endif
 
 #ifdef CONFIG_PV
 static int vcpumask_to_pcpumask(
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jul 31 15:44:18 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 31 Jul 2020 15:44: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 1k1XCk-00046g-0E; Fri, 31 Jul 2020 15:44:18 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=hW1S=BK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k1XCh-00046U-WB
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 15:44:16 +0000
X-Inumbo-ID: afea6222-d344-11ea-abdc-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id afea6222-d344-11ea-abdc-12813bfff9fa;
 Fri, 31 Jul 2020 15:44:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=oDzWMOjHoJzqijTEeTOogLC5IbdbwyrasliKk7uhoqE=; b=eGY1AqkBsaIMW0PHa+ohTiZz3H
 cCiwQOFqsSfGi55uQkBWtt4ZA4Da23Ote/EzrMqc7Pi601e2v6IdyHOihfr5LsI6qUXRcf5VP3Mc1
 ZLHYcQUxR9YkxIXWtQceN7mezAKjDE6IOgdv8upYEw5Ume+s+IXpsbm0eKZtoZHWlQpU=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k1XCg-0005Hh-Vj
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 15:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k1XCg-0003WD-Ts
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 15:44:14 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] tools/xen-cpuid: show enqcmd
Message-Id: <E1k1XCg-0003WD-Ts@xenbits.xenproject.org>
Date: Fri, 31 Jul 2020 15:44:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 132ece59bfae2864f8888e489563bf09cd92fa44
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Fri Jul 31 17:41:27 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 31 17:41:27 2020 +0200

    tools/xen-cpuid: show enqcmd
    
    Translate <29> into a feature string.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/misc/xen-cpuid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index ac3548dcfe..2446941a47 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -133,7 +133,7 @@ static const char *const str_7c0[32] =
     [22] = "rdpid",
     /* 24 */                   [25] = "cldemote",
     /* 26 */                   [27] = "movdiri",
-    [28] = "movdir64b",
+    [28] = "movdir64b",        [29] = "enqcmd",
     [30] = "sgx-lc",
 };
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jul 31 15:44:28 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 31 Jul 2020 15:44: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 1k1XCu-000487-1u; Fri, 31 Jul 2020 15:44:28 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=hW1S=BK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k1XCs-00047o-Fh
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 15:44:26 +0000
X-Inumbo-ID: b5f02c42-d344-11ea-8e61-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b5f02c42-d344-11ea-8e61-bc764e2007e4;
 Fri, 31 Jul 2020 15:44:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=JfTH/KX8gt6RaS/xCKwbRFiElaIvhqzYr/Jl9ZyqPEc=; b=4xNm4ffqmZdzCVpFuZWmA9A1h4
 /99eUljvVOTqdfVAYnTcS4IaycQgiSGPR5Nn0KmTpS1mP4C8sams0Q57vG7+/BPvXOhOPY1Ac6lSv
 hD3+KY0/MU7T8t3ttkbDhjO3LzG2nfRCZ3KC4txJ4SnRycb7UNn10WyTx06yH/5GAwdA=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k1XCr-0005Ht-3k
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 15:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k1XCr-0003X0-24
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 15:44:25 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86emul: replace UB shifts
Message-Id: <E1k1XCr-0003X0-24@xenbits.xenproject.org>
Date: Fri, 31 Jul 2020 15:44:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit b6a907f8c83d37886d0523f1aeff61b98e133498
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jul 31 17:41:58 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 31 17:41:58 2020 +0200

    x86emul: replace UB shifts
    
    Displacement values can be negative, hence we shouldn't left-shift them.
    Or else we get
    
    (XEN) UBSAN: Undefined behaviour in x86_emulate/x86_emulate.c:3482:55
    (XEN) left shift of negative value -2
    
    While auditing shifts, I noticed a pair of missing parentheses, which
    also get added right here.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 44474a268b..b8a4a1ca82 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -3370,7 +3370,7 @@ x86_decode(
         {
             generate_exception_if(d & vSIB, EXC_UD);
             modrm_rm |= ((rex_prefix & 1) << 3) |
-                        (evex_encoded() && !evex.x) << 4;
+                        ((evex_encoded() && !evex.x) << 4);
             ea.type = OP_REG;
         }
         else if ( ad_bytes == 2 )
@@ -3417,7 +3417,7 @@ x86_decode(
                     ea.mem.off = insn_fetch_type(int16_t);
                 break;
             case 1:
-                ea.mem.off += insn_fetch_type(int8_t) << disp8scale;
+                ea.mem.off += insn_fetch_type(int8_t) * (1 << disp8scale);
                 break;
             case 2:
                 ea.mem.off += insn_fetch_type(int16_t);
@@ -3479,7 +3479,7 @@ x86_decode(
                 pc_rel = mode_64bit();
                 break;
             case 1:
-                ea.mem.off += insn_fetch_type(int8_t) << disp8scale;
+                ea.mem.off += insn_fetch_type(int8_t) * (1 << disp8scale);
                 break;
             case 2:
                 ea.mem.off += insn_fetch_type(int32_t);
@@ -10028,7 +10028,8 @@ x86_emulate(
                 continue;
 
             rc = ops->write(ea.mem.seg,
-                            truncate_ea(ea.mem.off + (idx << state->sib_scale)),
+                            truncate_ea(ea.mem.off +
+                                        idx * (1 << state->sib_scale)),
                             (void *)mmvalp + i * op_bytes, op_bytes, ctxt);
             if ( rc != X86EMUL_OKAY )
             {
@@ -10146,7 +10147,7 @@ x86_emulate(
                   ? ops->write
                   : ops->read)(ea.mem.seg,
                                truncate_ea(ea.mem.off +
-                                           (idx << state->sib_scale)),
+                                           idx * (1 << state->sib_scale)),
                                NULL, 0, ctxt);
             if ( rc == X86EMUL_EXCEPTION )
             {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jul 31 15:44:37 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 31 Jul 2020 15:44:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1k1XD3-0004AL-5W; Fri, 31 Jul 2020 15:44:37 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=hW1S=BK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k1XD2-0004A8-4b
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 15:44:36 +0000
X-Inumbo-ID: bbfc9378-d344-11ea-abdc-12813bfff9fa
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id bbfc9378-d344-11ea-abdc-12813bfff9fa;
 Fri, 31 Jul 2020 15:44:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=rVgQ6h+HI+brhLqUKVbx9crFoAVx00f8HhmsM/q1BR8=; b=RmfC1sDycOPAw/C+wxWYkNqF0S
 rE6ZioNjEhiuK/IF/WIvdFSXHDyUyLa8aQeZG52QKcxUSIed1MHkxuzb5Ba6vxb14khyVdpoQgp+Z
 iVn4NaPJ2tNt9D38m6Wy8zpoLYQOs3qKoqv0ayjnZlwE7fiATZSCY9rw0PbdepNS9JZs=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k1XD1-0005I3-75
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 15:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k1XD1-0003Xp-5m
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 15:44:35 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/hvm: set 'ipat' in EPT for special pages
Message-Id: <E1k1XD1-0003Xp-5m@xenbits.xenproject.org>
Date: Fri, 31 Jul 2020 15:44:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit ca24b2ffdbd9a25b2d313a547ccbe97baf3e5a8d
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Fri Jul 31 17:42:47 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 31 17:42:47 2020 +0200

    x86/hvm: set 'ipat' in EPT for special pages
    
    All non-MMIO ranges (i.e those not mapping real device MMIO regions) that
    map valid MFNs are normally marked MTRR_TYPE_WRBACK and 'ipat' is set. Hence
    when PV drivers running in a guest populate the BAR space of the Xen Platform
    PCI Device with pages such as the Shared Info page or Grant Table pages,
    accesses to these pages will be cachable.
    
    However, should IOMMU mappings be enabled be enabled for the guest then these
    accesses become uncachable. This has a substantial negative effect on I/O
    throughput of PV devices. Arguably PV drivers should bot be using BAR space to
    host the Shared Info and Grant Table pages but it is currently commonplace for
    them to do this and so this problem needs mitigation. Hence this patch makes
    sure the 'ipat' bit is set for any special page regardless of where in GFN
    space it is mapped.
    
    NOTE: Clearly this mitigation only applies to Intel EPT. It is not obvious
          that there is any similar mitigation possible for AMD NPT. Downstreams
          such as Citrix XenServer have been carrying a patch similar to this for
          several releases though.
    
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/mtrr.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 511c3be1c8..2bd64e8025 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -794,6 +794,7 @@ int epte_get_entry_emt(struct domain *d, unsigned long gfn, mfn_t mfn,
 {
     int gmtrr_mtype, hmtrr_mtype;
     struct vcpu *v = current;
+    unsigned long i;
 
     *ipat = 0;
 
@@ -836,6 +837,17 @@ int epte_get_entry_emt(struct domain *d, unsigned long gfn, mfn_t mfn,
         return MTRR_TYPE_WRBACK;
     }
 
+    for ( i = 0; i < (1ul << order); i++ )
+    {
+        if ( is_special_page(mfn_to_page(mfn_add(mfn, i))) )
+        {
+            if ( order )
+                return -1;
+            *ipat = 1;
+            return MTRR_TYPE_WRBACK;
+        }
+    }
+
     gmtrr_mtype = hvm_get_mem_pinned_cacheattr(d, _gfn(gfn), order);
     if ( gmtrr_mtype >= 0 )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Jul 31 15:44:48 2020
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 31 Jul 2020 15:44:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1k1XDE-0004CI-7E; Fri, 31 Jul 2020 15:44:48 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=hW1S=BK=eu.citrix.com=ian.jackson@srs-us1.protection.inumbo.net>)
 id 1k1XDD-0004C1-1X
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 15:44:47 +0000
X-Inumbo-ID: c1f871fc-d344-11ea-8e61-bc764e2007e4
Received: from mail.xenproject.org (unknown [104.130.215.37])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id c1f871fc-d344-11ea-8e61-bc764e2007e4;
 Fri, 31 Jul 2020 15:44:45 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
 s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From:Sender:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=ftvPZyiIWzsS6uBreoAnNnoWVgM7+IHlwMglTf2N0IY=; b=jO/kfoIKbkF2hJIIJkHYuZtM0F
 tMmjACC2u21+VvQiSz57y125o24ZLvDGb5/98tgCc9qy9xt6wurkfKXXoDGiz2Q6fwy5f8XPpEzzT
 7u2xrHgrOJS/uD2y9Nm+t78fIMDU1c+Zky9wAXgYb/Z6EYKK9eo9P3VsSQsRxQW1foTM=;
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k1XDB-0005ID-AB
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 15:44:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1k1XDB-0003Ys-9L
 for xen-changelog@lists.xenproject.org; Fri, 31 Jul 2020 15:44:45 +0000
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Subject: [xen staging] x86/hvm: simplify 'mmio_direct' check in
 epte_get_entry_emt()
Message-Id: <E1k1XDB-0003Ys-9L@xenbits.xenproject.org>
Date: Fri, 31 Jul 2020 15:44:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Reply-To: xen-devel@lists.xenproject.org
Errors-To: xen-changelog-bounces@lists.xenproject.org
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>

commit 81fd0d3ca4b2cd309403c6e8da662c325dd35750
Author:     Paul Durrant <pdurrant@amazon.com>
AuthorDate: Fri Jul 31 17:43:31 2020 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jul 31 17:43:31 2020 +0200

    x86/hvm: simplify 'mmio_direct' check in epte_get_entry_emt()
    
    Re-factor the code to take advantage of the fact that the APIC access page is
    a 'special' page. The VMX code is left alone and hence the APIC access page is
    still inserted into the P2M with type p2m_mmio_direct. This is left alone as it
    is not obvious there is another suitable type to use, and the necessary
    re-ordering in epte_get_entry_emt() is straightforward.
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Paul Durrant <pdurrant@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/mtrr.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 2bd64e8025..fb051d59c3 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -815,23 +815,13 @@ int epte_get_entry_emt(struct domain *d, unsigned long gfn, mfn_t mfn,
         return -1;
     }
 
-    if ( direct_mmio )
-    {
-        if ( (mfn_x(mfn) ^ mfn_x(d->arch.hvm.vmx.apic_access_mfn)) >> order )
-            return MTRR_TYPE_UNCACHABLE;
-        if ( order )
-            return -1;
-        *ipat = 1;
-        return MTRR_TYPE_WRBACK;
-    }
-
     if ( !mfn_valid(mfn) )
     {
         *ipat = 1;
         return MTRR_TYPE_UNCACHABLE;
     }
 
-    if ( !is_iommu_enabled(d) && !cache_flush_permitted(d) )
+    if ( !direct_mmio && !is_iommu_enabled(d) && !cache_flush_permitted(d) )
     {
         *ipat = 1;
         return MTRR_TYPE_WRBACK;
@@ -848,6 +838,9 @@ int epte_get_entry_emt(struct domain *d, unsigned long gfn, mfn_t mfn,
         }
     }
 
+    if ( direct_mmio )
+        return MTRR_TYPE_UNCACHABLE;
+
     gmtrr_mtype = hvm_get_mem_pinned_cacheattr(d, _gfn(gfn), order);
     if ( gmtrr_mtype >= 0 )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


